From 6994c4ae328dc6e41ab98f183774c7ffdc9b5dbf Mon Sep 17 00:00:00 2001 From: zhs <zhs18203887318@163.com> Date: 星期三, 16 四月 2025 17:48:41 +0800 Subject: [PATCH] 04-16改数据采集-入科 --- smartor/src/main/java/com/smartor/service/impl/ServiceExternalServiceImpl.java | 143 +++++++++++++++++++++++++++++++++++++++++------ 1 files changed, 123 insertions(+), 20 deletions(-) diff --git a/smartor/src/main/java/com/smartor/service/impl/ServiceExternalServiceImpl.java b/smartor/src/main/java/com/smartor/service/impl/ServiceExternalServiceImpl.java index 90b5937..b7f2ec5 100644 --- a/smartor/src/main/java/com/smartor/service/impl/ServiceExternalServiceImpl.java +++ b/smartor/src/main/java/com/smartor/service/impl/ServiceExternalServiceImpl.java @@ -254,6 +254,58 @@ } @Override + public Boolean addInDeptInfo(Map dataMap) { + log.error("ServiceExternalServiceImpl---addInDeptInfo鐨勬柊澧炵殑鍊间负锛歿}", dataMap); + Map yeWuXX = (Map) dataMap.get("YeWuXX"); + +// 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); + externalInHospPatientInfo.setZeRenHSID(externalInDeptPatientInfo.getZeRenHSID()); + externalInHospPatientInfo.setZeRenHSXM(externalInDeptPatientInfo.getZeRenHSXM()); + 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; + ExternalInHospPatientDiagnoseInfo externalInHospPatientDiagnoseInfo = null; + List<ExternalInHospPatientAddrInfo> epai2 = epai.stream().map(map -> { + ExternalInHospPatientAddrInfo info = new ExternalInHospPatientAddrInfo(); + info.setDiZhiLX((String) map.get("DiZhiLX")); // 鍋囪瀛楁绫诲瀷鏄� Integer + info.setDiZhiXX((String) map.get("DiZhiXX")); + info.setShengFenDM((String) map.get("ShengFenDM")); + info.setShengFenMC((String) map.get("ShengFenMC")); + info.setShiDiQDM((String) map.get("ShiDiQDM")); + info.setShiDiQMC((String) map.get("ShiDiQMC")); + info.setXianQuDM((String) map.get("XianQuDM")); + info.setXianQuMC((String) map.get("XianQuMC")); + info.setXiangZhenDM((String) map.get("XiangZhenDM")); + info.setXiangZhenMC((String) map.get("XiangZhenMC")); + info.setCunJiDM((String) map.get("CunJiDM")); + info.setQiTaXX((String) map.get("QiTaXX")); + info.setYouBian((String) map.get("YouBian")); + return info; + }).collect(Collectors.toList()); + + + if (CollectionUtils.isNotEmpty(epai)) externalInHospPatientAddrInfo = epai2.get(0); + //鏂板鎮h�呭熀鏈俊鎭� + PatArchive patArchive = addPatArchive(externalInHospPatientInfo, externalInHospPatientAddrInfo, null); + //鏂板鎮h�呭叆闄俊鎭� + Boolean aBoolean = addPadInhospInfo(externalInHospPatientInfo, patArchive, externalInHospPatientDiagnoseInfo); + return aBoolean; + } + + @Override public Boolean cancelInHospInfo(Map dataMap) { log.error("ServiceExternalServiceImpl---cancelInHospInfo鐨勬柊澧炵殑鍊间负锛歿}", dataMap); Map yeWuXX = (Map) dataMap.get("YeWuXX"); @@ -261,6 +313,7 @@ ExternalInHospPatientInfo externalInHospPatientInfo = BeanUtil.mapToBean(BingRenXX, ExternalInHospPatientInfo.class, true); PatMedInhosp patMedInhosp = new PatMedInhosp(); patMedInhosp.setInhospno(externalInHospPatientInfo.getBingAnHao()); + patMedInhosp.setSerialnum(externalInHospPatientInfo.getJiuZhenYWID()); List<PatMedInhosp> patMedInhospList = patMedInhospMapper.selectPatMedInhospList(patMedInhosp); for (PatMedInhosp patMedInhosp1 : patMedInhospList) { String tagname = patMedInhospMapper.getTagnameBypatid(patMedInhosp1.getPatid()); @@ -333,6 +386,7 @@ PatMedInhosp patMedInhosp = new PatMedInhosp(); patMedInhosp.setInhospno(externalInHospPatientInfo.getBingAnHao()); + patMedInhosp.setSerialnum(externalInHospPatientInfo.getJiuZhenYWID()); List<PatMedInhosp> patMedInhospList = patMedInhospMapper.selectPatMedInhospList(patMedInhosp); for (PatMedInhosp patMedInhosp1 : patMedInhospList) { String tagname = patMedInhospMapper.getTagnameBypatid(patMedInhosp1.getPatid()); @@ -410,7 +464,7 @@ patMedInhosp1.setOrgid(ObjectUtils.isNotEmpty(BingRenXX.get("ZuZhiJGID")) ? BingRenXX.get("ZuZhiJGID").toString() : null); patMedInhosp1.setPatno(ObjectUtils.isNotEmpty(BingRenXX.get("BingRenID")) ? BingRenXX.get("BingRenID").toString() : null); patMedInhosp1.setInhospno(ObjectUtils.isNotEmpty(BingRenXX.get("BingAnHao")) ? BingRenXX.get("BingAnHao").toString() : null); - patMedInhosp1.setSerialnum(ObjectUtils.isNotEmpty(BingRenXX.get("BingAnHao")) ? BingRenXX.get("BingAnHao").toString() : null); + patMedInhosp1.setSerialnum(ObjectUtils.isNotEmpty(BingRenXX.get("JiuZhenYWID")) ? BingRenXX.get("JiuZhenYWID").toString() : null); } patMedInhosp1.setPatid(patArchive.getId()); patMedInhosp1.setPatname(patArchive.getName()); @@ -430,6 +484,7 @@ ExternalInHospPatientInfo externalInHospPatientInfo = BeanUtil.mapToBean(BingRenXX, ExternalInHospPatientInfo.class, true); PatMedInhosp patMedInhosp = new PatMedInhosp(); patMedInhosp.setInhospno(externalInHospPatientInfo.getBingAnHao()); + patMedInhosp.setSerialnum(externalInHospPatientInfo.getJiuZhenYWID()); List<PatMedInhosp> patMedInhospList = patMedInhospMapper.selectPatMedInhospList(patMedInhosp); for (PatMedInhosp patMedInhosp1 : patMedInhospList) { String tagname = patMedInhospMapper.getTagnameBypatid(patMedInhosp1.getPatid()); @@ -456,6 +511,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; @@ -476,6 +532,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()); } @@ -490,8 +547,11 @@ PatMedOuthosp patMedOuthosp = new PatMedOuthosp(); patMedOuthosp.setOuthospno(externalInHospPatientInfo.getBingAnHao()); - patMedOuthosp.setSerialnum(externalInHospPatientInfo.getBingAnHao()); + 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()); @@ -499,6 +559,7 @@ patMedOuthosp.setDeptcode(externalJZInfo.getJiuZhenKSID()); patMedOuthosp.setAdmitdate(externalJZInfo.getJiuZhenRQ()); patMedOuthosp.setOrgid(FaSongJGID); + patMedOuthosp.setHospitalname(FaSongJGMC); for (ExternalDiagnosisInfo externalDiagnosisInfo : externalDiagnosisInfoList) { if (externalDiagnosisInfo.getZhenDuanLBMC().equals("涓昏瘖鏂�")) { @@ -516,7 +577,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; } @@ -543,8 +613,8 @@ icd10.setGuid(externalDiseaseInfo.getZuZhiJGID()); icd10.setLastflag(externalDiseaseInfo.getMOJIBZ()); icd10.setChimedflag("" + externalDiseaseInfo.getZhongYiZDBZ()); + icd10.setUpdateTime(new Date()); if (CollectionUtils.isNotEmpty(icd10s)) { - icd10.setUpdateTime(new Date()); icd10.setIcdid(icd10s.get(0).getIcdid()); icd10Mapper.updateIcd10(icd10); } else { @@ -561,7 +631,7 @@ Map<String, Object> bqxx = ObjectUtils.isNotEmpty(yeWuXX) ? (Map<String, Object>) yeWuXX.get("BingQuXX") : null; ExternalWardArea externalWardArea = BeanUtil.mapToBean(bqxx, ExternalWardArea.class, true); SysDept sysDept = new SysDept(); - sysDept.setGuid(externalWardArea.getZuZhiJGID()); + sysDept.setOrgid(externalWardArea.getZuZhiJGID()); sysDept.setHisDeptId(externalWardArea.getBingQuID()); sysDept.setDeptName(externalWardArea.getBingQuMC()); @@ -571,19 +641,26 @@ sysDept.setDeptCode(externalWardArea.getBingQuID()); sysDept.setCreateBy(externalWardArea.getChuangJianRXM()); sysDept.setType(externalWardArea.getBingQuLXDM()); - sysDept.setCreateTime(externalWardArea.getCreateTime()); sysDept.setUpdateTime(externalWardArea.getUpdateTime()); sysDept.setUpdateBy(externalWardArea.getUpdateBy()); if (StringUtils.isNotEmpty(externalWardArea.getShiJianDM()) && externalWardArea.getShiJianDM().equals("3")) { sysDept.setStatus("1"); } if (StringUtils.isNotEmpty(externalWardArea.getShiJianDM()) && externalWardArea.getShiJianDM().equals("1")) { + sysDept.setCreateTime(externalWardArea.getCreateTime()); int i = sysDeptMapper.insertDept(sysDept); log.error("ServiceExternalServiceImpl---addWardAreaInfo鏄惁鏂板鎴愬姛锛歿}", i); } else { int i = sysDeptMapper.updateDept(sysDept); log.error("ServiceExternalServiceImpl---addWardAreaInfo鏄惁淇敼鎴愬姛锛歿}", i); } + return true; + } + + @Override + public Boolean addMedicalTeam(Map dataMap) { + log.error("ServiceExternalServiceImpl---addMedicalTeam鐨勬柊澧炵殑鍊间负锛歿}", dataMap); + return true; } @@ -662,7 +739,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()); @@ -698,7 +775,7 @@ ExternalOperationDetail info = new ExternalOperationDetail(); info.setShouShuMCID((String) map.get("ShouShuMCID")); info.setShouShuMC((String) map.get("ShouShuMC")); - info.setZhuShouSBZ((String) map.get("ZhuShouSBZ")); + info.setZhuShouSBZ(ObjectUtils.isNotEmpty(map.get("ZhuShouSBZ")) ? map.get("ZhuShouSBZ").toString() : null); info.setQieKouLBDM((String) map.get("QieKouLBDM")); info.setQieKouLBMC((String) map.get("QieKouLBMC")); info.setShouShuJBDM((String) map.get("ShouShuJBDM")); @@ -753,9 +830,12 @@ } } PatArchive patArchive = new PatArchive(); + //濡傛灉鏄垰鍑虹敓鐨勫皬瀛╁瓙锛屾槸娌℃湁韬唤璇佺殑锛屾�庝箞澶勭悊锛燂紵锛燂紵锛燂紵锛燂紵 patArchive.setIdcardno(externalInHospPatientInfo.getZhengJianHM()); patArchive.setOrgid(externalInHospPatientInfo.getZuZhiJGID()); - List<PatArchive> patArchives = patArchiveMapper.selectPatArchiveList(patArchive); + List<PatArchive> patArchives = null; + if (ObjectUtils.isNotEmpty(patArchive.getIdcardno())) + patArchives = patArchiveMapper.selectPatArchiveList(patArchive); patArchive.setPatientno(externalInHospPatientInfo.getJiuZhenKH()); patArchive.setBirthdate(parse); patArchive.setPatidHis(externalInHospPatientInfo.getBingRenID()); @@ -789,15 +869,13 @@ } 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.setCreateTime(new Date()); patArchive.setIdcardtype(externalInHospPatientInfo.getZhengJianLXMC()); + patArchive.setUpdateTime(new Date()); if (CollectionUtils.isNotEmpty(patArchives)) { //濡傛灉涓嶄负绌猴紝鐩存帴灏嗘煡璇㈠嚭鏉ョ殑瀵硅薄杩斿洖 PatArchive patArchive1 = patArchives.get(0); @@ -807,6 +885,7 @@ patArchiveMapper.updatePatArchive(patArchive); } } else { + patArchive.setCreateTime(new Date()); patArchiveMapper.insertPatArchiveSingle(patArchive); } //鏂板睘淇℃伅 @@ -835,10 +914,12 @@ //鏂板鎮h�呭叆闄俊鎭� private Boolean addPadInhospInfo(ExternalInHospPatientInfo externalInHospPatientInfo, PatArchive patArchive, ExternalInHospPatientDiagnoseInfo externalInHospPatientDiagnoseInfo) { PatMedInhosp patMedInhosp = new PatMedInhosp(); + List<PatMedInhosp> patMedInhospList = null; if (ObjectUtils.isNotEmpty(externalInHospPatientInfo)) { //鍖婚櫌閭h竟璇磋鐢ㄧ梾妗堝彿锛屼笉瑕佺敤浣忛櫌鍙� patMedInhosp.setInhospno(externalInHospPatientInfo.getBingAnHao()); - patMedInhosp.setSerialnum(externalInHospPatientInfo.getZhuYuanHao()); + patMedInhosp.setSerialnum(externalInHospPatientInfo.getJiuZhenYWID()); + patMedInhospList = patMedInhospMapper.selectPatMedInhospList(patMedInhosp); patMedInhosp.setHospitalname(externalInHospPatientInfo.getZuZhiJGMC()); patMedInhosp.setHospitalcode(externalInHospPatientInfo.getZuZhiJGID()); patMedInhosp.setStarttime(externalInHospPatientInfo.getRuYuanSJ()); @@ -846,6 +927,7 @@ patMedInhosp.setLeaveldeptcode(externalInHospPatientInfo.getDangQianKSID()); patMedInhosp.setDeptname(externalInHospPatientInfo.getDangQianKSMC()); patMedInhosp.setLeaveldeptname(externalInHospPatientInfo.getDangQianKSMC()); + //杩欓噷鏄簥浣嶅悕绉拌繕鏄簥浣嶇紪鍙凤紵锛燂紵锛� patMedInhosp.setBedNo(externalInHospPatientInfo.getDangQianCWID()); patMedInhosp.setOrgid(externalInHospPatientInfo.getZuZhiJGID()); patMedInhosp.setHospitaldistrictid(externalInHospPatientInfo.getDangQianBQID()); @@ -858,11 +940,18 @@ patMedInhosp.setHospitaldistrictname(externalInHospPatientInfo.getDangQianBQMC()); patMedInhosp.setLeavehospitaldistrictname(externalInHospPatientInfo.getDangQianBQMC()); patMedInhosp.setTelcode(patArchive.getTelcode()); - patMedInhosp.setDrname(""); + patMedInhosp.setDrname(externalInHospPatientInfo.getZhuZhiYSXM()); + patMedInhosp.setDrcode(externalInHospPatientInfo.getZhuZhiYSID()); + patMedInhosp.setNurseId(externalInHospPatientInfo.getZeRenHSID()); + patMedInhosp.setNurseName(externalInHospPatientInfo.getZeRenHSXM()); } if (ObjectUtils.isNotEmpty(externalInHospPatientDiagnoseInfo)) { - patMedInhosp.setIcd10code(StringUtils.isNotEmpty(patMedInhosp.getIcd10code()) ? patMedInhosp.getIcd10code() + "," + externalInHospPatientDiagnoseInfo.getZhenDuanID() : externalInHospPatientDiagnoseInfo.getZhenDuanID()); - patMedInhosp.setDiagname(StringUtils.isNotEmpty(patMedInhosp.getDiagname()) ? patMedInhosp.getDiagname() + "," + externalInHospPatientDiagnoseInfo.getZhenDuanMC() : externalInHospPatientDiagnoseInfo.getZhenDuanMC()); +// patMedInhosp.setIcd10code(StringUtils.isNotEmpty(patMedInhosp.getIcd10code()) ? patMedInhosp.getIcd10code() + "," + externalInHospPatientDiagnoseInfo.getZhenDuanID() : externalInHospPatientDiagnoseInfo.getZhenDuanID()); +// patMedInhosp.setDiagname(StringUtils.isNotEmpty(patMedInhosp.getDiagname()) ? patMedInhosp.getDiagname() + "," + externalInHospPatientDiagnoseInfo.getZhenDuanMC() : externalInHospPatientDiagnoseInfo.getZhenDuanMC()); + + patMedInhosp.setIcd10code(externalInHospPatientDiagnoseInfo.getZhenDuanID()); + patMedInhosp.setDiagname(externalInHospPatientDiagnoseInfo.getZhenDuanMC()); + } if (ObjectUtils.isNotEmpty(patArchive)) { @@ -871,9 +960,17 @@ patMedInhosp.setPatname(patArchive.getName()); patMedInhosp.setSchemestatus(1L); - patMedInhosp.setCreateTime(new Date()); + } - int i = patMedInhospMapper.insertPatMedInhosp(patMedInhosp); + patMedInhosp.setUpdateTime(new Date()); + int i = 1; + if (CollectionUtils.isNotEmpty(patMedInhospList)) { + patMedInhosp.setInhospid(patMedInhospList.get(0).getInhospid()); + i = patMedInhospMapper.updatePatMedInhosp(patMedInhosp); + } else { + patMedInhosp.setCreateTime(new Date()); + i = patMedInhospMapper.insertPatMedInhosp(patMedInhosp); + } if (i == 1) return true; return false; } @@ -997,8 +1094,14 @@ log.error("鍙栨秷鍑洪櫌鍏ュ弬绫诲瀷涓猴細{}", type); return cancelOutHospInfo(dataMap); case "JG_ZZ_BingQu": - log.error("鐥呭尯淇℃伅鍏ュ弬绫诲瀷涓鸿緟锛歿}", type); + log.error("鐥呭尯淇℃伅鍏ュ弬绫诲瀷涓猴細{}", type); return addWardAreaInfo(dataMap); + case "JG_ZZ_YiLiaoZYS": + log.error("鍖荤枟缁勫尰鐢熶负锛歿}", type); + return addMedicalTeam(dataMap); + case "JZ_ZY_RuKe": + log.error("鍏ョ鐨勬暟鎹负锛歿}", type); + return addInDeptInfo(dataMap); } return true; } -- Gitblit v1.9.3