소스 검색

视图数据更新

0027005599 2 년 전
부모
커밋
c206dc45ec

+ 5 - 1
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/entity/OutpatientSettleBill.java

@@ -136,7 +136,9 @@ public class OutpatientSettleBill implements Serializable {
 	/**患者年龄;如有患者年龄,则不需要患者出生日期。患者年龄或出生日期有一个字段即可*/
 	@Excel(name = "患者年龄;如有患者年龄,则不需要患者出生日期。患者年龄或出生日期有一个字段即可", width = 15)
     @ApiModelProperty(value = "患者年龄;如有患者年龄,则不需要患者出生日期。患者年龄或出生日期有一个字段即可")
-    private java.lang.Integer patientAge;
+    private java.lang.String patientAge;
+
+    private java.lang.Double patientAgeDays;
 	/**人员类别;在岗职工、退休职工、居民医保*/
 	@Excel(name = "人员类别;在岗职工、退休职工、居民医保", width = 15)
     @ApiModelProperty(value = "人员类别;在岗职工、退休职工、居民医保")
@@ -231,6 +233,8 @@ public class OutpatientSettleBill implements Serializable {
 	@Excel(name = "基金支付总额", width = 15)
     @ApiModelProperty(value = "基金支付总额")
     private java.math.BigDecimal fundPaySumamt;
+
+    private String state;
 	/**创建时间;*/
 	@JsonFormat(timezone = "GMT+8",pattern =  "yyyy-MM-dd HH:mm:ss")
     @DateTimeFormat(pattern= "yyyy-MM-dd HH:mm:ss")

+ 1 - 1
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/entity/OutpatientSettlementDetails.java

@@ -87,7 +87,7 @@ public class OutpatientSettlementDetails implements Serializable {
 	/**单价;该项目单价*/
 	@Excel(name = "单价;该项目单价", width = 15)
     @ApiModelProperty(value = "单价;该项目单价")
-    private java.lang.Integer unitPrice;
+    private java.lang.Double unitPrice;
 	/**数量;该项目数量*/
 	@Excel(name = "数量;该项目数量", width = 15)
     @ApiModelProperty(value = "数量;该项目数量")

+ 1 - 1
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/job/AfterWaringLogJob.java

@@ -27,7 +27,7 @@ import java.util.ArrayList;
 import java.util.List;
 
 /**
- * 事后监管任务生成
+ * 事后监管任务生成-住院就诊类型
  */
 @Slf4j
 public class AfterWaringLogJob implements Job {

+ 1 - 1
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/job/AfterWaringLogTestJob.java

@@ -34,7 +34,7 @@ import java.util.List;
 import java.util.Map;
 
 /**
- * 事后监管任务生成
+ * 事后监管任务生成-住院就诊类型
  */
 @Slf4j
 @Component

+ 146 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/job/OutpatientAuditLogJob.java

@@ -0,0 +1,146 @@
+package org.jeecg.modules.medical.job;
+
+import cn.hutool.core.collection.CollectionUtil;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang.StringUtils;
+import org.jeecg.modules.medical.Constant;
+import org.jeecg.modules.medical.common.CommonUtil;
+import org.jeecg.modules.medical.entity.AfterIncidentDetailLog;
+import org.jeecg.modules.medical.entity.AfterIncidentLog;
+import org.jeecg.modules.medical.entity.HospitalizatioSettleDetail;
+import org.jeecg.modules.medical.entity.MasterAdmissionBill;
+import org.jeecg.modules.medical.entity.OutpatientSettleBill;
+import org.jeecg.modules.medical.entity.OutpatientSettlementDetails;
+import org.jeecg.modules.medical.ruleengine.RuleEngine;
+import org.jeecg.modules.medical.service.IAfterIncidentDetailLogService;
+import org.jeecg.modules.medical.service.IAfterIncidentLogService;
+import org.jeecg.modules.medical.service.IHospitalizatioSettleDetailService;
+import org.jeecg.modules.medical.service.IMasterAdmissionBillService;
+import org.jeecg.modules.medical.service.IOutpatientSettleBillService;
+import org.jeecg.modules.medical.service.IOutpatientSettlementDetailsService;
+import org.jeecg.modules.system.entity.SysUser;
+import org.jeecg.modules.system.service.ISysUserService;
+import org.quartz.Job;
+import org.quartz.JobExecutionContext;
+import org.quartz.JobExecutionException;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Async;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 门诊事后监管任务生成
+ */
+@Slf4j
+public class OutpatientAuditLogJob implements Job {
+    @Autowired
+    IAfterIncidentLogService afterIncidentLogService;
+    @Autowired
+    IAfterIncidentDetailLogService afterIncidentDetailLogService;
+    @Autowired
+    RuleEngine ruleEngine;
+    @Autowired
+    IOutpatientSettleBillService outpatientSettleBillService;
+    @Autowired
+    IOutpatientSettlementDetailsService outpatientSettlementDetailsService;
+
+    @Autowired
+    ISysUserService sysUserService;
+
+    @Override
+    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
+        List<OutpatientSettleBill> outpatientSettleBillList = outpatientSettleBillService.lambdaQuery().isNull(OutpatientSettleBill::getState).last(" limit 1000").list();
+        for (OutpatientSettleBill outpatientSettleBill : outpatientSettleBillList) {
+            dealAftertask(outpatientSettleBill);
+        }
+    }
+
+
+    @Async("commonTaskAsyncPool")
+    public void dealAftertask(OutpatientSettleBill outpatientSettleBill) {
+        boolean updateCount = outpatientSettleBillService.lambdaUpdate().set(OutpatientSettleBill::getState, Constant.DEALING).eq(OutpatientSettleBill::getId, outpatientSettleBill.getId()).update();
+        if (!updateCount) {
+            log.error("门诊结算主单为:{} 未更新到处理状态", outpatientSettleBill.getId());
+            return;
+        }
+        AfterIncidentLog afterIncidentLog = afterIncidentLogService.addAfterIncidentLogByOutpatient(outpatientSettleBill);
+        List<OutpatientSettlementDetails> outpatientSettlementDetailsList = outpatientSettlementDetailsService.lambdaQuery().eq(OutpatientSettlementDetails::getHisid, outpatientSettleBill.getHisid()).list();
+        List<AfterIncidentDetailLog> afterIncidentDetailLogList = new ArrayList<>();
+        AfterIncidentDetailLog afterIncidentDetailLog = null;
+        List<SysUser> sysUserList = sysUserService.lambdaQuery().eq(SysUser::getDoctorId, afterIncidentLog.getDoctorId()).list();
+        String doctorLevel = "0";
+        if (CollectionUtil.isNotEmpty(sysUserList)) {
+            doctorLevel = sysUserList.get(0).getDoctorLevel();
+        }
+        for (OutpatientSettlementDetails outpatientSettlementDetails : outpatientSettlementDetailsList) {
+            afterIncidentDetailLog = new AfterIncidentDetailLog();
+
+            afterIncidentDetailLog.setAfterIncidentLogId(afterIncidentLog.getId());
+            afterIncidentDetailLog.setMedicalDiagnoseNameStr(outpatientSettleBill.getYbAdmissionDiseaseName().trim());
+            afterIncidentDetailLog.setMedicalDiagnoseCodeStr(outpatientSettleBill.getYbAdmissionDiseaseId().trim());
+            afterIncidentDetailLog.setAmount(outpatientSettlementDetails.getCost().doubleValue());
+
+            if (StringUtils.isNotBlank(outpatientSettlementDetails.getItemId())) {
+                afterIncidentDetailLog.setMedicalProjectCode(outpatientSettlementDetails.getItemId());
+                afterIncidentDetailLog.setMedicalProjectName(outpatientSettlementDetails.getItemName());
+            } else {
+                String[] itemIdNameArr = CommonUtil.getMedicalCodeAndName(outpatientSettlementDetails.getItemId());
+                if (null != itemIdNameArr) {
+                    afterIncidentDetailLog.setMedicalProjectCode(itemIdNameArr[0]);
+                    afterIncidentDetailLog.setMedicalProjectName(itemIdNameArr[1]);
+                }
+            }
+            afterIncidentDetailLog.setProjectName(outpatientSettlementDetails.getItemNameHosp());
+            afterIncidentDetailLog.setProjectCode(outpatientSettlementDetails.getItemIdHosp());
+            afterIncidentDetailLog.setCreateTime(afterIncidentLog.getCreateTime());
+            afterIncidentDetailLog.setDoctorCode(afterIncidentLog.getDoctorId());
+            afterIncidentDetailLog.setDoctorName(afterIncidentLog.getDoctorName());
+
+            afterIncidentDetailLog.setDoctorLevel(doctorLevel);
+            afterIncidentDetailLog.setUseDay(outpatientSettlementDetails.getUseDay());
+//            afterIncidentDetailLog.setDose_day();
+            afterIncidentDetailLog.setDoseForm(outpatientSettlementDetails.getDosageForm());
+            afterIncidentDetailLog.setDoseUnit(outpatientSettlementDetails.getPackageUnit());
+            afterIncidentDetailLog.setPrice(outpatientSettlementDetails.getUnitPrice());
+//            afterIncidentDetailLog.setDscgBed(outpatientSettleBill.getAdmBed());
+            afterIncidentDetailLog.setExpenseCategory(outpatientSettlementDetails.getPCategory());
+            afterIncidentDetailLog.setProjectUseTime(outpatientSettlementDetails.getUsageDate());
+            afterIncidentDetailLog.setChangeClass(outpatientSettlementDetails.getPCategory());
+//            afterIncidentDetailLog.setInspectionSite();
+//            afterIncidentDetailLog.setOutHospDate(outpatientSettleBill.getDischargeDate());
+            afterIncidentDetailLog.setDiagnoseCodeStr(outpatientSettleBill.getAdmissionDiseaseId().trim());
+            afterIncidentDetailLog.setDiagnoseNameStr(outpatientSettleBill.getAdmissionDiseaseName().trim());
+            afterIncidentDetailLog.setMedicalInsuranceMark(outpatientSettleBill.getPayMethod());
+            afterIncidentDetailLog.setMedicalSpecification(outpatientSettlementDetails.getDrugSpec());
+            afterIncidentDetailLog.setTotalAmount(outpatientSettleBill.getMedfeeSumamt().doubleValue());
+            afterIncidentDetailLog.setMedicalDeptCode(outpatientSettleBill.getAdmissionDeptId());
+            afterIncidentDetailLog.setMedicalDeptName(outpatientSettleBill.getAdmissionDeptName());
+            afterIncidentDetailLog.setPatientId(outpatientSettleBill.getPatientId());
+            afterIncidentDetailLog.setPatientName(outpatientSettleBill.getPatientName());
+            afterIncidentDetailLog.setPatientAge(outpatientSettleBill.getPatientAge());
+            afterIncidentDetailLog.setPatientAgeDays(outpatientSettleBill.getPatientAgeDays());
+//            afterIncidentDetailLog.setDischargeStatus(outpatientSettleBill.getDischargeStatus());
+//            afterIncidentDetailLog.setSingle_dose_number();
+//            afterIncidentDetailLog.setSingle_dose_unit();
+            afterIncidentDetailLog.setVisitNo(outpatientSettleBill.getVisitNo());
+            afterIncidentDetailLog.setRecipeNo(outpatientSettleBill.getRecipeNo());
+            afterIncidentDetailLog.setVisit_type(Constant.TREAMENT_TYPE_HOSP);
+            afterIncidentDetailLog.setState(Constant.WATING);
+            String projectType = CommonUtil.getProjectType(afterIncidentDetailLog.getMedicalProjectCode());
+            afterIncidentDetailLog.setProjectType(projectType);
+            afterIncidentDetailLog.setQuantity(outpatientSettlementDetails.getNum());
+            afterIncidentDetailLog.setPatientGender(outpatientSettleBill.getPatientGender());
+//            afterIncidentDetailLog.setInHospDate(outpatientSettleBill.getAdmissionDate());
+//            afterIncidentDetailLog.setInvoice_project()
+//            afterIncidentDetailLog.setOrderType();
+//            afterIncidentDetailLog.setOrderCatalog();
+            afterIncidentDetailLogList.add(afterIncidentDetailLog);
+        }
+
+        afterIncidentDetailLogService.saveBatch(afterIncidentDetailLogList);
+        outpatientSettleBillService.lambdaUpdate().set(OutpatientSettleBill::getState, Constant.SUCCESS).eq(OutpatientSettleBill::getId, outpatientSettleBill.getId()).update();
+    }
+
+
+}

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

@@ -4,6 +4,7 @@ import org.jeecg.modules.medical.Constant;
 import org.jeecg.modules.medical.entity.AfterIncidentLog;
 import com.baomidou.mybatisplus.extension.service.IService;
 import org.jeecg.modules.medical.entity.MasterAdmissionBill;
+import org.jeecg.modules.medical.entity.OutpatientSettleBill;
 
 import java.util.Date;
 
@@ -15,4 +16,6 @@ import java.util.Date;
  */
 public interface IAfterIncidentLogService extends IService<AfterIncidentLog> {
     public AfterIncidentLog addAfterIncidentLog(MasterAdmissionBill masterAdmissionBill);
+
+    AfterIncidentLog addAfterIncidentLogByOutpatient(OutpatientSettleBill outpatientSettleBill);
 }

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

@@ -3,6 +3,7 @@ package org.jeecg.modules.medical.service.impl;
 import org.jeecg.modules.medical.Constant;
 import org.jeecg.modules.medical.entity.AfterIncidentLog;
 import org.jeecg.modules.medical.entity.MasterAdmissionBill;
+import org.jeecg.modules.medical.entity.OutpatientSettleBill;
 import org.jeecg.modules.medical.mapper.AfterIncidentLogMapper;
 import org.jeecg.modules.medical.service.IAfterIncidentLogService;
 import org.springframework.stereotype.Service;
@@ -49,4 +50,34 @@ public class AfterIncidentLogServiceImpl extends ServiceImpl<AfterIncidentLogMap
         this.save(afterIncidentLog);
         return afterIncidentLog;
     }
+
+
+    @Override
+    public AfterIncidentLog addAfterIncidentLogByOutpatient(OutpatientSettleBill outpatientSettleBill){
+        Date date = new Date(System.currentTimeMillis());
+        AfterIncidentLog afterIncidentLog = new AfterIncidentLog();
+        afterIncidentLog.setVisitNo(outpatientSettleBill.getVisitNo());
+        afterIncidentLog.setDoctorId(outpatientSettleBill.getDoctorId());
+        afterIncidentLog.setDoctorName(outpatientSettleBill.getDoctorName());
+        afterIncidentLog.setCreateTime(date);
+        afterIncidentLog.setMedicalDeptCode(outpatientSettleBill.getAdmissionDeptId());
+        afterIncidentLog.setMedicalDeptName(outpatientSettleBill.getAdmissionDeptName());
+        afterIncidentLog.setPatientId(outpatientSettleBill.getPatientId());
+        afterIncidentLog.setPatientName(outpatientSettleBill.getPatientName());
+        afterIncidentLog.setDoctorAdviceNo(outpatientSettleBill.getRecipeNo());
+        afterIncidentLog.setVisitType(Constant.TREAMENT_TYPE_OUTPATIENT);
+//        afterIncidentLog.setInHospDate(outpatientSettleBill.getAdmissionDate());
+//        afterIncidentLog.setOutHospDate(outpatientSettleBill.getDischargeDate());
+//        afterIncidentLog.setZyts(outpatientSettleBill.getZyts());
+        afterIncidentLog.setDiagnoses(outpatientSettleBill.getAdmissionDiseaseId());
+        afterIncidentLog.setPatientAgeDays(outpatientSettleBill.getPatientAgeDays());
+        afterIncidentLog.setState(Constant.WATING);
+        Integer medicalINsurance = 0;
+        if(!"0".equals(outpatientSettleBill.getPayMethod())){
+            medicalINsurance = 1;
+        }
+        afterIncidentLog.setMedicalInsurance(medicalINsurance);
+        this.save(afterIncidentLog);
+        return afterIncidentLog;
+    }
 }