Pārlūkot izejas kodu

Merge branch 'dev/20200618_1.3.6' into debug

zhoutg 5 gadi atpakaļ
vecāks
revīzija
6fa0cf911e

+ 1 - 0
doc/010.20200618v1.3.6/qc_initv1.3.6.sql

@@ -0,0 +1 @@
+use `qc`;

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

@@ -66,6 +66,7 @@ public class ResourceServerConfigurer extends ResourceServerConfigurerAdapter {
                 .antMatchers("/qc/behospitalInfo/exportExcel").permitAll()
                 .antMatchers("/qc/behospitalInfo/exportQcresult").permitAll()
                 .antMatchers("/qc/behospitalInfo/exportQcresultByDept").permitAll()
+                .antMatchers("/qc/behospitalInfo/exportQcresultByGroup").permitAll()
                 .antMatchers("/qc/abnormal/getQcAnnormalMode").permitAll()
                 .antMatchers("/qc/dataimport/import").permitAll()
                 .antMatchers("/qc/dataimport/dataimportPrepare").permitAll()

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

@@ -110,6 +110,7 @@ public class UrlAccessDecisionManager implements AccessDecisionManager {
                 || matchers("/qc/behospitalInfo/exportExcel", request)
                 || matchers("/qc/behospitalInfo/exportQcresult", request)
                 || matchers("/qc/behospitalInfo/exportQcresultByDept", request)
+                || matchers("/qc/behospitalInfo/exportQcresultByGroup", request)
                 || matchers("/qc/abnormal/getQcAnnormalMode", request)
                 || matchers("/qc/dataimport/import", request)
                 || matchers("/qc/dataimport/dataimportPrepare", request)

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

@@ -1023,4 +1023,33 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
         response.setContentType("text/html;charset=UTF-8");
         ExcelUtils.exportExcelUser(res, null, "sheet1", ExportExcelDTO.class, fileName, response);
     }
+
+    /**
+     * 医疗组质控结果导出
+     *
+     * @param response
+     * @param exportQcresultVO
+     */
+    public void exportQcresultByGroup(HttpServletResponse response, ExportQcresultVO exportQcresultVO) {
+        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd");
+        String hospitalId = SysUserUtils.getCurrentHospitalID();
+        String userId = SysUserUtils.getCurrentPrincipleID();
+        exportQcresultVO.setHospitalId(hospitalId);
+        exportQcresultVO.setUserId(Long.valueOf(userId));
+        Date startDate = exportQcresultVO.getLeaveHosDateStart();
+        Date endDate = exportQcresultVO.getLeaveHosDateEnd();
+        //时间间隔7天
+        long interval = 7 * 24 * 60 * 60 * 1000;
+        if (endDate.getTime() < startDate.getTime()) {
+            throw new CommonException(CommonErrorCode.PARAM_ERROR, "截止时间不能小于起始时间");
+        }
+        if (endDate.getTime() - startDate.getTime() > interval) {
+            throw new CommonException(CommonErrorCode.PARAM_ERROR, "统计区间不能大于7天");
+        }
+        exportQcresultVO.setLeaveHosDateEnd(DateUtil.getFirstTimeOfDay(DateUtil.addDay(endDate, 1)));
+        List<ExportExcelDTO> res = this.exportQcresultByGroup(exportQcresultVO);
+        String fileName = dateFormat.format(startDate) + "-" + dateFormat.format(endDate) + "抽查住院病历质量情况.xls";
+        response.setContentType("text/html;charset=UTF-8");
+        ExcelUtils.exportExcelUser(res, null, "sheet1", ExportExcelDTO.class, fileName, response);
+    }
 }

+ 8 - 0
src/main/java/com/diagbot/mapper/BehospitalInfoMapper.java

