| | |
| | | import com.ltkj.hosp.sqlDomain.LtkjExamJcbgd; |
| | | import com.ltkj.hosp.sqlDomain.LtkjExamJcsqd; |
| | | import com.ltkj.system.service.ISysDeptService; |
| | | import com.sun.jna.platform.win32.WinDef; |
| | | import com.sun.org.apache.xpath.internal.operations.Bool; |
| | | import jodd.util.StringUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.security.PrivateKey; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | |
| | | |
| | | |
| | | import java.io.BufferedReader; |
| | | import java.io.InputStreamReader; |
| | | import java.net.HttpURLConnection; |
| | | import java.net.URL; |
| | | |
| | | /** |
| | | * @Company: 西安路泰科技有限公司 |
| | |
| | | @Autowired |
| | | private LtkjExamJcbgdService ltkjExamJcbgdService; |
| | | |
| | | @PostMapping("QueryOrder") |
| | | public String queryOrder(@RequestBody String json){ |
| | | // 体检开检查申请单调用此接口推送给pacs服务 |
| | | public boolean OrderAdd(String tjNumber) |
| | | { |
| | | try { |
| | | //从体检数据库中查询出申请单数据 调用 pacs webservice 接口 OrderAdd实现申请单推送 |
| | | HashMap<String, Object> hashMap = new HashMap<>(); |
| | | if (true){ |
| | | HashMap<String, Object> result = new HashMap<>(); |
| | | // result.put("PatientId",0); |
| | | // result.put("PatType","PatType"); |
| | | // result.put("Operator","Operator"); |
| | | // result.put("HisID","HisID"); |
| | | |
| | | hashMap.put("Root",result); |
| | | } |
| | | return ComSjyjtPacs(XmlUtil.mapToXmlStr(hashMap)); |
| | | }catch (Exception ex) |
| | | { |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | // 体检撤销申请单后调用此接口撤销pacs申请单 |
| | | public boolean OrderDelete(String tjNumber) |
| | | { |
| | | //入参字段 |
| | | // <PatientId> HIS或体检病人ID </PatientId> |
| | | // <PatType>病人类型</PatType > |
| | | // <Operator>操作人工号</Operator> |
| | | // <HisID>HIS或体检申请单号</HisID> |
| | | try { |
| | | //从体检数据库中查询出申请单数据 调用 pacs webservice 接口 OrderAdd实现申请单推送 |
| | | |
| | | HashMap<String, Object> hashMap = new HashMap<>(); |
| | | if (null == null){ |
| | | HashMap<String, Object> result = new HashMap<>(); |
| | | result.put("PatientId",0); |
| | | result.put("PatType","PatType"); |
| | | result.put("Operator","Operator"); |
| | | result.put("HisID","HisID"); |
| | | |
| | | hashMap.put("Root",result); |
| | | } |
| | | return ComSjyjtPacs(XmlUtil.mapToXmlStr(hashMap)); |
| | | }catch (Exception ex) |
| | | { |
| | | return false; |
| | | } |
| | | } |
| | | // 陕健医集团调用pacs接口Webservice |
| | | public boolean ComSjyjtPacs(String inputLine) |
| | | { |
| | | String apiUrl = "http://100.100.100.222:8000/WebInterfaceService.asmx"; // 替换为你的API URL |
| | | |
| | | try { |
| | | URL url = new URL(apiUrl); |
| | | HttpURLConnection connection = (HttpURLConnection) url.openConnection(); |
| | | connection.setRequestMethod("GET"); |
| | | |
| | | int responseCode = connection.getResponseCode(); |
| | | if (responseCode == HttpURLConnection.HTTP_OK) { |
| | | BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream())); |
| | | |
| | | StringBuffer response = new StringBuffer(); |
| | | |
| | | while ((inputLine = in.readLine()) != null) { |
| | | response.append(inputLine); |
| | | } |
| | | |
| | | in.close(); |
| | | |
| | | // 打印结果 |
| | | System.out.println(response.toString()); |
| | | } else { |
| | | // System.out.println("ComSjyjtPacs陕健医集团调用pacs接口Webservice调用失败!”); |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return true; |
| | | |
| | | } |
| | | |
| | | |
| | | @PostMapping("InvokeRisService") |
| | | public String InvokeRisService(String dataSourceName, String action, String message) |
| | | { |
| | | |
| | | String rusue=null; |
| | | switch (StringUtil.toLowerCase(action) ) |
| | | { |
| | | case "qeryorder": |
| | | rusue= queryOrder(dataSourceName); |
| | | break; |
| | | case "updateorderstatus": |
| | | rusue= updateOrderstatus(dataSourceName); |
| | | break; |
| | | case "reportverifyupload": |
| | | rusue= reportVerifyUpload(dataSourceName); |
| | | break; |
| | | |
| | | } |
| | | HashMap<String, Object> hashMap = new HashMap<>(); |
| | | // <Code>执行状态 执行状态 1 成功, 0失败</Code> |
| | | // <Message>结果消息</Message> |
| | | HashMap<String, Object> result = new HashMap<>(); |
| | | if(rusue==null) |
| | | { |
| | | result.put("Code", 1); |
| | | result.put("Message", "接口成功"); |
| | | } |
| | | else { |
| | | result.put("Code", 0); |
| | | result.put("Message", rusue); |
| | | } |
| | | hashMap.put("ResultInfor", result); |
| | | return XmlUtil.mapToXmlStr(hashMap); |
| | | } |
| | | |
| | | |
| | | private String updateOrderstatus(@RequestBody String json) { |
| | | // <PatientId> HIS或体检病人ID </PatientId> |
| | | // <PatType>病人类型</PatType > |
| | | // <Operator>操作人工号</Operator> |
| | | // <HisID>HIS或体检申请单号</HisID> |
| | | // <OrderStatus>单据状态</OrderStatus> |
| | | Map<String, Object> map = XmlUtil.xmlToMap(json); |
| | | JSONObject parseObj = JSONUtil.parseObj(map); |
| | | String msgStr = ""; |
| | | //必填HIS或体检病人ID |
| | | String PatientId = parseObj.getStr("PatientId"); |
| | | // 必填 病人类型病人类型O:门诊,I:住院,P:体检 |
| | | String PatType = parseObj.getStr("PatType"); |
| | | // 必填 操作人工号 |
| | | String Operator = parseObj.getStr("Operator"); |
| | | // 必填 HIS或体检申请单号 |
| | | String HisID = parseObj.getStr("HisID"); |
| | | // 必填 单据状态 单据状态 1已登记,0取消登记 |
| | | String OrderStatus = parseObj.getStr("OrderStatus"); |
| | | |
| | | if (PatientId == "") { |
| | | msgStr = msgStr + "HIS或体检病人ID未填写 ; "; |
| | | } |
| | | if (PatType == "") { |
| | | msgStr = msgStr + "病人类型未填写 ; "; |
| | | } |
| | | if (Operator == "") { |
| | | msgStr = msgStr + "操作人工号未填写 ; "; |
| | | } |
| | | if (HisID == "") { |
| | | msgStr = msgStr + "HIS或体检申请单号未填写 ; "; |
| | | } |
| | | if (OrderStatus == "") { |
| | | msgStr = msgStr + "单据状态未填写 ; "; |
| | | } |
| | | |
| | | HashMap<String, Object> hashMap = new HashMap<>(); |
| | | // <Code>执行状态 执行状态 1 成功, 0失败</Code> |
| | | // <Message>结果消息</Message> |
| | | HashMap<String, Object> result = new HashMap<>(); |
| | | if(msgStr=="") |
| | | { |
| | | result.put("Code", 1); |
| | | result.put("Message", "接口成功"); |
| | | } |
| | | else { |
| | | result.put("Code", 0); |
| | | result.put("Message", msgStr); |
| | | } |
| | | hashMap.put("ResultInfor", result); |
| | | return XmlUtil.mapToXmlStr(hashMap); |
| | | } |
| | | |
| | | //@PostMapping("QueryOrder") |
| | | private String queryOrder(@RequestBody String json){ |
| | | Map<String, Object> map = XmlUtil.xmlToMap(json); |
| | | JSONObject parseObj = JSONUtil.parseObj(map); |
| | | String hospitalID = parseObj.getStr("HospitalID"); |
| | |
| | | HashMap<String, Object> hashMap = new HashMap<>(); |
| | | if (customer == null){ |
| | | HashMap<String, Object> result = new HashMap<>(); |
| | | result.put("Code",500); |
| | | result.put("Code",0); |
| | | result.put("Message","未查询到人员信息"); |
| | | hashMap.put("ResultInfor",result); |
| | | return XmlUtil.mapToXmlStr(hashMap); |
| | |
| | | List<TjOrder> list = tjOrderService.list(new LambdaQueryWrapper<TjOrder>().eq(TjOrder::getUserId, customer.getCusId()).orderByDesc(TjOrder::getCreateTime)); |
| | | if (list.isEmpty()){ |
| | | HashMap<String, Object> result = new HashMap<>(); |
| | | result.put("Code",500); |
| | | result.put("Code",0); |
| | | result.put("Message","未查询到记录信息"); |
| | | hashMap.put("ResultInfor",result); |
| | | return XmlUtil.mapToXmlStr(hashMap); |
| | |
| | | patientInfo.put("PatBirthday",customer.getCusBrithday()); |
| | | patientInfo.put("IdCard",customer.getCusIdcard()); |
| | | |
| | | // ArrayList<HashMap<String, Object>> examItems = new ArrayList<>(); |
| | | String examItems = ""; |
| | | // String examItems = ""; |
| | | HashMap<String, Object> examItem = new HashMap<>(); |
| | | List<Map<String,Object>> lists = new ArrayList<>(); |
| | | for (TjProject project : projects) { |
| | | HashMap<String, Object> examItem = new HashMap<>(); |
| | | examItem.put("HisID", tjOrder.getTjNumber() + String.valueOf(project.getProId()).substring(String.valueOf(project.getProId()).length() - 4)); |
| | | examItem.put("EmergencyFlag", "0"); |
| | | examItem.put("ExamItemID", project.getHisXmbm()); |
| | | examItem.put("ExamItemName", project.getHisXmmc()); |
| | | examItem.put("OrderDT", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(tjOrder.getCreateTime())); |
| | | HashMap<String, Object> examItems = new HashMap<>(); |
| | | examItems.put("HisID", tjOrder.getTjNumber() + String.valueOf(project.getProId()).substring(String.valueOf(project.getProId()).length() - 4)); |
| | | examItems.put("EmergencyFlag", "0"); |
| | | examItems.put("ExamItemID", project.getHisXmbm()); |
| | | examItems.put("ExamItemName", project.getHisXmmc()); |
| | | examItems.put("OrderDT", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(tjOrder.getCreateTime())); |
| | | SysDept dept = deptService.getById(project.getDeptId()); |
| | | examItem.put("Modality", dept.getModality()); |
| | | examItems += "<ExamItem>"+ |
| | | XmlUtil.mapToXmlStr(examItem) |
| | | .replaceAll("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>","") |
| | | .replaceAll("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>","") |
| | | .replaceAll("<xml>","") |
| | | .replaceAll("</xml>","") |
| | | +"</ExamItem>"; |
| | | examItems.put("Modality", dept.getModality()); |
| | | // examItems += "<ExamItem>"+ |
| | | // XmlUtil.mapToXmlStr(examItem) |
| | | // .replaceAll("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>","") |
| | | // .replaceAll("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>","") |
| | | // .replaceAll("<xml>","") |
| | | // .replaceAll("</xml>","") |
| | | // +"</ExamItem>"; |
| | | lists.add(examItems); |
| | | } |
| | | hashMap.put("ExamItemList", examItems); |
| | | examItem.put("ExamItem",list); |
| | | hashMap.put("ExamItemList", examItem); |
| | | hashMap.put("PatientInfor",patientInfo); |
| | | HashMap<String, Object> result = new HashMap<>(); |
| | | result.put("Code",1); |
| | |
| | | .replaceAll("<","<").replaceAll(">",">"); |
| | | } |
| | | |
| | | @PostMapping("ReportVerifyUpload") |
| | | public String reportVerifyUpload(@RequestBody String json){ |
| | | //@PostMapping("ReportVerifyUpload") |
| | | private String reportVerifyUpload(@RequestBody String json){ |
| | | Map<String, Object> map = XmlUtil.xmlToMap(json); |
| | | HashMap<String, Object> reportInfor = (HashMap<String, Object>) map.get("ReportInfor"); |
| | | // cus_id |