Scott 2 anni fa
parent
commit
2d643f5fe0
17 ha cambiato i file con 495 aggiunte e 12 eliminazioni
  1. 3 1
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/common/bo/before/PatientInformationResponse.java
  2. 25 7
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/common/bo/mid/AuditMidDetailListResponse.java
  3. 33 0
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/common/bo/mid/request/AuditMidDetailListRequest.java
  4. 40 0
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/common/bo/mid/response/MidAuditDetailResponse.java
  5. 36 0
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/common/bo/mid/response/MidAuditDoctorInfo.java
  6. 36 0
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/common/bo/mid/response/ViolationsProjectMedicinesDetail.java
  7. 27 0
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/controller/ViolationAnalysisController.java
  8. 12 0
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/mapper/MidIncidentAuditMapper.java
  9. 3 3
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/mapper/xml/AfterwardsAuditMapper.xml
  10. 1 0
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/mapper/xml/MidIncidentAuditDetailMapper.xml
  11. 105 0
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/mapper/xml/MidIncidentAuditMapper.xml
  12. 2 0
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/service/IMidIncidentAuditDetailService.java
  13. 27 0
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/service/IMidIncidentAuditService.java
  14. 20 0
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/service/IViolationAnalysisService.java
  15. 2 0
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/service/impl/MidIncidentAuditDetailServiceImpl.java
  16. 20 0
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/service/impl/MidIncidentAuditServiceImpl.java
  17. 103 1
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/service/impl/ViolationAnalysisServiceImpl.java

+ 3 - 1
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/common/bo/before/PatientInformationResponse.java

@@ -10,7 +10,7 @@ import java.util.Date;
 /**
  * @author soft01
  * @time 2023/6/4 10:03
- * @description '这里描写类的用途'
+ * @description '患者基础信息'
  * @parentProject medical-java
  */
 @Data
