master
zhuqing 2 years ago
parent 4d6a8e25eb
commit 654b8f61e6

@ -1,10 +1,8 @@
package com.ruoyi.web.controller.pc;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.system.domain.TPatient;
import com.ruoyi.system.domain.resp.PlatformDayPlanResp;
import com.ruoyi.system.domain.resp.WeekMonthPersonCountResp;
import com.ruoyi.system.service.ITRecordService;
import com.ruoyi.system.service.impl.PlatformService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -62,7 +60,18 @@ public class PlatformController {
public AjaxResult ageCount(
@ApiParam(name = "hospitalId",value = "医院id",required = false) @RequestParam(required = false) Long hospitalId,
@ApiParam(name = "doctorId",value = "医生id",required = false) @RequestParam(required = false) Long doctorId){
List<TPatient> tPatients = platformService.ageCount(hospitalId,doctorId);
return AjaxResult.success(tPatients);
Map<String,Long> map = platformService.ageCount(hospitalId,doctorId);
return AjaxResult.success(map);
}
@ApiOperation("工作台-就诊时段统计")
@PostMapping("/weekMonthTimeCount")
public AjaxResult weekMonthTimeCount(
@ApiParam(name = "hospitalId",value = "医院id",required = false) @RequestParam(required = false) Long hospitalId,
@ApiParam(name = "doctorId",value = "医生id",required = false) @RequestParam(required = false) Long doctorId,
@ApiParam(name = "weekMonth",value = "周月的区分 1-周 2-月",required = false) @RequestParam(required = false) Long weekMonth){
Map<String,Integer> weekMonthPersonCountResps = platformService.weekMonthTimeCount(hospitalId, doctorId,weekMonth);
return AjaxResult.success(weekMonthPersonCountResps);
}
}

