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

fix: 事前找不到主单,医嘱字段缺失

Scott преди 1 година
родител
ревизия
fd4a42ae9c

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

@@ -20,6 +20,7 @@ import org.jeecg.modules.medical.common.enums.AfterwardsAuditStatusEnum;
 import org.jeecg.modules.medical.entity.AfterwardsAudit;
 import org.jeecg.modules.medical.entity.AfterwardsAuditDetail;
 import org.jeecg.modules.medical.entity.MedicalDoctorAppealRecord;
+import org.jeecg.modules.medical.entity.PrescriptionOrder;
 import org.jeecg.modules.medical.service.IAfterwardsAuditService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.util.CollectionUtils;
@@ -74,7 +75,7 @@ public class AfterwardsAuditController extends JeecgController<AfterwardsAudit,
 
 	 @ApiOperation(value = "审核端-医嘱信息")
 	 @GetMapping(value = "/audit/medicalorder/info")
-	 public Result<List<MedicalOrderInfoResponse>> loadMedicalOrderInfoResponseInfo(HttpServletRequest request, @RequestParam(value = "id", required = false) Integer id) {
+	 public Result<List<PrescriptionOrder>> loadMedicalOrderInfoResponseInfo(HttpServletRequest request, @RequestParam(value = "id", required = false) Integer id) {
 		 LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
 		 if (null == loginUser) {
 			 log.error("当前用户未登录");
@@ -83,7 +84,7 @@ public class AfterwardsAuditController extends JeecgController<AfterwardsAudit,
 		 if (id == null) {
 			 return Result.OK(new ArrayList<>());
 		 }
-		 List<MedicalOrderInfoResponse> result = afterwardsAuditService.loadMedicalOrderInfo(id);
+		 List<PrescriptionOrder> result = afterwardsAuditService.loadMedicalOrderInfo(id);
 		 return Result.OK(result);
 	 }
 

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

@@ -3,6 +3,7 @@ package org.jeecg.modules.medical.mapper;
 import java.util.List;
 
 import org.apache.ibatis.annotations.Param;
+import org.jeecg.modules.medical.common.bo.before.PatientInformationResponse;
 import org.jeecg.modules.medical.entity.AdvanceWarningAuditDetail;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 
@@ -14,4 +15,6 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  */
 public interface AdvanceWarningAuditDetailMapper extends BaseMapper<AdvanceWarningAuditDetail> {
 
+
+    PatientInformationResponse loadPatientInfoById(@Param("id") Integer id);
 }

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

@@ -11,6 +11,7 @@ import org.jeecg.modules.medical.common.bo.after.response.AfterDeptDetailRequest
 import org.jeecg.modules.medical.entity.AfterwardsAudit;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import org.jeecg.modules.medical.entity.AfterwardsAuditDetail;
+import org.jeecg.modules.medical.entity.PrescriptionOrder;
 import org.jeecg.modules.system.entity.SysDepart;
 
 /**
@@ -68,8 +69,8 @@ public interface AfterwardsAuditMapper extends BaseMapper<AfterwardsAudit> {
     List<AuditInfoListResponse> loadAuditInfoList(@Param("id") Integer id);
 
     List<DiagnosticInfoResponse> loadDiagnosticInfo(@Param("id") Integer id);
-
-    List<MedicalOrderInfoResponse> loadMedicalOrderInfo(@Param("id") Integer id);
+//    prescription_order
+    List<PrescriptionOrder> loadMedicalOrderInfo(@Param("id") Integer id);
 
     /**
      * 查询患者信息

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

@@ -2,4 +2,22 @@
 <!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.AdvanceWarningAuditDetailMapper">
 
+    <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 -- 科室编码
+                ,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>
 </mapper>

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

@@ -234,16 +234,17 @@
     </select>
 
     <select id="loadMedicalOrderInfo"
-            resultType="org.jeecg.modules.medical.common.bo.MedicalOrderInfoResponse">
+            resultType="org.jeecg.modules.medical.entity.PrescriptionOrder">
         SELECT
-            p.hisid as associatedSettlementMaster, -- 关联结算主单
-            p.patient_id as personalCode, -- 个人编码
-            p.inp_outpatient_number as admissionOutpatientNumber, -- 住院号/门诊号
-            ad.patient_name as patientName, -- 患者姓名
-            p.order_number as orderNumber, -- 医嘱号
-            p.order_time as orderTime, -- 下嘱时间
-            p.stop_order_time as stopOrderTime, -- 停嘱时间
-            p.order_status as orderStatus -- 医嘱状态
+--             p.hisid as associatedSettlementMaster, -- 关联结算主单
+--             p.patient_id as personalCode, -- 个人编码
+--             p.inp_outpatient_number as admissionOutpatientNumber, -- 住院号/门诊号
+--             ad.patient_name as patientName, -- 患者姓名
+--             p.order_number as orderNumber, -- 医嘱号
+--             p.order_time as orderTime, -- 下嘱时间
+--             p.stop_order_time as stopOrderTime, -- 停嘱时间
+--             p.order_status as orderStatus -- 医嘱状态
+            p.*
         FROM
             afterwards_audit as ad
                 RIGHT JOIN prescription_order as p ON p.inp_outpatient_number = ad.outpatient_number

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

@@ -1,5 +1,6 @@
 package org.jeecg.modules.medical.service;
 
+import org.jeecg.modules.medical.common.bo.before.PatientInformationResponse;
 import org.jeecg.modules.medical.entity.AdvanceWarningAuditDetail;
 import com.baomidou.mybatisplus.extension.service.IService;
 
@@ -21,4 +22,6 @@ public interface IAdvanceWarningAuditDetailService extends IService<AdvanceWarni
     List<AdvanceWarningAuditDetail> loadAdvanceWarningAuditDetail(String id);
 
     List<AdvanceWarningAuditDetail> detailList(String id);
+
+    PatientInformationResponse loadPatientInfoById(Integer advanceWarningAuditId, IAdvanceWarningAuditService advanceWarningAuditService);
 }

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

@@ -81,7 +81,7 @@ public interface IAfterwardsAuditService extends IService<AfterwardsAudit> {
      * @param id
      * @return
      */
-    List<MedicalOrderInfoResponse> loadMedicalOrderInfo(Integer id);
+    List<PrescriptionOrder> loadMedicalOrderInfo(Integer id);
 
     /**
      * 获取医生违规列表

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

@@ -2,13 +2,26 @@ package org.jeecg.modules.medical.service.impl;
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+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.entity.AdvanceWarningAudit;
 import org.jeecg.modules.medical.entity.AdvanceWarningAuditDetail;
+import org.jeecg.modules.medical.entity.AfterwardsAudit;
+import org.jeecg.modules.medical.entity.AfterwardsAuditDetail;
 import org.jeecg.modules.medical.mapper.AdvanceWarningAuditDetailMapper;
 import org.jeecg.modules.medical.service.IAdvanceWarningAuditDetailService;
+import org.jeecg.modules.medical.service.IAdvanceWarningAuditService;
 import org.springframework.stereotype.Service;
 
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.util.CollectionUtils;
 
+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;
 
 /**
@@ -17,6 +30,7 @@ import java.util.List;
  * @Date:   2023-05-09 14:37:22
  * @Version: V1.0
  */
+@Slf4j
 @Service
 public class AdvanceWarningAuditDetailServiceImpl extends ServiceImpl<AdvanceWarningAuditDetailMapper, AdvanceWarningAuditDetail> implements IAdvanceWarningAuditDetailService {
 
@@ -33,4 +47,45 @@ public class AdvanceWarningAuditDetailServiceImpl extends ServiceImpl<AdvanceWar
                 .eq(AdvanceWarningAuditDetail::getAdvanceWarningAuditId, id);
         return list(queryWrapper);
     }
+
+    @Override
+    public PatientInformationResponse loadPatientInfoById(Integer advanceWarningAuditId, IAdvanceWarningAuditService advanceWarningAuditService) {
+        AdvanceWarningAudit advanceWarningAudit = advanceWarningAuditService.getById(advanceWarningAuditId);
+//        AfterwardsAudit afterwardsAudit = advanceWarningAuditService.getById(advanceWarningAuditId);
+        if (advanceWarningAudit == null) {
+            log.error("找不到事前工单id={}", advanceWarningAuditId);
+            throw new JeecgBootException("找不到工单id");
+        }
+        PatientInformationResponse result = baseMapper.loadPatientInfoById(advanceWarningAuditId);
+        if (null != result) {
+            //查一次就诊流水号
+            List<AdvanceWarningAuditDetail> detailList = loadDetailList(advanceWarningAuditId);//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;
+    }
+
+    private List<AdvanceWarningAuditDetail> loadDetailList(Integer advanceWarningAuditId) {
+
+        LambdaQueryWrapper<AdvanceWarningAuditDetail> queryWrapper = Wrappers.<AdvanceWarningAuditDetail>lambdaQuery()
+                .eq(AdvanceWarningAuditDetail::getAdvanceWarningAuditId, advanceWarningAuditId);
+        return this.list(queryWrapper);
+
+    }
 }

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

@@ -411,10 +411,10 @@ public class AfterwardsAuditServiceImpl extends ServiceImpl<AfterwardsAuditMappe
     }
 
     @Override
-    public List<MedicalOrderInfoResponse> loadMedicalOrderInfo(Integer id) {
-        List<MedicalOrderInfoResponse> medicalOrderInfoResponses = baseMapper.loadMedicalOrderInfo(id);
+    public List<PrescriptionOrder> loadMedicalOrderInfo(Integer id) {
+        List<PrescriptionOrder> medicalOrderInfoResponses = baseMapper.loadMedicalOrderInfo(id);
 
-        for (MedicalOrderInfoResponse medicalOrderInfoRespons : medicalOrderInfoResponses) {
+        for (PrescriptionOrder medicalOrderInfoRespons : medicalOrderInfoResponses) {
             String itemId = medicalOrderInfoRespons.getItemId();
             if (StringUtils.hasText(itemId)) {
 //                String medicalInsuranceNumber = hisMedicalProjectCache.loadHisMedicalMapping(itemId);

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

@@ -256,7 +256,8 @@ public class ViolationAnalysisServiceImpl implements IViolationAnalysisService {
         // 构建患者信息
 //        PatientInformationResponse patientInformationResponse =
 //                midIncidentAuditDetailService.loadPatientInfoById(detailInfo.getId().toString());
-        PatientInformationResponse patientInformationResponse = afterwardsAuditDetailService.loadPatientInfoById(detailInfo.getId(), afterwardsAuditService);
+//        PatientInformationResponse patientInformationResponse = afterwardsAuditDetailService.loadPatientInfoById(detailInfo.getAdvanceWarningAuditId(), afterwardsAuditService);
+        PatientInformationResponse patientInformationResponse = advanceWarningAuditDetailService.loadPatientInfoById(detailInfo.getAdvanceWarningAuditId(), advanceWarningAuditService);
         patientInformationResponse.setPatientName(detailInfo.getPatientName());
         result.setPatientInfo(patientInformationResponse);
         // 构建医生信息