| | |
| | | import cn.hutool.core.bean.BeanUtil; |
| | | import com.ruoyi.common.core.domain.entity.SysDept; |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | import com.ruoyi.common.exception.base.BaseException; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.smartor.domain.*; |
| | | import com.smartor.mapper.*; |
| | | import com.smartor.service.IServiceExternalService; |
| | | import com.smartor.service.IServiceSubtaskService; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.collections4.CollectionUtils; |
| | | import org.apache.commons.lang3.ObjectUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.LocalDate; |
| | | import java.time.Period; |
| | | import java.time.ZoneId; |
| | | import java.time.temporal.ChronoUnit; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | |
| | | private BaseOrganizationMapper baseOrganizationMapper; |
| | | @Autowired |
| | | private PatArchiveMapper patArchiveMapper; |
| | | @Autowired |
| | | private PatArchivecontactMapper patArchivecontactMapper; |
| | | @Autowired |
| | | private PatMedInhospMapper patMedInhospMapper; |
| | | @Autowired |
| | |
| | | Map yeWuXX = (Map) dataMap.get("YeWuXX"); |
| | | Map<String, Object> keShiXX = (Map<String, Object>) yeWuXX.get("KeShiXX"); |
| | | ExternalDept externalDept = BeanUtil.mapToBean(keShiXX, ExternalDept.class, true); |
| | | if (ObjectUtils.isEmpty(externalDept)) { |
| | | throw new BaseException("externalDept是空的,没有数据!!!"); |
| | | } |
| | | SysDept sysDept = new SysDept(); |
| | | sysDept.setOrgid(externalDept.getZuZhiJGID()); |
| | | sysDept.setHisDeptId(externalDept.getKeShiID()); |
| | |
| | | Map yeWuXX = (Map) dataMap.get("YeWuXX"); |
| | | Map<String, Object> yongHuXX = (Map<String, Object>) yeWuXX.get("YongHuXX"); |
| | | ExternalUserInfo externalUserInfo = BeanUtil.mapToBean(yongHuXX, ExternalUserInfo.class, true); |
| | | if (ObjectUtils.isEmpty(externalUserInfo)) { |
| | | throw new BaseException("externalUserInfo是空的,没有数据!!!"); |
| | | } |
| | | SysUser sysUser = new SysUser(); |
| | | sysUser.setGuid(externalUserInfo.getZuZhiJGID()); |
| | | sysUser.setUserName(externalUserInfo.getYongHuDLM()); |
| | |
| | | Map yeWuXX = (Map) dataMap.get("YeWuXX"); |
| | | Map<String, Object> ZuZhiJGXX = (Map<String, Object>) yeWuXX.get("ZuZhiJGXX"); |
| | | ExternalOrganInfo externalOrganInfo = BeanUtil.mapToBean(ZuZhiJGXX, ExternalOrganInfo.class, true); |
| | | if (ObjectUtils.isEmpty(externalOrganInfo)) { |
| | | throw new BaseException("externalOrganInfo是空的,没有数据!!!"); |
| | | } |
| | | BaseOrganization baseOrganization = new BaseOrganization(); |
| | | baseOrganization.setOrganizationID(externalOrganInfo.getZuZhiJGID()); |
| | | baseOrganization.setOrganizationName(externalOrganInfo.getZuZhiJGMC()); |
| | |
| | | public Boolean addInHospInfo(Map dataMap) { |
| | | log.error("ServiceExternalServiceImpl---addInHospInfo的新增的值为:{}", dataMap); |
| | | Map yeWuXX = (Map) dataMap.get("YeWuXX"); |
| | | List<HashMap<String, Object>> epai = (List<HashMap<String, Object>>) yeWuXX.get("DiZhiXXList"); |
| | | List<HashMap<String, Object>> epli = (List<HashMap<String, Object>>) yeWuXX.get("LianXiRList"); |
| | | List<HashMap<String, Object>> hospPatientDiagnoseInfos = (List<HashMap<String, Object>>) yeWuXX.get("ZhenDuanList"); |
| | | Map<String, Object> BingRenXX = (Map<String, Object>) yeWuXX.get("BingRenXX"); |
| | | 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; |
| | | ExternalInHospPatientInfo externalInHospPatientInfo = BeanUtil.mapToBean(BingRenXX, ExternalInHospPatientInfo.class, true); |
| | | ExternalInHospPatientAddrInfo externalInHospPatientAddrInfo = null; |
| | | ExternalInHospPatientLiaisonInfo externalInHospPatientLiaisonInfo = null; |
| | |
| | | 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.setIcd10((String) map.get("Icd10")); |
| | | info.setZhenDuanMC((String) map.get("ZhenDuanMC")); |
| | | return info; |
| | | }).collect(Collectors.toList()); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public Boolean addInDeptInfo(Map dataMap) { |
| | | log.error("ServiceExternalServiceImpl---addInDeptInfo的新增的值为:{}", dataMap); |
| | | Map yeWuXX = (Map) dataMap.get("YeWuXX"); |
| | | 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); |
| | | //新增患者基本信息 |
| | | PatArchive patArchive = addPatArchive(externalInHospPatientInfo, externalInHospPatientAddrInfo, null); |
| | | //新增患者入院信息 |
| | | 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"); |
| | | Map<String, Object> BingRenXX = (Map<String, Object>) yeWuXX.get("BingRenXX"); |
| | | Map<String, Object> BingRenXX = ObjectUtils.isNotEmpty(yeWuXX) ? (Map<String, Object>) yeWuXX.get("BingRenXX") : null; |
| | | ExternalInHospPatientInfo externalInHospPatientInfo = BeanUtil.mapToBean(BingRenXX, ExternalInHospPatientInfo.class, true); |
| | | PatMedInhosp patMedInhosp = new PatMedInhosp(); |
| | | patMedInhosp.setInhospno(externalInHospPatientInfo.getZhuYuanHao()); |
| | | patMedInhosp.setInhospno(externalInHospPatientInfo.getBingAnHao()); |
| | | patMedInhosp.setSerialnum(externalInHospPatientInfo.getJiuZhenYWID()); |
| | | List<PatMedInhosp> patMedInhospList = patMedInhospMapper.selectPatMedInhospList(patMedInhosp); |
| | | for (PatMedInhosp patMedInhosp1 : patMedInhospList) { |
| | | String tagname = patMedInhospMapper.getTagnameBypatid(patMedInhosp1.getPatid()); |
| | | patMedInhosp1.setTagname(tagname); |
| | | } |
| | | if (CollectionUtils.isNotEmpty(patMedInhospList)) { |
| | | Map<String, Object> JiuZhenXX = (Map<String, Object>) yeWuXX.get("JiuZhenXX"); |
| | | Map<String, Object> JiuZhenXX = ObjectUtils.isNotEmpty(yeWuXX) ? (Map<String, Object>) yeWuXX.get("JiuZhenXX") : null; |
| | | PatMedInhosp patMedInhosp1 = patMedInhospList.get(0); |
| | | patMedInhosp1.setSchemestatus(3L); |
| | | patMedInhosp1.setDelFlag("1"); |
| | | patMedInhosp1.setOperator(JiuZhenXX.get("CaoZuoRXM").toString()); |
| | | patMedInhosp1.setOperatorId(JiuZhenXX.get("CaoZuoRID").toString()); |
| | | if (ObjectUtils.isNotEmpty(JiuZhenXX)) { |
| | | patMedInhosp1.setOperator(ObjectUtils.isNotEmpty(JiuZhenXX.get("CaoZuoRXM")) ? JiuZhenXX.get("CaoZuoRXM").toString() : null); |
| | | patMedInhosp1.setOperatorId(ObjectUtils.isNotEmpty(JiuZhenXX.get("CaoZuoRID")) ? JiuZhenXX.get("CaoZuoRID").toString() : null); |
| | | } |
| | | patMedInhosp1.setUpdateTime(new Date()); |
| | | int i = patMedInhospMapper.updatePatMedInhosp(patMedInhosp1); |
| | | if (i != 1) return false; |
| | |
| | | public Boolean addOutHospInfo(Map dataMap) { |
| | | 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>>) BingRenXX.get("DiZhiXXList"); |
| | | List<HashMap<String, Object>> epli = (List<HashMap<String, Object>>) yeWuXX.get("LianXiRList"); |
| | | Map<String, Object> BingRenXX = ObjectUtils.isNotEmpty(yeWuXX) ? (Map<String, Object>) yeWuXX.get("BingRenXX") : null; |
| | | Map<String, Object> ChuYuanJL = ObjectUtils.isNotEmpty(yeWuXX) ? (Map<String, Object>) yeWuXX.get("ChuYuanJL") : null; |
| | | List<HashMap<String, Object>> epai = ObjectUtils.isNotEmpty(BingRenXX) ? (List<HashMap<String, Object>>) BingRenXX.get("DiZhiXXList") : null; |
| | | List<HashMap<String, Object>> epli = ObjectUtils.isNotEmpty(yeWuXX) ? (List<HashMap<String, Object>>) yeWuXX.get("LianXiRList") : null; |
| | | Map<String, Object> SuiFangJH = ObjectUtils.isNotEmpty(ChuYuanJL) ? (Map<String, Object>) ChuYuanJL.get("SuiFangJH") : null; |
| | | |
| | | ExternalInHospPatientInfo externalInHospPatientInfo = BeanUtil.mapToBean(BingRenXX, ExternalInHospPatientInfo.class, true); |
| | | ExternalInHospPatientAddrInfo externalInHospPatientAddrInfo = null; |
| | | ExternalInHospPatientLiaisonInfo externalInHospPatientLiaisonInfo = null; |
| | |
| | | PatArchive patArchive = addPatArchive(externalInHospPatientInfo, externalInHospPatientAddrInfo, externalInHospPatientLiaisonInfo); |
| | | |
| | | PatMedInhosp patMedInhosp = new PatMedInhosp(); |
| | | patMedInhosp.setInhospno(externalInHospPatientInfo.getZhuYuanHao()); |
| | | patMedInhosp.setInhospno(externalInHospPatientInfo.getBingAnHao()); |
| | | patMedInhosp.setSerialnum(externalInHospPatientInfo.getJiuZhenYWID()); |
| | | List<PatMedInhosp> patMedInhospList = patMedInhospMapper.selectPatMedInhospList(patMedInhosp); |
| | | |
| | | Map<String, Object> JiuZhenXX = (Map<String, Object>) yeWuXX.get("JiuZhenXX"); |
| | | for (PatMedInhosp patMedInhosp1 : patMedInhospList) { |
| | | String tagname = patMedInhospMapper.getTagnameBypatid(patMedInhosp1.getPatid()); |
| | | patMedInhosp1.setTagname(tagname); |
| | | } |
| | | Map<String, Object> JiuZhenXX = ObjectUtils.isNotEmpty(yeWuXX) ? (Map<String, Object>) yeWuXX.get("JiuZhenXX") : null; |
| | | PatMedInhosp patMedInhosp1 = new PatMedInhosp(); |
| | | if (CollectionUtils.isNotEmpty(patMedInhospList)) patMedInhosp1 = patMedInhospList.get(0); |
| | | patMedInhosp1.setSchemestatus(2L); |
| | |
| | | } catch (ParseException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | patMedInhosp1.setOperator(JiuZhenXX.get("CaoZuoRXM").toString()); |
| | | patMedInhosp1.setOperatorId(JiuZhenXX.get("CaoZuoRID").toString()); |
| | | if (ObjectUtils.isNotEmpty(JiuZhenXX)) { |
| | | patMedInhosp1.setOperator(ObjectUtils.isNotEmpty(JiuZhenXX.get("CaoZuoRXM")) ? JiuZhenXX.get("CaoZuoRXM").toString() : null); |
| | | patMedInhosp1.setOperatorId(ObjectUtils.isNotEmpty(JiuZhenXX.get("CaoZuoRID")) ? JiuZhenXX.get("CaoZuoRID").toString() : null); |
| | | patMedInhosp1.setDrname(ObjectUtils.isNotEmpty(JiuZhenXX.get("ZhuZhiYSXM")) ? JiuZhenXX.get("ZhuZhiYSXM").toString() : null); |
| | | patMedInhosp1.setDrcode(ObjectUtils.isNotEmpty(JiuZhenXX.get("ZhuZhiYSID")) ? JiuZhenXX.get("ZhuZhiYSID").toString() : null); |
| | | patMedInhosp1.setNurseName(ObjectUtils.isNotEmpty(JiuZhenXX.get("ZeRenHSXM")) ? JiuZhenXX.get("ZeRenHSXM").toString() : null); |
| | | patMedInhosp1.setNurseId(ObjectUtils.isNotEmpty(JiuZhenXX.get("ZeRenHSID")) ? JiuZhenXX.get("ZeRenHSID").toString() : null); |
| | | patMedInhosp1.setBedNo(ObjectUtils.isNotEmpty(JiuZhenXX.get("DangQianCWMC")) ? JiuZhenXX.get("DangQianCWMC").toString() : null); |
| | | } |
| | | patMedInhosp1.setUpdateTime(new Date()); |
| | | patMedInhosp1.setTelcode(patArchive.getTelcode()); |
| | | patMedInhosp1.setLeavehospitaldistrictcode(externalInHospPatientInfo.getDangQianBQID()); |
| | |
| | | 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(); |
| | | info.setZhenDuanID((String) map.get("ZhenDuanID")); |
| | | info.setZhenDuanMC((String) map.get("ZhenDuanMC")); |
| | | return info; |
| | | }).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()); |
| | | |
| | | if (ObjectUtils.isNotEmpty(SuiFangJH)) { |
| | | patMedInhosp1.setFuflag(ObjectUtils.isNotEmpty(SuiFangJH.get("SuiFangBS")) ? SuiFangJH.get("SuiFangBS").toString() : null); |
| | | if (ObjectUtils.isNotEmpty(SuiFangJH.get("SuiFangRQ"))) { |
| | | try { |
| | | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | patMedInhosp1.setFudate(simpleDateFormat.parse(SuiFangJH.get("SuiFangRQ").toString())); |
| | | } catch (ParseException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | patMedInhosp1.setFuperiod(ObjectUtils.isNotEmpty(SuiFangJH.get("SuiFangZQJY")) ? SuiFangJH.get("SuiFangZQJY").toString() : null); |
| | | patMedInhosp1.setFutypecode(ObjectUtils.isNotEmpty(SuiFangJH.get("SuiFangFSDM")) ? SuiFangJH.get("SuiFangFSDM").toString() : null); |
| | | patMedInhosp1.setFutypedesc(ObjectUtils.isNotEmpty(SuiFangJH.get("SuiFangFSMC")) ? SuiFangJH.get("SuiFangFSMC").toString() : null); |
| | | patMedInhosp1.setFuadvice(ObjectUtils.isNotEmpty(SuiFangJH.get("FuZhenZD")) ? SuiFangJH.get("FuZhenZD").toString() : null); |
| | | patMedInhosp1.setFuspecialadvice(ObjectUtils.isNotEmpty(SuiFangJH.get("QiTaZKJBSF")) ? SuiFangJH.get("QiTaZKJBSF").toString() : null); |
| | | } |
| | | |
| | | List<HashMap<String, Object>> zhenDuanList = ObjectUtils.isNotEmpty(yeWuXX) ? (List<HashMap<String, Object>>) yeWuXX.get("ZhenDuanList") : null; |
| | | if (CollectionUtils.isNotEmpty(zhenDuanList)) { |
| | | List<ExternalInHospPatientDiagnoseInfo> hospPatientDiagnoseInfos2 = zhenDuanList.stream().map(map -> { |
| | | ExternalInHospPatientDiagnoseInfo info = new ExternalInHospPatientDiagnoseInfo(); |
| | | info.setZhenDuanID((String) map.get("ZhenDuanID")); |
| | | info.setZhenDuanMC((String) map.get("ZhenDuanMC")); |
| | | info.setIcd10((String) map.get("Icd10")); |
| | | return info; |
| | | }).collect(Collectors.toList()); |
| | | patMedInhosp1.setLeaveicd10code(StringUtils.isNotEmpty(patMedInhosp1.getLeaveicd10code()) ? patMedInhosp1.getLeaveicd10code() + "," + hospPatientDiagnoseInfos2.get(0).getIcd10() : hospPatientDiagnoseInfos2.get(0).getIcd10()); |
| | | 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.setLeavediagname(StringUtils.isNotEmpty(patMedInhosp1.getLeavediagname()) ? patMedInhosp1.getLeavediagname() : hospPatientDiagnoseInfos2.get(0).getZhenDuanMC()); |
| | | //patMedInhosp1.setDiagname(StringUtils.isNotEmpty(patMedInhosp1.getLeavediagname()) ? patMedInhosp1.getLeavediagname() : hospPatientDiagnoseInfos2.get(0).getZhenDuanMC()); |
| | | } |
| | | |
| | | patMedInhosp1.setInhospstate("1"); |
| | | if (CollectionUtils.isNotEmpty(patMedInhospList)) { |
| | | patMedInhosp1.setUpdateTime(new Date()); |
| | | patMedInhosp1.setOrgid(BingRenXX.get("ZuZhiJGID").toString()); |
| | | patMedInhosp1.setOrgid(ObjectUtils.isNotEmpty(BingRenXX) && ObjectUtils.isNotEmpty(BingRenXX.get("ZuZhiJGID")) ? BingRenXX.get("ZuZhiJGID").toString() : null); |
| | | 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()); |
| | | if (ObjectUtils.isNotEmpty(BingRenXX)) { |
| | | patMedInhosp1.setHospitalname(ObjectUtils.isNotEmpty(BingRenXX.get("ZuZhiJGMC")) ? BingRenXX.get("ZuZhiJGMC").toString() : null); |
| | | patMedInhosp1.setHospitalcode(ObjectUtils.isNotEmpty(BingRenXX.get("ZuZhiJGID")) ? BingRenXX.get("ZuZhiJGID").toString() : null); |
| | | patMedInhosp1.setLeavehospitaldistrictname(ObjectUtils.isNotEmpty(BingRenXX.get("DangQianBQMC")) ? BingRenXX.get("DangQianBQMC").toString() : null); |
| | | patMedInhosp1.setLeavehospitaldistrictcode(ObjectUtils.isNotEmpty(BingRenXX.get("DangQianBQID")) ? BingRenXX.get("DangQianBQID").toString() : null); |
| | | 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("JiuZhenYWID")) ? BingRenXX.get("JiuZhenYWID").toString() : null); |
| | | } |
| | | 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; |
| | |
| | | public Boolean cancelOutHospInfo(Map dataMap) { |
| | | log.error("ServiceExternalServiceImpl---cancelOutHospInfo的新增的值为:{}", dataMap); |
| | | Map yeWuXX = (Map) dataMap.get("YeWuXX"); |
| | | Map<String, Object> BingRenXX = (Map<String, Object>) yeWuXX.get("BingRenXX"); |
| | | Map<String, Object> BingRenXX = ObjectUtils.isNotEmpty(yeWuXX) ? (Map<String, Object>) yeWuXX.get("BingRenXX") : null; |
| | | ExternalInHospPatientInfo externalInHospPatientInfo = BeanUtil.mapToBean(BingRenXX, ExternalInHospPatientInfo.class, true); |
| | | PatMedInhosp patMedInhosp = new PatMedInhosp(); |
| | | patMedInhosp.setInhospno(externalInHospPatientInfo.getZhuYuanHao()); |
| | | patMedInhosp.setInhospno(externalInHospPatientInfo.getBingAnHao()); |
| | | patMedInhosp.setSerialnum(externalInHospPatientInfo.getJiuZhenYWID()); |
| | | List<PatMedInhosp> patMedInhospList = patMedInhospMapper.selectPatMedInhospList(patMedInhosp); |
| | | for (PatMedInhosp patMedInhosp1 : patMedInhospList) { |
| | | String tagname = patMedInhospMapper.getTagnameBypatid(patMedInhosp1.getPatid()); |
| | | patMedInhosp1.setTagname(tagname); |
| | | } |
| | | if (CollectionUtils.isNotEmpty(patMedInhospList)) { |
| | | Map<String, Object> JiuZhenXX = (Map<String, Object>) yeWuXX.get("JiuZhenXX"); |
| | | Map<String, Object> JiuZhenXX = ObjectUtils.isNotEmpty(yeWuXX) ? (Map<String, Object>) yeWuXX.get("JiuZhenXX") : null; |
| | | PatMedInhosp patMedInhosp1 = patMedInhospList.get(0); |
| | | patMedInhosp1.setSchemestatus(4L); |
| | | patMedInhosp1.setOperator(JiuZhenXX.get("CaoZuoRXM").toString()); |
| | | patMedInhosp1.setOperatorId(JiuZhenXX.get("CaoZuoRID").toString()); |
| | | if (ObjectUtils.isNotEmpty(JiuZhenXX)) { |
| | | patMedInhosp1.setOperator(ObjectUtils.isNotEmpty(JiuZhenXX.get("CaoZuoRXM")) ? JiuZhenXX.get("CaoZuoRXM").toString() : null); |
| | | patMedInhosp1.setOperatorId(ObjectUtils.isNotEmpty(JiuZhenXX.get("CaoZuoRXM")) ? JiuZhenXX.get("CaoZuoRID").toString() : null); |
| | | } |
| | | patMedInhosp1.setUpdateTime(new Date()); |
| | | int i = patMedInhospMapper.updatePatMedInhosp(patMedInhosp1); |
| | | if (i != 1) return false; |
| | |
| | | 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 = (Map<String, Object>) yeWuXX.get("BingRenXX"); |
| | | Map<String, Object> JiuZhenXX = (Map<String, Object>) yeWuXX.get("JiuZhenXX"); |
| | | List<HashMap<String, Object>> ZhenDuanList = (List<HashMap<String, Object>>) yeWuXX.get("ZhenDuanList"); |
| | | List<HashMap<String, Object>> externalWZInfos = (List<HashMap<String, Object>>) yeWuXX.get("WenZhenList"); |
| | | 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; |
| | | List<HashMap<String, Object>> ZhenDuanList = ObjectUtils.isNotEmpty(yeWuXX) ? (List<HashMap<String, Object>>) yeWuXX.get("ZhenDuanList") : null; |
| | | List<HashMap<String, Object>> externalWZInfos = ObjectUtils.isNotEmpty(yeWuXX) ? (List<HashMap<String, Object>>) yeWuXX.get("WenZhenList") : null; |
| | | ExternalInHospPatientInfo externalInHospPatientInfo = BeanUtil.mapToBean(BingRenXX, ExternalInHospPatientInfo.class, true); |
| | | //病人信息里没有组织机构ID |
| | | externalInHospPatientInfo.setZuZhiJGID(FaSongJGID); |
| | | |
| | | ExternalJZInfo externalJZInfo = BeanUtil.mapToBean(JiuZhenXX, ExternalJZInfo.class, true); |
| | | List<ExternalDiagnosisInfo> externalDiagnosisInfoList = ZhenDuanList.stream().map(map -> { |
| | | ExternalDiagnosisInfo info = new ExternalDiagnosisInfo(); |
| | | info.setZhenDuanYSID((String) map.get("ZhenDuanYSID")); |
| | | info.setZhenDuanYSXM((String) map.get("ZhenDuanYSXM")); |
| | | info.setZhenDuanID((String) map.get("ZhenDuanID")); |
| | | info.setZhenDuanMC((String) map.get("ZhenDuanMC")); |
| | | info.setZhenDuanLBDM((String) map.get("ZhenDuanLBDM")); |
| | | info.setZhenDuanLBMC((String) map.get("ZhenDuanLBMC")); |
| | | return info; |
| | | }).collect(Collectors.toList()); |
| | | |
| | | List<ExternalDiagnosisInfo> externalDiagnosisInfoList = null; |
| | | if (CollectionUtils.isNotEmpty(ZhenDuanList)) { |
| | | externalDiagnosisInfoList = ZhenDuanList.stream().map(map -> { |
| | | ExternalDiagnosisInfo info = new ExternalDiagnosisInfo(); |
| | | info.setZhenDuanYSID((String) map.get("ZhenDuanYSID")); |
| | | info.setZhenDuanYSXM((String) map.get("ZhenDuanYSXM")); |
| | | info.setZhenDuanID((String) map.get("ZhenDuanID")); |
| | | 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()); |
| | | } |
| | | List<ExternalWZInfo> ExternalWZInfoList = externalWZInfos.stream().map(map -> { |
| | | ExternalWZInfo info = new ExternalWZInfo(); |
| | | info.setWenZhenLXMC((String) map.get("WenZhenLXMC")); |
| | |
| | | |
| | | 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()); |
| | |
| | | patMedOuthosp.setDeptcode(externalJZInfo.getJiuZhenKSID()); |
| | | patMedOuthosp.setAdmitdate(externalJZInfo.getJiuZhenRQ()); |
| | | patMedOuthosp.setOrgid(FaSongJGID); |
| | | patMedOuthosp.setHospitalname(FaSongJGMC); |
| | | |
| | | for (ExternalDiagnosisInfo externalDiagnosisInfo : externalDiagnosisInfoList) { |
| | | if (externalDiagnosisInfo.getZhenDuanLBMC().equals("主诊断")) { |
| | | patMedOuthosp.setDiagname(externalDiagnosisInfo.getZhenDuanMC()); |
| | | patMedOuthosp.setIcd10code(externalDiagnosisInfo.getZhenDuanID()); |
| | | patMedOuthosp.setDrcode(externalDiagnosisInfo.getZhenDuanYSID()); |
| | | patMedOuthosp.setDrname(externalDiagnosisInfo.getZhenDuanYSXM()); |
| | | patMedOuthosp.setIcd10code(externalDiagnosisInfo.getIcd10()); |
| | |
| | | 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; |
| | | } |
| | |
| | | public Boolean addDiseaseInfo(Map dataMap) { |
| | | log.error("ServiceExternalServiceImpl---addDiseaseInfo的新增的值为:{}", dataMap); |
| | | Map yeWuXX = (Map) dataMap.get("YeWuXX"); |
| | | Map<String, Object> JiBing = (Map<String, Object>) yeWuXX.get("JiBingMLXX"); |
| | | Map<String, Object> JiBing = ObjectUtils.isNotEmpty(yeWuXX) ? (Map<String, Object>) yeWuXX.get("JiBingMLXX") : null; |
| | | ExternalDiseaseInfo externalDiseaseInfo = BeanUtil.mapToBean(JiBing, ExternalDiseaseInfo.class, true); |
| | | Map XiaoXiTou = (Map) dataMap.get("XiaoXiTou"); |
| | | String FaSongJGID = XiaoXiTou.get("FaSongJGID").toString(); |
| | | String FaSongJGID = ObjectUtils.isNotEmpty(XiaoXiTou) && ObjectUtils.isNotEmpty(XiaoXiTou.get("FaSongJGID")) ? XiaoXiTou.get("FaSongJGID").toString() : null; |
| | | Icd10 icd10 = new Icd10(); |
| | | icd10.setIcdcode(externalDiseaseInfo.getIcD10()); |
| | | icd10.setDelFlag("0"); |
| | |
| | | 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 { |
| | |
| | | public Boolean addWardAreaInfo(Map dataMap) { |
| | | log.error("ServiceExternalServiceImpl---addWardAreaInfo的新增的值为:{}", dataMap); |
| | | Map yeWuXX = (Map) dataMap.get("YeWuXX"); |
| | | Map<String, Object> bqxx = (Map<String, Object>) yeWuXX.get("BingQuXX"); |
| | | 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()); |
| | |
| | | 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 { |
| | |
| | | } |
| | | |
| | | @Override |
| | | public Boolean addMedicalTeam(Map dataMap) { |
| | | log.error("ServiceExternalServiceImpl---addMedicalTeam的新增的值为:{}", dataMap); |
| | | |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | public Boolean addOperationInfo(Map dataMap) { |
| | | log.error("ServiceExternalServiceImpl---addOperationInfo的新增的值为:{}", dataMap); |
| | | |
| | | Map yeWuXX = (Map) dataMap.get("YeWuXX"); |
| | | Map<String, Object> BingRenXX = (Map<String, Object>) yeWuXX.get("BingRenXX"); |
| | | Map<String, Object> BingRenXX = ObjectUtils.isNotEmpty(yeWuXX) ? (Map<String, Object>) yeWuXX.get("BingRenXX") : null; |
| | | ExternalInHospPatientInfo externalInHospPatientInfo = BeanUtil.mapToBean(BingRenXX, ExternalInHospPatientInfo.class, true); |
| | | |
| | | PatArchive patArchive = addPatArchive(externalInHospPatientInfo, null, null); |
| | | |
| | | |
| | | //手术信息新增 |
| | | Map<String, Object> ssxx = (Map<String, Object>) yeWuXX.get("ShouShuSQ"); |
| | | Map<String, Object> ssxx = ObjectUtils.isNotEmpty(yeWuXX) ? (Map<String, Object>) yeWuXX.get("ShouShuSQ") : null; |
| | | //手术更新 |
| | | Map<String, Object> ssgx = (Map<String, Object>) yeWuXX.get("ShouShuGX"); |
| | | Map<String, Object> ssgx = ObjectUtils.isNotEmpty(yeWuXX) ? (Map<String, Object>) yeWuXX.get("ShouShuGX") : null; |
| | | //手术撤销 |
| | | Map<String, Object> sscx = (Map<String, Object>) yeWuXX.get("ShouShuCX"); |
| | | Map<String, Object> sscx = ObjectUtils.isNotEmpty(yeWuXX) ? (Map<String, Object>) yeWuXX.get("ShouShuCX") : null; |
| | | ExternalOperationInfo externalOperationInfo = null; |
| | | if (ObjectUtils.isNotEmpty(ssxx)) |
| | | externalOperationInfo = BeanUtil.mapToBean(ssxx, ExternalOperationInfo.class, true); |
| | |
| | | patMedOperation.setPatid(patArchive.getId()); |
| | | patMedOperation.setPatcode(externalInHospPatientInfo.getBingRenID()); |
| | | patMedOperation.setPaname(externalInHospPatientInfo.getXingMing()); |
| | | // patMedOperation.setOpreqid(externalOperationInfo.getShenQingDID()); |
| | | patMedOperation.setOpreqcode(externalOperationInfo.getShenQingDID()); |
| | | //查询一下,该患者是否已经有这些数据 |
| | | List<PatMedOperation> patMedOperations = patMedOperationMapper.selectPatMedOperationList(patMedOperation); |
| | | |
| | | patMedOperation.setOpsstatus(null); |
| | | patMedOperation.setOptypecode(externalOperationInfo.getShouShuLBDM()); |
| | | patMedOperation.setOptypename(externalOperationInfo.getShouShuLBMC()); |
| | | patMedOperation.setOperatortime(externalOperationInfo.getYaoQiuSJ()); |
| | | patMedOperation.setOpreqtime(externalOperationInfo.getShenQingSJ()); |
| | | patMedOperation.setReqdoccode(externalOperationInfo.getShenQingYSID()); |
| | | patMedOperation.setReqdocname(externalOperationInfo.getShenQingYSXM()); |
| | | patMedOperation.setReqdeptcode(externalOperationInfo.getShenQingKSID()); |
| | | patMedOperation.setReqdeptname(externalOperationInfo.getShenQingKSMC()); |
| | | patMedOperation.setReqloccode(externalOperationInfo.getShouShuKSID()); |
| | | patMedOperation.setReqlocname(externalOperationInfo.getShouShuKSMC()); |
| | | patMedOperation.setSurgeoncode(externalOperationInfo.getZhuDaoYSID()); |
| | | patMedOperation.setSurgeonname(externalOperationInfo.getSanZhuYSXM()); |
| | | patMedOperation.setFirasscode(externalOperationInfo.getYiZhuID()); |
| | | patMedOperation.setFirassname(externalOperationInfo.getYiZhuMC()); |
| | | patMedOperation.setSecasscode(externalOperationInfo.getErZhuYSID()); |
| | | patMedOperation.setSecassname(externalOperationInfo.getErZhuYSXM()); |
| | | patMedOperation.setThrasscode(externalOperationInfo.getSanZhuYSID()); |
| | | patMedOperation.setThrassname(externalOperationInfo.getSanZhuYSXM()); |
| | | if (ObjectUtils.isNotEmpty(externalOperationInfo)) { |
| | | patMedOperation.setOptypecode(externalOperationInfo.getShouShuLBDM()); |
| | | patMedOperation.setOptypename(externalOperationInfo.getShouShuLBMC()); |
| | | patMedOperation.setOperatortime(externalOperationInfo.getYaoQiuSJ()); |
| | | patMedOperation.setOpreqtime(externalOperationInfo.getShenQingSJ()); |
| | | patMedOperation.setReqdoccode(externalOperationInfo.getShenQingYSID()); |
| | | patMedOperation.setReqdocname(externalOperationInfo.getShenQingYSXM()); |
| | | patMedOperation.setReqdeptcode(externalOperationInfo.getShenQingKSID()); |
| | | patMedOperation.setReqdeptname(externalOperationInfo.getShenQingKSMC()); |
| | | patMedOperation.setReqloccode(externalOperationInfo.getShouShuKSID()); |
| | | patMedOperation.setReqlocname(externalOperationInfo.getShouShuKSMC()); |
| | | patMedOperation.setSurgeoncode(externalOperationInfo.getZhuDaoYSID()); |
| | | patMedOperation.setSurgeonname(externalOperationInfo.getSanZhuYSXM()); |
| | | patMedOperation.setFirasscode(externalOperationInfo.getYiZhuID()); |
| | | patMedOperation.setFirassname(externalOperationInfo.getYiZhuMC()); |
| | | patMedOperation.setSecasscode(externalOperationInfo.getErZhuYSID()); |
| | | patMedOperation.setSecassname(externalOperationInfo.getErZhuYSXM()); |
| | | patMedOperation.setThrasscode(externalOperationInfo.getSanZhuYSID()); |
| | | patMedOperation.setThrassname(externalOperationInfo.getSanZhuYSXM()); |
| | | patMedOperation.setDeptid(externalOperationInfo.getShouShuKSID()); |
| | | patMedOperation.setDeptcode(externalOperationInfo.getShouShuKSID()); |
| | | patMedOperation.setDeptname(externalOperationInfo.getShouShuKSMC()); |
| | | patMedOperation.setDrcode(externalOperationInfo.getZhuDaoYSID()); |
| | | patMedOperation.setDrname(externalOperationInfo.getZhuDaoYSXM()); |
| | | } |
| | | patMedOperation.setCanceltime(null); |
| | | patMedOperation.setCancelreason(null); |
| | | patMedOperation.setCancelcode(null); |
| | |
| | | patMedOperation.setDelFlag("0"); |
| | | patMedOperation.setIsupload(null); |
| | | patMedOperation.setUploadTime(null); |
| | | patMedOperation.setOrgid(externalInHospPatientInfo.getZuZhiJGID()); |
| | | patMedOperation.setInhospstate(null); |
| | | patMedOperation.setPatno(externalInHospPatientInfo.getBingRenID()); |
| | | patMedOperation.setPatname(externalInHospPatientInfo.getXingMing()); |
| | | patMedOperation.setVisitid(null); |
| | | patMedOperation.setSerialnum(externalInHospPatientInfo.getZhuYuanHao()); |
| | | patMedOperation.setInhospno(externalInHospPatientInfo.getZhuYuanHao()); |
| | | patMedOperation.setHospitalname(externalInHospPatientInfo.getZuZhiJGMC()); |
| | | patMedOperation.setHospitalcode(externalInHospPatientInfo.getZuZhiJGID()); |
| | | patMedOperation.setDeptid(externalOperationInfo.getShouShuKSID()); |
| | | patMedOperation.setDeptcode(externalOperationInfo.getShouShuKSID()); |
| | | patMedOperation.setDeptname(externalOperationInfo.getShouShuKSMC()); |
| | | patMedOperation.setInhospstate(null); |
| | | if (ObjectUtils.isNotEmpty(externalInHospPatientInfo)) { |
| | | patMedOperation.setPatno(externalInHospPatientInfo.getBingRenID()); |
| | | patMedOperation.setPatname(externalInHospPatientInfo.getXingMing()); |
| | | patMedOperation.setOrgid(externalInHospPatientInfo.getZuZhiJGID()); |
| | | patMedOperation.setSerialnum(externalInHospPatientInfo.getJiuZhenYWID()); |
| | | patMedOperation.setInhospno(externalInHospPatientInfo.getBingAnHao()); |
| | | patMedOperation.setHospitalname(externalInHospPatientInfo.getZuZhiJGMC()); |
| | | patMedOperation.setHospitalcode(externalInHospPatientInfo.getZuZhiJGID()); |
| | | } |
| | | patMedOperation.setHospitaldistrictcode(null); |
| | | patMedOperation.setHospitaldistrictname(null); |
| | | patMedOperation.setRoomno(null); |
| | | patMedOperation.setBedNo(null); |
| | | patMedOperation.setDrcode(externalOperationInfo.getZhuDaoYSID()); |
| | | patMedOperation.setDrname(externalOperationInfo.getZhuDaoYSXM()); |
| | | |
| | | patMedOperation.setNurseId(null); |
| | | patMedOperation.setNurseName(null); |
| | | if (CollectionUtils.isNotEmpty(patMedOperations)) { |
| | |
| | | patMedOperation.setDelFlag("1"); |
| | | //同时去查询,是否在subtask中生成任务,如果生成出得立马删除 |
| | | } |
| | | patMedOperation.setUpdateTime(new Date()); |
| | | patMedOperationMapper.updatePatMedOperation(patMedOperation); |
| | | } else patMedOperationMapper.insertPatMedOperation(patMedOperation); |
| | | } else { |
| | | patMedOperation.setCreateTime(new Date()); |
| | | patMedOperationMapper.insertPatMedOperation(patMedOperation); |
| | | } |
| | | log.error("-----patMedOperation的主键id为:{}", patMedOperation.getId()); |
| | | |
| | | if (ObjectUtils.isNotEmpty(ssxx)) { |
| | | Map<String, Object> ShouShuMXList = (Map<String, Object>) ssxx.get("ShouShuMXList"); |
| | | List<ExternalOperationDetail> externalOperationDetails = BeanUtil.mapToBean(ShouShuMXList, List.class, true); |
| | | List<HashMap<String, Object>> ShouShuMXList = (List<HashMap<String, Object>>) ssxx.get("ShouShuMXList"); |
| | | |
| | | List<ExternalOperationDetail> externalOperationDetails = ObjectUtils.isNotEmpty(ShouShuMXList) ? ShouShuMXList.stream().map(map -> { |
| | | ExternalOperationDetail info = new ExternalOperationDetail(); |
| | | info.setShouShuMCID((String) map.get("ShouShuMCID")); |
| | | info.setShouShuMC((String) map.get("ShouShuMC")); |
| | | 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")); |
| | | info.setShouShuJBMC((String) map.get("ShouShuJBMC")); |
| | | info.setShouShuBW((String) map.get("ShouShuBW")); |
| | | info.setBiaoZhunBM((String) map.get("BiaoZhunBM")); |
| | | info.setShouShuMCQZ((String) map.get("ShouShuMCQZ")); |
| | | info.setShouShuMCHZ((String) map.get("ShouShuMCHZ")); |
| | | return info; |
| | | }).collect(Collectors.toList()) : null; |
| | | |
| | | //addMianTableFalg是否需要将主手术的信息放到PatMedOperation表中(只有第一个主手术信息需要放,后面的都不需要放了,也就是说,第一个放完后,就要把这个flag改成false) |
| | | Boolean addMianTableFalg = true; |
| | | for (ExternalOperationDetail externalOperationDetail : externalOperationDetails) { |
| | |
| | | patMedOperation.setOpcode(externalOperationDetail.getShouShuMCID()); |
| | | patMedOperation.setOpdesc(externalOperationDetail.getShouShuMC()); |
| | | // patMedOperation.setOpid(externalOperationDetail.getShouShuJBDM()); |
| | | patMedOperation.setUpdateTime(new Date()); |
| | | patMedOperationMapper.updatePatMedOperation(patMedOperation); |
| | | addMianTableFalg = false; |
| | | } |
| | | |
| | | patMedOperationItem.setCreateTime(new Date()); |
| | | patMedOperationItemMapper.insertPatMedOperationItem(patMedOperationItem); |
| | | } |
| | | } |
| | |
| | | |
| | | //新增患者基本信息 |
| | | private PatArchive addPatArchive(ExternalInHospPatientInfo externalInHospPatientInfo, ExternalInHospPatientAddrInfo externalInHospPatientAddrInfo, ExternalInHospPatientLiaisonInfo externalInHospPatientLiaisonInfo) { |
| | | Date parse = null; |
| | | String chuShengRQ = externalInHospPatientInfo.getChuShengRQ(); |
| | | if (StringUtils.isNotEmpty(chuShengRQ)) { |
| | | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); |
| | | try { |
| | | parse = simpleDateFormat.parse(chuShengRQ); |
| | | } catch (ParseException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | 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(externalInHospPatientInfo.getChuShengRQ()); |
| | | patArchive.setBirthdate(parse); |
| | | patArchive.setPatidHis(externalInHospPatientInfo.getBingRenID()); |
| | | patArchive.setSourcefrom(1); |
| | | patArchive.setPattype("2"); |
| | |
| | | patArchive.setSex(Long.valueOf(externalInHospPatientInfo.getXingBieDM())); |
| | | patArchive.setNation(externalInHospPatientInfo.getMinZuMC()); |
| | | patArchive.setNativePlace(externalInHospPatientInfo.getGuoJiMC()); |
| | | if (ObjectUtils.isNotEmpty(externalInHospPatientAddrInfo)) { |
| | | if (ObjectUtils.isNotEmpty(externalInHospPatientInfo.getXianZhuZXX())) { |
| | | patArchive.setPlaceOfResidence(externalInHospPatientInfo.getXianZhuZXX()); |
| | | } else if (ObjectUtils.isNotEmpty(externalInHospPatientAddrInfo)) { |
| | | String por = null; |
| | | if (StringUtils.isNotEmpty(externalInHospPatientAddrInfo.getDiZhiXX())) { |
| | | por = externalInHospPatientAddrInfo.getDiZhiXX(); |
| | |
| | | por = externalInHospPatientAddrInfo.getShengFenMC() + externalInHospPatientAddrInfo.getShiDiQMC() + externalInHospPatientAddrInfo.getXianQuMC() + externalInHospPatientAddrInfo.getXiangZhenMC() + externalInHospPatientAddrInfo.getCunJiMC() + externalInHospPatientAddrInfo.getQiTaXX(); |
| | | } |
| | | patArchive.setPlaceOfResidence(por.replace("null", "")); |
| | | patArchive.setBirthplace(por.replace("null", "")); |
| | | // patArchive.setBirthplace(por.replace("null", "")); |
| | | } |
| | | patArchive.setBirthdate(externalInHospPatientInfo.getChuShengRQ()); |
| | | patArchive.setAge(externalInHospPatientInfo.getNianLing()); |
| | | patArchive.setAgeUnit(externalInHospPatientInfo.getNianLingDW()); |
| | | |
| | | if (ObjectUtils.isNotEmpty(parse)) { |
| | | Map<String, String> map = calculateAge(parse.toInstant().atZone(ZoneId.systemDefault()).toLocalDate(), LocalDate.now()); |
| | | patArchive.setAge(ObjectUtils.isNotEmpty(map.get("age")) ? Long.valueOf(map.get("age")) : null); |
| | | patArchive.setAgeUnit(map.get("ageUnit")); |
| | | patArchive.setAge2(ObjectUtils.isNotEmpty(map.get("age2")) ? Long.valueOf(map.get("age2")) : null); |
| | | patArchive.setAgeUnit2(map.get("ageUnit2")); |
| | | |
| | | } |
| | | |
| | | 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.getZhuYuanHao()); |
| | | patArchive.setCreateTime(new Date()); |
| | | patArchive.setInhospno(externalInHospPatientInfo.getBingAnHao()); |
| | | patArchive.setIdcardtype(externalInHospPatientInfo.getZhengJianLXMC()); |
| | | patArchive.setUpdateTime(new Date()); |
| | | if (CollectionUtils.isNotEmpty(patArchives)) { |
| | | //如果不为空,直接将查询出来的对象返回 |
| | | PatArchive patArchive1 = patArchives.get(0); |
| | |
| | | if (StringUtils.isNotEmpty(orgid)) { |
| | | patArchive.setId(patArchive1.getId()); |
| | | patArchiveMapper.updatePatArchive(patArchive); |
| | | return patArchive; |
| | | } |
| | | } else { |
| | | patArchive.setCreateTime(new Date()); |
| | | patArchiveMapper.insertPatArchiveSingle(patArchive); |
| | | } |
| | | //新属信息 |
| | | if (ObjectUtils.isNotEmpty(externalInHospPatientInfo.getExternalInHospPatientLiaisonInfos())) { |
| | | for (ExternalInHospPatientLiaisonInfo external : externalInHospPatientInfo.getExternalInHospPatientLiaisonInfos()) { |
| | | PatArchivecontact patArchivecontact = new PatArchivecontact(); |
| | | patArchivecontact.setPatid(patArchive.getId()); |
| | | patArchivecontact.setContactname(external.getLianXiRXM()); |
| | | patArchivecontact.setOrgid(patArchive.getOrgid()); |
| | | List<PatArchivecontact> patArchivecontacts = patArchivecontactMapper.selectPatArchivecontactList(patArchivecontact); |
| | | patArchivecontact.setContactway(external.getLianXiRDH()); |
| | | patArchivecontact.setRelation(external.getGuanXiMC()); |
| | | if (CollectionUtils.isEmpty(patArchivecontacts)) |
| | | patArchivecontactMapper.insertPatArchivecontact(patArchivecontact); |
| | | else { |
| | | patArchivecontact.setId(patArchivecontacts.get(0).getId()); |
| | | patArchivecontactMapper.updatePatArchivecontact(patArchivecontact); |
| | | } |
| | | } |
| | | } |
| | | patArchiveMapper.insertPatArchiveSingle(patArchive); |
| | | |
| | | |
| | | return patArchive; |
| | | } |
| | | |
| | | //新增患者入院信息 |
| | | private Boolean addPadInhospInfo(ExternalInHospPatientInfo externalInHospPatientInfo, PatArchive patArchive, ExternalInHospPatientDiagnoseInfo externalInHospPatientDiagnoseInfo) { |
| | | PatMedInhosp patMedInhosp = new PatMedInhosp(); |
| | | List<PatMedInhosp> patMedInhospList = null; |
| | | if (ObjectUtils.isNotEmpty(externalInHospPatientInfo)) { |
| | | patMedInhosp.setInhospno(externalInHospPatientInfo.getZhuYuanHao()); |
| | | patMedInhosp.setSerialnum(externalInHospPatientInfo.getZhuYuanHao()); |
| | | //医院那边说要用病案号,不要用住院号 |
| | | patMedInhosp.setInhospno(externalInHospPatientInfo.getBingAnHao()); |
| | | patMedInhosp.setSerialnum(externalInHospPatientInfo.getJiuZhenYWID()); |
| | | patMedInhospList = patMedInhospMapper.selectPatMedInhospList(patMedInhosp); |
| | | patMedInhosp.setHospitalname(externalInHospPatientInfo.getZuZhiJGMC()); |
| | | patMedInhosp.setHospitalcode(externalInHospPatientInfo.getZuZhiJGID()); |
| | | patMedInhosp.setStarttime(externalInHospPatientInfo.getRuYuanSJ()); |
| | |
| | | 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()); |
| | |
| | | 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.getIcd10()); |
| | | patMedInhosp.setDiagname(externalInHospPatientDiagnoseInfo.getZhenDuanMC()); |
| | | |
| | | } |
| | | |
| | | if (ObjectUtils.isNotEmpty(patArchive)) { |
| | |
| | | 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; |
| | | } |
| | |
| | | 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; |
| | | } |
| | | |
| | | public Map<String, String> calculateAge(LocalDate birthdate, LocalDate today) { |
| | | if (birthdate == null || today.isBefore(birthdate)) { |
| | | return null; |
| | | } |
| | | Map<String, String> ageMap = new HashMap<>(); |
| | | |
| | | Period period = Period.between(birthdate, today); |
| | | long totalDays = ChronoUnit.DAYS.between(birthdate, today); |
| | | long totalMonths = ChronoUnit.MONTHS.between(birthdate, today); |
| | | |
| | | int years = period.getYears(); |
| | | int months = period.getMonths(); |
| | | int days = period.getDays(); |
| | | |
| | | String ageUnit; |
| | | Integer age; |
| | | String ageUnit2 = null; |
| | | Integer age2 = null; |
| | | |
| | | if (totalDays < 90) { |
| | | // 小于 1 个月,按天计算 |
| | | ageUnit = "天"; |
| | | age = (int) totalDays; |
| | | ageMap.put("age", age != null ? age.toString() : null); |
| | | ageMap.put("ageUnit", ageUnit); |
| | | ageMap.put("age2", null); |
| | | ageMap.put("ageUnit2", null); |
| | | } else if (totalMonths < 36) { |
| | | // 小于 1 年,按月 + 天计算 |
| | | ageUnit = "月"; |
| | | age = (int) totalMonths; |
| | | ageUnit2 = "天"; |
| | | age2 = days; |
| | | ageMap.put("age", age != null ? age.toString() : null); |
| | | ageMap.put("ageUnit", ageUnit); |
| | | ageMap.put("age2", age2 != null ? age2.toString() : null); |
| | | ageMap.put("ageUnit2", ageUnit2); |
| | | } else { |
| | | // 大于 1 年,按年 + 月计算 |
| | | ageUnit = "岁"; |
| | | age = years; |
| | | ageUnit2 = "月"; |
| | | age2 = months; |
| | | ageMap.put("age", age != null ? age.toString() : null); |
| | | ageMap.put("ageUnit", ageUnit); |
| | | ageMap.put("age2", age2 != null ? age2.toString() : null); |
| | | ageMap.put("ageUnit2", ageUnit2); |
| | | } |
| | | |
| | | return ageMap; |
| | | } |
| | | |
| | | } |