@ -17,12 +17,8 @@ public class PcTDoctorUpdateReq {
@ApiModelProperty("id")
private Long id;
/** 用户ID */
@ApiModelProperty("用户ID")
private Long userId;
/** 编号 */
@ApiModelProperty("号")
@ApiModelProperty("工作证号")
private String identifier;
/** 名称 */
@ -33,18 +29,6 @@ public class PcTDoctorUpdateReq {
@ApiModelProperty("电话")
private String phone;
/** 用户性别0男 1女 2未知 */
@ApiModelProperty("用户性别0男 1女 2未知 ")
private String sex;
/** 年龄 */
@ApiModelProperty("年龄")
private Integer age;
/** 婚姻状态0未婚 1已婚 2未知 */
@ApiModelProperty("婚姻状态0未婚 1已婚 2未知 ")
private String marriage;
/** 职称 */
@ApiModelProperty("职称")
private String title;
@ -53,12 +37,8 @@ public class PcTDoctorUpdateReq {
@ApiModelProperty("专长")
private String speciality;
/** 简介 */
@ApiModelProperty("简介")
private String introduction;
/** 职业医师照片路径 */
@ApiModelProperty("职业医师照片路径")
@ApiModelProperty("职业医师照片base64")
private String medicalLicense;
/** 二维码base64 */
@ -77,14 +57,6 @@ public class PcTDoctorUpdateReq {
this.id = id;
}
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public String getIdentifier() {
return identifier;
}
@ -109,30 +81,6 @@ public class PcTDoctorUpdateReq {
this.phone = phone;
}
public String getSex() {
return sex;
}
public void setSex(String sex) {
this.sex = sex;
}
public Integer getAge() {
return age;
}
public void setAge(Integer age) {
this.age = age;
}
public String getMarriage() {
return marriage;
}
public void setMarriage(String marriage) {
this.marriage = marriage;
}
public String getTitle() {
return title;
}
@ -149,14 +97,6 @@ public class PcTDoctorUpdateReq {
this.speciality = speciality;
}
public String getIntroduction() {
return introduction;
}
public void setIntroduction(String introduction) {
this.introduction = introduction;
}
public String getMedicalLicense() {
return medicalLicense;
}
@ -185,16 +125,11 @@ public class PcTDoctorUpdateReq {
public String toString() {
return "PcTDoctorUpdateReq{" +
"id=" + id +
", userId=" + userId +
", identifier='" + identifier + '\'' +
", name='" + name + '\'' +
", phone='" + phone + '\'' +
", sex='" + sex + '\'' +
", age=" + age +
", marriage='" + marriage + '\'' +
", title='" + title + '\'' +
", speciality='" + speciality + '\'' +
", introduction='" + introduction + '\'' +
", medicalLicense='" + medicalLicense + '\'' +
", qrCode='" + qrCode + '\'' +
", hospitalId=" + hospitalId +

@ -84,6 +84,19 @@ public class PcTDoctorQueryByPageResp {
@ApiModelProperty("患者个数")
private int countPatints;
/** 最近一次就诊时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty("最近一次就诊时间")
private Date latestTime;
public Date getLatestTime() {
return latestTime;
}
public void setLatestTime(Date latestTime) {
this.latestTime = latestTime;
}
public Long getId() {
return id;
}

@ -0,0 +1,35 @@
package com.ruoyi.system.domain.resp;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
/**
* @Author zhuqing
* @Date 2022/8/9
*/
public class WeekMonthTimeResp {
@ApiModelProperty("count")
private int count;
@ApiModelProperty("创建时间/小时")
private Integer createTime;
public int getCount() {
return count;
}
public void setCount(int count) {
this.count = count;
}
public Integer getCreateTime() {
return createTime;
}
public void setCreateTime(Integer createTime) {
this.createTime = createTime;
}
}

@ -10,6 +10,7 @@ import com.ruoyi.system.domain.req.TRecordResultReq;
import com.ruoyi.system.domain.resp.PlatformDayPlanResp;
import com.ruoyi.system.domain.resp.TRecordResp;
import com.ruoyi.system.domain.resp.WeekMonthPersonCountResp;
import com.ruoyi.system.domain.resp.WeekMonthTimeResp;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -59,9 +60,26 @@ public interface TRecordMapper
@Param("weekMonth")Long weekMonth);
/**
*
* @param hospitalId
* @param doctorId
* @return
*/
List<TPatient> ageCount(@Param("hospitalId")Long hospitalId,
@Param("doctorId")Long doctorId);
/**
*
* @param hospitalId
* @param doctorId
* @param weekMonth
* @return
*/
List<WeekMonthTimeResp> weekMonthTimeCount(@Param("hospitalId")Long hospitalId,
@Param("doctorId")Long doctorId,
@Param("weekMonth")Long weekMonth);
/**
*
*

@ -3,10 +3,12 @@ package com.ruoyi.system.service.impl;
import com.ruoyi.system.domain.TPatient;
import com.ruoyi.system.domain.resp.PlatformDayPlanResp;
import com.ruoyi.system.domain.resp.WeekMonthPersonCountResp;
import com.ruoyi.system.domain.resp.WeekMonthTimeResp;
import com.ruoyi.system.mapper.TRecordMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.text.SimpleDateFormat;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -66,7 +68,56 @@ public class PlatformService {
return tRecordMapper.weekMonthPersonCount(hospitalId, doctorId,weekMonth);
}
public List<TPatient> ageCount(Long hospitalId, Long doctorId) {
return tRecordMapper.ageCount(hospitalId, doctorId);
/**
*
* @param hospitalId
* @param doctorId
* @return
*/
public Map<String,Long> ageCount(Long hospitalId, Long doctorId) {
List<TPatient> tPatients = tRecordMapper.ageCount(hospitalId, doctorId);
//20-30
long count20 = tPatients.stream().filter(a -> a.getAge() >= 20 && a.getAge() <= 30).count();
//31-40
long count31 = tPatients.stream().filter(a -> a.getAge() >= 31 && a.getAge() <= 40).count();
//41-50
long count41 = tPatients.stream().filter(a -> a.getAge() >= 41 && a.getAge() <= 50).count();
//51-
long count51 = tPatients.stream().filter(a -> a.getAge() >= 51).count();
Map<String,Long> map = new HashMap<String,Long>(){{
put("count20",count20);
put("count31",count31);
put("count41",count41);
put("count51",count51);
}};
return map;
}
/**
*
* @param hospitalId
* @param doctorId
* @param weekMonth
* @return
*/
public Map<String,Integer> weekMonthTimeCount(Long hospitalId,Long doctorId,Long weekMonth){
Map<String,Integer> map = new HashMap<>();
List<WeekMonthTimeResp> weekMonthTimeResps = tRecordMapper.weekMonthTimeCount(hospitalId, doctorId, weekMonth);
//0-3
int sum0 = weekMonthTimeResps.stream().filter(a -> a.getCreateTime() >= 0 && a.getCreateTime() < 3).mapToInt(WeekMonthTimeResp::getCount).sum();
//3-6
int sum3 = weekMonthTimeResps.stream().filter(a -> a.getCreateTime() >= 3 && a.getCreateTime() < 6).mapToInt(WeekMonthTimeResp::getCount).sum();
//6-9
int sum6 = weekMonthTimeResps.stream().filter(a -> a.getCreateTime() >= 6 && a.getCreateTime() < 9).mapToInt(WeekMonthTimeResp::getCount).sum();
//9-12
int sum9 = weekMonthTimeResps.stream().filter(a -> a.getCreateTime() >= 9 && a.getCreateTime() < 12).mapToInt(WeekMonthTimeResp::getCount).sum();
//12-15
int sum12 = weekMonthTimeResps.stream().filter(a -> a.getCreateTime() >= 12 && a.getCreateTime() < 15).mapToInt(WeekMonthTimeResp::getCount).sum();
//15-18
int sum15 = weekMonthTimeResps.stream().filter(a -> a.getCreateTime() >= 15 && a.getCreateTime() < 18).mapToInt(WeekMonthTimeResp::getCount).sum();
//18-21
int sum18 = weekMonthTimeResps.stream().filter(a -> a.getCreateTime() >= 18 && a.getCreateTime() <= 21).mapToInt(WeekMonthTimeResp::getCount).sum();
map.put("sum0",sum0);map.put("sum3",sum3);map.put("sum6",sum6);map.put("sum9",sum9);map.put("sum12",sum12);map.put("sum15",sum15);map.put("sum18",sum18);
return map;
}
}

@ -127,14 +127,35 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="weekMonth == 2">
(select * from t_record where DATE_SUB(CURDATE(), INTERVAL 30 DAY) &lt;= date(create_time)) X
</if>
where 1 = 1
where X.status = '1'
<if test="doctorId != null "> and X.doctor_id = #{doctorId}</if>
<if test="hospitalId != null "> and X.hospital_id = #{hospitalId}</if>
group by date_format(X.create_time, '%Y-%m-%d');
</select>
<select id="ageCount" resultType="com.ruoyi.system.domain.TPatient">
SELECT
a.id,a.age
from t_patient a
inner JOIN t_record b on a.id = b.patient_id
where 1 = 1
<if test="doctorId != null "> and b.doctor_id = #{doctorId}</if>
<if test="hospitalId != null "> and b.hospital_id = #{hospitalId}</if>
</select>
<select id="weekMonthTimeCount" resultType="com.ruoyi.system.domain.resp.WeekMonthTimeResp">
select date_format(create_time, '%H') createTime, count(*) count
from
<if test="weekMonth == 1 || weekMonth == null">
(select * from t_record where DATE_SUB(CURDATE(), INTERVAL 7 DAY) &lt;= date(create_time)) X
</if>
<if test="weekMonth == 2">
(select * from t_record where DATE_SUB(CURDATE(), INTERVAL 30 DAY) &lt;= date(create_time)) X
</if>
where X.status = '1'
<if test="doctorId != null "> and X.doctor_id = #{doctorId}</if>
<if test="hospitalId != null "> and X.hospital_id = #{hospitalId}</if>
group by date_format(X.create_time, '%H');
</select>
<!--====================工作台相关接口=====================-->

Loading…
Cancel
Save