Explorar o código

病历质控接口修改

gaodm %!s(int64=5) %!d(string=hai) anos
pai
achega
a62cad15c0

+ 0 - 1
doc/004.20200527v.1.3.0/qc_init.sql

@@ -28,7 +28,6 @@ INSERT INTO `qc`.`sys_role_permission` ( `is_deleted`, `gmt_create`, `gmt_modifi
 INSERT INTO `qc`.`sys_role_permission` ( `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `role_id`, `permission_id`, `remark`) VALUES ('N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '-1', '87', '用户-质控类型维护-删除医院数据模块');
 INSERT INTO `qc`.`sys_role_permission` ( `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `role_id`, `permission_id`, `remark`) VALUES ('N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '-1', '88', '用户-质控类型维护-获取医院全部模块');
 
-
 -- alter table qc_module_info MODIFY COLUMN `record_module_id` bigint(20) NOT NULL DEFAULT '0' COMMENT 'med_record_module的id';
 --
 -- DROP TABLE IF EXISTS `med_module_mapping`;

+ 23 - 0
doc/005.20200528v1.2.x/qc_init.sql

@@ -0,0 +1,23 @@
+use `qc`;
+
+ALTER TABLE med_behospital_info ADD COLUMN `is_placefile` varchar(2) NOT NULL DEFAULT '0' COMMENT '是否归档(0:未归档,1:已归档)' AFTER `director_doctor_name`;
+
+
+alter table qc_module_info MODIFY COLUMN `record_module_id` bigint(20) NOT NULL DEFAULT '0' COMMENT 'med_record_module的id';
+
+DROP TABLE IF EXISTS `med_module_mapping`;
+CREATE TABLE `med_module_mapping` (
+  `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
+  `is_deleted` char(1) NOT NULL DEFAULT 'N' COMMENT '是否删除,N:未删除,Y:删除',
+  `gmt_create` datetime NOT NULL DEFAULT '1970-01-01 12:00:00' COMMENT '记录创建时间',
+  `gmt_modified` datetime NOT NULL DEFAULT '1970-01-01 12:00:00' COMMENT '记录修改时间,如果时间是1970年则表示纪录未修改',
+  `creator` varchar(20) NOT NULL DEFAULT '0' COMMENT '创建人,0表示无创建人值',
+  `modifier` varchar(20) NOT NULL DEFAULT '0' COMMENT '修改人,如果为0则表示纪录未修改',
+  `module_id` bigint(20) NOT NULL DEFAULT '0' COMMENT '模板id',
+  `record_id` bigint(20) NOT NULL DEFAULT '0' COMMENT '文书id(med_record_analyze中的id)',
+  `hospital_id` bigint(20) NOT NULL DEFAULT '0' COMMENT '医院ID',
+  `remark` varchar(128) DEFAULT NULL COMMENT '备注',
+  PRIMARY KEY (`id`),
+  KEY `module_id` (`module_id`),
+  KEY `record_id` (`record_id`)
+) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8 COMMENT='模板与文书映射关系表';

+ 43 - 1
src/main/java/com/diagbot/entity/BehospitalInfo.java

@@ -25,7 +25,7 @@ public class BehospitalInfo implements Serializable {
     /**
      * 病人住院ID
      */
-    @TableId(value = "behospital_code",type = IdType.INPUT)
+    @TableId(value = "behospital_code", type = IdType.INPUT)
     private String behospitalCode;
 
     /**
@@ -148,6 +148,11 @@ public class BehospitalInfo implements Serializable {
      */
     private String directorDoctorName;
 
+    /**
+     * 是否归档(0:未归档,1:已归档)
+     */
+    private String isPlacefile;
+
     /**
      * 是否删除,N:未删除,Y:删除
      */
@@ -180,6 +185,7 @@ public class BehospitalInfo implements Serializable {
     public void setBehospitalCode(String behospitalCode) {
         this.behospitalCode = behospitalCode;
     }
+
     public Long getHospitalId() {
         return hospitalId;
     }
@@ -187,6 +193,7 @@ public class BehospitalInfo implements Serializable {
     public void setHospitalId(Long hospitalId) {
         this.hospitalId = hospitalId;
     }
+
     public String getName() {
         return name;
     }
@@ -194,6 +201,7 @@ public class BehospitalInfo implements Serializable {
     public void setName(String name) {
         this.name = name;
     }
+
     public String getSex() {
         return sex;
     }
@@ -201,6 +209,7 @@ public class BehospitalInfo implements Serializable {
     public void setSex(String sex) {
         this.sex = sex;
     }
+
     public Date getBirthday() {
         return birthday;
     }
@@ -208,6 +217,7 @@ public class BehospitalInfo implements Serializable {
     public void setBirthday(Date birthday) {
         this.birthday = birthday;
     }
+
     public String getFileCode() {
         return fileCode;
     }
@@ -215,6 +225,7 @@ public class BehospitalInfo implements Serializable {
     public void setFileCode(String fileCode) {
         this.fileCode = fileCode;
     }
+
     public Long getQcTypeId() {
         return qcTypeId;
     }
@@ -222,6 +233,7 @@ public class BehospitalInfo implements Serializable {
     public void setQcTypeId(Long qcTypeId) {
         this.qcTypeId = qcTypeId;
     }
+
     public String getWardCode() {
         return wardCode;
     }
@@ -229,6 +241,7 @@ public class BehospitalInfo implements Serializable {
     public void setWardCode(String wardCode) {
         this.wardCode = wardCode;
     }
+
     public String getWardName() {
         return wardName;
     }
@@ -236,6 +249,7 @@ public class BehospitalInfo implements Serializable {
     public void setWardName(String wardName) {
         this.wardName = wardName;
     }
+
     public String getBehDeptId() {
         return behDeptId;
     }
@@ -243,6 +257,7 @@ public class BehospitalInfo implements Serializable {
     public void setBehDeptId(String behDeptId) {
         this.behDeptId = behDeptId;
     }
+
     public String getBehDeptName() {
         return behDeptName;
     }
@@ -250,6 +265,7 @@ public class BehospitalInfo implements Serializable {
     public void setBehDeptName(String behDeptName) {
         this.behDeptName = behDeptName;
     }
+
     public String getBedCode() {
         return bedCode;
     }
@@ -257,6 +273,7 @@ public class BehospitalInfo implements Serializable {
     public void setBedCode(String bedCode) {
         this.bedCode = bedCode;
     }
+
     public String getBedName() {
         return bedName;
     }
@@ -264,6 +281,7 @@ public class BehospitalInfo implements Serializable {
     public void setBedName(String bedName) {
         this.bedName = bedName;
     }
+
     public String getInsuranceName() {
         return insuranceName;
     }
@@ -271,6 +289,7 @@ public class BehospitalInfo implements Serializable {
     public void setInsuranceName(String insuranceName) {
         this.insuranceName = insuranceName;
     }
+
     public String getJobType() {
         return jobType;
     }
@@ -278,6 +297,7 @@ public class BehospitalInfo implements Serializable {
     public void setJobType(String jobType) {
         this.jobType = jobType;
     }
+
     public Date getBehospitalDate() {
         return behospitalDate;
     }
@@ -285,6 +305,7 @@ public class BehospitalInfo implements Serializable {
     public void setBehospitalDate(Date behospitalDate) {
         this.behospitalDate = behospitalDate;
     }
+
     public Date getLeaveHospitalDate() {
         return leaveHospitalDate;
     }
@@ -292,6 +313,7 @@ public class BehospitalInfo implements Serializable {
     public void setLeaveHospitalDate(Date leaveHospitalDate) {
         this.leaveHospitalDate = leaveHospitalDate;
     }
+
     public String getDiagnoseIcd() {
         return diagnoseIcd;
     }
@@ -299,6 +321,7 @@ public class BehospitalInfo implements Serializable {
     public void setDiagnoseIcd(String diagnoseIcd) {
         this.diagnoseIcd = diagnoseIcd;
     }
+
     public String getDiagnose() {
         return diagnose;
     }
@@ -306,6 +329,7 @@ public class BehospitalInfo implements Serializable {
     public void setDiagnose(String diagnose) {
         this.diagnose = diagnose;
     }
+
     public String getBehDoctorId() {
         return behDoctorId;
     }
@@ -313,6 +337,7 @@ public class BehospitalInfo implements Serializable {
     public void setBehDoctorId(String behDoctorId) {
         this.behDoctorId = behDoctorId;
     }
+
     public String getBehDoctorName() {
         return behDoctorName;
     }
@@ -320,6 +345,7 @@ public class BehospitalInfo implements Serializable {
     public void setBehDoctorName(String behDoctorName) {
         this.behDoctorName = behDoctorName;
     }
+
     public String getDoctorId() {
         return doctorId;
     }
@@ -327,6 +353,7 @@ public class BehospitalInfo implements Serializable {
     public void setDoctorId(String doctorId) {
         this.doctorId = doctorId;
     }
+
     public String getDoctorName() {
         return doctorName;
     }
@@ -334,6 +361,7 @@ public class BehospitalInfo implements Serializable {
     public void setDoctorName(String doctorName) {
         this.doctorName = doctorName;
     }
+
     public String getDirectorDoctorId() {
         return directorDoctorId;
     }
@@ -341,6 +369,7 @@ public class BehospitalInfo implements Serializable {
     public void setDirectorDoctorId(String directorDoctorId) {
         this.directorDoctorId = directorDoctorId;
     }
+
     public String getDirectorDoctorName() {
         return directorDoctorName;
     }
@@ -348,6 +377,15 @@ public class BehospitalInfo implements Serializable {
     public void setDirectorDoctorName(String directorDoctorName) {
         this.directorDoctorName = directorDoctorName;
     }
+
+    public String getIsPlacefile() {
+        return isPlacefile;
+    }
+
+    public void setIsPlacefile(String isPlacefile) {
+        this.isPlacefile = isPlacefile;
+    }
+
     public String getIsDeleted() {
         return isDeleted;
     }
@@ -355,6 +393,7 @@ public class BehospitalInfo implements Serializable {
     public void setIsDeleted(String isDeleted) {
         this.isDeleted = isDeleted;
     }
+
     public Date getGmtCreate() {
         return gmtCreate;
     }
@@ -362,6 +401,7 @@ public class BehospitalInfo implements Serializable {
     public void setGmtCreate(Date gmtCreate) {
         this.gmtCreate = gmtCreate;
     }
+
     public Date getGmtModified() {
         return gmtModified;
     }
@@ -369,6 +409,7 @@ public class BehospitalInfo implements Serializable {
     public void setGmtModified(Date gmtModified) {
         this.gmtModified = gmtModified;
     }
+
     public String getCreator() {
         return creator;
     }
@@ -376,6 +417,7 @@ public class BehospitalInfo implements Serializable {
     public void setCreator(String creator) {
         this.creator = creator;
     }
+
     public String getModifier() {
         return modifier;
     }

+ 69 - 106
src/main/java/com/diagbot/facade/BehospitalInfoFacade.java

@@ -106,6 +106,8 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
     QcQuestionFacade qcQuestionFacade;
     @Autowired
     QcModelHospitalFacade qcModelHospitalFacade;
+    @Autowired
+    private FilterFacade filterFacade;
 
     /**
      * 分页
@@ -114,32 +116,7 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
      * @return
      */
     public IPage<BehospitalInfoDTO> pageFac(BehospitalPageVO behospitalPageVO) {
-        //入参验证
-        //入院时间
-        if (null != behospitalPageVO && null != behospitalPageVO.getBehosDateStart()) {
-            behospitalPageVO.setBehosDateStart(DateUtil.getFirstTimeOfDay(behospitalPageVO.getBehosDateStart()));
-        }
-        if (null != behospitalPageVO && null != behospitalPageVO.getBehosDateEnd()) {
-            behospitalPageVO.setBehosDateEnd(DateUtil.getLastTimeOfDay(behospitalPageVO.getBehosDateEnd()));
-        }
-        if (null != behospitalPageVO && null != behospitalPageVO.getBehosDateStart() && null != behospitalPageVO.getBehosDateEnd()) {
-            if (DateUtil.after(behospitalPageVO.getBehosDateStart(), behospitalPageVO.getBehosDateEnd())) {
-                throw new CommonException(CommonErrorCode.PARAM_IS_ERROR, "入院时间的开始时间必须小于结束时间!");
-            }
-        }
-        //出院时间
-        if (null != behospitalPageVO && null != behospitalPageVO.getLeaveHosDateStart()) {
-            behospitalPageVO.setLeaveHosDateStart(DateUtil.getFirstTimeOfDay(behospitalPageVO.getLeaveHosDateStart()));
-        }
-        if (null != behospitalPageVO && null != behospitalPageVO.getLeaveHosDateEnd()) {
-            behospitalPageVO.setLeaveHosDateEnd(DateUtil.getLastTimeOfDay(behospitalPageVO.getLeaveHosDateEnd()));
-        }
-        if (null != behospitalPageVO && null != behospitalPageVO.getLeaveHosDateStart() && null != behospitalPageVO.getLeaveHosDateEnd()) {
-            if (DateUtil.after(behospitalPageVO.getLeaveHosDateStart(), behospitalPageVO.getLeaveHosDateEnd())) {
-                throw new CommonException(CommonErrorCode.PARAM_IS_ERROR, "出院时间的开始时间必须小于结束时间!");
-            }
-        }
-        behospitalPageVO.setHospitalId(Long.parseLong(SysUserUtils.getCurrentHospitalID()));
+        behospitalPageSet(behospitalPageVO);
         IPage<BehospitalInfoDTO> res = getPage(behospitalPageVO);
         return res;
     }
@@ -220,7 +197,7 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
     public QueryVo dealCommonData(Long hospitalId, AnalyzeVO analyzeVO) {
         // 获取质控条目
         List<QcCasesEntryDTO> qcCasesEntryDTOList = qcCasesEntryFacade.getQcCasesEntry(analyzeVO);
-        if(ListUtil.isEmpty(qcCasesEntryDTOList)){
+        if (ListUtil.isEmpty(qcCasesEntryDTOList)) {
             throw new CommonException(CommonErrorCode.NOT_EXISTS, "该病历无关联的质控条目!");
         }
 
@@ -346,7 +323,7 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
         if (!analyzeVO.getIsTask()) {
             hospitalId = Long.parseLong(SysUserUtils.getCurrentHospitalID());
         }
-//        Long hospitalId = 1L; // 写死
+        //        Long hospitalId = 1L; // 写死
         analyzeVO.setHospitalId(hospitalId);
 
         // 处理公共数据
@@ -379,7 +356,7 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
         }
 
         // 对info赋值
-        for(QcResultAlgVO bean : qcResultAlgVOList) {
+        for (QcResultAlgVO bean : qcResultAlgVOList) {
             String info = codeToInfoMap.get(bean.getCode());
             if (StringUtil.isNotBlank(info)) {
                 bean.setInfo(info);
@@ -403,8 +380,8 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
         Date date = qcresultInfoFacade.saveQcResult(algorithmDTO, algorithmVO, analyzeVO, pageData, menuData, analyzeVO.getIsTask());
 
         // 返回提示信息
-//        List<MsgDTO> msgDTOList = getMsg(analyzeVO);
-//        Map<String, List<MsgDTO>> msgMap = EntityUtil.makeEntityListMap(msgDTOList, "modelName");
+        //        List<MsgDTO> msgDTOList = getMsg(analyzeVO);
+        //        Map<String, List<MsgDTO>> msgMap = EntityUtil.makeEntityListMap(msgDTOList, "modelName");
 
         //返回参数组装
         AnalyzeDTO analyzeDTO = new AnalyzeDTO();
@@ -509,8 +486,8 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
      * @param medrecVoList
      * @param map
      */
-    public void addDataWithKeyConvert(String key,  List<DoctorAdvice> list,
-                               List<MedrecVo> medrecVoList, Map<String, String> map, List<String> dateList) {
+    public void addDataWithKeyConvert(String key, List<DoctorAdvice> list,
+                                      List<MedrecVo> medrecVoList, Map<String, String> map, List<String> dateList) {
         MedrecVo medrecVo = new MedrecVo();
         medrecVo.setTitle(key);
         Map<String, Object> content = new HashMap<>();
@@ -523,7 +500,7 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
                 for (String objKey : objectMap.keySet()) {
                     if (map.get(objKey) != null) {
                         if (dateList.contains(objKey)) {
-                            Date date = (Date)objectMap.get(objKey);
+                            Date date = (Date) objectMap.get(objKey);
                             res.put(map.get(objKey), DateUtil.formatDateTime(date).replaceAll("null", ""));
                         } else {
                             res.put(map.get(objKey), String.valueOf(objectMap.get(objKey)).replaceAll("null", ""));
@@ -556,7 +533,7 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
         for (String objKey : objectMap.keySet()) {
             if (dicMap.containsKey(objKey)) {
                 if (dateList.contains(objKey)) {
-                    Date date = (Date)objectMap.get(objKey);
+                    Date date = (Date) objectMap.get(objKey);
                     res.put(dicMap.get(objKey), DateUtil.formatDateTime(date).replaceAll("null", ""));
                 } else {
                     res.put(dicMap.get(objKey), String.valueOf(objectMap.get(objKey)).replaceAll("null", ""));
@@ -568,6 +545,7 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
 
     /**
      * 拼接数据(病案首页),从数据字典获取信息转换
+     *
      * @param key
      * @param homePage
      * @param medrecVoList
@@ -575,7 +553,7 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
      * @param homeDiagnoseInfoList
      * @param homeOperationInfoList
      */
-    public void addDataWithFirstPage(String key,  HomePage homePage, List<MedrecVo> medrecVoList, Map<String, Map<String, String>> dicMap,
+    public void addDataWithFirstPage(String key, HomePage homePage, List<MedrecVo> medrecVoList, Map<String, Map<String, String>> dicMap,
                                      List<HomeDiagnoseInfo> homeDiagnoseInfoList, List<HomeOperationInfo> homeOperationInfoList) {
         MedrecVo medrecVo = new MedrecVo();
         medrecVo.setTitle(key);
@@ -588,7 +566,7 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
             for (String objKey : objectMap.keySet()) {
                 if (map.containsKey(objKey)) {
                     if (firstPageDate.contains(objKey)) {
-                        Date date = (Date)objectMap.get(objKey);
+                        Date date = (Date) objectMap.get(objKey);
                         content.put(map.get(objKey), DateUtil.formatDateTime(date).replaceAll("null", ""));
                     } else {
                         content.put(map.get(objKey), String.valueOf(objectMap.get(objKey)).replaceAll("null", ""));
@@ -668,21 +646,21 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
             authServiceClient.analyze_rpc(analyzeVO);
         }
 
-//        List<BehospitalInfo> behospitalInfoList = this.list(new QueryWrapper<BehospitalInfo>()
-//                .eq("is_deleted", IsDeleteEnum.N.getKey())
-//        );
-//
-//        int i = 1;
-//        while(i < 100) {
-//            for (BehospitalInfo bean : behospitalInfoList) {
-//                AnalyzeVO analyzeVO = new AnalyzeVO();
-//                analyzeVO.setIsTask(true);
-//                analyzeVO.setHospitalId(bean.getHospitalId());
-//                analyzeVO.setBehospitalCode(bean.getBehospitalCode());
-//                authServiceClient.analyze_rpc(analyzeVO);
-//                System.out.println(i++);
-//            }
-//        }
+        //        List<BehospitalInfo> behospitalInfoList = this.list(new QueryWrapper<BehospitalInfo>()
+        //                .eq("is_deleted", IsDeleteEnum.N.getKey())
+        //        );
+        //
+        //        int i = 1;
+        //        while(i < 100) {
+        //            for (BehospitalInfo bean : behospitalInfoList) {
+        //                AnalyzeVO analyzeVO = new AnalyzeVO();
+        //                analyzeVO.setIsTask(true);
+        //                analyzeVO.setHospitalId(bean.getHospitalId());
+        //                analyzeVO.setBehospitalCode(bean.getBehospitalCode());
+        //                authServiceClient.analyze_rpc(analyzeVO);
+        //                System.out.println(i++);
+        //            }
+        //        }
     }
 
 
@@ -751,7 +729,7 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
         if (qcResultDTO == null) {
             throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
                     "该病历未评分!【hospitalId=" + hospitalId + "】【behospitalCode="
-                    + getDetailVO.getBehospitalCode() + "】");
+                            + getDetailVO.getBehospitalCode() + "】");
         }
         QcResultApiDTO qcResultApiDTO = new QcResultApiDTO();
         BeanUtil.copyProperties(qcResultDTO, qcResultApiDTO);
@@ -769,69 +747,18 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
     }
 
     /**
-     *
      * @param behospitalPageVO
      * @return
      */
     public IPage<BehospitalInfoDTO> pagePerson(BehospitalPageVO behospitalPageVO) {
-        //入参验证
-        //入院时间
-        if (null != behospitalPageVO && null != behospitalPageVO.getBehosDateStart()) {
-            behospitalPageVO.setBehosDateStart(DateUtil.getFirstTimeOfDay(behospitalPageVO.getBehosDateStart()));
-        }
-        if (null != behospitalPageVO && null != behospitalPageVO.getBehosDateEnd()) {
-            behospitalPageVO.setBehosDateEnd(DateUtil.getLastTimeOfDay(behospitalPageVO.getBehosDateEnd()));
-        }
-        if (null != behospitalPageVO && null != behospitalPageVO.getBehosDateStart() && null != behospitalPageVO.getBehosDateEnd()) {
-            if (DateUtil.after(behospitalPageVO.getBehosDateStart(), behospitalPageVO.getBehosDateEnd())) {
-                throw new CommonException(CommonErrorCode.PARAM_IS_ERROR, "入院时间的开始时间必须小于结束时间!");
-            }
-        }
-        //出院时间
-        if (null != behospitalPageVO && null != behospitalPageVO.getLeaveHosDateStart()) {
-            behospitalPageVO.setLeaveHosDateStart(DateUtil.getFirstTimeOfDay(behospitalPageVO.getLeaveHosDateStart()));
-        }
-        if (null != behospitalPageVO && null != behospitalPageVO.getLeaveHosDateEnd()) {
-            behospitalPageVO.setLeaveHosDateEnd(DateUtil.getLastTimeOfDay(behospitalPageVO.getLeaveHosDateEnd()));
-        }
-        if (null != behospitalPageVO && null != behospitalPageVO.getLeaveHosDateStart() && null != behospitalPageVO.getLeaveHosDateEnd()) {
-            if (DateUtil.after(behospitalPageVO.getLeaveHosDateStart(), behospitalPageVO.getLeaveHosDateEnd())) {
-                throw new CommonException(CommonErrorCode.PARAM_IS_ERROR, "出院时间的开始时间必须小于结束时间!");
-            }
-        }
-        behospitalPageVO.setHospitalId(Long.parseLong(SysUserUtils.getCurrentHospitalID()));
+        behospitalPageSet(behospitalPageVO);
         behospitalPageVO.setUserId(Long.parseLong(SysUserUtils.getCurrentPrincipleID()));
         IPage<BehospitalInfoDTO> res = getPageByPerson(behospitalPageVO);
         return res;
     }
 
     public IPage<BehospitalInfoDTO> pageDept(BehospitalPageVO behospitalPageVO) {
-        //入参验证
-        //入院时间
-        if (null != behospitalPageVO && null != behospitalPageVO.getBehosDateStart()) {
-            behospitalPageVO.setBehosDateStart(DateUtil.getFirstTimeOfDay(behospitalPageVO.getBehosDateStart()));
-        }
-        if (null != behospitalPageVO && null != behospitalPageVO.getBehosDateEnd()) {
-            behospitalPageVO.setBehosDateEnd(DateUtil.getLastTimeOfDay(behospitalPageVO.getBehosDateEnd()));
-        }
-        if (null != behospitalPageVO && null != behospitalPageVO.getBehosDateStart() && null != behospitalPageVO.getBehosDateEnd()) {
-            if (DateUtil.after(behospitalPageVO.getBehosDateStart(), behospitalPageVO.getBehosDateEnd())) {
-                throw new CommonException(CommonErrorCode.PARAM_IS_ERROR, "入院时间的开始时间必须小于结束时间!");
-            }
-        }
-        //出院时间
-        if (null != behospitalPageVO && null != behospitalPageVO.getLeaveHosDateStart()) {
-            behospitalPageVO.setLeaveHosDateStart(DateUtil.getFirstTimeOfDay(behospitalPageVO.getLeaveHosDateStart()));
-        }
-        if (null != behospitalPageVO && null != behospitalPageVO.getLeaveHosDateEnd()) {
-            behospitalPageVO.setLeaveHosDateEnd(DateUtil.getLastTimeOfDay(behospitalPageVO.getLeaveHosDateEnd()));
-        }
-        if (null != behospitalPageVO && null != behospitalPageVO.getLeaveHosDateStart() && null != behospitalPageVO.getLeaveHosDateEnd()) {
-            if (DateUtil.after(behospitalPageVO.getLeaveHosDateStart(), behospitalPageVO.getLeaveHosDateEnd())) {
-                throw new CommonException(CommonErrorCode.PARAM_IS_ERROR, "出院时间的开始时间必须小于结束时间!");
-            }
-        }
-        behospitalPageVO.setHospitalId(Long.parseLong(SysUserUtils.getCurrentHospitalID()));
+        behospitalPageSet(behospitalPageVO);
         behospitalPageVO.setUserId(Long.parseLong(SysUserUtils.getCurrentPrincipleID()));
         IPage<BehospitalInfoDTO> res = getPageByDept(behospitalPageVO);
         return res;
@@ -921,4 +848,40 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
         return analyzeRunDTO;
     }
 
+    private void behospitalPageSet(BehospitalPageVO behospitalPageVO) {
+        //入参验证
+        //入院时间
+        if (null != behospitalPageVO && null != behospitalPageVO.getBehosDateStart()) {
+            behospitalPageVO.setBehosDateStart(DateUtil.getFirstTimeOfDay(behospitalPageVO.getBehosDateStart()));
+        }
+        if (null != behospitalPageVO && null != behospitalPageVO.getBehosDateEnd()) {
+            behospitalPageVO.setBehosDateEnd(DateUtil.getFirstTimeOfDay(DateUtil.addDay(behospitalPageVO.getBehosDateEnd(), 1)));
+        }
+        if (null != behospitalPageVO && null != behospitalPageVO.getBehosDateStart() && null != behospitalPageVO.getBehosDateEnd()) {
+            if (DateUtil.after(behospitalPageVO.getBehosDateStart(), behospitalPageVO.getBehosDateEnd())) {
+                throw new CommonException(CommonErrorCode.PARAM_IS_ERROR, "入院时间的开始时间必须小于结束时间!");
+            }
+        }
+        //出院时间
+        if (null != behospitalPageVO && null != behospitalPageVO.getLeaveHosDateStart()) {
+            behospitalPageVO.setLeaveHosDateStart(DateUtil.getFirstTimeOfDay(behospitalPageVO.getLeaveHosDateStart()));
+        }
+        if (null != behospitalPageVO && null != behospitalPageVO.getLeaveHosDateEnd()) {
+            behospitalPageVO.setLeaveHosDateEnd(DateUtil.getFirstTimeOfDay(DateUtil.addDay(behospitalPageVO.getLeaveHosDateEnd(), 1)));
+        }
+        if (null != behospitalPageVO && null != behospitalPageVO.getLeaveHosDateStart() && null != behospitalPageVO.getLeaveHosDateEnd()) {
+            if (DateUtil.after(behospitalPageVO.getLeaveHosDateStart(), behospitalPageVO.getLeaveHosDateEnd())) {
+                throw new CommonException(CommonErrorCode.PARAM_IS_ERROR, "出院时间的开始时间必须小于结束时间!");
+            }
+        }
+        behospitalPageVO.setHospitalId(Long.parseLong(SysUserUtils.getCurrentHospitalID()));
+        if (null != behospitalPageVO.getStatisticsType()
+                && null == behospitalPageVO.getLeaveHosDateStart()
+                && null == behospitalPageVO.getLeaveHosDateEnd()) {
+            String startDate = filterFacade.getStartDateStr(behospitalPageVO.getStatisticsType(), null);
+            String endDate = filterFacade.getEndDateStr(behospitalPageVO.getStatisticsType(), null);
+            behospitalPageVO.setLeaveHosDateStart(DateUtil.parseDate(startDate));
+            behospitalPageVO.setLeaveHosDateEnd(DateUtil.parseDate(endDate));
+        }
+    }
 }

+ 5 - 0
src/main/java/com/diagbot/vo/BehospitalPageVO.java

@@ -80,4 +80,9 @@ public class BehospitalPageVO extends Page implements Serializable {
     private Long userId;
 
     private Long doctorCode;
+
+    /**
+     * 统计维度 1-本月,2-本年
+     */
+    private Integer statisticsType;
 }

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

@@ -48,6 +48,7 @@ public class BehospitalInfoController {
     @ApiOperation(value = "病历分页列表[by:zhoutg]",
             notes = "name:姓名<br>" +
                     "fileCode:档案号<br>" +
+                    "statisticsType: 统计维度 1-本月,2-本年<br>" +
                     "behosDateStart:入院时间开始时间<br>" +
                     "behosDateEnd:入院时间结束时间<br>" +
                     "leaveHosDateStart:出院时间开始时间<br>" +
@@ -156,6 +157,7 @@ public class BehospitalInfoController {
     @ApiOperation(value = "病历分页列表(科室)[by:zhoutg]",
             notes = "name:姓名<br>" +
                     "fileCode:档案号<br>" +
+                    "statisticsType: 统计维度 1-本月,2-本年<br>" +
                     "behosDateStart:入院时间开始时间<br>" +
                     "behosDateEnd:入院时间结束时间<br>" +
                     "leaveHosDateStart:出院时间开始时间<br>" +
@@ -170,6 +172,7 @@ public class BehospitalInfoController {
     @ApiOperation(value = "病历分页列表(个人)[by:zhoutg]",
             notes = "name:姓名<br>" +
                     "fileCode:档案号<br>" +
+                    "statisticsType: 统计维度 1-本月,2-本年<br>" +
                     "behosDateStart:入院时间开始时间<br>" +
                     "behosDateEnd:入院时间结束时间<br>" +
                     "leaveHosDateStart:出院时间开始时间<br>" +

+ 6 - 6
src/main/resources/mapper/BehospitalInfoMapper.xml

@@ -72,13 +72,13 @@
             <![CDATA[ and t.behospital_date >= #{behosDateStart}]]>
         </if>
         <if test="behosDateEnd != null">
-            <![CDATA[ and t.behospital_date <= #{behosDateEnd}]]>
+            <![CDATA[ and t.behospital_date < #{behosDateEnd}]]>
         </if>
         <if test="leaveHosDateStart != null">
             <![CDATA[ and t.leave_hospital_date >= #{leaveHosDateStart}]]>
         </if>
         <if test="leaveHosDateEnd != null">
-            <![CDATA[ and t.leave_hospital_date <= #{leaveHosDateEnd}]]>
+            <![CDATA[ and t.leave_hospital_date < #{leaveHosDateEnd}]]>
         </if>
         <if test="level != null and level != ''">
             and t.level = #{level}
@@ -464,13 +464,13 @@
             <![CDATA[ and t.behospital_date >= #{behosDateStart}]]>
         </if>
         <if test="behosDateEnd != null">
-            <![CDATA[ and t.behospital_date <= #{behosDateEnd}]]>
+            <![CDATA[ and t.behospital_date < #{behosDateEnd}]]>
         </if>
         <if test="leaveHosDateStart != null">
             <![CDATA[ and t.leave_hospital_date >= #{leaveHosDateStart}]]>
         </if>
         <if test="leaveHosDateEnd != null">
-            <![CDATA[ and t.leave_hospital_date <= #{leaveHosDateEnd}]]>
+            <![CDATA[ and t.leave_hospital_date < #{leaveHosDateEnd}]]>
         </if>
         <if test="level != null and level != ''">
             and t.level = #{level}
@@ -531,13 +531,13 @@
             <![CDATA[ and t.behospital_date >= #{behosDateStart}]]>
         </if>
         <if test="behosDateEnd != null">
-            <![CDATA[ and t.behospital_date <= #{behosDateEnd}]]>
+            <![CDATA[ and t.behospital_date < #{behosDateEnd}]]>
         </if>
         <if test="leaveHosDateStart != null">
             <![CDATA[ and t.leave_hospital_date >= #{leaveHosDateStart}]]>
         </if>
         <if test="leaveHosDateEnd != null">
-            <![CDATA[ and t.leave_hospital_date <= #{leaveHosDateEnd}]]>
+            <![CDATA[ and t.leave_hospital_date < #{leaveHosDateEnd}]]>
         </if>
         <if test="level != null and level != ''">
             and t.level = #{level}