From 8f24d5a2bbe37d0b00d7cbfe0b90c87f0f65325c Mon Sep 17 00:00:00 2001 From: zzc Date: Wed, 19 Feb 2025 11:56:59 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../web/AdminStatisticsController.java | 65 +++ .../web/FmsFollowupQueueController.java | 35 -- .../web/PmsTreatmentController.java | 29 +- .../controller/web/StatisticsController.java | 2 +- .../src/main/resources/application-stage.yml | 3 +- .../src/main/resources/application.yml | 2 +- .../common/constant/DiseaseMapping.java | 29 ++ .../src/main/resources/mbg.xml | 2 +- .../system/domain/dto/AdminStatisticsDto.java | 26 ++ .../system/domain/dto/PmsTreatmentDto.java | 3 + .../domain/po/FmsPatientQueueRelation.java | 57 ++- .../po/FmsPatientQueueRelationExample.java | 276 ++++++++----- .../domain/po/FmsPatientQueueRelationKey.java | 11 + .../system/domain/vo/AdminStatisticsVo.java | 389 ++++++++++++++++++ .../system/domain/vo/FmsFollowupVo.java | 9 +- .../system/domain/vo/PmsTreatmentVo.java | 8 + .../system/domain/vo/StatisticsVo.java | 50 +-- .../system/persist/dao/AdminTongjiDao.java | 88 ++++ .../system/persist/dao/FmsFollowupDao.java | 3 + .../system/persist/dao/StatisticsDao.java | 4 +- .../mapper/FmsPatientQueueRelationMapper.java | 5 +- .../service/AdminStatisticsService.java | 55 +++ .../system/service/PmsTreatmentService.java | 9 + .../system/service/StatisticsService.java | 2 +- .../impl/AdminStatisticsServiceImpl.java | 121 ++++++ .../impl/FmsFollowupQueueServiceImpl.java | 17 +- .../service/impl/FmsFollowupServiceImpl.java | 54 ++- .../service/impl/PmsTreatmentServiceImpl.java | 157 +++++++ .../service/impl/StatisticsServiceImpl.java | 73 ++-- .../resources/mapper/dao/AdminTongjiDao.xml | 306 ++++++++++++++ .../resources/mapper/dao/FmsFollowupDao.xml | 73 +++- .../resources/mapper/dao/PmsPatientDao.xml | 3 +- .../resources/mapper/dao/PmsTreatmentDao.xml | 108 ++--- .../resources/mapper/dao/StatisticsDao.xml | 89 ++-- .../system/FmsPatientQueueRelationMapper.xml | 119 +++--- 35 files changed, 1876 insertions(+), 406 deletions(-) create mode 100644 acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/AdminStatisticsController.java delete mode 100644 acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/FmsFollowupQueueController.java create mode 100644 acupuncture-common/src/main/java/com/acupuncture/common/constant/DiseaseMapping.java create mode 100644 acupuncture-system/src/main/java/com/acupuncture/system/domain/dto/AdminStatisticsDto.java create mode 100644 acupuncture-system/src/main/java/com/acupuncture/system/domain/vo/AdminStatisticsVo.java create mode 100644 acupuncture-system/src/main/java/com/acupuncture/system/persist/dao/AdminTongjiDao.java create mode 100644 acupuncture-system/src/main/java/com/acupuncture/system/service/AdminStatisticsService.java create mode 100644 acupuncture-system/src/main/java/com/acupuncture/system/service/impl/AdminStatisticsServiceImpl.java create mode 100644 acupuncture-system/src/main/resources/mapper/dao/AdminTongjiDao.xml diff --git a/acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/AdminStatisticsController.java b/acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/AdminStatisticsController.java new file mode 100644 index 00000000..cc3e895b --- /dev/null +++ b/acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/AdminStatisticsController.java @@ -0,0 +1,65 @@ +package com.acupuncture.web.controller.web; + +import com.acupuncture.common.core.domain.JsonResponse; +import com.acupuncture.system.domain.dto.StatisticsDto; +import com.acupuncture.system.domain.vo.AdminStatisticsVo; +import com.acupuncture.system.service.AdminStatisticsService; +import com.acupuncture.system.service.StatisticsService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.annotation.Resource; +import java.util.List; + +/** + * @Author zzc + * @Package com.acupuncture.web.controller.web + * @Date 2025/2/13 8:58 + * @description: + */ +@Slf4j +@Api(tags = "统计相关") +@RestController +@RequestMapping("/admin/statistics") +public class AdminStatisticsController { + + @Resource + private AdminStatisticsService statisticsService; + + @ApiOperation("患者统计") + @PostMapping("/patientTotal") + public JsonResponse queryPatientStatistics(@RequestBody @Validated StatisticsDto.Query dto) { + return JsonResponse.ok(statisticsService.queryPatientStatistics(dto)); + } + + @ApiOperation("诊疗统计") + @PostMapping("/zlInfo") + public JsonResponse queryZlStatistics(@RequestBody @Validated StatisticsDto.Query dto) { + return JsonResponse.ok(statisticsService.queryZlStatistics(dto)); + } + + @ApiOperation("治疗类型统计") + @PostMapping("/zlType") + public JsonResponse queryZlTypeStatistics(@RequestBody @Validated StatisticsDto.Query dto) { + return JsonResponse.ok(statisticsService.queryZlTypeStatistics(dto)); + } + + @ApiOperation("随访分布统计") + @PostMapping("/sffb") + public JsonResponse> querySfStatistics(@RequestBody @Validated StatisticsDto.Query dto) { + return JsonResponse.ok(statisticsService.querySfStatistics(dto)); + } + + @ApiOperation("失访统计") + @PostMapping("/sftj") + public JsonResponse> querySfTjStatistics(@RequestBody @Validated StatisticsDto.Query dto) { + return JsonResponse.ok(statisticsService.querySfTjStatistics(dto)); + } + +} diff --git a/acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/FmsFollowupQueueController.java b/acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/FmsFollowupQueueController.java deleted file mode 100644 index 97f61694..00000000 --- a/acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/FmsFollowupQueueController.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.acupuncture.web.controller.web; - -import com.acupuncture.common.core.domain.BaseDto; -import com.acupuncture.common.core.domain.JsonResponse; -import com.acupuncture.system.domain.dto.FmsFollowupDto; -import com.acupuncture.system.domain.vo.FmsFollowupVo; -import com.acupuncture.system.service.FmsFollowupQueueService; -import com.github.pagehelper.PageHelper; -import com.github.pagehelper.PageInfo; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import lombok.extern.slf4j.Slf4j; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -import javax.annotation.Resource; - -/** - * @Author zzc - * @Package com.acupuncture.web.controller.web - * @Date 2025/2/10 16:59 - * @description: - */ -@Slf4j -@Api(tags = "随访相关") -@RestController -@RequestMapping("/followup") -public class FmsFollowupQueueController { - - - -} diff --git a/acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/PmsTreatmentController.java b/acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/PmsTreatmentController.java index 8d8c06fa..2f0768b1 100644 --- a/acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/PmsTreatmentController.java +++ b/acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/PmsTreatmentController.java @@ -9,14 +9,18 @@ import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; +import io.swagger.models.auth.In; import lombok.extern.slf4j.Slf4j; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.multipart.MultipartFile; import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; import java.util.List; /** @@ -36,28 +40,28 @@ public class PmsTreatmentController { @ApiOperation("添加诊疗档案") @PostMapping("/add") - public JsonResponse addTreatment(@RequestBody @Validated PmsTreatmentDto.TreatmentAdd dto){ + public JsonResponse addTreatment(@RequestBody @Validated PmsTreatmentDto.TreatmentAdd dto) { treatmentService.addTreatment(dto); return JsonResponse.ok(); } @ApiOperation("修改诊疗档案") @PostMapping("/upd") - public JsonResponse updateTreatment(@RequestBody @Validated PmsTreatmentDto.TreatmentUpdateDTO dto){ + public JsonResponse updateTreatment(@RequestBody @Validated PmsTreatmentDto.TreatmentUpdateDTO dto) { treatmentService.updateTreatment(dto); return JsonResponse.ok(); } @ApiOperation("删除诊疗档案") @PostMapping("/del") - public JsonResponse deleteTreatment(@RequestBody @Validated PmsTreatmentDto.DeleteDto dto){ + public JsonResponse deleteTreatment(@RequestBody @Validated PmsTreatmentDto.DeleteDto dto) { treatmentService.deleteTreatment(dto.getIdList()); return JsonResponse.ok(); } @ApiOperation("查询诊疗档案") @PostMapping("/list") - public JsonResponse> listTreatment(@RequestBody @Validated BaseDto queryDTO){ + public JsonResponse> listTreatment(@RequestBody @Validated BaseDto queryDTO) { if (queryDTO.getPageNum() > 0) { PageHelper.startPage(queryDTO.getPageNum(), queryDTO.getPageSize()); } @@ -66,14 +70,27 @@ public class PmsTreatmentController { @ApiOperation("新增诊疗档案数据") @PostMapping("/saveAidRecord") - public JsonResponse saveAidRecord(@RequestBody @Validated PmsTreatmentDto.SaveAidRecord dto){ + public JsonResponse saveAidRecord(@RequestBody @Validated PmsTreatmentDto.SaveAidRecord dto) { treatmentService.saveAidRecord(dto); return JsonResponse.ok(); } @ApiOperation("查询诊疗档案数据") @PostMapping("/queryRecord") - public JsonResponse queryRecord(@RequestBody @Validated PmsTreatmentDto.QueryRecord dto){ + public JsonResponse queryRecord(@RequestBody @Validated PmsTreatmentDto.QueryRecord dto) { return JsonResponse.ok(treatmentService.queryRecord(dto.getTreatmentId(), dto.getCodeList())); } + + @ApiOperation("导出诊疗档案数据") + @PostMapping("/exportTreatment") + public void exportTreatment(HttpServletResponse response, @RequestBody @Validated PmsTreatmentDto.TreatmentQueryDTO dto) { + treatmentService.exportTreatment(response, dto); + } + + @ApiOperation("导入诊疗档案数据") + @PostMapping("/importTreatment") + public JsonResponse importTreatment(MultipartFile file) throws IOException { + treatmentService.importTreatment(file); + return JsonResponse.ok(); + } } diff --git a/acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/StatisticsController.java b/acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/StatisticsController.java index 4ba4cddc..26ff26f9 100644 --- a/acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/StatisticsController.java +++ b/acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/StatisticsController.java @@ -51,7 +51,7 @@ public class StatisticsController { @ApiOperation("随访分布统计") @PostMapping("/sffb") - public JsonResponse querySfStatistics(@RequestBody @Validated StatisticsDto.Query dto) { + public JsonResponse> querySfStatistics(@RequestBody @Validated StatisticsDto.Query dto) { return JsonResponse.ok(statisticsService.querySfStatistics(dto)); } diff --git a/acupuncture-admin/src/main/resources/application-stage.yml b/acupuncture-admin/src/main/resources/application-stage.yml index 846ba2a5..081be83f 100644 --- a/acupuncture-admin/src/main/resources/application-stage.yml +++ b/acupuncture-admin/src/main/resources/application-stage.yml @@ -60,4 +60,5 @@ spring: config: multi-statement-allow: true file: - PatientTemplate: C:\Users\zzc16\Desktop\PatientTemplate.xlsx \ No newline at end of file + PatientTemplate: /home/acupuncture/server/profile/PatientTemplate.xlsx + TreamentTemplate: /home/acupuncture/server/profile/PatientTemplate.xlsx \ No newline at end of file diff --git a/acupuncture-admin/src/main/resources/application.yml b/acupuncture-admin/src/main/resources/application.yml index 6bb95bc2..5e6b60b6 100644 --- a/acupuncture-admin/src/main/resources/application.yml +++ b/acupuncture-admin/src/main/resources/application.yml @@ -7,7 +7,7 @@ acupuncture: # 版权年份 copyrightYear: 2025 # 文件路径 示例( Windows配置D:/acupuncture/uploadPath,Linux配置 /home/acupuncture/uploadPath) - profile: /home/acupuncture/uploadPath + profile: /home/acupuncture/server/profile # 获取ip地址开关 addressEnabled: false # 验证码类型 math 数字计算 char 字符验证 diff --git a/acupuncture-common/src/main/java/com/acupuncture/common/constant/DiseaseMapping.java b/acupuncture-common/src/main/java/com/acupuncture/common/constant/DiseaseMapping.java new file mode 100644 index 00000000..e9e7aa17 --- /dev/null +++ b/acupuncture-common/src/main/java/com/acupuncture/common/constant/DiseaseMapping.java @@ -0,0 +1,29 @@ +package com.acupuncture.common.constant; + +import java.util.HashMap; +import java.util.Map; + +/** + * @Author zzc + * @Package com.acupuncture.common.constant + * @Date 2025/2/18 9:37 + * @description: + */ +public class DiseaseMapping { + public static final Map DISEASE_MAP = new HashMap<>(); + + static { + DISEASE_MAP.put("E66.0", "肥胖症"); + DISEASE_MAP.put("BNX040", "失眠病"); + DISEASE_MAP.put("F51.0", "失眠病"); + DISEASE_MAP.put("BNG080", "中风病"); + DISEASE_MAP.put("I63", "中风病"); + DISEASE_MAP.put("BWV120", "面瘫病"); + DISEASE_MAP.put("G51.802", "面瘫病"); + DISEASE_MAP.put("BGS000", "项痹病"); + DISEASE_MAP.put("M47.221+G55.2*", "项痹病"); + DISEASE_MAP.put("M51.202", "腰痛病"); + DISEASE_MAP.put("BNG090", "痉挛性斜颈"); + DISEASE_MAP.put("G24.300", "痉挛性斜颈"); + } +} diff --git a/acupuncture-generator/src/main/resources/mbg.xml b/acupuncture-generator/src/main/resources/mbg.xml index 40131f6a..4df469e8 100644 --- a/acupuncture-generator/src/main/resources/mbg.xml +++ b/acupuncture-generator/src/main/resources/mbg.xml @@ -20,7 +20,7 @@ diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/domain/dto/AdminStatisticsDto.java b/acupuncture-system/src/main/java/com/acupuncture/system/domain/dto/AdminStatisticsDto.java new file mode 100644 index 00000000..6051065c --- /dev/null +++ b/acupuncture-system/src/main/java/com/acupuncture/system/domain/dto/AdminStatisticsDto.java @@ -0,0 +1,26 @@ +package com.acupuncture.system.domain.dto; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.Date; + +/** + * @Author zzc + * @Package com.acupuncture.system.domain.dto + * @Date 2025/2/13 10:52 + * @description: + */ +public class AdminStatisticsDto { + + @Data + public static class Query { + @ApiModelProperty("开始时间") + private Date startTime; + @ApiModelProperty("结束时间") + private Date endTime; + @ApiModelProperty("统计方式 0:周 1:月 2:季 3:年") + private Integer timeType; + } + +} diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/domain/dto/PmsTreatmentDto.java b/acupuncture-system/src/main/java/com/acupuncture/system/domain/dto/PmsTreatmentDto.java index 1b06ce9b..16b6deb7 100644 --- a/acupuncture-system/src/main/java/com/acupuncture/system/domain/dto/PmsTreatmentDto.java +++ b/acupuncture-system/src/main/java/com/acupuncture/system/domain/dto/PmsTreatmentDto.java @@ -67,6 +67,7 @@ public class PmsTreatmentDto { public static class TreatmentUpdateDTO { private Long id; private String name; + private Long patientId; private Integer gender; private Integer age; @JsonFormat(pattern = "yyyy-MM-dd") @@ -89,6 +90,8 @@ public class PmsTreatmentDto { private String createBy; private String remark; private String updateBy; + @ApiModelProperty("随访队列ID集合") + private List queueIdList; } // TreatmentQueryDTO.java (查询用) diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/domain/po/FmsPatientQueueRelation.java b/acupuncture-system/src/main/java/com/acupuncture/system/domain/po/FmsPatientQueueRelation.java index d3199c6f..16191dab 100644 --- a/acupuncture-system/src/main/java/com/acupuncture/system/domain/po/FmsPatientQueueRelation.java +++ b/acupuncture-system/src/main/java/com/acupuncture/system/domain/po/FmsPatientQueueRelation.java @@ -3,7 +3,11 @@ package com.acupuncture.system.domain.po; import java.io.Serializable; import java.util.Date; -public class FmsPatientQueueRelation extends FmsPatientQueueRelationKey implements Serializable { +public class FmsPatientQueueRelation implements Serializable { + private Long id; + + private Long patientId; + private String name; private String pinyinFull; @@ -24,8 +28,12 @@ public class FmsPatientQueueRelation extends FmsPatientQueueRelationKey implemen private String idCard; + private Date dischargeTime; + private Long tenantId; + private Long queueId; + private Byte delFlag; private String createBy; @@ -38,12 +46,26 @@ public class FmsPatientQueueRelation extends FmsPatientQueueRelationKey implemen private String remark; - private Date dischargeTime; - private Byte taskFlag; private static final long serialVersionUID = 1L; + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Long getPatientId() { + return patientId; + } + + public void setPatientId(Long patientId) { + this.patientId = patientId; + } + public String getName() { return name; } @@ -124,6 +146,14 @@ public class FmsPatientQueueRelation extends FmsPatientQueueRelationKey implemen this.idCard = idCard == null ? null : idCard.trim(); } + public Date getDischargeTime() { + return dischargeTime; + } + + public void setDischargeTime(Date dischargeTime) { + this.dischargeTime = dischargeTime; + } + public Long getTenantId() { return tenantId; } @@ -132,6 +162,14 @@ public class FmsPatientQueueRelation extends FmsPatientQueueRelationKey implemen this.tenantId = tenantId; } + public Long getQueueId() { + return queueId; + } + + public void setQueueId(Long queueId) { + this.queueId = queueId; + } + public Byte getDelFlag() { return delFlag; } @@ -180,14 +218,6 @@ public class FmsPatientQueueRelation extends FmsPatientQueueRelationKey implemen this.remark = remark == null ? null : remark.trim(); } - public Date getDischargeTime() { - return dischargeTime; - } - - public void setDischargeTime(Date dischargeTime) { - this.dischargeTime = dischargeTime; - } - public Byte getTaskFlag() { return taskFlag; } @@ -202,6 +232,8 @@ public class FmsPatientQueueRelation extends FmsPatientQueueRelationKey implemen sb.append(getClass().getSimpleName()); sb.append(" ["); sb.append("Hash = ").append(hashCode()); + sb.append(", id=").append(id); + sb.append(", patientId=").append(patientId); sb.append(", name=").append(name); sb.append(", pinyinFull=").append(pinyinFull); sb.append(", pinyinSimple=").append(pinyinSimple); @@ -212,14 +244,15 @@ public class FmsPatientQueueRelation extends FmsPatientQueueRelationKey implemen sb.append(", phone=").append(phone); sb.append(", idCardType=").append(idCardType); sb.append(", idCard=").append(idCard); + sb.append(", dischargeTime=").append(dischargeTime); sb.append(", tenantId=").append(tenantId); + sb.append(", queueId=").append(queueId); sb.append(", delFlag=").append(delFlag); sb.append(", createBy=").append(createBy); sb.append(", createTime=").append(createTime); sb.append(", updateBy=").append(updateBy); sb.append(", updateTime=").append(updateTime); sb.append(", remark=").append(remark); - sb.append(", dischargeTime=").append(dischargeTime); sb.append(", taskFlag=").append(taskFlag); sb.append("]"); return sb.toString(); diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/domain/po/FmsPatientQueueRelationExample.java b/acupuncture-system/src/main/java/com/acupuncture/system/domain/po/FmsPatientQueueRelationExample.java index 4f9d6f66..4d0cfb21 100644 --- a/acupuncture-system/src/main/java/com/acupuncture/system/domain/po/FmsPatientQueueRelationExample.java +++ b/acupuncture-system/src/main/java/com/acupuncture/system/domain/po/FmsPatientQueueRelationExample.java @@ -132,123 +132,123 @@ public class FmsPatientQueueRelationExample { addCriterion(condition, new java.sql.Date(value1.getTime()), new java.sql.Date(value2.getTime()), property); } - public Criteria andPatientIdIsNull() { - addCriterion("patient_id is null"); + public Criteria andIdIsNull() { + addCriterion("id is null"); return (Criteria) this; } - public Criteria andPatientIdIsNotNull() { - addCriterion("patient_id is not null"); + public Criteria andIdIsNotNull() { + addCriterion("id is not null"); return (Criteria) this; } - public Criteria andPatientIdEqualTo(Long value) { - addCriterion("patient_id =", value, "patientId"); + public Criteria andIdEqualTo(Long value) { + addCriterion("id =", value, "id"); return (Criteria) this; } - public Criteria andPatientIdNotEqualTo(Long value) { - addCriterion("patient_id <>", value, "patientId"); + public Criteria andIdNotEqualTo(Long value) { + addCriterion("id <>", value, "id"); return (Criteria) this; } - public Criteria andPatientIdGreaterThan(Long value) { - addCriterion("patient_id >", value, "patientId"); + public Criteria andIdGreaterThan(Long value) { + addCriterion("id >", value, "id"); return (Criteria) this; } - public Criteria andPatientIdGreaterThanOrEqualTo(Long value) { - addCriterion("patient_id >=", value, "patientId"); + public Criteria andIdGreaterThanOrEqualTo(Long value) { + addCriterion("id >=", value, "id"); return (Criteria) this; } - public Criteria andPatientIdLessThan(Long value) { - addCriterion("patient_id <", value, "patientId"); + public Criteria andIdLessThan(Long value) { + addCriterion("id <", value, "id"); return (Criteria) this; } - public Criteria andPatientIdLessThanOrEqualTo(Long value) { - addCriterion("patient_id <=", value, "patientId"); + public Criteria andIdLessThanOrEqualTo(Long value) { + addCriterion("id <=", value, "id"); return (Criteria) this; } - public Criteria andPatientIdIn(List values) { - addCriterion("patient_id in", values, "patientId"); + public Criteria andIdIn(List values) { + addCriterion("id in", values, "id"); return (Criteria) this; } - public Criteria andPatientIdNotIn(List values) { - addCriterion("patient_id not in", values, "patientId"); + public Criteria andIdNotIn(List values) { + addCriterion("id not in", values, "id"); return (Criteria) this; } - public Criteria andPatientIdBetween(Long value1, Long value2) { - addCriterion("patient_id between", value1, value2, "patientId"); + public Criteria andIdBetween(Long value1, Long value2) { + addCriterion("id between", value1, value2, "id"); return (Criteria) this; } - public Criteria andPatientIdNotBetween(Long value1, Long value2) { - addCriterion("patient_id not between", value1, value2, "patientId"); + public Criteria andIdNotBetween(Long value1, Long value2) { + addCriterion("id not between", value1, value2, "id"); return (Criteria) this; } - public Criteria andQueueIdIsNull() { - addCriterion("queue_id is null"); + public Criteria andPatientIdIsNull() { + addCriterion("patient_id is null"); return (Criteria) this; } - public Criteria andQueueIdIsNotNull() { - addCriterion("queue_id is not null"); + public Criteria andPatientIdIsNotNull() { + addCriterion("patient_id is not null"); return (Criteria) this; } - public Criteria andQueueIdEqualTo(Long value) { - addCriterion("queue_id =", value, "queueId"); + public Criteria andPatientIdEqualTo(Long value) { + addCriterion("patient_id =", value, "patientId"); return (Criteria) this; } - public Criteria andQueueIdNotEqualTo(Long value) { - addCriterion("queue_id <>", value, "queueId"); + public Criteria andPatientIdNotEqualTo(Long value) { + addCriterion("patient_id <>", value, "patientId"); return (Criteria) this; } - public Criteria andQueueIdGreaterThan(Long value) { - addCriterion("queue_id >", value, "queueId"); + public Criteria andPatientIdGreaterThan(Long value) { + addCriterion("patient_id >", value, "patientId"); return (Criteria) this; } - public Criteria andQueueIdGreaterThanOrEqualTo(Long value) { - addCriterion("queue_id >=", value, "queueId"); + public Criteria andPatientIdGreaterThanOrEqualTo(Long value) { + addCriterion("patient_id >=", value, "patientId"); return (Criteria) this; } - public Criteria andQueueIdLessThan(Long value) { - addCriterion("queue_id <", value, "queueId"); + public Criteria andPatientIdLessThan(Long value) { + addCriterion("patient_id <", value, "patientId"); return (Criteria) this; } - public Criteria andQueueIdLessThanOrEqualTo(Long value) { - addCriterion("queue_id <=", value, "queueId"); + public Criteria andPatientIdLessThanOrEqualTo(Long value) { + addCriterion("patient_id <=", value, "patientId"); return (Criteria) this; } - public Criteria andQueueIdIn(List values) { - addCriterion("queue_id in", values, "queueId"); + public Criteria andPatientIdIn(List values) { + addCriterion("patient_id in", values, "patientId"); return (Criteria) this; } - public Criteria andQueueIdNotIn(List values) { - addCriterion("queue_id not in", values, "queueId"); + public Criteria andPatientIdNotIn(List values) { + addCriterion("patient_id not in", values, "patientId"); return (Criteria) this; } - public Criteria andQueueIdBetween(Long value1, Long value2) { - addCriterion("queue_id between", value1, value2, "queueId"); + public Criteria andPatientIdBetween(Long value1, Long value2) { + addCriterion("patient_id between", value1, value2, "patientId"); return (Criteria) this; } - public Criteria andQueueIdNotBetween(Long value1, Long value2) { - addCriterion("queue_id not between", value1, value2, "queueId"); + public Criteria andPatientIdNotBetween(Long value1, Long value2) { + addCriterion("patient_id not between", value1, value2, "patientId"); return (Criteria) this; } @@ -912,6 +912,66 @@ public class FmsPatientQueueRelationExample { return (Criteria) this; } + public Criteria andDischargeTimeIsNull() { + addCriterion("discharge_time is null"); + return (Criteria) this; + } + + public Criteria andDischargeTimeIsNotNull() { + addCriterion("discharge_time is not null"); + return (Criteria) this; + } + + public Criteria andDischargeTimeEqualTo(Date value) { + addCriterion("discharge_time =", value, "dischargeTime"); + return (Criteria) this; + } + + public Criteria andDischargeTimeNotEqualTo(Date value) { + addCriterion("discharge_time <>", value, "dischargeTime"); + return (Criteria) this; + } + + public Criteria andDischargeTimeGreaterThan(Date value) { + addCriterion("discharge_time >", value, "dischargeTime"); + return (Criteria) this; + } + + public Criteria andDischargeTimeGreaterThanOrEqualTo(Date value) { + addCriterion("discharge_time >=", value, "dischargeTime"); + return (Criteria) this; + } + + public Criteria andDischargeTimeLessThan(Date value) { + addCriterion("discharge_time <", value, "dischargeTime"); + return (Criteria) this; + } + + public Criteria andDischargeTimeLessThanOrEqualTo(Date value) { + addCriterion("discharge_time <=", value, "dischargeTime"); + return (Criteria) this; + } + + public Criteria andDischargeTimeIn(List values) { + addCriterion("discharge_time in", values, "dischargeTime"); + return (Criteria) this; + } + + public Criteria andDischargeTimeNotIn(List values) { + addCriterion("discharge_time not in", values, "dischargeTime"); + return (Criteria) this; + } + + public Criteria andDischargeTimeBetween(Date value1, Date value2) { + addCriterion("discharge_time between", value1, value2, "dischargeTime"); + return (Criteria) this; + } + + public Criteria andDischargeTimeNotBetween(Date value1, Date value2) { + addCriterion("discharge_time not between", value1, value2, "dischargeTime"); + return (Criteria) this; + } + public Criteria andTenantIdIsNull() { addCriterion("tenant_id is null"); return (Criteria) this; @@ -972,6 +1032,66 @@ public class FmsPatientQueueRelationExample { return (Criteria) this; } + public Criteria andQueueIdIsNull() { + addCriterion("queue_id is null"); + return (Criteria) this; + } + + public Criteria andQueueIdIsNotNull() { + addCriterion("queue_id is not null"); + return (Criteria) this; + } + + public Criteria andQueueIdEqualTo(Long value) { + addCriterion("queue_id =", value, "queueId"); + return (Criteria) this; + } + + public Criteria andQueueIdNotEqualTo(Long value) { + addCriterion("queue_id <>", value, "queueId"); + return (Criteria) this; + } + + public Criteria andQueueIdGreaterThan(Long value) { + addCriterion("queue_id >", value, "queueId"); + return (Criteria) this; + } + + public Criteria andQueueIdGreaterThanOrEqualTo(Long value) { + addCriterion("queue_id >=", value, "queueId"); + return (Criteria) this; + } + + public Criteria andQueueIdLessThan(Long value) { + addCriterion("queue_id <", value, "queueId"); + return (Criteria) this; + } + + public Criteria andQueueIdLessThanOrEqualTo(Long value) { + addCriterion("queue_id <=", value, "queueId"); + return (Criteria) this; + } + + public Criteria andQueueIdIn(List values) { + addCriterion("queue_id in", values, "queueId"); + return (Criteria) this; + } + + public Criteria andQueueIdNotIn(List values) { + addCriterion("queue_id not in", values, "queueId"); + return (Criteria) this; + } + + public Criteria andQueueIdBetween(Long value1, Long value2) { + addCriterion("queue_id between", value1, value2, "queueId"); + return (Criteria) this; + } + + public Criteria andQueueIdNotBetween(Long value1, Long value2) { + addCriterion("queue_id not between", value1, value2, "queueId"); + return (Criteria) this; + } + public Criteria andDelFlagIsNull() { addCriterion("del_flag is null"); return (Criteria) this; @@ -1362,66 +1482,6 @@ public class FmsPatientQueueRelationExample { return (Criteria) this; } - public Criteria andDischargeTimeIsNull() { - addCriterion("discharge_time is null"); - return (Criteria) this; - } - - public Criteria andDischargeTimeIsNotNull() { - addCriterion("discharge_time is not null"); - return (Criteria) this; - } - - public Criteria andDischargeTimeEqualTo(Date value) { - addCriterion("discharge_time =", value, "dischargeTime"); - return (Criteria) this; - } - - public Criteria andDischargeTimeNotEqualTo(Date value) { - addCriterion("discharge_time <>", value, "dischargeTime"); - return (Criteria) this; - } - - public Criteria andDischargeTimeGreaterThan(Date value) { - addCriterion("discharge_time >", value, "dischargeTime"); - return (Criteria) this; - } - - public Criteria andDischargeTimeGreaterThanOrEqualTo(Date value) { - addCriterion("discharge_time >=", value, "dischargeTime"); - return (Criteria) this; - } - - public Criteria andDischargeTimeLessThan(Date value) { - addCriterion("discharge_time <", value, "dischargeTime"); - return (Criteria) this; - } - - public Criteria andDischargeTimeLessThanOrEqualTo(Date value) { - addCriterion("discharge_time <=", value, "dischargeTime"); - return (Criteria) this; - } - - public Criteria andDischargeTimeIn(List values) { - addCriterion("discharge_time in", values, "dischargeTime"); - return (Criteria) this; - } - - public Criteria andDischargeTimeNotIn(List values) { - addCriterion("discharge_time not in", values, "dischargeTime"); - return (Criteria) this; - } - - public Criteria andDischargeTimeBetween(Date value1, Date value2) { - addCriterion("discharge_time between", value1, value2, "dischargeTime"); - return (Criteria) this; - } - - public Criteria andDischargeTimeNotBetween(Date value1, Date value2) { - addCriterion("discharge_time not between", value1, value2, "dischargeTime"); - return (Criteria) this; - } - public Criteria andTaskFlagIsNull() { addCriterion("task_flag is null"); return (Criteria) this; diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/domain/po/FmsPatientQueueRelationKey.java b/acupuncture-system/src/main/java/com/acupuncture/system/domain/po/FmsPatientQueueRelationKey.java index eb5a3b9c..3f6d9973 100644 --- a/acupuncture-system/src/main/java/com/acupuncture/system/domain/po/FmsPatientQueueRelationKey.java +++ b/acupuncture-system/src/main/java/com/acupuncture/system/domain/po/FmsPatientQueueRelationKey.java @@ -7,6 +7,8 @@ public class FmsPatientQueueRelationKey implements Serializable { private Long queueId; + private Byte delFlag; + private static final long serialVersionUID = 1L; public Long getPatientId() { @@ -25,6 +27,14 @@ public class FmsPatientQueueRelationKey implements Serializable { this.queueId = queueId; } + public Byte getDelFlag() { + return delFlag; + } + + public void setDelFlag(Byte delFlag) { + this.delFlag = delFlag; + } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -33,6 +43,7 @@ public class FmsPatientQueueRelationKey implements Serializable { sb.append("Hash = ").append(hashCode()); sb.append(", patientId=").append(patientId); sb.append(", queueId=").append(queueId); + sb.append(", delFlag=").append(delFlag); sb.append("]"); return sb.toString(); } diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/domain/vo/AdminStatisticsVo.java b/acupuncture-system/src/main/java/com/acupuncture/system/domain/vo/AdminStatisticsVo.java new file mode 100644 index 00000000..0709dd24 --- /dev/null +++ b/acupuncture-system/src/main/java/com/acupuncture/system/domain/vo/AdminStatisticsVo.java @@ -0,0 +1,389 @@ +package com.acupuncture.system.domain.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +/** + * @Author zzc + * @Package com.acupuncture.system.domain.vo + * @Date 2025/2/13 8:59 + * @description: + */ +public class AdminStatisticsVo { + + @Data + @ApiModel("患者统计") + public static class PatientVo { + private Integer totalPatients; + @ApiModelProperty("性别统计") + private GenderVo gender; + + @ApiModelProperty("年龄统计") + private AgeVo age; + + @ApiModelProperty("疾病统计") + private JwbzVo jwbz; + + @Data + public static class GenderVo { + @ApiModelProperty("男患者人数") + private Integer male; + @ApiModelProperty("女患者人数") + private Integer female; + @ApiModelProperty("未知患者人数") + private Integer other; + } + + @Data + public static class AgeVo { + @ApiModelProperty("0-40") + private Integer num1; + @ApiModelProperty("41-50") + private Integer num2; + @ApiModelProperty("51-60") + private Integer num3; + @ApiModelProperty("61-70") + private Integer num4; + @ApiModelProperty("71-80") + private Integer num5; + @ApiModelProperty("80") + private Integer num6; + } + + @Data + public static class JwbzVo { + @ApiModelProperty("高血压") + private Integer gxy; + @ApiModelProperty("脑血管病") + private Integer nxgb; + @ApiModelProperty("恶性肿瘤") + private Integer exzl; + @ApiModelProperty("冠心病") + private Integer gxb; + @ApiModelProperty("精神疾病") + private Integer jsjb; + @ApiModelProperty("胃和十二指肠溃疡") + private Integer whsezcky; + @ApiModelProperty("肥胖症") + private Integer fpz; + @ApiModelProperty("骨质疏松症") + private Integer gzssz; + @ApiModelProperty("遗传性、先天性疾病") + private Integer ycxXtxjb; + @ApiModelProperty("糖尿病") + private Integer tnb; + @ApiModelProperty("慢性肺系疾病") + private Integer mxfxjb; + @ApiModelProperty("高脂血症") + private Integer gzxz; + @ApiModelProperty("肝脏疾病") + private Integer gzjb; + @ApiModelProperty("过敏性疾病") + private Integer gmxjb; + @ApiModelProperty("关节炎") + private Integer gjy; + @ApiModelProperty("痛风") + private Integer tf; + @ApiModelProperty("肾炎、肾病") + private Integer sySb; + @ApiModelProperty("其他") + private Integer other; + + } + } + + + @Data + @ApiModel("诊疗信息") + public static class TreamentVo { + + @ApiModelProperty("排名信息") + private List sort; + @ApiModelProperty("体型分布") + private TxfbVo txfb; + @ApiModelProperty("中医体质分布") + private ZytzVo zytz; + @ApiModelProperty("体态") + private TtfbVo ttfb; + @ApiModelProperty("失眠") + private SmfbVo smfb; + @ApiModelProperty("焦虑") + private JlfbVo jlfb; + + @Data + @ApiModel("排名信息") + public static class SortVo { + private Integer total; + private Integer sort; + private String type; + + private String diseaseName; + private Integer count; + public SortVo(Integer total, Integer sort, String type, String diseaseName, Integer count) { + this.total = total; + this.sort = sort; + this.type = type; + this.diseaseName = diseaseName; + this.count = count; + } + } + + @Data + @ApiModel("体型分布") + public static class TxfbVo { + @ApiModelProperty("") + private Integer total; + @ApiModelProperty("隐形肥胖型") + private Integer yxfpz; + @ApiModelProperty("脂肪过多型") + private Integer zfgdx; + @ApiModelProperty("肥胖型") + private Integer fpx; + @ApiModelProperty("肌肉不足型") + private Integer jrbzx; + @ApiModelProperty("健康匀称型") + private Integer jkjcx; + @ApiModelProperty("超重肌肉型") + private Integer czjrx; + @ApiModelProperty("消瘦型") + private Integer xsx; + @ApiModelProperty("低脂肪型") + private Integer dzfx; + @ApiModelProperty("运动员型") + private Integer ydyx; + } + + @Data + @ApiModel("体型分布") + public static class ZytzVo { + @ApiModelProperty("") + private Integer total; + @ApiModelProperty("平和质") + private Integer phz; + @ApiModelProperty("气虚质") + private Integer qxz; + @ApiModelProperty("阳虚质") + private Integer yangxz; + @ApiModelProperty("阴虚质") + private Integer yinxz; + @ApiModelProperty("痰湿质") + private Integer tsz; + @ApiModelProperty("湿热质") + private Integer srz; + @ApiModelProperty("血瘀质") + private Integer xyz; + @ApiModelProperty("气郁质") + private Integer qyz; + @ApiModelProperty("特禀质") + private Integer tlz; + } + + @Data + @ApiModel("体态分布") + public static class TtfbVo { + @ApiModelProperty("") + private Integer score1; + @ApiModelProperty("") + private Integer score2; + @ApiModelProperty("") + private Integer score3; + @ApiModelProperty("") + private Integer score4; + @ApiModelProperty("") + private Integer score5; + } + + @Data + @ApiModel("失眠分布") + public static class SmfbVo { + @ApiModelProperty("") + private Integer score1; + @ApiModelProperty("") + private Integer score2; + @ApiModelProperty("") + private Integer score3; + @ApiModelProperty("") + private Integer score4; + @ApiModelProperty("") + private Integer score5; + } + + @Data + @ApiModel("焦虑分布") + public static class JlfbVo { + @ApiModelProperty("") + private Integer score1; + @ApiModelProperty("") + private Integer score2; + @ApiModelProperty("") + private Integer score3; + @ApiModelProperty("") + private Integer score4; + } + } + + @Data + @ApiModel("治疗类型") + public static class ZlTypeVo { + @ApiModelProperty("治疗类型统计") + private Zllxtj zllxtj; + @ApiModelProperty("病种方法分布") + private BzfffbVo bzfffb; + @ApiModelProperty("病种穴位分布") + private BzxwfbVo bzxwfb; + @ApiModelProperty("治疗效果统计") + private ZlxgVo zlxwfb; + @ApiModelProperty("诊疗费用分布") + private ZlfyVo zlfy; + + @Data + @ApiModel("治疗类型统计") + public static class Zllxtj { + private Integer zxyjh; + private Integer czy; + } + + @Data + @ApiModel("病种方法分布") + public static class BzfffbVo { + private Fpz fpz; + private Smz smz; + private Otherbz otherbz; + + @Data + @ApiModel("肥胖症") + public static class Fpz { + @ApiModelProperty("行为心理干预") + private Integer xwxlg; + @ApiModelProperty("运动干预") + private Integer ydgy; + @ApiModelProperty("临床营养治疗") + private Integer lcyyzl; + @ApiModelProperty("针灸疗法") + private Integer zjlf; + @ApiModelProperty("药物治疗") + private Integer ywzl; + } + + @Data + @ApiModel("失眠症") + public static class Smz { + @ApiModelProperty("生活习惯") + private Integer shxg; + @ApiModelProperty("心理调适") + private Integer xlts; + @ApiModelProperty("针灸") + private Integer zj; + @ApiModelProperty("药物治疗") + private Integer ywzl; + } + + @Data + @ApiModel("失眠症") + public static class Otherbz { + @ApiModelProperty("针灸") + private Integer zj; + @ApiModelProperty("药物治疗") + private Integer ywzl; + } + } + + @Data + @ApiModel("病种穴位分布") + public static class BzxwfbVo { + @ApiModelProperty("肥胖症病种穴位分布") + private Bzxwfb fpzbzxwfb; + @ApiModelProperty("失眠症病种穴位分布") + private Bzxwfb smzbzxwfb; + @ApiModelProperty("其他病种穴位分布") + private Bzxwfb qtbzxwfb; + + @Data + @ApiModel("病种穴位分布") + public static class Bzxwfb { + @ApiModelProperty("足三里") + private Integer zsl; + @ApiModelProperty("中脘") + private Integer zr; + @ApiModelProperty("天枢") + private Integer tq; + @ApiModelProperty("神门") + private Integer sm; + @ApiModelProperty("三阴交") + private Integer syj; + @ApiModelProperty("百会") + private Integer bh; + @ApiModelProperty("其他") + private Integer am; + @ApiModelProperty("药物治疗") + private Integer other; + } + } + + @Data + @ApiModel("治疗效果统计") + public static class ZlxgVo { + @ApiModelProperty("治愈") + private Integer zy; + @ApiModelProperty("显效") + private Integer xx; + @ApiModelProperty("好转") + private Integer hz; + @ApiModelProperty("无效") + private Integer wx; + } + + @Data + @ApiModel("诊疗费用分布") + public static class ZlfyVo { + @ApiModelProperty("<300元") + private Integer score1; + @ApiModelProperty("300 ~ 900元") + private Integer score2; + @ApiModelProperty("900 ~ 2000元") + private Integer score3; + @ApiModelProperty("2000 ~ 5000元") + private Integer score4; + @ApiModelProperty(">5000元") + private Integer score5; + } + } + + @Data + @ApiModel("随访分布") + public static class SffbVo { + @ApiModelProperty("减重队列") + private DlVo jzdl; + @ApiModelProperty("失眠队列") + private DlVo smdl; + + @Data + @ApiModel("队列") + public static class DlVo { + private Long queueId; + private String queueName; + @ApiModelProperty("人数") + private Integer num; + @ApiModelProperty("待随访") + private Integer dsf; + @ApiModelProperty("临近随访") + private Integer ljsf; + @ApiModelProperty("超期随访") + private Integer cqsf; + @ApiModelProperty("正常随访") + private Integer zc; + } + } + + @Data + @ApiModel("失访统计") + public static class SftjVo { + @ApiModelProperty("失访数量") + private Integer num; + @ApiModelProperty("失访原因") + private String reason; + } +} diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/domain/vo/FmsFollowupVo.java b/acupuncture-system/src/main/java/com/acupuncture/system/domain/vo/FmsFollowupVo.java index d737c7b2..311bc76a 100644 --- a/acupuncture-system/src/main/java/com/acupuncture/system/domain/vo/FmsFollowupVo.java +++ b/acupuncture-system/src/main/java/com/acupuncture/system/domain/vo/FmsFollowupVo.java @@ -84,7 +84,10 @@ public class FmsFollowupVo { private String personInCharge; private String personInChargeUsername; - private String lostReason; + private Date startTime; + private Date endTime; + + private String reason; private String followuper; @@ -98,6 +101,10 @@ public class FmsFollowupVo { private String updateBy; private Date updateTime; private String remark; + + private String queueName; + + private String tenantName; } @Data diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/domain/vo/PmsTreatmentVo.java b/acupuncture-system/src/main/java/com/acupuncture/system/domain/vo/PmsTreatmentVo.java index 310a0fa8..d457138e 100644 --- a/acupuncture-system/src/main/java/com/acupuncture/system/domain/vo/PmsTreatmentVo.java +++ b/acupuncture-system/src/main/java/com/acupuncture/system/domain/vo/PmsTreatmentVo.java @@ -50,6 +50,14 @@ public class PmsTreatmentVo { private String updateBy; private Date updateTime; private String remark; + + private List queueVoList; + + @Data + public static class QueueVo{ + private Long queueId; + private String queueName; + } } @Data diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/domain/vo/StatisticsVo.java b/acupuncture-system/src/main/java/com/acupuncture/system/domain/vo/StatisticsVo.java index d9b7fbb6..0ed3daae 100644 --- a/acupuncture-system/src/main/java/com/acupuncture/system/domain/vo/StatisticsVo.java +++ b/acupuncture-system/src/main/java/com/acupuncture/system/domain/vo/StatisticsVo.java @@ -97,49 +97,6 @@ public class StatisticsVo { @ApiModelProperty("其他") private Integer other; - public List sortFields() { - List sortList = new ArrayList<>(); - - // 将所有字段及其类型放入列表 - sortList.add(new TreamentVo.SortVo(gxy, 0, "高血压")); - sortList.add(new TreamentVo.SortVo(nxgb, 1, "脑血管病")); - sortList.add(new TreamentVo.SortVo(exzl, 2, "恶性肿瘤")); - sortList.add(new TreamentVo.SortVo(gxb, 3, "冠心病")); - sortList.add(new TreamentVo.SortVo(jsjb, 4, "精神疾病")); - sortList.add(new TreamentVo.SortVo(whsezcky, 5, "胃和十二指肠溃疡")); - sortList.add(new TreamentVo.SortVo(fpz, 6, "肥胖症")); - sortList.add(new TreamentVo.SortVo(gzssz, 7, "骨质疏松症")); - sortList.add(new TreamentVo.SortVo(ycxXtxjb, 8, "遗传性、先天性疾病")); - sortList.add(new TreamentVo.SortVo(tnb, 9, "糖尿病")); - sortList.add(new TreamentVo.SortVo(mxfxjb, 10, "慢性肺系疾病")); - sortList.add(new TreamentVo.SortVo(gzxz, 11, "高脂血症")); - sortList.add(new TreamentVo.SortVo(gzjb, 12, "肝脏疾病")); - sortList.add(new TreamentVo.SortVo(gmxjb, 13, "过敏性疾病")); - sortList.add(new TreamentVo.SortVo(gjy, 14, "关节炎")); - sortList.add(new TreamentVo.SortVo(tf, 15, "痛风")); - sortList.add(new TreamentVo.SortVo(sySb, 16, "肾炎、肾病")); - - // 使用选择排序算法对列表进行排序 - for (int i = 0; i < sortList.size() - 1; i++) { - int minIndex = i; - for (int j = i + 1; j < sortList.size(); j++) { - if (sortList.get(j).getTotal() > sortList.get(minIndex).getTotal()) { - minIndex = j; - } - } - if (minIndex != i) { - TreamentVo.SortVo temp = sortList.get(i); - sortList.set(i, sortList.get(minIndex)); - sortList.set(minIndex, temp); - } - } - - // 设置排序位置 - for (int i = 0; i < sortList.size(); i++) { - sortList.get(i).setSort(i + 1); - } - return sortList; - } } } @@ -168,12 +125,14 @@ public class StatisticsVo { private Integer sort; private String type; - private String disease_name; + private String diseaseName; private Integer count; - public SortVo(Integer total, Integer sort, String type) { + public SortVo(Integer total, Integer sort, String type, String diseaseName, Integer count) { this.total = total; this.sort = sort; this.type = type; + this.diseaseName = diseaseName; + this.count = count; } } @@ -410,6 +369,7 @@ public class StatisticsVo { @ApiModel("队列") public static class DlVo { private Long queueId; + private String queueName; @ApiModelProperty("人数") private Integer num; @ApiModelProperty("待随访") diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/persist/dao/AdminTongjiDao.java b/acupuncture-system/src/main/java/com/acupuncture/system/persist/dao/AdminTongjiDao.java new file mode 100644 index 00000000..bcbf904c --- /dev/null +++ b/acupuncture-system/src/main/java/com/acupuncture/system/persist/dao/AdminTongjiDao.java @@ -0,0 +1,88 @@ +package com.acupuncture.system.persist.dao; + +import com.acupuncture.common.annotation.DataSource; +import com.acupuncture.common.enums.DataSourceType; +import com.acupuncture.system.domain.dto.StatisticsDto; +import com.acupuncture.system.domain.vo.AdminStatisticsVo; +import org.apache.ibatis.annotations.Param; +import org.mybatis.spring.annotation.MapperScan; + +import java.util.List; + +/** + * @Author zzc + * @Package com.acupuncture.system.persist.dao + * @Date 2025/2/13 14:07 + * @description: + */ +@MapperScan("AdminTongjiDao") +public interface AdminTongjiDao { + + /** + * 患者统计 + * + * @param dto + * @param tenantId + * @return + */ + @DataSource(DataSourceType.MASTER) + AdminStatisticsVo.PatientVo.GenderVo queryGenderStatistics(@Param("dto") StatisticsDto.Query dto, + @Param("tenantId") Long tenantId); + + /** + * 年龄统计 + * + * @param dto + * @param tenantId + * @return + */ + @DataSource(DataSourceType.MASTER) + AdminStatisticsVo.PatientVo.AgeVo queryAgeStatistics(@Param("dto") StatisticsDto.Query dto, + @Param("tenantId") Long tenantId); + @DataSource(DataSourceType.MASTER) + AdminStatisticsVo.PatientVo.JwbzVo queryJwbzStatistics(@Param("dto") StatisticsDto.Query dto, + @Param("tenantId") Long tenantId); + @DataSource(DataSourceType.MASTER) + List queryZyzdStatistics(@Param("dto") StatisticsDto.Query dto, + @Param("tenantId") Long tenantId); + @DataSource(DataSourceType.MASTER) + Integer queryTotalPatient(@Param("dto") StatisticsDto.Query dto, + @Param("tenantId") Long tenantId); + @DataSource(DataSourceType.MASTER) + AdminStatisticsVo.TreamentVo.TxfbVo queryTxfbStatistics(@Param("dto") StatisticsDto.Query dto, + @Param("tenantId") Long tenantId); + @DataSource(DataSourceType.MASTER) + AdminStatisticsVo.TreamentVo.ZytzVo queryZytzStatistics(@Param("dto") StatisticsDto.Query dto, + @Param("tenantId") Long tenantId); + @DataSource(DataSourceType.MASTER) + AdminStatisticsVo.ZlTypeVo.Zllxtj queryZllxtjStatistics(@Param("dto") StatisticsDto.Query dto, + @Param("tenantId") Long tenantId); + @DataSource(DataSourceType.MASTER) + + AdminStatisticsVo.ZlTypeVo.BzfffbVo.Fpz queryFpzStatistics(@Param("dto") StatisticsDto.Query dto, + @Param("tenantId") Long tenantId); + @DataSource(DataSourceType.MASTER) + AdminStatisticsVo.ZlTypeVo.ZlxgVo queryZlxgStatistics(@Param("dto") StatisticsDto.Query dto, + @Param("tenantId") Long tenantId); + @DataSource(DataSourceType.MASTER) + AdminStatisticsVo.ZlTypeVo.ZlfyVo queryZlfyStatistics(@Param("dto") StatisticsDto.Query dto, + @Param("tenantId") Long tenantId); + @DataSource(DataSourceType.MASTER) + List querySftjStatistics(@Param("dto") StatisticsDto.Query dto, + @Param("tenantId") Long tenantId); + @DataSource(DataSourceType.MASTER) + List querySfStatistics(@Param("dto") StatisticsDto.Query dto, + @Param("tenantId") Long tenantId); + @DataSource(DataSourceType.MASTER) + AdminStatisticsVo.TreamentVo.TtfbVo queryTtfbStatistics(@Param("dto") StatisticsDto.Query dto, + @Param("tenantId") Long tenantId); + @DataSource(DataSourceType.MASTER) + AdminStatisticsVo.TreamentVo.SmfbVo querySmfbStatistics(@Param("dto") StatisticsDto.Query dto, + @Param("tenantId") Long tenantId); + @DataSource(DataSourceType.MASTER) + AdminStatisticsVo.TreamentVo.JlfbVo queryJlfbStatistics(@Param("dto") StatisticsDto.Query dto, + @Param("tenantId") Long tenantId); + @DataSource(DataSourceType.MASTER) + AdminStatisticsVo.ZlTypeVo.BzfffbVo.Smz querySmzStatistics(StatisticsDto.Query dto, Long tenantId); +} + diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/persist/dao/FmsFollowupDao.java b/acupuncture-system/src/main/java/com/acupuncture/system/persist/dao/FmsFollowupDao.java index 169afdd5..28dbf994 100644 --- a/acupuncture-system/src/main/java/com/acupuncture/system/persist/dao/FmsFollowupDao.java +++ b/acupuncture-system/src/main/java/com/acupuncture/system/persist/dao/FmsFollowupDao.java @@ -4,6 +4,7 @@ import com.acupuncture.common.annotation.DataSource; import com.acupuncture.common.enums.DataSourceType; import com.acupuncture.system.domain.dto.FmsFollowupDto; import com.acupuncture.system.domain.vo.FmsFollowupVo; +import com.acupuncture.system.domain.vo.PmsTreatmentVo; import org.apache.ibatis.annotations.Param; import java.util.List; @@ -50,4 +51,6 @@ public interface FmsFollowupDao { int updateStatusToLost(@Param("dto") FmsFollowupDto.FollowupLostDTO dto); int completeFollowup(@Param("dto") FmsFollowupDto.FollowupCompleteDTO dto); + + List queryQueueListByPatientId(@Param("patientId") Long patientId); } diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/persist/dao/StatisticsDao.java b/acupuncture-system/src/main/java/com/acupuncture/system/persist/dao/StatisticsDao.java index 3c9451df..e33bdf29 100644 --- a/acupuncture-system/src/main/java/com/acupuncture/system/persist/dao/StatisticsDao.java +++ b/acupuncture-system/src/main/java/com/acupuncture/system/persist/dao/StatisticsDao.java @@ -3,6 +3,7 @@ package com.acupuncture.system.persist.dao; import com.acupuncture.system.domain.dto.StatisticsDto; import com.acupuncture.system.domain.vo.StatisticsVo; import org.apache.ibatis.annotations.Param; +import org.mybatis.spring.annotation.MapperScan; import java.util.List; @@ -12,6 +13,7 @@ import java.util.List; * @Date 2025/2/13 14:07 * @description: */ +@MapperScan("StatisticsDao") public interface StatisticsDao { /** @@ -37,7 +39,7 @@ public interface StatisticsDao { StatisticsVo.PatientVo.JwbzVo queryJwbzStatistics(@Param("dto") StatisticsDto.Query dto, @Param("tenantId") Long tenantId); - List queryZyzdStatistics(@Param("dto") StatisticsDto.Query dto, + List queryZyzdStatistics(@Param("dto") StatisticsDto.Query dto, @Param("tenantId") Long tenantId); Integer queryTotalPatient(@Param("dto") StatisticsDto.Query dto, diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/persist/mapper/FmsPatientQueueRelationMapper.java b/acupuncture-system/src/main/java/com/acupuncture/system/persist/mapper/FmsPatientQueueRelationMapper.java index 3e817701..470e5177 100644 --- a/acupuncture-system/src/main/java/com/acupuncture/system/persist/mapper/FmsPatientQueueRelationMapper.java +++ b/acupuncture-system/src/main/java/com/acupuncture/system/persist/mapper/FmsPatientQueueRelationMapper.java @@ -2,14 +2,13 @@ package com.acupuncture.system.persist.mapper; import com.acupuncture.system.domain.po.FmsPatientQueueRelation; import com.acupuncture.system.domain.po.FmsPatientQueueRelationExample; -import com.acupuncture.system.domain.po.FmsPatientQueueRelationKey; import java.util.List; import org.apache.ibatis.annotations.Param; public interface FmsPatientQueueRelationMapper { long countByExample(FmsPatientQueueRelationExample example); - int deleteByPrimaryKey(FmsPatientQueueRelationKey key); + int deleteByPrimaryKey(Long id); int insert(FmsPatientQueueRelation record); @@ -17,7 +16,7 @@ public interface FmsPatientQueueRelationMapper { List selectByExample(FmsPatientQueueRelationExample example); - FmsPatientQueueRelation selectByPrimaryKey(FmsPatientQueueRelationKey key); + FmsPatientQueueRelation selectByPrimaryKey(Long id); int updateByExampleSelective(@Param("record") FmsPatientQueueRelation record, @Param("example") FmsPatientQueueRelationExample example); diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/service/AdminStatisticsService.java b/acupuncture-system/src/main/java/com/acupuncture/system/service/AdminStatisticsService.java new file mode 100644 index 00000000..e962d6a7 --- /dev/null +++ b/acupuncture-system/src/main/java/com/acupuncture/system/service/AdminStatisticsService.java @@ -0,0 +1,55 @@ +package com.acupuncture.system.service; + +import com.acupuncture.system.domain.dto.StatisticsDto; +import com.acupuncture.system.domain.vo.AdminStatisticsVo; + +import java.util.List; + +/** + * @Author zzc + * @Package com.acupuncture.system.service + * @Date 2025/2/13 8:58 + * @description: + */ +public interface AdminStatisticsService { + + /** + * 患者统计 + * + * @param dto + * @return + */ + AdminStatisticsVo.PatientVo queryPatientStatistics(StatisticsDto.Query dto); + + /** + * 诊疗统计 + * + * @param dto + * @return + */ + AdminStatisticsVo.TreamentVo queryZlStatistics(StatisticsDto.Query dto); + + /** + * 治疗类型统计 + * + * @param dto + * @return + */ + AdminStatisticsVo.ZlTypeVo queryZlTypeStatistics(StatisticsDto.Query dto); + + /** + * 随访分布统计 + * + * @param dto + * @return + */ + List querySfStatistics(StatisticsDto.Query dto); + + /** + * 失访统计 + * + * @param dto + * @return + */ + List querySfTjStatistics(StatisticsDto.Query dto); +} diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/service/PmsTreatmentService.java b/acupuncture-system/src/main/java/com/acupuncture/system/service/PmsTreatmentService.java index 1e872ed4..d2ff6c1f 100644 --- a/acupuncture-system/src/main/java/com/acupuncture/system/service/PmsTreatmentService.java +++ b/acupuncture-system/src/main/java/com/acupuncture/system/service/PmsTreatmentService.java @@ -1,8 +1,12 @@ package com.acupuncture.system.service; +import com.acupuncture.system.domain.dto.PmsPatientDto; import com.acupuncture.system.domain.dto.PmsTreatmentDto; import com.acupuncture.system.domain.vo.PmsTreatmentVo; +import org.springframework.web.multipart.MultipartFile; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; import java.util.List; /** @@ -41,4 +45,9 @@ public interface PmsTreatmentService { void saveAidRecord(PmsTreatmentDto.SaveAidRecord dto); PmsTreatmentVo.TreatmentRecordVO queryRecord(Long treatmentId, List codeList); + + void exportTreatment(HttpServletResponse response, PmsTreatmentDto.TreatmentQueryDTO dto); + + void importTreatment(MultipartFile file) throws IOException; + } diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/service/StatisticsService.java b/acupuncture-system/src/main/java/com/acupuncture/system/service/StatisticsService.java index 58d135cf..8c33f7d1 100644 --- a/acupuncture-system/src/main/java/com/acupuncture/system/service/StatisticsService.java +++ b/acupuncture-system/src/main/java/com/acupuncture/system/service/StatisticsService.java @@ -43,7 +43,7 @@ public interface StatisticsService { * @param dto * @return */ - StatisticsVo.SffbVo querySfStatistics(StatisticsDto.Query dto); + List querySfStatistics(StatisticsDto.Query dto); /** * 失访统计 diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/AdminStatisticsServiceImpl.java b/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/AdminStatisticsServiceImpl.java new file mode 100644 index 00000000..f7f18179 --- /dev/null +++ b/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/AdminStatisticsServiceImpl.java @@ -0,0 +1,121 @@ +package com.acupuncture.system.service.impl; + +import cn.hutool.core.collection.CollUtil; +import com.acupuncture.common.constant.DiseaseMapping; +import com.acupuncture.common.utils.SecurityUtils; +import com.acupuncture.system.domain.dto.StatisticsDto; +import com.acupuncture.system.domain.vo.AdminStatisticsVo; +import com.acupuncture.system.persist.dao.AdminTongjiDao; +import com.acupuncture.system.service.AdminStatisticsService; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * @Author zzc + * @Package com.acupuncture.system.service + * @Date 2025/2/13 8:58 + * @description: + */ +@Service +public class AdminStatisticsServiceImpl implements AdminStatisticsService { + @Resource + private AdminTongjiDao adminTongjiDao; + + @Override + public AdminStatisticsVo.PatientVo queryPatientStatistics(StatisticsDto.Query dto) { + AdminStatisticsVo.PatientVo patientVo = new AdminStatisticsVo.PatientVo(); + patientVo.setGender(adminTongjiDao.queryGenderStatistics(dto, SecurityUtils.getTenantId())); + patientVo.setAge(adminTongjiDao.queryAgeStatistics(dto, SecurityUtils.getTenantId())); + patientVo.setJwbz(adminTongjiDao.queryJwbzStatistics(dto, SecurityUtils.getTenantId())); + patientVo.setTotalPatients(adminTongjiDao.queryTotalPatient(dto, SecurityUtils.getTenantId())); + return patientVo; + } + + @Override + public AdminStatisticsVo.TreamentVo queryZlStatistics(StatisticsDto.Query dto) { + AdminStatisticsVo.TreamentVo treamentVo = new AdminStatisticsVo.TreamentVo(); + List answers = adminTongjiDao.queryZyzdStatistics(dto, SecurityUtils.getTenantId()); + // 统计病种出现次数 + if (CollUtil.isNotEmpty(answers)) { + Map diseaseCountMap = new HashMap<>(); + for (String answer : answers) { + if (answer != null && !answer.isEmpty()) { + String[] items = answer.split("!@#"); + for (String item : items) { + String code = item.split(" ")[0]; // 提取编码 + String diseaseName = DiseaseMapping.DISEASE_MAP.get(code); + if (diseaseName != null) { + diseaseCountMap.put(diseaseName, diseaseCountMap.getOrDefault(diseaseName, 0) + 1); + } + } + } + } + // 转换为列表并排序 + List> sortedList = new ArrayList<>(diseaseCountMap.entrySet()); + sortedList.sort((e1, e2) -> e2.getValue().compareTo(e1.getValue())); + + // 封装为SortVo对象 + List result = new ArrayList<>(); + int total = sortedList.size(); + for (int i = 0; i < sortedList.size(); i++) { + Map.Entry entry = sortedList.get(i); + result.add(new AdminStatisticsVo.TreamentVo.SortVo(total, i + 1, "主要诊断", entry.getKey(), entry.getValue())); + } + treamentVo.setSort(result); + } + treamentVo.setTxfb(adminTongjiDao.queryTxfbStatistics(dto, SecurityUtils.getTenantId())); + treamentVo.setZytz(adminTongjiDao.queryZytzStatistics(dto, SecurityUtils.getTenantId())); + treamentVo.setTtfb(adminTongjiDao.queryTtfbStatistics(dto, SecurityUtils.getTenantId())); + treamentVo.setSmfb(adminTongjiDao.querySmfbStatistics(dto, SecurityUtils.getTenantId())); + treamentVo.setJlfb(adminTongjiDao.queryJlfbStatistics(dto, SecurityUtils.getTenantId())); + return treamentVo; + } + + @Override + public AdminStatisticsVo.ZlTypeVo queryZlTypeStatistics(StatisticsDto.Query dto) { + AdminStatisticsVo.ZlTypeVo zlTypeVo = new AdminStatisticsVo.ZlTypeVo(); + zlTypeVo.setZllxtj(adminTongjiDao.queryZllxtjStatistics(dto, SecurityUtils.getTenantId())); + + AdminStatisticsVo.ZlTypeVo.BzfffbVo bzfffbVo = new AdminStatisticsVo.ZlTypeVo.BzfffbVo(); + bzfffbVo.setFpz(adminTongjiDao.queryFpzStatistics(dto, SecurityUtils.getTenantId())); + bzfffbVo.setSmz(adminTongjiDao.querySmzStatistics(dto, SecurityUtils.getTenantId())); + //TODO + zlTypeVo.setBzfffb(bzfffbVo); + zlTypeVo.setZlxwfb(adminTongjiDao.queryZlxgStatistics(dto, SecurityUtils.getTenantId())); + zlTypeVo.setZlfy(adminTongjiDao.queryZlfyStatistics(dto, SecurityUtils.getTenantId())); + return zlTypeVo; + } + + @Override + public List querySfStatistics(StatisticsDto.Query dto) { + AdminStatisticsVo.SffbVo sffbVo = new AdminStatisticsVo.SffbVo(); + return adminTongjiDao.querySfStatistics(dto, SecurityUtils.getTenantId()); +// if (CollUtil.isNotEmpty(dlVos)) { +// for (AdminStatisticsVo.SffbVo.DlVo dlVo : dlVos) { +// if (dlVo.getQueueId() == 10L) { +// //减重队列 +// AdminStatisticsVo.SffbVo.DlVo jzdl = new AdminStatisticsVo.SffbVo.DlVo(); +// BeanUtil.copyProperties(dlVo, jzdl); +// sffbVo.setJzdl(jzdl); +// } else if (dlVo.getQueueId() == 11L) { +// //失眠队列 +// //减重队列 +// AdminStatisticsVo.SffbVo.DlVo smdl = new AdminStatisticsVo.SffbVo.DlVo(); +// BeanUtil.copyProperties(dlVo, smdl); +// sffbVo.setSmdl(smdl); +// } +// } +// } +// return sffbVo; + } + + @Override + public List querySfTjStatistics(StatisticsDto.Query dto) { + return adminTongjiDao.querySftjStatistics(dto, SecurityUtils.getTenantId()); + } +} diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/FmsFollowupQueueServiceImpl.java b/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/FmsFollowupQueueServiceImpl.java index 93a06591..5b624d9a 100644 --- a/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/FmsFollowupQueueServiceImpl.java +++ b/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/FmsFollowupQueueServiceImpl.java @@ -1,6 +1,9 @@ package com.acupuncture.system.service.impl; +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollectionUtil; import com.acupuncture.common.annotation.DataSource; +import com.acupuncture.common.core.redis.RedisCache; import com.acupuncture.common.enums.DataSourceType; import com.acupuncture.system.domain.vo.FmsFollowupVo; import com.acupuncture.system.persist.dao.FmsFollowupDao; @@ -21,10 +24,20 @@ public class FmsFollowupQueueServiceImpl implements FmsFollowupQueueService { @Resource private FmsFollowupDao fmsFollowupDao; - + @Resource + private RedisCache redisCache; + public static String COMMON_FOLLOWUP_QUEUE = "common_followup_queue"; @Override @DataSource(DataSourceType.MASTER) public List queryCommonQueue(String name) { - return fmsFollowupDao.queryCommonQueue(name); + List cacheList =redisCache.getCacheList(COMMON_FOLLOWUP_QUEUE); + if (CollectionUtil.isEmpty(cacheList)) { + List followupQueueVOS = fmsFollowupDao.queryCommonQueue(name); + redisCache.setCacheList(COMMON_FOLLOWUP_QUEUE, followupQueueVOS); + return followupQueueVOS; + }else { + return BeanUtil.copyToList(cacheList, FmsFollowupVo.FollowupQueueVO.class); + } + } } diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/FmsFollowupServiceImpl.java b/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/FmsFollowupServiceImpl.java index eb195ec2..91e910e8 100644 --- a/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/FmsFollowupServiceImpl.java +++ b/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/FmsFollowupServiceImpl.java @@ -3,10 +3,12 @@ package com.acupuncture.system.service.impl; import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.util.IdUtil; +import com.acupuncture.common.core.redis.RedisCache; import com.acupuncture.common.utils.SecurityUtils; import com.acupuncture.system.domain.dto.FmsFollowupDto; import com.acupuncture.system.domain.po.*; import com.acupuncture.system.domain.vo.FmsFollowupVo; +import com.acupuncture.system.domain.vo.PmsTreatmentVo; import com.acupuncture.system.persist.dao.FmsFollowupDao; import com.acupuncture.system.persist.mapper.FmsFollowupQueueMapper; import com.acupuncture.system.persist.mapper.FmsFollowupTaskMapper; @@ -20,10 +22,9 @@ import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; -import java.util.ArrayList; -import java.util.Calendar; -import java.util.Date; -import java.util.List; +import java.util.*; +import java.util.function.Function; +import java.util.stream.Collectors; /** * @Author zzc @@ -41,6 +42,8 @@ public class FmsFollowupServiceImpl implements FmsFollowupService { private FmsFollowupQueueMapper fmsFollowupQueueMapper; @Resource private FmsPatientQueueRelationMapper fmsPatientQueueRelationMapper; + @Resource + private RedisCache redisCache; @Override public List queryQueue(FmsFollowupDto.FollowupQueueQueryDTO dto) { @@ -76,7 +79,45 @@ public class FmsFollowupServiceImpl implements FmsFollowupService { @Override public List queryPatient(FmsFollowupDto.FollowupPatientQueryDTO dto) { - return fmsFollowupDao.queryPatient(dto.getId(), null); + List followupPatients = fmsFollowupDao.queryPatient(dto.getId(), null); + if (CollectionUtil.isNotEmpty(followupPatients)) { + List commonFollowupQueue = redisCache.getCacheList("common_followup_queue"); + for (FmsFollowupVo.FollowupPatient followupPatient : followupPatients) { + if (CollectionUtil.isNotEmpty(followupPatient.getQueueList())) { + + List queueVos = fmsFollowupDao.queryQueueListByPatientId(followupPatient.getPatientId()); + List queueVoList = new ArrayList<>(); + if (CollectionUtil.isNotEmpty(queueVos)) { + queueVoList = BeanUtil.copyToList(queueVos, FmsFollowupVo.FollowupPatient.QueueVo.class); + Map map = new HashMap<>(); + if (CollectionUtil.isNotEmpty(commonFollowupQueue)) { + List followupQueueVOS1 = BeanUtil.copyToList(commonFollowupQueue, FmsFollowupVo.FollowupQueueVO.class); + map = followupQueueVOS1.stream().collect(Collectors.toMap(FmsFollowupVo.FollowupQueueVO::getId, Function.identity())); + } + for (FmsFollowupVo.FollowupPatient.QueueVo queueVo : queueVoList) { + FmsFollowupVo.FollowupQueueVO followupQueueVO = map.get(queueVo.getQueueId()); + if (followupQueueVO != null) { + queueVo.setQueueName(followupQueueVO.getName()); + } + } + } + followupPatient.setQueueList(queueVoList); + +// Map map = new HashMap<>(); +// if (CollectionUtil.isNotEmpty(commonFollowupQueue)) { +// List followupQueueVOS1 = BeanUtil.copyToList(commonFollowupQueue, FmsFollowupVo.FollowupQueueVO.class); +// map = followupQueueVOS1.stream().collect(Collectors.toMap(FmsFollowupVo.FollowupQueueVO::getId, Function.identity())); +// } +// for (FmsFollowupVo.FollowupPatient.QueueVo queueVo : followupPatient.getQueueList()) { +// FmsFollowupVo.FollowupQueueVO followupQueueVO = map.get(queueVo.getQueueId()); +// if (followupQueueVO != null) { +// queueVo.setQueueName(followupQueueVO.getName()); +// } +// } + } + } + } + return followupPatients; } @Override @@ -88,7 +129,7 @@ public class FmsFollowupServiceImpl implements FmsFollowupService { List fmsPatientQueueRelations = fmsPatientQueueRelationMapper.selectByExample(fmsPatientQueueRelationExample); if (CollectionUtil.isNotEmpty(fmsPatientQueueRelations)) { for (FmsPatientQueueRelation patientQueueRelation : fmsPatientQueueRelations) { - fmsPatientQueueRelationMapper.deleteByPrimaryKey(patientQueueRelation); + fmsPatientQueueRelationMapper.deleteByPrimaryKey(patientQueueRelation.getId()); } } int i = 0; @@ -102,6 +143,7 @@ public class FmsFollowupServiceImpl implements FmsFollowupService { relation.setQueueId(queueId); relation.setTenantId(SecurityUtils.getTenantId()); relation.setCreateTime(new Date()); + relation.setId(IdUtil.getSnowflakeNextId()); fmsPatientQueueRelationMapper.insertSelective(relation); } i = dto.getQueueIdList().size(); diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/PmsTreatmentServiceImpl.java b/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/PmsTreatmentServiceImpl.java index 30048274..db8e5941 100644 --- a/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/PmsTreatmentServiceImpl.java +++ b/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/PmsTreatmentServiceImpl.java @@ -2,16 +2,26 @@ package com.acupuncture.system.service.impl; import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.collection.CollectionUtil; +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.io.IoUtil; import cn.hutool.core.map.MapUtil; import cn.hutool.core.util.IdUtil; +import cn.hutool.core.util.IdcardUtil; import cn.hutool.core.util.StrUtil; import cn.hutool.extra.pinyin.PinyinUtil; +import cn.hutool.poi.excel.BigExcelWriter; +import cn.hutool.poi.excel.ExcelUtil; +import com.acupuncture.common.core.redis.RedisCache; import com.acupuncture.common.exception.base.BaseException; +import com.acupuncture.common.utils.ExceptionUtil; import com.acupuncture.common.utils.SecurityUtils; import com.acupuncture.system.domain.dto.PmsPatientDto; import com.acupuncture.system.domain.dto.PmsTreatmentDto; import com.acupuncture.system.domain.po.*; +import com.acupuncture.system.domain.vo.FmsFollowupVo; +import com.acupuncture.system.domain.vo.PmsPatientVo; import com.acupuncture.system.domain.vo.PmsTreatmentVo; +import com.acupuncture.system.persist.dao.FmsFollowupDao; import com.acupuncture.system.persist.dao.PmsTreatmentDao; import com.acupuncture.system.persist.mapper.FmsPatientQueueRelationMapper; import com.acupuncture.system.persist.mapper.PmsPatientMapper; @@ -19,13 +29,19 @@ import com.acupuncture.system.persist.mapper.PmsTreatmentMapper; import com.acupuncture.system.persist.mapper.PmsTreatmentRecordMapper; import com.acupuncture.system.service.PmsPatientService; import com.acupuncture.system.service.PmsTreatmentService; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; +import org.springframework.web.multipart.MultipartFile; import javax.annotation.Resource; +import javax.servlet.ServletOutputStream; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.function.Function; import java.util.stream.Collectors; /** @@ -49,6 +65,12 @@ public class PmsTreatmentServiceImpl implements PmsTreatmentService { private PmsTreatmentRecordMapper pmsTreatmentRecordMapper; @Resource private FmsPatientQueueRelationMapper fmsPatientQueueRelationMapper; + @Resource + private FmsFollowupDao fmsFollowupDao; + @Resource + private RedisCache redisCache; + @Value("${file.TreamentTemplate}") + private String treamentTemplate; @Override public void addTreatment(PmsTreatmentDto.TreatmentAdd dto) { @@ -82,6 +104,7 @@ public class PmsTreatmentServiceImpl implements PmsTreatmentService { if (CollectionUtil.isNotEmpty(dto.getQueueIdList())) { for (Long queueId : dto.getQueueIdList()) { FmsPatientQueueRelation patientQueueRelation = BeanUtil.copyProperties(dto, FmsPatientQueueRelation.class); + patientQueueRelation.setId(IdUtil.getSnowflakeNextId()); patientQueueRelation.setDelFlag((byte) 0); patientQueueRelation.setCreateBy(SecurityUtils.getUsername()); patientQueueRelation.setPatientId(patientId); @@ -98,6 +121,28 @@ public class PmsTreatmentServiceImpl implements PmsTreatmentService { pmsTreatment.setUpdateBy(SecurityUtils.getUsername()); pmsTreatment.setUpdateTime(new Date()); treatmentMapper.updateByPrimaryKeySelective(pmsTreatment); + + //删除队列 + //如有患者档案信息,则需要判断患者是否有随访队列,如果有,则需要删除(先删除后新增) + FmsPatientQueueRelationExample fmsPatientQueueRelationExample = new FmsPatientQueueRelationExample(); + fmsPatientQueueRelationExample.createCriteria().andPatientIdEqualTo(pmsTreatment.getPatientId()).andDelFlagEqualTo((byte) 0); + FmsPatientQueueRelation fmsPatientQueueRelation = new FmsPatientQueueRelation(); + fmsPatientQueueRelation.setDelFlag((byte) 1); + fmsPatientQueueRelationMapper.updateByExampleSelective(fmsPatientQueueRelation, fmsPatientQueueRelationExample); + //新增随访队列 + if (CollectionUtil.isNotEmpty(dto.getQueueIdList())) { + for (Long queueId : dto.getQueueIdList()) { + FmsPatientQueueRelation patientQueueRelation = BeanUtil.copyProperties(dto, FmsPatientQueueRelation.class); + patientQueueRelation.setDelFlag((byte) 0); + patientQueueRelation.setCreateBy(SecurityUtils.getUsername()); + patientQueueRelation.setPatientId(pmsTreatment.getPatientId()); + patientQueueRelation.setQueueId(queueId); + patientQueueRelation.setCreateTime(new Date()); + patientQueueRelation.setId(IdUtil.getSnowflakeNextId()); + fmsPatientQueueRelationMapper.insertSelective(patientQueueRelation); + } + } + } @Override @@ -113,6 +158,8 @@ public class PmsTreatmentServiceImpl implements PmsTreatmentService { public List listTreatment(PmsTreatmentDto.TreatmentQueryDTO queryDTO) { List query = pmsTreatmentDao.query(queryDTO); if (CollectionUtil.isNotEmpty(query)) { + //查询公共队列 + List commonFollowupQueue = redisCache.getCacheList("common_followup_queue"); for (PmsTreatmentVo.TreatmentVO treatmentVO : query) { PmsTreatmentRecordExample pmsTreatmentRecordExample = new PmsTreatmentRecordExample(); pmsTreatmentRecordExample.createCriteria().andDelFlagEqualTo((byte) 0).andQuestionCodeEqualTo("JBXX_ZYZD").andTreatmentIdEqualTo(treatmentVO.getId()); @@ -120,6 +167,21 @@ public class PmsTreatmentServiceImpl implements PmsTreatmentService { if (CollectionUtil.isNotEmpty(pmsTreatmentRecords)) { treatmentVO.setDiagnosisName(pmsTreatmentRecords.stream().map(PmsTreatmentRecord::getAnswer).collect(Collectors.joining(","))); } + List queueVos = fmsFollowupDao.queryQueueListByPatientId(treatmentVO.getPatientId()); + if (CollectionUtil.isNotEmpty(queueVos)) { + Map map = new HashMap<>(); + if (CollectionUtil.isNotEmpty(commonFollowupQueue)) { + List followupQueueVOS1 = BeanUtil.copyToList(commonFollowupQueue, FmsFollowupVo.FollowupQueueVO.class); + map = followupQueueVOS1.stream().collect(Collectors.toMap(FmsFollowupVo.FollowupQueueVO::getId, Function.identity())); + } + for (PmsTreatmentVo.TreatmentVO.QueueVo queueVo : queueVos) { + FmsFollowupVo.FollowupQueueVO followupQueueVO = map.get(queueVo.getQueueId()); + if (followupQueueVO != null) { + queueVo.setQueueName(followupQueueVO.getName()); + } + } + } + treatmentVO.setQueueVoList(queueVos); } } return query; @@ -205,4 +267,99 @@ public class PmsTreatmentServiceImpl implements PmsTreatmentService { return treatmentRecordVO; } + + @Override + public void exportTreatment(HttpServletResponse response, PmsTreatmentDto.TreatmentQueryDTO dto) { + List treatmentVOList = listTreatment(dto); + if (CollectionUtil.isEmpty(treatmentVOList)) { + throw new BaseException("暂无数据"); + } + BigExcelWriter writer = new BigExcelWriter(treamentTemplate, ""); + int row = 0; + for (int i = 0; i < treatmentVOList.size(); i++) { + row += 1; + writer.writeCellValue(0, row, DateUtil.format(treatmentVOList.get(i).getCreateTime(), "yyyy-MM-dd HH:mm:ss")); + writer.writeCellValue(1, row, treatmentVOList.get(i).getName()); + writer.writeCellValue(2, row, treatmentVOList.get(i).getGender() == null ? "未知" : treatmentVOList.get(i).getGender() == 0 ? "男" : "女"); + writer.writeCellValue(3, row, treatmentVOList.get(i).getAge()); + Integer idCardType = treatmentVOList.get(i).getIdCardType(); + if (idCardType != null) { + switch (idCardType) { + case 0: + writer.writeCellValue(4, row, "身份证"); + break; + case 1: + writer.writeCellValue(4, row, "护照或外国人永居证"); + break; + case 2: + writer.writeCellValue(4, row, "港澳居民来往内地通行证"); + break; + case 3: + writer.writeCellValue(4, row, "其他"); + } + } + writer.writeCellValue(5, row, treatmentVOList.get(i).getIdCard()); + writer.writeCellValue(6, row, treatmentVOList.get(i).getVisitType() == 0 ? "门诊" : "住院"); + writer.writeCellValue(7, row, treatmentVOList.get(i).getVisitNumber()); + writer.writeCellValue(8, row, DateUtil.format(treatmentVOList.get(i).getVisitTime(), "yyyy-MM-dd HH:mm:ss")); + writer.writeCellValue(9, row, treatmentVOList.get(i).getDischargeTime()); + writer.writeCellValue(10, row, treatmentVOList.get(i).getDoctor()); + writer.writeCellValue(12, row, treatmentVOList.get(i).getCreateBy()); + } + String filename = StrUtil.format("患者档案-{}.xlsx", DateUtil.date().toString("yyyyMMdd")); + + //response为HttpServletResponse对象 + response.setContentType("application/vnd.ms-excel;charset=utf-8"); + //test.xls是弹出下载对话框的文件名,不能为中文,中文请自行编码 + response.setHeader("Content-Disposition", "attachment;filename=" + filename); + ServletOutputStream out = null; + try { + out = response.getOutputStream(); + writer.flush(out); + } catch ( + IOException e) { + e.printStackTrace(); + } finally { + // 关闭writer,释放内存 + writer.close(); + //此处记得关闭输出Servlet流 + IoUtil.close(out); + } + } + + @Override + public void importTreatment(MultipartFile file) throws IOException { + //读取excel + List pmsPatientList = CollectionUtil.newArrayList(); + ExcelUtil.readBySax(file.getInputStream(), 0, (sheetIndex, rowIndex, rowList) -> { + //患者姓名 性别 年龄 证件类型(0身份证;1护照或外国人永居证; 2港澳居民来往内地通行; 3台湾居民来往大陆通行证; 4其他;) 证件号码 门诊/住院 门诊号/住院号 门诊时间/住院时间 出院时间 责任医生 主要诊断 建档人 建档时间 档案状态 + try { + if (rowIndex < 1) { + return; + } + PmsTreatmentDto.TreatmentAdd dto = new PmsTreatmentDto.TreatmentAdd(); + dto.setName(rowList.get(1).toString()); + dto.setGender(rowList.get(2).toString().trim().equals("男") ? 0 : 1); + String idcard = rowList.get(5).toString(); + if (StrUtil.isNotEmpty(idcard) && IdcardUtil.isValidCard(idcard)) { + dto.setBirthDate(IdcardUtil.getBirthDate(idcard)); + } + dto.setIdCardType(rowList.get(4).toString().trim().equals("身份证") ? 0 : rowList.get(7).toString().trim().equals("护照或外国人永居证") ? 1 : rowList.get(7).toString().trim().equals("港澳居民来往内地通行证") ? 2 : rowList.get(7).toString().trim().equals("台湾居民来往大陆通行证") ? 3 : 4); + dto.setIdCard(idcard); + dto.setVisitType(rowList.get(6).toString().trim().equals("门诊") ? 0 : 1); + dto.setVisitNumber(rowList.get(7).toString()); + dto.setVisitTime(DateUtil.parse(rowList.get(8).toString())); + dto.setDischargeTime(DateUtil.parse(rowList.get(9).toString())); + dto.setDoctor(rowList.get(10).toString()); + dto.setCreateBy(SecurityUtils.getUsername()); + dto.setStatus(0); + dto.setCreateBy(SecurityUtils.getUsername()); + addTreatment(dto); + } catch (Exception e) { + e.printStackTrace(); + throw new BaseException(StrUtil.format("导入诊疗信息错误:sheet:{},row:{}, {}", + sheetIndex + 1, rowIndex + 1, ExceptionUtil.getExceptionMessage(e))); + } + }); + } } diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/StatisticsServiceImpl.java b/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/StatisticsServiceImpl.java index cbfde025..10654819 100644 --- a/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/StatisticsServiceImpl.java +++ b/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/StatisticsServiceImpl.java @@ -2,6 +2,7 @@ package com.acupuncture.system.service.impl; import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.collection.CollUtil; +import com.acupuncture.common.constant.DiseaseMapping; import com.acupuncture.common.utils.SecurityUtils; import com.acupuncture.system.domain.dto.StatisticsDto; import com.acupuncture.system.domain.vo.StatisticsVo; @@ -10,8 +11,7 @@ import com.acupuncture.system.service.StatisticsService; import org.springframework.stereotype.Service; import javax.annotation.Resource; -import java.util.Comparator; -import java.util.List; +import java.util.*; import java.util.stream.Collectors; /** @@ -38,9 +38,34 @@ public class StatisticsServiceImpl implements StatisticsService { @Override public StatisticsVo.TreamentVo queryZlStatistics(StatisticsDto.Query dto) { StatisticsVo.TreamentVo treamentVo = new StatisticsVo.TreamentVo(); - List sortVoList = statisticsDao.queryZyzdStatistics(dto, SecurityUtils.getTenantId()); - if (CollUtil.isNotEmpty(sortVoList)) { - treamentVo.setSort(sortVoList.stream().sorted(Comparator.comparing(StatisticsVo.TreamentVo.SortVo::getSort, Comparator.reverseOrder())).collect(Collectors.toList())); + List answers = statisticsDao.queryZyzdStatistics(dto, SecurityUtils.getTenantId()); + // 统计病种出现次数 + if (CollUtil.isNotEmpty(answers)) { + Map diseaseCountMap = new HashMap<>(); + for (String answer : answers) { + if (answer != null && !answer.isEmpty()) { + String[] items = answer.split("!@#"); + for (String item : items) { + String code = item.split(" ")[0]; // 提取编码 + String diseaseName = DiseaseMapping.DISEASE_MAP.get(code); + if (diseaseName != null) { + diseaseCountMap.put(diseaseName, diseaseCountMap.getOrDefault(diseaseName, 0) + 1); + } + } + } + } + // 转换为列表并排序 + List> sortedList = new ArrayList<>(diseaseCountMap.entrySet()); + sortedList.sort((e1, e2) -> e2.getValue().compareTo(e1.getValue())); + + // 封装为SortVo对象 + List result = new ArrayList<>(); + int total = sortedList.size(); + for (int i = 0; i < sortedList.size(); i++) { + Map.Entry entry = sortedList.get(i); + result.add(new StatisticsVo.TreamentVo.SortVo(total, i + 1, "主要诊断", entry.getKey(), entry.getValue())); + } + treamentVo.setSort(result); } treamentVo.setTxfb(statisticsDao.queryTxfbStatistics(dto, SecurityUtils.getTenantId())); treamentVo.setZytz(statisticsDao.queryZytzStatistics(dto, SecurityUtils.getTenantId())); @@ -66,26 +91,26 @@ public class StatisticsServiceImpl implements StatisticsService { } @Override - public StatisticsVo.SffbVo querySfStatistics(StatisticsDto.Query dto) { + public List querySfStatistics(StatisticsDto.Query dto) { StatisticsVo.SffbVo sffbVo = new StatisticsVo.SffbVo(); - List dlVos = statisticsDao.querySfStatistics(dto, SecurityUtils.getTenantId()); - if (CollUtil.isNotEmpty(dlVos)) { - for (StatisticsVo.SffbVo.DlVo dlVo : dlVos) { - if (dlVo.getQueueId() == 10L) { - //减重队列 - StatisticsVo.SffbVo.DlVo jzdl = new StatisticsVo.SffbVo.DlVo(); - BeanUtil.copyProperties(dlVo, jzdl); - sffbVo.setJzdl(jzdl); - }else if (dlVo.getQueueId() == 11L) { - //失眠队列 - //减重队列 - StatisticsVo.SffbVo.DlVo smdl = new StatisticsVo.SffbVo.DlVo(); - BeanUtil.copyProperties(dlVo, smdl); - sffbVo.setSmdl(smdl); - } - } - } - return sffbVo; + return statisticsDao.querySfStatistics(dto, SecurityUtils.getTenantId()); +// if (CollUtil.isNotEmpty(dlVos)) { +// for (StatisticsVo.SffbVo.DlVo dlVo : dlVos) { +// if (dlVo.getQueueId() == 10L) { +// //减重队列 +// StatisticsVo.SffbVo.DlVo jzdl = new StatisticsVo.SffbVo.DlVo(); +// BeanUtil.copyProperties(dlVo, jzdl); +// sffbVo.setJzdl(jzdl); +// } else if (dlVo.getQueueId() == 11L) { +// //失眠队列 +// //减重队列 +// StatisticsVo.SffbVo.DlVo smdl = new StatisticsVo.SffbVo.DlVo(); +// BeanUtil.copyProperties(dlVo, smdl); +// sffbVo.setSmdl(smdl); +// } +// } +// } +// return sffbVo; } @Override diff --git a/acupuncture-system/src/main/resources/mapper/dao/AdminTongjiDao.xml b/acupuncture-system/src/main/resources/mapper/dao/AdminTongjiDao.xml new file mode 100644 index 00000000..1baab239 --- /dev/null +++ b/acupuncture-system/src/main/resources/mapper/dao/AdminTongjiDao.xml @@ -0,0 +1,306 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/acupuncture-system/src/main/resources/mapper/dao/FmsFollowupDao.xml b/acupuncture-system/src/main/resources/mapper/dao/FmsFollowupDao.xml index ae180133..e65c51ee 100644 --- a/acupuncture-system/src/main/resources/mapper/dao/FmsFollowupDao.xml +++ b/acupuncture-system/src/main/resources/mapper/dao/FmsFollowupDao.xml @@ -50,14 +50,13 @@ - - + @@ -66,7 +65,7 @@ - + @@ -93,40 +92,70 @@ FROM fms_patient_queue_relation r left join fms_followup_queue q - on r.queue_id = q.id + on r.queue_id = q.id or q.id is null WHERE r.del_flag = 0 - - AND queue_id = #{id} + AND r.queue_id = #{id} AND r.task_flag = #{taskFlag} - group by r.id_card, r.queue_id + group by r.id_card, r.tenant_id @@ -143,4 +172,16 @@ followup_time = #{dto.followupTime}, followup_text = #{dto.followupText} WHERE id =#{dto.id} + + diff --git a/acupuncture-system/src/main/resources/mapper/dao/PmsPatientDao.xml b/acupuncture-system/src/main/resources/mapper/dao/PmsPatientDao.xml index 47409b2b..c4065813 100644 --- a/acupuncture-system/src/main/resources/mapper/dao/PmsPatientDao.xml +++ b/acupuncture-system/src/main/resources/mapper/dao/PmsPatientDao.xml @@ -42,7 +42,7 @@ AND p.id_card = #{query.idCard} - AND p.source = #{query.source} + AND p.source = #{query.sourceId} AND DATE_FORMAT(FROM_DAYS(DATEDIFF(NOW(), p.birth_date)), '%Y') + 0 >= #{query.startAge} @@ -58,6 +58,7 @@ ) + order by p.create_time desc diff --git a/acupuncture-system/src/main/resources/mapper/dao/PmsTreatmentDao.xml b/acupuncture-system/src/main/resources/mapper/dao/PmsTreatmentDao.xml index f8a9ee05..01f5d1e1 100644 --- a/acupuncture-system/src/main/resources/mapper/dao/PmsTreatmentDao.xml +++ b/acupuncture-system/src/main/resources/mapper/dao/PmsTreatmentDao.xml @@ -5,56 +5,64 @@ diff --git a/acupuncture-system/src/main/resources/mapper/dao/StatisticsDao.xml b/acupuncture-system/src/main/resources/mapper/dao/StatisticsDao.xml index c50c97b8..c18171b4 100644 --- a/acupuncture-system/src/main/resources/mapper/dao/StatisticsDao.xml +++ b/acupuncture-system/src/main/resources/mapper/dao/StatisticsDao.xml @@ -34,7 +34,45 @@ - WITH RECURSIVE diagnosis_split AS ( - SELECT - TRIM(SUBSTRING_INDEX(SUBSTRING_INDEX(answer, '!@#', 1), '!@#', -1)) AS disease_name - FROM pms_treatment_record - WHERE question_code = 'JBXX_ZYZD' AND answer IS NOT NULL AND answer != '' - UNION ALL - SELECT - TRIM(SUBSTRING_INDEX(SUBSTRING_INDEX(answer, '!@#', n.n), '!@#', -1)) AS disease_name - FROM pms_treatment_record - JOIN ( - SELECT 2 AS n UNION ALL SELECT 3 UNION ALL SELECT 4 UNION ALL SELECT 5 UNION ALL SELECT 6 - ) n - WHERE question_code = 'JBXX_ZYZD' AND answer IS NOT NULL AND answer != '' - AND CHAR_LENGTH(answer) - CHAR_LENGTH(REPLACE(answer, '!@#', '')) >= n.n - 1 -), -disease_count AS ( - SELECT - CASE - WHEN disease_name REGEXP '^[^0-9]+$' THEN disease_name -- 只包含字母的病种名称 - ELSE SUBSTRING_INDEX(disease_name, ' ', 1) -- 提取病种名称部分 - END AS disease_name, - COUNT(0) AS count - FROM diagnosis_split - GROUP BY disease_name - ) - SELECT - disease_nameclear, - count - FROM disease_count - ORDER BY count DESC; + SELECT queue_id as queueId, + q.name as queueName, COUNT(*) AS num, -- 总记录数 - SUM(CASE WHEN status = 0 AND followup_time IS NULL AND end_time > NOW() THEN 1 ELSE 0 END) AS dsf, -- 待随访 - SUM(CASE WHEN status = 0 AND followup_time IS NULL AND end_time BETWEEN DATE_SUB(NOW(), INTERVAL 2 DAY) AND DATE_ADD(NOW(), INTERVAL 2 DAY) THEN 1 ELSE 0 END) AS ljsf, -- 临近随访 - SUM(CASE WHEN (status = 0 AND followup_time IS NULL AND end_time < NOW()) OR (status = 1 AND followup_time > end_time) THEN 1 ELSE 0 END) AS cqsf, -- 超期随访 - SUM(CASE WHEN status = 1 AND followup_time <= end_time THEN 1 ELSE 0 END) AS zc -- 正常随访 + SUM(CASE WHEN t.status = 0 AND followup_time IS NULL AND end_time > NOW() THEN 1 ELSE 0 END) AS dsf, -- 待随访 + SUM(CASE WHEN t.status = 0 AND followup_time IS NULL AND end_time BETWEEN DATE_SUB(NOW(), INTERVAL 2 DAY) AND DATE_ADD(NOW(), INTERVAL 2 DAY) THEN 1 ELSE 0 END) AS ljsf, -- 临近随访 + SUM(CASE WHEN (t.status = 0 AND followup_time IS NULL AND end_time < NOW()) OR (t.status = 1 AND followup_time > end_time) THEN 1 ELSE 0 END) AS cqsf, -- 超期随访 + SUM(CASE WHEN t.status = 1 AND followup_time <= end_time THEN 1 ELSE 0 END) AS zc -- 正常随访 FROM - fms_followup_task + fms_followup_task t + left join fms_followup_queue q on t.queue_id = q.id WHERE - del_flag = 0 + t.del_flag = 0 group by queue_id diff --git a/acupuncture-system/src/main/resources/mapper/system/FmsPatientQueueRelationMapper.xml b/acupuncture-system/src/main/resources/mapper/system/FmsPatientQueueRelationMapper.xml index 55bcdba2..8ec847cf 100644 --- a/acupuncture-system/src/main/resources/mapper/system/FmsPatientQueueRelationMapper.xml +++ b/acupuncture-system/src/main/resources/mapper/system/FmsPatientQueueRelationMapper.xml @@ -2,8 +2,8 @@ - - + + @@ -14,14 +14,15 @@ + + - @@ -83,9 +84,9 @@ - patient_id, queue_id, name, pinyin_full, pinyin_simple, gender, birth_date, ethnicity, - education_years, phone, id_card_type, id_card, tenant_id, del_flag, create_by, create_time, - update_by, update_time, remark, discharge_time, task_flag + id, patient_id, name, pinyin_full, pinyin_simple, gender, birth_date, ethnicity, + education_years, phone, id_card_type, id_card, discharge_time, tenant_id, queue_id, + del_flag, create_by, create_time, update_by, update_time, remark, task_flag - select from fms_patient_queue_relation - where patient_id = #{patientId,jdbcType=BIGINT} - and queue_id = #{queueId,jdbcType=BIGINT} + where id = #{id,jdbcType=BIGINT} - + delete from fms_patient_queue_relation - where patient_id = #{patientId,jdbcType=BIGINT} - and queue_id = #{queueId,jdbcType=BIGINT} + where id = #{id,jdbcType=BIGINT} - insert into fms_patient_queue_relation (patient_id, queue_id, name, + insert into fms_patient_queue_relation (id, patient_id, name, pinyin_full, pinyin_simple, gender, birth_date, ethnicity, education_years, phone, id_card_type, id_card, - tenant_id, del_flag, create_by, - create_time, update_by, update_time, - remark, discharge_time, task_flag - ) - values (#{patientId,jdbcType=BIGINT}, #{queueId,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR}, + discharge_time, tenant_id, queue_id, + del_flag, create_by, create_time, + update_by, update_time, remark, + task_flag) + values (#{id,jdbcType=BIGINT}, #{patientId,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR}, #{pinyinFull,jdbcType=VARCHAR}, #{pinyinSimple,jdbcType=VARCHAR}, #{gender,jdbcType=TINYINT}, #{birthDate,jdbcType=DATE}, #{ethnicity,jdbcType=VARCHAR}, #{educationYears,jdbcType=INTEGER}, #{phone,jdbcType=VARCHAR}, #{idCardType,jdbcType=TINYINT}, #{idCard,jdbcType=VARCHAR}, - #{tenantId,jdbcType=BIGINT}, #{delFlag,jdbcType=TINYINT}, #{createBy,jdbcType=VARCHAR}, - #{createTime,jdbcType=TIMESTAMP}, #{updateBy,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP}, - #{remark,jdbcType=VARCHAR}, #{dischargeTime,jdbcType=TIMESTAMP}, #{taskFlag,jdbcType=TINYINT} - ) + #{dischargeTime,jdbcType=TIMESTAMP}, #{tenantId,jdbcType=BIGINT}, #{queueId,jdbcType=BIGINT}, + #{delFlag,jdbcType=TINYINT}, #{createBy,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, + #{updateBy,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP}, #{remark,jdbcType=VARCHAR}, + #{taskFlag,jdbcType=TINYINT}) insert into fms_patient_queue_relation + + id, + patient_id, - - queue_id, - name, @@ -170,9 +169,15 @@ id_card, + + discharge_time, + tenant_id, + + queue_id, + del_flag, @@ -191,20 +196,17 @@ remark, - - discharge_time, - task_flag, + + #{id,jdbcType=BIGINT}, + #{patientId,jdbcType=BIGINT}, - - #{queueId,jdbcType=BIGINT}, - #{name,jdbcType=VARCHAR}, @@ -235,9 +237,15 @@ #{idCard,jdbcType=VARCHAR}, + + #{dischargeTime,jdbcType=TIMESTAMP}, + #{tenantId,jdbcType=BIGINT}, + + #{queueId,jdbcType=BIGINT}, + #{delFlag,jdbcType=TINYINT}, @@ -256,9 +264,6 @@ #{remark,jdbcType=VARCHAR}, - - #{dischargeTime,jdbcType=TIMESTAMP}, - #{taskFlag,jdbcType=TINYINT}, @@ -273,12 +278,12 @@ update fms_patient_queue_relation + + id = #{record.id,jdbcType=BIGINT}, + patient_id = #{record.patientId,jdbcType=BIGINT}, - - queue_id = #{record.queueId,jdbcType=BIGINT}, - name = #{record.name,jdbcType=VARCHAR}, @@ -309,9 +314,15 @@ id_card = #{record.idCard,jdbcType=VARCHAR}, + + discharge_time = #{record.dischargeTime,jdbcType=TIMESTAMP}, + tenant_id = #{record.tenantId,jdbcType=BIGINT}, + + queue_id = #{record.queueId,jdbcType=BIGINT}, + del_flag = #{record.delFlag,jdbcType=TINYINT}, @@ -330,9 +341,6 @@ remark = #{record.remark,jdbcType=VARCHAR}, - - discharge_time = #{record.dischargeTime,jdbcType=TIMESTAMP}, - task_flag = #{record.taskFlag,jdbcType=TINYINT}, @@ -343,8 +351,8 @@ update fms_patient_queue_relation - set patient_id = #{record.patientId,jdbcType=BIGINT}, - queue_id = #{record.queueId,jdbcType=BIGINT}, + set id = #{record.id,jdbcType=BIGINT}, + patient_id = #{record.patientId,jdbcType=BIGINT}, name = #{record.name,jdbcType=VARCHAR}, pinyin_full = #{record.pinyinFull,jdbcType=VARCHAR}, pinyin_simple = #{record.pinyinSimple,jdbcType=VARCHAR}, @@ -355,14 +363,15 @@ phone = #{record.phone,jdbcType=VARCHAR}, id_card_type = #{record.idCardType,jdbcType=TINYINT}, id_card = #{record.idCard,jdbcType=VARCHAR}, + discharge_time = #{record.dischargeTime,jdbcType=TIMESTAMP}, tenant_id = #{record.tenantId,jdbcType=BIGINT}, + queue_id = #{record.queueId,jdbcType=BIGINT}, del_flag = #{record.delFlag,jdbcType=TINYINT}, create_by = #{record.createBy,jdbcType=VARCHAR}, create_time = #{record.createTime,jdbcType=TIMESTAMP}, update_by = #{record.updateBy,jdbcType=VARCHAR}, update_time = #{record.updateTime,jdbcType=TIMESTAMP}, remark = #{record.remark,jdbcType=VARCHAR}, - discharge_time = #{record.dischargeTime,jdbcType=TIMESTAMP}, task_flag = #{record.taskFlag,jdbcType=TINYINT} @@ -371,6 +380,9 @@ update fms_patient_queue_relation + + patient_id = #{patientId,jdbcType=BIGINT}, + name = #{name,jdbcType=VARCHAR}, @@ -401,9 +413,15 @@ id_card = #{idCard,jdbcType=VARCHAR}, + + discharge_time = #{dischargeTime,jdbcType=TIMESTAMP}, + tenant_id = #{tenantId,jdbcType=BIGINT}, + + queue_id = #{queueId,jdbcType=BIGINT}, + del_flag = #{delFlag,jdbcType=TINYINT}, @@ -422,19 +440,16 @@ remark = #{remark,jdbcType=VARCHAR}, - - discharge_time = #{dischargeTime,jdbcType=TIMESTAMP}, - task_flag = #{taskFlag,jdbcType=TINYINT}, - where patient_id = #{patientId,jdbcType=BIGINT} - and queue_id = #{queueId,jdbcType=BIGINT} + where id = #{id,jdbcType=BIGINT} update fms_patient_queue_relation - set name = #{name,jdbcType=VARCHAR}, + set patient_id = #{patientId,jdbcType=BIGINT}, + name = #{name,jdbcType=VARCHAR}, pinyin_full = #{pinyinFull,jdbcType=VARCHAR}, pinyin_simple = #{pinyinSimple,jdbcType=VARCHAR}, gender = #{gender,jdbcType=TINYINT}, @@ -444,16 +459,16 @@ phone = #{phone,jdbcType=VARCHAR}, id_card_type = #{idCardType,jdbcType=TINYINT}, id_card = #{idCard,jdbcType=VARCHAR}, + discharge_time = #{dischargeTime,jdbcType=TIMESTAMP}, tenant_id = #{tenantId,jdbcType=BIGINT}, + queue_id = #{queueId,jdbcType=BIGINT}, del_flag = #{delFlag,jdbcType=TINYINT}, create_by = #{createBy,jdbcType=VARCHAR}, create_time = #{createTime,jdbcType=TIMESTAMP}, update_by = #{updateBy,jdbcType=VARCHAR}, update_time = #{updateTime,jdbcType=TIMESTAMP}, remark = #{remark,jdbcType=VARCHAR}, - discharge_time = #{dischargeTime,jdbcType=TIMESTAMP}, task_flag = #{taskFlag,jdbcType=TINYINT} - where patient_id = #{patientId,jdbcType=BIGINT} - and queue_id = #{queueId,jdbcType=BIGINT} + where id = #{id,jdbcType=BIGINT} \ No newline at end of file