diff --git a/yudao-module-inspect/yudao-module-inspect-biz/src/main/java/cn/iocoder/yudao/module/inspect/controller/admin/inspectpatient/InspectPatientController.java b/yudao-module-inspect/yudao-module-inspect-biz/src/main/java/cn/iocoder/yudao/module/inspect/controller/admin/inspectpatient/InspectPatientController.java index 9f8bbdc..be8e9c8 100644 --- a/yudao-module-inspect/yudao-module-inspect-biz/src/main/java/cn/iocoder/yudao/module/inspect/controller/admin/inspectpatient/InspectPatientController.java +++ b/yudao-module-inspect/yudao-module-inspect-biz/src/main/java/cn/iocoder/yudao/module/inspect/controller/admin/inspectpatient/InspectPatientController.java @@ -15,6 +15,7 @@ import cn.iocoder.yudao.module.inspect.service.exammodule.ExammoduleService; import cn.iocoder.yudao.module.inspect.service.inspectpacsdata.InspectPacsDataService; import cn.iocoder.yudao.module.inspect.service.inspectpatientitems.InspectPatientitemsService; import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.type.TypeReference; import org.apache.pdfbox.pdmodel.PDDocument; import org.apache.pdfbox.rendering.PDFRenderer; import org.apache.poi.ss.usermodel.*; @@ -951,14 +952,30 @@ public class InspectPatientController { Map dataMap = (Map) responseMap.get("data"); if (dataMap != null) { - inspectApiInfoVO.setIdCard(dataMap.get("idCard").toString()); - inspectApiInfoVO.setName(dataMap.get("name").toString()); - inspectApiInfoVO.setSex(dataMap.get("sex").toString()); - inspectApiInfoVO.setAge(dataMap.get("age").toString()); - inspectApiInfoVO.setBirthday(dataMap.get("birthday").toString()); - inspectApiInfoVO.setGender(dataMap.get("gender").toString()); - inspectApiInfoVO.setAddree(dataMap.get("addree").toString()); - inspectApiInfoVO.setTelephone(dataMap.get("telephone").toString()); + if (dataMap.get("idCard") != null) { + inspectApiInfoVO.setIdCard(dataMap.get("idCard").toString()); + } + if (dataMap.get("name") != null) { + inspectApiInfoVO.setName(dataMap.get("name").toString()); + } + if (dataMap.get("sex") != null) { + inspectApiInfoVO.setSex(dataMap.get("sex").toString()); + } + if (dataMap.get("age") != null) { + inspectApiInfoVO.setAge(dataMap.get("age").toString()); + } + if (dataMap.get("birthday") != null) { + inspectApiInfoVO.setBirthday(dataMap.get("birthday").toString()); + } + if (dataMap.get("gender") != null) { + inspectApiInfoVO.setGender(dataMap.get("gender").toString()); + } + if (dataMap.get("addree") != null) { + inspectApiInfoVO.setAddree(dataMap.get("addree").toString()); + } + if (dataMap.get("telephone") != null) { + inspectApiInfoVO.setTelephone(dataMap.get("telephone").toString()); + } } else { @@ -971,46 +988,45 @@ public class InspectPatientController { @PutMapping("/syncPatientZyInfo") @Operation(summary = "同步中医体质结果项") - public CommonResult syncPatientZyInfo(@RequestParam("medicalSn") String medicalSn,@RequestParam("cardId") String cardId) throws JsonProcessingException { + public CommonResult syncPatientZyInfo(@RequestParam("medicalSn") String medicalSn, @RequestParam("cardId") String cardId) throws JsonProcessingException { ConfigDO config = configService.getConfigByKey("url.zytz"); String url = config.getValue(); - if(url!=null) - { + if (url != null) { String response = HttpUtils.get(url + "?" + "idCard=" + cardId); - if(response!=null) - { + if (response != null) { // 解析 JSON 响应 ObjectMapper objectMapper = new ObjectMapper(); Map responseMap = objectMapper.readValue(response, Map.class); String msg = (String) responseMap.get("message"); - if(msg.contains("查询成功")) - { - String data = (String) responseMap.get("data"); - if(data!=null) - { - // 将 data 字段解析为一个 Java 对象 - Map dataMap = objectMapper.readValue(data, Map.class); + if (msg.contains("查询成功")) { + Object dataObj = responseMap.get("data"); + if (dataObj != null) { + // 将 data 字段解析为一个 List> + List> dataList = objectMapper.convertValue(dataObj, new TypeReference>>() {}); InspectPatientSaveReqVO inspectPatientSaveReqVO = new InspectPatientSaveReqVO(); inspectPatientSaveReqVO.setMedicalSn(medicalSn); - // 根据图片中的 JSON 格式映射数据 - if (dataMap.containsKey("physiquename")) { - inspectPatientSaveReqVO.setZybs((String) dataMap.get("physiquename")); - } - if (dataMap.containsKey("features")) { - inspectPatientSaveReqVO.setFeatures((String) dataMap.get("features")); + // 遍历 dataList 并提取所需信息 + for (Map dataMap : dataList) { + // 根据图片中的 JSON 格式映射数据 + if (dataMap.containsKey("physiquename")) { + inspectPatientSaveReqVO.setZybs((String) dataMap.get("physiquename")); + } + if (dataMap.containsKey("features")) { + inspectPatientSaveReqVO.setFeatures((String) dataMap.get("features")); + } } + patientService.medicalSnfeaturesupdate(inspectPatientSaveReqVO); } - } } - } return success(true); } + @GetMapping("/page") @Operation(summary = "获得患者信息分页") public CommonResult> getPatientPage(@Valid InspectPatientPageReqVO pageReqVO) {