Commit 16ed0970bf7c38ecac98065edbd636d7f1711f5a

Authored by liquanyu
1 parent 0bb804549e

update

Showing 6 changed files with 117 additions and 18 deletions

platform-common/src/main/java/com/lyms/platform/common/utils/HttpClientUtil.java View file @ 16ed097
... ... @@ -257,6 +257,50 @@
257 257 }
258 258  
259 259  
  260 + public static String doWebServicePost(String apiUrl, Object json) {
  261 + HttpClient httpClient = null;
  262 + HttpPost httpPost = new HttpPost(apiUrl);
  263 + HttpResponse response = null;
  264 + String httpStr = null;
  265 +
  266 + try {
  267 + httpClient = new SSLClient();
  268 + httpPost.setConfig(requestConfig);
  269 + StringEntity stringEntity = new StringEntity("json="+json.toString(),"UTF-8");//解决中文乱码问题
  270 + stringEntity.setContentEncoding("UTF-8");
  271 + stringEntity.setContentType("application/x-www-form-urlencoded; charset=UTF-8");
  272 + httpPost.setHeader("connection", "Keep-Alive");
  273 + httpPost.setEntity(stringEntity);
  274 + response = httpClient.execute(httpPost);
  275 + int statusCode = response.getStatusLine().getStatusCode();
  276 + System.out.println("return code = "+ statusCode);
  277 + if (statusCode != HttpStatus.SC_OK) {
  278 + return null;
  279 + }
  280 + HttpEntity entity = response.getEntity();
  281 + if (entity == null) {
  282 + return null;
  283 + }
  284 + httpStr = EntityUtils.toString(entity, "utf-8");
  285 + } catch (Exception e) {
  286 + e.printStackTrace();
  287 + } finally {
  288 + if (response != null) {
  289 + try {
  290 + EntityUtils.consume(response.getEntity());
  291 + } catch (IOException e) {
  292 + e.printStackTrace();
  293 + }
  294 + }
  295 + if (httpPost != null)
  296 + {
  297 + httpPost.releaseConnection();
  298 + }
  299 +
  300 + }
  301 + return httpStr;
  302 + }
  303 +
