浏览代码

病案表签收表没有数据时,取原始数据,优化上传

lihong 2 年之前
父节点
当前提交
46b71c29c4

+ 4 - 0
src/main/java/thyyxxk/webserver/dao/his/medicalinsurance/UpIdCollectionDao.java

@@ -1017,4 +1017,8 @@ public interface UpIdCollectionDao extends BaseMapper<SetlinfoUpld> {
     void synchronousDisDiag(@Param("patNo") String patNo, @Param("times") Integer times);
     @Insert(" insert into batj_ba4_modify  select *  from  batj_ba4 where zyh =#{patNo} and zycs =#{times} ")
     void synchronousOprt(@Param("patNo") String patNo, @Param("times") Integer times);
+    @Select("select top 1 1 from t_case_frontsheet_main where bah=#{patNo} and admiss_times=#{times}")
+    Integer existCaseFrontsheetMain(@Param("patNo") String patNo, @Param("times") Integer times);
+    @Select("select si_code from zd_country_code where code = #{code} ")
+    String getCountrySiCode(String code);
 }

+ 8 - 0
src/main/java/thyyxxk/webserver/dao/his/redislike/RedisLikeDao.java

@@ -59,4 +59,12 @@ public interface RedisLikeDao {
 
     @Select("select role_id from dj_user_role where user_code=#{code}")
     List<Integer> selectUserRoles(@Param("code") String code);
+    @Select(" select rtrim(yb_code) " +
+            "                          from zy_zd_relative_code  " +
+            "                          where code = #{code}")
+    String selectYbCodeContactRelation(String code);
+    @Select("select rtrim(si_caty) " +
+            "                          from zd_unit_code " +
+            "                          where code = #{code}")
+    String selecYbDept(String code);
 }

+ 80 - 3
src/main/java/thyyxxk/webserver/service/medicalinsurance/SetlListUpldService.java

@@ -34,11 +34,13 @@ import thyyxxk.webserver.dao.his.medicalinsurance.SiLogDao;
 import thyyxxk.webserver.dao.his.medicalinsurance.SiQueryDao;
 import thyyxxk.webserver.dao.his.medicalinsurance.UpIdCollectionDao;
 import thyyxxk.webserver.entity.ResultVo;
+import thyyxxk.webserver.entity.casefrontsheet.CaseFrontsheetMain;
 import thyyxxk.webserver.entity.casefrontsheet.SheetOverview;
 import thyyxxk.webserver.entity.datamodify.GetDropdownBox;
 import thyyxxk.webserver.entity.datamodify.TYbSetModifyTime;
 import thyyxxk.webserver.entity.datamodify.TYbSetlModifyReq;
 import thyyxxk.webserver.entity.dictionary.CodeName;
+import thyyxxk.webserver.entity.login.UserInfo;
 import thyyxxk.webserver.entity.medicalinsurance.inpatient.BatjBa4;
 import thyyxxk.webserver.entity.medicalinsurance.inpatient.YbZyDisDiag;
 import thyyxxk.webserver.entity.medicalinsurance.inpatient.ZyDisDiagYb;
@@ -358,8 +360,13 @@ public class SetlListUpldService {
         }
 
         Integer flag = getModifyFlag(patNo, times);
-        // 患者基本信息
+        // 患者基本信息 先判断签收表是否有数据
+        Integer existCaseFrontsheetMain = dao.existCaseFrontsheetMain(patNo, times);
         SetlinfoUpld setlinfoUpld = dao.setlinfo1(patNo, times, ledgerSn);
+        if(existCaseFrontsheetMain ==null){
+        //    这里使用病案首页数据
+            covertCaseFrontsheetMain2SetlinfoUpld(setlinfoUpld,patNo,times);
+        }
         EntityCopy.Copy(dao.setlinfo2(patNo, times), setlinfoUpld);
         EntityCopy.Copy(dao.setlinfo3(String.format("inpatient_no ='%s'", patNo)), setlinfoUpld);
         EntityCopy.Copy(dao.setlinfo4(patNo, times), setlinfoUpld);
@@ -538,6 +545,76 @@ public class SetlListUpldService {
         setlinfoUpld.setSpPsnType(null);
         return ResultVoUtil.success(upldCollection);
     }
