Переглянути джерело

条目缺陷改善统计-内页

chengyao 3 роки тому
батько
коміт
793e684936

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

@@ -270,6 +270,7 @@ public class ResourceServerConfigurer extends ResourceServerConfigurerAdapter {
                 .antMatchers("/qc/analysis/getQcClickInnerPageByExport").permitAll()
                 .antMatchers("/qc/analysis/getEntryDefectImprove").permitAll()
                 .antMatchers("/qc/analysis/getEntryDefectImproveByExport").permitAll()
+                .antMatchers("/qc/analysis/getEntryDefectImproveInner").permitAll()
                 .antMatchers("/qc/analysisDept/getQcClickDept").permitAll()
                 .antMatchers("/qc/analysisDept/getQcClickByDeptExport").permitAll()
                 .antMatchers("/**").authenticated();

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

@@ -314,6 +314,7 @@ public class UrlAccessDecisionManager implements AccessDecisionManager {
                 || matchers("/qc/analysis/getQcClickInnerPageByExport", request)
                 || matchers("/qc/analysis/getEntryDefectImprove", request)
                 || matchers("/qc/analysis/getEntryDefectImproveByExport", request)
+                || matchers("/qc/analysis/getEntryDefectImproveInner", request)
                 || matchers("/qc/analysisDept/getQcClickDept", request)
                 || matchers("/qc/analysisDept/getQcClickByDeptExport", request)
                 || matchers("/", request)) {

+ 41 - 1
src/main/java/com/diagbot/facade/DataAnalysisFacade.java

@@ -1,10 +1,10 @@
 package com.diagbot.facade;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.diagbot.dto.BehospitalInfoDTO;
 import com.diagbot.dto.GetEntryDefectImproveDTO;
 import com.diagbot.dto.GetQcClickDTO;
 import com.diagbot.dto.GetQcClickInnerPageDTO;
-import com.diagbot.dto.HomePageByDeptDTO;
 import com.diagbot.entity.MedClickInfo;
 import com.diagbot.entity.QcresultInfo;
 import com.diagbot.enums.IsDeleteEnum;
@@ -17,10 +17,12 @@ import com.diagbot.util.ExcelUtils;
 import com.diagbot.util.ListUtil;
 import com.diagbot.util.StringUtil;
 import com.diagbot.util.SysUserUtils;
+import com.diagbot.vo.GetEntryDefectImproveInnerVO;
 import com.diagbot.vo.GetEntryDefectImproveVO;
 import com.diagbot.vo.GetQcClickInnerPageVO;
 import com.diagbot.vo.GetQcClickVO;
 import com.diagbot.vo.MedClickInfoVO;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Qualifier;
 import org.springframework.stereotype.Component;
@@ -121,6 +123,13 @@ public class DataAnalysisFacade {
         ExcelUtils.exportExcel(page.getRecords(), null, "sheet1", GetEntryDefectImproveDTO.class, fileName, response, 12.8f);
     }
 
+
+    public IPage<BehospitalInfoDTO> getEntryDefectImproveInner(GetEntryDefectImproveInnerVO getEntryDefectImproveInnerVO) {
+        entryDefectInnerSet(getEntryDefectImproveInnerVO);
+        IPage<BehospitalInfoDTO> records = medClickInfoService.getBaseMapper().getEntryDefectImproveInner(getEntryDefectImproveInnerVO);
+        return records;
+    }
+
     /**
      * 增加全院记录
      *
@@ -197,5 +206,36 @@ public class DataAnalysisFacade {
         getEntryDefectImproveVO.setHospitalId(Long.parseLong(SysUserUtils.getCurrentHospitalID()));
     }
 
+    private void entryDefectInnerSet(GetEntryDefectImproveInnerVO getEntryDefectImproveInnerVO) {
+        //入参验证
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
+        Date startDate = null;
+        Date endDate = null;
+        try {
+            startDate = simpleDateFormat.parse(getEntryDefectImproveInnerVO.getStartDate());
+            endDate = simpleDateFormat.parse(getEntryDefectImproveInnerVO.getEndDate());
 
+        } catch (ParseException e) {
+            e.printStackTrace();
+        }
+        if (DateUtil.after(startDate,endDate)){
+            throw new CommonException(CommonErrorCode.PARAM_IS_ERROR, "开始时间必须小于结束时间!");
+        }
+        if(StringUtils.isNotBlank(getEntryDefectImproveInnerVO.getChTimeStart())
+                && StringUtils.isNotBlank(getEntryDefectImproveInnerVO.getChTimeEnd())
+        ){
+            Date chTimeStartDate = null;
+            Date chTimeEndDate = null;
+            try {
+                chTimeStartDate = simpleDateFormat.parse(getEntryDefectImproveInnerVO.getChTimeStart());
+                chTimeEndDate = simpleDateFormat.parse(getEntryDefectImproveInnerVO.getChTimeStart());
+            } catch (ParseException e) {
+                e.printStackTrace();
+            }
+            if (DateUtil.after(chTimeStartDate,chTimeEndDate)){
+                throw new CommonException(CommonErrorCode.PARAM_IS_ERROR, "病历核查开始时间必须小于结束时间!");
+            }
+        }
+        getEntryDefectImproveInnerVO.setHospitalId(Long.parseLong(SysUserUtils.getCurrentHospitalID()));
+    }
 }

+ 3 - 0
src/main/java/com/diagbot/mapper/MedClickInfoMapper.java

@@ -1,11 +1,13 @@
 package com.diagbot.mapper;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.diagbot.dto.BehospitalInfoDTO;
 import com.diagbot.dto.GetEntryDefectImproveDTO;
 import com.diagbot.dto.GetQcClickDTO;
 import com.diagbot.dto.GetQcClickInnerPageDTO;
 import com.diagbot.entity.MedClickInfo;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.diagbot.vo.GetEntryDefectImproveInnerVO;
 import com.diagbot.vo.GetEntryDefectImproveVO;
 import com.diagbot.vo.GetQcClickInnerPageVO;
 import com.diagbot.vo.GetQcClickVO;
@@ -24,4 +26,5 @@ public interface MedClickInfoMapper extends BaseMapper<MedClickInfo> {
     public List<GetQcClickDTO> getQcClick(GetQcClickVO getQcClickVO);
     public IPage<GetQcClickInnerPageDTO> getQcClickInnerPage(GetQcClickInnerPageVO getQcClickInnerPageVO);
     public IPage<GetEntryDefectImproveDTO> getEntryDefectImprove(GetEntryDefectImproveVO getEntryDefectImproveVO);
+    public IPage<BehospitalInfoDTO> getEntryDefectImproveInner(GetEntryDefectImproveInnerVO getEntryDefectImproveInnerVO);
 }

+ 110 - 0
src/main/java/com/diagbot/vo/GetEntryDefectImproveInnerVO.java

@@ -0,0 +1,110 @@
+package com.diagbot.vo;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+import javax.validation.constraints.NotNull;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2020/6/16 17:00
+ */
+@Getter
+@Setter
+public class GetEntryDefectImproveInnerVO extends Page {
+    @ApiModelProperty(hidden = true)
+    private Long userId;
+    @ApiModelProperty(hidden = true)
+    private Long hospitalId;
+    /**
+     * 病历号
+     */
+    private String behospitalCode;
+    /**
+     * 病人姓名
+     */
+    private String patName;
+
+
+    /**
+     * 条目id
+     */
+    private Long entryId;
+
+    /**
+     * 条目缺陷名称
+     */
+    private String entryName;
+
+    /**
+     * 主诊断
+     */
+    private String diagnose;
+
+    /**
+     * 模块id
+     */
+    private Long casesId;
+
+    /**
+     * 模块名称
+     */
+    private String casesName;
+
+    /**
+     * 科室id
+     */
+    private String deptId;
+
+    /**
+     * 科室名称
+     */
+    private String deptName;
+
+    /**
+     * 医生编号
+     */
+    private String doctorId;
+
+    /**
+     * 医生姓名
+     */
+    private String doctorName;
+
+    /**
+     * 病历等级
+     */
+    private String level;
+
+    @NotNull(message = "请输入起始时间")
+    private String startDate;
+
+    @NotNull(message = "请输入截止时间")
+    private String endDate;
+
+    /**
+     * 核查状态(1:已核查,0:未核查)
+     */
+    private Integer checkStatus;
+
+    /**
+     * 病历核查人员
+     */
+    private String chName;
+
+    /**
+     * 病历核查起始时间
+     */
+    private String chTimeStart;
+    /**
+     * 病历核查截止时间
+     */
+    private String chTimeEnd;
+
+    /**
+     * 总数量-0,已改善数量-1,待改善数量-2
+     */
+    private String typeMark;
+}

+ 16 - 0
src/main/java/com/diagbot/web/DataAnalysisController.java

@@ -2,11 +2,13 @@ package com.diagbot.web;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.diagbot.annotation.SysLogger;
+import com.diagbot.dto.BehospitalInfoDTO;
 import com.diagbot.dto.GetQcClickDTO;
 import com.diagbot.dto.GetQcClickInnerPageDTO;
 import com.diagbot.dto.RespDTO;
 import com.diagbot.dto.GetEntryDefectImproveDTO;
 import com.diagbot.facade.DataAnalysisFacade;
+import com.diagbot.vo.GetEntryDefectImproveInnerVO;
 import com.diagbot.vo.GetQcClickInnerPageVO;
 import com.diagbot.vo.GetQcClickVO;
 import com.diagbot.vo.GetEntryDefectImproveVO;
@@ -122,4 +124,18 @@ public class DataAnalysisController {
        dataAnalysisFacade.getEntryDefectImproveByExport(response,getEntryDefectImproveVO);
     }
 
+
+    /**
+     * 条目缺陷改善统计-内页
+     *
+     * @param getEntryDefectImproveInnerVO
+     * @return
+     */
+    @ApiOperation(value = "条目缺陷改善统计-内页[by:cy]")
+    @PostMapping("/getEntryDefectImproveInner")
+    @SysLogger("getEntryDefectImproveInner")
+    public RespDTO<IPage<BehospitalInfoDTO>> getEntryDefectImproveInner(@RequestBody GetEntryDefectImproveInnerVO getEntryDefectImproveInnerVO) {
+        return RespDTO.onSuc(dataAnalysisFacade.getEntryDefectImproveInner(getEntryDefectImproveInnerVO));
+    }
+
 }

+ 325 - 6
src/main/resources/mapper/MedClickInfoMapper.xml

@@ -148,14 +148,14 @@
         FROM
         (
         SELECT
-        t.hospital_id AS hospitalId,
-        t.dept_id AS deptId,
-        t.dept_name AS deptName,
-        t.behospital_code AS behospitalCode,
+        e.hospital_id AS hospitalId,
+        e.dept_id AS deptId,
+        e.dept_name AS deptName,
+        e.behospital_code AS behospitalCode,
+        e.lastQcresultInfoId,
         t.beforeQcresultInfoId,
         u.cases_id AS casesId,
-        u.cases_entry_id AS beforeCasesEntryId,
-        e.lastQcresultInfoId
+        u.cases_entry_id AS beforeCasesEntryId
         FROM
         (
         SELECT
@@ -317,4 +317,323 @@
         s.casesId,
         s.entryId
     </select>
+
+    <select id="getEntryDefectImproveInner" resultType="com.diagbot.dto.BehospitalInfoDTO">
+        SELECT y.* from(
+        SELECT
+        s.hospitalId,
+        s.deptId,
+        s.deptName,
+        s.fileCode,
+        s.behospitalCode,
+        s. NAME,
+        s.sex,
+        s.bedCode,
+        s.behospitalDate,
+        s.leaveHospitalDate,
+        s.placefileDate,
+        s.diagnose,
+        s.doctorId,
+        s.doctorName,
+        s.behDoctorId,
+        s.behDoctorName,
+        s.directorDoctorId,
+        s.directorDoctorName,
+        s.wardCode,
+        s.wardName,
+        s.lastQcresultInfoId,
+        s.`level`,
+        s.gradeType,
+        s.scoreRes,
+        s.gradeTime,
+        s.age,
+        s.scoreBn,
+        s.checkStatus,
+        s.chType,
+        s.chName,
+        s.chTime,
+        s.casesId,
+        s.casesName,
+        s.entryName,
+        s.beforeCasesEntryId AS entryId,
+        sum(s.totalNum) AS totalNum,
+        sum(s.improveleNum) AS improveleNum,
+        sum(s.totalNum) - sum(s.improveleNum) AS handleNum
+        FROM
+        (
+        SELECT
+        f.*,
+        count(f.beforeCasesEntryId) AS totalNum,
+        CASE
+        WHEN count(f.lastCasesEntryId) &gt; 0 AND count(f.beforeCasesEntryId) - count(f.lastCasesEntryId) &lt;= 0 THEN
+        count(f.beforeCasesEntryId)
+        WHEN count(f.lastCasesEntryId) &gt; 0 AND count(f.beforeCasesEntryId) - count(f.lastCasesEntryId) &gt; 0 THEN
+        count(f.beforeCasesEntryId) - count(f.lastCasesEntryId)
+        WHEN count(f.lastCasesEntryId) = 0 THEN 0
+        END AS improveleNum
+        FROM
+        (
+        SELECT
+        k.*, i. NAME AS casesName,
+        o. NAME AS entryName,
+        y.cases_entry_id AS lastCasesEntryId
+        FROM
+        (
+        SELECT
+        e.*, t.beforeQcresultInfoId,
+        u.cases_id AS casesId,
+        u.cases_entry_id AS beforeCasesEntryId
+        FROM
+        (
+        SELECT
+        h.*
+        FROM
+        (
+        SELECT DISTINCT
+        w.hospital_id,
+        w.behospital_code
+        FROM
+        med_click_info w
+        WHERE
+        w.is_deleted = 'N'
+        <if test="hospitalId != null and hospitalId != ''">
+            AND w.hospital_id = #{hospitalId}
+        </if>
+        <if test="startDate != null and startDate != ''">
+            <![CDATA[ AND w.gmt_create >= #{startDate}]]>
+        </if>
+        <if test="endDate != null and endDate != ''">
+            <![CDATA[ AND w.gmt_create <= #{endDate}]]>
+        </if>
+        ) g
+        LEFT JOIN (
+        SELECT
+        v.hospital_id AS hospitalId,
+        v.beh_dept_id AS deptId,
+        v.beh_dept_name AS deptName,
+        v.file_code AS fileCode,
+        v.behospital_code AS behospitalCode,
+        v. NAME,
+        v.sex,
+        v.bed_code AS bedCode,
+        v.behospital_date AS behospitalDate,
+        v.leave_hospital_date AS leaveHospitalDate,
+        v.placefile_date AS placefileDate,
+        v.diagnose AS diagnose,
+        v.doctor_id AS doctorId,
+        v.doctor_name AS doctorName,
+        v.beh_doctor_id AS behDoctorId,
+        v.beh_doctor_name AS behDoctorName,
+        v.director_doctor_id AS directorDoctorId,
+        v.director_doctor_name AS directorDoctorName,
+        v.ward_code AS wardCode,
+        v.ward_name AS wardName,
+        v.lastQcresultInfoId,
+        ifnull(p. LEVEL, '未评分') AS `level`,
+        p.grade_type AS gradeType,
+        p.score_res AS scoreRes,
+        p.gmt_create AS gradeTime,
+        IF ( n.age IS NULL,NULL,CONCAT(ifnull(n.age, ''),ifnull(n.age_unit, ''))) AS age,
+        r.score_res AS scoreBn,
+        CASE WHEN ISNULL(j. STATUS) THEN 0 ELSE j.STATUS END checkStatus,
+        j.check_type AS chType,
+        j.check_name AS chName,
+        j.check_time AS chTime
+        FROM
+        (
+        SELECT
+        q.*,
+         max(w.qcresult_info_id) AS lastQcresultInfoId
+        FROM
+        med_behospital_info q,
+        med_click_info w
+        WHERE
+        q.is_deleted = 'N'
+        AND w.is_deleted = 'N'
+        AND q.hospital_id = w.hospital_id
+        AND q.behospital_code = w.behospital_code
+        AND q.qc_type_id != 0
+        <if test="hospitalId != null and hospitalId != ''">
+            AND q.hospital_id = #{hospitalId}
+        </if>
+        <if test="deptId != null and deptId != ''">
+            and q.beh_dept_id = #{deptId}
+        </if>
+        <if test="deptName != null and deptName != ''">
+            and q.beh_dept_name like CONCAT('%',#{deptName},'%')
+        </if>
+        <if test="diagnose != null and diagnose != ''">
+            AND q.diagnose LIKE CONCAT( '%', #{diagnose}, '%' )
+        </if>
+        <if test="doctorId != null and doctorId != ''">
+            and q.doctor_id = #{doctor_id}
+        </if>
+        <if test="doctorName != null and doctorName != ''">
+            and q.doctor_name like CONCAT('%',#{doctorName},'%')
+        </if>
+        <if test="patName != null and patName != ''">
+            and q.name like CONCAT('%',#{patName},'%')
+        </if>
+        <if test="behospitalCode != null and behospitalCode != ''">
+            and q.behospital_code like CONCAT('%',#{behospitalCode},'%')
+        </if>
+        GROUP BY
+        q.beh_dept_id,
+        q.beh_dept_name,
+        q.behospital_code
+        ) v
+        LEFT JOIN med_qcresult_info p ON v.hospital_id = p.hospital_id
+        AND v.behospital_code = p.behospital_code
+        AND p.is_deleted = 'N'
+        LEFT JOIN med_home_page n ON v.hospital_id = n.hospital_id
+        AND v.behospital_code = n.behospital_code
+        AND n.is_deleted = 'N'
+        LEFT JOIN med_qcresult_cases r ON v.hospital_id = r.hospital_id
+        AND v.behospital_code = r.behospital_code
+        AND r.is_deleted = 'N'
+        AND r.cases_id = 243
+        LEFT JOIN (
+        SELECT
+        *
+        FROM
+        med_check_info
+        WHERE
+        is_deleted = 'N'
+        AND check_type IN (0, 2)
+        ) j ON v.behospital_code = j.behospital_code
+        AND v.hospital_id = j.hospital_id
+        where 1=1
+        <if test="level != null and level != ''">
+            and p.level = #{level}
+        </if>
+        <if test="checkStatus != null ">
+            and j.check_status = #{checkStatus}
+        </if>
+
+        <if test="chName != null and chName !=''">
+            AND j.ch_name like CONCAT('%',#{chName},'%')
+        </if>
+        <if test="chTimeStart != null">
+            <![CDATA[ and j.ch_time >= #{chTimeStart}]]>
+        </if>
+        <if test="chTimeEnd != null">
+            <![CDATA[ and j.ch_time < #{chTimeEnd}]]>
+        </if>
+        ) h ON g.hospital_id = h.hospitalId
+        AND g.behospital_code = h.behospitalCode
+        ) e
+        LEFT JOIN (
+        SELECT
+        q.hospital_id,
+        q.beh_dept_id AS dept_id,
+        q.beh_dept_name AS dept_name,
+        w.behospital_code,
+        min(w.qcresult_info_id) AS beforeQcresultInfoId
+        FROM
+        med_behospital_info q,
+        med_click_info w,
+        med_qcresult_detail e
+        WHERE
+        q.is_deleted = 'N'
+        AND w.is_deleted = 'N'
+        AND e.is_deleted = 'Y'
+        AND q.hospital_id = w.hospital_id
+        AND q.hospital_id = e.hospital_id
+        AND q.behospital_code = w.behospital_code
+        AND w.qcresult_info_id = e.qcresult_info_id
+        AND q.qc_type_id != 0
+        <if test="hospitalId != null and hospitalId != ''">
+            AND q.hospital_id = #{hospitalId}
+        </if>
+        <if test="deptId != null and deptId != ''">
+            and q.beh_dept_id = #{deptId}
+        </if>
+        <if test="deptName != null and deptName != ''">
+            and q.beh_dept_name like CONCAT('%',#{deptName},'%')
+        </if>
+        GROUP BY
+        q.beh_dept_id,
+        q.beh_dept_name,
+        q.behospital_code
+        UNION
+        SELECT
+        q.hospital_id,
+        q.beh_dept_id AS dept_id,
+        q.beh_dept_name AS dept_name,
+        w.behospital_code,
+        min(w.qcresult_info_id) AS beforeQcresultInfoId
+        FROM
+        med_behospital_info q,
+        med_click_info w
+        WHERE
+        q.is_deleted = 'N'
+        AND w.is_deleted = 'N'
+        AND q.hospital_id = w.hospital_id
+        AND q.behospital_code = w.behospital_code
+        AND q.qc_type_id != 0
+        <if test="hospitalId != null and hospitalId != ''">
+            AND q.hospital_id = #{hospitalId}
+        </if>
+        <if test="deptId != null and deptId != ''">
+            and q.beh_dept_id = #{deptId}
+        </if>
+        <if test="deptName != null and deptName != ''">
+            and q.beh_dept_name like CONCAT('%',#{deptName},'%')
+        </if>
+        GROUP BY
+        q.beh_dept_id,
+        q.beh_dept_name,
+        q.behospital_code
+        HAVING
+        count(q.behospital_code) = 1
+        ) t ON e.hospitalId = t.hospital_id
+        AND e.behospitalCode = t.behospital_code
+        LEFT JOIN med_qcresult_detail u ON t.hospital_id = u.hospital_id
+        AND t.beforeQcresultInfoId = u.qcresult_info_id
+        WHERE
+        u.grade_type = 1
+        ORDER BY
+        t.dept_name
+        ) k
+        LEFT JOIN med_qcresult_detail y ON k.hospitalId = y.hospital_id
+        AND k.lastQcresultInfoId = y.qcresult_info_id
+        AND k.beforeCasesEntryId = y.cases_entry_id
+        LEFT JOIN qc_cases i ON i.id = k.casesId
+        AND i.is_deleted = 'N'
+        LEFT JOIN qc_cases_entry o ON o.id = k.beforeCasesEntryId
+        AND o.is_deleted = 'N'
+        WHERE
+        (y.grade_type = 1 OR y.cases_entry_id IS NULL)
+        <if test="casesName != null and casesName != ''">
+            and i.name like CONCAT('%',#{casesName},'%')
+        </if>
+        <if test="entryName != null and entryName != ''">
+            and o.name like CONCAT('%',#{entryName},'%')
+        </if>
+        ) f
+        GROUP BY
+        f.deptId,
+        f.deptName,
+        f.behospitalCode,
+        f.casesId,
+        f.beforeCasesEntryId
+        ) s
+        GROUP BY
+        s.deptId,
+        s.deptName,
+        s.casesId,
+        s.behospitalCode,
+        s.beforeCasesEntryId)y
+        where
+        1=1
+        <if test="typeMark != null and typeMark !='' and typeMark == 0">
+            AND y.totalNum = 1
+        </if>
+        <if test="typeMark != null and typeMark !='' and typeMark == 1">
+            AND y.handleNum = 1
+        </if>
+        <if test="typeMark != null and typeMark !='' and typeMark == 2">
+            AND y.improveleNum = 1
+        </if>
+    </select>
 </mapper>