lenovodn 1 рік тому
батько
коміт
c2c103499a

+ 5 - 2
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/controller/ViolationAnalysisController.java

@@ -361,9 +361,12 @@ public class ViolationAnalysisController {
         }
         AuditMidDetailListRequest request = new AuditMidDetailListRequest();
         request.setMedicalInsRuleInfoCode(medicalInsRuleInfoCode);
+        AfterDeptDetailRequest afterDeptDetailRequest = new AfterDeptDetailRequest();
+        afterDeptDetailRequest.setMedicalInsRuleInfoCode(medicalInsRuleInfoCode);
+
         Map<String, String[]> parameterMap = req.getParameterMap();
-        IPage<AuditMidDetailListResponse> result = violationAnalysisService.loadMidAuditPageList(request, pageNo, pageSize, parameterMap);
-        BigDecimal totalAmount = violationAnalysisService.statisticsMidAuditTotal(request);
+        IPage<AuditMidDetailListResponse> result = violationAnalysisService.loadAfterAuditPageList(request, pageNo, pageSize, parameterMap);
+        BigDecimal totalAmount = violationAnalysisService.afterStatisticsMidAuditTotal(afterDeptDetailRequest);
         Result<IPage<AuditMidDetailListResponse>> ok = Result.OK(result);
         JSONObject j = new JSONObject();
         j.put("totalAmount", totalAmount);

+ 1 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/mapper/AfterwardsAuditMapper.java

@@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import org.apache.ibatis.annotations.Param;
 import org.jeecg.modules.medical.common.bo.*;
 import org.jeecg.modules.medical.common.bo.after.response.AfterDeptDetailRequest;
+import org.jeecg.modules.medical.common.bo.mid.request.AuditMidDetailListRequest;
 import org.jeecg.modules.medical.entity.AfterwardsAudit;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import org.jeecg.modules.medical.entity.AfterwardsAuditDetail;

+ 3 - 7
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/mapper/xml/AfterwardsAuditDetailMapper.xml

@@ -48,15 +48,11 @@
         m.project_type,
         m.medical_project_name,
         m.medical_project_code,
-        IFNULL(count(d.amount), 0) as violationTotal,
-        sum(d.amount) as errorAmountTotal
+        IFNULL(count(m.medical_project_code), 0) as violationTotal,
+        sum(m.amount) as errorAmountTotal
         FROM
         afterwards_audit_detail AS m
-        LEFT JOIN (
-        SELECT medical_project_code, count(amount) as amount
-        FROM afterwards_audit_detail
-        GROUP BY medical_project_code
-        ) AS d ON m.medical_project_code = d.medical_project_code
+
         <where>
                       1=1
             <if test="medicalProjectSearch != null and medicalProjectSearch != '' ">

+ 1 - 6
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/mapper/xml/AfterwardsAuditMapper.xml

@@ -10,7 +10,7 @@
         m.medical_dept_name,
         m.medical_dept_code,
         IFNULL(sd.deptDoctorTotal, 0) AS deptDoctorTotal,
-        COUNT(DISTINCT t.doctor_id) AS violationDoctorNumber,
+        COUNT(DISTINCT m.doctor_id) AS violationDoctorNumber,
         COUNT(m.id) AS violationTotal,
         IFNULL(SUM(CASE WHEN m.treatment_type = '2' THEN m.amount ELSE 0 END), 0) AS outpatientsErrorAmount,
         IFNULL(SUM(CASE WHEN m.treatment_type = '1' THEN m.amount ELSE 0 END), 0) AS hospErrorAmount,
@@ -26,11 +26,6 @@
         FROM sys_depart
         WHERE medical_dept_code = m.medical_dept_code
         )
-        LEFT JOIN (
-        SELECT medical_dept_code, doctor_id
-        FROM afterwards_audit_detail
-        GROUP BY medical_dept_code, doctor_id
-        ) AS t ON m.medical_dept_code = t.medical_dept_code
         <where>
                       1=1
             <if test="ew.medicalDeptName != null and ew.medicalDeptName != ''">

