瀏覽代碼

湘雅全院条目缺陷改善统计

chengyao 3 年之前
父節點
當前提交
4899d6852b

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

@@ -266,6 +266,7 @@ public class ResourceServerConfigurer extends ResourceServerConfigurerAdapter {
                 .antMatchers("/qc/medCheckInfo/saveDataEdit").permitAll()
                 .antMatchers("/qc/analysis/getQcClick").permitAll()
                 .antMatchers("/qc/analysis/getQcClickInnerPage").permitAll()
+                .antMatchers("/qc/analysis/getEntryDefectImprove").permitAll()
                 .antMatchers("/**").authenticated();
         //                .antMatchers("/**").permitAll();
     }

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

@@ -310,6 +310,7 @@ public class UrlAccessDecisionManager implements AccessDecisionManager {
                 || matchers("/qc/dataEdit/saveDataEdit", request)
                 || matchers("/qc/analysis/getQcClick", request)
                 || matchers("/qc/analysis/getQcClickInnerPage", request)
+                || matchers("/qc/analysis/getEntryDefectImprove", request)
                 || matchers("/", request)) {
             return true;
         }

+ 69 - 0
src/main/java/com/diagbot/dto/GetEntryDefectImproveDTO.java

@@ -0,0 +1,69 @@
+package com.diagbot.dto;
+
+import lombok.Data;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.io.Serializable;
+import java.text.DecimalFormat;
+
+/**
+ * @Description:
+ * @author: cy
+ * @time: 2020/9/4 14:59
+ */
+@Data
+public class GetEntryDefectImproveDTO{
+    /**
+     * 科室id
+     */
+    private String deptId;
+
+
+    /**
+     * 科室名称
+     */
+    private String deptName;
+
+    /**
+     * 缺陷id
+     */
+    private String entryId;
+
+    /**
+     * 缺陷名称
+     */
+    private String entryName;
+
+    /**
+     * 模块id
+     */
+    private String casesId;
+
+    /**
+     * 模块名称
+     */
+    private String casesName;
+
+
+    /**
+     * 缺陷总数
+     */
+    private Integer totalNum;
+
+    /**
+     * 已改善数
+     */
+    private Integer handleNum;
+
+    /**
+     * 待改善数
+     */
+    private Integer improveleNum;
+
+    /**
+     * 改善率
+     */
+    private String handleStr;
+
+}

+ 16 - 0
src/main/java/com/diagbot/facade/DataAnalysisFacade.java

@@ -1,6 +1,7 @@
 package com.diagbot.facade;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.diagbot.dto.GetEntryDefectImproveDTO;
 import com.diagbot.dto.GetQcClickDTO;
 import com.diagbot.dto.GetQcClickInnerPageDTO;
 import com.diagbot.exception.CommonErrorCode;
@@ -10,6 +11,7 @@ import com.diagbot.util.DateUtil;
 import com.diagbot.util.ListUtil;
 import com.diagbot.util.StringUtil;
 import com.diagbot.util.SysUserUtils;
+import com.diagbot.vo.GetEntryDefectImproveVO;
 import com.diagbot.vo.GetQcClickInnerPageVO;
 import com.diagbot.vo.GetQcClickVO;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -48,6 +50,12 @@ public class DataAnalysisFacade {
         return records;
     }
 
