Browse Source

门特备案使用医生的医保赋码

lighter 2 tháng trước cách đây
mục cha
commit
635b81cfde

+ 12 - 1
src/main/java/thyyxxk/webserver/service/medicalinsurance/SiPsnRcdService.java

@@ -1,17 +1,21 @@
 package thyyxxk.webserver.service.medicalinsurance;
 
+import cn.hutool.core.util.StrUtil;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import thyyxxk.webserver.config.envionment.SystemConfig;
+import thyyxxk.webserver.config.exception.BizException;
 import thyyxxk.webserver.config.exception.ExceptionEnum;
 import thyyxxk.webserver.constants.sidicts.SiFunction;
 import thyyxxk.webserver.dao.his.medicalinsurance.*;
 import thyyxxk.webserver.entity.ResultVo;
+import thyyxxk.webserver.entity.login.UserInfo;
 import thyyxxk.webserver.entity.medicalinsurance.log.SiLog;
 import thyyxxk.webserver.entity.medicalinsurance.psnrcd.*;
+import thyyxxk.webserver.service.hutoolcache.UserCache;
 import thyyxxk.webserver.utils.ResultVoUtil;
 import thyyxxk.webserver.utils.TokenUtil;
 
@@ -35,9 +39,10 @@ public class SiPsnRcdService {
     private final PsnAccidentRcdDao psnAccdntDao;
     private final SiLogDao logDao;
     private final SystemConfig sysCfg;
+    private final UserCache userCache;
 
     @Autowired
-    public SiPsnRcdService(ExecService exec, SlwSpcChrRcdDao dao, TransHospRcdDao trsHspRcdDao, PsnAsgnmtRcdDao psnAsgRcdDao, PsnAccidentRcdDao psnAccdntDao, SiLogDao logDao, SystemConfig sysCfg) {
+    public SiPsnRcdService(ExecService exec, SlwSpcChrRcdDao dao, TransHospRcdDao trsHspRcdDao, PsnAsgnmtRcdDao psnAsgRcdDao, PsnAccidentRcdDao psnAccdntDao, SiLogDao logDao, SystemConfig sysCfg, UserCache userCache) {
         this.exec = exec;
         this.slwSpcChrRcdDao = dao;
         this.trsHspRcdDao = trsHspRcdDao;
@@ -45,6 +50,7 @@ public class SiPsnRcdService {
         this.psnAccdntDao = psnAccdntDao;
         this.logDao = logDao;
         this.sysCfg = sysCfg;
+        this.userCache = userCache;
     }
 
     public ResultVo<String> transferHospitalRecord(TransHospRcd trsHspRcd) {
@@ -103,6 +109,11 @@ public class SiPsnRcdService {
     }
 
     public ResultVo<String> specialChronicDiseasesRecord(SlwSpcDiseRcd slwSpcDiseRcd) {
+        UserInfo userInfo = userCache.get(slwSpcDiseRcd.getDiagDrCodg());
+        if (StrUtil.isBlank(userInfo.getYbCode())) {
+            throw new BizException(ExceptionEnum.USER_NOT_EXIST, "诊断医生没有医保赋码!");
+        }
+        slwSpcDiseRcd.setDiagDrCodg(userInfo.getYbCode());
         slwSpcDiseRcd.setIdeFixmedinsNo(sysCfg.getInstitutionId());
         slwSpcDiseRcd.setIdeFixmedinsName(sysCfg.getInstitutionName());
         JSONObject input = exec.makeTradeHeaderWithInsureArea(SiFunction.SPECIAL_CHRONIC_DISEASES_RECORD, slwSpcDiseRcd.getInsuOptins());