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

各科室缺陷占比导出兼容90天

chengyao 4 éve
szülő
commit
b826d7bdc6

+ 34 - 13
src/main/java/com/diagbot/facade/BehospitalInfoFacade.java

@@ -1804,17 +1804,28 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
 
     private void exportQcresultVOSet(ExportQcresultVO exportQcresultVO) {
         //入参验证
-        long interval = 7 * 24 * 60 * 60 * 1000;
+        long interval_7 = 7 * 24 * 60 * 60 * 1000;
+        long interval_90 = 90l * 24 * 60 * 60 * 1000;
         //入院时间
         if (null != exportQcresultVO && null != exportQcresultVO.getBehosDateStart() && null != exportQcresultVO.getBehosDateEnd()) {
             Date startDate = exportQcresultVO.getBehosDateStart();
             Date endDate = exportQcresultVO.getBehosDateEnd();
-            //时间间隔7天
-            if (endDate.getTime() < startDate.getTime()) {
-                throw new CommonException(CommonErrorCode.PARAM_ERROR, "截止时间不能小于起始时间");
-            }
-            if (endDate.getTime() - startDate.getTime() > interval) {
-                throw new CommonException(CommonErrorCode.PARAM_ERROR, "统计区间不能大于7天");
+            if("1".equals(exportQcresultVO.getRadioCheck())){
+                //时间间隔7天
+                if (endDate.getTime() < startDate.getTime()) {
+                    throw new CommonException(CommonErrorCode.PARAM_ERROR, "截止时间不能小于起始时间");
+                }
+                if (endDate.getTime() - startDate.getTime() > interval_7) {
+                    throw new CommonException(CommonErrorCode.PARAM_ERROR, "统计区间不能大于7天");
+                }
+            }else{
+                //时间间隔90天
+                if (endDate.getTime() < startDate.getTime()) {
+                    throw new CommonException(CommonErrorCode.PARAM_ERROR, "截止时间不能小于起始时间");
+                }
+                if (endDate.getTime() - startDate.getTime() > interval_90) {
+                    throw new CommonException(CommonErrorCode.PARAM_ERROR, "统计区间不能大于90天");
+                }
             }
             exportQcresultVO.setBehosDateStart(DateUtil.getFirstTimeOfDay(exportQcresultVO.getBehosDateStart()));
             exportQcresultVO.setBehosDateEnd(DateUtil.getFirstTimeOfDay(DateUtil.addDay(exportQcresultVO.getBehosDateEnd(), 1)));
@@ -1823,12 +1834,22 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
         if (null != exportQcresultVO && null != exportQcresultVO.getLeaveHosDateStart() && null != exportQcresultVO.getLeaveHosDateEnd()) {
             Date startDate = exportQcresultVO.getLeaveHosDateStart();
             Date endDate = exportQcresultVO.getLeaveHosDateEnd();
-            //时间间隔7天
-            if (endDate.getTime() < startDate.getTime()) {
-                throw new CommonException(CommonErrorCode.PARAM_ERROR, "截止时间不能小于起始时间");
-            }
-            if (endDate.getTime() - startDate.getTime() > interval) {
-                throw new CommonException(CommonErrorCode.PARAM_ERROR, "统计区间不能大于7天");
+            if("1".equals(exportQcresultVO.getRadioCheck())){
+                //时间间隔7天
+                if (endDate.getTime() < startDate.getTime()) {
+                    throw new CommonException(CommonErrorCode.PARAM_ERROR, "截止时间不能小于起始时间");
+                }
+                if (endDate.getTime() - startDate.getTime() > interval_7) {
+                    throw new CommonException(CommonErrorCode.PARAM_ERROR, "统计区间不能大于7天");
+                }
+            }else{
+                //时间间隔90天
+                if (endDate.getTime() < startDate.getTime()) {
+                    throw new CommonException(CommonErrorCode.PARAM_ERROR, "截止时间不能小于起始时间");
+                }
+                if (endDate.getTime() - startDate.getTime() > interval_90) {
+                    throw new CommonException(CommonErrorCode.PARAM_ERROR, "统计区间不能大于90天");
+                }
             }
             exportQcresultVO.setLeaveHosDateStart(DateUtil.getFirstTimeOfDay(exportQcresultVO.getLeaveHosDateStart()));
             exportQcresultVO.setLeaveHosDateEnd(DateUtil.getFirstTimeOfDay(DateUtil.addDay(exportQcresultVO.getLeaveHosDateEnd(), 1)));

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

@@ -27,6 +27,8 @@ public class ExportQcresultVO {
     private Date leaveHosDateEnd;
     @ApiModelProperty(hidden = true)
     private String hospitalId;
+    //(1-导出7天[含缺陷明细项]  2-导出90天[不含缺陷明细项] )
+    private String radioCheck = "1";
     @ApiModelProperty(hidden = true)
     private Long userId;
     /**

+ 23 - 14
src/main/resources/mapper/BehospitalInfoMapper.xml

@@ -3248,10 +3248,12 @@
         t1.behospitalDate,
         t1.leaveHospitalDate,
         t1.score,
-        t1.scoreBn,
-        t2.avgScore,
+        <if test="radioCheck !=null and radioCheck == 1">
         t1.msg,
-        t1.caseName
+        t1.caseName,
+        </if>
+        t1.scoreBn,
+        t2.avgScore
         FROM
         (
         SELECT
@@ -3265,8 +3267,10 @@
         a.leave_hospital_date AS leaveHospitalDate,
         b.score_res AS score,
         e.score_res as scoreBn,
+        <if test="radioCheck !=null and radioCheck == 1">
         c.msg AS msg,
         d.NAME AS caseName,
+        </if>
         a.beh_dept_id AS behDeptId,
         a.beh_dept_name AS behDeptName,
         a.hospital_id AS hospitalId
@@ -3278,15 +3282,17 @@
         AND a.is_deleted = 'N'
         AND b.is_deleted = 'N'
         AND a.behospital_code = b.behospital_code
-        LEFT JOIN
-        med_qcresult_detail c
-        ON c.is_deleted = 'N'
-        AND b.behospital_code = c.behospital_code
-        AND b.hospital_id = c.hospital_id
-        LEFT JOIN
-        qc_cases d
-        on d.is_deleted = 'N'
-        AND c.cases_id = d.id
+        <if test="radioCheck !=null and radioCheck == 1">
+            LEFT JOIN
+            med_qcresult_detail c
+            ON c.is_deleted = 'N'
+            AND b.behospital_code = c.behospital_code
+            AND b.hospital_id = c.hospital_id
+            LEFT JOIN
+            qc_cases d
+            on d.is_deleted = 'N'
+            AND c.cases_id = d.id
+        </if>
         LEFT JOIN med_qcresult_cases e
         on  b.behospital_code = e.behospital_code
         and b.hospital_id = e.hospital_id
@@ -3407,8 +3413,11 @@
         t1.behDeptName,
         t1.behDoctorName,
         t1.patName,
-        t1.behospitalCode,
-        t1.caseName)tp
+        <if test="radioCheck !=null and radioCheck == 1">
+        t1.caseName,
+        </if>
+        t1.behospitalCode
+       )tp
         LEFT JOIN (SELECT * FROM med_check_info WHERE is_deleted = 'N' AND check_type = 0 ) g
         ON tp.behospitalCode = g.behospital_code
         AND tp.hospitalId = g.hospital_id