| | |
| | | import com.ruoyi.common.core.domain.entity.SysUserDept; |
| | | import com.ruoyi.common.core.domain.entity.SysUserRole; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.smartor.common.enums.EmergencyLevelEnum; |
| | | import com.smartor.common.enums.ImportFlagEnum; |
| | | import com.ruoyi.common.utils.http.HttpUtils; |
| | | import com.smartor.common.DistinctByProperty; |
| | | import com.smartor.domain.*; |
| | |
| | | patMedInhosp.setInhospno(dto.getHealthcareRecordNo()); |
| | | patMedInhosp.setFuflag("1"); |
| | | |
| | | |
| | | if (StringUtils.isNotEmpty(patArchive.getNotrequiredFlag()) && patArchive.getNotrequiredFlag().equals("1")) |
| | | patMedInhosp.setFuflag("0"); |
| | | if ("0".equals(cry)) { |
| | |
| | | setDischargeInfo(patMedInhosp, dto); |
| | | } else { |
| | | setAdmissionInfo(patMedInhosp, dto); |
| | | patMedInhosp.setEncounterSourceId(dto.getEncounterSourceId() == null ? "" : dto.getEncounterSourceId()); |
| | | if (StringUtils.isNotEmpty(dto.getEncounterSourceId())) { |
| | | //根据 encounterSourceId 获取 importanceFlagCode emergencyLevelCode |
| | | Map<String, String> applyInfo = hospitalizedApply(dto.getEncounterSourceId(), dto.getOrgId()); |
| | | patMedInhosp.setImportanceFlagCode(applyInfo.get("importanceFlagCode")); |
| | | patMedInhosp.setEmergencyLevelCode(applyInfo.get("emergencyLevelCode")); |
| | | } |
| | | } |
| | | |
| | | patMedInhosp.setDrname(dto.getDoctorName()); |
| | |
| | | patMedInhosp.setHospitaldistrictid("" + dto.getAreaId()); |
| | | patMedInhosp.setHospitaldistrictcode("" + dto.getAreaId()); |
| | | patMedInhosp.setHospitaldistrictname(dto.getAreaName()); |
| | | } |
| | | |
| | | /** |
| | | * 根据入院申请单ID查询入院申请单详情 |
| | | * 只提取 importanceFlagCode(importanceFlagCodeList逗号拼接)和 emergencyLevelCode 两个值 |
| | | */ |
| | | private Map<String, String> hospitalizedApply(String encounterSourceId, String orgid) { |
| | | Map<String, String> applyInfo = new HashMap<>(); |
| | | Map<String, String> headers = buildRequestHeaders(); |
| | | log.info("院申请单ID查询入院申请单:{},appKey:{}", sltdPubPath + "/sf/hospitalizedApply/query", APP_KEY); |
| | | //设置入参 |
| | | Map<String, Object> requestParams = new HashMap<>(); |
| | | requestParams.put("applyId", encounterSourceId); |
| | | requestParams.put("orgId", orgid); |
| | | |
| | | String result = null; |
| | | if (StringUtils.isNotEmpty(encounterSourceId) && StringUtils.isNotEmpty(orgid)) |
| | | result = HttpUtils.sendPostByHeader(sltdPubPath + "/sf/hospitalizedApply/query", new Gson().toJson(requestParams), headers); |
| | | |
| | | if (StringUtils.isEmpty(result)) { |
| | | log.error("【hospitalizedApply】接口返回为空,applyId={}", encounterSourceId); |
| | | return applyInfo; |
| | | } |
| | | try { |
| | | Gson gson = new Gson(); |
| | | Type mapType = new TypeToken<Map<String, Object>>() { |
| | | }.getType(); |
| | | Map<String, Object> responseMap = gson.fromJson(result, mapType); |
| | | Object dataObj = responseMap == null ? null : responseMap.get("data"); |
| | | if (dataObj instanceof Map) { |
| | | Map<String, Object> data = (Map<String, Object>) dataObj; |
| | | //重要性标记编码,接口返回是数组,需要转换为字典名称 |
| | | Object importanceFlagCodeListObj = data.get("importanceFlagCodeList"); |
| | | if (importanceFlagCodeListObj instanceof List) { |
| | | List<?> importanceFlagCodeList = (List<?>) importanceFlagCodeListObj; |
| | | // 过滤掉 null 值 |
| | | List<String> nonNullList = importanceFlagCodeList.stream() |
| | | .filter(Objects::nonNull) |
| | | .map(Object::toString) |
| | | .filter(StringUtils::isNotEmpty) |
| | | .collect(Collectors.toList()); |
| | | |
| | | if (!nonNullList.isEmpty()) { |
| | | String importanceFlagLabel; |
| | | if (nonNullList.size() == 1) { |
| | | // 只有一个值,直接通过枚举获取描述 |
| | | importanceFlagLabel = ImportFlagEnum.getDescByCode(nonNullList.get(0)); |
| | | } else { |
| | | // 多个值,用逗号拼接枚举描述 |
| | | StringBuilder labelBuilder = new StringBuilder(); |
| | | for (String code : nonNullList) { |
| | | String label = ImportFlagEnum.getDescByCode(code); |
| | | if (StringUtils.isNotEmpty(label)) { |
| | | labelBuilder.append(label).append(","); |
| | | } |
| | | } |
| | | importanceFlagLabel = StringUtils.stripEnd(labelBuilder.toString(), ","); |
| | | } |
| | | |
| | | if (StringUtils.isNotEmpty(importanceFlagLabel)) { |
| | | applyInfo.put("importanceFlagCode", importanceFlagLabel); |
| | | } |
| | | } |
| | | } |
| | | //紧急程度编码,通过枚举转换描述 |
| | | Object emergencyLevelCodeObj = data.get("emergencyLevelCode"); |
| | | if (emergencyLevelCodeObj != null) { |
| | | String emergencyLevelLabel = EmergencyLevelEnum.getDescByCode(emergencyLevelCodeObj.toString()); |
| | | if (StringUtils.isNotEmpty(emergencyLevelLabel)) { |
| | | applyInfo.put("emergencyLevelCode", emergencyLevelLabel); |
| | | } |
| | | } |
| | | } else { |
| | | log.error("【hospitalizedApply】接口返回data不是对象,applyId={},result:{}", encounterSourceId, result); |
| | | } |
| | | } catch (Exception e) { |
| | | log.error("【hospitalizedApply】解析入院申请单详情失败,applyId={}", encounterSourceId, e); |
| | | } |
| | | log.info("【hospitalizedApply】applyId={},importanceFlagCode={},emergencyLevelCode={}", encounterSourceId, applyInfo.get("importanceFlagCode"), applyInfo.get("emergencyLevelCode")); |
| | | return applyInfo; |
| | | } |
| | | |
| | | /** |
| | |
| | | dto.setCostCategoryCode(getStringValue(dataItem, "costCategoryCode")); |
| | | dto.setCostNatureName(getStringValue(dataItem, "costNatureName")); |
| | | dto.setCostNatureCode(getStringValue(dataItem, "costNatureCode")); |
| | | dto.setEncounterSourceId(getStringValue(dataItem, "encounterSourceId")); |
| | | dto.setFurtherConsultationStatus(getIntegerValue(dataItem, "furtherConsultationStatus")); |
| | | Object mainDiagObj = dataItem.get("mainDischargeDiagnosis"); |
| | | if (mainDiagObj instanceof Map) { |