Forráskód Böngészése

31天再入院科室逻辑调整

chengyao 4 éve
szülő
commit
a5d48dcf67

+ 1 - 5
src/main/java/com/diagbot/dto/ReBeHosByDeptDTO.java

@@ -25,11 +25,7 @@ public class ReBeHosByDeptDTO {
      */
     @Excel(name = "性别", width = 10, needMerge = true, orderNum = "2")
     private String sex;
-    /**
-     * 主诊断
-     */
-    @Excel(name = "主诊断", width = 50, needMerge = true, orderNum = "3")
-    private String diagnose;
+
     /**
      * 间隔天数
      */

+ 18 - 4
src/main/java/com/diagbot/dto/ReBeHosDetailByDeptDTO.java

@@ -25,6 +25,7 @@ public class ReBeHosDetailByDeptDTO {
      */
     @Excel(name = "病人姓名", width = 20, orderNum = "2")
     private String name;
+
     /**
      * 病历等级
      */
@@ -51,26 +52,39 @@ public class ReBeHosDetailByDeptDTO {
      */
     @Excel(name = "主管医生", width = 50, orderNum = "6")
     private String doctorName;
+
+    /**
+     * 入院诊断
+     */
+    @Excel(name = "入院诊断", width = 50, needMerge = true, orderNum = "7")
+    private String diagnose;
+
+    /**
+     * 出院诊断
+     */
+    @Excel(name = "出院诊断", width = 50, needMerge = true, orderNum = "8")
+    private String diagnoseName;
+
     /**
      * 出院日期
      */
-    @Excel(name = "出院日期", format = "yyyy-MM-dd", width = 30, orderNum = "7")
+    @Excel(name = "出院日期", format = "yyyy-MM-dd", width = 30, orderNum = "9")
     @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
     private Date leaveHospitalDate;
     /**
      * 入院日期
      */
-    @Excel(name = "入院日期", format = "yyyy-MM-dd", width = 30, orderNum = "8")
+    @Excel(name = "入院日期", format = "yyyy-MM-dd", width = 30, orderNum = "10")
     @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
     private Date behospitalDate;
     /**
      * 住院天数
      */
-    @Excel(name = "住院天数", width = 15, orderNum = "9")
+    @Excel(name = "住院天数", width = 15, orderNum = "11")
     private String behospitalDayNum;
     /**
      * 住院费用
      */
-    @Excel(name = "住院费用", width = 15, orderNum = "10")
+    @Excel(name = "住院费用", width = 15, orderNum = "12")
     private String totleFee;
 }

+ 15 - 13
src/main/java/com/diagbot/dto/ReBeHosDetailDTO.java

@@ -26,26 +26,16 @@ public class ReBeHosDetailDTO {
     @Excel(name = "病人姓名", width = 20, orderNum = "2")
     private String name;
 
-    /**
-     * 入院诊断
-     */
-    @Excel(name = "入院诊断", width = 50, needMerge = true, orderNum = "3")
-    private String diagnose;
 
-    /**
-     * 出院诊断
-     */
-    @Excel(name = "出院诊断", width = 50, needMerge = true, orderNum = "4")
-    private String diagnoseName;
     /**
      * 病历等级
      */
-    @Excel(name = "病历等级", width = 10, orderNum = "5")
+    @Excel(name = "病历等级", width = 10, orderNum = "3")
     private String level;
     /**
      * 病历得分
      */
-    @Excel(name = "病历得分", width = 10, orderNum = "6")
+    @Excel(name = "病历得分", width = 10, orderNum = "4")
     private Double scoreRes;
     /**
      * 科室编码
@@ -54,8 +44,20 @@ public class ReBeHosDetailDTO {
     /**
      * 科室
      */
-    @Excel(name = "科室", width = 50, orderNum = "7")
+    @Excel(name = "科室", width = 50, orderNum = "5")
     private String behDeptName;
+
+    /**
+     * 入院诊断
+     */
+    @Excel(name = "入院诊断", width = 50, needMerge = true, orderNum = "6")
+    private String diagnose;
+
+    /**
+     * 出院诊断
+     */
+    @Excel(name = "出院诊断", width = 50, needMerge = true, orderNum = "7")
+    private String diagnoseName;
     /**
      * 出院日期
      */

+ 30 - 1
src/main/java/com/diagbot/facade/ConsoleByDeptFacade.java

@@ -900,13 +900,24 @@ public class ConsoleByDeptFacade {
      */
     public IPage<ReBeHosByDeptDTO> reHos31DaysPageByDept(ReBeHosPageVO reBeHosPageVO) {
         filterFacade.reBeHosPageVOSet(reBeHosPageVO);
+        long size = reBeHosPageVO.getSize();
+        long current = reBeHosPageVO.getCurrent();
+        reBeHosPageVO.setCurrent(1L);
+        reBeHosPageVO.setSize(10000L);
         IPage<ReBeHosMergeDTO> page = behospitalInfoFacade.reHos31DaysPageByDept(reBeHosPageVO);
         List<ReBeHosMergeDTO> records = page.getRecords();
         IPage<ReBeHosByDeptDTO> retPage = new Page<>();
         BeanUtil.copyProperties(page, retPage);
         List<ReBeHosByDeptDTO> retRecords = Lists.newLinkedList();
         if (ListUtil.isNotEmpty(records)) {
-            for (ReBeHosMergeDTO record : records) {
+            Iterator<ReBeHosMergeDTO> iterator = records.iterator();
+            while(iterator.hasNext()){
+                ReBeHosMergeDTO record = iterator.next();
+                Boolean flag = ConsoleFacade.isContainDiagnose(record);
+                if(!flag){
+                    iterator.remove();
+                    continue;
+                }
                 ReBeHosByDeptDTO retRecord = new ReBeHosByDeptDTO();
                 BeanUtil.copyProperties(record, retRecord);
                 List<ReBeHosDetailByDeptDTO> details = Lists.newLinkedList();
@@ -918,6 +929,8 @@ public class ConsoleByDeptFacade {
                 lastDetailRecord.setBehDeptId(record.getLastBehDeptId());
                 lastDetailRecord.setBehDeptName(record.getLastBehDeptName());
                 lastDetailRecord.setDoctorName(record.getLastDoctorName());
+                lastDetailRecord.setDiagnose(record.getLastDiagnose());
+                lastDetailRecord.setDiagnoseName(record.getLastDiagnoseName());
                 lastDetailRecord.setBehospitalCode(record.getLastBehospitalCode());
                 lastDetailRecord.setBehospitalDate(record.getLastBehospitalDate());
                 lastDetailRecord.setLeaveHospitalDate(record.getLastLeaveHospitalDate());
@@ -930,6 +943,22 @@ public class ConsoleByDeptFacade {
                 retRecords.add(retRecord);
             }
         }
+        retPage.setSize(size);
+        retPage.setTotal(retRecords.size());
+        retPage.setCurrent(current);
+        if(0 == current){
+            current = 1;
+        }
+        int startIndex = ((int)current -1)*10;
+        int endIndex = startIndex + (int) size;
+
+        if(retRecords.size()>1){
+            if( retRecords.size()-startIndex<(int)size){
+                retRecords = retRecords.subList(startIndex,retRecords.size());
+            }else{
+                retRecords = retRecords.subList(startIndex,endIndex );
+            }
+        }
         retPage.setRecords(retRecords);
         return retPage;
     }

+ 2 - 2
src/main/java/com/diagbot/facade/ConsoleFacade.java

@@ -3066,7 +3066,7 @@ public class ConsoleFacade {
     }
 
 
-    Boolean isContainDiagnose(ReBeHosMergeDTO record){
+   static Boolean isContainDiagnose(ReBeHosMergeDTO record){
         String lastDiagnoseName = record.getLastDiagnoseName().replace(",","、").replace(",","、");
 
         String diagnose = record.getDiagnose().replace(",","、").replace(",","、");
@@ -3079,7 +3079,7 @@ public class ConsoleFacade {
         return true;
     };
 
-    Set strTranListMethod(String str){
+    static Set strTranListMethod(String str){
         Set<String> names = new HashSet<>();
         if(str.contains("、")){
             for (String diagnoseName : str.split("、")) {

+ 75 - 32
src/main/resources/mapper/BehospitalInfoMapper.xml

@@ -14323,6 +14323,7 @@
         SELECT
         t.fileCode,
         t.diagnose,
+        t.diagnoseName,
         t.NAME,
         t.sex,
         t.hospitalId,
@@ -14333,6 +14334,8 @@
         t.behospitalCode,
         t.behospitalDate,
         t.leaveHospitalDate,
+        t.lastDiagnose,
+        t.lastDiagnoseName,
         t.lastBehDeptId,
         t.lastBehDeptName,
         t.lastDoctorName,
@@ -14353,6 +14356,7 @@
         SELECT
         be.fileCode,
         be.diagnose,
+        be.diagnoseName,
         be.NAME,
         be.sex,
         be.hospitalId,
@@ -14363,6 +14367,8 @@
         be.behospitalCode,
         be.behospitalDate,
         be.leaveHospitalDate,
+        be.lastDiagnose,
+        be.lastDiagnoseName,
         be.lastBehDeptId,
         be.lastBehDeptName,
         be.lastDoctorId,
@@ -14376,6 +14382,7 @@
         SELECT
         r1.file_code AS fileCode,
         r1.diagnose,
+        r1.diagnose_name AS diagnoseName,
         r1.NAME,
         r1.sex,
         r1.hospital_id AS hospitalId,
@@ -14386,6 +14393,8 @@
         r1.behospital_code AS behospitalCode,
         r1.behospital_date AS behospitalDate,
         r1.leave_hospital_date AS leaveHospitalDate,
+        r2.diagnose AS lastDiagnose,
+        r2.diagnose_name AS lastDiagnoseName,
         r2.beh_dept_id AS lastBehDeptId,
         r2.beh_dept_name AS lastBehDeptName,
         r2.behospital_code AS lastBehospitalCode,
@@ -14399,9 +14408,10 @@
         SELECT
         ( @rownum := @rownum + 1 ) AS rownum,
         t1.file_code,
-        t1.diagnose,
         t1.NAME,
         t1.sex,
+        t1.diagnose,
+        t1.diagnose_name,
         t1.doctor_id,
         t1.doctor_name,
         t1.hospital_id,
@@ -14412,9 +14422,24 @@
         t1.leave_hospital_date
         FROM
         (
+        select
+        tt3.file_code,
+        tt3.behospital_code,
+        tt3.diagnose,
+        tt3.NAME,
+        tt3.sex,
+        tt3.hospital_id,
+        tt3.beh_dept_id,
+        tt3.beh_dept_name,
+        tt3.doctor_id,
+        tt3.doctor_name,
+        tt3.behospital_date,
+        tt3.leave_hospital_date,
+        GROUP_CONCAT(case when tt5.diagnose_name is not null then tt5.diagnose_name else '' end) as diagnose_name
+        FROM(
         SELECT
         tt1.file_code,
-        tt1.diagnose,
+        tt2.diagnose,
         tt2.doctor_id,
         tt2.doctor_name,
         tt2.NAME,
@@ -14428,10 +14453,7 @@
         FROM
         (
         SELECT
-        a.file_code,
-        a.diagnose,
-        a.doctor_id,
-        a.doctor_name
+        a.file_code
         FROM
         med_behospital_info a,
         sys_user_dept c
@@ -14478,8 +14500,7 @@
             AND a.name like concat('%', #{reBeHosPageVO.name},'%')
         </if>
         GROUP BY
-        a.file_code,
-        a.diagnose
+        a.file_code
         HAVING
         count(*)> 1
         ) tt1,
@@ -14491,7 +14512,6 @@
         </if>
         AND tt2.qc_type_id != 0
         AND tt1.file_code = tt2.file_code
-        AND tt1.diagnose = tt2.diagnose
         <if test="reBeHosPageVO.hospitalId != null and reBeHosPageVO.hospitalId != ''">
             AND tt2.hospital_id = #{reBeHosPageVO.hospitalId}
         </if>
@@ -14519,8 +14539,15 @@
         </if>
         ORDER BY
         tt1.file_code,
-        tt1.diagnose,
-        tt2.behospital_date DESC
+        tt2.behospital_date DESC)tt3
+        left join med_home_page tt4 on tt4.is_deleted = 'N'
+        AND tt3.hospital_id = tt4.hospital_id
+        AND tt3.behospital_code = tt4.behospital_code
+        LEFT JOIN med_home_diagnose_info tt5 on tt5.is_deleted = 'N'
+        AND tt4.hospital_id = tt5.hospital_id
+        AND tt4.home_page_id = tt5.home_page_id
+        GROUP by tt3.behospital_code
+        ORDER BY tt3.file_code,tt3.leave_hospital_date DESC
         ) t1,
         ( SELECT @rownum := 0 ) r
         ) r1
@@ -14528,22 +14555,38 @@
         SELECT
         ( @INDEX := @INDEX + 1 ) AS rownum,
         t1.file_code,
-        t1.diagnose,
         t1.NAME,
         t1.sex,
+        t1.diagnose,
+        t1.diagnose_name,
+        t1.doctor_id,
+        t1.doctor_name,
         t1.hospital_id,
         t1.beh_dept_id,
         t1.beh_dept_name,
-        t1.doctor_id,
-        t1.doctor_name,
         t1.behospital_code,
         t1.behospital_date,
         t1.leave_hospital_date
         FROM
         (
+        select
+        tt3.file_code,
+        tt3.behospital_code,
+        tt3.diagnose,
+        tt3.NAME,
+        tt3.sex,
+        tt3.hospital_id,
+        tt3.beh_dept_id,
+        tt3.beh_dept_name,
+        tt3.doctor_id,
+        tt3.doctor_name,
+        tt3.behospital_date,
+        tt3.leave_hospital_date,
+        GROUP_CONCAT(case when tt5.diagnose_name is not null then tt5.diagnose_name else '' end) as diagnose_name
+        FROM(
         SELECT
         tt1.file_code,
-        tt1.diagnose,
+        tt2.diagnose,
         tt2.doctor_id,
         tt2.doctor_name,
         tt2.NAME,
@@ -14557,10 +14600,7 @@
         FROM
         (
         SELECT
-        a.file_code,
-        a.diagnose,
-        a.doctor_id ,
-        a.doctor_name
+        a.file_code
         FROM
         med_behospital_info a,
         sys_user_dept c
@@ -14570,14 +14610,14 @@
         AND a.hospital_id = c.hospital_id
         AND a.beh_dept_id = c.dept_id
         <if test="reBeHosPageVO.deptName != null and reBeHosPageVO.deptName != ''">
-              and a.beh_dept_name = #{reBeHosPageVO.deptName}
-        </if>
-        <if test="reBeHosPageVO.userId!=null">
-            AND c.user_id = #{reBeHosPageVO.userId}
+            and a.beh_dept_name = #{reBeHosPageVO.deptName}
         </if>
         <if test="reBeHosPageVO.isPlacefile != null and reBeHosPageVO.isPlacefile != ''">
             and a.is_placefile = #{reBeHosPageVO.isPlacefile}
         </if>
+        <if test="reBeHosPageVO.userId!=null">
+            AND c.user_id = #{reBeHosPageVO.userId}
+        </if>
         AND a.qc_type_id != 0
         AND IFNULL( a.diagnose, '' )!= ''
         AND IFNULL( a.file_code, '' )!= ''
@@ -14607,8 +14647,7 @@
             AND a.name like concat('%', #{reBeHosPageVO.name},'%')
         </if>
         GROUP BY
-        a.file_code,
-        a.diagnose
+        a.file_code
         HAVING
         count(*)> 1
         ) tt1,
@@ -14620,7 +14659,6 @@
         </if>
         AND tt2.qc_type_id != 0
         AND tt1.file_code = tt2.file_code
-        AND tt1.diagnose = tt2.diagnose
         <if test="reBeHosPageVO.hospitalId != null and reBeHosPageVO.hospitalId != ''">
             AND tt2.hospital_id = #{reBeHosPageVO.hospitalId}
         </if>
@@ -14648,12 +14686,17 @@
         </if>
         ORDER BY
         tt1.file_code,
-        tt1.diagnose,
-        tt2.behospital_date DESC
-        ) t1,(
-        SELECT
-        @INDEX := 0
-        ) r
+        tt2.behospital_date DESC)tt3
+        left join med_home_page tt4 on tt4.is_deleted = 'N'
+        AND tt3.hospital_id = tt4.hospital_id
+        AND tt3.behospital_code = tt4.behospital_code
+        LEFT JOIN med_home_diagnose_info tt5 on tt5.is_deleted = 'N'
+        AND tt4.hospital_id = tt5.hospital_id
+        AND tt4.home_page_id = tt5.home_page_id
+        GROUP by tt3.behospital_code
+        ORDER BY tt3.file_code,tt3.leave_hospital_date DESC
+        ) t1,
+        ( SELECT @INDEX := 0 ) r
         ) r2 ON r1.file_code = r2.file_code
         AND r1.rownum = r2.rownum - 1
         ) be