zhs
2025-04-17 9814549e8064737867a155a92a53b8dd7982c80b
smartor/src/main/java/com/smartor/service/impl/ServiceExternalServiceImpl.java
@@ -257,11 +257,10 @@
    public Boolean addInDeptInfo(Map dataMap) {
        log.error("ServiceExternalServiceImpl---addInDeptInfo的新增的值为:{}", dataMap);
        Map yeWuXX = (Map) dataMap.get("YeWuXX");
        List<HashMap<String, Object>> epai = ObjectUtils.isNotEmpty(yeWuXX) ? (List<HashMap<String, Object>>) yeWuXX.get("DiZhiXXList") : null;
        List<HashMap<String, Object>> epli = ObjectUtils.isNotEmpty(yeWuXX) ? (List<HashMap<String, Object>>) yeWuXX.get("LianXiRList") : null;
        List<HashMap<String, Object>> hospPatientDiagnoseInfos = ObjectUtils.isNotEmpty(yeWuXX) ? (List<HashMap<String, Object>>) yeWuXX.get("ZhenDuanList") : null;
        Map<String, Object> BingRenXX = ObjectUtils.isNotEmpty(yeWuXX) ? (Map<String, Object>) yeWuXX.get("BingRenXX") : null;
        Map<String, Object> RuKeXX = ObjectUtils.isNotEmpty(yeWuXX) ? (Map<String, Object>) yeWuXX.get("RuKeXX") : null;
        List<HashMap<String, Object>> epai = ObjectUtils.isNotEmpty(yeWuXX) ? (List<HashMap<String, Object>>) BingRenXX.get("DiZhiXXList") : null;
        ExternalInHospPatientInfo externalInHospPatientInfo = BeanUtil.mapToBean(BingRenXX, ExternalInHospPatientInfo.class, true);
        ExternalInDeptPatientInfo externalInDeptPatientInfo = BeanUtil.mapToBean(RuKeXX, ExternalInDeptPatientInfo.class, true);
@@ -270,6 +269,9 @@
        externalInHospPatientInfo.setZhuZhiYSID(externalInDeptPatientInfo.getZhuZhiYSID());
        externalInHospPatientInfo.setZhuZhiYSXM(externalInDeptPatientInfo.getZhuZhiYSXM());
        externalInHospPatientInfo.setRuYuanSJ(externalInDeptPatientInfo.getRuYuanSJ());
        externalInHospPatientInfo.setLianXiDH(ObjectUtils.isNotEmpty(BingRenXX.get("LianXiDH")) ? BingRenXX.get("LianXiDH").toString() : null);
        externalInHospPatientInfo.setDangQianCWID(ObjectUtils.isNotEmpty(BingRenXX.get("DangQianCWID")) ? BingRenXX.get("DangQianCWID").toString() : null);
        externalInHospPatientInfo.setDangQianCWMC(ObjectUtils.isNotEmpty(BingRenXX.get("DangQianCWMC")) ? BingRenXX.get("DangQianCWMC").toString() : null);
        ExternalInHospPatientAddrInfo externalInHospPatientAddrInfo = null;
        ExternalInHospPatientLiaisonInfo externalInHospPatientLiaisonInfo = null;
@@ -292,29 +294,10 @@
            return info;
        }).collect(Collectors.toList());
        List<ExternalInHospPatientLiaisonInfo> epli2 = epli.stream().map(map -> {
            ExternalInHospPatientLiaisonInfo info = new ExternalInHospPatientLiaisonInfo();
            info.setLianXiRXM((String) map.get("LianXiRXM"));
            info.setLianXiRDH((String) map.get("LianXiRDH"));
            info.setGuanXiDM((String) map.get("GuanXiDM"));
            info.setGuanXiMC((String) map.get("GuanXiMC"));
            return info;
        }).collect(Collectors.toList());
        externalInHospPatientInfo.setExternalInHospPatientLiaisonInfos(epli2);
        List<ExternalInHospPatientDiagnoseInfo> hospPatientDiagnoseInfos2 = hospPatientDiagnoseInfos.stream().map(map -> {
            ExternalInHospPatientDiagnoseInfo info = new ExternalInHospPatientDiagnoseInfo();
            info.setZhenDuanID((String) map.get("ZhenDuanID"));
            info.setZhenDuanMC((String) map.get("ZhenDuanMC"));
            return info;
        }).collect(Collectors.toList());
        if (CollectionUtils.isNotEmpty(epai)) externalInHospPatientAddrInfo = epai2.get(0);
        if (CollectionUtils.isNotEmpty(epli)) externalInHospPatientLiaisonInfo = epli2.get(0);
        if (CollectionUtils.isNotEmpty(hospPatientDiagnoseInfos))
            externalInHospPatientDiagnoseInfo = hospPatientDiagnoseInfos2.get(0);
        //新增患者基本信息
        PatArchive patArchive = addPatArchive(externalInHospPatientInfo, externalInHospPatientAddrInfo, externalInHospPatientLiaisonInfo);
        PatArchive patArchive = addPatArchive(externalInHospPatientInfo, externalInHospPatientAddrInfo, null);
        //新增患者入院信息
        Boolean aBoolean = addPadInhospInfo(externalInHospPatientInfo, patArchive, externalInHospPatientDiagnoseInfo);
        return aBoolean;