260 304 /**
261 305 * sslpost
262 306 * @param apiUrl
platform-operate-api/src/main/java/com/lyms/hospitalapi/lhxfy/LhxfyService.java View file @ 16ed097
1 1 package com.lyms.hospitalapi.lhxfy;
2 2  
3   -import com.alibaba.druid.support.json.JSONUtils;
4 3 import com.lyms.platform.biz.service.BasicConfigService;
5 4 import com.lyms.platform.biz.service.ResidentsArchiveService;
6 5 import com.lyms.platform.common.enums.YnEnums;
... ... @@ -14,8 +13,9 @@
14 13 import com.lyms.platform.query.ResidentsArchiveQuery;
15 14 import net.sf.json.JSONObject;
16 15 import org.apache.commons.collections.CollectionUtils;
17   -import org.apache.commons.dbutils.QueryRunner;
18   -import org.apache.commons.dbutils.handlers.BeanListHandler;
  16 +import org.dom4j.Document;
  17 +import org.dom4j.DocumentHelper;
  18 +import org.dom4j.Element;
19 19 import org.springframework.beans.factory.annotation.Autowired;
20 20 import org.springframework.data.mongodb.core.MongoTemplate;
21 21 import org.springframework.data.mongodb.core.query.Criteria;
... ... @@ -23,7 +23,7 @@
23 23 import org.springframework.data.mongodb.core.query.Update;
24 24 import org.springframework.stereotype.Service;
25 25  
26   -import java.sql.Connection;
  26 +
27 27 import java.util.*;
28 28  
29 29 /**
30 30  
... ... @@ -671,9 +671,10 @@
671 671 model.getHusbandAccountAddress(), basicConfigService));
672 672 data.put("idCard", model.getHusbandCardNo());
673 673 data.put("phoneNumber", model.getHusbandPhone());
  674 + data.put("deviceNum", "管理员");
674 675 String husbandJson = JsonUtil.obj2Str(data);
675 676 System.out.println("HusbandJson=" + husbandJson);
676   - String husbandResult = HttpClientUtil.doPostSSL(LHFY_HIS_URL,husbandJson);
  677 + String husbandResult = HttpClientUtil.doWebServicePost(LHFY_HIS_URL,husbandJson);
677 678 System.out.println("husbandResult="+husbandResult);
678 679 model.setHusbandBlNum(getPatientId(husbandResult));
679 680  
680 681  
681 682  
... ... @@ -681,16 +682,17 @@
681 682 data.put("patientName",model.getWifeName());
682 683 data.put("patientSex","女");
683 684 data.put("birthday",DateUtil.getyyyy_MM_dd(model.getWifeBirthday()));
684   - data.put("address", CommonsHelper.getResidence(model.getWifeAccountProvince(),
  685 + data.put("address", CommonsHelper.getResidence(model.getWifeAccountProvince(),
685 686 model.getWifeAccountCity(),
686 687 model.getWifeAccountArea(),
687 688 model.getWifeAccountStreet(),
688 689 model.getWifeAccountAddress(), basicConfigService));
689 690 data.put("idCard",model.getWifeCardNo());
690 691 data.put("phoneNumber", model.getWifePhone());
  692 + data.put("deviceNum", "管理员");
691 693 String json = JsonUtil.obj2Str(data);
692 694 System.out.println("wifeJson=" + json);
693   - String wifeResult = HttpClientUtil.doPostSSL(LHFY_HIS_URL, json);
  695 + String wifeResult = HttpClientUtil.doWebServicePost(LHFY_HIS_URL, json);
694 696 System.out.println("wifeResult="+wifeResult);
695 697 model.setWifeBlNum(getPatientId(wifeResult));
696 698  
697 699  
... ... @@ -726,9 +728,10 @@
726 728 data.put("address", addressStr);
727 729 data.put("idCard", model.getCertificateNum());
728 730 data.put("phoneNumber", model.getPhone());
  731 + data.put("deviceNum", "管理员");
729 732 String json = JsonUtil.obj2Str(data);
730 733 System.out.println("residentsJson=" + json);
731   - String residentsResult = HttpClientUtil.doPostSSL(LHFY_HIS_URL,json);
  734 + String residentsResult = HttpClientUtil.doWebServicePost(LHFY_HIS_URL,json);
732 735 System.out.println("residentsResult="+residentsResult);
733 736 model.setBlNum(getPatientId(residentsResult));
734 737  
735 738  
736 739  
737 740  
738 741  
... ... @@ -744,18 +747,31 @@
744 747 }
745 748  
746 749  
747   - private String getPatientId(String result)
  750 + public static String getPatientId(String result)
748 751 {
  752 + //result= "<?xml version=\"1.0\" encoding=\"utf-8\"?><string xmlns=\"http://tempuri.org/\">{\"header\":{\"responseCode\":\"100\",\"remark\":\"\"},\"body\":{\"patientId\":\"2107170115\"}}</string>";
749 753 if (StringUtils.isNotEmpty(result))
750 754 {
751   - JSONObject jsonObject = JsonUtil.getObj(result);
752   - JSONObject jsonObject1 = jsonObject.getJSONObject("header");
753   - if ("100".equals(jsonObject1.getString("responseCode")))
  755 + try {
  756 + Document document = DocumentHelper.parseText(result);
  757 + Element recordEle = document.getRootElement();
  758 + String json = recordEle.getStringValue();
  759 +
  760 + JSONObject jsonObject = JsonUtil.getObj(json);
  761 + JSONObject jsonObject1 = jsonObject.getJSONObject("header");
  762 + if ("100".equals(jsonObject1.getString("responseCode")))
  763 + {
  764 + String patientId = jsonObject.getJSONObject("body").getString("patientId");
  765 + if (StringUtils.isNotEmpty(patientId))
  766 + {
  767 + return patientId;
  768 + }
  769 + }
  770 + }
  771 + catch (Exception e)
754 772 {
755   - String patientId = jsonObject.getJSONObject("body").getString("patientId");
756   - return patientId;
  773 + return null;
757 774 }
758   -
759 775 }
760 776 return null;
761 777 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BabyCheckController.java View file @ 16ed097
... ... @@ -187,8 +187,10 @@
187 187 @RequestParam(value = "highRisk", required = false) Integer highRisk,
188 188 @RequestParam(value = "waskSon", required = false) Integer waskSon,
189 189 @RequestParam(value = "checkDoctorId", required = false) String checkDoctorId,
  190 + @RequestParam(value = "level", required = false) String level,
190 191 Integer page, Integer limit, HttpServletRequest request) {
191   - return babyCheckFacade.babyCheckList(checkTime, queryNo, startCheckMonthAge, endCheckMonthAge, nextDate, highRisk, waskSon, checkDoctorId, page, limit, getUserId(request));
  192 + return babyCheckFacade.babyCheckList(checkTime, queryNo, startCheckMonthAge, endCheckMonthAge,
  193 + nextDate, highRisk, waskSon, checkDoctorId, page, limit, getUserId(request),level);
192 194 }
193 195  
194 196 /**
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyBookbuildingFacade.java View file @ 16ed097
... ... @@ -2485,6 +2485,7 @@
2485 2485 br.setName(data.getName());
2486 2486 br.setParentId(data.getParentId());
2487 2487 br.setDesc(data.getDescribe());
  2488 + br.setLevel(data.getLevel());
2488 2489 configResults.add(br);
2489 2490 }
2490 2491  
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyCheckFacade.java View file @ 16ed097
... ... @@ -1088,7 +1088,7 @@
1088 1088 }
1089 1089  
1090 1090 public BaseResponse babyCheckList(String checkTime, String queryNo, Integer checkMonthAge, Integer endCheckMonthAge, String nextDate,
1091   - Integer highRisk, Integer waskSon, String checkDoctorId,Integer page, Integer limit, Integer userId) {
  1091 + Integer highRisk, Integer waskSon, String checkDoctorId,Integer page, Integer limit, Integer userId,String level) {
1092 1092 boolean flag = false;
1093 1093 // List<String> hospital = groupsFacade.findGroupHospital(userId, false);
1094 1094 String hospitalId = autoMatchFacade.getHospitalId(userId);
... ... @@ -1132,6 +1132,10 @@
1132 1132 if (null != waskSon) {
1133 1133 criteria.and("waskSon").is(waskSon);
1134 1134 }
  1135 +
  1136 + if (StringUtils.isNotEmpty(level)) {
  1137 + criteria.and("diagnoseLevel").in(level);
  1138 + }
1135 1139 if (null != checkDoctorId) {
1136 1140 criteria.and("checkDoctor").is(checkDoctorId);
1137 1141 }
... ... @@ -1176,6 +1180,38 @@
1176 1180 map.put("checkDoctor", usersService.getUsers(Integer.valueOf(babyCheckModel.getCheckDoctor())).getName());
1177 1181 }
1178 1182  
  1183 + String diagnoseStr = babyCheckModel.getDiagnose();
  1184 + List<Map> diagnoseList = new ArrayList<>();
  1185 + if (!com.lyms.platform.common.utils.StringUtils.isEmpty(diagnoseStr)) {
  1186 + List diagnoses = JsonUtil.toList(diagnoseStr, List.class);
  1187 + for (int i = 0; i < diagnoses.size(); i++) {
  1188 + if (diagnoses.get(i) != null) {
  1189 + Map data = new HashMap();
  1190 + BasicConfigQuery basicConfigQuery = new BasicConfigQuery();
  1191 + basicConfigQuery.setYn(YnEnums.YES.getId());
  1192 + basicConfigQuery.setParentId(SystemConfig.DIAGNOSE_TYPE_ID);
  1193 + basicConfigQuery.setId(String.valueOf(diagnoses.get(i)));
  1194 + List <BasicConfig> datas = basicConfigService.queryBasicConfig(basicConfigQuery);
  1195 + if (CollectionUtils.isNotEmpty(datas)) {
  1196 + data.put("name",datas.get(0).getName());
  1197 + data.put("level",datas.get(0).getLevel());
  1198 + diagnoseList.add(data);
  1199 + } else if (CollectionUtils.isEmpty(datas)) {
  1200 + BasicConfigQuery basicConfigQuery2 = new BasicConfigQuery();
  1201 + basicConfigQuery2.setYn(YnEnums.YES.getId());
  1202 + basicConfigQuery2.setId(String.valueOf(diagnoses.get(i)));
  1203 + List <BasicConfig> datas2 = basicConfigService.queryBasicConfig(basicConfigQuery2);
  1204 + if (CollectionUtils.isNotEmpty(datas2)) {
  1205 + data.put("name",datas2.get(0).getName());
  1206 + data.put("level",datas2.get(0).getLevel());
  1207 + diagnoseList.add(data);
  1208 + }
  1209 + }
  1210 + }
  1211 +
  1212 + }
  1213 + }
  1214 + map.put("diagnoseList",diagnoseList);
1179 1215 map.put("height", babyCheckModel.getHeight());
1180 1216 map.put("weight", babyCheckModel.getWeight());
1181 1217 list.add(map);
platform-operate-api/src/main/resources/config.properties View file @ 16ed097
... ... @@ -52,7 +52,7 @@
52 52 area_url=http://localhost:8082
53 53  
54 54 #隆化妇幼同步his的地址
55   -lhfy_his_url=
  55 +lhfy_his_url=http://10.0.32.141:8087/Default.asmx/HosRegister
56 56 #隆化妇幼获取lis的url
57 57 lhfy_lis_url=https://lhfy-chengde-api.healthbaby.com.cn:12356/lis/getLhLisById