Преглед на файлове

添加事中弹窗的相关接口

Scott преди 2 години
родител
ревизия
478094e16d
променени са 14 файла, в които са добавени 178 реда и са изтрити 14 реда
  1. 6 0
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/common/bo/before/MedicalHistoryRecord.java
  2. 2 2
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/common/bo/before/PatientInformationResponse.java
  3. 7 4
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/controller/AdvanceWarningAuditController.java
  4. 8 1
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/controller/MidIncidentAuditDetailController.java
  5. 4 0
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/entity/AdvanceWarningAuditDetail.java
  6. 5 0
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/mapper/MidIncidentAuditDetailMapper.java
  7. 2 2
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/mapper/xml/AdvanceWarningAuditMapper.xml
  8. 19 0
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/mapper/xml/MidIncidentAuditDetailMapper.xml
  9. 10 0
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/service/IAdvanceWarningAuditDetailService.java
  10. 2 2
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/service/IAdvanceWarningAuditService.java
  11. 11 0
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/service/IMidIncidentAuditDetailService.java
  12. 17 0
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/service/impl/AdvanceWarningAuditDetailServiceImpl.java
  13. 37 3
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/service/impl/AdvanceWarningAuditServiceImpl.java
  14. 48 0
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/service/impl/MidIncidentAuditDetailServiceImpl.java

+ 6 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/common/bo/before/MedicalHistoryRecord.java

@@ -50,4 +50,10 @@ public class MedicalHistoryRecord implements Serializable {
 
     @ApiModelProperty(value = "个人支付金额")
     private BigDecimal personalPayAmt;
+
+    // 异常提示的标题头信息
+    @ApiModelProperty(value = "违规-标题-规则名称")
+    private String ruleName;
+    @ApiModelProperty(value = "违规-副标题-处理结果")
+    private String description;
 }

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

