|  |  | 
 |  |  |  | 
 |  |  | import com.alibaba.fastjson2.JSON; | 
 |  |  | import com.alibaba.fastjson2.JSONObject; | 
 |  |  | import com.fasterxml.jackson.core.JsonParser; | 
 |  |  | import com.fasterxml.jackson.databind.JsonNode; | 
 |  |  | import com.fasterxml.jackson.databind.ObjectMapper; | 
 |  |  | import com.google.common.reflect.TypeToken; | 
 |  |  | 
 |  |  | import com.smartor.common.SendService; | 
 |  |  | import com.smartor.domain.*; | 
 |  |  | import com.smartor.mapper.ServiceTaskMapper; | 
 |  |  | import com.smartor.mapper.SysUserImportMapper; | 
 |  |  | import com.smartor.service.*; | 
 |  |  | import lombok.extern.slf4j.Slf4j; | 
 |  |  | import org.apache.commons.collections4.CollectionUtils; | 
 |  |  | 
 |  |  |  | 
 |  |  |     @Autowired | 
 |  |  |     private PlatformTransactionManager transactionManager; | 
 |  |  |  | 
 |  |  |     @Autowired | 
 |  |  |     private SysUserImportMapper sysUserImportMapper; | 
 |  |  |  | 
 |  |  |     @Value("${localIP}") | 
 |  |  |     private String localIP; | 
 |  |  | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public void importData() { | 
 |  |  | //        String filePath = "path/to/your/file.txt"; // 替换为你的文件路径 | 
 |  |  | // | 
 |  |  | //        try { | 
 |  |  | //            // 读取文件内容 | 
 |  |  | //            String jsonContent = new String(Files.readAllBytes(Paths.get(filePath))); | 
 |  |  | // | 
 |  |  | //            // 创建ObjectMapper对象 | 
 |  |  | //            ObjectMapper objectMapper = new ObjectMapper(); | 
 |  |  | // | 
 |  |  | //            // 解析JSON为JsonNode | 
 |  |  | //            JsonNode rootNode = objectMapper.readTree(jsonContent); | 
 |  |  | //            // 获取resultList | 
 |  |  | //            JsonNode resultListNode = rootNode.path("results").path("resultList"); | 
 |  |  | //            // 遍历resultList中的每个对象 | 
 |  |  | //            for (JsonNode item : resultListNode) { | 
 |  |  | //                String userName = item.path("staffNum").asText(); | 
 |  |  | //                String idCard = item.path("idCard").asText(); | 
 |  |  | //                String personnelStampNum = item.path("defaultWardId").asText(); | 
 |  |  | //                String personnelStampNum = item.path("defaultWardName").asText(); | 
 |  |  | //                String deptName = item.path("defaultDeptName").asText(); | 
 |  |  | //                String deptCode = item.path("defaultDeptId").asText(); | 
 |  |  | //                String phonenumber = item.path("telphone").asText(); | 
 |  |  | //                String nickName = item.path("staffName").asText(); | 
 |  |  | //                String sex = item.path("staffSex").asText(); | 
 |  |  | // | 
 |  |  | //            } | 
 |  |  | // | 
 |  |  | //        } catch (IOException e) { | 
 |  |  | //            e.printStackTrace(); | 
 |  |  | //        } | 
 |  |  |         String filePath = "C:\\Users\\86176\\Desktop\\新建文本文档 4.txt"; // 替换为你的文件路径 | 
 |  |  |  | 
 |  |  |         try { | 
 |  |  |             // 读取文件内容 | 
 |  |  |             String jsonContent = new String(Files.readAllBytes(Paths.get(filePath)), StandardCharsets.UTF_8); | 
 |  |  |  | 
 |  |  |             // 创建ObjectMapper对象 | 
 |  |  |             ObjectMapper objectMapper = new ObjectMapper(); | 
 |  |  |             // 解析JSON为JsonNode | 
 |  |  |             JsonNode rootNode = objectMapper.readTree(jsonContent); | 
 |  |  |             // 获取resultList | 
 |  |  |             JsonNode resultListNode = rootNode.path("results").path("resultList"); | 
 |  |  |             // 遍历resultList中的每个对象 | 
 |  |  |             for (JsonNode item : resultListNode) { | 
 |  |  |  | 
 |  |  |                 SysUserImport person = objectMapper.treeToValue(item, SysUserImport.class); | 
 |  |  |                 person.setStaffPhoto(""); | 
 |  |  |                 sysUserImportMapper.insertSysUserImport(person); | 
 |  |  |  | 
 |  |  |             } | 
 |  |  |  | 
 |  |  |         } catch (IOException e) { | 
 |  |  |             e.printStackTrace(); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |     } | 
 |  |  |  | 
 |  |  | 
 |  |  |                 patMedInhosp.setLeaveldeptid(thiedInhospInfo.getCurrDeptCode()); | 
 |  |  |                 //如果是出院,先通过患者编号和流水号去查一下,患者是否存在,如果存在,则进行修改 | 
 |  |  |                 PatMedInhosp inhosp = new PatMedInhosp(); | 
 |  |  |                 inhosp.setInhospno(patArchive.getPatientno()); | 
 |  |  |                 inhosp.setPatno(patArchive.getPatientno()); | 
 |  |  |                 inhosp.setSerialnum(patMedInhosp.getSerialnum()); | 
 |  |  |                 List<PatMedInhosp> patMedInhosps = patMedInhospService.selectPatMedInhospList(inhosp); | 
 |  |  |                 if (CollectionUtils.isNotEmpty(patMedInhosps)) { |