+ 42 - 20
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/mapper/xml/MidIncidentAuditDetailMapper.xml

@@ -73,15 +73,26 @@
     <select id="midDeptAuditList"
             resultType="org.jeecg.modules.medical.common.bo.mid.response.MidDeptAuditDetailResponse">
         SELECT
-            m.medical_dept_name
-             ,m.medical_dept_code
-             ,(SELECT count(*) from sys_user_depart where dep_id = (SELECT id from sys_depart where medical_dept_code = m.medical_dept_code)) as deptDoctorTotal -- 科室医生总数
-             ,(select count(*) from ( SELECT  count(doctor_id) from mid_incident_audit_detail WHERE medical_dept_code = m.medical_dept_code GROUP BY doctor_id) as t  ) as violationDoctorNumber -- 违规医生总数
-             ,COUNT(id) as violationTotal
-             ,(select IFNULL(sum(amount), 0) from mid_incident_audit_detail WHERE medical_dept_code = m.medical_dept_code and treatment_type = '2') as outpatientsErrorAmount  -- 门诊违规金额
-             ,(select IFNULL(sum(amount),0) from mid_incident_audit_detail WHERE medical_dept_code = m.medical_dept_code and treatment_type = '1') as hospErrorAmount -- 住院违规金额
-             ,sum(amount) as errorAmountTotal -- 异常金额总和
-        FROM mid_incident_audit_detail as m
+        m.id,
+        m.medical_dept_name,
+        m.medical_dept_code,
+        IFNULL(sd.deptDoctorTotal, 0) AS deptDoctorTotal,
+        COUNT(DISTINCT m.doctor_id) AS violationDoctorNumber,
+        COUNT(m.id) AS violationTotal,
+        IFNULL(SUM(CASE WHEN m.treatment_type = '2' THEN m.amount ELSE 0 END), 0) AS outpatientsErrorAmount,
+        IFNULL(SUM(CASE WHEN m.treatment_type = '1' THEN m.amount ELSE 0 END), 0) AS hospErrorAmount,
+        IFNULL(SUM(m.amount), 0) AS errorAmountTotal
+        FROM mid_incident_audit_detail AS m
+        LEFT JOIN (
+        SELECT dep.id AS department_id, COUNT(user_dep.id) AS deptDoctorTotal
+        FROM sys_depart AS dep
+        LEFT JOIN sys_user_depart AS user_dep ON dep.id = user_dep.dep_id
+        GROUP BY dep.id
+        ) AS sd ON sd.department_id = (
+        SELECT id
+        FROM sys_depart
+        WHERE medical_dept_code = m.medical_dept_code
+        )
         <where> 1=1
             <if test="deptName != null and deptName != ''">
                 AND m.medical_dept_name like LIKE concat(concat('%',#{deptName}),'%')
@@ -96,7 +107,7 @@
                 and <![CDATA[ m.create_time <= #{endTime} ]]>
             </if>
         </where>
-        GROUP BY medical_dept_code
+        GROUP BY m.medical_dept_code
         ORDER BY violationDoctorNumber DESC
     </select>
 
@@ -104,15 +115,26 @@
     <select id="afterDeptAuditList"
             resultType="org.jeecg.modules.medical.common.bo.mid.response.MidDeptAuditDetailResponse">
         SELECT
-        m.medical_dept_name
-        ,m.medical_dept_code
-        ,(SELECT count(*) from sys_user_depart where dep_id = (SELECT id from sys_depart where medical_dept_code = m.medical_dept_code)) as deptDoctorTotal -- 科室医生总数
-        ,(select count(*) from ( SELECT  count(doctor_id) from afterwards_audit_detail WHERE medical_dept_code = m.medical_dept_code GROUP BY doctor_id) as t  ) as violationDoctorNumber -- 违规医生总数
-        ,COUNT(id) as violationTotal
-        ,(select IFNULL(sum(amount), 0) from afterwards_audit_detail WHERE medical_dept_code = m.medical_dept_code and treatment_type = '2') as outpatientsErrorAmount  -- 门诊违规金额
-        ,(select IFNULL(sum(amount),0) from afterwards_audit_detail WHERE medical_dept_code = m.medical_dept_code and treatment_type = '1') as hospErrorAmount -- 住院违规金额
-        ,sum(amount) as errorAmountTotal -- 异常金额总和
-        FROM afterwards_audit_detail as m
+        m.id,
+        m.medical_dept_name,
+        m.medical_dept_code,
+        IFNULL(sd.deptDoctorTotal, 0) AS deptDoctorTotal,
+        COUNT(DISTINCT m.doctor_id) AS violationDoctorNumber,
+        COUNT(m.id) AS violationTotal,
+        IFNULL(SUM(CASE WHEN m.treatment_type = '2' THEN m.amount ELSE 0 END), 0) AS outpatientsErrorAmount,
+        IFNULL(SUM(CASE WHEN m.treatment_type = '1' THEN m.amount ELSE 0 END), 0) AS hospErrorAmount,
+        IFNULL(SUM(m.amount), 0) AS errorAmountTotal
+        FROM afterwards_audit_detail AS m
+        LEFT JOIN (
+        SELECT dep.id AS department_id, COUNT(user_dep.id) AS deptDoctorTotal
+        FROM sys_depart AS dep
+        LEFT JOIN sys_user_depart AS user_dep ON dep.id = user_dep.dep_id
+        GROUP BY dep.id
+        ) AS sd ON sd.department_id = (
+        SELECT id
+        FROM sys_depart
+        WHERE medical_dept_code = m.medical_dept_code
+        )
         <where> 1=1
             <if test="deptName != null and deptName != ''">
                 AND m.medical_dept_name like LIKE concat(concat('%',#{deptName}),'%')
@@ -127,7 +149,7 @@
                 and <![CDATA[ m.create_time <= #{endTime} ]]>
             </if>
         </where>
-        GROUP BY medical_dept_code
+        GROUP BY m.medical_dept_code
         ORDER BY violationDoctorNumber DESC
     </select>
 

+ 5 - 2
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/mapper/xml/MidIncidentAuditMapper.xml

@@ -103,7 +103,7 @@
             <if test="ew.endTime != null and ew.endTime != '' ">
                 AND <![CDATA[  create_time <= #{ew.endTime} ]]>
             </if>
-            <if test="ew.medicalProjectCode != null and ew.medicalProjectCode != null" >
+            <if test="ew.medicalProjectCode != '' and ew.medicalProjectCode != null" >
                 AND medical_project_code = #{ew.medicalProjectCode}
             </if>
             <if test="ew.medicalInsRuleInfoCode != null and ew.medicalInsRuleInfoCode != ''">
@@ -143,9 +143,12 @@
             <if test="ew.endTime != null and ew.endTime != '' ">
                 AND <![CDATA[  create_time <= #{ew.endTime} ]]>
             </if>
-            <if test="ew.medicalProjectCode != null and ew.medicalProjectCode != null" >
+            <if test="ew.medicalProjectCode != '' and ew.medicalProjectCode != null" >
                 AND medical_project_code = #{ew.medicalProjectCode}
             </if>
+            <if test="ew.medicalInsRuleInfoCode != '' and ew.medicalInsRuleInfoCode != null" >
+                AND medical_Ins_Rule_Info_Code = #{ew.medicalInsRuleInfoCode}
+            </if>
         </where>
     </select>
 

+ 1 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/service/IAfterwardsAuditService.java

@@ -8,6 +8,7 @@ import org.jeecg.modules.medical.common.bo.*;
 import org.jeecg.modules.medical.common.bo.after.response.AfterDeptDetailRequest;
 import org.jeecg.modules.medical.common.bo.after.response.AfterwardsAuditDetailResponse;
 import org.jeecg.modules.medical.common.bo.before.AuditAdvanceWarningAuditDetailResponse;
+import org.jeecg.modules.medical.common.bo.mid.request.AuditMidDetailListRequest;
 import org.jeecg.modules.medical.common.bo.mid.response.MidAuditViolateProjectStatisticsResponse;
 import org.jeecg.modules.medical.entity.AfterwardsAudit;
 import com.baomidou.mybatisplus.extension.service.IService;

+ 2 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/service/IViolationAnalysisService.java

@@ -1,6 +1,7 @@
 package org.jeecg.modules.medical.service;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.jeecg.modules.medical.common.bo.after.response.AfterDeptDetailRequest;
 import org.jeecg.modules.medical.common.bo.before.AuditAdvanceWarningAuditDetailResponse;
 import org.jeecg.modules.medical.common.bo.mid.AuditMidDetailListResponse;
 import org.jeecg.modules.medical.common.bo.mid.request.AuditMidDetailListRequest;
@@ -34,6 +35,7 @@ public interface IViolationAnalysisService {
     IPage<AuditMidDetailListResponse> loadAfterAuditPageList(AuditMidDetailListRequest request, Integer pageNo, Integer pageSize, Map<String, String[]> parameterMap);
 
     BigDecimal statisticsMidAuditTotal(AuditMidDetailListRequest request);
+    BigDecimal afterStatisticsMidAuditTotal(AfterDeptDetailRequest request);
 
     /**
      * 事中审查统计-查看明细

+ 1 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/service/impl/AfterwardsAuditServiceImpl.java

@@ -14,6 +14,7 @@ import org.jeecg.modules.medical.common.bo.*;
 import org.jeecg.modules.medical.common.bo.after.response.AfterDeptDetailRequest;
 import org.jeecg.modules.medical.common.bo.after.response.AfterwardsAuditDetailResponse;
 import org.jeecg.modules.medical.common.bo.before.AuditAdvanceWarningAuditDetailResponse;
+import org.jeecg.modules.medical.common.bo.mid.request.AuditMidDetailListRequest;
 import org.jeecg.modules.medical.common.bo.mid.response.MidAuditViolateProjectStatisticsResponse;
 import org.jeecg.modules.medical.common.enums.AfterwardsAuditStatusEnum;
 import org.jeecg.modules.medical.entity.AfterwardsAudit;

+ 5 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/service/impl/ViolationAnalysisServiceImpl.java

@@ -10,6 +10,7 @@ import org.jeecg.common.exception.JeecgBootException;
 import org.jeecg.common.system.query.QueryGenerator;
 import org.jeecg.modules.medical.common.bo.DiagnosticInfoResponse;
 import org.jeecg.modules.medical.common.bo.MedicalOrderInfoResponse;
+import org.jeecg.modules.medical.common.bo.after.response.AfterDeptDetailRequest;
 import org.jeecg.modules.medical.common.bo.after.response.AfterwardsAuditDetailResponse;
 import org.jeecg.common.util.oConvertUtils;
 import org.jeecg.modules.medical.common.bo.before.AuditAdvanceWarningAuditDetailResponse;
@@ -143,6 +144,10 @@ public class ViolationAnalysisServiceImpl implements IViolationAnalysisService {
     public BigDecimal statisticsMidAuditTotal(AuditMidDetailListRequest request) {
         return midIncidentAuditService.statisticsMidAuditTotal(request);
     }
+    @Override
+    public BigDecimal afterStatisticsMidAuditTotal(AfterDeptDetailRequest request) {
+        return afterwardsAuditService.statisticsAfterAuditTotal(request);
+    }
 
     /**
      * 事中审查统计-查看明细