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

Merge remote-tracking branch 'origin/dev/20210608_2.0.4' into develop

chengyao 3 éve
szülő
commit
b6db17fdff
23 módosított fájl, 500 hozzáadás és 136 törlés
  1. 13 0
      doc/033.20210608v2.0.4/qc_initv2.0.4.sql
  2. 35 4
      src/main/java/com/diagbot/aggregate/LeaveHosStatisticsAggregate.java
  3. 7 0
      src/main/java/com/diagbot/config/ResourceServerConfigurer.java
  4. 7 1
      src/main/java/com/diagbot/config/security/UrlAccessDecisionManager.java
  5. 1 1
      src/main/java/com/diagbot/dto/JwtDTO.java
  6. 6 6
      src/main/java/com/diagbot/dto/ReBeHosByDeptDTO.java
  7. 7 6
      src/main/java/com/diagbot/dto/ReBeHosDTO.java
  8. 18 4
      src/main/java/com/diagbot/dto/ReBeHosDetailByDeptDTO.java
  9. 21 4
      src/main/java/com/diagbot/dto/ReBeHosDetailDTO.java
  10. 8 1
      src/main/java/com/diagbot/dto/ReBeHosMergeDTO.java
  11. 10 0
      src/main/java/com/diagbot/facade/BehospitalInfoFacade.java
  12. 1 2
      src/main/java/com/diagbot/facade/ConsoleByDeptExportFacade.java
  13. 51 3
      src/main/java/com/diagbot/facade/ConsoleByDeptFacade.java
  14. 1 2
      src/main/java/com/diagbot/facade/ConsoleExportFacade.java
  15. 91 3
      src/main/java/com/diagbot/facade/ConsoleFacade.java
  16. 2 0
      src/main/java/com/diagbot/facade/FilterFacade.java
  17. 38 30
      src/main/java/com/diagbot/facade/SysUserFacade.java
  18. 1 1
      src/main/java/com/diagbot/vo/AnalyzeVO.java
  19. 2 0
      src/main/java/com/diagbot/vo/ReBeHosPageVO.java
  20. 0 2
      src/main/java/com/diagbot/web/BehospitalInfoController.java
  21. 1 1
      src/main/java/com/diagbot/web/SysUserController.java
  22. 179 64
      src/main/resources/mapper/BehospitalInfoMapper.xml
  23. 0 1
      src/main/resources/mapper/MedicalRecordMapper.xml

+ 13 - 0
doc/033.20210608v2.0.4/qc_initv2.0.4.sql

