package com.glxp.api.http; import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.StrUtil; import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.TypeReference; import com.glxp.api.common.res.BaseResponse; import com.glxp.api.common.util.ResultVOUtils; import com.glxp.api.entity.basic.BasicSkProjectDetailEntity; import com.glxp.api.entity.basic.BasicSkProjectEntity; import com.glxp.api.entity.basic.BasicSkSickerEntity; import com.glxp.api.entity.thrsys.ThrManufacturerEntity; import com.glxp.api.entity.thrsys.ThrSystemBusApiEntity; import com.glxp.api.entity.thrsys.ThrSystemEntity; import com.glxp.api.http.req.UdiwmsBusTypeRequest; import com.glxp.api.http.req.UdiwmsUnitRequest; import com.glxp.api.req.basic.DlThirdDestinyRequest; import com.glxp.api.req.basic.GetSickPrescribeRequest; import com.glxp.api.req.basic.GetSickRequest; import com.glxp.api.req.thrsys.*; import com.glxp.api.res.PageSimpleResponse; import com.glxp.api.res.basic.BasicSkPrescribeResponse; import com.glxp.api.res.basic.BasicSkProjectDetailResponse; import com.glxp.api.res.basic.BasicSkProjectResponse; import com.glxp.api.res.basic.BasicSkSickerResponse; import com.glxp.api.res.thrsys.ThrCorpsResponse; import com.glxp.api.res.thrsys.ThrProductsResponse; import com.glxp.api.res.thrsys.UdiwmsWarehouseDetail; import com.glxp.api.service.thrsys.ThrSystemService; import lombok.extern.slf4j.Slf4j; import okhttp3.*; import org.apache.commons.lang3.exception.ExceptionUtils; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.util.List; /** * 第三方服务HttpClient */ @Slf4j @Service public class ErpBasicClient { @Resource private OkHttpClient okHttpClient; @Resource HttpOkClient httpOkClient; @Resource private ThrSystemService basicThirdSysService; /** * 获取往来单位 */ public BaseResponse> getErpCrop(ThrUnitMaintainFilterRequest thrUnitMaintainFilterRequest) { UdiwmsUnitRequest udiwmsUnitRequest = new UdiwmsUnitRequest(); BeanUtils.copyProperties(thrUnitMaintainFilterRequest, udiwmsUnitRequest); udiwmsUnitRequest.setUnitId(thrUnitMaintainFilterRequest.getErpId()); ThrSystemEntity thrSystemEntity = basicThirdSysService.selectByThirdId(thrUnitMaintainFilterRequest.getThirdSysFk()); try { String url = thrSystemEntity.getThridUrl() + "/udiwms/erp/getUnits"; String response = httpOkClient.uCloudPost(url, udiwmsUnitRequest, thrSystemEntity); if (StrUtil.isBlank(response)) { return ResultVOUtils.error(500, "连接第三方系统接口服务出错!"); } BaseResponse> udiDlDeviceResponse = JSONObject.parseObject(response, new TypeReference>>() { }); return udiDlDeviceResponse; } catch (Exception e) { log.error("获取往来单位异常", e); return ResultVOUtils.error(500, "连接第三方系统接口服务出错!"); } } /** * 获取往来单位 */ public BaseResponse> getThrManu(ThrManuFilterRequest thrManuFilterRequest) { UdiwmsUnitRequest udiwmsUnitRequest = new UdiwmsUnitRequest(); BeanUtils.copyProperties(thrManuFilterRequest, udiwmsUnitRequest); udiwmsUnitRequest.setUnitId(thrManuFilterRequest.getErpId()); ThrSystemEntity thrSystemEntity = basicThirdSysService.selectByThirdId(thrManuFilterRequest.getThirdSysFk()); try { String url = thrSystemEntity.getThridUrl() + "/udiwms/erp/getManus"; String response = httpOkClient.uCloudPost(url, udiwmsUnitRequest, thrSystemEntity); if (StrUtil.isBlank(response)) { return ResultVOUtils.error(500, "连接第三方系统接口服务出错!"); } BaseResponse> baseResponse = JSONObject.parseObject(response, new TypeReference>>() { }); return baseResponse; } catch (Exception e) { log.error("获取生产企业接口异常", e); return ResultVOUtils.error(500, "连接第三方系统接口服务出错!"); } } //获取产品信息 public BaseResponse> getErpProducts(FilterThrProductsRequest filterThrProductsRequest) { ThrSystemEntity basicThirdSysEntity = basicThirdSysService.selectByThirdId(filterThrProductsRequest.getThirdSysFk()); String url = basicThirdSysEntity.getThridUrl() + "/udiwms/erp/getProducts"; try { String response = httpOkClient.uCloudPost(url, filterThrProductsRequest, basicThirdSysEntity); if (StrUtil.isBlank(response)) { return ResultVOUtils.error(500, "连接第三方系统接口服务出错!"); } BaseResponse> udiDlDeviceResponse = JSONObject.parseObject(response, new TypeReference>>() { }); return udiDlDeviceResponse; } catch (Exception e) { log.error("获取产品信息异常", e); return ResultVOUtils.error(500, "连接第三方系统接口服务出错!"); } } //查询仓库货位号 public BaseResponse> getWarehouse(UdiwmsWarehouseRequest udiwmsWarehouseRequest) { ThrSystemEntity basicThirdSysEntity = basicThirdSysService.selectByThirdId(udiwmsWarehouseRequest.getThirdSys()); String url = basicThirdSysEntity.getThridUrl() + "/udiwms/erp/getWarehouse"; try { String response = httpOkClient.uCloudPost(url, udiwmsWarehouseRequest); BaseResponse> listBaseResponse = JSONObject.parseObject(response, new TypeReference>>() { }); return listBaseResponse; } catch (Exception e) { log.error("获取第三方系统的仓库货位码异常", e); return ResultVOUtils.error(500, "连接第三方系统接口服务出错"); } } /** * 获取患者信息 * * @param getSickRequest * @return */ public BaseResponse> getSicker(GetSickRequest getSickRequest) { if (StrUtil.isEmpty(getSickRequest.getThirdSys())) { getSickRequest.setThirdSys("thirdId"); } ThrSystemEntity basicThirdSysEntity = basicThirdSysService.selectByThirdId(getSickRequest.getThirdSys()); String url = basicThirdSysEntity.getThridUrl() + "/udiwms/erp/sicker/getInfo"; try { String response = httpOkClient.uCloudPost(url, getSickRequest); BaseResponse> listBaseResponse = JSONObject.parseObject(response, new TypeReference>>() { }); return listBaseResponse; } catch (Exception e) { log.error("获取患者信息异常" + ExceptionUtils.getStackTrace(e)); return ResultVOUtils.error(500, "连接第三方系统接口服务出错"); } } /** * 获取患者处方信息 * * @param getSickPrescribeRequest * @return */ public BaseResponse> getSickPrescribe(GetSickPrescribeRequest getSickPrescribeRequest) { ThrSystemEntity basicThirdSysEntity = basicThirdSysService.selectByThirdId(getSickPrescribeRequest.getThirdSys()); String url = basicThirdSysEntity.getThridUrl() + "/udiwms/erp/sicker/getPrescribe"; try { String response = httpOkClient.uCloudPost(url, getSickPrescribeRequest); // String response = "{\"code\":20000,\"data\":{\"total\":108,\"list\":[{\"code\":\"2038979\",\"createDr\":\"卢进炜/220\",\"deptCode\":\"90\",\"deptName\":\"外科\",\"diagnosis\":\"卵巢恶性肿瘤\",\"itemList\":[{\"category\":\"项目\",\"count\":\"0\",\"ggxh\":\"\",\"itemCode\":\"121237\",\"itemName\":\"Ⅱ级护理\",\"measureUnit\":\"\",\"remark\":\"\",\"thrId\":\"121237\"}],\"prescribeDate\":\"2017-09-30 23:19:19\",\"remark\":\"\",\"sickCode\":\"0000362743\"},{\"amount\":0,\"code\":\"2038983\",\"createDr\":\"卢进炜/220\",\"deptCode\":\"90\",\"deptName\":\"外科\",\"diagnosis\":\"卵巢恶性肿瘤\",\"itemList\":[{\"amount\":0,\"category\":\"项目\",\"count\":\"0\",\"ggxh\":\"\",\"itemCode\":\"121346\",\"itemName\":\"外科护理常规\",\"measureUnit\":\"\",\"remark\":\"\",\"thrId\":\"121346\"}],\"prescribeDate\":\"2017-09-30 23:19:19\",\"remark\":\"\",\"sickCode\":\"0000362743\"},{\"amount\":18.3,\"code\":\"2091375\",\"createDr\":\"卢进炜/220\",\"deptCode\":\"90\",\"deptName\":\"外科\",\"diagnosis\":\"卵巢恶性肿瘤\",\"itemList\":[{\"amount\":18.3,\"category\":\"项目\",\"count\":\"0\",\"ggxh\":\"\",\"itemCode\":\"121914\",\"itemName\":\"鼻饲管置管\",\"measureCount\":\"1\",\"measureUnit\":\"次\",\"remark\":\"\",\"thrId\":\"121914\"}],\"prescribeDate\":\"2017-10-13 09:29:57\",\"remark\":\"\",\"sickCode\":\"0000362743\"},{\"amount\":1.3,\"code\":\"2102067\",\"createDr\":\"卢进炜/220\",\"deptCode\":\"90\",\"deptName\":\"外科\",\"diagnosis\":\"卵巢恶性肿瘤\",\"itemList\":[{\"amount\":1.3,\"category\":\"项目\",\"count\":\"0\",\"ggxh\":\"\",\"itemCode\":\"950030000004\",\"itemName\":\"一次性注射器50ml(16#側 /支)\",\"measureCount\":\"1\",\"measureUnit\":\"支\",\"remark\":\"\",\"thrId\":\"950030000004\"}],\"prescribeDate\":\"2017-10-15 23:20:22\",\"remark\":\"\",\"sickCode\":\"0000362743\"},{\"amount\":231.5,\"code\":\"2099946\",\"createDr\":\"卢进炜/220\",\"deptCode\":\"90\",\"deptName\":\"外科\",\"diagnosis\":\"卵巢恶性肿瘤\",\"itemList\":[{\"amount\":231.5,\"category\":\"项目\",\"count\":\"0\",\"ggxh\":\"\",\"itemCode\":\"121258\",\"itemName\":\"生化全套\",\"measureCount\":\"1\",\"measureUnit\":\"次\",\"remark\":\"\",\"thrId\":\"121258\"}],\"prescribeDate\":\"2017-10-15 09:31:50\",\"remark\":\"\",\"sickCode\":\"0000362743\"},{\"amount\":14.8,\"code\":\"2174111\",\"createDr\":\"卢进炜/220\",\"deptCode\":\"90\",\"deptName\":\"外科\",\"diagnosis\":\"卵巢恶性肿瘤\",\"itemList\":[{\"amount\":5.2,\"category\":\"药品\",\"count\":\"0\",\"ggxh\":\"250ml:12.5g/瓶(软袋)\",\"itemCode\":\"120007\",\"itemName\":\"5%葡萄糖注射液\",\"measureCount\":\"250\",\"measureUnit\":\"ml\",\"remark\":\"bid\",\"thrId\":\"120007\"},{\"amount\":9.6,\"category\":\"药品\",\"count\":\"0\",\"ggxh\":\"2ml:0.2g*10瓶/盒\",\"itemCode\":\"120441\",\"itemName\":\"西咪替丁注射液\",\"measureCount\":\"0.4\",\"measureUnit\":\"g\",\"remark\":\"bid\",\"thrId\":\"120441\"}],\"prescribeDate\":\"2017-10-31 09:05:06\",\"remark\":\"\",\"sickCode\":\"0000362743\"},{\"amount\":10.8,\"code\":\"2205765\",\"createDr\":\"卢进炜/220\",\"deptCode\":\"90\",\"deptName\":\"外科\",\"diagnosis\":\"卵巢恶性肿瘤\",\"itemList\":[{\"amount\":10.8,\"category\":\"项目\",\"count\":\"0\",\"ggxh\":\"\",\"itemCode\":\"122411\",\"itemName\":\"中心吸氧\",\"measureCount\":\"3\",\"measureUnit\":\"小时\",\"remark\":\"\",\"thrId\":\"122411\"}],\"prescribeDate\":\"2017-11-06 17:37:48\",\"remark\":\"\",\"sickCode\":\"0000362743\"},{\"amount\":11,\"code\":\"2069829\",\"createDr\":\"卢进炜/220\",\"deptCode\":\"90\",\"deptName\":\"外科\",\"diagnosis\":\"卵巢恶性肿瘤\",\"itemList\":[{\"amount\":11,\"category\":\"项目\",\"count\":\"0\",\"ggxh\":\"\",\"itemCode\":\"950023000006\",\"itemName\":\"3M透明敷料10*12\",\"measureCount\":\"1\",\"measureUnit\":\"片\",\"remark\":\"\",\"thrId\":\"950023000006\"}],\"prescribeDate\":\"2017-10-09 10:06:00\",\"remark\":\"\",\"sickCode\":\"0000362743\"},{\"amount\":0,\"code\":\"2069861\",\"createDr\":\"卢进炜/220\",\"deptCode\":\"90\",\"deptName\":\"外科\",\"diagnosis\":\"卵巢恶性肿瘤\",\"itemList\":[{\"amount\":0,\"category\":\"项目\",\"count\":\"0\",\"ggxh\":\"\",\"itemCode\":\"121352\",\"itemName\":\"流质饮食\",\"measureUnit\":\"\",\"remark\":\"\",\"thrId\":\"121352\"}],\"prescribeDate\":\"2017-10-09 10:07:08\",\"remark\":\"\",\"sickCode\":\"0000362743\"},{\"amount\":46.15,\"code\":\"2135833\",\"createDr\":\"卢进炜/220\",\"deptCode\":\"90\",\"deptName\":\"外科\",\"diagnosis\":\"卵巢恶性肿瘤\",\"itemList\":[{\"amount\":4.8,\"category\":\"药品\",\"count\":\"0\",\"ggxh\":\"100ml:0.9g/瓶(塑瓶)\",\"itemCode\":\"119989\",\"itemName\":\"0.9%氯化钠注射液\",\"measureCount\":\"100\",\"measureUnit\":\"ml\",\"remark\":\"bid\",\"thrId\":\"119989\"},{\"amount\":41.35,\"category\":\"药品\",\"count\":\"0\",\"ggxh\":\"30mg/瓶\",\"itemCode\":\"120244\",\"itemName\":\"注射用兰索拉唑\",\"measureCount\":\"30\",\"measureUnit\":\"mg\",\"remark\":\"bid\",\"thrId\":\"120244\"}],\"prescribeDate\":\"2017-10-23 09:05:58\",\"remark\":\"\",\"sickCode\":\"0000362743\"},{\"code\":\"2182176\",\"createDr\":\"卢进炜/220\",\"deptCode\":\"90\",\"deptName\":\"外科\",\"diagnosis\":\"卵巢恶性肿瘤\",\"itemList\":[{\"category\":\"项目\",\"count\":\"0\",\"ggxh\":\"\",\"itemCode\":\"122532\",\"itemName\":\"静脉采血费\",\"measureCount\":\"1\",\"measureUnit\":\"次\",\"remark\":\"\",\"thrId\":\"122532\"}],\"prescribeDate\":\"2017-11-01 16:26:03\",\"remark\":\"\",\"sickCode\":\"0000362743\"},{\"amount\":3.56,\"code\":\"2201702\",\"createDr\":\"卢进炜/220\",\"deptCode\":\"90\",\"deptName\":\"外科\",\"diagnosis\":\"卵巢恶性肿瘤\",\"itemList\":[{\"amount\":3.56,\"category\":\"药品\",\"count\":\"0\",\"ggxh\":\"1ml:10mg*10支/盒\",\"itemCode\":\"120530\",\"itemName\":\"盐酸吗啡注射液\",\"measureCount\":\"10\",\"measureUnit\":\"mg\",\"remark\":\"prn\",\"thrId\":\"120530\"}],\"prescribeDate\":\"2017-11-06 08:47:22\",\"remark\":\"\",\"sickCode\":\"0000362743\"},{\"amount\":3.56,\"code\":\"2200047\",\"createDr\":\"叶小聪/223\",\"deptCode\":\"90\",\"deptName\":\"外科\",\"diagnosis\":\"卵巢恶性肿瘤\",\"itemList\":[{\"amount\":3.56,\"category\":\"药品\",\"count\":\"0\",\"ggxh\":\"1ml:10mg*10支/盒\",\"itemCode\":\"120530\",\"itemName\":\"盐酸吗啡注射液\",\"measureCount\":\"10\",\"measureUnit\":\"mg\",\"remark\":\"qd\",\"thrId\":\"120530\"}],\"prescribeDate\":\"2017-11-05 17:45:57\",\"remark\":\"\",\"sickCode\":\"0000362743\"},{\"code\":\"2194412\",\"createDr\":\"卢进炜/220\",\"deptCode\":\"90\",\"deptName\":\"外科\",\"diagnosis\":\"卵巢恶性肿瘤\",\"itemList\":[{\"category\":\"项目\",\"count\":\"0\",\"ggxh\":\"\",\"itemCode\":\"121236\",\"itemName\":\"Ⅰ级护理\",\"measureUnit\":\"\",\"remark\":\"\",\"thrId\":\"121236\"}],\"prescribeDate\":\"2017-11-04 09:30:42\",\"remark\":\"\",\"sickCode\":\"0000362743\"},{\"amount\":3.6,\"code\":\"2194402\",\"createDr\":\"卢进炜/220\",\"deptCode\":\"90\",\"deptName\":\"外科\",\"diagnosis\":\"卵巢恶性肿瘤\",\"itemList\":[{\"amount\":3.6,\"category\":\"项目\",\"count\":\"0\",\"ggxh\":\"\",\"itemCode\":\"122411\",\"itemName\":\"中心吸氧\",\"measureCount\":\"1\",\"measureUnit\":\"次\",\"remark\":\"qd\",\"thrId\":\"122411\"}],\"prescribeDate\":\"2017-11-04 09:30:26\",\"remark\":\"\",\"sickCode\":\"0000362743\"},{\"amount\":1.8,\"code\":\"2040306\",\"createDr\":\"卢进炜/220\",\"deptCode\":\"90\",\"deptName\":\"外科\",\"diagnosis\":\"卵巢恶性肿瘤\",\"itemList\":[{\"amount\":1.8,\"category\":\"项目\",\"count\":\"0\",\"ggxh\":\"\",\"itemCode\":\"121952\",\"itemName\":\"引流管冲洗(留置引流次日起每日收)\",\"measureCount\":\"1\",\"measureUnit\":\"次\",\"remark\":\"qd\",\"thrId\":\"121952\"}],\"prescribeDate\":\"2017-09-30 23:19:19\",\"remark\":\"\",\"sickCode\":\"0000362743\"},{\"amount\":2.7,\"code\":\"2040307\",\"createDr\":\"卢进炜/220\",\"deptCode\":\"90\",\"deptName\":\"外科\",\"diagnosis\":\"卵巢恶性肿瘤\",\"itemList\":[{\"amount\":2.7,\"category\":\"项目\",\"count\":\"0\",\"ggxh\":\"\",\"itemCode\":\"121953\",\"itemName\":\"引流管冲洗(只更换引流装置)\",\"measureCount\":\"1\",\"measureUnit\":\"次\",\"remark\":\"qod\",\"thrId\":\"121953\"}],\"prescribeDate\":\"2017-09-30 23:24:45\",\"remark\":\"\",\"sickCode\":\"0000362743\"},{\"amount\":19.9,\"code\":\"2058185\",\"createDr\":\"卢进炜/220\",\"deptCode\":\"90\",\"deptName\":\"外科\",\"diagnosis\":\"卵巢恶性肿瘤\",\"itemList\":[{\"amount\":19.9,\"category\":\"项目\",\"count\":\"0\",\"ggxh\":\"\",\"itemCode\":\"121291\",\"itemName\":\"大换药\",\"measureCount\":\"1\",\"measureUnit\":\"次\",\"remark\":\"\",\"thrId\":\"121291\"}],\"prescribeDate\":\"2017-10-06 09:19:19\",\"remark\":\"\",\"sickCode\":\"0000362743\"},{\"amount\":2.3,\"code\":\"2091369\",\"createDr\":\"卢进炜/220\",\"deptCode\":\"90\",\"deptName\":\"外科\",\"diagnosis\":\"卵巢恶性肿瘤\",\"itemList\":[{\"amount\":2.3,\"category\":\"项目\",\"count\":\"0\",\"ggxh\":\"\",\"itemCode\":\"121945\",\"itemName\":\"胃肠减压(负压引流)\",\"measureCount\":\"1\",\"measureUnit\":\"日\",\"remark\":\"qd\",\"thrId\":\"121945\"}],\"prescribeDate\":\"2017-10-13 09:28:56\",\"remark\":\"\",\"sickCode\":\"0000362743\"},{\"amount\":3.25,\"code\":\"2093698\",\"createDr\":\"卢进炜/220\",\"deptCode\":\"90\",\"deptName\":\"外科\",\"diagnosis\":\"卵巢恶性肿瘤\",\"itemList\":[{\"amount\":3.25,\"category\":\"项目\",\"count\":\"0\",\"ggxh\":\"\",\"itemCode\":\"960098000002\",\"itemName\":\"一次性负压引流器(1000ml/个)\",\"measureCount\":\"1\",\"measureUnit\":\"个\",\"remark\":\"\",\"thrId\":\"960098000002\"}],\"prescribeDate\":\"2017-10-13 15:36:55\",\"remark\":\"\",\"sickCode\":\"0000362743\"},{\"amount\":3.25,\"code\":\"2102073\",\"createDr\":\"卢进炜/220\",\"deptCode\":\"90\",\"deptName\":\"外科\",\"diagnosis\":\"卵巢恶性肿瘤\",\"itemList\":[{\"amount\":3.25,\"category\":\"项目\",\"count\":\"0\",\"ggxh\":\"\",\"itemCode\":\"960098000002\",\"itemName\":\"一次性负压引流器(1000ml/个)\",\"measureCount\":\"1\",\"measureUnit\":\"个\",\"remark\":\"\",\"thrId\":\"960098000002\"}],\"prescribeDate\":\"2017-10-15 23:42:20\",\"remark\":\"\",\"sickCode\":\"0000362743\"},{\"amount\":0.81,\"code\":\"2172059\",\"createDr\":\"叶小聪/223\",\"deptCode\":\"90\",\"deptName\":\"外科\",\"diagnosis\":\"卵巢恶性肿瘤\",\"itemList\":[{\"amount\":0.81,\"category\":\"药品\",\"count\":\"0\",\"ggxh\":\"2ml:10mg*10瓶/盒\",\"itemCode\":\"120531\",\"itemName\":\"盐酸甲氧氯普胺注射液\",\"measureCount\":\"10\",\"measureUnit\":\"mg\",\"remark\":\"st\",\"thrId\":\"120531\"}],\"prescribeDate\":\"2017-10-30 16:51:24\",\"remark\":\"\",\"sickCode\":\"0000362743\"},{\"amount\":231.5,\"code\":\"2168562\",\"createDr\":\"卢进炜/220\",\"deptCode\":\"90\",\"deptName\":\"外科\",\"diagnosis\":\"卵巢恶性肿瘤\",\"itemList\":[{\"amount\":231.5,\"category\":\"项目\",\"count\":\"0\",\"ggxh\":\"\",\"itemCode\":\"121258\",\"itemName\":\"生化全套\",\"measureCount\":\"1\",\"measureUnit\":\"次\",\"remark\":\"\",\"thrId\":\"121258\"}],\"prescribeDate\":\"2017-10-30 09:02:13\",\"remark\":\"\",\"sickCode\":\"0000362743\"},{\"amount\":0.81,\"code\":\"2130636\",\"createDr\":\"叶小聪/223\",\"deptCode\":\"90\",\"deptName\":\"外科\",\"diagnosis\":\"卵巢恶性肿瘤\",\"itemList\":[{\"amount\":0.81,\"category\":\"药品\",\"count\":\"0\",\"ggxh\":\"2ml:10mg*10瓶/盒\",\"itemCode\":\"120531\",\"itemName\":\"盐酸甲氧氯普胺注射液\",\"measureCount\":\"10\",\"measureUnit\":\"mg\",\"remark\":\"st\",\"thrId\":\"120531\"}],\"prescribeDate\":\"2017-10-21 19:52:26\",\"remark\":\"\",\"sickCode\":\"0000362743\"},{\"amount\":7.96,\"code\":\"2140486\",\"createDr\":\"卢进炜/220\",\"deptCode\":\"90\",\"deptName\":\"外科\",\"diagnosis\":\"卵巢恶性肿瘤\",\"itemList\":[{\"amount\":4.8,\"category\":\"药品\",\"count\":\"0\",\"ggxh\":\"100ml:5g/瓶(软袋)\",\"itemCode\":\"120005\",\"itemName\":\"5%葡萄糖注射液\",\"measureCount\":\"100\",\"measureUnit\":\"ml\",\"remark\":\"bid\",\"thrId\":\"120005\"},{\"amount\":3.16,\"category\":\"药品\",\"count\":\"0\",\"ggxh\":\"1ml:10mg/支\",\"itemCode\":\"120025\",\"itemName\":\"盐酸消旋山莨菪碱注射液\",\"measureCount\":\"10\",\"measureUnit\":\"mg\",\"remark\":\"bid\",\"thrId\":\"120025\"}],\"prescribeDate\":\"2017-10-24 10:06:05\",\"remark\":\"\",\"sickCode\":\"0000362743\"},{\"code\":\"2120625\",\"createDr\":\"卢进炜/220\",\"deptCode\":\"90\",\"deptName\":\"外科\",\"diagnosis\":\"卵巢恶性肿瘤\",\"itemList\":[{\"category\":\"项目\",\"count\":\"0\",\"ggxh\":\"\",\"itemCode\":\"950046000001\",\"itemName\":\"特殊采血管\",\"measureCount\":\"1\",\"measureUnit\":\"支\",\"remark\":\"\",\"thrId\":\"950046000001\"}],\"prescribeDate\":\"2017-10-19 16:25:26\",\"remark\":\"\",\"sickCode\":\"0000362743\"},{\"amount\":3.56,\"code\":\"2188160\",\"createDr\":\"杨文显/010\",\"deptCode\":\"90\",\"deptName\":\"外科\",\"diagnosis\":\"卵巢恶性肿瘤\",\"itemList\":[{\"amount\":3.56,\"category\":\"药品\",\"count\":\"0\",\"ggxh\":\"1ml:10mg*10支/盒\",\"itemCode\":\"120530\",\"itemName\":\"盐酸吗啡注射液\",\"measureCount\":\"10\",\"measureUnit\":\"mg\",\"remark\":\"qd\",\"thrId\":\"120530\"}],\"prescribeDate\":\"2017-11-02 21:35:41\",\"remark\":\"\",\"sickCode\":\"0000362743\"},{\"code\":\"2182177\",\"createDr\":\"卢进炜/220\",\"deptCode\":\"90\",\"deptName\":\"外科\",\"diagnosis\":\"卵巢恶性肿瘤\",\"itemList\":[{\"category\":\"项目\",\"count\":\"0\",\"ggxh\":\"\",\"itemCode\":\"950046000001\",\"itemName\":\"特殊采血管\",\"measureCount\":\"1\",\"measureUnit\":\"支\",\"remark\":\"\",\"thrId\":\"950046000001\"}],\"prescribeDate\":\"2017-11-01 16:26:03\",\"remark\":\"\",\"sickCode\":\"0000362743\"},{\"amount\":3.56,\"code\":\"2182850\",\"createDr\":\"卢进炜/220\",\"deptCode\":\"90\",\"deptName\":\"外科\",\"diagnosis\":\"卵巢恶性肿瘤\",\"itemList\":[{\"amount\":3.56,\"category\":\"药品\",\"count\":\"0\",\"ggxh\":\"1ml:10mg*10支/盒\",\"itemCode\":\"120530\",\"itemName\":\"盐酸吗啡注射液\",\"measureCount\":\"10\",\"measureUnit\":\"mg\",\"remark\":\"qd\",\"thrId\":\"120530\"}],\"prescribeDate\":\"2017-11-01 19:04:18\",\"remark\":\"\",\"sickCode\":\"0000362743\"},{\"amount\":60.7,\"code\":\"2099947\",\"createDr\":\"卢进炜/220\",\"deptCode\":\"90\",\"deptName\":\"外科\",\"diagnosis\":\"卵巢恶性肿瘤\",\"itemList\":[{\"amount\":60.7,\"category\":\"项目\",\"count\":\"0\",\"ggxh\":\"\",\"itemCode\":\"121223\",\"itemName\":\"血常规(CRP)\",\"measureCount\":\"1\",\"measureUnit\":\"次\",\"remark\":\"\",\"thrId\":\"121223\"}],\"prescribeDate\":\"2017-10-15 09:31:50\",\"remark\":\"\",\"sickCode\":\"0000362743\"},{\"amount\":0.81,\"code\":\"2161456\",\"createDr\":\"卢进炜/220\",\"deptCode\":\"90\",\"deptName\":\"外科\",\"diagnosis\":\"卵巢恶性肿瘤\",\"itemList\":[{\"amount\":0.81,\"category\":\"药品\",\"count\":\"0\",\"ggxh\":\"2ml:10mg*10瓶/盒\",\"itemCode\":\"120531\",\"itemName\":\"盐酸甲氧氯普胺注射液\",\"measureCount\":\"10\",\"measureUnit\":\"mg\",\"remark\":\"qd\",\"thrId\":\"120531\"}],\"prescribeDate\":\"2017-10-28 09:21:47\",\"remark\":\"\",\"sickCode\":\"0000362743\"},{\"amount\":3.56,\"code\":\"2172543\",\"createDr\":\"郑华滨/015\",\"deptCode\":\"90\",\"deptName\":\"外科\",\"diagnosis\":\"卵巢恶性肿瘤\",\"itemList\":[{\"amount\":3.56,\"category\":\"药品\",\"count\":\"0\",\"ggxh\":\"1ml:10mg*10支/盒\",\"itemCode\":\"120530\",\"itemName\":\"盐酸吗啡注射液\",\"measureCount\":\"10\",\"measureUnit\":\"mg\",\"remark\":\"qd\",\"thrId\":\"120530\"}],\"prescribeDate\":\"2017-10-30 21:13:08\",\"remark\":\"\",\"sickCode\":\"0000362743\"},{\"amount\":3.56,\"code\":\"2164343\",\"createDr\":\"卢进炜/220\",\"deptCode\":\"90\",\"deptName\":\"外科\",\"diagnosis\":\"卵巢恶性肿瘤\",\"itemList\":[{\"amount\":3.56,\"category\":\"药品\",\"count\":\"0\",\"ggxh\":\"1ml:10mg*10支/盒\",\"itemCode\":\"120530\",\"itemName\":\"盐酸吗啡注射液\",\"measureCount\":\"10\",\"measureUnit\":\"mg\",\"remark\":\"qd\",\"thrId\":\"120530\"}],\"prescribeDate\":\"2017-10-28 21:43:11\",\"remark\":\"\",\"sickCode\":\"0000362743\"},{\"amount\":3.56,\"code\":\"2160284\",\"createDr\":\"叶小聪/223\",\"deptCode\":\"90\",\"deptName\":\"外科\",\"diagnosis\":\"卵巢恶性肿瘤\",\"itemList\":[{\"amount\":3.56,\"category\":\"药品\",\"count\":\"0\",\"ggxh\":\"1ml:10mg*10支/盒\",\"itemCode\":\"120530\",\"itemName\":\"盐酸吗啡注射液\",\"measureCount\":\"10\",\"measureUnit\":\"mg\",\"remark\":\"qd\",\"thrId\":\"120530\"}],\"prescribeDate\":\"2017-10-27 20:30:41\",\"remark\":\"\",\"sickCode\":\"0000362743\"},{\"amount\":0,\"code\":\"2204649\",\"createDr\":\"卢进炜/220\",\"deptCode\":\"90\",\"deptName\":\"外科\",\"diagnosis\":\"卵巢恶性肿瘤\",\"itemList\":[{\"amount\":0,\"category\":\"项目\",\"count\":\"0\",\"ggxh\":\"\",\"itemCode\":\"120593\",\"itemName\":\"自动出院\",\"measureUnit\":\"\",\"remark\":\"\",\"thrId\":\"120593\"}],\"prescribeDate\":\"2017-11-06 13:38:05\",\"remark\":\"\",\"sickCode\":\"0000362743\"},{\"amount\":7.9,\"code\":\"2074420\",\"createDr\":\"卢进炜/220\",\"deptCode\":\"90\",\"deptName\":\"外科\",\"diagnosis\":\"卵巢恶性肿瘤\",\"itemList\":[{\"amount\":6.5,\"category\":\"药品\",\"count\":\"0\",\"ggxh\":\"500ml:29.5g/瓶(软袋)\",\"itemCode\":\"120016\",\"itemName\":\"葡萄糖氯化钠注射液\",\"measureCount\":\"500\",\"measureUnit\":\"ml\",\"remark\":\"bid\",\"thrId\":\"120016\"},{\"amount\":1.4,\"category\":\"药品\",\"count\":\"0\",\"ggxh\":\"10ml:1g*1瓶/支\",\"itemCode\":\"120242\",\"itemName\":\"氯化钾注射液\",\"measureCount\":\"15\",\"measureUnit\":\"ml\",\"remark\":\"bid\",\"thrId\":\"120242\"}],\"prescribeDate\":\"2017-10-10 09:05:49\",\"remark\":\"\",\"sickCode\":\"0000362743\"},{\"amount\":3.25,\"code\":\"2126200\",\"createDr\":\"卢进炜/220\",\"deptCode\":\"90\",\"deptName\":\"外科\",\"diagnosis\":\"卵巢恶性肿瘤\",\"itemList\":[{\"amount\":3.25,\"category\":\"项目\",\"count\":\"0\",\"ggxh\":\"\",\"itemCode\":\"960098000002\",\"itemName\":\"一次性负压引流器(1000ml/个)\",\"measureCount\":\"1\",\"measureUnit\":\"个\",\"remark\":\"\",\"thrId\":\"960098000002\"}],\"prescribeDate\":\"2017-10-20 16:42:19\",\"remark\":\"\",\"sickCode\":\"0000362743\"},{\"amount\":0.81,\"code\":\"2135839\",\"createDr\":\"卢进炜/220\",\"deptCode\":\"90\",\"deptName\":\"外科\",\"diagnosis\":\"卵巢恶性肿瘤\",\"itemList\":[{\"amount\":0.81,\"category\":\"药品\",\"count\":\"0\",\"ggxh\":\"2ml:10mg*10瓶/盒\",\"itemCode\":\"120531\",\"itemName\":\"盐酸甲氧氯普胺注射液\",\"measureCount\":\"10\",\"measureUnit\":\"mg\",\"remark\":\"qd\",\"thrId\":\"120531\"}],\"prescribeDate\":\"2017-10-23 09:06:52\",\"remark\":\"\",\"sickCode\":\"0000362743\"},{\"amount\":3.56,\"code\":\"2178238\",\"createDr\":\"叶小聪/223\",\"deptCode\":\"90\",\"deptName\":\"外科\",\"diagnosis\":\"卵巢恶性肿瘤\",\"itemList\":[{\"amount\":3.56,\"category\":\"药品\",\"count\":\"0\",\"ggxh\":\"1ml:10mg*10支/盒\",\"itemCode\":\"120530\",\"itemName\":\"盐酸吗啡注射液\",\"measureCount\":\"10\",\"measureUnit\":\"mg\",\"remark\":\"qd\",\"thrId\":\"120530\"}],\"prescribeDate\":\"2017-10-31 23:36:40\",\"remark\":\"\",\"sickCode\":\"0000362743\"},{\"amount\":1.98,\"code\":\"2193587\",\"createDr\":\"卢进炜/220\",\"deptCode\":\"90\",\"deptName\":\"外科\",\"diagnosis\":\"卵巢恶性肿瘤\",\"itemList\":[{\"amount\":1.98,\"category\":\"药品\",\"count\":\"0\",\"ggxh\":\"2ml:20mg/支\",\"itemCode\":\"120125\",\"itemName\":\"呋塞米注射液\",\"measureCount\":\"20\",\"measureUnit\":\"mg\",\"remark\":\"qd\",\"thrId\":\"120125\"}],\"prescribeDate\":\"2017-11-04 08:42:31\",\"remark\":\"\",\"sickCode\":\"0000362743\"},{\"amount\":3.56,\"code\":\"2197293\",\"createDr\":\"郑华滨/015\",\"deptCode\":\"90\",\"deptName\":\"外科\",\"diagnosis\":\"卵巢恶性肿瘤\",\"itemList\":[{\"amount\":3.56,\"category\":\"药品\",\"count\":\"0\",\"ggxh\":\"1ml:10mg*10支/盒\",\"itemCode\":\"120530\",\"itemName\":\"盐酸吗啡注射液\",\"measureCount\":\"10\",\"measureUnit\":\"mg\",\"remark\":\"qd\",\"thrId\":\"120530\"}],\"prescribeDate\":\"2017-11-05 05:58:48\",\"remark\":\"\",\"sickCode\":\"0000362743\"},{\"amount\":1.98,\"code\":\"2201710\",\"createDr\":\"卢进炜/220\",\"deptCode\":\"90\",\"deptName\":\"外科\",\"diagnosis\":\"卵巢恶性肿瘤\",\"itemList\":[{\"amount\":1.98,\"category\":\"药品\",\"count\":\"0\",\"ggxh\":\"2ml:20mg/支\",\"itemCode\":\"120125\",\"itemName\":\"呋塞米注射液\",\"measureCount\":\"20\",\"measureUnit\":\"mg\",\"remark\":\"qd\",\"thrId\":\"120125\"}],\"prescribeDate\":\"2017-11-06 08:47:22\",\"remark\":\"\",\"sickCode\":\"0000362743\"},{\"amount\":3.56,\"code\":\"2192700\",\"createDr\":\"林添福/072\",\"deptCode\":\"90\",\"deptName\":\"外科\",\"diagnosis\":\"卵巢恶性肿瘤\",\"itemList\":[{\"amount\":3.56,\"category\":\"药品\",\"count\":\"0\",\"ggxh\":\"1ml:10mg*10支/盒\",\"itemCode\":\"120530\",\"itemName\":\"盐酸吗啡注射液\",\"measureCount\":\"10\",\"measureUnit\":\"mg\",\"remark\":\"qd\",\"thrId\":\"120530\"}],\"prescribeDate\":\"2017-11-03 20:02:58\",\"remark\":\"\",\"sickCode\":\"0000362743\"},{\"amount\":0,\"code\":\"2038984\",\"createDr\":\"卢进炜/220\",\"deptCode\":\"90\",\"deptName\":\"外科\",\"diagnosis\":\"卵巢恶性肿瘤\",\"itemList\":[{\"amount\":0,\"category\":\"项目\",\"count\":\"0\",\"ggxh\":\"\",\"itemCode\":\"122334\",\"itemName\":\"测血压qd或bid\",\"measureUnit\":\"\",\"remark\":\"\",\"thrId\":\"122334\"}],\"prescribeDate\":\"2017-09-30 23:19:19\",\"remark\":\"\",\"sickCode\":\"0000362743\"},{\"amount\":0.33,\"code\":\"2038990\",\"createDr\":\"卢进炜/220\",\"deptCode\":\"90\",\"deptName\":\"外科\",\"diagnosis\":\"卵巢恶性肿瘤\",\"itemList\":[{\"amount\":0.33,\"category\":\"药品\",\"count\":\"0\",\"ggxh\":\"5mg*100片/瓶\",\"itemCode\":\"120226\",\"itemName\":\"甲氧氯普胺片\",\"measureCount\":\"5\",\"measureUnit\":\"mg\",\"remark\":\"tid\",\"thrId\":\"120226\"}],\"prescribeDate\":\"2017-09-30 23:19:19\",\"remark\":\"\",\"sickCode\":\"0000362743\"},{\"amount\":9.77,\"code\":\"2039064\",\"createDr\":\"卢进炜/220\",\"deptCode\":\"90\",\"deptName\":\"外科\",\"diagnosis\":\"卵巢恶性肿瘤\",\"itemList\":[{\"amount\":0.5,\"category\":\"药品\",\"count\":\"0\",\"ggxh\":\"10ml:90mgl/瓶\",\"itemCode\":\"119994\",\"itemName\":\"0.9%氯化钠注射液\",\"measureCount\":\"5\",\"measureUnit\":\"ml\",\"remark\":\"bid\",\"thrId\":\"119994\"},{\"amount\":9.27,\"category\":\"药品\",\"count\":\"0\",\"ggxh\":\"2ml:12500iu*10支/盒\",\"itemCode\":\"120181\",\"itemName\":\"肝素钠注射液\",\"measureCount\":\"50\",\"measureUnit\":\"IU\",\"remark\":\"bid\",\"thrId\":\"120181\"}],\"prescribeDate\":\"2017-09-30 22:06:47\",\"remark\":\"\",\"sickCode\":\"0000362743\"},{\"amount\":1.98,\"code\":\"2164572\",\"createDr\":\"卢进炜/220\",\"deptCode\":\"90\",\"deptName\":\"外科\",\"diagnosis\":\"卵巢恶性肿瘤\",\"itemList\":[{\"amount\":1.98,\"category\":\"药品\",\"count\":\"0\",\"ggxh\":\"2ml:20mg/支\",\"itemCode\":\"120125\",\"itemName\":\"呋塞米注射液\",\"measureCount\":\"20\",\"measureUnit\":\"mg\",\"remark\":\"qd\",\"thrId\":\"120125\"}],\"prescribeDate\":\"2017-10-29 08:13:33\",\"remark\":\"\",\"sickCode\":\"0000362743\"},{\"amount\":60.7,\"code\":\"2168563\",\"createDr\":\"卢进炜/220\",\"deptCode\":\"90\",\"deptName\":\"外科\",\"diagnosis\":\"卵巢恶性肿瘤\",\"itemList\":[{\"amount\":60.7,\"category\":\"项目\",\"count\":\"0\",\"ggxh\":\"\",\"itemCode\":\"121223\",\"itemName\":\"血常规(CRP)\",\"measureCount\":\"1\",\"measureUnit\":\"次\",\"remark\":\"\",\"thrId\":\"121223\"}],\"prescribeDate\":\"2017-10-30 09:02:13\",\"remark\":\"\",\"sickCode\":\"0000362743\"},{\"amount\":19.9,\"code\":\"2069828\",\"createDr\":\"卢进炜/220\",\"deptCode\":\"90\",\"deptName\":\"外科\",\"diagnosis\":\"卵巢恶性肿瘤\",\"itemList\":[{\"amount\":19.9,\"category\":\"项目\",\"count\":\"0\",\"ggxh\":\"\",\"itemCode\":\"121291\",\"itemName\":\"大换药\",\"measureCount\":\"1\",\"measureUnit\":\"次\",\"remark\":\"\",\"thrId\":\"121291\"}],\"prescribeDate\":\"2017-10-09 10:06:00\",\"remark\":\"\",\"sickCode\":\"0000362743\"},{\"amount\":18.3,\"code\":\"2126187\",\"createDr\":\"卢进炜/220\",\"deptCode\":\"90\",\"deptName\":\"外科\",\"diagnosis\":\"卵巢恶性肿瘤\",\"itemList\":[{\"amount\":18.3,\"category\":\"项目\",\"count\":\"0\",\"ggxh\":\"\",\"itemCode\":\"121914\",\"itemName\":\"鼻饲管置管\",\"measureCount\":\"1\",\"measureUnit\":\"次\",\"remark\":\"\",\"thrId\":\"121914\"}],\"prescribeDate\":\"2017-10-20 16:40:02\",\"remark\":\"\",\"sickCode\":\"0000362743\"}]},\"message\":\"success\"}\n"; BaseResponse> listBaseResponse = JSONObject.parseObject(response, new TypeReference>>() { }); return listBaseResponse; } catch (Exception e) { log.error("获取患者处方信息", e); return ResultVOUtils.error(500, "连接第三方系统接口服务出错"); } } /** * 提交第三方产品信息 * * @param postRelProductRequest * @return */ public BaseResponse postRelProduct(PostRelProductRequest postRelProductRequest) { ThrSystemEntity basicThirdSysEntity = basicThirdSysService.selectByThirdId("thirdId"); String url = basicThirdSysEntity.getThridUrl() + "/udiwms/erp/post/udiRel/product"; String response = ""; try { response = httpOkClient.uCloudPost(url, postRelProductRequest); BaseResponse listBaseResponse = JSONObject.parseObject(response, new TypeReference>() { }); return listBaseResponse; } catch (Exception e) { log.error("提交第三产品信息异常" + response, e); return ResultVOUtils.error(500, "连接第三方系统接口服务出错"); } } //测试连通性 public BaseResponse testConnection(ThrSystemEntity thrSystemEntity) { String response = httpOkClient.uCloudPost(thrSystemEntity.getThridUrl() + "/udiwms/erp/testLocal", "{}"); log.info(response); if (StrUtil.isBlank(response)) { return ResultVOUtils.error(500, "连接失败"); } try { return JSONObject.parseObject(response, BaseResponse.class); } catch (Exception e) { log.info("测试第三方服务连通性失败"); return ResultVOUtils.error(500, "连接失败"); } } //测试连通性 public BaseResponse testThridConnect(ThrSystemEntity thrSystemEntity) { String response = httpOkClient.uCloudPost(thrSystemEntity.getThridUrl() + "/udiwms/erp/testThirdSys", "{}"); log.info(response); try { return JSONObject.parseObject(response, BaseResponse.class); } catch (Exception e) { log.info("测试第三方服务接口连通性失败"); return ResultVOUtils.error(500, "连接失败"); } } //下载第三方系统单据类型 public BaseResponse> getBusTypes(FilterBasicThirdSysDetailRequest filterBasicThirdSysDetailRequest) { ThrSystemEntity thrSystemEntity = basicThirdSysService.selectByThirdId(filterBasicThirdSysDetailRequest.getThirdSysFk()); String url = thrSystemEntity.getThridUrl() + "/udiwms/erp/getOrderType"; UdiwmsBusTypeRequest udiwmsBusTypeRequest = new UdiwmsBusTypeRequest(); udiwmsBusTypeRequest.setThirdSys(filterBasicThirdSysDetailRequest.getThirdSysFk()); udiwmsBusTypeRequest.setPage(filterBasicThirdSysDetailRequest.getPage()); udiwmsBusTypeRequest.setLimit(filterBasicThirdSysDetailRequest.getLimit()); try { String response = httpOkClient.uCloudPost(url, udiwmsBusTypeRequest, thrSystemEntity); log.info(response); BaseResponse> udiDlDeviceResponse = JSONObject.parseObject(response, new TypeReference>>() { }); if (udiDlDeviceResponse != null) { return udiDlDeviceResponse; } else { return ResultVOUtils.error(500, "查询第三方数据失败!"); } } catch (Exception e) { log.error("获取单据类型异常", e); return ResultVOUtils.error(500, "连接第三方系统接口服务出错!"); } } /** * 上传文件到第三方接口服务,解析第三方系统产品信息并获取回调结果 * * @param thirdSys * @return */ public BaseResponse uploadPi(byte[] bytes, String fileName, String thirdSys) { ThrSystemEntity thrSystemEntity = basicThirdSysService.selectByThirdId(thirdSys); String url = thrSystemEntity.getThridUrl() + "/udiwms/erp/pi/upload"; try { MultipartBody.Builder builder = new MultipartBody.Builder() .setType(MultipartBody.FORM); builder.addFormDataPart("file", fileName, RequestBody.create(MediaType.parse("application/vnd.ms-excel"), bytes)); builder.addFormDataPart("thirdSys", thirdSys); MultipartBody multipartBody = builder.build(); Request request = new Request.Builder().url(url).post(multipartBody).build(); Response response = okHttpClient.newCall(request).execute(); response.close(); if (response.code() == 200) { return ResultVOUtils.success("解析成功"); } else { log.info("解析接口响应信息失败,返回信息:{}", response); return ResultVOUtils.error(500, "解析第三方产品信息失败"); } } catch (Exception e) { log.error("解析第三方系统产品信息失败", e); return ResultVOUtils.error(500, "解析第三方系统产品信息失败"); } } /** * 获取项目组套信息 */ public BaseResponse> getBasicProject(DlThirdDestinyRequest dlThirdDestinyRequest) { ThrSystemEntity basicThirdSysEntity = basicThirdSysService.selectByThirdId(dlThirdDestinyRequest.getThirdSys()); String url = basicThirdSysEntity.getThridUrl() + "/udiwms/erp/basic/getProject"; try { String response = httpOkClient.uCloudPost(url, dlThirdDestinyRequest); BaseResponse> listBaseResponse = JSONObject.parseObject(response, new TypeReference>>() { }); return listBaseResponse; } catch (Exception e) { log.error("获取患者处方信息", e); return ResultVOUtils.error(500, "连接第三方系统接口服务出错"); } } }