+    public IPage<GetEntryDefectImproveDTO> getEntryDefectImprove(GetEntryDefectImproveVO getEntryDefectImproveVO) {
+        entryDefectSet(getEntryDefectImproveVO);
+        IPage<GetEntryDefectImproveDTO> records = medClickInfoService.getBaseMapper().getEntryDefectImprove(getEntryDefectImproveVO);
+        return records;
+    }
+
     /**
      * 增加全院记录
      *
@@ -89,5 +97,13 @@ public class DataAnalysisFacade {
         getQcClickInnerPageVO.setHospitalId(Long.parseLong(SysUserUtils.getCurrentHospitalID()));
     }
 
+    private void entryDefectSet(GetEntryDefectImproveVO getEntryDefectImproveVO) {
+        //入参验证
+        if (DateUtil.after(DateUtil.parseDateTime(getEntryDefectImproveVO.getStartDate()),DateUtil.parseDateTime(getEntryDefectImproveVO.getEndDate()))){
+            throw new CommonException(CommonErrorCode.PARAM_IS_ERROR, "开始时间必须小于结束时间!");
+        }
+        getEntryDefectImproveVO.setHospitalId(Long.parseLong(SysUserUtils.getCurrentHospitalID()));
+    }
+
 
 }

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

@@ -1,10 +1,12 @@
 package com.diagbot.mapper;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
+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.GetEntryDefectImproveVO;
 import com.diagbot.vo.GetQcClickInnerPageVO;
 import com.diagbot.vo.GetQcClickVO;
 
@@ -21,4 +23,5 @@ import java.util.List;
 public interface MedClickInfoMapper extends BaseMapper<MedClickInfo> {
     public List<GetQcClickDTO> getQcClick(GetQcClickVO getQcClickVO);
     public IPage<GetQcClickInnerPageDTO> getQcClickInnerPage(GetQcClickInnerPageVO getQcClickInnerPageVO);
+    public IPage<GetEntryDefectImproveDTO> getEntryDefectImprove(GetEntryDefectImproveVO getEntryDefectImproveVO);
 }

+ 52 - 0
src/main/java/com/diagbot/vo/GetEntryDefectImproveVO.java

@@ -0,0 +1,52 @@
+package com.diagbot.vo;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import javax.validation.constraints.NotNull;
+
+/**
+ * @Description:
+ * @author: cy
+ * @time: 2020/9/4 14:59
+ */
+@Getter
+@Setter
+public class GetEntryDefectImproveVO extends Page {
+    /**
+     * 医院id
+     */
+    @ApiModelProperty(hidden = true)
+    private Long hospitalId;
+
+    /**
+     * 科室id
+     */
+    private String deptId;
+
+    /**
+     * 科室名称
+     */
+    private String deptName;
+
+    /**
+     * 缺陷名称
+     */
+    private String entryName;
+
+    /**
+     * 模块名称
+     */
+    private String casesName;
+
+    @NotNull(message = "请输入起始时间")
+    @DateTimeFormat(pattern = "yyyy-MM-dd  HH:mm:ss")
+    private String startDate;
+    @DateTimeFormat(pattern = "yyyy-MM-dd  HH:mm:ss")
+    @NotNull(message = "请输入截止时间")
+    private String endDate;
+
+}

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

@@ -5,9 +5,11 @@ import com.diagbot.annotation.SysLogger;
 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.GetQcClickInnerPageVO;
 import com.diagbot.vo.GetQcClickVO;
+import com.diagbot.vo.GetEntryDefectImproveVO;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -57,4 +59,19 @@ public class DataAnalysisController {
     public RespDTO<IPage<GetQcClickInnerPageDTO>> getQcClickInnerPage(@RequestBody @Valid GetQcClickInnerPageVO getQcClickInnerPageVO) {
         return RespDTO.onSuc(dataAnalysisFacade.getQcClickInnerPage(getQcClickInnerPageVO));
     }
+
+    /**
+     * 条目缺陷改善统计
+     *
+     * @param getEntryDefectImproveVO
+     * @return
+     */
+    @ApiOperation(value = "条目缺陷改善统计[by:cy]")
+    @PostMapping("/getEntryDefectImprove")
+    @SysLogger("getEntryDefectImprove")
+    public RespDTO<IPage<GetEntryDefectImproveDTO>> getEntryDefectImprove(@RequestBody @Valid GetEntryDefectImproveVO getEntryDefectImproveVO) {
+        return RespDTO.onSuc(dataAnalysisFacade.getEntryDefectImprove(getEntryDefectImproveVO));
+    }
+
+
 }