@@ -526,6 +509,7 @@
        Map yeWuXX = (Map) dataMap.get("YeWuXX");
        Map XiaoXiTou = (Map) dataMap.get("XiaoXiTou");
        String FaSongJGID = ObjectUtils.isNotEmpty(XiaoXiTou.get("FaSongJGID")) ? XiaoXiTou.get("FaSongJGID").toString() : null;
        String FaSongJGMC = ObjectUtils.isNotEmpty(XiaoXiTou.get("FaSongJGMC")) ? XiaoXiTou.get("FaSongJGMC").toString() : null;
        Map<String, Object> BingRenXX = ObjectUtils.isNotEmpty(yeWuXX) ? (Map<String, Object>) yeWuXX.get("BingRenXX") : null;
        Map<String, Object> JiuZhenXX = ObjectUtils.isNotEmpty(yeWuXX) ? (Map<String, Object>) yeWuXX.get("JiuZhenXX") : null;
@@ -546,6 +530,7 @@
                info.setZhenDuanMC((String) map.get("ZhenDuanMC"));
                info.setZhenDuanLBDM((String) map.get("ZhenDuanLBDM"));
                info.setZhenDuanLBMC((String) map.get("ZhenDuanLBMC"));
                info.setIcd10((String) map.get("Icd10"));
                return info;
            }).collect(Collectors.toList());
        }
@@ -560,8 +545,11 @@
        PatMedOuthosp patMedOuthosp = new PatMedOuthosp();
        patMedOuthosp.setOuthospno(externalInHospPatientInfo.getBingAnHao());
        patMedOuthosp.setSerialnum(ObjectUtils.isNotEmpty(yeWuXX.get("JiuZhenYWID")) ? yeWuXX.get("JiuZhenYWID").toString() : null);
        patMedOuthosp.setSerialnum(externalInHospPatientInfo.getJiuZhenYWID());
        List<PatMedOuthosp> patMedOuthosps = patMedOuthospMapper.selectPatMedOuthospList(patMedOuthosp);
        patMedOuthosp.setPatid(patArchive.getId());
        patMedOuthosp.setPatno(externalInHospPatientInfo.getBingAnHao());
        patMedOuthosp.setPatname(externalInHospPatientInfo.getXingMing());
        patMedOuthosp.setHospitalname(externalInHospPatientInfo.getZuZhiJGMC());
        patMedOuthosp.setHospitalcode(externalInHospPatientInfo.getZuZhiJGID());