@@ -0,0 +1,13 @@
+use `qc`;
+
+-- 字典表加入密码正则表达式  不同的医院需要修改id为对应的医院id
+SET @id ='4';
+INSERT INTO `sys_dictionary_info` ( `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `group_type`, `name`, `val`, `return_type`, `order_no`, `remark`) VALUES ( 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '30', @id, '^(?=.*?[A-Z])(?=(.*[a-z]){1,})(?=(.*[\\d]){1,})(?=(.*[\\W]){1,})(?!.*\\s).{8,12}$', '2', '0', '正则表达式(至少8个字符,少于12个字符,大写字母+小写字母+数字+特殊字符)');
+
+UPDATE `sys_menu` SET `name`='31日再入院病历数' WHERE (`name`='31日再入院病人数');
+UPDATE `sys_menu` SET `name`='31日再入院病历数' WHERE (`name`='31日再入院病人数');
+UPDATE `sys_permission` SET  `name`='31日再入院病历数报表',`descritpion`='31日再入院病历数报表' WHERE (`permissionUrl`='/console/reHos31DaysPage');
+UPDATE `sys_permission` SET  `name`='31日再入院病历数报表',`descritpion`='31日再入院病历数报表(科室)' WHERE (`permissionUrl`='/consoleByDept/reHos31DaysPageByDept');
+
+
+

+ 35 - 4
src/main/java/com/diagbot/aggregate/LeaveHosStatisticsAggregate.java

@@ -1,15 +1,20 @@
 package com.diagbot.aggregate;
 
+import com.diagbot.dto.ReBeHosDTO;
 import com.diagbot.facade.BehospitalInfoFacade;
+import com.diagbot.facade.ConsoleFacade;
+import com.diagbot.util.BeanUtil;
 import com.diagbot.vo.FilterVO;
+import com.diagbot.vo.ReBeHosPageVO;
 import io.github.lvyahui8.spring.annotation.DataConsumer;
 import io.github.lvyahui8.spring.annotation.DataProvider;
 import io.github.lvyahui8.spring.annotation.InvokeParameter;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
-import java.util.LinkedHashMap;
-import java.util.Map;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.*;
 
 /**
  * @Description:
@@ -20,6 +25,8 @@ import java.util.Map;
 public class LeaveHosStatisticsAggregate {
     @Autowired
     private BehospitalInfoFacade behospitalInfoFacade;
+    @Autowired
+    private ConsoleFacade consoleFacade;
 
     @DataProvider("setAllLeaveHos")
     public Map<String, Object> setAllLeaveHos(
@@ -37,7 +44,7 @@ public class LeaveHosStatisticsAggregate {
         retMap.put("新生儿人数", newBornNum);
         retMap.put("手术病人数", operationNum);
         retMap.put("非医嘱离院病人数", nonAdviceNum);
-        retMap.put("31日再入院病数", reBehospitalNum);
+        retMap.put("31日再入院病数", reBehospitalNum);
         return retMap;
 
     }
@@ -105,6 +112,30 @@ public class LeaveHosStatisticsAggregate {
      */
     @DataProvider("get31DaysBehospitalCount")
     public Integer get31DaysBehospitalCount(@InvokeParameter("filterVO") FilterVO filterVO) {
-        return behospitalInfoFacade.get31DaysBehospitalCount(filterVO);
+        ReBeHosPageVO reBeHosPageVO = new ReBeHosPageVO();
+        BeanUtil.copyProperties(filterVO,reBeHosPageVO);
+        reBeHosPageVO.setStartDate(timeTrans(filterVO.getStartDate()));
+        reBeHosPageVO.setEndDate(timeTrans(filterVO.getEndDate()));
+        reBeHosPageVO.setFlag(31);
+        List<ReBeHosDTO> records = consoleFacade.reHos31DaysPage(reBeHosPageVO).getRecords();
+        Set<String> codeList = new HashSet<>();
+        records.forEach(obj->{
+            obj.getDetails().forEach(opj->{
+                codeList.add(opj.getBehospitalCode());
+            });
+        });
+        return codeList.size();
+    }
+
+    public static Date timeTrans(String time){
+        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        try {
+            Date date = format.parse(time);
+            return date;
+        } catch (ParseException e) {
+            e.printStackTrace();
+        }
+        return new Date();
+
     }
 }

+ 7 - 0
src/main/java/com/diagbot/config/ResourceServerConfigurer.java

@@ -235,7 +235,14 @@ public class ResourceServerConfigurer extends ResourceServerConfigurerAdapter {
                 .antMatchers("/consoleByDept/medicalCheckFormKs").permitAll()
                 .antMatchers("/print/export/medicalCheckExportByDept").permitAll()
                 .antMatchers("/consoleByDept/medicalCheckTitleKs").permitAll()
+                .antMatchers("/console/qualityControl").permitAll()
+                .antMatchers("/console/export/qualityControlExport").permitAll()
+                .antMatchers("/consoleByDept/qualityControlByDept").permitAll()
+                .antMatchers("/print/export/qualityControlExportByDept").permitAll()
+                .antMatchers("/qc/behospitalInfo/getMedQualityCoList").permitAll()
+                .antMatchers("/console/saveMedicaIndicator").permitAll()
                 .antMatchers("/qc/medCheckInfo/createMedBeHospitalInfoType").permitAll()
+                .antMatchers("/qc/medCheckInfo/addMedCheckInfo").permitAll()
                 .antMatchers("/**").authenticated();
         //                .antMatchers("/**").permitAll();
     }

+ 7 - 1
src/main/java/com/diagbot/config/security/UrlAccessDecisionManager.java

@@ -279,14 +279,20 @@ public class UrlAccessDecisionManager implements AccessDecisionManager {
                 || matchers("/consoleByDept/medicalCheckFormKs", request)
                 || matchers("/print/export/medicalCheckExportByDept", request)
                 || matchers("/consoleByDept/medicalCheckTitleKs", request)
+                || matchers("/console/qualityControl", request)
+                || matchers("/console/export/qualityControlExport", request)
+                || matchers("/consoleByDept/qualityControlByDept", request)
+                || matchers("/print/export/qualityControlExportByDept", request)
+                || matchers("/qc/behospitalInfo/getMedQualityCoList", request)
+                || matchers("/console/saveMedicaIndicator", request)
                 || matchers("/qc/medCheckInfo/createMedBeHospitalInfoType", request)
+                || matchers("/qc/medCheckInfo/addMedCheckInfo", request)
                 || matchers("/", request)) {
             return true;
         }
         return false;
     }
 
-
     private boolean matchers(String url, HttpServletRequest request) {
         AntPathRequestMatcher matcher = new AntPathRequestMatcher(url);
         if (matcher.matches(request)) {

+ 1 - 1
src/main/java/com/diagbot/dto/JwtDTO.java

@@ -20,5 +20,5 @@ public class JwtDTO {
     //用户权限列表
     private List<SysRoleDTO> selRoles;
     //用户密码复杂度是否符合
-//    private String passwordComplexity;
+    private String passwordComplexity;
 }

+ 6 - 6
src/main/java/com/diagbot/dto/ReBeHosByDeptDTO.java

@@ -25,19 +25,19 @@ 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;
+
     /**
      * 间隔天数
      */
     @Excel(name = "间隔天数", width = 10, needMerge = true, orderNum = "4")
     private Integer diffDays;
+
+    @Excel(name = "是否有出院31天内再住院计划", width = 30, needMerge = true,  orderNum = "5")
+    private String lastAgainBehospitalPlan;//31天再入院计划(是/否)
+
     /**
      * 比较病历组
      */
-    @ExcelCollection(name = "", orderNum = "5")
+    @ExcelCollection(name = "", orderNum = "6")
     private List<ReBeHosDetailByDeptDTO> details;
 }

+ 7 - 6
src/main/java/com/diagbot/dto/ReBeHosDTO.java

@@ -25,19 +25,20 @@ public class ReBeHosDTO {
      */
     @Excel(name = "性别", width = 10, needMerge = true, orderNum = "2")
     private String sex;
-    /**
-     * 主诊断
-     */
-    @Excel(name = "主诊断", width = 50, needMerge = true, orderNum = "3")
-    private String diagnose;
+
     /**
      * 间隔天数
      */
     @Excel(name = "间隔天数", width = 10, needMerge = true, orderNum = "4")
     private Integer diffDays;
+
+
+    @Excel(name = "是否有出院31天内再住院计划", width = 30, needMerge = true,  orderNum = "5")
+    private String lastAgainBehospitalPlan;//31天再入院计划(是/否)
+
     /**
      * 比较病历组
      */
-    @ExcelCollection(name = "", orderNum = "5")
+    @ExcelCollection(name = "", orderNum = "6")
     private List<ReBeHosDetailDTO> details;
 }

+ 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;
 }

+ 21 - 4
src/main/java/com/diagbot/dto/ReBeHosDetailDTO.java

@@ -25,6 +25,8 @@ public class ReBeHosDetailDTO {
      */
     @Excel(name = "病人姓名", width = 20, orderNum = "2")
     private String name;
+
+
     /**
      * 病历等级
      */
@@ -44,26 +46,41 @@ public class ReBeHosDetailDTO {
      */
     @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;
     /**
      * 出院日期
      */
-    @Excel(name = "出院日期", format = "yyyy-MM-dd", width = 30, orderNum = "6")
+    @Excel(name = "出院日期", format = "yyyy-MM-dd", width = 30, orderNum = "8")
     @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
     private Date leaveHospitalDate;
     /**
      * 入院日期
      */
-    @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 behospitalDate;
     /**
      * 住院天数
      */
-    @Excel(name = "住院天数", width = 15, orderNum = "8")
+    @Excel(name = "住院天数", width = 15, orderNum = "10")
     private String behospitalDayNum;
     /**
      * 住院费用
      */
-    @Excel(name = "住院费用", width = 15, orderNum = "9")
+    @Excel(name = "住院费用", width = 15, orderNum = "11")
     private String totleFee;
+
+    private String age;
+
 }

+ 8 - 1
src/main/java/com/diagbot/dto/ReBeHosMergeDTO.java

@@ -15,7 +15,8 @@ import java.util.Date;
 @Setter
 public class ReBeHosMergeDTO {
     private String fileCode;
-    private String diagnose;
+    private String diagnose = "";
+    private String diagnoseName = "";//病案首页诊断
     private String name;
     private String sex;
     private String doctorName;
@@ -29,6 +30,8 @@ public class ReBeHosMergeDTO {
     private Date behospitalDate;
     @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
     private Date leaveHospitalDate;
+    private String lastDiagnose = "";
+    private String lastDiagnoseName = "";
     private String lastBehDeptId;
     private String lastBehDeptName;
     private String lastDoctorName;
@@ -42,6 +45,10 @@ public class ReBeHosMergeDTO {
     private Integer diffDays;
     private String totleFee;
     private String behospitalDayNum;
+    private String againBehospitalPlan;//31天再入院计划(是/否)
+    private String age;//年龄
+    private String lastAge;//年龄
     private String lastTotleFee;
     private String lastBehospitalDayNum;
+    private String lastAgainBehospitalPlan;//31天再入院计划(是/否)
 }

+ 10 - 0
src/main/java/com/diagbot/facade/BehospitalInfoFacade.java

@@ -223,6 +223,13 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
                 .eq("behospital_code", getDetailVO.getBehospitalCode()), false
         );
 
+        // 获取患者年龄
+        HomePage homePage = homePageFacade.getOne(new QueryWrapper<HomePage>()
+                .eq("is_deleted", IsDeleteEnum.N.getKey())
+                .eq("hospital_id", getDetailVO.getHospitalId())
+                .eq("behospital_code", getDetailVO.getBehospitalCode()), false
+        );
+
         List<String> paramList = getDetailVO.getParamStr();// 参数列表
 
         if (ListUtil.isEmpty(paramList) || paramList.contains("beHospital")) {
@@ -231,6 +238,9 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
                 throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "该病历已删除!");
             }
             BeanUtil.copyProperties(behospitalInfo, behosDTO);
+            if(null != homePage && StringUtils.isNotEmpty(homePage.getAge()) && StringUtils.isNotEmpty(homePage.getAgeUnit())){
+                behosDTO.setAge(homePage.getAge()+homePage.getAgeUnit());
+            }
             res.put("beHospital", behosDTO);
         }
 

+ 1 - 2
src/main/java/com/diagbot/facade/ConsoleByDeptExportFacade.java

@@ -332,9 +332,8 @@ public class ConsoleByDeptExportFacade {
      * @return
      */
     public void reHos31DaysPageExportByDept(HttpServletResponse response, ReBeHosPageVO reBeHosPageVO) {
-        reBeHosPageVO.setCurrent(1L);
-        reBeHosPageVO.setSize(Long.MAX_VALUE);
         reBeHosPageVO.setSearchCount(false);
+        reBeHosPageVO.setFlag(1);
         IPage<ReBeHosByDeptDTO> page = consoleByDeptFacade.reHos31DaysPageByDept(reBeHosPageVO);
         List<ReBeHosByDeptDTO> records = page.getRecords();
         String fileName = "31天再入院统计详情.xls";

+ 51 - 3
src/main/java/com/diagbot/facade/ConsoleByDeptFacade.java

@@ -900,13 +900,25 @@ 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(Long.MAX_VALUE);
         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) {
+            List<ReBeHosByDeptDTO> retRecords = Lists.newLinkedList();
+            BeanUtil.copyProperties(page, retPage);
+            Iterator<ReBeHosMergeDTO> iterator = records.iterator();
+            while(iterator.hasNext()){
+                ReBeHosMergeDTO record = iterator.next();
+                strTrans(record);
+                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 +930,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());
@@ -929,10 +943,44 @@ public class ConsoleByDeptFacade {
                 retRecord.setDetails(details);
                 retRecords.add(retRecord);
             }
+
+        if(reBeHosPageVO.getFlag()==1){
+            size = retRecords.size();
+        }
+        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;
     }
+
+    public static void strTrans(ReBeHosMergeDTO record) {
+        String replace = record.getLastAgainBehospitalPlan();
+        if(StringUtils.isEmpty(replace)){
+            replace = "否";
+            record.setLastAgainBehospitalPlan(replace);
+            return;
+        }
+        replace = replace.replace("无", "否")
+                .replace("-", "无").replace("是一周后", "是")
+                .replace("1", "否").replace("2", "是")
+                .replace("有", "是");
+        record.setLastAgainBehospitalPlan(replace);
+    }
     /**
      * 未整改病历质控评分页-科室(内页)
      *

+ 1 - 2
src/main/java/com/diagbot/facade/ConsoleExportFacade.java

@@ -478,9 +478,8 @@ public class ConsoleExportFacade {
      * @return
      */
     public void reHos31DaysPageExport(HttpServletResponse response, ReBeHosPageVO reBeHosPageVO) {
-        reBeHosPageVO.setCurrent(1L);
-        reBeHosPageVO.setSize(Long.MAX_VALUE);
         reBeHosPageVO.setSearchCount(false);
+        reBeHosPageVO.setFlag(1);
         IPage<ReBeHosDTO> page = consoleFacade.reHos31DaysPage(reBeHosPageVO);
         List<ReBeHosDTO> records = page.getRecords();
         String fileName = "31天再入院统计详情.xls";

+ 91 - 3
src/main/java/com/diagbot/facade/ConsoleFacade.java

@@ -3002,13 +3002,25 @@ public class ConsoleFacade {
      */
     public IPage<ReBeHosDTO> reHos31DaysPage(ReBeHosPageVO reBeHosPageVO) {
         filterFacade.reBeHosPageVOSet(reBeHosPageVO);
+        long size = reBeHosPageVO.getSize();
+        long current = reBeHosPageVO.getCurrent();
+        reBeHosPageVO.setCurrent(1L);
+        reBeHosPageVO.setSize(Long.MAX_VALUE);
         IPage<ReBeHosMergeDTO> page = behospitalInfoFacade.reHos31DaysPage(reBeHosPageVO);
         List<ReBeHosMergeDTO> records = page.getRecords();
         IPage<ReBeHosDTO> retPage = new Page<>();
-        BeanUtil.copyProperties(page, retPage);
-        List<ReBeHosDTO> retRecords = Lists.newLinkedList();
         if (ListUtil.isNotEmpty(records)) {
-            for (ReBeHosMergeDTO record : records) {
+            BeanUtil.copyProperties(page, retPage);
+            List<ReBeHosDTO> retRecords = Lists.newLinkedList();
+            Iterator<ReBeHosMergeDTO> iterator = records.iterator();
+            while(iterator.hasNext()){
+                ReBeHosMergeDTO record = iterator.next();
+                ConsoleByDeptFacade.strTrans(record);
+                Boolean flag = isContainDiagnose(record);
+                if(!flag){
+                    iterator.remove();
+                    continue;
+                }
                 ReBeHosDTO retRecord = new ReBeHosDTO();
                 BeanUtil.copyProperties(record, retRecord);
                 List<ReBeHosDetailDTO> details = Lists.newLinkedList();
@@ -3017,6 +3029,9 @@ public class ConsoleFacade {
                 details.add(detailRecord);
                 ReBeHosDetailDTO lastDetailRecord = new ReBeHosDetailDTO();
                 lastDetailRecord.setName(record.getName());
+                lastDetailRecord.setAge(record.getLastAge());
+                lastDetailRecord.setDiagnose(record.getLastDiagnose());
+                lastDetailRecord.setDiagnoseName(record.getLastDiagnoseName());
                 lastDetailRecord.setBehDeptId(record.getLastBehDeptId());
                 lastDetailRecord.setBehDeptName(record.getLastBehDeptName());
                 lastDetailRecord.setBehospitalCode(record.getLastBehospitalCode());
@@ -3030,11 +3045,84 @@ public class ConsoleFacade {
                 retRecord.setDetails(details);
                 retRecords.add(retRecord);
             }
+            //首页返回全部数据
+        if(reBeHosPageVO.getFlag()==31){
+            retPage.setRecords(retRecords);
+            return retPage;
+        }
+        //导出操作
+        if(reBeHosPageVO.getFlag()==1){
+            size = retRecords.size();
+        }
+        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;
     }
 
+
+   static Boolean isContainDiagnose(ReBeHosMergeDTO record){
+       // String lastDiagnoseName = replace(record.getLastDiagnoseName());本身使用,分隔
+        String diagnose =replace(record.getDiagnose());//手动分隔
+        String lastDiagnose = replace(record.getLastDiagnose());
+        record.setDiagnose(diagnose);
+        record.setLastDiagnose(lastDiagnose);
+        Set lastDiagnoseNames = strTranListMethod(record.getLastDiagnoseName());
+        Set diagnoses = strTranListMethod(record.getDiagnose());
+        long count = diagnoses.stream().filter(obj ->null != lastDiagnoseNames && null != obj && lastDiagnoseNames.contains(obj)).count();
+        if(count<=0){
+            return false;
+        }
+        return true;
+    };
+
+    static String replace(String str){
+        if(StringUtils.isEmpty(str)){
+            return null;
+        }
+        str = str.trim().replace(";", ",").replace(";", ",")
+                        .replace("、", ",").replace(",", ",")
+                        .replace("|", ",").replace(" ", ",")
+                        .replace(":", ",") .replace(":", ",");
+        if(str.startsWith(",")){
+            str = str.substring(1);
+        }
+        if(str.endsWith(",")){
+            str = str.substring(0,str.length()-1);
+        }
+
+       return str;
+    }
+    static Set strTranListMethod(String str){
+        Set<String> names = new HashSet<>();
+        if(StringUtils.isNotEmpty(str)){
+        if(str.contains(",") && str.length()>1){
+            for (String diagnoseName : str.split(",")) {
+                names.add(diagnoseName);
+            }
+        }else{
+            names.add(str);
+             }
+        }
+        return names;
+    };
+
     /**
      * 入院人数统计(首页)
      *

+ 2 - 0
src/main/java/com/diagbot/facade/FilterFacade.java

@@ -518,10 +518,12 @@ public class FilterFacade {
      * @param reBeHosPageVO
      */
     public void reBeHosPageVOSet(ReBeHosPageVO reBeHosPageVO) {
+        if(null == reBeHosPageVO.getUserId() && StringUtils.isEmpty(reBeHosPageVO.getHospitalId())){
         String hospitalId = SysUserUtils.getCurrentHospitalID();
         String userId = SysUserUtils.getCurrentPrincipleID();
         reBeHosPageVO.setHospitalId(hospitalId);
         reBeHosPageVO.setUserId(Long.valueOf(userId));
+        }
     }
 
     /**

+ 38 - 30
src/main/java/com/diagbot/facade/SysUserFacade.java

@@ -39,6 +39,7 @@ import org.springframework.security.crypto.factory.PasswordEncoderFactories;
 import org.springframework.security.crypto.password.PasswordEncoder;
 import org.springframework.security.oauth2.common.OAuth2AccessToken;
 import org.springframework.stereotype.Component;
+import org.springframework.util.DigestUtils;
 
 import java.util.*;
 import java.util.stream.Collectors;
@@ -101,6 +102,8 @@ public class SysUserFacade extends SysUserServiceImpl {
             throw new CommonException(CommonErrorCode.PARAM_IS_NULL,
                     "请输入密码");
         }
+        //使用MD5对密码进行加密
+        String MD5Password = DigestUtils.md5DigestAsHex(password.getBytes());
         QueryWrapper<SysUser> userQueryWrapper = new QueryWrapper<>();
         userQueryWrapper.eq("username", username)
                 .eq("status", StatusEnum.Enable.getKey())
@@ -110,11 +113,11 @@ public class SysUserFacade extends SysUserServiceImpl {
             throw new CommonException(ServiceErrorCode.USER_NOT_FOUND);
         }
         PasswordEncoder passwordEncoder = PasswordEncoderFactories.createDelegatingPasswordEncoder();
-        if (!passwordEncoder.matches(password, user.getPassword())) {
+        if (!passwordEncoder.matches(MD5Password, user.getPassword())) {
             throw new CommonException(ServiceErrorCode.USER_PASSWORD_ERROR);
         }
         JWT jwt = authServiceClient.getToken("Basic dWFhLXNlcnZpY2U6MTIzNDU2",
-                "password", username, password);
+                "password", username, MD5Password);
         if (null == jwt) {
             throw new CommonException(ServiceErrorCode.GET_TOKEN_FAIL);
         }
@@ -143,22 +146,22 @@ public class SysUserFacade extends SysUserServiceImpl {
         jwtStore.setRefreshToken(jwt.getRefresh_token());
         tokenFacade.createToken(jwtStore);
         /***
-         * 未加密密码复杂度判断
+         * 未经过MD5加密密码复杂度判断
          */
-        //获取用户医院id
-//        String hospitalID = SysUserUtils.getCurrentHospitalID();
-//        Long id = user.getId();
-//        QueryWrapper<SysUserHospital> UserHospitalQueryWrapper = new QueryWrapper<>();
-//        UserHospitalQueryWrapper
-//                .eq("user_id", id)
-//                .eq("is_deleted", IsDeleteEnum.N.getKey());
-//        SysUserHospital userHospital = sysUserHospitalFacade.getOne(UserHospitalQueryWrapper, false);
-//        Long hospitalId = userHospital.getHospitalId();
-//        String idStr = String.valueOf(hospitalId);
-//        Boolean passwordRegular = passwordRegular(password,idStr);
-//        if(!passwordRegular){
-//            data.setPasswordComplexity("密码复杂度过低,请及时修改密码");
-//        }
+     //   获取用户医院id
+   //     String hospitalID = SysUserUtils.getCurrentHospitalID();
+        Long id = user.getId();
+        QueryWrapper<SysUserHospital> UserHospitalQueryWrapper = new QueryWrapper<>();
+        UserHospitalQueryWrapper
+                .eq("user_id", id)
+                .eq("is_deleted", IsDeleteEnum.N.getKey());
+        SysUserHospital userHospital = sysUserHospitalFacade.getOne(UserHospitalQueryWrapper, false);
+        Long hospitalId = userHospital.getHospitalId();
+        String idStr = String.valueOf(hospitalId);
+        Boolean passwordRegular = passwordRegular(password,idStr);
+        if(!passwordRegular){
+            data.setPasswordComplexity("未修改初始密码,请及时修改密码");
+        }
         return data;
     }
 
@@ -255,17 +258,22 @@ public class SysUserFacade extends SysUserServiceImpl {
      * @return 修改密码是否成功
      */
     public Boolean modifyPassword(String password, String modifyPassword) {
+        //使用MD5对原密码和新密码进行加密
+        String MD5Password = DigestUtils.md5DigestAsHex(password.getBytes());
+        String MD5ModifyPassword = DigestUtils.md5DigestAsHex(modifyPassword.getBytes());
         if (StringUtil.isBlank(password)) {
             throw new CommonException(CommonErrorCode.PARAM_IS_NULL,
-                    "请输入密码");
+                    "请输入密码");
         }
         if (StringUtil.isBlank(modifyPassword)) {
             throw new CommonException(CommonErrorCode.PARAM_IS_NULL,
                     "请输入新密码");
         }
-        if (password.equals(modifyPassword)) {
-            throw new CommonException(CommonErrorCode.PARAM_IS_NULL,
-                    "原密码和新密码不能相同");
+        //对传入的密码进行格式验证
+        String hospitalID = SysUserUtils.getCurrentHospitalID();
+        Boolean regularBoolean = passwordRegular(modifyPassword,hospitalID);
+        if(!regularBoolean){
+            throw new CommonException(CommonErrorCode.PARAM_IS_ERROR, "请输入正确格式的新密码");
         }
         String userId = SysUserUtils.getCurrentPrincipleID();
         SysUser user = this.getOne(new QueryWrapper<SysUser>()
@@ -277,15 +285,14 @@ public class SysUserFacade extends SysUserServiceImpl {
         }
         PasswordEncoder passwordEncoder
                 = PasswordEncoderFactories.createDelegatingPasswordEncoder();
-        if (!passwordEncoder.matches(password, user.getPassword())) {
+        if (!passwordEncoder.matches(MD5Password, user.getPassword())) {
             throw new CommonException(CommonErrorCode.PARAM_IS_ERROR, "原密码错误");
         }
-//        String hospitalID = SysUserUtils.getCurrentHospitalID();
-//        Boolean regularBoolean = passwordRegular(modifyPassword,hospitalID);
-//        if(!regularBoolean){
-//            throw new CommonException(CommonErrorCode.PARAM_IS_ERROR, "请输入正确格式的新密码");
-//        }
-        String entryPassword = passwordEncoder.encode(modifyPassword);
+        if (password.equals(modifyPassword)) {
+            throw new CommonException(CommonErrorCode.PARAM_IS_ERROR,
+                    "原密码和新密码不能相同");
+        }
+        String entryPassword = passwordEncoder.encode(MD5ModifyPassword);
         user.setPassword(entryPassword);
         user.setGmtModified(DateUtil.now());
         user.setModifier(userId);
@@ -299,14 +306,15 @@ public class SysUserFacade extends SysUserServiceImpl {
      * @return
      */
     public Boolean passwordRegular(String password,String hospitalId){
-        //获取字点表中存储的正则表达式   "^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)(?=.*[$@$!%*?&])[A-Za-z\\d$@$!%*?&]{8,}"
         boolean check=true;
         Map<String, Map<String, String>> dictionaryWithKey = sysDictionaryFacade.getDictionaryWithKey();
         if(dictionaryWithKey!=null){
             Map<String, String> stringStringMap = dictionaryWithKey.get("30");
             if(stringStringMap!=null) {
                 String regular = stringStringMap.get(hospitalId);
-                check = password.matches(regular);
+                if(StringUtil.isNotEmpty(regular)) {
+                    check = password.matches(regular);
+                }
             }
         }
         return check;

+ 1 - 1
src/main/java/com/diagbot/vo/AnalyzeVO.java

@@ -28,6 +28,6 @@ public class AnalyzeVO {
     @ApiModelProperty(hidden = true)
     private Integer delStatus;
     //已核查不能再次评分校验
-    @ApiModelProperty(hidden = true)
+    @ApiModelProperty("已核查不能再次评分标志位,false表示核查与评分无关已核查也可以评分")
     private Boolean checkFlag = false;
 }

+ 2 - 0
src/main/java/com/diagbot/vo/ReBeHosPageVO.java

@@ -37,4 +37,6 @@ public class ReBeHosPageVO extends Page {
      * 是否归档(0:未归档,1:已归档)
      */
     private String isPlacefile = "1";
+
+    private int flag = 0;//1-导出操作;
 }

+ 0 - 2
src/main/java/com/diagbot/web/BehospitalInfoController.java

@@ -85,8 +85,6 @@ public class BehospitalInfoController {
     @SysLogger("analyze")
     @Transactional
     public RespDTO<AnalyzeDTO> analyze(@RequestBody AnalyzeVO analyzeVO) {
-        analyzeVO.setUseCrfCache(true);
-        analyzeVO.setCheckFlag(true);
         return RespDTO.onSuc(behospitalInfoFacade.analyze(analyzeVO));
     }
 

+ 1 - 1
src/main/java/com/diagbot/web/SysUserController.java

@@ -61,7 +61,7 @@ public class SysUserController {
 
     @ApiOperation(value = "登录获取jwt[by:gaodm]",
             notes = "username:用户名,必填<br>" +
-                    "password:密码, 必填, 默认密码:dc483e80a7a0bd9ef71d8cf973673924<br> ")
+                    "password:密码, 必填, 默认密码:a123456<br> ")
     @PostMapping("/getJwt")
     @SysLogger("getJwt")
     public RespDTO<JwtDTO> getJwt(@RequestBody UserLoginVO userLoginVO) {

+ 179 - 64
src/main/resources/mapper/BehospitalInfoMapper.xml

@@ -6047,9 +6047,21 @@
         a.beh_dept_name,
         a.beh_dept_id
         FROM
-        med_behospital_info a
+        med_behospital_info a,
+        med_qcresult_info b,
+        med_qcresult_detail c,
+        qc_cases_entry d
         WHERE
         a.is_deleted = 'N'
+        AND b.is_deleted = 'N'
+        AND c.is_deleted = 'N'
+        AND d.is_deleted = 'N'
+        AND a.hospital_id = b.hospital_id
+        AND a.hospital_id = c.hospital_id
+        AND a.behospital_code = b.behospital_code
+        AND a.behospital_code = c.behospital_code
+        AND c.cases_id = d.cases_id
+        AND c.cases_entry_id = d.id
         AND TIMESTAMPDIFF(
         DAY,
         DATE( behospital_date ),
@@ -6561,18 +6573,31 @@
         a.doctor_name
         FROM
         med_behospital_info a,
-        sys_user_dept b
+        med_behospital_info a,
+        med_qcresult_info b,
+        med_qcresult_detail c,
+        qc_cases_entry d,
+        sys_user_dept e
         WHERE
         a.is_deleted = 'N'
         AND b.is_deleted = 'N'
+        AND c.is_deleted = 'N'
+        AND d.is_deleted = 'N'
+        AND e.is_deleted = 'N'
         AND a.hospital_id = b.hospital_id
-        AND a.beh_dept_id = b.dept_id
+        AND a.hospital_id = c.hospital_id
+        AND a.hospital_id = e.hospital_id
+        AND a.behospital_code = b.behospital_code
+        AND a.behospital_code = c.behospital_code
+        AND c.cases_id = d.cases_id
+        AND c.cases_entry_id = d.id
+        AND a.beh_dept_id = e.dept_id
         AND TIMESTAMPDIFF(
         DAY,
         DATE( behospital_date ),
         DATE( leave_hospital_date ))> 31
         <if test="userId!=null">
-            AND b.user_id = #{userId}
+            AND e.user_id = #{userId}
         </if>
         <if test="isPlacefile != null and isPlacefile != ''">
             and a.is_placefile = #{isPlacefile}
@@ -13938,6 +13963,7 @@
         SELECT
         t.fileCode,
         t.diagnose,
+        t.diagnoseName,
         t.NAME,
         t.sex,
         t.hospitalId,
@@ -13945,6 +13971,8 @@
         t.behDeptName,
         t.behospitalCode,
         t.behospitalDate,
+        t.lastDiagnose,
+        t.lastDiagnoseName,
         t.leaveHospitalDate,
         t.lastBehDeptId,
         t.lastBehDeptName,
@@ -13958,6 +13986,10 @@
         mqi_last.LEVEL AS lastLevel,
         mhp.total_fee AS totleFee,
         mhp.behospital_day_num AS behospitalDayNum,
+        mhp.again_behospital_plan AS againBehospitalPlan,
+        IF(mhp.age is null, null,CONCAT( ifnull(mhp.age,'') ,ifnull(mhp.age_unit,'') ))as age,
+        mhp_last.again_behospital_plan AS lastAgainBehospitalPlan,
+        IF(mhp_last.age is null, null,CONCAT( ifnull(mhp_last.age,'') ,ifnull(mhp_last.age_unit,'') ))as lastAge,
         mhp_last.total_fee AS lastTotleFee,
         mhp_last.behospital_day_num AS lastBehospitalDayNum
         FROM
@@ -13965,6 +13997,7 @@
         SELECT
         be.fileCode,
         be.diagnose,
+        be.diagnoseName,
         be.NAME,
         be.sex,
         be.hospitalId,
@@ -13973,6 +14006,8 @@
         be.behospitalCode,
         be.behospitalDate,
         be.leaveHospitalDate,
+        be.lastDiagnose,
+        be.lastDiagnoseName,
         be.lastBehDeptId,
         be.lastBehDeptName,
         be.lastBehospitalCode,
@@ -13984,6 +14019,7 @@
         SELECT
         r1.file_code AS fileCode,
         r1.diagnose,
+        r1.diagnose_name AS diagnoseName,
         r1.NAME,
         r1.sex,
         r1.hospital_id AS hospitalId,
@@ -13992,6 +14028,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,
@@ -14003,20 +14041,33 @@
         SELECT
         ( @rownum := @rownum + 1 ) AS rownum,
         t1.file_code,
+        t1.behospital_code,
         t1.diagnose,
+        t1.diagnose_name,
         t1.NAME,
         t1.sex,
         t1.hospital_id,
         t1.beh_dept_id,
         t1.beh_dept_name,
-        t1.behospital_code,
         t1.behospital_date,
         t1.leave_hospital_date
-        FROM
-        (
+        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.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.file_code,
+        tt2.diagnose,
         tt2.NAME,
         tt2.sex,
         tt2.hospital_id,
@@ -14028,8 +14079,7 @@
         FROM
         (
         SELECT
-        a.file_code,
-        a.diagnose
+        a.file_code
         FROM
         med_behospital_info a
         WHERE
@@ -14066,8 +14116,7 @@
             AND a.name like concat('%', #{reBeHosPageVO.name},'%')
         </if>
         GROUP BY
-        a.file_code,
-        a.diagnose
+        a.file_code
         HAVING
         count(*)> 1
         ) tt1,
@@ -14079,7 +14128,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>
@@ -14107,8 +14155,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
@@ -14116,20 +14171,33 @@
         SELECT
         ( @INDEX := @INDEX + 1 ) AS rownum,
         t1.file_code,
+        t1.behospital_code,
         t1.diagnose,
+        t1.diagnose_name,
         t1.NAME,
         t1.sex,
         t1.hospital_id,
         t1.beh_dept_id,
         t1.beh_dept_name,
-        t1.behospital_code,
         t1.behospital_date,
         t1.leave_hospital_date
-        FROM
-        (
+        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.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.file_code,
+        tt2.diagnose,
         tt2.NAME,
         tt2.sex,
         tt2.hospital_id,
@@ -14141,8 +14209,7 @@
         FROM
         (
         SELECT
-        a.file_code,
-        a.diagnose
+        a.file_code
         FROM
         med_behospital_info a
         WHERE
@@ -14179,8 +14246,7 @@
             AND a.name like concat('%', #{reBeHosPageVO.name},'%')
         </if>
         GROUP BY
-        a.file_code,
-        a.diagnose
+        a.file_code
         HAVING
         count(*)> 1
         ) tt1,
@@ -14192,7 +14258,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>
@@ -14220,12 +14285,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
@@ -14253,6 +14323,7 @@
         SELECT
         t.fileCode,
         t.diagnose,
+        t.diagnoseName,
         t.NAME,
         t.sex,
         t.hospitalId,
@@ -14263,6 +14334,8 @@
         t.behospitalCode,
         t.behospitalDate,
         t.leaveHospitalDate,
+        t.lastDiagnose,
+        t.lastDiagnoseName,
         t.lastBehDeptId,
         t.lastBehDeptName,
         t.lastDoctorName,
@@ -14274,6 +14347,8 @@
         mqi.LEVEL AS LEVEL,
         mqi_last.score_res AS lastScoreRes,
         mqi_last.LEVEL AS lastLevel,
+        mhp.again_behospital_plan AS againBehospitalPlan,
+        mhp_last.again_behospital_plan AS lastAgainBehospitalPlan,
         mhp.total_fee AS totleFee,
         mhp.behospital_day_num AS behospitalDayNum,
         mhp_last.total_fee AS lastTotleFee,
@@ -14283,6 +14358,7 @@
         SELECT
         be.fileCode,
         be.diagnose,
+        be.diagnoseName,
         be.NAME,
         be.sex,
         be.hospitalId,
@@ -14293,6 +14369,8 @@
         be.behospitalCode,
         be.behospitalDate,
         be.leaveHospitalDate,
+        be.lastDiagnose,
+        be.lastDiagnoseName,
         be.lastBehDeptId,
         be.lastBehDeptName,
         be.lastDoctorId,
@@ -14306,6 +14384,7 @@
         SELECT
         r1.file_code AS fileCode,
         r1.diagnose,
+        r1.diagnose_name AS diagnoseName,
         r1.NAME,
         r1.sex,
         r1.hospital_id AS hospitalId,
@@ -14316,6 +14395,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,
@@ -14329,9 +14410,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,
@@ -14342,9 +14424,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,
@@ -14358,10 +14455,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
@@ -14408,8 +14502,7 @@
             AND a.name like concat('%', #{reBeHosPageVO.name},'%')
         </if>
         GROUP BY
-        a.file_code,
-        a.diagnose
+        a.file_code
         HAVING
         count(*)> 1
         ) tt1,
@@ -14421,7 +14514,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>
@@ -14449,8 +14541,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
@@ -14458,22 +14557,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,
@@ -14487,10 +14602,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
@@ -14500,14 +14612,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, '' )!= ''
@@ -14537,8 +14649,7 @@
             AND a.name like concat('%', #{reBeHosPageVO.name},'%')
         </if>
         GROUP BY
-        a.file_code,
-        a.diagnose
+        a.file_code
         HAVING
         count(*)> 1
         ) tt1,
@@ -14550,7 +14661,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>
@@ -14578,12 +14688,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

+ 0 - 1
src/main/resources/mapper/MedicalRecordMapper.xml

@@ -46,7 +46,6 @@
         and t1.rec_id = t3.rec_id
         and t1.hospital_id = #{hospitalId}
         and t1.behospital_code = #{behospitalCode}
-        and t3.xml_text != ''
     </select>
 
     <select id="getRecordCount"  resultType="java.lang.Integer">