1
Showing
1 changed file
with
234 additions
and
160 deletions
| ... | @@ -11,11 +11,14 @@ import com.phxl.modules.goods.entity.billback.BillBackWithDetail; | ... | @@ -11,11 +11,14 @@ import com.phxl.modules.goods.entity.billback.BillBackWithDetail; |
| 11 | import org.apache.commons.fileupload.disk.DiskFileItem; | 11 | import org.apache.commons.fileupload.disk.DiskFileItem; |
| 12 | import org.apache.http.HttpEntity; | 12 | import org.apache.http.HttpEntity; |
| 13 | import org.apache.http.HttpResponse; | 13 | import org.apache.http.HttpResponse; |
| 14 | import org.apache.http.NameValuePair; | ||
| 14 | import org.apache.http.client.HttpClient; | 15 | import org.apache.http.client.HttpClient; |
| 16 | import org.apache.http.client.entity.UrlEncodedFormEntity; | ||
| 15 | import org.apache.http.client.methods.HttpPost; | 17 | import org.apache.http.client.methods.HttpPost; |
| 16 | import org.apache.http.entity.mime.MultipartEntityBuilder; | 18 | import org.apache.http.entity.mime.MultipartEntityBuilder; |
| 17 | import org.apache.http.entity.mime.content.FileBody; | 19 | import org.apache.http.entity.mime.content.FileBody; |
| 18 | import org.apache.http.impl.client.HttpClients; | 20 | import org.apache.http.impl.client.HttpClients; |
| 21 | import org.apache.http.message.BasicNameValuePair; | ||
| 19 | import org.apache.http.util.EntityUtils; | 22 | import org.apache.http.util.EntityUtils; |
| 20 | import org.slf4j.Logger; | 23 | import org.slf4j.Logger; |
| 21 | import org.slf4j.LoggerFactory; | 24 | import org.slf4j.LoggerFactory; |
| ... | @@ -78,58 +81,59 @@ import com.phxl.modules.goods.service.supplygoods.MedSupplyGoodsService; | ... | @@ -78,58 +81,59 @@ import com.phxl.modules.goods.service.supplygoods.MedSupplyGoodsService; |
| 78 | @RequestMapping(value = "/Api") | 81 | @RequestMapping(value = "/Api") |
| 79 | public class SpdControlller { | 82 | public class SpdControlller { |
| 80 | 83 | ||
| 81 | /** | 84 | /** |
| 82 | * 日志对象 | 85 | * 日志对象 |
| 83 | */ | 86 | */ |
| 84 | protected Logger logger = LoggerFactory.getLogger(getClass()); | 87 | protected Logger logger = LoggerFactory.getLogger(getClass()); |
| 85 | 88 | ||
| 86 | @Autowired | 89 | @Autowired |
| 87 | private HisCtMedicineMaterialService ctMedicineMaterialService; | 90 | private HisCtMedicineMaterialService ctMedicineMaterialService; |
| 88 | 91 | ||
| 89 | @Autowired | 92 | @Autowired |
| 90 | private InterfaceLogService interfaceLogService; | 93 | private InterfaceLogService interfaceLogService; |
| 91 | 94 | ||
| 92 | @Autowired | 95 | @Autowired |
| 93 | private HisCtDeptService hisCtDeptService; | 96 | private HisCtDeptService hisCtDeptService; |
| 94 | 97 | ||
| 95 | @Autowired | 98 | @Autowired |
| 96 | private CTCareProvService cTCareProvService; | 99 | private CTCareProvService cTCareProvService; |
| 97 | 100 | ||
| 98 | @Autowired | 101 | @Autowired |
| 99 | private MedSupplyGoodsService supplyGoodsService; | 102 | private MedSupplyGoodsService supplyGoodsService; |
| 100 | 103 | ||
| 101 | @Autowired | 104 | @Autowired |
| 102 | private MedStockService stockService; | 105 | private MedStockService stockService; |
| 103 | 106 | ||
| 104 | @Autowired | 107 | @Autowired |
| 105 | private MedPlanService medPlanService; | 108 | private MedPlanService medPlanService; |
| 106 | 109 | ||
| 107 | @Autowired | 110 | @Autowired |
| 108 | private MedInStoreService medInStoreService; | 111 | private MedInStoreService medInStoreService; |
| 109 | 112 | ||
| 110 | @Autowired | 113 | @Autowired |
| 111 | private BillBackService backService; | 114 | private BillBackService backService; |
| 112 | 115 | ||
| 113 | @Autowired | 116 | @Autowired |
| 114 | private BillSettlementService billSettlementService; | 117 | private BillSettlementService billSettlementService; |
| 115 | 118 | ||
| 116 | @Autowired | 119 | @Autowired |
| 117 | private SupplierStockService supplierStockService; | 120 | private SupplierStockService supplierStockService; |
| 118 | 121 | ||
| 119 | @Autowired | 122 | @Autowired |
| 120 | private SuOutStoreService suOutStoreService; | 123 | private SuOutStoreService suOutStoreService; |
| 121 | 124 | ||
| 122 | @Autowired | 125 | @Autowired |
| 123 | private HisSpillsService hisSpillsService; | 126 | private HisSpillsService hisSpillsService; |
| 124 | 127 | ||
| 125 | @Autowired | 128 | @Autowired |
| 126 | private SuInvoiceBackService suInvoiceBackService; | 129 | private SuInvoiceBackService suInvoiceBackService; |
| 127 | 130 | ||
| 128 | 131 | private static HttpClient client; | |
| 129 | @RequestMapping(value="/setMFMedGoods") | 132 | |
| 130 | @ResponseBody | 133 | @RequestMapping(value="/setMFMedGoods") |
| 131 | public String setMFMedGoods(String id,HttpServletRequest request, @RequestBody String medgoodsList){ | 134 | @ResponseBody |
| 132 | logger.debug("药品目录接口请求参数:{}",medgoodsList); | 135 | public String setMFMedGoods(String id,HttpServletRequest request, @RequestBody String medgoodsList){ |
| 136 | logger.debug("药品目录接口请求参数:{}",medgoodsList); | ||
| 133 | String result = ""; | 137 | String result = ""; |
| 134 | String logId = IdUtil.uuid(); | 138 | String logId = IdUtil.uuid(); |
| 135 | String exception = ""; | 139 | String exception = ""; |
| ... | @@ -156,12 +160,12 @@ public class SpdControlller { | ... | @@ -156,12 +160,12 @@ public class SpdControlller { |
| 156 | } | 160 | } |
| 157 | interfaceLogService.setResultLog(response, logId, exception); | 161 | interfaceLogService.setResultLog(response, logId, exception); |
| 158 | return result; | 162 | return result; |
| 159 | } | 163 | } |
| 160 | 164 | ||
| 161 | @RequestMapping(value="/setHDept") | 165 | @RequestMapping(value="/setHDept") |
| 162 | @ResponseBody | 166 | @ResponseBody |
| 163 | public String setHDept(String id,HttpServletRequest request, @RequestBody String params){ | 167 | public String setHDept(String id,HttpServletRequest request, @RequestBody String params){ |
| 164 | logger.debug("医院科室资料接口请求参数:{}",params); | 168 | logger.debug("医院科室资料接口请求参数:{}",params); |
| 165 | String result = ""; | 169 | String result = ""; |
| 166 | String logId = IdUtil.uuid(); | 170 | String logId = IdUtil.uuid(); |
| 167 | String exception = ""; | 171 | String exception = ""; |
| ... | @@ -190,9 +194,9 @@ public class SpdControlller { | ... | @@ -190,9 +194,9 @@ public class SpdControlller { |
| 190 | } | 194 | } |
| 191 | interfaceLogService.setResultLog(response, logId, exception); | 195 | interfaceLogService.setResultLog(response, logId, exception); |
| 192 | return result; | 196 | return result; |
| 193 | } | 197 | } |
| 194 | 198 | ||
| 195 | /** | 199 | /** |
| 196 | * 医院人员资料接口 | 200 | * 医院人员资料接口 |
| 197 | * @param request | 201 | * @param request |
| 198 | * @param params | 202 | * @param params |
| ... | @@ -232,8 +236,8 @@ public class SpdControlller { | ... | @@ -232,8 +236,8 @@ public class SpdControlller { |
| 232 | interfaceLogService.setResultLog(response, logId, exception); | 236 | interfaceLogService.setResultLog(response, logId, exception); |
| 233 | return result; | 237 | return result; |
| 234 | } | 238 | } |
| 235 | 239 | ||
| 236 | 240 | ||
| 237 | /** | 241 | /** |
| 238 | * 医院采购目录接口 | 242 | * 医院采购目录接口 |
| 239 | * @param request | 243 | * @param request |
| ... | @@ -274,8 +278,8 @@ public class SpdControlller { | ... | @@ -274,8 +278,8 @@ public class SpdControlller { |
| 274 | interfaceLogService.setResultLog(response, logId, exception); | 278 | interfaceLogService.setResultLog(response, logId, exception); |
| 275 | return result; | 279 | return result; |
| 276 | } | 280 | } |
| 277 | 281 | ||
| 278 | 282 | ||
| 279 | /** | 283 | /** |
| 280 | * 医院库存接口 | 284 | * 医院库存接口 |
| 281 | * @param request | 285 | * @param request |
| ... | @@ -316,8 +320,8 @@ public class SpdControlller { | ... | @@ -316,8 +320,8 @@ public class SpdControlller { |
| 316 | interfaceLogService.setResultLog(response, logId, exception); | 320 | interfaceLogService.setResultLog(response, logId, exception); |
| 317 | return result; | 321 | return result; |
| 318 | } | 322 | } |
| 319 | 323 | ||
| 320 | 324 | ||
| 321 | /** | 325 | /** |
| 322 | * 医院补货计划接口 | 326 | * 医院补货计划接口 |
| 323 | * @param request | 327 | * @param request |
| ... | @@ -359,8 +363,8 @@ public class SpdControlller { | ... | @@ -359,8 +363,8 @@ public class SpdControlller { |
| 359 | interfaceLogService.setResultLog(response, logId, exception); | 363 | interfaceLogService.setResultLog(response, logId, exception); |
| 360 | return result; | 364 | return result; |
| 361 | } | 365 | } |
| 362 | 366 | ||
| 363 | 367 | ||
| 364 | /** | 368 | /** |
| 365 | * 医院退货接口 | 369 | * 医院退货接口 |
| 366 | * @param request | 370 | * @param request |
| ... | @@ -401,7 +405,7 @@ public class SpdControlller { | ... | @@ -401,7 +405,7 @@ public class SpdControlller { |
| 401 | interfaceLogService.setResultLog(response, logId, exception); | 405 | interfaceLogService.setResultLog(response, logId, exception); |
| 402 | return result; | 406 | return result; |
| 403 | } | 407 | } |
| 404 | 408 | ||
| 405 | /** | 409 | /** |
| 406 | * 结算单接口 | 410 | * 结算单接口 |
| 407 | * @param request | 411 | * @param request |
| ... | @@ -442,8 +446,8 @@ public class SpdControlller { | ... | @@ -442,8 +446,8 @@ public class SpdControlller { |
| 442 | interfaceLogService.setResultLog(response, logId, exception); | 446 | interfaceLogService.setResultLog(response, logId, exception); |
| 443 | return result; | 447 | return result; |
| 444 | } | 448 | } |
| 445 | 449 | ||
| 446 | 450 | ||
| 447 | /** | 451 | /** |
| 448 | * 供应商库存接口 | 452 | * 供应商库存接口 |
| 449 | * @param request | 453 | * @param request |
| ... | @@ -474,7 +478,7 @@ public class SpdControlller { | ... | @@ -474,7 +478,7 @@ public class SpdControlller { |
| 474 | result = JSON.toJSONString(response); | 478 | result = JSON.toJSONString(response); |
| 475 | try | 479 | try |
| 476 | { | 480 | { |
| 477 | //SPD服务请求: | 481 | //SPD服务请求: |
| 478 | result = HTTPClient.sendJsonDataByPost(PlatformConstant.PlatForm_SPD_Url+"setStock", params); | 482 | result = HTTPClient.sendJsonDataByPost(PlatformConstant.PlatForm_SPD_Url+"setStock", params); |
| 479 | response = JSONObject.parseObject(result,PlatFormResponse.class); | 483 | response = JSONObject.parseObject(result,PlatFormResponse.class); |
| 480 | response.setMsg("SPD:"+response.getMsg()); | 484 | response.setMsg("SPD:"+response.getMsg()); |
| ... | @@ -486,7 +490,7 @@ public class SpdControlller { | ... | @@ -486,7 +490,7 @@ public class SpdControlller { |
| 486 | response.setMsg("SPD:"+ex.getMessage()); | 490 | response.setMsg("SPD:"+ex.getMessage()); |
| 487 | result = JSON.toJSONString(response); | 491 | result = JSON.toJSONString(response); |
| 488 | } | 492 | } |
| 489 | 493 | ||
| 490 | } catch (Exception e) { | 494 | } catch (Exception e) { |
| 491 | logger.error("前置机:"+e.getMessage()); | 495 | logger.error("前置机:"+e.getMessage()); |
| 492 | exception = "前置机:"+e.getMessage(); | 496 | exception = "前置机:"+e.getMessage(); |
| ... | @@ -497,8 +501,8 @@ public class SpdControlller { | ... | @@ -497,8 +501,8 @@ public class SpdControlller { |
| 497 | interfaceLogService.setResultLog(response, logId, exception); | 501 | interfaceLogService.setResultLog(response, logId, exception); |
| 498 | return result; | 502 | return result; |
| 499 | } | 503 | } |
| 500 | 504 | ||
| 501 | 505 | ||
| 502 | /** | 506 | /** |
| 503 | * 供应商出库单接口 | 507 | * 供应商出库单接口 |
| 504 | * @param request | 508 | * @param request |
| ... | @@ -529,7 +533,7 @@ public class SpdControlller { | ... | @@ -529,7 +533,7 @@ public class SpdControlller { |
| 529 | result = JSON.toJSONString(response); | 533 | result = JSON.toJSONString(response); |
| 530 | try | 534 | try |
| 531 | { | 535 | { |
| 532 | //SPD服务请求: | 536 | //SPD服务请求: |
| 533 | result = HTTPClient.sendJsonDataByPost(PlatformConstant.PlatForm_SPD_Url+"setTrmedwv", params); | 537 | result = HTTPClient.sendJsonDataByPost(PlatformConstant.PlatForm_SPD_Url+"setTrmedwv", params); |
| 534 | response = JSONObject.parseObject(result,PlatFormResponse.class); | 538 | response = JSONObject.parseObject(result,PlatFormResponse.class); |
| 535 | response.setMsg("SPD:"+response.getMsg()); | 539 | response.setMsg("SPD:"+response.getMsg()); |
| ... | @@ -541,7 +545,7 @@ public class SpdControlller { | ... | @@ -541,7 +545,7 @@ public class SpdControlller { |
| 541 | response.setMsg("SPD:"+ex.getMessage()); | 545 | response.setMsg("SPD:"+ex.getMessage()); |
| 542 | result = JSON.toJSONString(response); | 546 | result = JSON.toJSONString(response); |
| 543 | } | 547 | } |
| 544 | 548 | ||
| 545 | } catch (Exception e) { | 549 | } catch (Exception e) { |
| 546 | logger.error("前置机:"+e.getMessage()); | 550 | logger.error("前置机:"+e.getMessage()); |
| 547 | exception = "前置机:"+e.getMessage(); | 551 | exception = "前置机:"+e.getMessage(); |
| ... | @@ -552,7 +556,7 @@ public class SpdControlller { | ... | @@ -552,7 +556,7 @@ public class SpdControlller { |
| 552 | interfaceLogService.setResultLog(response, logId, exception); | 556 | interfaceLogService.setResultLog(response, logId, exception); |
| 553 | return result; | 557 | return result; |
| 554 | } | 558 | } |
| 555 | 559 | ||
| 556 | /** | 560 | /** |
| 557 | * 医院盘点损溢接口 | 561 | * 医院盘点损溢接口 |
| 558 | * @param request | 562 | * @param request |
| ... | @@ -560,9 +564,9 @@ public class SpdControlller { | ... | @@ -560,9 +564,9 @@ public class SpdControlller { |
| 560 | * @return | 564 | * @return |
| 561 | */ | 565 | */ |
| 562 | @RequestMapping(value="/setTrDiff") | 566 | @RequestMapping(value="/setTrDiff") |
| 563 | @ResponseBody | 567 | @ResponseBody |
| 564 | public String setTrDiff(String id,HttpServletRequest request, @RequestBody String params){ | 568 | public String setTrDiff(String id,HttpServletRequest request, @RequestBody String params){ |
| 565 | logger.debug("医院盘点损溢接口请求参数:{}",params); | 569 | logger.debug("医院盘点损溢接口请求参数:{}",params); |
| 566 | String result = ""; | 570 | String result = ""; |
| 567 | String logId = IdUtil.uuid(); | 571 | String logId = IdUtil.uuid(); |
| 568 | String exception = ""; | 572 | String exception = ""; |
| ... | @@ -592,9 +596,9 @@ public class SpdControlller { | ... | @@ -592,9 +596,9 @@ public class SpdControlller { |
| 592 | } | 596 | } |
| 593 | interfaceLogService.setResultLog(response, logId, exception); | 597 | interfaceLogService.setResultLog(response, logId, exception); |
| 594 | return result; | 598 | return result; |
| 595 | } | 599 | } |
| 596 | 600 | ||
| 597 | 601 | ||
| 598 | /** | 602 | /** |
| 599 | * 供应商发票回传接口 | 603 | * 供应商发票回传接口 |
| 600 | * @param request | 604 | * @param request |
| ... | @@ -622,10 +626,10 @@ public class SpdControlller { | ... | @@ -622,10 +626,10 @@ public class SpdControlller { |
| 622 | response.setFlag(PlatFormResponseConstant.ResponseBodyMsg.fail_ResultCode); | 626 | response.setFlag(PlatFormResponseConstant.ResponseBodyMsg.fail_ResultCode); |
| 623 | response.setMsg(PlatFormResponseConstant.ResponseBodyMsg.getFail_ResultContent); | 627 | response.setMsg(PlatFormResponseConstant.ResponseBodyMsg.getFail_ResultContent); |
| 624 | } | 628 | } |
| 625 | result = JSON.toJSONString(response); | 629 | result = JSON.toJSONString(response); |
| 626 | try | 630 | try |
| 627 | { | 631 | { |
| 628 | //SPD服务请求: | 632 | //SPD服务请求: |
| 629 | result = HTTPClient.sendJsonDataByPost(PlatformConstant.PlatForm_SPD_Url+"setInvoice", params); | 633 | result = HTTPClient.sendJsonDataByPost(PlatformConstant.PlatForm_SPD_Url+"setInvoice", params); |
| 630 | response = JSONObject.parseObject(result,PlatFormResponse.class); | 634 | response = JSONObject.parseObject(result,PlatFormResponse.class); |
| 631 | response.setMsg("SPD:"+response.getMsg()); | 635 | response.setMsg("SPD:"+response.getMsg()); |
| ... | @@ -637,7 +641,7 @@ public class SpdControlller { | ... | @@ -637,7 +641,7 @@ public class SpdControlller { |
| 637 | response.setMsg("SPD:"+ex.getMessage()); | 641 | response.setMsg("SPD:"+ex.getMessage()); |
| 638 | result = JSON.toJSONString(response); | 642 | result = JSON.toJSONString(response); |
| 639 | } | 643 | } |
| 640 | 644 | ||
| 641 | } catch (Exception e) { | 645 | } catch (Exception e) { |
| 642 | logger.error("前置机:"+e.getMessage()); | 646 | logger.error("前置机:"+e.getMessage()); |
| 643 | exception = "前置机:"+e.getMessage(); | 647 | exception = "前置机:"+e.getMessage(); |
| ... | @@ -795,7 +799,7 @@ public class SpdControlller { | ... | @@ -795,7 +799,7 @@ public class SpdControlller { |
| 795 | interfaceLogService.setResultLog(response, logId, exception); | 799 | interfaceLogService.setResultLog(response, logId, exception); |
| 796 | return result; | 800 | return result; |
| 797 | } | 801 | } |
| 798 | 802 | ||
| 799 | /** | 803 | /** |
| 800 | * 推送证照数据到平台 | 804 | * 推送证照数据到平台 |
| 801 | * @param params | 805 | * @param params |
| ... | @@ -829,8 +833,8 @@ public class SpdControlller { | ... | @@ -829,8 +833,8 @@ public class SpdControlller { |
| 829 | interfaceLogService.setResultLog(response, logId, exception); | 833 | interfaceLogService.setResultLog(response, logId, exception); |
| 830 | return result; | 834 | return result; |
| 831 | } | 835 | } |
| 832 | 836 | ||
| 833 | 837 | ||
| 834 | /** | 838 | /** |
| 835 | * 推送证照图片数据到平台 | 839 | * 推送证照图片数据到平台 |
| 836 | * @param params | 840 | * @param params |
| ... | @@ -845,29 +849,29 @@ public class SpdControlller { | ... | @@ -845,29 +849,29 @@ public class SpdControlller { |
| 845 | PlatFormResponse response = new PlatFormResponse(); | 849 | PlatFormResponse response = new PlatFormResponse(); |
| 846 | interfaceLogService.saveLog("pushDispensing:(推送证照数据)","filename////"+file.getOriginalFilename(), logId); | 850 | interfaceLogService.saveLog("pushDispensing:(推送证照数据)","filename////"+file.getOriginalFilename(), logId); |
| 847 | try { | 851 | try { |
| 848 | if (file!=null) { | 852 | if (file!=null) { |
| 849 | HttpClient client = HttpClients.createDefault(); | 853 | HttpClient client = HttpClients.createDefault(); |
| 850 | HttpPost post = new HttpPost(PlatformConstant.PlatForm_SPD_Url + "saveresLicpic");// | 854 | HttpPost post = new HttpPost(PlatformConstant.PlatForm_SPD_Url + "saveresLicpic");// |
| 851 | File newfile = new File("/usr/local/img/"+file.getOriginalFilename()); | 855 | File newfile = new File("/usr/local/img/"+file.getOriginalFilename()); |
| 852 | file.transferTo(newfile); | 856 | file.transferTo(newfile); |
| 853 | FileBody bin = new FileBody(newfile); | 857 | FileBody bin = new FileBody(newfile); |
| 854 | HttpEntity reqEntity = MultipartEntityBuilder.create().addPart("file", bin).build(); | 858 | HttpEntity reqEntity = MultipartEntityBuilder.create().addPart("file", bin).build(); |
| 855 | post.setEntity(reqEntity); | 859 | post.setEntity(reqEntity); |
| 856 | HttpResponse htppresponse = client.execute(post); | 860 | HttpResponse htppresponse = client.execute(post); |
| 857 | HttpEntity resEntity = htppresponse.getEntity(); | 861 | HttpEntity resEntity = htppresponse.getEntity(); |
| 858 | result = EntityUtils.toString(resEntity, "UTF-8"); | 862 | result = EntityUtils.toString(resEntity, "UTF-8"); |
| 859 | JSONObject jsonObject = JSONObject.parseObject(result); | 863 | JSONObject jsonObject = JSONObject.parseObject(result); |
| 860 | if(!"Y".equals(jsonObject.getString("FLAG"))){ | 864 | if(!"Y".equals(jsonObject.getString("FLAG"))){ |
| 861 | response.setFlag(PlatFormResponseConstant.ResponseBodyMsg.fail_ResultCode); | 865 | response.setFlag(PlatFormResponseConstant.ResponseBodyMsg.fail_ResultCode); |
| 862 | }else { | 866 | }else { |
| 863 | response.setFlag(PlatFormResponseConstant.ResponseBodyMsg.success_ResultCode); | 867 | response.setFlag(PlatFormResponseConstant.ResponseBodyMsg.success_ResultCode); |
| 864 | } | 868 | } |
| 865 | response.setMsg(jsonObject.toJSONString()); | 869 | response.setMsg(jsonObject.toJSONString()); |
| 866 | if (newfile.exists()) { | 870 | if (newfile.exists()) { |
| 867 | newfile.delete(); | 871 | newfile.delete(); |
| 868 | } | 872 | } |
| 869 | } | 873 | } |
| 870 | 874 | ||
| 871 | } catch (Exception e) { | 875 | } catch (Exception e) { |
| 872 | logger.error(e.getMessage()); | 876 | logger.error(e.getMessage()); |
| 873 | exception = e.getMessage(); | 877 | exception = e.getMessage(); |
| ... | @@ -878,66 +882,136 @@ public class SpdControlller { | ... | @@ -878,66 +882,136 @@ public class SpdControlller { |
| 878 | interfaceLogService.setResultLog(response, logId, exception); | 882 | interfaceLogService.setResultLog(response, logId, exception); |
| 879 | return result; | 883 | return result; |
| 880 | } | 884 | } |
| 881 | 885 | ||
| 882 | 886 | ||
| 883 | 887 | ||
| 884 | @RequestMapping(value="/CancelMedPlan") | 888 | @RequestMapping(value="/CancelMedPlan") |
| 885 | @ResponseBody | 889 | @ResponseBody |
| 886 | public String CancelMedPlan(HttpServletRequest request, @RequestBody String param){ | 890 | public String CancelMedPlan(HttpServletRequest request, @RequestBody String param){ |
| 887 | logger.debug("补货计划作废接口请求参数:{}",param); | 891 | logger.debug("补货计划作废接口请求参数:{}",param); |
| 888 | String result = ""; | 892 | String result = ""; |
| 889 | String logId = IdUtil.uuid(); | 893 | String logId = IdUtil.uuid(); |
| 890 | String exception = ""; | 894 | String exception = ""; |
| 891 | interfaceLogService.saveLog("CancelMedPlan:(补货计划作废接口)", param, logId); | 895 | interfaceLogService.saveLog("CancelMedPlan:(补货计划作废接口)", param, logId); |
| 892 | PlatFormResponse response = new PlatFormResponse(); | 896 | PlatFormResponse response = new PlatFormResponse(); |
| 893 | try { | 897 | try { |
| 894 | result = HTTPClient.sendJsonDataByPost(PlatformConstant.PlatForm_HUARUN_Url+"CancelMedPlan", param); | 898 | result = HTTPClient.sendJsonDataByPost(PlatformConstant.PlatForm_HUARUN_Url+"CancelMedPlan", param); |
| 895 | JSONObject jsonObject = JSONObject.parseObject(result); | 899 | JSONObject jsonObject = JSONObject.parseObject(result); |
| 896 | response.setFlag( jsonObject.getString("FLAG")); | 900 | response.setFlag( jsonObject.getString("FLAG")); |
| 897 | response.setMsg(jsonObject.getString("message")); | 901 | response.setMsg(jsonObject.getString("message")); |
| 898 | } catch (Exception e) { | 902 | } catch (Exception e) { |
| 899 | logger.error(e.getMessage()); | 903 | logger.error(e.getMessage()); |
| 900 | exception = e.getMessage(); | 904 | exception = e.getMessage(); |
| 901 | response.setFlag("E"); | 905 | response.setFlag("E"); |
| 902 | response.setMsg(e.getMessage()); | 906 | response.setMsg(e.getMessage()); |
| 903 | result = JSON.toJSONString(response); | 907 | result = JSON.toJSONString(response); |
| 904 | } | 908 | } |
| 905 | interfaceLogService.setResultLog(response, logId, exception); | 909 | interfaceLogService.setResultLog(response, logId, exception); |
| 906 | return result; | 910 | return result; |
| 907 | } | 911 | } |
| 908 | 912 | ||
| 909 | /** | 913 | /** |
| 910 | * 推送证照数据到平台 | 914 | * 推送证照数据到平台 |
| 911 | * @param params | 915 | * @param params |
| 912 | * @return | 916 | * @return |
| 913 | */ | 917 | */ |
| 914 | @RequestMapping("/doBarcode") | 918 | @RequestMapping("/doBarcode") |
| 915 | @ResponseBody | 919 | @ResponseBody |
| 916 | public String doBarcode(@RequestBody String params){ | 920 | public String doBarcode(@RequestBody String params){ |
| 917 | logger.debug("供应商出库条码回传:{}", params); | 921 | logger.debug("供应商出库条码回传:{}", params); |
| 918 | String result = ""; | 922 | String result = ""; |
| 919 | String logId = IdUtil.uuid(); | 923 | String logId = IdUtil.uuid(); |
| 920 | String exception = ""; | 924 | String exception = ""; |
| 921 | interfaceLogService.saveLog("doBarcode:(供应商出库条码回传)", params, logId); | 925 | interfaceLogService.saveLog("doBarcode:(供应商出库条码回传)", params, logId); |
| 922 | PlatFormResponse response = new PlatFormResponse(); | 926 | PlatFormResponse response = new PlatFormResponse(); |
| 923 | try { | 927 | try { |
| 924 | result = HTTPClient.sendJsonDataByPost(PlatformConstant.PlatForm_SPD_Url + "doBarcode", params);// | 928 | result = HTTPClient.sendJsonDataByPost(PlatformConstant.PlatForm_SPD_Url + "doBarcode", params);// |
| 925 | JSONObject jsonObject = JSONObject.parseObject(result); | 929 | JSONObject jsonObject = JSONObject.parseObject(result); |
| 926 | if(jsonObject.getString("FLAG") != null){ | 930 | if(jsonObject.getString("FLAG") != null){ |
| 927 | response.setFlag(jsonObject.getString("FLAG")); | 931 | response.setFlag(jsonObject.getString("FLAG")); |
| 928 | response.setMsg(jsonObject.getString("MSG")); | 932 | response.setMsg(jsonObject.getString("MSG")); |
| 929 | }else{ | 933 | }else{ |
| 930 | response.setFlag("Y"); | 934 | response.setFlag("Y"); |
| 931 | response.setMsg("doBarcode:(供应商出库条码回传)返回值格式未对应"); | 935 | response.setMsg("doBarcode:(供应商出库条码回传)返回值格式未对应"); |
| 932 | } | ||
| 933 | } catch (Exception e) { | ||
| 934 | logger.error(e.getMessage()); | ||
| 935 | exception = e.getMessage(); | ||
| 936 | response.setFlag(PlatFormResponseConstant.ResponseBodyMsg.fail_ResultCode); | ||
| 937 | response.setMsg("doBarcode:(供应商出库条码回传)给SPD平台错误:" + e.getMessage()); | ||
| 938 | result = JSON.toJSONString(response); | ||
| 939 | } | 936 | } |
| 940 | interfaceLogService.setResultLog(response, logId, exception); | 937 | } catch (Exception e) { |
| 941 | return result; | 938 | logger.error(e.getMessage()); |
| 939 | exception = e.getMessage(); | ||
| 940 | response.setFlag(PlatFormResponseConstant.ResponseBodyMsg.fail_ResultCode); | ||
| 941 | response.setMsg("doBarcode:(供应商出库条码回传)给SPD平台错误:" + e.getMessage()); | ||
| 942 | result = JSON.toJSONString(response); | ||
| 943 | } | ||
| 944 | interfaceLogService.setResultLog(response, logId, exception); | ||
| 945 | return result; | ||
| 946 | } | ||
| 947 | |||
| 948 | |||
| 949 | /** | ||
| 950 | * 库存查询接口 | ||
| 951 | * @param params | ||
| 952 | * @return | ||
| 953 | */ | ||
| 954 | @RequestMapping("/querystock") | ||
| 955 | @ResponseBody | ||
| 956 | public String querystock(@RequestBody String params){ | ||
| 957 | logger.debug("查询库存:{}", params); | ||
| 958 | String result = ""; | ||
| 959 | try { | ||
| 960 | result = HTTPClient.sendJsonDataByPost("http://10.146.8.221:9002/medicinal-web/a/StoreDetail/queryDrugByDeptAll", params); | ||
| 961 | } catch (Exception e) { | ||
| 962 | result = e.getMessage(); | ||
| 942 | } | 963 | } |
| 964 | return result; | ||
| 965 | } | ||
| 966 | |||
| 967 | /** | ||
| 968 | * 近效期查询接口 | ||
| 969 | * @param params | ||
| 970 | * @return | ||
| 971 | */ | ||
| 972 | @RequestMapping("/queryexpir") | ||
| 973 | @ResponseBody | ||
| 974 | public String queryexpir(@RequestBody String params){ | ||
| 975 | logger.debug("查询近效期:{}", params); | ||
| 976 | String result = ""; | ||
| 977 | try { | ||
| 978 | result = HTTPClient.sendJsonDataByPost("http://10.146.8.221:9002/medicinal-web/a/ypjxq/statics/list", params); | ||
| 979 | } catch (Exception e) { | ||
| 980 | result = e.getMessage(); | ||
| 981 | } | ||
| 982 | return result; | ||
| 983 | } | ||
| 984 | |||
| 985 | /** | ||
| 986 | * 呆滞品查询接口 | ||
| 987 | * @param params | ||
| 988 | * @return | ||
| 989 | */ | ||
| 990 | @RequestMapping("/querydetained") | ||
| 991 | @ResponseBody | ||
| 992 | public String querydetained(@RequestBody String params){ | ||
| 993 | logger.debug("查询近效期:{}", params); | ||
| 994 | String result = ""; | ||
| 995 | if (client == null){ | ||
| 996 | client = HttpClients.createDefault(); | ||
| 997 | } | ||
| 998 | try { | ||
| 999 | JSONObject objec = JSON.parseObject(params); | ||
| 1000 | List<NameValuePair> param = new ArrayList<NameValuePair>(); | ||
| 1001 | param.add(new BasicNameValuePair("depetCode",objec.getString("depetCode"))); | ||
| 1002 | param.add(new BasicNameValuePair("pageNo",objec.getString("pageNo"))); | ||
| 1003 | param.add(new BasicNameValuePair("pageSize",objec.getString("pageSize"))); | ||
| 1004 | param.add(new BasicNameValuePair("startTime",objec.getString("startTime"))); | ||
| 1005 | param.add(new BasicNameValuePair("endTime",objec.getString("endTime"))); | ||
| 1006 | HttpPost post = new HttpPost("http://10.146.8.221:9002/medicinal-web/a/statics/delayStore/list"); | ||
| 1007 | post.setHeader("Content-Type", "application/x-www-form-urlencoded"); | ||
| 1008 | post.setEntity(new UrlEncodedFormEntity(param)); | ||
| 1009 | HttpResponse reponse = client.execute(post); | ||
| 1010 | HttpEntity entity = reponse.getEntity(); | ||
| 1011 | result = EntityUtils.toString(entity, "UTF-8"); | ||
| 1012 | } catch (Exception e) { | ||
| 1013 | result = e.getMessage(); | ||
| 1014 | } | ||
| 1015 | return result; | ||
| 1016 | } | ||
| 943 | } | 1017 | } | ... | ... |
-
Please register or sign in to post a comment