Selaa lähdekoodia

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/service/impl/ViolationAnalysisServiceImpl.java
Scott 1 vuosi sitten
vanhempi
säilyke
63d95ca221

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

@@ -19,6 +19,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 public interface AfterwardsAuditDetailMapper extends BaseMapper<AfterwardsAuditDetail> {
 
     PatientInformationResponse loadPatientInfoById(@Param("id") Integer id);
+    PatientInformationResponse beforeLoadPatientInfoById(@Param("id") Integer id);
 
     IPage<MidAuditViolateProjectStatisticsResponse> afterViolateProjectStatisticsList(IPage<AuditAdvanceWarningAuditDetailResponse> page, @Param("projectCode")  String projectCode,
                                                                                       @Param("medicalProjectSearch")String medicalProjectSearch,@Param("startTime") String startTime,@Param("endTime") String endTime);

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

@@ -177,7 +177,7 @@
             hd.use_day as useDay
         FROM
             ${tableName} AS hd
-        <where>
+        <where> 1=1
             <if test="patientId != null and patientId != ''">
                 AND hd.patient_id = #{patientId}
             </if>

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

@@ -20,6 +20,24 @@
                  LEFT JOIN his_patient as p on ad.patient_id = p.patient_no
         WHERE ad.id = #{id,jdbcType=INTEGER}
     </select>
+    <select id="beforeLoadPatientInfoById"
+            resultType="org.jeecg.modules.medical.common.bo.before.PatientInformationResponse">
+        SELECT
+            ad.patient_id AS patientId, -- 患者编码
+            p.patient_name AS patientName, -- 患者姓名
+            p.gender AS gender, -- 性别
+            p.birthday AS birthday, -- 生日
+            "" AS age, -- 年龄
+            "" AS medicalInsurance, -- 是否医保(从主表查询)
+            ad.visit_time AS visitDate, -- 就诊日期
+            "" AS visitSerialNumber, -- 就诊流水号(从主表查询)
+            ad.medical_dept_name AS medicalDeptName, -- 科室名称
+            ad.medical_dept_code AS medicalDeptCode -- 科室编码
+                ,ad.treatment_type as treatmentType -- 就诊类型
+        FROM advance_warning_audit as ad
+                 LEFT JOIN his_patient as p on ad.patient_id = p.patient_no
+        WHERE ad.id = #{id,jdbcType=INTEGER}
+    </select>
 
     <select id="afterViolateProjectStatisticsList"
             resultType="org.jeecg.modules.medical.common.bo.mid.response.MidAuditViolateProjectStatisticsResponse">

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

@@ -74,7 +74,7 @@
              ,create_time
              ,description
         from afterwards_audit_detail
-        <where>
+        <where> 1=1
             <if test="ew.medicalProjectSearch != null and ew.medicalProjectSearch != '' ">
                 AND ( medical_project_code LIKE concat(concat('%',#{ew.medicalProjectSearch}),'%') or medical_project_name LIKE concat(concat('%',#{ew.medicalProjectSearch}),'%') )
             </if>

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

@@ -20,7 +20,7 @@
         FROM
             sys_dict_item item
                 INNER JOIN sys_dict dict ON dict.id = item.dict_id
-        <where>
+        <where> 1=1
             AND item.item_value IN
             <foreach collection="fieldList" open="(" separator="," close=")" item="field">
                 #{field,jdbcType=VARCHAR}

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

@@ -63,7 +63,7 @@
             md.amount as abnormalAmount -- 异常金额
         FROM
             mid_incident_audit_detail as md
-        <where>
+        <where> 1=1
             and md.mid_incident_audit_id = #{id,jdbcType=INTEGER}
             and md.medical_ins_rule_info_code = #{ruleCode,jdbcType=VARCHAR}
         </where>
@@ -82,7 +82,7 @@
              ,(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
-        <where>
+        <where> 1=1
             <if test="deptName != null and deptName != ''">
                 AND m.medical_dept_name like LIKE concat(concat('%',#{deptName}),'%')
             </if>
@@ -110,7 +110,7 @@
         ,(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
-        <where>
+        <where> 1=1
             <if test="deptName != null and deptName != ''">
                 AND m.medical_dept_name like LIKE concat(concat('%',#{deptName}),'%')
             </if>
@@ -136,7 +136,7 @@
              ,(select IFNULL(count(amount), 0) from mid_incident_audit_detail WHERE medical_project_code = m.medical_project_code ) as violationTotal  -- 违规总数
              ,sum(amount) as errorAmountTotal -- 异常金额总和
         FROM mid_incident_audit_detail as m
-        <where>
+        <where> 1=1
             <if test="projectSearch != null and projectSearch != '' ">
                 AND(
                     proejct_code LIKE concat(concat('%',#{projectSearch}),'%')
@@ -166,7 +166,7 @@
              ,(select IFNULL(count(amount), 0) from mid_incident_audit_detail WHERE medical_ins_rule_info_code = m.medical_ins_rule_info_code ) as violationTotal  -- 违规总数
              ,sum(amount) as errorAmountTotal -- 异常金额总和
         FROM mid_incident_audit_detail as m
-        <where>
+        <where> 1=1
             <if test="medicalInsRuleInfoName != null and medicalInsRuleInfoName != ''">
                 AND medical_ins_rule_info_name = #{medicalInsRuleInfoName}
             </if>
@@ -195,7 +195,7 @@
         ,(select IFNULL(count(amount), 0) from mid_incident_audit_detail WHERE medical_ins_rule_info_code = m.medical_ins_rule_info_code ) as violationTotal  -- 违规总数
         ,sum(amount) as errorAmountTotal -- 异常金额总和
         FROM afterwards_audit_detail as m
-        <where>
+        <where> 1=1
             <if test="medicalInsRuleInfoName != null and medicalInsRuleInfoName != ''">
                 AND medical_ins_rule_info_name = #{medicalInsRuleInfoName}
             </if>

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

@@ -23,7 +23,7 @@
             ,description
         FROM
             mid_incident_audit_detail
-        <where>
+        <where> 1=1
             <if test="ew.projectSearch != null and ew.projectSearch != '' ">
                 AND(
                     proejct_code LIKE concat(concat('%',#{ew.projectSearch}),'%')
@@ -78,7 +78,7 @@
         ,description
         FROM
         afterwards_audit_detail
-        <where>
+        <where> 1=1
             <if test="ew.projectSearch != null and ew.projectSearch != '' ">
                 AND(
                 proejct_code LIKE concat(concat('%',#{ew.projectSearch}),'%')
@@ -115,7 +115,7 @@
             ifnull(sum(amount), 0) as totalAmount
         FROM
         mid_incident_audit_detail
-        <where>
+        <where> 1=1
             <if test="ew.projectSearch != null and ew.projectSearch != '' ">
                 AND(
                 proejct_code LIKE concat(concat('%',#{ew.projectSearch}),'%')
@@ -132,6 +132,9 @@
             <if test="ew.medicalDeptName != null and ew.medicalDeptName != ''">
                 AND medical_dept_name = #{ew.medicalDeptName}
             </if>
+            <if test="ew.medicalDeptCode != null and ew.medicalDeptCode != ''">
+                AND medical_dept_code = #{ew.medicalDeptCode}
+            </if>
             <if test="ew.startTime != null and ew.startTime != '' ">
                 AND <![CDATA[ create_time >= #{ew.startTime} ]]>
             </if>
@@ -201,7 +204,7 @@
         mid_incident_audit_detail AS mid
         LEFT JOIN mid_incident_audit AS mia ON mid.mid_incident_audit_id = mia.id
 
-        <where>
+        <where> 1=1
             AND mid.id = #{detailId,jdbcType=VARCHAR}
         </where>
 

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

@@ -25,6 +25,7 @@ public interface IAfterwardsAuditDetailService extends IService<AfterwardsAuditD
      * @return
      */
     PatientInformationResponse loadPatientInfoById(Integer afterwardsAuditId, IAfterwardsAuditService afterwardsAuditService);
+    PatientInformationResponse beforeLoadPatientInfoById(Integer auditId, IAdvanceWarningAuditService afterwardsAuditService);
 
     IPage<MidAuditViolateProjectStatisticsResponse> afterViolateProjectStatisticsList(IPage<AuditAdvanceWarningAuditDetailResponse> page, String projectCode, String medicalProjectSearch, String startTime, String endTime);
 }

+ 46 - 4
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/service/impl/AfterwardsAuditDetailServiceImpl.java

@@ -10,14 +10,14 @@ import org.jeecg.modules.medical.common.bo.after.response.AfterwardsAuditDetailR
 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.response.MidAuditViolateProjectStatisticsResponse;
-import org.jeecg.modules.medical.entity.AfterwardsAudit;
-import org.jeecg.modules.medical.entity.AfterwardsAuditDetail;
-import org.jeecg.modules.medical.entity.MidIncidentAudit;
-import org.jeecg.modules.medical.entity.MidIncidentAuditDetail;
+import org.jeecg.modules.medical.entity.*;
 import org.jeecg.modules.medical.mapper.AfterwardsAuditDetailMapper;
+import org.jeecg.modules.medical.service.IAdvanceWarningAuditDetailService;
+import org.jeecg.modules.medical.service.IAdvanceWarningAuditService;
 import org.jeecg.modules.medical.service.IAfterwardsAuditDetailService;
 import org.jeecg.modules.medical.service.IAfterwardsAuditService;
 import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -40,6 +40,11 @@ import java.util.List;
 @Service
 public class AfterwardsAuditDetailServiceImpl extends ServiceImpl<AfterwardsAuditDetailMapper, AfterwardsAuditDetail> implements IAfterwardsAuditDetailService {
 
+    @Autowired
+    private IAdvanceWarningAuditService advanceWarningAuditService;
+    @Autowired
+
+    private IAdvanceWarningAuditDetailService advanceWarningAuditDetailService;
     @Override
     public AfterwardsAuditDetailResponse afterAllDetail(Integer detailId) {
         AfterwardsAuditDetail one = getById(detailId);
@@ -80,6 +85,38 @@ public class AfterwardsAuditDetailServiceImpl extends ServiceImpl<AfterwardsAudi
         return result;
     }
 
+    @Override
+    public PatientInformationResponse beforeLoadPatientInfoById(Integer auditId, IAdvanceWarningAuditService advanceWarningAuditService) {
+        AdvanceWarningAudit afterwardsAudit = advanceWarningAuditService.getById(auditId);
+        if (afterwardsAudit == null) {
+            log.error("找不到事前工单id={}", auditId);
+            throw new JeecgBootException("找不到工单id");
+        }
+        PatientInformationResponse result = baseMapper.beforeLoadPatientInfoById(auditId);
+        if (null != result) {
+            //查一次就诊流水号
+            List<AdvanceWarningAuditDetail> detailList = beforeLoadDetailList(auditId);//baseMapper.loadAdvanceWarningAuditDetail(id);
+            if (!CollectionUtils.isEmpty(detailList)) {
+                AdvanceWarningAuditDetail advanceWarningAuditDetail = detailList.get(0);
+                String outpatientNumber = advanceWarningAuditDetail.getOutpatientNumber();
+                result.setVisitSerialNumber(outpatientNumber);
+                result.setMedicalInsurance(advanceWarningAuditDetail.getMedicalInsuranceMark());
+            }
+            //计算患者年龄
+            Date birthday = result.getBirthday();
+            if (null != birthday) {
+
+                Instant instant = birthday.toInstant();
+                LocalDate usageLocalDate = instant.atZone(ZoneId.systemDefault()).toLocalDate();
+                LocalDate now = LocalDate.now();
+                // 获取两个日期天数相差
+                long until = usageLocalDate.until(now, ChronoUnit.YEARS) + 1;
+                result.setAge(String.valueOf(until));
+            }
+        }
+        return result;
+    }
+
     @Override
     public IPage<MidAuditViolateProjectStatisticsResponse> afterViolateProjectStatisticsList(IPage<AuditAdvanceWarningAuditDetailResponse> page, String projectCode, String medicalProjectSearch, String startTime, String endTime) {
         return baseMapper.afterViolateProjectStatisticsList(page, projectCode, medicalProjectSearch, startTime, endTime);
@@ -90,4 +127,9 @@ public class AfterwardsAuditDetailServiceImpl extends ServiceImpl<AfterwardsAudi
                 .eq(AfterwardsAuditDetail::getAfterwardsAuditId, id);
         return this.list(queryWrapper);
     }
+    private List<AdvanceWarningAuditDetail> beforeLoadDetailList(Integer id) {
+        LambdaQueryWrapper<AdvanceWarningAuditDetail> queryWrapper = Wrappers.<AdvanceWarningAuditDetail>lambdaQuery()
+                .eq(AdvanceWarningAuditDetail::getAdvanceWarningAuditId, id);
+        return advanceWarningAuditDetailService.list(queryWrapper);
+    }
 }