@@ -213,6 +213,14 @@ public interface BehospitalInfoMapper extends BaseMapper<BehospitalInfo> {
      */
     public List<ExportExcelDTO> exportQcresultByDept(ExportQcresultVO exportQcresultVO);
 
+    /**
+     * 医疗组质控评分导出到excel
+     *
+     * @param exportQcresultVO
+     * @return
+     */
+    public List<ExportExcelDTO> exportQcresultByGroup(ExportQcresultVO exportQcresultVO);
+
     /**
      * 条目缺陷质控评分页(内页)
      *

+ 8 - 0
src/main/java/com/diagbot/service/BehospitalInfoService.java

@@ -213,6 +213,14 @@ public interface BehospitalInfoService extends IService<BehospitalInfo> {
      */
     public List<ExportExcelDTO> exportQcresultByDept(ExportQcresultVO exportQcresultVO);
 
+    /**
+     * 科室质控评分导出到excel
+     *
+     * @param exportQcresultVO
+     * @return
+     */
+    public List<ExportExcelDTO> exportQcresultByGroup(ExportQcresultVO exportQcresultVO);
+
     /**
      * 条目缺陷质控评分页(内页)
      *

+ 5 - 0
src/main/java/com/diagbot/service/impl/BehospitalInfoServiceImpl.java

@@ -289,6 +289,11 @@ public class BehospitalInfoServiceImpl extends ServiceImpl<BehospitalInfoMapper,
         return baseMapper.exportQcresultByDept(exportQcresultVO);
     }
 
+    @Override
+    public List<ExportExcelDTO> exportQcresultByGroup(ExportQcresultVO exportQcresultVO) {
+        return baseMapper.exportQcresultByGroup(exportQcresultVO);
+    }
+
     /**
      * 条目缺陷质控评分页(内页)
      *

+ 9 - 1
src/main/java/com/diagbot/web/BehospitalInfoController.java

@@ -234,11 +234,19 @@ public class BehospitalInfoController {
         behospitalInfoFacade.exportQcresult(response, exportQcresultVO);
     }
 
-    @ApiOperation(value = "科室质控结果导出[by:zhaops]",
+    @ApiOperation(value = "科室质控结果导出[by:zhaops]",
             notes = "")
     @PostMapping("/exportQcresultByDept")
     @SysLogger("exportQcresultByDept")
     public void exportQcresultByDept(HttpServletResponse response, @RequestBody ExportQcresultVO exportQcresultVO) {
         behospitalInfoFacade.exportQcresultByDept(response, exportQcresultVO);
     }
+
+    @ApiOperation(value = "【医疗组】质控结果导出[by:zhaops]",
+            notes = "")
+    @PostMapping("/exportQcresultByGroup")
+    @SysLogger("exportQcresultByGroup")
+    public void exportQcresultByGroup(HttpServletResponse response, @RequestBody ExportQcresultVO exportQcresultVO) {
+        behospitalInfoFacade.exportQcresultByGroup(response, exportQcresultVO);
+    }
 }

+ 174 - 0
src/main/resources/mapper/BehospitalInfoMapper.xml

@@ -2563,6 +2563,180 @@
         t1.caseName
     </select>
 
+    <!-- 医疗组质控评分导出到excel-->
+    <select  id="exportQcresultByGroup" resultMap="ExportExcelMap" parameterType="com.diagbot.vo.ExportQcresultVO">
+        SELECT
+        t1.behDeptId,
+        t1.behDeptName,
+        t1.behDoctorName,
+        t1.patName,
+        t1.behospitalCode,
+        t1.behospitalDate,
+        t1.leaveHospitalDate,
+        t1.score,
+        t2.avgScore,
+        t1.msg,
+        t1.caseName
+        FROM
+        (
+        SELECT
+        CONCAT(
+        ( CASE WHEN a.director_doctor_name IS NOT NULL AND a.director_doctor_name != '' THEN concat( a.director_doctor_name, '\n' ) ELSE '' END ),
+        a.doctor_name
+        ) AS behDoctorName,
+        a.`name` AS patName,
+        a.behospital_code AS behospitalCode,
+        a.behospital_date AS behospitalDate,
+        a.leave_hospital_date AS leaveHospitalDate,
+        b.score_res AS score,
+        c.msg AS msg,
+        d.NAME AS caseName,
+        a.beh_dept_id AS behDeptId,
+        a.beh_dept_name AS behDeptName
+        FROM
+        med_behospital_info a,
+        med_qcresult_info b,
+        med_qcresult_detail c,
+        qc_cases 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.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.id
+        AND a.beh_dept_id = e.dept_id
+        AND a.is_placefile = '1'
+        AND a.doctor_id in
+            (SELECT doctor_id FROM `bas_doctor_info`
+            where is_deleted = 'N' and hospital_id = #{hospitalId} and group_id in (
+            select c3.group_id from sys_user c1, sys_user_hospital c2, bas_doctor_info c3
+            where c1.is_deleted = 'N' and c2.is_deleted = 'N' and c3.is_deleted = 'N'
+            and c1.id = c2.user_id and c2.hospital_id = c3.hospital_id
+            and c1.username = c3.doctor_id
+            and c2.hospital_id = #{hospitalId}
+            and c1.id = #{userId}
+            ))
+        <![CDATA[AND a.qc_type_id <>0 ]]>
+        <if test="hospitalId != null and hospitalId != ''">
+            AND a.hospital_id = #{hospitalId}
+        </if>
+        <if test="userId != null ">
+            AND e.user_id = #{userId}
+        </if>
+        <if test="leaveHosDateStart != null ">
+            <![CDATA[ and a.leave_hospital_date >= DATE(#{leaveHosDateStart})]]>
+        </if>
+        <if test="leaveHosDateEnd != null ">
+            <![CDATA[AND a.leave_hospital_date < DATE(#{leaveHosDateEnd})]]>
+        </if>
+        <if test="behospitalCode != null and behospitalCode != ''">
+            AND a.behospital_code like CONCAT('%',#{behospitalCode},'%')
+        </if>
+        <if test="level != null and level != ''">
+            AND b.level = #{level}
+        </if>
+        <if test="doctorName != null and doctorName != ''">
+            AND (a.doctor_name like CONCAT('%',#{doctorName},'%')
+            OR a.beh_doctor_name like CONCAT('%',#{doctorName},'%')
+            OR a.director_doctor_name like CONCAT('%',#{doctorName},'%'))
+        </if>
+        <if test="doctorCode != null and doctorCode != ''">
+            AND (a.doctor_id like CONCAT('%',#{doctorCode},'%')
+            OR a.beh_doctor_id like CONCAT('%',#{doctorCode},'%')
+            OR a.director_doctor_id like CONCAT('%',#{doctorCode},'%'))
+        </if>
+        <if test="deptId != null and deptId != ''">
+            AND a.beh_dept_id = #{deptId}
+        </if>
+        <if test="name != null and name != ''">
+            AND a.name like CONCAT('%',#{name},'%')
+        </if>
+        ) t1,
+        (
+        SELECT
+        ROUND( AVG( b.score_res ), 2 ) AS avgScore,
+        a.beh_dept_id AS behDeptId,
+        a.beh_dept_name AS behDeptName
+        FROM
+        med_behospital_info a,
+        med_qcresult_info b,
+        sys_user_dept c
+        WHERE
+        a.is_deleted = 'N'
+        AND a.doctor_id in
+            (SELECT doctor_id FROM `bas_doctor_info`
+            where is_deleted = 'N' and hospital_id = #{hospitalId} and group_id in (
+            select c3.group_id from sys_user c1, sys_user_hospital c2, bas_doctor_info c3
+            where c1.is_deleted = 'N' and c2.is_deleted = 'N' and c3.is_deleted = 'N'
+            and c1.id = c2.user_id and c2.hospital_id = c3.hospital_id
+            and c1.username = c3.doctor_id
+            and c2.hospital_id = #{hospitalId}
+            and c1.id = #{userId}
+            ))
+        AND b.is_deleted = 'N'
+        AND c.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.beh_dept_id = c.dept_id
+        AND a.is_placefile = '1'
+        <![CDATA[AND a.qc_type_id <>0 ]]>
+        <if test="hospitalId != null and hospitalId != ''">
+            AND a.hospital_id = #{hospitalId}
+        </if>
+        <if test="userId != null ">
+            AND c.user_id = #{userId}
+        </if>
+        <if test="leaveHosDateStart != null ">
+            <![CDATA[ and a.leave_hospital_date >= DATE(#{leaveHosDateStart})]]>
+        </if>
+        <if test="leaveHosDateEnd != null ">
+            <![CDATA[AND a.leave_hospital_date < DATE(#{leaveHosDateEnd})]]>
+        </if>
+        <if test="behospitalCode != null and behospitalCode != ''">
+            AND a.behospital_code like CONCAT('%',#{behospitalCode},'%')
+        </if>
+        <if test="level != null and level != ''">
+            AND b.level = #{level}
+        </if>
+        <if test="doctorName != null and doctorName != ''">
+            AND (a.doctor_name like CONCAT('%',#{doctorName},'%')
+            OR a.beh_doctor_name like CONCAT('%',#{doctorName},'%')
+            OR a.director_doctor_name like CONCAT('%',#{doctorName},'%'))
+        </if>
+        <if test="doctorCode != null and doctorCode != ''">
+            AND (a.doctor_id like CONCAT('%',#{doctorCode},'%')
+            OR a.beh_doctor_id like CONCAT('%',#{doctorCode},'%')
+            OR a.director_doctor_id like CONCAT('%',#{doctorCode},'%'))
+        </if>
+        <if test="deptId != null and deptId != ''">
+            AND a.beh_dept_id = #{deptId}
+        </if>
+        <if test="name != null and name != ''">
+            AND a.name like CONCAT('%',#{name},'%')
+        </if>
+        GROUP BY
+        a.beh_dept_id,
+        a.beh_dept_name
+        ) t2
+        WHERE
+        t1.behDeptId = t2.behDeptId
+        AND t1.behDeptName = t2.behDeptName
+        ORDER BY
+        t1.behDeptName,
+        t1.behDeptName,
+        t1.patName,
+        t1.behospitalCode,
+        t1.caseName
+    </select>
+
     <!-- 条目缺陷质控评分页(内页)-->
     <select id="qcResultShortPage" resultType="com.diagbot.dto.QcResultShortDTO">
         SELECT