liusheng
2025-03-12 4d7b0c1dc2f1a400005feb93a945a09b52e5d101
smartor/src/main/java/com/smartor/service/impl/ServiceExternalServiceImpl.java
@@ -265,12 +265,14 @@
        log.error("ServiceExternalServiceImpl---addOutHospInfo的新增的值为:{}", dataMap);
        Map yeWuXX = (Map) dataMap.get("YeWuXX");
        Map<String, Object> BingRenXX = (Map<String, Object>) yeWuXX.get("BingRenXX");
        List<HashMap<String, Object>> epai = (List<HashMap<String, Object>>) yeWuXX.get("DiZhiXXList");
        List<HashMap<String, Object>> epai = (List<HashMap<String, Object>>) BingRenXX.get("DiZhiXXList");
        List<HashMap<String, Object>> epli = (List<HashMap<String, Object>>) yeWuXX.get("LianXiRList");
        ExternalInHospPatientInfo externalInHospPatientInfo = BeanUtil.mapToBean(BingRenXX, ExternalInHospPatientInfo.class, true);
        ExternalInHospPatientAddrInfo externalInHospPatientAddrInfo = null;
        ExternalInHospPatientLiaisonInfo externalInHospPatientLiaisonInfo = null;
        List<ExternalInHospPatientAddrInfo> epai2 = epai.stream().map(map -> {
        List<ExternalInHospPatientAddrInfo> epai2 = null;
        if (CollectionUtils.isNotEmpty(epai)) {
            epai2 = epai.stream().map(map -> {
            ExternalInHospPatientAddrInfo info = new ExternalInHospPatientAddrInfo();
            info.setDiZhiLX((String) map.get("DiZhiLX")); // 假设字段类型是 Integer
            info.setDiZhiXX((String) map.get("DiZhiXX"));
@@ -287,8 +289,10 @@
            info.setYouBian((String) map.get("YouBian"));
            return info;
        }).collect(Collectors.toList());
        List<ExternalInHospPatientLiaisonInfo> epli2 = epli.stream().map(map -> {
        }
        List<ExternalInHospPatientLiaisonInfo> epli2 = null;
        if (CollectionUtils.isNotEmpty(epli)) {
            epli2 = epli.stream().map(map -> {
            ExternalInHospPatientLiaisonInfo info = new ExternalInHospPatientLiaisonInfo();
            info.setLianXiRXM((String) map.get("LianXiRXM"));
            info.setLianXiRDH((String) map.get("LianXiRDH"));
@@ -296,6 +300,7 @@
            info.setGuanXiMC((String) map.get("GuanXiMC"));
            return info;
        }).collect(Collectors.toList());
        }
        if (CollectionUtils.isNotEmpty(epai)) externalInHospPatientAddrInfo = epai2.get(0);
        if (CollectionUtils.isNotEmpty(epli)) externalInHospPatientLiaisonInfo = epli2.get(0);
        //新增患者基本信息新增或修改
@@ -304,9 +309,10 @@
        PatMedInhosp patMedInhosp = new PatMedInhosp();
        patMedInhosp.setInhospno(externalInHospPatientInfo.getZhuYuanHao());
        List<PatMedInhosp> patMedInhospList = patMedInhospMapper.selectPatMedInhospList(patMedInhosp);
        if (CollectionUtils.isNotEmpty(patMedInhospList)) {
            Map<String, Object> JiuZhenXX = (Map<String, Object>) yeWuXX.get("JiuZhenXX");
            PatMedInhosp patMedInhosp1 = patMedInhospList.get(0);
        PatMedInhosp patMedInhosp1 = new PatMedInhosp();
        if (CollectionUtils.isNotEmpty(patMedInhospList)) patMedInhosp1 = patMedInhospList.get(0);
            patMedInhosp1.setSchemestatus(2L);
            try {
                patMedInhosp1.setEndtime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(JiuZhenXX.get("ChuYuanSJ").toString()));
@@ -316,12 +322,13 @@
            patMedInhosp1.setOperator(JiuZhenXX.get("CaoZuoRXM").toString());
            patMedInhosp1.setOperatorId(JiuZhenXX.get("CaoZuoRID").toString());
            patMedInhosp1.setUpdateTime(new Date());
            patMedInhosp1.setUpdateTime(new Date());
            patMedInhosp1.setTelcode(patArchive.getTelcode());
            patMedInhosp1.setLeavehospitaldistrictcode(externalInHospPatientInfo.getDangQianBQID());
            patMedInhosp1.setLeavehospitaldistrictname(externalInHospPatientInfo.getDangQianBQMC());
            patMedInhosp1.setLeaveldeptname(externalInHospPatientInfo.getDangQianKSMC());
        patMedInhosp1.setDeptname(externalInHospPatientInfo.getDangQianKSMC());
            patMedInhosp1.setLeaveldeptcode(externalInHospPatientInfo.getDangQianKSID());
        patMedInhosp1.setDeptcode(externalInHospPatientInfo.getDangQianKSID());
            List<HashMap<String, Object>> zhenDuanList = (List<HashMap<String, Object>>) yeWuXX.get("ZhenDuanList");
            List<ExternalInHospPatientDiagnoseInfo> hospPatientDiagnoseInfos2 = zhenDuanList.stream().map(map -> {
                ExternalInHospPatientDiagnoseInfo info = new ExternalInHospPatientDiagnoseInfo();
@@ -331,9 +338,28 @@
            }).collect(Collectors.toList());
            patMedInhosp1.setLeaveicd10code(StringUtils.isNotEmpty(patMedInhosp1.getLeaveicd10code()) ? patMedInhosp1.getLeaveicd10code() + "," + hospPatientDiagnoseInfos2.get(0).getZhenDuanID() : hospPatientDiagnoseInfos2.get(0).getZhenDuanID());
            patMedInhosp1.setLeavediagname(StringUtils.isNotEmpty(patMedInhosp1.getLeavediagname()) ? patMedInhosp1.getLeavediagname() + "," + hospPatientDiagnoseInfos2.get(0).getZhenDuanMC() : hospPatientDiagnoseInfos2.get(0).getZhenDuanMC());
        patMedInhosp1.setDiagname(StringUtils.isNotEmpty(patMedInhosp1.getLeavediagname()) ? patMedInhosp1.getLeavediagname() + "," + hospPatientDiagnoseInfos2.get(0).getZhenDuanMC() : hospPatientDiagnoseInfos2.get(0).getZhenDuanMC());
        patMedInhosp1.setIcd10code(StringUtils.isNotEmpty(patMedInhosp1.getLeavediagname()) ? patMedInhosp1.getLeavediagname() + "," + hospPatientDiagnoseInfos2.get(0).getZhenDuanMC() : hospPatientDiagnoseInfos2.get(0).getZhenDuanMC());
            patMedInhosp1.setInhospstate("1");
        if (CollectionUtils.isNotEmpty(patMedInhospList)) {
            patMedInhosp1.setUpdateTime(new Date());
            patMedInhosp1.setOrgid(BingRenXX.get("ZuZhiJGID").toString());
            int i = patMedInhospMapper.updatePatMedInhosp(patMedInhosp1);
            if (i != 1) return false;
        } else {
            patMedInhosp1.setHospitalname(BingRenXX.get("ZuZhiJGMC").toString());
            patMedInhosp1.setHospitalcode(BingRenXX.get("ZuZhiJGID").toString());
            patMedInhosp1.setLeavehospitaldistrictname(BingRenXX.get("DangQianBQMC").toString());
            patMedInhosp1.setLeavehospitaldistrictcode(BingRenXX.get("DangQianBQID").toString());
            patMedInhosp1.setPatid(patArchive.getId());
            patMedInhosp1.setPatname(patArchive.getName());
            patMedInhosp1.setOrgid(BingRenXX.get("ZuZhiJGID").toString());
            patMedInhosp1.setPatno(BingRenXX.get("BingRenID").toString());
            patMedInhosp1.setInhospno(BingRenXX.get("ZhuYuanHao").toString());
            patMedInhosp1.setSerialnum(BingRenXX.get("BingAnHao").toString());
            patMedInhosp1.setCreateTime(new Date());
            int i = patMedInhospMapper.insertPatMedInhosp(patMedInhosp1);
            if (i != 1) return false;
        }
        return true;
    }