+    /**
+     * @description:病案首页转换为结算的的数据 用于签收表没有数据,重新取数据
+     * @author: lihong
+     * @date: 2023/2/9 16:30
+     * @param: setlinfoUpld
+     * @param: patNo
+     * @param: times
+     **/
+    public void covertCaseFrontsheetMain2SetlinfoUpld(SetlinfoUpld setlinfoUpld, String patNo, Integer times) {
+        SheetOverview overview = new SheetOverview();
+        overview.setInOutFlag(2);
+        overview.setBah(patNo);
+        overview.setTimes(times);
+        ResultVo<CaseFrontsheetMain> patientInfo = caseFrontSheetMainService.getPatientInfo(overview);
+        if(patientInfo.getData() !=null){
+            CaseFrontsheetMain caseFrontsheetMain = patientInfo.getData();
+            setlinfoUpld.setNtly(caseFrontsheetMain.getCountry()!=null ? dao.getCountrySiCode(caseFrontsheetMain.getCountry()):null);
+            setlinfoUpld.setPrfs(caseFrontsheetMain.getOccupation());
+            setlinfoUpld.setCertno(caseFrontsheetMain.getSocialNo());
+            setlinfoUpld.setCurrAddr(caseFrontsheetMain.getLivePlace());
+            setlinfoUpld.setEmpName(caseFrontsheetMain.getUnitName());
+            setlinfoUpld.setEmpAddr(caseFrontsheetMain.getUnitPlace());
+            setlinfoUpld.setEmpTel(caseFrontsheetMain.getUnitPhone());
+            setlinfoUpld.setPoscode(caseFrontsheetMain.getAddrZipCode());
+            setlinfoUpld.setNaty(redisLikeService.getWjwNation(caseFrontsheetMain.getNation()));
+            setlinfoUpld.setConerName(caseFrontsheetMain.getContactName());
+            setlinfoUpld.setBrdy(DateUtil.formatDatetime(caseFrontsheetMain.getBirthDate(),"yyyy-MM-dd"));
+            setlinfoUpld.setAge(String.valueOf(caseFrontsheetMain.getAge()));
+            setlinfoUpld.setGend(caseFrontsheetMain.getSex());
+            setlinfoUpld.setPatnRlts(redisLikeService.getYbCodeContactRelation(caseFrontsheetMain.getContactRelation()));
+            setlinfoUpld.setConerTel(caseFrontsheetMain.getContactPhone());
+            setlinfoUpld.setPwcryBfadmComaDura(caseFrontsheetMain.getComaDaysBeforeAdmiss()+"/"+caseFrontsheetMain.getComaHoursBeforeAdmiss()+"/"+caseFrontsheetMain.getComaMinutesBeforeAdmiss());
+            setlinfoUpld.setPwcryAfadmComaDura(caseFrontsheetMain.getComaDaysAfterAdmiss()+"/"+caseFrontsheetMain.getComaHoursAfterAdmiss()+"/"+caseFrontsheetMain.getComaMinutesAfterAdmiss());
+            setlinfoUpld.setDscgWay(caseFrontsheetMain.getZyDismissWay());
+            setlinfoUpld.setAcpMedinsName(caseFrontsheetMain.getDismissDestination());
+            setlinfoUpld.setDaysRinpFlag31(caseFrontsheetMain.getAdmissAgainInOneMonth());
+            setlinfoUpld.setDaysRinpPup31(caseFrontsheetMain.getAdmissAgainPurpose());
+            setlinfoUpld.setChfpdrName(StringUtil.isBlank(caseFrontsheetMain.getMainDoctorName()) ? caseFrontsheetMain.getAdmissDoctorName() : caseFrontsheetMain.getMainDoctorName());
+            setlinfoUpld.setChfpdrCode(StringUtil.isBlank(getYbCode(caseFrontsheetMain.getMainDoctor())) ? getYbCode(caseFrontsheetMain.getAdmissDoctor()) : getYbCode(caseFrontsheetMain.getMainDoctor()));
+            setlinfoUpld.setNwbAge(caseFrontsheetMain.getAgeDays() == null? "" : caseFrontsheetMain.getAgeDays().toString());
+            setlinfoUpld.setConerAddr(caseFrontsheetMain.getContactAddrName());
+            setlinfoUpld.setNwbBirWt(caseFrontsheetMain.getNewBornWeight() == null ? "" : caseFrontsheetMain.getNewBornWeight().toString());
+            String dutyNurse = getYbCode(caseFrontsheetMain.getDutyNurse());
+            if(StringUtil.notBlank(dutyNurse)){
+                setlinfoUpld.setRespNursCode(dutyNurse);
+            }
+            if(StringUtil.notBlank(caseFrontsheetMain.getDutyNurseName())){
+                setlinfoUpld.setRespNursName(caseFrontsheetMain.getDutyNurseName());
+            }
+            String refldeptDept = redisLikeService.getYbDept(caseFrontsheetMain.getTransDeptCode());
+            if(refldeptDept !=null){
+                setlinfoUpld.setRefldeptDept(refldeptDept);
+            }
+            String dscCaty = redisLikeService.getYbDept(caseFrontsheetMain.getAdmissDeptCode());
+            if(dscCaty != null){
+                setlinfoUpld.setDscgCaty(dscCaty);
+            }
+        }
+
+    }
+
+    public String getYbCode(String code) {
+        UserInfo userInfo = redisLikeService.getUserInfoByCode(code);
+        String ybCode = "";
+        if(userInfo !=null){
+            ybCode = userInfo.getYbCode();
+        }
+        return ybCode;
+    }
+
 
     @NotNull
     public Integer getModifyFlag(String patNo, Integer times) {
@@ -2279,8 +2356,8 @@ public class SetlListUpldService {
         sheetOverview.setTimes(param.getAdmissTimes());
         sheetOverview.setInOutFlag(2);
         ResultVo<Map<String, List<CodeName>>> mapResultVo = caseFrontSheetMainService.sheetVerification(sheetOverview);
-        Integer count = dao.queryCountTCaseFrontsheetMain(param.getInpatientNo(), param.getAdmissTimes());
-        if(ListUtil.isBlank(mapResultVo.getData().get("force")) && count < 1){
+        Integer count = dao.existCaseFrontsheetMain(param.getInpatientNo(), param.getAdmissTimes());
+        if(ListUtil.isBlank(mapResultVo.getData().get("force")) && count != null){
             throw new BizException(ExceptionEnum.LOGICAL_ERROR,"病案首页签收表没有数据,请去病案首页操作打印正反面!");
         }
         return mapResultVo;

+ 32 - 1
src/main/java/thyyxxk/webserver/service/redislike/RedisLikeService.java

@@ -1,6 +1,5 @@
 package thyyxxk.webserver.service.redislike;
 
-import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Service;
@@ -30,6 +29,8 @@ public class RedisLikeService {
     private final static Map<String, String> WJW_NATION_MAP = new HashMap<>();
     private final static Map<String, String> COUNTRY_MAP = new HashMap<>();
     private final static Map<String, UserInfo> USER_MAP = new HashMap<>();
+    private final static Map<String, String> YB_CONTACT_RELATION_MAP = new HashMap<>();
+    private final static Map<String, String> YB_DEPT_MAP = new HashMap<>();
     private final RedisLikeDao dao;
     private final CorpWxSrvc srvc;
 
@@ -134,6 +135,18 @@ public class RedisLikeService {
         return wjwCode;
     }
 
+    public String getYbDept(String code){
+        if (StringUtil.invalidValue(code)) {
+            return null;
+        }
+        String ybCode = YB_DEPT_MAP.get(code);
+        if (null == ybCode) {
+            ybCode = dao.selecYbDept(code);
+            YB_DEPT_MAP.put(code, ybCode);
+        }
+        return ybCode;
+    }
+
     public String getWjwNation(String code) {
         if (StringUtil.invalidValue(code)) {
             return null;
@@ -145,6 +158,24 @@ public class RedisLikeService {
         }
         return wjwCode;
     }
+    /**
+     * @description:获取医保联系人关系
+     * @author: lihong
+     * @date: 2023/2/9 15:14
+     * @param: code
+     * @return: java.lang.String
+     **/
+    public String getYbCodeContactRelation(String code){
+        if (StringUtil.invalidValue(code)) {
+            return null;
+        }
+        String ybCode = YB_CONTACT_RELATION_MAP.get(code);
+        if (null == ybCode) {
+            ybCode = dao.selectYbCodeContactRelation(code);
+            YB_CONTACT_RELATION_MAP.put(code, ybCode);
+        }
+        return ybCode;
+    }
 
     public String getCountryName(String code) {
         if (StringUtil.invalidValue(code)) {