+ 216 - 0
src/main/resources/mapper/MedClickInfoMapper.xml

@@ -106,4 +106,220 @@
         a.doctor_name
        )t
     </select>
+
+    <select id="getEntryDefectImprove" resultType="com.diagbot.dto.GetEntryDefectImproveDTO">
+        select
+        t6.hospitalId,
+        t6.deptId,
+        t6.deptName,
+        t6.casesId,
+        t6.casesName,
+        t6.entryName,
+        t6.entryId,
+        t6.totalNum,
+        t6.improveleNum,
+        t6.handleNum,
+        t6.handleStr
+        from(
+        SELECT
+        t5.hospital_id AS hospitalId,
+        t5.dept_id AS deptId,
+        t5.dept_name AS deptName,
+        t5.cases_id AS casesId,
+        t5. NAME AS casesName,
+        t5.entryName,
+        t5.cases_entry_id AS entryId,
+        sum(t5.totalNum) AS totalNum,
+        sum(t5.improveleNum) AS improveleNum,
+        sum(t5.totalNum)-sum(t5.improveleNum) AS handleNum,
+        concat( ROUND((sum(t5.totalNum)-sum(t5.improveleNum))/ sum(t5.totalNum)* 100, 2 ), '%' ) AS handleStr
+        FROM
+        (
+        SELECT
+        t4.hospital_id,
+        t4.dept_id,
+        t4.dept_name,
+        t4.behospital_code,
+        t4.cases_id,
+        t4. NAME,
+        t4.entryName,
+        t4.cases_entry_id,
+        count(t4.msgSec) AS totalNum,
+        CASE
+        WHEN count(t4.msg) &gt; 0
+        AND count(t4.msgSec) - count(t4.msg) &lt;= 0 THEN
+        count(t4.msgSec)
+        WHEN count(t4.msg) &gt; 0
+        AND count(t4.msgSec) - count(t4.msg) &gt; 0 THEN
+        count(t4.msgSec) - count(t4.msg)
+        WHEN count(t4.msg) = 0
+        AND count(t4.msgSec) - count(t4.msg) &gt; 0 THEN
+        0
+        END AS improveleNum
+        FROM
+        (
+        SELECT
+        t3.hospital_id,
+        t3.dept_id,
+        t3.dept_name,
+        t3.behospital_code,
+        t3.cases_id,
+        t3. NAME,
+        t3.msg AS entryName,
+        t3.cases_entry_id,
+        CASE
+        WHEN t3.is_deleted = 'N' THEN
+        t3.msg
+        END AS msg,
+        CASE
+        WHEN t3.is_deleted = 'Y' THEN
+        t3.msg
+        END AS msgSec
+        FROM
+        (
+        SELECT
+        t1.hospital_id,
+        t1.dept_id,
+        t1.dept_name,
+        t2.behospital_code,
+        t2.cases_id,
+        t3. NAME,
+        t2.cases_entry_id,
+        t2.msg,
+        t2.is_deleted
+        FROM
+        med_click_info t1,
+        med_qcresult_detail t2,
+        qc_cases t3
+        WHERE
+        t1.is_deleted = 'N'
+        AND t2.is_deleted = 'N'
+        AND t1.hospital_id = t2.hospital_id
+        AND t1.qcresult_info_id = t2.qcresult_info_id
+        AND t2.cases_id = t3.id
+        <if test="hospitalId != null and hospitalId != ''">
+            AND t1.hospital_id = #{hospitalId}
+        </if>
+        <if test="deptId != null and deptId != ''">
+            and t1.dept_id = #{deptId}
+        </if>
+        <if test="deptName != null and deptName != ''">
+            and t1.dept_name like CONCAT('%',#{deptName},'%')
+        </if>
+        <if test="casesName != null and casesName != ''">
+            and t3.name like CONCAT('%',#{casesName},'%')
+        </if>
+        <if test="entryName != null and entryName != ''">
+            and t2.msg like CONCAT('%',#{entryName},'%')
+        </if>
+        UNION
+        SELECT
+        tt1.hospital_id,
+        tt1.dept_id,
+        tt1.dept_name,
+        tt1.behospital_code,
+        tt1.cases_id,
+        tt1.name,
+        tt1.cases_entry_id,
+        tt1.msg,
+        tt1.is_deleted
+        FROM
+        (
+        SELECT DISTINCT
+        t1.hospital_id,
+        t1.dept_id,
+        t1.dept_name,
+        t2.qcresult_info_id,
+        t2.behospital_code,
+        t2.cases_id,
+        t2.cases_entry_id,
+        t2.msg,
+        t3. NAME,
+        t2.is_deleted,
+        t2.gmt_create AS gmTime
+        FROM
+        med_click_info t1,
+        med_qcresult_detail t2,
+        qc_cases t3
+        WHERE
+        t1.is_deleted = 'N'
+        AND t2.is_deleted = 'Y'
+        AND t1.hospital_id = t2.hospital_id
+        AND t1.qcresult_info_id = t2.qcresult_info_id
+        AND t2.cases_id = t3.id
+        <if test="hospitalId != null and hospitalId != ''">
+            AND t1.hospital_id = #{hospitalId}
+        </if>
+        <if test="deptId != null and deptId != ''">
+            and t1.dept_id = #{deptId}
+        </if>
+        <if test="deptName != null and deptName != ''">
+            and t1.dept_name like CONCAT('%',#{deptName},'%')
+        </if>
+        <if test="casesName != null and casesName != ''">
+            and t3.name like CONCAT('%',#{casesName},'%')
+        </if>
+        <if test="entryName != null and entryName != ''">
+            and t2.msg like CONCAT('%',#{entryName},'%')
+        </if>
+        ORDER BY
+        t2.gmt_create
+        ) tt1,
+        (
+        SELECT
+        t2.qcresult_info_id,
+        t2.behospital_code,
+        min(t2.gmt_create) AS gmTime
+        FROM
+        med_click_info t1,
+        med_click_info t2
+        WHERE
+        t1.is_deleted = 'N'
+        and t1.is_deleted = 'N'
+        and t1.behospital_code =t2.behospital_code
+        <if test="hospitalId != null and hospitalId != ''">
+            and t1.hospital_id = #{hospitalId}
+        </if>
+        <if test="deptId != null and deptId != ''">
+            and t1.dept_id = #{deptId}
+        </if>
+        <if test="deptName != null and deptName != ''">
+            and t1.dept_name like CONCAT('%',#{deptName},'%')
+        </if>
+        <if test="startDate != null and startDate != ''">
+            <![CDATA[ AND t1.gmt_create >= #{startDate}]]>
+        </if>
+        <if test="endDate != null and endDate != ''">
+            <![CDATA[ AND t1.gmt_create <= #{endDate}]]>
+        </if>
+        GROUP BY
+        t2.behospital_code
+        ) tt2
+        WHERE
+        tt1.behospital_code = tt2.behospital_code
+        AND tt1.qcresult_info_id = tt2.qcresult_info_id
+        ) t3
+        GROUP BY
+        t3.dept_id,
+        t3.dept_name,
+        t3.behospital_code,
+        t3.cases_id,
+        t3.cases_entry_id,
+        t3.is_deleted
+        ) t4
+        GROUP BY
+        t4.dept_id,
+        t4.dept_name,
+        t4.behospital_code,
+        t4.cases_id,
+        t4.cases_entry_id
+        ) t5
+        GROUP BY
+        t5.dept_id,
+        t5.dept_name,
+        t5.cases_id,
+        t5.cases_entry_id)t6
+        where
+        t6.totalNum != 0
+    </select>
 </mapper>