diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/pc/PlatformController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/pc/PlatformController.java index 92696ff..42861c2 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/pc/PlatformController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/pc/PlatformController.java @@ -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 tPatients = platformService.ageCount(hospitalId,doctorId); - return AjaxResult.success(tPatients); + Map 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 weekMonthPersonCountResps = platformService.weekMonthTimeCount(hospitalId, doctorId,weekMonth); + return AjaxResult.success(weekMonthPersonCountResps); + } + } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/req/PcTDoctorUpdateReq.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/req/PcTDoctorUpdateReq.java index 53997a2..da41d40 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/req/PcTDoctorUpdateReq.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/req/PcTDoctorUpdateReq.java @@ -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 + diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/resp/PcTDoctorQueryByPageResp.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/resp/PcTDoctorQueryByPageResp.java index 1d1f980..9c6a617 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/resp/PcTDoctorQueryByPageResp.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/resp/PcTDoctorQueryByPageResp.java @@ -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; } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/resp/WeekMonthTimeResp.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/resp/WeekMonthTimeResp.java new file mode 100644 index 0000000..c20085f --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/resp/WeekMonthTimeResp.java @@ -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; + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/TRecordMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/TRecordMapper.java index 01f05db..9c4e431 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/TRecordMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/TRecordMapper.java @@ -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 ageCount(@Param("hospitalId")Long hospitalId, @Param("doctorId")Long doctorId); + /** + * 就诊时段统计 + * @param hospitalId + * @param doctorId + * @param weekMonth + * @return + */ + List weekMonthTimeCount(@Param("hospitalId")Long hospitalId, + @Param("doctorId")Long doctorId, + @Param("weekMonth")Long weekMonth); + /** * 查询诊断记录信息 * diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/PlatformService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/PlatformService.java index e01cc65..c02e8aa 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/PlatformService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/PlatformService.java @@ -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 ageCount(Long hospitalId, Long doctorId) { - return tRecordMapper.ageCount(hospitalId, doctorId); + /** + * 年龄分布 + * @param hospitalId + * @param doctorId + * @return + */ + public Map ageCount(Long hospitalId, Long doctorId) { + List 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 map = new HashMap(){{ + put("count20",count20); + put("count31",count31); + put("count41",count41); + put("count51",count51); + }}; + return map; + } + + /** + * 就诊时段统计 + * @param hospitalId + * @param doctorId + * @param weekMonth + * @return + */ + public Map weekMonthTimeCount(Long hospitalId,Long doctorId,Long weekMonth){ + Map map = new HashMap<>(); + List 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; } } diff --git a/ruoyi-system/src/main/resources/mapper/system/TRecordMapper.xml b/ruoyi-system/src/main/resources/mapper/system/TRecordMapper.xml index f1b2555..600d0e4 100644 --- a/ruoyi-system/src/main/resources/mapper/system/TRecordMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/TRecordMapper.xml @@ -127,14 +127,35 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" (select * from t_record where DATE_SUB(CURDATE(), INTERVAL 30 DAY) <= date(create_time)) X - where 1 = 1 + where X.status = '1' and X.doctor_id = #{doctorId} and X.hospital_id = #{hospitalId} group by date_format(X.create_time, '%Y-%m-%d'); +