| | |
| | | queryInhosp.setSerialnum(StringUtils.trim(patMedInhosp.getSerialnum())); |
| | | queryInhosp.setOrgid(StringUtils.trim(dto.getOrgId())); |
| | | queryInhosp.setInhospstate(cry); |
| | | log.info("----------------这里的入参为:{},{}", queryInhosp.getPatno(), queryInhosp.getSerialnum()); |
| | | // log.info("----------------这里的入参为:{},{}", queryInhosp.getPatno(), queryInhosp.getSerialnum()); |
| | | List<PatMedInhosp> existingInhosps = patMedInhospService.selectPatMedInhosp(queryInhosp); |
| | | |
| | | if (cry.equals("0")) { |
| | |
| | | } else { |
| | | // 不存在出院记录,先查预入院(state=3),再查入院(state=0) |
| | | queryInhosp.setInhospstate("3"); |
| | | log.info("-----查询预入院记录,入参为:{}", queryInhosp); |
| | | // log.info("-----查询预入院记录,入参为:{}", queryInhosp); |
| | | List<PatMedInhosp> patMedInhospList = patMedInhospService.selectPatMedInhosp(queryInhosp); |
| | | log.info("----预入院查询结果:{}", CollectionUtils.isEmpty(patMedInhospList) ? "空" : patMedInhospList.get(0).getSerialnum()); |
| | | if (CollectionUtils.isNotEmpty(patMedInhospList)) { |
| | |
| | | if (CollectionUtils.isEmpty(patMedInhospList3)) { |
| | | try { |
| | | //获取一下入院申请单 |
| | | Map<String, String> headers = buildRequestHeaders(); |
| | | Map<String, Object> requestParams = new HashMap<>(); |
| | | requestParams.put("orgId", "20001001"); |
| | | requestParams.put("20001001", patArchive.getPatidHis()); |
| | | String result = HttpUtils.sendPostByHeader(sltdPubPath + "/hospitalizedApply/query", new Gson().toJson(requestParams), headers); |
| | | |
| | | |
| | | //根据 encounterSourceId 获取 importanceFlagCode emergencyLevelCode |
| | | if (active.equals("sltd")) { |
| | | Map<String, String> applyInfo = hospitalizedApply(dto.getEncounterSourceId(), dto.getOrgId()); |
| | | if (ObjectUtils.isNotEmpty(applyInfo)) { |
| | | patMedInhosp.setImportanceFlagCode(applyInfo.get("importanceFlagCode")); |
| | | patMedInhosp.setEmergencyLevelCode(applyInfo.get("emergencyLevelCode")); |
| | | } |
| | | } |
| | | patMedInhospService.insertPatMedInhosp(patMedInhosp); |
| | | log.debug("成功插入预入院记录:serialnum={}", patMedInhosp.getSerialnum()); |
| | | } catch (Exception e) { |
| | |
| | | if ("1".equals(cry)) { |
| | | patMedInhosp.setInhospstate("1"); |
| | | ServiceSLTDDiagnosisResDTO mainDischargeDiagnosis = dto.getMainDischargeDiagnosis(); |
| | | log.info("-----------mainDischargeDiagnosis的值有了吗?{}", mainDischargeDiagnosis); |
| | | // log.info("-----------mainDischargeDiagnosis的值有了吗?{}", mainDischargeDiagnosis); |
| | | if (!Objects.isNull(mainDischargeDiagnosis)) { |
| | | if (mainDischargeDiagnosis.getIsMainDiagnosis() == 1) { |
| | | patMedInhosp.setLeavediagname(StringUtils.defaultString(mainDischargeDiagnosis.getDiagnosisDictName(), "")); |
| | |
| | | } else { |
| | | setAdmissionInfo(patMedInhosp, dto); |
| | | patMedInhosp.setEncounterSourceId(dto.getEncounterSourceId() == null ? "" : dto.getEncounterSourceId()); |
| | | if (StringUtils.isNotEmpty(dto.getEncounterSourceId())) { |
| | | if (StringUtils.isNotEmpty(dto.getEncounterSourceId()) && active.equals("sltd")) { |
| | | //根据 encounterSourceId 获取 importanceFlagCode emergencyLevelCode |
| | | Map<String, String> applyInfo = hospitalizedApply(dto.getEncounterSourceId(), dto.getOrgId()); |
| | | patMedInhosp.setImportanceFlagCode(applyInfo.get("importanceFlagCode")); |
| | | patMedInhosp.setEmergencyLevelCode(applyInfo.get("emergencyLevelCode")); |
| | | if (!Objects.isNull(applyInfo)) { |
| | | patMedInhosp.setImportanceFlagCode(applyInfo.get("importanceFlagCode")); |
| | | patMedInhosp.setEmergencyLevelCode(applyInfo.get("emergencyLevelCode")); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | patMedInhosp.setMedicalName(drugInfoMap.get("drugItemNames")); |
| | | patMedInhosp.setMedicalCode(drugInfoMap.get("drugItemIds")); |
| | | patMedInhosp.setMedicalCompany(drugInfoMap.get("drugManufacturerNames")); |
| | | |
| | | log.info("获取药品信息成功:名称={}, 编码={}, 厂家={}", drugInfoMap.get("drugItemNames"), drugInfoMap.get("drugItemIds"), drugInfoMap.get("drugManufacturerNames")); |
| | | } |
| | | } |
| | |
| | | String code = BigDecimal.valueOf(((Number) codeObj).longValue()).toPlainString(); |
| | | if (!"200".equals(code)) { |
| | | log.error("【queryMedicalOrders】接口返回失败,code={}, message={}", code, responseMap.get("message")); |
| | | return result; |
| | | return null; |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | // 遍历医嘱列表,提取药品信息 |
| | | Set<String> processedItemIds = new HashSet<>(); // 用于去重(只根据 itemId 去重) |
| | | |
| | | |
| | | for (Object item : dataList) { |
| | | if (item instanceof Map) { |
| | | Map<String, Object> itemMap = (Map<String, Object>) item; |
| | |
| | | |
| | | // 至少有一个有值,处理每个字段 |
| | | String itemName = (itemNameObj != null && StringUtils.isNotEmpty(itemNameObj.toString())) ? itemNameObj.toString() : ""; |
| | | |
| | | |
| | | // itemId 特殊处理:避免科学计数法(Gson 可能将数字解析为 Double) |
| | | String itemId = ""; |
| | | if (itemIdObj != null && StringUtils.isNotEmpty(itemIdObj.toString())) { |
| | |
| | | itemId = itemIdObj.toString(); |
| | | } |
| | | } |
| | | |
| | | |
| | | String manufacturerName = (manufacturerNameObj != null && StringUtils.isNotEmpty(manufacturerNameObj.toString())) ? manufacturerNameObj.toString() : ""; |
| | | |
| | | // 只根据 itemId 去重(同一编码的药品只保留一个) |