@@ -22,7 +22,7 @@ public class PatientInformationResponse implements Serializable {
     @ApiModelProperty(value = "患者姓名")
     private String patientName;
 
-    @ApiModelProperty(value = "性别")
+    @ApiModelProperty(value = "性别;0=未说明,1=男,2=女,3=未知")
     private String gender;
 
     @ApiModelProperty(value = "生日")
@@ -31,7 +31,7 @@ public class PatientInformationResponse implements Serializable {
     @ApiModelProperty(value = "年龄")
     private String age;
 
-    @ApiModelProperty(value = "是否医保")
+    @ApiModelProperty(value = "是否医保;0=非医保,1=是医保")
     private String medicalInsurance;
 
     @ApiModelProperty(value = "就诊日期")

+ 7 - 4
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/controller/AdvanceWarningAuditController.java

@@ -11,6 +11,7 @@ import org.jeecg.modules.medical.common.bo.before.PatientDiagnosisInfo;
 import org.jeecg.modules.medical.common.bo.before.PatientInformationResponse;
 import org.jeecg.modules.medical.common.bo.before.PrescriptionDetail;
 import org.jeecg.modules.medical.entity.AdvanceWarningAudit;
+import org.jeecg.modules.medical.service.IAdvanceWarningAuditDetailService;
 import org.jeecg.modules.medical.service.IAdvanceWarningAuditService;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -39,13 +40,15 @@ import org.jeecg.common.aspect.annotation.AutoLog;
 public class AdvanceWarningAuditController extends JeecgController<AdvanceWarningAudit, IAdvanceWarningAuditService> {
 	@Autowired
 	private IAdvanceWarningAuditService advanceWarningAuditService;
+	@Autowired
+	private IAdvanceWarningAuditDetailService iAdvanceWarningAuditDetailService;
 
 
 	 @ApiOperation(value = "事前工单-根据事前工单查询患者信息", notes = "根据事前工单查询患者信息")
 	 @GetMapping(value = "/patient/info")
 	 public Result<PatientInformationResponse> loadPatientInfoById(@RequestParam(name = "id", required = true) String id) {
 		 PatientInformationResponse patientInfoResponse = advanceWarningAuditService
-				 .loadPatientInfoById(id);
+				 .loadPatientInfoById(id, iAdvanceWarningAuditDetailService);
 		 return Result.OK(patientInfoResponse);
 	 }
 
@@ -53,14 +56,14 @@ public class AdvanceWarningAuditController extends JeecgController<AdvanceWarnin
 	 @GetMapping(value = "/patient/medicalHistory")
 	 public Result<IPage<MedicalHistoryRecord>> queryMedicalHistoryRecords(
 			 @RequestParam(name = "id", required = true) String id,
-			 @RequestParam(name = "pageNum", defaultValue = "1") Integer pageNum,
+			 @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
 			 @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
 		 if (pageSize > 100) {
 			 pageSize = 100;
 		 }
-		 Page<MedicalHistoryRecord> page = new Page<>(pageNum, pageSize);
+		 Page<MedicalHistoryRecord> page = new Page<>(pageNo, pageSize);
 		 IPage<MedicalHistoryRecord> medicalHistoryRecords = advanceWarningAuditService
-				 .queryMedicalHistoryRecords(page, id);
+				 .queryMedicalHistoryRecords(page, id, iAdvanceWarningAuditDetailService);
 		 return Result.OK("查询成功", medicalHistoryRecords);
 	 }
 

+ 8 - 1
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/controller/MidIncidentAuditDetailController.java

@@ -8,6 +8,7 @@ import javax.validation.Valid;
 
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.system.query.QueryGenerator;
+import org.jeecg.modules.medical.common.bo.before.PatientInformationResponse;
 import org.jeecg.modules.medical.common.bo.mid.FeedbackReasonRequest;
 import org.jeecg.modules.medical.common.bo.mid.ViolationDetails;
 import org.jeecg.modules.medical.common.bo.mid.ViolationInfo;
@@ -46,7 +47,13 @@ public class MidIncidentAuditDetailController extends JeecgController<MidInciden
 	private IMidIncidentAuditService midIncidentAuditService;
 
 
-	// 获取患者信息 、、同事前一样的接口,使用同一个
+	 @ApiOperation(value = "事中工单-根据事前工单查询患者信息", notes = "根据事中工单查询患者信息")
+	 @GetMapping(value = "/patient/info")
+	 public Result<PatientInformationResponse> loadPatientInfoById(@RequestParam(name = "id", required = true) String id) {
+		 PatientInformationResponse patientInfoResponse = midIncidentAuditDetailService
+				 .loadPatientInfoById(id, midIncidentAuditService);
+		 return Result.OK(patientInfoResponse);
+	 }
 
 	 /**
 	  * 根据始终推送的工单id,查询违规信息

+ 4 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/entity/AdvanceWarningAuditDetail.java

@@ -52,6 +52,10 @@ public class AdvanceWarningAuditDetail implements Serializable {
 	@Excel(name = "医保规则名称", width = 15)
     @ApiModelProperty(value = "医保规则名称")
     private java.lang.String medicalInsRuleInfoName;
+    /**医保标志: 0:不是医保, 1:是医保*/
+    @Excel(name = "医保标志", width = 15)
+    @ApiModelProperty(value = "医保标志")
+    private java.lang.String medicalInsuranceMark; //医保标志
 	/**就诊类别;住院/门诊*/
 	@Excel(name = "就诊类别;住院/门诊", width = 15)
     @ApiModelProperty(value = "就诊类别;住院/门诊")

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

@@ -5,6 +5,7 @@ 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.before.PatientInformationResponse;
 import org.jeecg.modules.medical.common.bo.mid.ViolationDetails;
 import org.jeecg.modules.medical.common.bo.mid.ViolationInfo;
 import org.jeecg.modules.medical.entity.MidIncidentAuditDetail;
@@ -18,7 +19,11 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  */
 public interface MidIncidentAuditDetailMapper extends BaseMapper<MidIncidentAuditDetail> {
 
+    PatientInformationResponse loadPatientInfoById(@Param("id") String id);
+
     List<ViolationInfo> loadViolationInfoList(@Param("id") Integer id);
 
     IPage<ViolationDetails> loadViolationDetails(Page<ViolationDetails> page, @Param("id") String id, @Param("ruleCode") String ruleCode);
+
+
 }

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

@@ -10,9 +10,9 @@
             p.gender AS gender, -- 性别
             p.birthday AS birthday, -- 生日
             "" AS age, -- 年龄
-            "" AS medicalInsurance, -- 是否医保
+            "" AS medicalInsurance, -- 是否医保(从主表查询)
             ad.visit_time AS visitDate, -- 就诊日期
-            "" AS visitSerialNumber, -- 就诊流水号
+            "" AS visitSerialNumber, -- 就诊流水号(从主表查询)
             ad.medical_dept_name AS medicalDeptName, -- 科室名称
             ad.medical_dept_code AS medicalDeptCode -- 科室编码
         FROM advance_warning_audit as ad

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

@@ -2,6 +2,24 @@
 <!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.MidIncidentAuditDetailMapper">
 
+    <select id="loadPatientInfoById"
+            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 -- 科室编码
+        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}
+    </select>
+
     <select id="loadViolationInfoList" resultType="org.jeecg.modules.medical.common.bo.mid.ViolationInfo">
         SELECT
             any_value(medical_ins_rule_info_code) as ruleCode, -- "规则编码",
@@ -32,4 +50,5 @@
             and md.medical_ins_rule_info_code = #{ruleCode,jdbcType=VARCHAR}
         </where>
     </select>
+
 </mapper>

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

@@ -3,6 +3,8 @@ package org.jeecg.modules.medical.service;
 import org.jeecg.modules.medical.entity.AdvanceWarningAuditDetail;
 import com.baomidou.mybatisplus.extension.service.IService;
 
+import java.util.List;
+
 /**
  * @Description: advance_warning_audit_detail
  * @Author: jeecg-boot
@@ -11,4 +13,12 @@ import com.baomidou.mybatisplus.extension.service.IService;
  */
 public interface IAdvanceWarningAuditDetailService extends IService<AdvanceWarningAuditDetail> {
 
+    /**
+     * 获取事前工单详细信息
+     * @param id
+     * @return
+     */
+    List<AdvanceWarningAuditDetail> loadAdvanceWarningAuditDetail(String id);
+
+    List<AdvanceWarningAuditDetail> detailList(String id);
 }

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

@@ -19,7 +19,7 @@ import java.util.List;
  */
 public interface IAdvanceWarningAuditService extends IService<AdvanceWarningAudit> {
 
-    PatientInformationResponse loadPatientInfoById(String id);
+    PatientInformationResponse loadPatientInfoById(String id, IAdvanceWarningAuditDetailService iAdvanceWarningAuditDetailService);
 
     /**
      * 根据事前工单id,查询患者历史记录
@@ -27,7 +27,7 @@ public interface IAdvanceWarningAuditService extends IService<AdvanceWarningAudi
      * @param id    工单id
      * @return
      */
-    IPage<MedicalHistoryRecord> queryMedicalHistoryRecords(Page<MedicalHistoryRecord> page, String id);
+    IPage<MedicalHistoryRecord> queryMedicalHistoryRecords(Page<MedicalHistoryRecord> page, String id, IAdvanceWarningAuditDetailService iAdvanceWarningAuditDetailService);
 
     /**
      * 根据住院、结算id查询患者诊断信息

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

@@ -2,6 +2,7 @@ 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.PatientInformationResponse;
 import org.jeecg.modules.medical.common.bo.mid.FeedbackReasonRequest;
 import org.jeecg.modules.medical.common.bo.mid.ViolationDetails;
 import org.jeecg.modules.medical.common.bo.mid.ViolationInfo;
@@ -21,6 +22,14 @@ public interface IMidIncidentAuditDetailService extends IService<MidIncidentAudi
     List<ViolationInfo> loadViolationInfoList(Integer id);
 
 
+    /**
+     * 获取患者基础信息
+     * @param id
+     * @param midIncidentAuditService
+     * @return
+     */
+    PatientInformationResponse loadPatientInfoById(String id, IMidIncidentAuditService midIncidentAuditService);
+
     /**
      * 根据事中工单id获取违规明细
      * @param page
@@ -31,4 +40,6 @@ public interface IMidIncidentAuditDetailService extends IService<MidIncidentAudi
     IPage<ViolationDetails> loadViolationDetails(Page<ViolationDetails> page, String id, String ruleCode);
 
     void updateReason(FeedbackReasonRequest request, IMidIncidentAuditService midIncidentAuditService);
+
+
 }

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

@@ -1,5 +1,7 @@
 package org.jeecg.modules.medical.service.impl;
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import org.jeecg.modules.medical.entity.AdvanceWarningAuditDetail;
 import org.jeecg.modules.medical.mapper.AdvanceWarningAuditDetailMapper;
 import org.jeecg.modules.medical.service.IAdvanceWarningAuditDetailService;
@@ -7,6 +9,8 @@ import org.springframework.stereotype.Service;
 
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 
+import java.util.List;
+
 /**
  * @Description: advance_warning_audit_detail
  * @Author: jeecg-boot
@@ -16,4 +20,17 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 @Service
 public class AdvanceWarningAuditDetailServiceImpl extends ServiceImpl<AdvanceWarningAuditDetailMapper, AdvanceWarningAuditDetail> implements IAdvanceWarningAuditDetailService {
 
+    @Override
+    public List<AdvanceWarningAuditDetail> loadAdvanceWarningAuditDetail(String id) {
+        LambdaQueryWrapper<AdvanceWarningAuditDetail> queryWrapper = Wrappers.<AdvanceWarningAuditDetail>lambdaQuery()
+                .eq(AdvanceWarningAuditDetail::getAdvanceWarningAuditId, id);
+        return list(queryWrapper);
+    }
+
+    @Override
+    public List<AdvanceWarningAuditDetail> detailList(String id) {
+        LambdaQueryWrapper<AdvanceWarningAuditDetail> queryWrapper = Wrappers.<AdvanceWarningAuditDetail>lambdaQuery()
+                .eq(AdvanceWarningAuditDetail::getAdvanceWarningAuditId, id);
+        return list(queryWrapper);
+    }
 }

+ 37 - 3
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/service/impl/AdvanceWarningAuditServiceImpl.java

@@ -6,7 +6,9 @@ import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.exception.JeecgBootException;
 import org.jeecg.modules.medical.common.bo.before.*;
 import org.jeecg.modules.medical.entity.AdvanceWarningAudit;
+import org.jeecg.modules.medical.entity.AdvanceWarningAuditDetail;
 import org.jeecg.modules.medical.mapper.AdvanceWarningAuditMapper;
+import org.jeecg.modules.medical.service.IAdvanceWarningAuditDetailService;
 import org.jeecg.modules.medical.service.IAdvanceWarningAuditService;
 import org.springframework.stereotype.Service;
 
@@ -31,22 +33,44 @@ import java.util.List;
  */
 @Service
 @Slf4j
-public class AdvanceWarningAuditServiceImpl extends ServiceImpl<AdvanceWarningAuditMapper, AdvanceWarningAudit> implements IAdvanceWarningAuditService {
+public class AdvanceWarningAuditServiceImpl extends ServiceImpl<AdvanceWarningAuditMapper, AdvanceWarningAudit>
+        implements IAdvanceWarningAuditService {
 
 
     @Override
-    public PatientInformationResponse loadPatientInfoById(String id) {
+    public PatientInformationResponse loadPatientInfoById(String id, IAdvanceWarningAuditDetailService iAdvanceWarningAuditDetailService) {
         AdvanceWarningAudit advanceWarningAudit = this.getById(id);
         if (advanceWarningAudit == null) {
             log.error("找不到事前工单id={}", id);
             throw new JeecgBootException("找不到工单id");
         }
         PatientInformationResponse result = baseMapper.loadPatientInfoById(id);
+        if (null != result) {
+            //查一次就诊流水号
+            List<AdvanceWarningAuditDetail> detailList = iAdvanceWarningAuditDetailService.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<MedicalHistoryRecord> queryMedicalHistoryRecords(Page<MedicalHistoryRecord> page, String id) {
+    public IPage<MedicalHistoryRecord> queryMedicalHistoryRecords(Page<MedicalHistoryRecord> page, String id, IAdvanceWarningAuditDetailService iAdvanceWarningAuditDetailService) {
         // 先查询主单,获取到患者信息
         AdvanceWarningAudit advanceWarningAudit = this.getById(id);
         if (advanceWarningAudit == null) {
@@ -65,6 +89,12 @@ public class AdvanceWarningAuditServiceImpl extends ServiceImpl<AdvanceWarningAu
         DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
         String startTime = localDateTime.format(dateTimeFormatter);
 
+        AdvanceWarningAuditDetail advanceWarningAuditDetail = null;
+        //查询详情中的标题信息
+        List<AdvanceWarningAuditDetail> detailList = iAdvanceWarningAuditDetailService.detailList(id);
+        if (!CollectionUtils.isEmpty(detailList)) {
+            advanceWarningAuditDetail = detailList.get(0);
+        }
 
         IPage<MedicalHistoryRecord> result = baseMapper.queryMedicalHistoryRecords(page, patientId, startTime);
         // 查询子表,获取总费用,医保费用,以及个人费用
@@ -87,6 +117,10 @@ public class AdvanceWarningAuditServiceImpl extends ServiceImpl<AdvanceWarningAu
                     record.setFundPayAmount(mr.getFundPayAmount());
                     record.setPersonalPayAmt(mr.getPersonalPayAmt());
                 }
+                if (advanceWarningAuditDetail != null) {
+                    record.setRuleName(advanceWarningAuditDetail.getMedicalInsRuleInfoName());
+                    record.setDescription(advanceWarningAuditDetail.getDescription());
+                }
             }
         }
         result.setRecords(records);

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

@@ -1,15 +1,19 @@
 package org.jeecg.modules.medical.service.impl;
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.exception.JeecgBootException;
+import org.jeecg.modules.medical.common.bo.before.PatientInformationResponse;
 import org.jeecg.modules.medical.common.bo.mid.FeedbackReasonRequest;
 import org.jeecg.modules.medical.common.bo.mid.ViolationDetails;
 import org.jeecg.modules.medical.common.bo.mid.ViolationInfo;
 import org.jeecg.modules.medical.common.enums.MidFeedBackReasonEnum;
+import org.jeecg.modules.medical.entity.AdvanceWarningAudit;
+import org.jeecg.modules.medical.entity.AdvanceWarningAuditDetail;
 import org.jeecg.modules.medical.entity.MidIncidentAudit;
 import org.jeecg.modules.medical.entity.MidIncidentAuditDetail;
 import org.jeecg.modules.medical.mapper.MidIncidentAuditDetailMapper;
@@ -19,8 +23,14 @@ import org.springframework.stereotype.Service;
 
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.CollectionUtils;
 import org.springframework.util.StringUtils;
 
+import java.time.Instant;
+import java.time.LocalDate;
+import java.time.ZoneId;
+import java.time.temporal.ChronoUnit;
+import java.util.Date;
 import java.util.List;
 
 /**
@@ -39,6 +49,44 @@ public class MidIncidentAuditDetailServiceImpl extends ServiceImpl<MidIncidentAu
         return baseMapper.loadViolationInfoList(id);
     }
 
+    @Override
+    public PatientInformationResponse loadPatientInfoById(String id, IMidIncidentAuditService midIncidentAuditService) {
+        MidIncidentAudit midIncidentAudit = midIncidentAuditService.getById(id);
+        if (midIncidentAudit == null) {
+            log.error("找不到事前工单id={}", id);
+            throw new JeecgBootException("找不到工单id");
+        }
+        PatientInformationResponse result = baseMapper.loadPatientInfoById(id);
+        if (null != result) {
+            //查一次就诊流水号
+            List<MidIncidentAuditDetail> detailList = loadDetailList(id) ;//baseMapper.loadAdvanceWarningAuditDetail(id);
+            if (!CollectionUtils.isEmpty(detailList)) {
+                MidIncidentAuditDetail 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;
+    }
+
+    private List<MidIncidentAuditDetail> loadDetailList(String id) {
+        LambdaQueryWrapper<MidIncidentAuditDetail> queryWrapper = Wrappers.<MidIncidentAuditDetail>lambdaQuery()
+                .eq(MidIncidentAuditDetail::getMidIncidentAuditId, id);
+        return this.list(queryWrapper);
+    }
+
     @Override
     public IPage<ViolationDetails> loadViolationDetails(Page<ViolationDetails> page, String id, String ruleCode) {
         IPage<ViolationDetails> detail = baseMapper.loadViolationDetails(page, id, ruleCode);