@@ -39,6 +39,8 @@ public class PatientInformationResponse implements Serializable {
 
     @ApiModelProperty(value = "就诊流水号")
     private String visitSerialNumber;
+    @ApiModelProperty(value = "就诊类型")
+    private String treatmentType;
 
     @ApiModelProperty(value = "科室名称")
     private String medicalDeptName;

+ 25 - 7
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/common/bo/mid/AuditMidDetailListResponse.java

@@ -17,15 +17,17 @@ import java.util.Date;
 @Data
 @ApiModel(description = "事中-审查统计响应值")
 public class AuditMidDetailListResponse implements Serializable {
-//    @ApiModelProperty(value = "项目编码")
-//    private String projectCode;
-//
-//    @ApiModelProperty(value = "项目名称")
-//    private String projectName;
+    @ApiModelProperty(value = "项目编码")
+    private String projectCode;
+
+    @ApiModelProperty(value = "项目名称")
+    private String projectName;
 
     @ApiModelProperty(value = "事中工单id")
     private Integer id;
 
+    private Integer midIncidentAuditId;
+
     @ApiModelProperty(value = "患者编码|参保人编码")
     private String patientId;
 
@@ -35,8 +37,14 @@ public class AuditMidDetailListResponse implements Serializable {
 //    @ApiModelProperty(value = "违反规则代码")
 //    private String violationRuleCode;
 
-//    @ApiModelProperty(value = "规则管理级别")
-//    private String reminderLevel;
+    @ApiModelProperty(value = "违反规则代码")
+    private String medicalInsRuleInfoCode;
+
+    @ApiModelProperty(value = "违反规则名称")
+    private String medicalInsRuleInfoName;
+
+    @ApiModelProperty(value = "规则管理级别")
+    private String reminderLevel;
 
     @ApiModelProperty(value = "患者姓名")
     private String patientName;
@@ -50,8 +58,12 @@ public class AuditMidDetailListResponse implements Serializable {
     @ApiModelProperty(value = "科室名称")
     private String medicalDeptName;
 
+    private String medicalDeptCode;
+
     @ApiModelProperty(value = "医生名称")
     private String doctorName;
+    @ApiModelProperty(value = "医生编码")
+    private String doctorId;
 
     @ApiModelProperty(value = "提醒时间")
     private Date createTime;
@@ -80,4 +92,10 @@ public class AuditMidDetailListResponse implements Serializable {
 
     @ApiModelProperty(value = "违规名称-弹窗部分橘黄色副标题")
     private String description;
+    @ApiModelProperty(value = "是否医保")
+    private String medicalInsuranceMark;
+    @ApiModelProperty(value = "单价")
+    private BigDecimal price;
+    @ApiModelProperty(value = "数量")
+    private Integer medicalNumber;
 }

+ 33 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/common/bo/mid/request/AuditMidDetailListRequest.java

@@ -0,0 +1,33 @@
+package org.jeecg.modules.medical.common.bo.mid.request;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * @author yaowei
+ * @time 2023/10/18 16:30 星期三
+ * @description '事中审查统计请求参数'
+ * @parentProject medical-java
+ */
+@Data
+public class AuditMidDetailListRequest implements Serializable {
+
+    @ApiModelProperty(value = "项目编码/名称搜索")
+    private String projectSearch;
+    @ApiModelProperty(value = "就诊类型")
+    private String treatmentType;
+//    @ApiModelProperty(value = "违反规则编码")
+//    private String feedbackCode;
+//
+//    @ApiModelProperty(value = "医生处理意见")
+//    private String feedbackResult;
+
+    @ApiModelProperty(value = "医生名称")
+    private String doctorName;
+    @ApiModelProperty(value = "科室名称")
+    private String medicalDeptName;
+    private String startTime;
+    private String endTime;
+}

+ 40 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/common/bo/mid/response/MidAuditDetailResponse.java

@@ -0,0 +1,40 @@
+package org.jeecg.modules.medical.common.bo.mid.response;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import org.jeecg.modules.medical.common.bo.before.PatientInformationResponse;
+
+import java.io.Serializable;
+import java.util.Date;
+import java.util.List;
+import java.util.Objects;
+
+/**
+ * @author yaowei
+ * @time 2023/10/18 17:44 星期三
+ * @description '事中审查-明细查看'
+ * @parentProject medical-java
+ */
+@Data
+public class MidAuditDetailResponse implements Serializable {
+
+    @ApiModelProperty(value = "异常标题(规则处理结果)")
+    private String description;
+    @ApiModelProperty(value = "规则管理级别")
+    private String violationLevel;
+    @ApiModelProperty(value = "违反规则编码")
+    private String medicalInsRuleInfoCode;
+    @ApiModelProperty(value = "提醒时间")
+    private Date createTime;
+    @ApiModelProperty(value = "违规项目/药品明细")
+    private List<ViolationsProjectMedicinesDetail> lists;
+    @ApiModelProperty(value = "患者信息")
+    private PatientInformationResponse patientInfo;
+    @ApiModelProperty(value = "医生信息")
+    private MidAuditDoctorInfo doctorInfo;
+    @ApiModelProperty(value = "诊断信息")
+    private List<Object> diagnosticInfoList;
+
+
+
+}

+ 36 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/common/bo/mid/response/MidAuditDoctorInfo.java

@@ -0,0 +1,36 @@
+package org.jeecg.modules.medical.common.bo.mid.response;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import org.jeecgframework.poi.excel.annotation.Excel;
+
+/**
+ * @author yaowei
+ * @time 2023/10/18 18:26 星期三
+ * @description '事中审查-审查明细-医生信息'
+ * @parentProject medical-java
+ */
+@Data
+public class MidAuditDoctorInfo {
+
+
+    /**科室编码*/
+    @Excel(name = "科室编码", width = 15)
+    @ApiModelProperty(value = "科室编码")
+    private java.lang.String medicalDeptCode;
+    /**科室名称*/
+    @Excel(name = "科室名称", width = 15)
+    @ApiModelProperty(value = "科室名称")
+    private java.lang.String medicalDeptName;
+    /**医生姓名*/
+    @Excel(name = "医生姓名", width = 15)
+    @ApiModelProperty(value = "医生姓名")
+    private java.lang.String doctorName;
+    /**主诊医师编码*/
+    @Excel(name = "主诊医师编码", width = 15)
+    @ApiModelProperty(value = "主诊医师编码")
+    private java.lang.String doctorId;
+
+    @ApiModelProperty(value = "医生处理意见")
+    private String feedbackResult;
+}

+ 36 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/common/bo/mid/response/ViolationsProjectMedicinesDetail.java

@@ -0,0 +1,36 @@
+package org.jeecg.modules.medical.common.bo.mid.response;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import org.jeecgframework.poi.excel.annotation.Excel;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+
+/**
+ * @author yaowei
+ * @time 2023/10/18 18:03 星期三
+ * @description '违规项目明细'
+ * @parentProject medical-java
+ */
+@Data
+public class ViolationsProjectMedicinesDetail implements Serializable {
+
+
+    @ApiModelProperty(value = "医保项目编码(违规项目编码)")
+    private java.lang.String medicalProjectCode;
+    @ApiModelProperty(value = "医保项目名称(项目名称)")
+    private java.lang.String medicalProjectName;
+    @ApiModelProperty(value = "医保标志;0=非医保,1=是医保")
+    private java.lang.String medicalInsuranceMark; //医保标志
+    @ApiModelProperty(value = "价格;单价,必须使用数值型,如”12.5”")
+    private java.math.BigDecimal price;
+    @ApiModelProperty(value = "数量;数量,必须使用数值型,如”10”")
+    private Integer medicalNumber;
+
+    @ApiModelProperty(value = "异常-多收")
+    private BigDecimal errorRelativelyManyAmt;
+
+    @ApiModelProperty(value = "异常-少收")
+    private BigDecimal errorRelativelyFewAmt;
+}

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

@@ -6,7 +6,11 @@ import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.api.vo.Result;
 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;
+import org.jeecg.modules.medical.common.bo.mid.response.MidAuditDetailResponse;
 import org.jeecg.modules.medical.service.IViolationAnalysisService;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestParam;
@@ -27,6 +31,7 @@ import java.util.Map;
 @Slf4j
 public class ViolationAnalysisController {
 
+    @Autowired
     private IViolationAnalysisService violationAnalysisService;
 
     @ApiOperation(value="违规分析-事前提醒明细统计", notes="违规分析-事前提醒明细统计")
@@ -40,6 +45,28 @@ public class ViolationAnalysisController {
         return Result.OK(result);
     }
 
+    @ApiOperation(value="违规分析-事中审查统计", notes="违规分析-事中审查统计")
+    @GetMapping(value = "/mid/list")
+    public Result<IPage<AuditMidDetailListResponse>> loadMidAuditPageList(AuditMidDetailListRequest request,
+                                                                          @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
+                                                                          @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
+                                                                          HttpServletRequest req
+                                                                          ) {
+        Map<String, String[]> parameterMap = req.getParameterMap();
+        IPage<AuditMidDetailListResponse> result = violationAnalysisService.loadMidAuditPageList(request, pageNo, pageSize, parameterMap);
+        return Result.OK(result);
+    }
+
+    @ApiOperation(value="违规分析-事中审查统-查看详情", notes="违规分析-事中审查-查看详情")
+    @GetMapping(value = "/mid/detail")
+    public Result<MidAuditDetailResponse> midAuditDetail(@RequestParam(name = "detailId") Integer detailId) {
+        MidAuditDetailResponse reqObject = violationAnalysisService.midAuditDetail(detailId);
+        return Result.OK(reqObject);
+    }
+
+
+
+
 
 
 }

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

@@ -1,8 +1,13 @@
 package org.jeecg.modules.medical.mapper;
 
+import java.math.BigDecimal;
 import java.util.List;
 
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import org.apache.ibatis.annotations.Param;
+import org.jeecg.modules.medical.common.bo.mid.AuditMidDetailListResponse;
+import org.jeecg.modules.medical.common.bo.mid.request.AuditMidDetailListRequest;
 import org.jeecg.modules.medical.entity.MidIncidentAudit;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 
@@ -14,4 +19,11 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  */
 public interface MidIncidentAuditMapper extends BaseMapper<MidIncidentAudit> {
 
+    IPage<AuditMidDetailListResponse> loadMidAuditPageList(Page<AuditMidDetailListResponse> page, @Param("ew") AuditMidDetailListRequest ew);
+
+    AuditMidDetailListResponse loadViolationDetail(@Param("detailId") Integer detailId);
+
+    BigDecimal statissticsErrAmtByMidAuditRecordId(@Param("id") Integer id);
+
+
 }

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

@@ -63,7 +63,7 @@
                      WHEN 'diagnoses' THEN d.id
                      else 0 end as join_id,
                  case t.project_type
-                     WHEN 'medicine' THEN m.price
+                     WHEN 'medicine' THEN m.max_sale_limit
                      WHEN 'consumable' THEN c.price
                      WHEN 'diagnoses' THEN d.price
                      else 0 end as price, -- 单价
@@ -124,7 +124,7 @@
                      WHEN 'diagnoses' THEN d.id
                      else 0 end as join_id,
                  case t.project_type
-                     WHEN 'medicine' THEN m.price
+                     WHEN 'medicine' THEN m.max_sale_limit
                      WHEN 'consumable' THEN c.price
                      WHEN 'diagnoses' THEN d.price
                      else 0 end as price, -- 单价
@@ -205,7 +205,7 @@
                  WHEN 'diagnoses' THEN d.id
                  else 0 end as join_id,
              case t.project_type
-                 WHEN 'medicine' THEN m.price
+                 WHEN 'medicine' THEN m.max_sale_limit
                  WHEN 'consumable' THEN c.price
                  WHEN 'diagnoses' THEN d.price
                  else 0 end as price, -- 单价

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

@@ -15,6 +15,7 @@
             "" AS visitSerialNumber, -- 就诊流水号(从主表查询)
             ad.medical_dept_name AS medicalDeptName, -- 科室名称
             ad.medical_dept_code AS medicalDeptCode -- 科室编码
+            ,ad.treatment_type as treatmentType -- 就诊类型
         FROM mid_incident_audit as ad
                  LEFT JOIN his_patient as p on ad.patient_id = p.patient_no
         WHERE ad.id = #{id,jdbcType=INTEGER}

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

@@ -2,4 +2,109 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="org.jeecg.modules.medical.mapper.MidIncidentAuditMapper">
 
+    <select id="loadMidAuditPageList"
+            resultType="org.jeecg.modules.medical.common.bo.mid.AuditMidDetailListResponse">
+        SELECT
+            id,
+            proejct_code,
+            proejct_name
+            ,patient_id,
+            patient_name,
+            treatment_type,
+            medical_dept_name,
+            doctor_name,
+            doctor_id,
+            create_time,
+            amount
+            ,(SELECT feedback_code from mid_incident_audit WHERE id = mid_incident_audit_id) as feedback_code
+            ,(SELECT feedback_result from mid_incident_audit WHERE id = mid_incident_audit_id) as feedback_result
+            ,description
+        FROM
+            mid_incident_audit_detail
+        <where>
+            <if test="ew.projectSearch != null and ew.projectSearch != '' ">
+                AND(
+                    proejct_code LIKE concat(concat('%',#{ew.projectSearch}),'%')
+                    or
+                    proejct_name LIKE concat(concat('%',#{ew.projectSearch}),'%')
+                )
+            </if>
+            <if test="ew.treatmentType != null and ew.treatmentType != '' ">
+                AND treatment_type = #{ew.treatmentType}
+            </if>
+            <if test="ew.doctorName != null and ew.doctorName != '' ">
+                AND doctor_name LIKE concat(concat('%',#{ew.doctorName}),'%')
+            </if>
+            <if test="ew.medicalDeptName != null and ew.medicalDeptName != ''">
+                AND medical_dept_name = #{ew.medicalDeptName}
+            </if>
+            <if test="ew.startTime != null and ew.startTime != '' ">
+                AND <![CDATA[ create_time >= #{ew.startTime} ]]>
+            </if>
+            <if test="ew.endTime != null and ew.endTime != '' ">
+                AND <![CDATA[  create_time <= #{ew.endTime} ]]>
+            </if>
+        </where>
+    </select>
+
+    <select id="statissticsErrAmtByMidAuditRecordId" resultType="java.math.BigDecimal">
+        SELECT
+            sum((tdetail.amount - (tdetail.quantity * tdetail.price))) as detailTotalAmt
+        from(
+            SELECT
+                t.medical_dept_name,
+                t.doctor_id,
+                t.doctor_name
+                 , CASE t.project_type
+                       WHEN 'medicine' THEN m.id
+                       WHEN 'consumable' THEN c.id
+                       WHEN 'diagnoses' THEN d.id
+                       ELSE 0 END as join_id
+                 , CASE t.proejct_code
+                       WHEN 'medicine' THEN m.max_sale_limit
+                       WHEN 'consumable' THEN c.price
+                       WHEN 'diagnoses' THEN d.price
+                       else 0 end as price -- 单价
+                 ,t.medical_number as quantity -- 数量
+                 ,t.amount
+            from mid_incident_audit_detail as t
+                     left JOIN medicine as m on t.medical_project_code = m.medicine_code and t.project_type = 'medicine' -- 计算药品
+                     LEFT JOIN consumable_material as c on t.medical_project_code = c.consumable_code AND t.project_type = 'consumable' -- 计算耗材
+                     left JOIN diagnosis_treatment as d on t.medical_project_code = d.project_code AND t.project_type = 'diagnoses' -- 计算出诊费用
+            WHERE t.id = #{id}
+        ) as tdetail
+    </select>
+
+    <select id="loadViolationDetail"
+            resultType="org.jeecg.modules.medical.common.bo.mid.AuditMidDetailListResponse">
+        SELECT
+            id,
+            proejct_code,
+            proejct_name
+            ,patient_id,
+            patient_name,
+            treatment_type,
+            medical_dept_name
+            ,medical_dept_code
+            ,doctor_name
+            ,doctor_id,
+            create_time,
+            amount
+            ,(SELECT feedback_code from mid_incident_audit WHERE id = mid_incident_audit_id) as feedback_code
+            ,(SELECT feedback_result from mid_incident_audit WHERE id = mid_incident_audit_id) as feedback_result
+            ,description
+            ,reminder_level
+            ,medical_ins_rule_info_code
+            ,medical_ins_rule_info_name
+            ,medical_insurance_mark
+            ,price
+            ,medical_number
+            ,mid_incident_audit_id
+        FROM
+            mid_incident_audit_detail
+        <where>
+            AND id = #{detailId,jdbcType=VARCHAR}
+        </where>
+
+    </select>
 </mapper>

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

@@ -39,7 +39,9 @@ public interface IMidIncidentAuditDetailService extends IService<MidIncidentAudi
      */
     IPage<ViolationDetails> loadViolationDetails(Page<ViolationDetails> page, String id, String ruleCode);
 
+
     void updateReason(FeedbackReasonRequest request, IMidIncidentAuditService midIncidentAuditService);
 
 
+
 }

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

@@ -1,7 +1,15 @@
 package org.jeecg.modules.medical.service;
 
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+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;
 import org.jeecg.modules.medical.entity.MidIncidentAudit;
 import com.baomidou.mybatisplus.extension.service.IService;
+import org.jeecg.modules.medical.entity.MidIncidentAuditDetail;
+
+import java.math.BigDecimal;
 
 /**
  * @Description: mid_incident_audit
@@ -11,4 +19,23 @@ import com.baomidou.mybatisplus.extension.service.IService;
  */
 public interface IMidIncidentAuditService extends IService<MidIncidentAudit> {
 
+
+
+    IPage<AuditMidDetailListResponse> loadMidAuditPageList(Page<AuditMidDetailListResponse> page, AuditMidDetailListRequest request);
+
+    /**
+     * 获取一条事中审核记录
+     * @param detailId
+     * @return
+     */
+    AuditMidDetailListResponse loadViolationDetail(Integer detailId);
+
+    /**
+     * 计算异常金额
+     * @param id
+     * @return
+     */
+    BigDecimal statissticsErrAmtByMidAuditRecordId(Integer id);
+
+
 }

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

@@ -2,6 +2,9 @@ package org.jeecg.modules.medical.service;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
 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;
+import org.jeecg.modules.medical.common.bo.mid.response.MidAuditDetailResponse;
 
 import java.util.Map;
 
@@ -13,4 +16,21 @@ import java.util.Map;
  */
 public interface IViolationAnalysisService {
     IPage<AuditAdvanceWarningAuditDetailResponse> loadBeforeList(AuditAdvanceWarningAuditDetailResponse advanceWarningAuditDetail, Integer pageNo, Integer pageSize, Map<String, String[]> parameterMap);
+
+    /**
+     * 违规分析,事中审核统计
+     * @param request
+     * @param pageNo
+     * @param pageSize
+     * @param parameterMap
+     * @return
+     */
+    IPage<AuditMidDetailListResponse> loadMidAuditPageList(AuditMidDetailListRequest request, Integer pageNo, Integer pageSize, Map<String, String[]> parameterMap);
+
+    /**
+     * 事中审查统计-查看明细
+     * @param detailId
+     * @return
+     */
+    MidAuditDetailResponse midAuditDetail(Integer detailId);
 }

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

@@ -93,6 +93,8 @@ public class MidIncidentAuditDetailServiceImpl extends ServiceImpl<MidIncidentAu
         return detail;
     }
 
+
+
     @Transactional(readOnly = false)
     @Override
     public void updateReason(FeedbackReasonRequest request,  IMidIncidentAuditService midIncidentAuditService) {

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

@@ -1,5 +1,9 @@
 package org.jeecg.modules.medical.service.impl;
 
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import org.jeecg.modules.medical.common.bo.mid.AuditMidDetailListResponse;
+import org.jeecg.modules.medical.common.bo.mid.request.AuditMidDetailListRequest;
 import org.jeecg.modules.medical.entity.MidIncidentAudit;
 import org.jeecg.modules.medical.mapper.MidIncidentAuditMapper;
 import org.jeecg.modules.medical.service.IMidIncidentAuditService;
@@ -7,6 +11,8 @@ import org.springframework.stereotype.Service;
 
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 
+import java.math.BigDecimal;
+
 /**
  * @Description: mid_incident_audit
  * @Author: jeecg-boot
@@ -16,4 +22,18 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 @Service
 public class MidIncidentAuditServiceImpl extends ServiceImpl<MidIncidentAuditMapper, MidIncidentAudit> implements IMidIncidentAuditService {
 
+    @Override
+    public IPage<AuditMidDetailListResponse> loadMidAuditPageList(Page<AuditMidDetailListResponse> page, AuditMidDetailListRequest request) {
+        return baseMapper.loadMidAuditPageList(page, request);
+    }
+
+    @Override
+    public AuditMidDetailListResponse loadViolationDetail(Integer detailId) {
+        return baseMapper.loadViolationDetail(detailId);
+    }
+
+    @Override
+    public BigDecimal statissticsErrAmtByMidAuditRecordId(Integer id) {
+        return baseMapper.statissticsErrAmtByMidAuditRecordId(id);
+    }
 }

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

@@ -3,31 +3,48 @@ package org.jeecg.modules.medical.service.impl;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.exception.JeecgBootException;
 import org.jeecg.common.system.query.QueryGenerator;
 import org.jeecg.modules.medical.common.bo.before.AuditAdvanceWarningAuditDetailResponse;
+import org.jeecg.modules.medical.common.bo.before.PatientInformationResponse;
+import org.jeecg.modules.medical.common.bo.mid.AuditMidDetailListResponse;
+import org.jeecg.modules.medical.common.bo.mid.request.AuditMidDetailListRequest;
+import org.jeecg.modules.medical.common.bo.mid.response.MidAuditDetailResponse;
+import org.jeecg.modules.medical.common.bo.mid.response.MidAuditDoctorInfo;
+import org.jeecg.modules.medical.common.bo.mid.response.ViolationsProjectMedicinesDetail;
 import org.jeecg.modules.medical.entity.AdvanceWarningAuditDetail;
 import org.jeecg.modules.medical.service.IAdvanceWarningAuditDetailService;
+import org.jeecg.modules.medical.service.IMidIncidentAuditDetailService;
+import org.jeecg.modules.medical.service.IMidIncidentAuditService;
 import org.jeecg.modules.medical.service.IViolationAnalysisService;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.util.CollectionUtils;
 
+import java.math.BigDecimal;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
+import java.util.stream.Collectors;
 
 /**
  * @author yaowei
  * @time 2023/10/18 15:23 星期三
- * @description '这里写类描述'
+ * @description '违规分析'
  * @parentProject medical-java
  */
+@Slf4j
 @Service
 public class ViolationAnalysisServiceImpl implements IViolationAnalysisService {
 
     @Autowired
     private IAdvanceWarningAuditDetailService advanceWarningAuditDetailService;
+    @Autowired // 事中主要服务
+    private IMidIncidentAuditService midIncidentAuditService;
+    @Autowired // 事中审查详情服务
+    private IMidIncidentAuditDetailService midIncidentAuditDetailService;
 
     @Override
     public IPage<AuditAdvanceWarningAuditDetailResponse> loadBeforeList(AuditAdvanceWarningAuditDetailResponse advanceWarningAuditDetail, Integer pageNo, Integer pageSize, Map<String, String[]> parameterMap) {
@@ -51,4 +68,89 @@ public class ViolationAnalysisServiceImpl implements IViolationAnalysisService {
         }
         return resultPage;
     }
+
+    /**
+     * 事中审查统计
+     * @param request
+     * @param pageNo
+     * @param pageSize
+     * @param parameterMap
+     * @return
+     */
+    @Override
+    public IPage<AuditMidDetailListResponse> loadMidAuditPageList(AuditMidDetailListRequest request, Integer pageNo, Integer pageSize, Map<String, String[]> parameterMap) {
+        Page<AuditMidDetailListResponse> page = new Page<>(pageNo, pageSize);
+        IPage<AuditMidDetailListResponse> resultPage = midIncidentAuditService.loadMidAuditPageList(page, request);
+        List<AuditMidDetailListResponse> records = resultPage.getRecords();
+        records.stream().map(item -> {
+            BigDecimal detailTotalAmt = midIncidentAuditService.statissticsErrAmtByMidAuditRecordId(item.getId());
+            item.setErrorRelativelyFewAmt(new BigDecimal("0.00"));
+            item.setErrorRelativelyManyAmt(new BigDecimal("0.00"));
+            if (null != detailTotalAmt) {
+                if (detailTotalAmt.compareTo(BigDecimal.ZERO) > 0) { // 异常金额大于0,就是多收
+                    item.setErrorRelativelyManyAmt(detailTotalAmt);
+                } else if (detailTotalAmt.compareTo(BigDecimal.ZERO) < 0) {
+                    item.setErrorRelativelyFewAmt(detailTotalAmt);
+                }
+            }
+            return item;
+        }).collect(Collectors.toList());
+        return resultPage;
+    }
+
+    /**
+     * 事中审查统计-查看明细
+     * @param detailId: 详情ID
+     * @return
+     */
+    @Override
+    public MidAuditDetailResponse midAuditDetail(Integer detailId) {
+        MidAuditDetailResponse result = new MidAuditDetailResponse();
+
+        AuditMidDetailListResponse detailInfo = midIncidentAuditService.loadViolationDetail(detailId);
+        if (detailInfo == null) {
+            log.error("找不到审查记录");
+            throw new JeecgBootException("找不到审查记录");
+        }
+        result.setDescription(detailInfo.getDescription());
+        result.setViolationLevel(detailInfo.getReminderLevel());
+        result.setMedicalInsRuleInfoCode(detailInfo.getMedicalInsRuleInfoCode());
+        // 构建违规项目/药品明细
+        ViolationsProjectMedicinesDetail v = new ViolationsProjectMedicinesDetail();
+        v.setMedicalProjectCode(detailInfo.getMedicalInsRuleInfoCode());
+        v.setMedicalProjectName(detailInfo.getMedicalInsRuleInfoName());
+        v.setMedicalInsuranceMark(detailInfo.getMedicalInsuranceMark());
+        v.setPrice(detailInfo.getPrice());
+        v.setMedicalNumber(detailInfo.getMedicalNumber());
+        // 处理异常多收,少收
+        BigDecimal detailTotalAmt = midIncidentAuditService.statissticsErrAmtByMidAuditRecordId(detailId);
+        v.setErrorRelativelyFewAmt(new BigDecimal("0.00"));
+        v.setErrorRelativelyManyAmt(new BigDecimal("0.00"));
+        if (null != detailTotalAmt) {
+            if (detailTotalAmt.compareTo(BigDecimal.ZERO) > 0) { // 异常金额大于0,就是多收
+                v.setErrorRelativelyManyAmt(detailTotalAmt);
+            } else if (detailTotalAmt.compareTo(BigDecimal.ZERO) < 0) {
+                v.setErrorRelativelyFewAmt(detailTotalAmt);
+            }
+        }
+        List<ViolationsProjectMedicinesDetail> violationsProjectMedicinesDetails = new ArrayList<>();
+        violationsProjectMedicinesDetails.add(v);
+        result.setLists(violationsProjectMedicinesDetails);
+        // 构建患者信息
+        PatientInformationResponse patientInformationResponse =
+                midIncidentAuditDetailService.loadPatientInfoById(detailInfo.getMidIncidentAuditId().toString(), midIncidentAuditService);
+        result.setPatientInfo(patientInformationResponse);
+        // 构建医生信息
+        MidAuditDoctorInfo midAuditDoctorInfo = new MidAuditDoctorInfo();
+        midAuditDoctorInfo.setMedicalDeptCode(detailInfo.getMedicalDeptCode());
+        midAuditDoctorInfo.setMedicalDeptName(detailInfo.getMedicalDeptName());
+        midAuditDoctorInfo.setDoctorId(detailInfo.getDoctorId());
+        midAuditDoctorInfo.setDoctorName(detailInfo.getDoctorName());
+        midAuditDoctorInfo.setFeedbackResult(detailInfo.getFeedbackResult());
+        result.setDoctorInfo(midAuditDoctorInfo);
+        // 构建诊断信息
+
+
+        return result;
+    }
 }