@@ -569,6 +557,7 @@
        patMedOuthosp.setDeptcode(externalJZInfo.getJiuZhenKSID());
        patMedOuthosp.setAdmitdate(externalJZInfo.getJiuZhenRQ());
        patMedOuthosp.setOrgid(FaSongJGID);
        patMedOuthosp.setHospitalname(FaSongJGMC);
        for (ExternalDiagnosisInfo externalDiagnosisInfo : externalDiagnosisInfoList) {
            if (externalDiagnosisInfo.getZhenDuanLBMC().equals("主诊断")) {
@@ -586,7 +575,16 @@
                patMedOuthosp.setMainsuit(externalWZInfo.getNeiRong());
            }
        }
        int i = patMedOuthospMapper.insertPatMedOuthosp(patMedOuthosp);
        int i = 0;
        if (CollectionUtils.isNotEmpty(patMedOuthosps)) {
            patMedOuthosp.setId(patMedOuthosps.get(0).getId());
            patMedOuthosp.setUpdateTime(new Date());
            i = patMedOuthospMapper.updatePatMedOuthosp(patMedOuthosp);
        } else {
            patMedOuthosp.setCreateTime(new Date());
            patMedOuthosp.setUpdateTime(new Date());
            i = patMedOuthospMapper.insertPatMedOuthosp(patMedOuthosp);
        }
        if (i > 0) {
            return true;
        }
@@ -739,7 +737,7 @@
            patMedOperation.setPatno(externalInHospPatientInfo.getBingRenID());
            patMedOperation.setPatname(externalInHospPatientInfo.getXingMing());
            patMedOperation.setOrgid(externalInHospPatientInfo.getZuZhiJGID());
            patMedOperation.setSerialnum(externalInHospPatientInfo.getZhuYuanHao());
            patMedOperation.setSerialnum(externalInHospPatientInfo.getJiuZhenYWID());
            patMedOperation.setInhospno(externalInHospPatientInfo.getBingAnHao());
            patMedOperation.setHospitalname(externalInHospPatientInfo.getZuZhiJGMC());
            patMedOperation.setHospitalcode(externalInHospPatientInfo.getZuZhiJGID());
@@ -869,12 +867,10 @@
        }
        patArchive.setTelcode(externalInHospPatientInfo.getLianXiDH());
        if (StringUtils.isEmpty(externalInHospPatientInfo.getLianXiDH()))
        if (StringUtils.isEmpty(patArchive.getTelcode()))
            patArchive.setTelcode(externalInHospPatientInfo.getLianXiRDH());
        patArchive.setRelativetelcode(externalInHospPatientInfo.getLianXiRDH());
        patArchive.setGuid(externalInHospPatientInfo.getZuZhiJGID());
        if (ObjectUtils.isNotEmpty(externalInHospPatientLiaisonInfo))
            patArchive.setRelativetelcode(externalInHospPatientLiaisonInfo.getLianXiRDH());
        patArchive.setInhospno(externalInHospPatientInfo.getBingAnHao());
        patArchive.setIdcardtype(externalInHospPatientInfo.getZhengJianLXMC());
        patArchive.setUpdateTime(new Date());
@@ -929,7 +925,8 @@
            patMedInhosp.setLeaveldeptcode(externalInHospPatientInfo.getDangQianKSID());
            patMedInhosp.setDeptname(externalInHospPatientInfo.getDangQianKSMC());
            patMedInhosp.setLeaveldeptname(externalInHospPatientInfo.getDangQianKSMC());
            patMedInhosp.setBedNo(externalInHospPatientInfo.getDangQianCWID());
            //这里是床位名称还是床位编号????
            patMedInhosp.setBedNo(externalInHospPatientInfo.getDangQianCWMC());
            patMedInhosp.setOrgid(externalInHospPatientInfo.getZuZhiJGID());
            patMedInhosp.setHospitaldistrictid(externalInHospPatientInfo.getDangQianBQID());
            patMedInhosp.setGuid(externalInHospPatientInfo.getZuZhiJGID());
@@ -963,9 +960,10 @@
            patMedInhosp.setSchemestatus(1L);
        }
        patMedInhosp.setUpdateTime(new Date());
        int i = 1;
        if (CollectionUtils.isNotEmpty(patMedInhospList)) {
            patMedInhosp.setUpdateTime(new Date());
            patMedInhosp.setInhospid(patMedInhospList.get(0).getInhospid());
            i = patMedInhospMapper.updatePatMedInhosp(patMedInhosp);
        } else {
            patMedInhosp.setCreateTime(new Date());
@@ -1101,7 +1099,7 @@
                return addMedicalTeam(dataMap);
            case "JZ_ZY_RuKe":
                log.error("入科的数据为:{}", type);
                return addMedicalTeam(dataMap);
                return addInDeptInfo(dataMap);
        }
        return true;
    }