Commit daa6862e86d2b84fc1b355eb5ef2ac6e9833caf4
1 parent
0efdb84599
Exists in
master
and in
6 other branches
肌萎缩
Showing 10 changed files with 548 additions and 188 deletions
- platform-common/src/main/java/com/lyms/platform/common/utils/DateUtil.java
- platform-common/src/main/java/com/lyms/platform/common/utils/HttpClientUtil.java
- platform-dal/src/main/java/com/lyms/platform/pojo/PersonModel.java
- platform-operate-api/src/main/java/com/lyms/hospitalapi/lhxfy/model/SaveChildHomeVisitInfo.java
- platform-operate-api/src/main/java/com/lyms/hospitalapi/lhxfy/model/SaveChildInfo.java
- platform-operate-api/src/main/java/com/lyms/hospitalapi/lhxfy/model/SaveMaternalRegisterInfo.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/Public2PathController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/MatDeliverFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/Public2PathFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/SmnTaskFacade.java
platform-common/src/main/java/com/lyms/platform/common/utils/DateUtil.java
View file @
daa6862
... | ... | @@ -1984,6 +1984,11 @@ |
1984 | 1984 | // |
1985 | 1985 | System.out.println("211022199403243920".substring("211022199403243920".length() - 6)); |
1986 | 1986 | System.out.println(DateUtil.getyyyy_MM_dd_hms(DateUtil.parseYMDHMS("2022-8-4 9:49:48"))); |
1987 | + | |
1988 | + for (int j = 0; j <22;j++) | |
1989 | + { | |
1990 | + System.out.println(-j+"==="+(-(j+1))); | |
1991 | + } | |
1987 | 1992 | } |
1988 | 1993 | |
1989 | 1994 | } |
platform-common/src/main/java/com/lyms/platform/common/utils/HttpClientUtil.java
View file @
daa6862
... | ... | @@ -4,6 +4,7 @@ |
4 | 4 | * Created by Administrator on 2017-01-18. |
5 | 5 | */ |
6 | 6 | |
7 | +import org.apache.commons.collections.CollectionUtils; | |
7 | 8 | import org.apache.http.HttpEntity; |
8 | 9 | import org.apache.http.HttpResponse; |
9 | 10 | import org.apache.http.HttpStatus; |
... | ... | @@ -203,6 +204,110 @@ |
203 | 204 | |
204 | 205 | } |
205 | 206 | return result; |
207 | + } | |
208 | + public static String doGetHeader(String url,Map<String,String> params,String charset,Map<String,String> headers){ | |
209 | + | |
210 | + StringBuffer sb = new StringBuffer(); | |
211 | + if(params!=null && !params.isEmpty()) { | |
212 | + Iterator<String> keys = params.keySet().iterator(); | |
213 | + while(keys.hasNext()){ | |
214 | + String key = keys.next(); | |
215 | + String value = params.get(key); | |
216 | + if (!StringUtils.isNotEmpty(value)) | |
217 | + { | |
218 | + continue; | |
219 | + } | |
220 | + if(sb.length()==0)sb.append("?"); | |
221 | + else sb.append("&"); | |
222 | + sb.append(key+"="+value); | |
223 | + } | |
224 | + } | |
225 | + | |
226 | + HttpClient httpClient = null; | |
227 | + HttpGet httpGet = null; | |
228 | + String result = null; | |
229 | + try{ | |
230 | + httpClient = new SSLClient(); | |
231 | + httpGet = new HttpGet(url+sb.toString()); | |
232 | + httpGet.setConfig(requestConfig); | |
233 | + if (headers != null && headers.size() > 0) | |
234 | + { | |
235 | + for (String key : headers.keySet()) | |
236 | + { | |
237 | + httpGet.addHeader(key, headers.get(key)); | |
238 | + } | |
239 | + } | |
240 | + HttpResponse response = httpClient.execute(httpGet); | |
241 | + if(response != null){ | |
242 | + int statusCode = response.getStatusLine().getStatusCode(); | |
243 | + if (statusCode != HttpStatus.SC_OK) { | |
244 | + return null; | |
245 | + } | |
246 | + HttpEntity resEntity = response.getEntity(); | |
247 | + if(resEntity != null){ | |
248 | + result = EntityUtils.toString(resEntity,charset); | |
249 | + } | |
250 | + } | |
251 | + }catch(Exception ex){ | |
252 | + | |
253 | + } | |
254 | + return result; | |
255 | + } | |
256 | + | |
257 | + | |
258 | + public static String doPostHeader(String apiUrl, Object json,Map<String,String> headers) { | |
259 | + HttpClient httpClient = null; | |
260 | + HttpPost httpPost = new HttpPost(apiUrl); | |
261 | + HttpResponse response = null; | |
262 | + String httpStr = null; | |
263 | + | |
264 | + try { | |
265 | + httpClient = new SSLClient(); | |
266 | + httpPost.setConfig(requestConfig); | |
267 | + StringEntity stringEntity = new StringEntity(json.toString(),"UTF-8");//解决中文乱码问题 | |
268 | + stringEntity.setContentEncoding("UTF-8"); | |
269 | + stringEntity.setContentType("application/json"); | |
270 | + httpPost.setHeader("connection", "Keep-Alive"); | |
271 | + if (headers != null && headers.size() > 0) | |
272 | + { | |
273 | + for (String key : headers.keySet()) | |
274 | + { | |
275 | + httpPost.addHeader(key, headers.get(key)); | |
276 | + } | |
277 | + } | |
278 | + httpPost.setEntity(stringEntity); | |
279 | + response = httpClient.execute(httpPost); | |
280 | + int statusCode = response.getStatusLine().getStatusCode(); | |
281 | + System.out.println("return code = "+ statusCode); | |
282 | + if (statusCode != HttpStatus.SC_OK) { | |
283 | + return null; | |
284 | + } | |
285 | + HttpEntity entity = response.getEntity(); | |
286 | + if (entity == null) { | |
287 | + return null; | |
288 | + } | |
289 | + httpStr = EntityUtils.toString(entity, "utf-8"); | |
290 | + } catch (Exception e) { | |
291 | + ExceptionUtils.catchException(e,e.getMessage()); | |
292 | + if (httpPost != null) | |
293 | + { | |
294 | + httpPost.releaseConnection(); | |
295 | + } | |
296 | + return null; | |
297 | + } finally { | |
298 | + if (response != null) { | |
299 | + try { | |
300 | + EntityUtils.consume(response.getEntity()); | |
301 | + } catch (IOException e) { | |
302 | + e.printStackTrace(); | |
303 | + } | |
304 | + } | |
305 | + if (httpPost != null) | |
306 | + { | |
307 | + httpPost.releaseConnection(); | |
308 | + } | |
309 | + } | |
310 | + return httpStr; | |
206 | 311 | } |
207 | 312 | |
208 | 313 |
platform-dal/src/main/java/com/lyms/platform/pojo/PersonModel.java
View file @
daa6862
... | ... | @@ -39,6 +39,25 @@ |
39 | 39 | |
40 | 40 | private Integer yn; |
41 | 41 | |
42 | + private String gwPersonId;//工位档案id | |
43 | + private String maternalId;//工位孕产登记id | |
44 | + | |
45 | + public String getMaternalId() { | |
46 | + return maternalId; | |
47 | + } | |
48 | + | |
49 | + public void setMaternalId(String maternalId) { | |
50 | + this.maternalId = maternalId; | |
51 | + } | |
52 | + | |
53 | + public String getGwPersonId() { | |
54 | + return gwPersonId; | |
55 | + } | |
56 | + | |
57 | + public void setGwPersonId(String gwPersonId) { | |
58 | + this.gwPersonId = gwPersonId; | |
59 | + } | |
60 | + | |
42 | 61 | public String getId() { |
43 | 62 | return id; |
44 | 63 | } |
platform-operate-api/src/main/java/com/lyms/hospitalapi/lhxfy/model/SaveChildHomeVisitInfo.java
View file @
daa6862
1 | 1 | package com.lyms.hospitalapi.lhxfy.model; |
2 | 2 | |
3 | +import com.lyms.platform.biz.service.BasicConfigService; | |
3 | 4 | import com.lyms.platform.common.utils.DateUtil; |
4 | 5 | import com.lyms.platform.common.utils.StringUtils; |
6 | +import com.lyms.platform.operate.web.utils.CommonsHelper; | |
5 | 7 | import com.lyms.platform.permission.dao.master.CouponMapper; |
8 | +import com.lyms.platform.permission.service.OrganizationService; | |
6 | 9 | import com.lyms.platform.pojo.BabyModel; |
7 | 10 | import com.lyms.platform.pojo.NewbornVisit; |
8 | 11 | import org.springframework.beans.factory.annotation.Autowired; |
9 | 12 | |
... | ... | @@ -108,18 +111,20 @@ |
108 | 111 | private String personInfoId; //类型:String 必有字段 备注:个人档案ID |
109 | 112 | @Autowired |
110 | 113 | private CouponMapper couponMapper; |
111 | - public void convertToDataModel(NewbornVisit newbornVisit){ | |
112 | - setIsAppCreate(null==newbornVisit.getIsAppCreate()?0:newbornVisit.getIsAppCreate()); | |
113 | - setStandard(StringUtils.isEmpty(newbornVisit.getStandard())?"无":newbornVisit.getStandard()); | |
114 | - setVisitDoctorId(StringUtils.isEmpty(newbornVisit.getDoctor())?"无":newbornVisit.getDoctor()); | |
115 | - String visitDoctorName=couponMapper.findUserName(newbornVisit.getDoctor()); | |
116 | - setVisitDoctorName(StringUtils.isEmpty(visitDoctorName)?"无":visitDoctorName); | |
117 | - setNewbornSexCode(StringUtils.isEmpty(newbornVisit.getNewbornSexCode())?"无":newbornVisit.getNewbornSexCode()); | |
114 | + public void convertToDataModel(NewbornVisit newbornVisit, BabyModel babyModel | |
115 | + , BasicConfigService basicConfigService, OrganizationService organizationService){ | |
116 | + setIsAppCreate(0); | |
117 | + setStandard("2017"); | |
118 | +// setVisitDoctorId(StringUtils.isEmpty(newbornVisit.getDoctor())?"无":newbornVisit.getDoctor()); | |
119 | +// String visitDoctorName=couponMapper.findUserName(newbornVisit.getDoctor()); | |
120 | +// setVisitDoctorName(StringUtils.isEmpty(visitDoctorName)?"无":visitDoctorName); | |
121 | + setNewbornSexCode(babyModel.getSex() == 0 ? "2" : babyModel.getSex() == 1 ? "1" : "0"); | |
118 | 122 | setNewbornIdNo(StringUtils.isEmpty(newbornVisit.getNewbornIdNo())?"无":newbornVisit.getNewbornIdNo()); |
119 | 123 | setNewbornBirthDate(StringUtils.isEmpty(newbornVisit.getNewbornBirthDate())?"无":newbornVisit.getNewbornBirthDate()); |
120 | - setFatherIdno(null); | |
121 | - setMotherIdno(null); | |
122 | - setPresentAddrProvince(null); | |
124 | + setFatherIdno(babyModel.getFcertNo()); | |
125 | + setMotherIdno(babyModel.getMcertNo()); | |
126 | + setPresentAddrProvince(CommonsHelper.getResidence(babyModel.getProvinceId(),babyModel.getCityId(), | |
127 | + babyModel.getAreaId(),babyModel.getStreetId(),babyModel.getAddress(),basicConfigService)); | |
123 | 128 | setFatherName(null); |
124 | 129 | setFatherOccupName(null); |
125 | 130 | setFatherTelNo(null); |
126 | 131 | |
... | ... | @@ -130,13 +135,13 @@ |
130 | 135 | setReferralDepartment(null); |
131 | 136 | setReferralTel(null); |
132 | 137 | setFatherWorkUnit(null); |
133 | - setMotherName(StringUtils.isEmpty(newbornVisit.getMotherName())?"无":newbornVisit.getMotherName()); | |
134 | - setMotherOccupName(StringUtils.isEmpty(newbornVisit.getMotherOccupName())?"无":newbornVisit.getMotherOccupName()); | |
135 | - setMotherTelNo(StringUtils.isEmpty(newbornVisit.getMotherTelNo())?"无":newbornVisit.getMotherTelNo()); | |
136 | - setMotherBirthDate(StringUtils.isEmpty(newbornVisit.getMotherBirthDate())?"无":newbornVisit.getMotherBirthDate()); | |
138 | + setMotherName(StringUtils.isEmpty(babyModel.getMname())?"无":babyModel.getMname()); | |
139 | + setMotherOccupName(CommonsHelper.getName1(babyModel.getMproTypeId(),basicConfigService)); | |
140 | + setMotherTelNo(StringUtils.isEmpty(babyModel.getMphone())?"无":babyModel.getMphone()); | |
141 | + setMotherBirthDate(newbornVisit.getMotherBirthDate()); | |
137 | 142 | setBirthGestWeeks(null==newbornVisit.getCsWeek()?0:newbornVisit.getCsWeek()); |
138 | 143 | setBirthGestDays(null==newbornVisit.getCsDay()?0:newbornVisit.getCsDay()); |
139 | - setDeliveryOrgName(null); | |
144 | + setDeliveryOrgName(newbornVisit.getDueOrg()); | |
140 | 145 | setAsphyxiaCode(null); |
141 | 146 | setMalformCode(null); |
142 | 147 | setHearingScreenCode(null); |
143 | 148 | |
... | ... | @@ -201,9 +206,8 @@ |
201 | 206 | setBregmaVertDiameter(null); |
202 | 207 | String thisVisitDate=DateUtil.getyyyy_MM_dd(newbornVisit.getCheckTime()); |
203 | 208 | setThisVisitDate(StringUtils.isEmpty(thisVisitDate)?"无":thisVisitDate); |
204 | - setNextVisitDate(null); | |
209 | + setNextVisitDate(DateUtil.getyyyy_MM_dd(newbornVisit.getNextVisitTimeDesc())); | |
205 | 210 | setNextVisitPlace(null); |
206 | - setPersonInfoId("无"); | |
207 | 211 | } |
208 | 212 | |
209 | 213 | public Integer getIsAppCreate() { |
platform-operate-api/src/main/java/com/lyms/hospitalapi/lhxfy/model/SaveChildInfo.java
View file @
daa6862
1 | 1 | package com.lyms.hospitalapi.lhxfy.model; |
2 | 2 | |
3 | +import com.lyms.platform.biz.service.BasicConfigService; | |
3 | 4 | import com.lyms.platform.common.utils.DateUtil; |
4 | 5 | import com.lyms.platform.common.utils.StringUtils; |
6 | +import com.lyms.platform.operate.web.utils.CommonsHelper; | |
7 | +import com.lyms.platform.permission.service.OrganizationService; | |
5 | 8 | import com.lyms.platform.pojo.BabyModel; |
6 | 9 | |
7 | 10 | import java.util.HashMap; |
8 | 11 | |
9 | 12 | |
10 | 13 | |
11 | 14 | |
12 | 15 | |
13 | 16 | |
14 | 17 | |
... | ... | @@ -55,42 +58,42 @@ |
55 | 58 | private String personInfoId; //类型:String 必有字段 备注:个人档案ID |
56 | 59 | |
57 | 60 | |
58 | - public void convertToDataModel(BabyModel babyModel){ | |
61 | + public void convertToDataModel(BabyModel babyModel, BasicConfigService basicConfigService, OrganizationService organizationService){ | |
59 | 62 | |
60 | 63 | setRecordChoice(babyModel.getRecordChoice()); |
61 | - setIsAppCreate(null==babyModel.getIsAppCreate()?0:babyModel.getIsAppCreate()); | |
64 | + setIsAppCreate(0); | |
62 | 65 | int babySc=Integer.valueOf(StringUtils.isEmpty(babyModel.getBabySc())?"0":babyModel.getBabySc()); |
63 | 66 | setChildrenBookIsBuild(babySc); |
64 | 67 | setChildrenBookBuildDate(StringUtils.isEmpty(babyModel.getChildrenBookBuildDate())? DateUtil.getyyyy_MM_dd(babyModel.getCreated()):babyModel.getChildrenBookBuildDate()); |
65 | 68 | setCloseCaseCode(null==babyModel.getEndCase()?"0":babyModel.getEndCase().toString()); |
66 | 69 | setCloseCaseReason(StringUtils.isEmpty(babyModel.getReason())?"无":babyModel.getReason()); |
67 | - setCloseCaseReason(null); | |
68 | 70 | setMalformCode(null); |
69 | - setFatherTelNo(null); | |
70 | - setFatherWorkUnit(null); | |
71 | - setMotherTelNo(null); | |
72 | - setMotherWorkUnit(null); | |
73 | - setNewbornName(null); | |
74 | - setChildInfoNo(null); | |
75 | - setNewbornSexCode(null); | |
76 | - setNewbornBirthDate(null); | |
77 | - setNewbornIdNo(null); | |
78 | - setPresentAddrProvince(null); | |
71 | + setFatherTelNo(babyModel.getFphone()); | |
72 | + setFatherWorkUnit(babyModel.getFwork()); | |
73 | + setMotherTelNo(babyModel.getMphone()); | |
74 | + setMotherWorkUnit(babyModel.getMwork()); | |
75 | + setNewbornName(babyModel.getName()); | |
76 | + setChildInfoNo(babyModel.getFileCode()); | |
77 | + setNewbornSexCode(babyModel.getSex() == 0 ? "2" : babyModel.getSex() == 1 ? "1" : "0"); | |
78 | + setNewbornBirthDate(DateUtil.getyyyy_MM_dd(babyModel.getBirth())); | |
79 | + setNewbornIdNo(babyModel.getCardNo()); | |
80 | + setPresentAddrProvince(CommonsHelper.getResidence(babyModel.getProvinceId(),babyModel.getCityId(), | |
81 | + babyModel.getAreaId(),babyModel.getStreetId(),babyModel.getAddress(),basicConfigService)); | |
79 | 82 | setIsWeakChildren(null); |
80 | - setBirthGestWeeks(null); | |
81 | - setBirthGestDays(null); | |
82 | - setDeliveryOrgName(null); | |
83 | + setBirthGestWeeks(babyModel.getDueWeek()); | |
84 | + setBirthGestDays(babyModel.getDueDay()); | |
85 | + setDeliveryOrgName(CommonsHelper.getHospitalName(babyModel.getDeliverOrg(),organizationService)); | |
83 | 86 | setAsphyxiaCode(null); |
84 | 87 | setSuffocationType(null); |
85 | - setFatherName(null); | |
88 | + setFatherName(babyModel.getFname()); | |
86 | 89 | setFatherId(null); |
87 | 90 | setFatherBirthDate(null); |
88 | 91 | setFatherOccupCode(null); |
89 | - setFatherIdno(null); | |
90 | - setMotherName(null); | |
92 | + setFatherIdno(babyModel.getFcertNo()); | |
93 | + setMotherName(babyModel.getMname()); | |
91 | 94 | setMotherId(null); |
92 | - setMotherBirthDate(null); | |
93 | - setMotherIdno(null); | |
95 | + setMotherBirthDate(DateUtil.getyyyy_MM_dd(babyModel.getMbirth())); | |
96 | + setMotherIdno(babyModel.getCardNo()); | |
94 | 97 | setMotherOccupCode(null); |
95 | 98 | setGuardian(null); |
96 | 99 | setGuardianRelation(null); |
... | ... | @@ -99,7 +102,6 @@ |
99 | 102 | setGuardianAddress(null); |
100 | 103 | setRespondent(null); |
101 | 104 | setInvestigateDate(null); |
102 | - setPersonInfoId("无");//? | |
103 | 105 | } |
104 | 106 | |
105 | 107 | public List<Object> getRecordChoice() { |
platform-operate-api/src/main/java/com/lyms/hospitalapi/lhxfy/model/SaveMaternalRegisterInfo.java
View file @
daa6862
1 | 1 | package com.lyms.hospitalapi.lhxfy.model; |
2 | 2 | |
3 | 3 | import com.lyms.platform.biz.service.BabyBookbuildingService; |
4 | +import com.lyms.platform.biz.service.BasicConfigService; | |
4 | 5 | import com.lyms.platform.common.utils.DateUtil; |
5 | 6 | import com.lyms.platform.common.utils.StringUtils; |
7 | +import com.lyms.platform.operate.web.utils.CommonsHelper; | |
6 | 8 | import com.lyms.platform.pojo.BabyCheckModel; |
7 | 9 | import com.lyms.platform.pojo.BabyModel; |
8 | 10 | import com.lyms.platform.pojo.Patients; |
9 | 11 | |
10 | 12 | |
11 | 13 | |
12 | 14 | |
... | ... | @@ -50,27 +52,28 @@ |
50 | 52 | private String personInfoId; //类型:String 必有字段 备注:个人档案ID |
51 | 53 | private String maternalInfoNo; //类型:String 可有字段 备注:孕产妇基本信息ID |
52 | 54 | |
53 | - public void convertToDataModel(Patients patients){ | |
54 | - setIsAppCreate(null==patients.getIsAppCreate()?0:patients.getIsAppCreate()); | |
55 | - setHusbandName(null); | |
56 | - setHusbandUnit(null); | |
57 | - setHusbandTelNo(null); | |
58 | - setAddress(null); | |
59 | - setExpectedChildBirthday(null); | |
55 | + public void convertToDataModel(Patients patients, BasicConfigService basicConfigService){ | |
56 | + setIsAppCreate(0); | |
57 | + setHusbandName(patients.getHusbandName()); | |
58 | + setHusbandUnit(patients.getHworkUnit()); | |
59 | + setHusbandTelNo(patients.getHusbandPhone()); | |
60 | + setAddress(CommonsHelper.getResidence(patients.getHprovinceId(),patients.getHcityId(), | |
61 | + patients.getHareaId(),patients.getHstreetId(),patients.getHaddress(),basicConfigService)); | |
62 | + setExpectedChildBirthday(DateUtil.getyyyy_MM_dd(patients.getDueDate())); | |
60 | 63 | setBmi(null); |
61 | 64 | setPregnancyInplan(null); |
62 | - setCloseCaseReason(StringUtils.isEmpty(patients.getCloseCaseReason())?"无":patients.getCloseCaseReason()); | |
63 | - setCloseCaseCode(StringUtils.isEmpty(patients.getCloseCaseCode())?"0":patients.getCloseCaseCode()); | |
65 | + setCloseCaseReason(""); | |
66 | + setCloseCaseCode("0"); | |
64 | 67 | setRecordChoice(null); |
65 | 68 | setName(StringUtils.isEmpty(patients.getUsername())?"无":patients.getUsername()); |
66 | - setWorkUnit(null); | |
69 | + setWorkUnit(patients.getPworkUnit()); | |
67 | 70 | setHusbandPersonInfoId(null); |
68 | 71 | setMensesPeriod(null); |
69 | 72 | setMensesMeasure(null); |
70 | - setMensesLastDate(null); | |
73 | + setMensesLastDate(DateUtil.getyyyy_MM_dd(patients.getLastMenses())); | |
71 | 74 | setChildrenCount(null); |
72 | - setBuildingManualDate(null==patients.getBookbuildingDate()?"无": DateUtil.getyyyy_MM_dd(patients.getBookbuildingDate())); | |
73 | - setBuildingManualCode(StringUtils.isEmpty(patients.getBuildingManualCode())?"无":patients.getBuildingManualCode()); | |
75 | + setBuildingManualDate(DateUtil.getyyyy_MM_dd(patients.getBookbuildingDate())); | |
76 | + setBuildingManualCode("1"); | |
74 | 77 | setSpontaneousAbortionCount(null); |
75 | 78 | setArtificialAbortionCount(null); |
76 | 79 | setDrugAbortionCount(null); |
... | ... | @@ -82,8 +85,6 @@ |
82 | 85 | setWeight(null); |
83 | 86 | setHeight(null); |
84 | 87 | setRemark(null); |
85 | - setPersonInfoId("无");//? | |
86 | - setMaternalInfoNo(StringUtils.isEmpty(patients.getId())?"无":patients.getId()); | |
87 | 88 | } |
88 | 89 | |
89 | 90 | public Integer getIsAppCreate() { |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/Public2PathController.java
View file @
daa6862
... | ... | @@ -19,8 +19,6 @@ |
19 | 19 | import org.springframework.stereotype.Controller; |
20 | 20 | import org.springframework.web.bind.annotation.*; |
21 | 21 | |
22 | -import javax.servlet.http.HttpServletRequest; | |
23 | -import javax.servlet.http.HttpServletResponse; | |
24 | 22 | |
25 | 23 | |
26 | 24 | /** |
27 | 25 | |
28 | 26 | |
... | ... | @@ -40,13 +38,11 @@ |
40 | 38 | * @param hospitalId |
41 | 39 | */ |
42 | 40 | @ResponseBody |
43 | - @TokenRequired | |
44 | 41 | @RequestMapping(value = "/saveChildInfo", method = RequestMethod.GET) |
45 | - public BaseResponse saveChildInfo(@RequestParam String startDate, | |
42 | + public void saveChildInfo(@RequestParam String startDate, | |
46 | 43 | @RequestParam String endDate, |
47 | - @RequestParam String hospitalId) { | |
48 | - BaseResponse baseResponse=public2PathFacade.saveChildInfo(startDate,endDate,hospitalId); | |
49 | - return baseResponse; | |
44 | + @RequestParam(required = false) String hospitalId) { | |
45 | + public2PathFacade.saveChildInfo(startDate,endDate,hospitalId); | |
50 | 46 | } |
51 | 47 | /** |
52 | 48 | * 公卫2.0-新增新生儿家庭访视 |
53 | 49 | |
54 | 50 | |
... | ... | @@ -55,13 +51,11 @@ |
55 | 51 | * @param hospitalId |
56 | 52 | */ |
57 | 53 | @ResponseBody |
58 | - @TokenRequired | |
59 | 54 | @RequestMapping(value = "/saveChildHomeVisit", method = RequestMethod.GET) |
60 | - public BaseResponse saveChildHomeVisit(@RequestParam String startDate, | |
55 | + public void saveChildHomeVisit(@RequestParam String startDate, | |
61 | 56 | @RequestParam String endDate, |
62 | - @RequestParam String hospitalId) { | |
63 | - BaseResponse baseResponse=public2PathFacade.saveChildHomeVisit(startDate,endDate,hospitalId); | |
64 | - return baseResponse; | |
57 | + @RequestParam(required = false) String hospitalId) { | |
58 | + public2PathFacade.saveChildHomeVisit(startDate,endDate,hospitalId); | |
65 | 59 | } |
66 | 60 | /** |
67 | 61 | * 公卫2.0-新增儿童健康检查 |
... | ... | @@ -70,7 +64,6 @@ |
70 | 64 | * @param hospitalId |
71 | 65 | */ |
72 | 66 | @ResponseBody |
73 | - @TokenRequired | |
74 | 67 | @RequestMapping(value = "/saveChildHealthExam", method = RequestMethod.GET) |
75 | 68 | public BaseResponse saveChildHealthExam(@RequestParam String startDate, |
76 | 69 | @RequestParam String endDate, |
... | ... | @@ -85,7 +78,6 @@ |
85 | 78 | * @param hospitalId |
86 | 79 | */ |
87 | 80 | @ResponseBody |
88 | - @TokenRequired | |
89 | 81 | @RequestMapping(value = "/saveMaternalRegister", method = RequestMethod.GET) |
90 | 82 | public BaseResponse saveMaternalRegister(@RequestParam String startDate, |
91 | 83 | @RequestParam String endDate, |
92 | 84 | |
93 | 85 | |
... | ... | @@ -100,13 +92,11 @@ |
100 | 92 | * @param hospitalId |
101 | 93 | */ |
102 | 94 | @ResponseBody |
103 | - @TokenRequired | |
104 | 95 | @RequestMapping(value = "/saveMaternalFirstFollowup", method = RequestMethod.GET) |
105 | - public BaseResponse saveMaternalFirstFollowup(@RequestParam String startDate, | |
96 | + public void saveMaternalFirstFollowup(@RequestParam String startDate, | |
106 | 97 | @RequestParam String endDate, |
107 | - @RequestParam String hospitalId) { | |
108 | - BaseResponse baseResponse=public2PathFacade.saveMaternalFirstFollowup(startDate,endDate,hospitalId); | |
109 | - return baseResponse; | |
98 | + @RequestParam(required = false) String hospitalId) { | |
99 | + public2PathFacade.saveMaternalFirstFollowup(startDate,endDate,hospitalId); | |
110 | 100 | } |
111 | 101 | /** |
112 | 102 | * 公卫2.0-新增非首次产前随访 |
... | ... | @@ -115,7 +105,6 @@ |
115 | 105 | * @param hospitalId |
116 | 106 | */ |
117 | 107 | @ResponseBody |
118 | - @TokenRequired | |
119 | 108 | @RequestMapping(value = "/saveMaternalFollowup", method = RequestMethod.GET) |
120 | 109 | public BaseResponse saveMaternalFollowup(@RequestParam String startDate, |
121 | 110 | @RequestParam String endDate, |
... | ... | @@ -130,7 +119,6 @@ |
130 | 119 | * @param hospitalId |
131 | 120 | */ |
132 | 121 | @ResponseBody |
133 | - @TokenRequired | |
134 | 122 | @RequestMapping(value = "/saveMaternalPostpartum42Followup", method = RequestMethod.GET) |
135 | 123 | public BaseResponse saveMaternalPostpartum42Followup(@RequestParam String startDate, |
136 | 124 | @RequestParam String endDate, |
137 | 125 | |
... | ... | @@ -145,13 +133,21 @@ |
145 | 133 | * @param hospitalId |
146 | 134 | */ |
147 | 135 | @ResponseBody |
148 | - @TokenRequired | |
149 | 136 | @RequestMapping(value = "/saveMaternalPostpartumFollowup", method = RequestMethod.GET) |
150 | 137 | public BaseResponse saveMaternalPostpartumFollowup(@RequestParam String startDate, |
151 | 138 | @RequestParam String endDate, |
152 | 139 | @RequestParam String hospitalId) { |
153 | 140 | BaseResponse baseResponse=public2PathFacade.saveMaternalPostpartumFollowup(startDate,endDate,hospitalId); |
154 | 141 | return baseResponse; |
142 | + } | |
143 | + | |
144 | + | |
145 | + @ResponseBody | |
146 | + @RequestMapping(value = "/createGwPerson", method = RequestMethod.GET) | |
147 | + public BaseResponse createGwPerson(@RequestParam String id, | |
148 | + @RequestParam int type) { | |
149 | + public2PathFacade.createGwPerson(id,type); | |
150 | + return new BaseResponse(); | |
155 | 151 | } |
156 | 152 | |
157 | 153 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/MatDeliverFacade.java
View file @
daa6862
... | ... | @@ -813,6 +813,18 @@ |
813 | 813 | trackDownService.addOrupdateTrackDownRecord(patients.getOperator(), trackDownRecord); |
814 | 814 | } |
815 | 815 | } |
816 | + | |
817 | + Query query = Query.query(Criteria.where("cardNo").is(patients.getCardNo()).and("sfStatus").is(2)); | |
818 | + SmnModel smnModel = mongoTemplate.findOne(query, SmnModel.class); | |
819 | + if (smnModel != null) | |
820 | + { | |
821 | + smnModel.setSfStatus(5); | |
822 | + //肌萎缩设置状态 | |
823 | + Query query1 = Query.query(Criteria.where("id").is(smnModel.getId())); | |
824 | + Update update = MongoConvertHelper | |
825 | + .convertToNativeUpdate(ReflectionUtils.getUpdateField(smnModel)); | |
826 | + mongoTemplate.updateFirst(query1, update, SmnModel.class); | |
827 | + } | |
816 | 828 | } |
817 | 829 | }); |
818 | 830 |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/Public2PathFacade.java
View file @
daa6862
... | ... | @@ -8,14 +8,18 @@ |
8 | 8 | import com.lyms.platform.common.result.BaseResponse; |
9 | 9 | import com.lyms.platform.common.utils.*; |
10 | 10 | import com.lyms.platform.operate.web.utils.CollectionUtils; |
11 | +import com.lyms.platform.operate.web.utils.CommonsHelper; | |
12 | +import com.lyms.platform.permission.service.OrganizationService; | |
11 | 13 | import com.lyms.platform.pojo.*; |
12 | 14 | import com.lyms.platform.query.*; |
13 | 15 | import jxl.common.BaseUnit; |
16 | +import net.sf.json.JSONObject; | |
14 | 17 | import org.apache.poi.ss.formula.functions.T; |
15 | 18 | import org.springframework.beans.factory.annotation.Autowired; |
16 | 19 | import org.springframework.data.mongodb.core.MongoTemplate; |
17 | 20 | import org.springframework.data.mongodb.core.query.Criteria; |
18 | 21 | import org.springframework.data.mongodb.core.query.Query; |
22 | +import org.springframework.data.mongodb.core.query.Update; | |
19 | 23 | import org.springframework.stereotype.Component; |
20 | 24 | |
21 | 25 | import java.util.*; |
... | ... | @@ -37,6 +41,11 @@ |
37 | 41 | @Autowired |
38 | 42 | PatientsService patientsService; |
39 | 43 | @Autowired |
44 | + private BasicConfigService basicConfigService; | |
45 | + | |
46 | + @Autowired | |
47 | + private OrganizationService organizationService; | |
48 | + @Autowired | |
40 | 49 | private AntenatalExaminationService antExService; |
41 | 50 | @Autowired |
42 | 51 | private AntenatalExaminationService antenatalExaminationService; |
43 | 52 | |
44 | 53 | |
45 | 54 | |
46 | 55 | |
47 | 56 | |
48 | 57 | |
49 | 58 | |
50 | 59 | |
... | ... | @@ -45,55 +54,261 @@ |
45 | 54 | @Autowired |
46 | 55 | private MatDeliverFollowService matDeliverFollowService; |
47 | 56 | private static final String URL = "http://222.223.187.132:7076/ph-s-report"; |
48 | - public BaseResponse saveChildInfo(String startDate, String endDate,String hospitalId) { | |
49 | - BaseResponse baseResponse=new BaseResponse(); | |
50 | - List<String> baseResponseList=new ArrayList<>();//记录错误信息 | |
51 | - BabyModelQuery modelQuery=new BabyModelQuery(); | |
57 | + private static final String USER_URL = "http://222.223.187.132:7090/"; | |
58 | + public void saveChildInfo(String startDate, String endDate,String hospitalId) { | |
59 | + | |
60 | + BabyModelQuery modelQuery = new BabyModelQuery(); | |
52 | 61 | modelQuery.setYn(YnEnums.YES.getId()); |
53 | 62 | modelQuery.setHospitalId(hospitalId); |
63 | + //modelQuery.setId("633143979932178d885f0c08"); | |
54 | 64 | modelQuery.setBuildDateStart(DateUtil.getDayFirstSecond(DateUtil.parseYMD(startDate))); |
55 | 65 | modelQuery.setBuildDateEnd(DateUtil.getDayLastSecond(DateUtil.parseYMD(endDate))); |
56 | 66 | List<BabyModel> models = babyBookbuildingService.queryBabyBuildByCond(modelQuery); |
57 | - String url=URL+"/thirdApi/saveChildInfo/v1";//新增上传 | |
58 | - for (BabyModel model : models) { | |
59 | - try { | |
60 | - //数据转换 | |
61 | - SaveChildInfo modelInfo=new SaveChildInfo(); | |
62 | - modelInfo.convertToDataModel(model); | |
63 | - String jsonString = JSON.toJSONString(modelInfo); | |
64 | - //上传数据 | |
65 | - String result=repeatPost(url,jsonString); | |
66 | - if(StringUtils.isNotEmpty(result)){ | |
67 | - List<UploadResult_Public2> results=JsonUtil.jsonToList(result, UploadResult.class); | |
68 | - if("0".equals(results.get(0).getCode())){ | |
69 | - baseResponseList.add("新增儿童花名册---"+model.getId()+"---code:"+results.get(0).getCode()+"message:"+results.get(0).getMessage()); | |
70 | - LogUtil.taskInfo("新增儿童花名册---"+model.getId()+"---code:"+results.get(0).getCode()+"message:"+results.get(0).getMessage()); | |
71 | - }else { | |
72 | - baseResponseList.add("新增儿童花名册---"+model.getId()+"---code:"+results.get(0).getCode()+"message:"+results.get(0).getMessage()); | |
73 | - LogUtil.error("新增儿童花名册---"+model.getId()+"---code:"+results.get(0).getCode()+"message:"+results.get(0).getMessage(),null); | |
74 | - } | |
75 | - }else { | |
76 | - baseResponseList.add("新增儿童花名册---"+model.getId()+"---上传返回结果为null"); | |
77 | - LogUtil.error("新增儿童花名册---"+model.getId()+"---上传返回结果为null",null); | |
67 | + | |
68 | + String url = URL + "/thirdApi/saveChildInfo/v1";//新增上传 | |
69 | + if (CollectionUtils.isNotEmpty(models)) | |
70 | + { | |
71 | + for (BabyModel model : models) { | |
72 | + try { | |
73 | + //数据转换 | |
74 | + SaveChildInfo modelInfo = new SaveChildInfo(); | |
75 | + modelInfo.convertToDataModel(model,basicConfigService, organizationService); | |
76 | + | |
77 | + String gwPersonId = createGwPerson(model.getId(),2); | |
78 | + modelInfo.setPersonInfoId(gwPersonId); | |
79 | + String jsonString = JSON.toJSONString(modelInfo); | |
80 | + //上传数据 | |
81 | + Map<String,String> headers = new HashMap<>(); | |
82 | + headers.put("partner-license","zuMEenBpJFPTx+x7Kd+gotbTo+tVvlkPwvd6i0U0rO0pasjnbgBTEq2dPDI52276CFxgTT+N84EOp4+4P0jcwrhRyRM1gYiZiC2952JWZTwEu7ONwcXNS0FkmFAwkQ0M-0Xdumz"); | |
83 | + headers.put("access_token",getLoginToken().get("access_token")); | |
84 | + String result = repeatPost(url,jsonString,headers); | |
85 | + System.out.println("saveChildInfo result "+result); | |
86 | + } catch (Exception e) { | |
87 | + ExceptionUtils.catchException("saveChildInfo error."); | |
78 | 88 | } |
79 | - } catch (Exception e) { | |
80 | - e.printStackTrace(); | |
81 | - LogUtil.error("新增儿童花名册---"+model.getId()+"---"+e.getMessage(),null); | |
82 | - baseResponse.setErrormsg("新增儿童花名册---"+model.getId()+"---"+e.getMessage()); | |
83 | 89 | } |
84 | 90 | } |
85 | - baseResponse.setObject(baseResponseList); | |
86 | - return baseResponse; | |
87 | 91 | } |
92 | + | |
88 | 93 | /** |
94 | + * { | |
95 | + * "access_token": "04385757-bc05-4ce0-8c56-7bad17c996b9", | |
96 | + * "token_type": "bearer", | |
97 | + * "refresh_token": "242ba4d8-0f2d-4d69-9919-9669fbe28454", | |
98 | + * "expires_in": 604799, | |
99 | + * "username": "gtgfy", | |
100 | + * "create_time": "2022-09-20 09:39:36" | |
101 | + * } | |
102 | + * @return | |
103 | + */ | |
104 | + private static Map<String,String> getLoginToken() | |
105 | + { | |
106 | + Map<String,String> params = new HashMap<>(); | |
107 | + params.put("grant_type","password"); | |
108 | + params.put("username","gtgfy"); | |
109 | + params.put("password","a123456"); | |
110 | + params.put("client_id","a936340269e44859bea2e80cac3daae9"); | |
111 | + params.put("client_secret","a1ef7838318147d1b1227e319c4c5d18"); | |
112 | + String result = HttpClientUtil.doGet(USER_URL+"pm-oauth/oauth/token",params,"utf-8",null); | |
113 | + Map<String,String> resultMap = JsonUtil.getMap(result); | |
114 | + if (resultMap != null && resultMap.get("access_token") != null) | |
115 | + { | |
116 | + return resultMap; | |
117 | + } | |
118 | + return null; | |
119 | + } | |
120 | + | |
121 | + public String createGwPerson(String id,Integer type) | |
122 | + { | |
123 | + | |
124 | + Map<String,String> datas = new HashMap<>(); | |
125 | + datas.put("isAppCreate","0"); | |
126 | + datas.put("nationalityCode","01"); | |
127 | + datas.put("rhCode","3"); | |
128 | + String pid = null; | |
129 | + String cardNo = null; | |
130 | + if (type == 1) | |
131 | + { | |
132 | + Patients patients = patientsService.findOnePatientById(id); | |
133 | + pid = patients.getPid(); | |
134 | + cardNo = patients.getCardNo(); | |
135 | + //居住地址 | |
136 | + String address = CommonsHelper.getResidence(patients.getProvinceRegisterId(), patients.getCityRegisterId(), | |
137 | + patients.getAreaRegisterId(), patients.getStreetRegisterId(), patients.getAddressRegister(), basicConfigService); | |
138 | + | |
139 | + | |
140 | + //户籍地址 | |
141 | + String addressRegister = CommonsHelper.getResidence(patients.getProvinceId(), patients.getCityId(), | |
142 | + patients.getAreaId(), patients.getStreetId(), patients.getAddress(), basicConfigService); | |
143 | + | |
144 | + datas.put("sexCode","2"); | |
145 | + datas.put("address",StringUtils.isNotEmpty(address) ? address : addressRegister); | |
146 | + datas.put("paperArchiveDate",DateUtil.getyyyy_MM_dd(patients.getBookbuildingDate())); | |
147 | + datas.put("householdAddress",StringUtils.isNotEmpty(addressRegister) ? addressRegister : address); | |
148 | + datas.put("contactName",patients.getUsername()); | |
149 | + datas.put("contactTelNo",patients.getPhone()); | |
150 | + datas.put("idNo",patients.getCardNo()); | |
151 | + datas.put("name",patients.getUsername()); | |
152 | + datas.put("sexValue","女"); | |
153 | + datas.put("committee","42963805-ef0c-24b2-e053-1264010aaa4b"); | |
154 | + } | |
155 | + else | |
156 | + { | |
157 | + BabyModel babyModel = babyBookbuildingService.queryBabyBuildById(id); | |
158 | + pid = babyModel.getPid(); | |
159 | + String address = CommonsHelper.getResidence(babyModel.getProvinceId(), babyModel.getCityId(), | |
160 | + babyModel.getAreaId(), babyModel.getStreetId(), babyModel.getAddress(), basicConfigService); | |
161 | + String hjAddress = CommonsHelper.getResidence(babyModel.getBabyProvinceId(), babyModel.getBabyProvinceId(), | |
162 | + babyModel.getBabyAreaId(), babyModel.getBabyStreetId(), babyModel.getBabyAddress(), basicConfigService); | |
163 | + datas.put("sexCode",babyModel.getSex() == 0 ? "2" : babyModel.getSex() == 1 ? "1" : "0"); | |
164 | + datas.put("address",StringUtils.isNotEmpty(address) ? address : (StringUtils.isNotEmpty(hjAddress) ? hjAddress : "/")); | |
165 | + datas.put("paperArchiveDate",DateUtil.getyyyy_MM_dd(babyModel.getBuildDate())); | |
166 | + datas.put("householdAddress",StringUtils.isNotEmpty(hjAddress) ? hjAddress : (StringUtils.isNotEmpty(address) ? address : "/")); | |
167 | + datas.put("contactName",babyModel.getMname()); | |
168 | + datas.put("contactTelNo",babyModel.getMphone()); | |
169 | + datas.put("name",babyModel.getName()); | |
170 | + datas.put("idNo",babyModel.getCardNo()); | |
171 | + datas.put("birthday",DateUtil.getyyyy_MM_dd(babyModel.getBirth())); | |
172 | + datas.put("sexValue",babyModel.getSex() == 0 ? "女" : babyModel.getSex() == 1 ? "男" : "未知"); | |
173 | + datas.put("committee","42963805-ef0c-24b2-e053-1264010aaa4b"); | |
174 | + } | |
175 | + | |
176 | + PersonModel personModel = mongoTemplate.findOne(Query.query(Criteria.where("id").is(pid)),PersonModel.class); | |
177 | + | |
178 | + if (personModel != null && StringUtils.isEmpty(personModel.getGwPersonId())) | |
179 | + { | |
180 | + Map<String,String> headers = new HashMap<>(); | |
181 | + headers.put("partner-license","zuMEenBpJFPTx+x7Kd+gotbTo+tVvlkPwvd6i0U0rO0pasjnbgBTEq2dPDI52276CFxgTT+N84EOp4+4P0jcwrhRyRM1gYiZiC2952JWZTwEu7ONwcXNS0FkmFAwkQ0M-0Xdumz"); | |
182 | + headers.put("access_token",getLoginToken().get("access_token")); | |
183 | + String res = HttpClientUtil.doPostHeader(URL+"/thirdApi/savePersonInfo/v1",JsonUtil.obj2Str(datas),headers); | |
184 | + JSONObject jsonObject = JsonUtil.getObj(res); | |
185 | + Object codeObj = jsonObject.get("code"); | |
186 | + String gwPersonId = null; | |
187 | + if (codeObj != null && Integer.valueOf(String.valueOf(codeObj)) == 0) | |
188 | + { | |
189 | + String resJson = jsonObject.get("result").toString(); | |
190 | + Map<String,String> map = JsonUtil.getMap(resJson); | |
191 | + gwPersonId = map.get("personInfoId"); | |
192 | + } | |
193 | + else | |
194 | + { | |
195 | + gwPersonId = getPersonId(cardNo); | |
196 | + } | |
197 | + personModel.setGwPersonId(gwPersonId); | |
198 | + Update update = MongoConvertHelper | |
199 | + .convertToNativeUpdate(ReflectionUtils.getUpdateField(personModel)); | |
200 | + mongoTemplate.updateFirst(Query.query(Criteria.where("id").is(pid)), update, PersonModel.class); | |
201 | + return gwPersonId; | |
202 | + } | |
203 | + return personModel.getGwPersonId(); | |
204 | + | |
205 | + } | |
206 | + public String getPersonId(String cardNo) | |
207 | + { | |
208 | + Map<String,String> headers = new HashMap<>(); | |
209 | + headers.put("partner-license","zuMEenBpJFPTx+x7Kd+gotbTo+tVvlkPwvd6i0U0rO0pasjnbgBTEq2dPDI52276CFxgTT+N84EOp4+4P0jcwrhRyRM1gYiZiC2952JWZTwEu7ONwcXNS0FkmFAwkQ0M-0Xdumz"); | |
210 | + headers.put("access_token",getLoginToken().get("access_token")); | |
211 | + Map<String,String> params = new HashMap<>(); | |
212 | + params.put("idNo",cardNo); | |
213 | + String res = HttpClientUtil.doPostHeader(URL+"/thirdApi/findPersonIsExist/v1",JsonUtil.obj2Str(params),headers); | |
214 | + JSONObject jsonObject = JsonUtil.getObj(res); | |
215 | + Object codeObj = jsonObject.get("code"); | |
216 | + if (codeObj != null && Integer.valueOf(String.valueOf(codeObj)) == 0) | |
217 | + { | |
218 | + String resJson = jsonObject.get("result").toString(); | |
219 | + List< Map<String,String>> list = JsonUtil.jsonToList(resJson,Map.class); | |
220 | + System.out.println(list.get(0).get("personInfoId")); | |
221 | + return list.get(0).get("personInfoId"); | |
222 | + } | |
223 | + return null; | |
224 | + } | |
225 | + | |
226 | + | |
227 | + private Map<String,String> getPersonInfo(Patients patients,AntExChuModel chuModel,AntenatalExaminationModel examinationModel) | |
228 | + { | |
229 | + Map<String,String> map = new HashMap<>(); | |
230 | + | |
231 | + PersonModel personModel = mongoTemplate.findOne(Query.query(Criteria.where("id").is(patients.getPid())),PersonModel.class); | |
232 | + if (personModel != null && StringUtils.isNotEmpty(personModel.getGwPersonId()) && StringUtils.isNotEmpty(personModel.getMaternalId())) | |
233 | + { | |
234 | + map.put("gwPersonId",personModel.getGwPersonId()); | |
235 | + map.put("maternalId",personModel.getMaternalId()); | |
236 | + return map; | |
237 | + } | |
238 | + | |
239 | + String personId = getPersonId(patients.getCardNo()); | |
240 | + if (StringUtils.isEmpty(personId)) | |
241 | + { | |
242 | + return map; | |
243 | + } | |
244 | + | |
245 | + //创建孕产登记id | |
246 | + SaveMaternalRegisterInfo modelInfo = new SaveMaternalRegisterInfo(); | |
247 | + modelInfo.setPersonInfoId(personId); | |
248 | + modelInfo.convertToDataModel(patients,basicConfigService); | |
249 | + String jsonString = JSON.toJSONString(modelInfo); | |
250 | + Map<String,String> headers = new HashMap<>(); | |
251 | + headers.put("partner-license","zuMEenBpJFPTx+x7Kd+gotbTo+tVvlkPwvd6i0U0rO0pasjnbgBTEq2dPDI52276CFxgTT+N84EOp4+4P0jcwrhRyRM1gYiZiC2952JWZTwEu7ONwcXNS0FkmFAwkQ0M-0Xdumz"); | |
252 | + headers.put("access_token",getLoginToken().get("access_token")); | |
253 | + //上传数据 | |
254 | + String url = URL+"/thirdApi/saveChildHealthExam/v1";//新增上传 | |
255 | + String result = repeatPost(url,jsonString,headers); | |
256 | + | |
257 | + JSONObject jsonObject = JsonUtil.getObj(result); | |
258 | + Object codeObj = jsonObject.get("code"); | |
259 | + String maternalId = null; | |
260 | + if (codeObj != null && Integer.valueOf(String.valueOf(codeObj)) == 0) { | |
261 | + String resJson = jsonObject.get("result").toString(); | |
262 | + Map<String, String> resMap = JsonUtil.getMap(resJson); | |
263 | + maternalId = resMap.get("maternalRegisterId"); | |
264 | + } | |
265 | + if (StringUtils.isNotEmpty(maternalId)) | |
266 | + { | |
267 | + map.put("gwPersonId",personId); | |
268 | + map.put("maternalId",maternalId); | |
269 | + personModel.setGwPersonId(personId); | |
270 | + personModel.setMaternalId(maternalId); | |
271 | + Update update = MongoConvertHelper | |
272 | + .convertToNativeUpdate(ReflectionUtils.getUpdateField(personModel)); | |
273 | + mongoTemplate.updateFirst(Query.query(Criteria.where("id").is(patients.getPid())), update, PersonModel.class); | |
274 | + } | |
275 | + return map; | |
276 | + } | |
277 | + | |
278 | + | |
279 | + /** | |
280 | + * 获取工位机构信息 | |
281 | + * @param token | |
282 | + * @return | |
283 | + */ | |
284 | + public static Map<String,String> getGwOrgInfo(String token) | |
285 | + { | |
286 | + Map<String,String> headers = new HashMap<>(); | |
287 | + headers.put("partner-license","zuMEenBpJFPTx+x7Kd+gotbTo+tVvlkPwvd6i0U0rO0pasjnbgBTEq2dPDI52276CFxgTT+N84EOp4+4P0jcwrhRyRM1gYiZiC2952JWZTwEu7ONwcXNS0FkmFAwkQ0M-0Xdumz"); | |
288 | + headers.put("access_token",token); | |
289 | + String result = HttpClientUtil.doGetHeader(USER_URL+"pm-oauth/pos/sessions",null,"utf-8",headers); | |
290 | + Map<String,String> resultMap = JsonUtil.getMap(result); | |
291 | + if (resultMap != null && resultMap.get("pos_id") != null) | |
292 | + { | |
293 | + return resultMap; | |
294 | + } | |
295 | + return null; | |
296 | + } | |
297 | + | |
298 | + public static void main(String[] args) { | |
299 | + Map<String,String> resultMap = getGwOrgInfo(getLoginToken().get("access_token")); | |
300 | + System.out.println(resultMap); | |
301 | + } | |
302 | + | |
303 | + /** | |
89 | 304 | * 重试三次 |
90 | 305 | * @param apiUrl |
91 | 306 | * @param json |
92 | 307 | * @return |
93 | 308 | */ |
94 | - private String repeatPost(String apiUrl, Object json) { | |
309 | + private String repeatPost(String apiUrl, Object json,Map<String,String> headers) { | |
95 | 310 | for (int i = 0; i <= 2; i++) { |
96 | - String result = HttpClientUtil.doPostSSL(apiUrl,json); | |
311 | + String result = HttpClientUtil.doPostHeader(apiUrl,json,headers); | |
97 | 312 | if (result == null) { |
98 | 313 | try { |
99 | 314 | Thread.sleep(1000); |
100 | 315 | |
101 | 316 | |
... | ... | @@ -107,12 +322,10 @@ |
107 | 322 | return null; |
108 | 323 | } |
109 | 324 | |
110 | - public BaseResponse saveChildHomeVisit(String startDate, String endDate, String hospitalId) { | |
111 | - BaseResponse baseResponse=new BaseResponse(); | |
112 | - List<String> baseResponseList=new ArrayList<>();//记录错误信息 | |
325 | + public void saveChildHomeVisit(String startDate, String endDate, String hospitalId) { | |
113 | 326 | Query query=new Query(); |
327 | + query.addCriteria(Criteria.where("id").is("fa3940ca0cba4ef9a86f5b33b2e42dc2")); | |
114 | 328 | query.addCriteria(Criteria.where("yn").is("1")); |
115 | - query.addCriteria(Criteria.where("hospitalId").is(hospitalId)); | |
116 | 329 | query.addCriteria(Criteria.where("checkTime") |
117 | 330 | .gte(DateUtil.getDayFirstSecond(DateUtil.parseYMD(startDate))) |
118 | 331 | .lte(DateUtil.getDayLastSecond(DateUtil.parseYMD(endDate)))); |
119 | 332 | |
120 | 333 | |
121 | 334 | |
122 | 335 | |
... | ... | @@ -122,32 +335,24 @@ |
122 | 335 | for (NewbornVisit model : models) { |
123 | 336 | try { |
124 | 337 | //数据转换 |
125 | - SaveChildHomeVisitInfo modelInfo=new SaveChildHomeVisitInfo(); | |
126 | - modelInfo.convertToDataModel(model); | |
338 | + SaveChildHomeVisitInfo modelInfo = new SaveChildHomeVisitInfo(); | |
339 | + BabyModel babyModel = babyBookbuildingService.queryBabyBuildById(model.getBabyId()); | |
340 | + | |
341 | + String gwPersonId = createGwPerson(model.getBabyId(),2); | |
342 | + modelInfo.setPersonInfoId(gwPersonId); | |
343 | + | |
344 | + modelInfo.convertToDataModel(model,babyModel, basicConfigService, organizationService); | |
127 | 345 | String jsonString = JSON.toJSONString(modelInfo); |
346 | + Map<String,String> headers = new HashMap<>(); | |
347 | + headers.put("partner-license","zuMEenBpJFPTx+x7Kd+gotbTo+tVvlkPwvd6i0U0rO0pasjnbgBTEq2dPDI52276CFxgTT+N84EOp4+4P0jcwrhRyRM1gYiZiC2952JWZTwEu7ONwcXNS0FkmFAwkQ0M-0Xdumz"); | |
348 | + headers.put("access_token",getLoginToken().get("access_token")); | |
128 | 349 | //上传数据 |
129 | - String result=repeatPost(url,jsonString); | |
130 | - if(StringUtils.isNotEmpty(result)){ | |
131 | - List<UploadResult_Public2> results=JsonUtil.jsonToList(result, UploadResult.class); | |
132 | - if("0".equals(results.get(0).getCode())){ | |
133 | - baseResponseList.add("新增新生儿家庭访视---"+model.getId()+"---code:"+results.get(0).getCode()+"message:"+results.get(0).getMessage()); | |
134 | - LogUtil.taskInfo("新增新生儿家庭访视---"+model.getId()+"---code:"+results.get(0).getCode()+"message:"+results.get(0).getMessage()); | |
135 | - }else { | |
136 | - baseResponseList.add("新增新生儿家庭访视---"+model.getId()+"---code:"+results.get(0).getCode()+"message:"+results.get(0).getMessage()); | |
137 | - LogUtil.error("新增新生儿家庭访视---"+model.getId()+"---code:"+results.get(0).getCode()+"message:"+results.get(0).getMessage(),null); | |
138 | - } | |
139 | - }else { | |
140 | - baseResponseList.add("新增新生儿家庭访视---"+model.getId()+"---上传返回结果为null"); | |
141 | - LogUtil.error("新增新生儿家庭访视---"+model.getId()+"---上传返回结果为null",null); | |
142 | - } | |
350 | + String result = repeatPost(url,jsonString,headers); | |
351 | + System.out.println("saveChildHomeVisit result "+result); | |
143 | 352 | } catch (Exception e) { |
144 | - e.printStackTrace(); | |
145 | - LogUtil.error("新增新生儿家庭访视---"+model.getId()+"---"+e.getMessage(),null); | |
146 | - baseResponse.setErrormsg("新增新生儿家庭访视---"+model.getId()+"---"+e.getMessage()); | |
353 | + ExceptionUtils.catchException("saveChildHomeVisit error."); | |
147 | 354 | } |
148 | 355 | } |
149 | - baseResponse.setObject(baseResponseList); | |
150 | - return baseResponse; | |
151 | 356 | } |
152 | 357 | |
153 | 358 | public BaseResponse saveChildHealthExam(String startDate, String endDate, String hospitalId) { |
... | ... | @@ -167,7 +372,10 @@ |
167 | 372 | modelInfo.convertToDataModel(model); |
168 | 373 | String jsonString = JSON.toJSONString(modelInfo); |
169 | 374 | //上传数据 |
170 | - String result=repeatPost(url,jsonString); | |
375 | + Map<String,String> headers = new HashMap<>(); | |
376 | + headers.put("partner-license","zuMEenBpJFPTx+x7Kd+gotbTo+tVvlkPwvd6i0U0rO0pasjnbgBTEq2dPDI52276CFxgTT+N84EOp4+4P0jcwrhRyRM1gYiZiC2952JWZTwEu7ONwcXNS0FkmFAwkQ0M-0Xdumz"); | |
377 | + headers.put("access_token",getLoginToken().get("access_token")); | |
378 | + String result=repeatPost(url,jsonString,headers); | |
171 | 379 | if(StringUtils.isNotEmpty(result)){ |
172 | 380 | List<UploadResult_Public2> results=JsonUtil.jsonToList(result, UploadResult.class); |
173 | 381 | if("0".equals(results.get(0).getCode())){ |
174 | 382 | |
175 | 383 | |
... | ... | @@ -207,10 +415,13 @@ |
207 | 415 | try { |
208 | 416 | //数据转换 |
209 | 417 | SaveMaternalRegisterInfo modelInfo=new SaveMaternalRegisterInfo(); |
210 | - modelInfo.convertToDataModel(model); | |
418 | + // modelInfo.convertToDataModel(model); | |
211 | 419 | String jsonString = JSON.toJSONString(modelInfo); |
420 | + Map<String,String> headers = new HashMap<>(); | |
421 | + headers.put("partner-license","zuMEenBpJFPTx+x7Kd+gotbTo+tVvlkPwvd6i0U0rO0pasjnbgBTEq2dPDI52276CFxgTT+N84EOp4+4P0jcwrhRyRM1gYiZiC2952JWZTwEu7ONwcXNS0FkmFAwkQ0M-0Xdumz"); | |
422 | + headers.put("access_token",getLoginToken().get("access_token")); | |
212 | 423 | //上传数据 |
213 | - String result=repeatPost(url,jsonString); | |
424 | + String result=repeatPost(url,jsonString,headers); | |
214 | 425 | if(StringUtils.isNotEmpty(result)){ |
215 | 426 | List<UploadResult_Public2> results=JsonUtil.jsonToList(result, UploadResult.class); |
216 | 427 | if("0".equals(results.get(0).getCode())){ |
217 | 428 | |
218 | 429 | |
219 | 430 | |
... | ... | @@ -247,28 +458,26 @@ |
247 | 458 | for (AntExChuModel model : models) { |
248 | 459 | try { |
249 | 460 | //数据转换 |
250 | - SaveMaternalFirstFollowupInfo modelInfo=new SaveMaternalFirstFollowupInfo(); | |
461 | + SaveMaternalFirstFollowupInfo modelInfo = new SaveMaternalFirstFollowupInfo(); | |
462 | + Patients patients = patientsService.findOnePatientById(model.getParentId()); | |
463 | + String personId = getPersonId(patients.getCardNo()); | |
464 | + | |
465 | + if (StringUtils.isEmpty(personId)) | |
466 | + { | |
467 | + continue; | |
468 | + } | |
469 | + | |
470 | + modelInfo.setPersonInfoId(personId); | |
251 | 471 | modelInfo.convertToDataModel(model); |
252 | 472 | String jsonString = JSON.toJSONString(modelInfo); |
473 | + Map<String,String> headers = new HashMap<>(); | |
474 | + headers.put("partner-license","zuMEenBpJFPTx+x7Kd+gotbTo+tVvlkPwvd6i0U0rO0pasjnbgBTEq2dPDI52276CFxgTT+N84EOp4+4P0jcwrhRyRM1gYiZiC2952JWZTwEu7ONwcXNS0FkmFAwkQ0M-0Xdumz"); | |
475 | + headers.put("access_token",getLoginToken().get("access_token")); | |
253 | 476 | //上传数据 |
254 | - String result=repeatPost(url,jsonString); | |
255 | - if(StringUtils.isNotEmpty(result)){ | |
256 | - List<UploadResult_Public2> results=JsonUtil.jsonToList(result, UploadResult.class); | |
257 | - if("0".equals(results.get(0).getCode())){ | |
258 | - baseResponseList.add("新增第一次产前随访---"+model.getId()+"---code:"+results.get(0).getCode()+"message:"+results.get(0).getMessage()); | |
259 | - LogUtil.taskInfo("新增第一次产前随访---"+model.getId()+"---code:"+results.get(0).getCode()+"message:"+results.get(0).getMessage()); | |
260 | - }else { | |
261 | - baseResponseList.add("新增第一次产前随访---"+model.getId()+"---code:"+results.get(0).getCode()+"message:"+results.get(0).getMessage()); | |
262 | - LogUtil.error("新增第一次产前随访---"+model.getId()+"---code:"+results.get(0).getCode()+"message:"+results.get(0).getMessage(),null); | |
263 | - } | |
264 | - }else { | |
265 | - baseResponseList.add("新增第一次产前随访---"+model.getId()+"---上传返回结果为null"); | |
266 | - LogUtil.error("新增第一次产前随访---"+model.getId()+"---上传返回结果为null",null); | |
267 | - } | |
477 | + String result = repeatPost(url,jsonString,headers); | |
478 | + System.out.println(result); | |
268 | 479 | } catch (Exception e) { |
269 | - e.printStackTrace(); | |
270 | - LogUtil.error("新增第一次产前随访---"+model.getId()+"---"+e.getMessage(),null); | |
271 | - baseResponse.setErrormsg("新增第一次产前随访---"+model.getId()+"---"+e.getMessage()); | |
480 | + ExceptionUtils.catchException(e,"保存初诊到工位异常"); | |
272 | 481 | } |
273 | 482 | } |
274 | 483 | baseResponse.setObject(baseResponseList); |
275 | 484 | |
... | ... | @@ -291,8 +500,11 @@ |
291 | 500 | SaveMaternalFollowupInfo modelInfo=new SaveMaternalFollowupInfo(); |
292 | 501 | modelInfo.convertToDataModel(model); |
293 | 502 | String jsonString = JSON.toJSONString(modelInfo); |
503 | + Map<String,String> headers = new HashMap<>(); | |
504 | + headers.put("partner-license","zuMEenBpJFPTx+x7Kd+gotbTo+tVvlkPwvd6i0U0rO0pasjnbgBTEq2dPDI52276CFxgTT+N84EOp4+4P0jcwrhRyRM1gYiZiC2952JWZTwEu7ONwcXNS0FkmFAwkQ0M-0Xdumz"); | |
505 | + headers.put("access_token",getLoginToken().get("access_token")); | |
294 | 506 | //上传数据 |
295 | - String result=repeatPost(url,jsonString); | |
507 | + String result=repeatPost(url,jsonString,headers); | |
296 | 508 | if(StringUtils.isNotEmpty(result)){ |
297 | 509 | List<UploadResult_Public2> results=JsonUtil.jsonToList(result, UploadResult.class); |
298 | 510 | if("0".equals(results.get(0).getCode())){ |
299 | 511 | |
300 | 512 | |
... | ... | @@ -332,13 +544,14 @@ |
332 | 544 | saveMaternalPostpartum42FollowupInfo modelInfo=new saveMaternalPostpartum42FollowupInfo(); |
333 | 545 | modelInfo.convertToDataModel(model); |
334 | 546 | String jsonString = JSON.toJSONString(modelInfo); |
547 | + Map<String,String> headers = new HashMap<>(); | |
548 | + headers.put("partner-license","zuMEenBpJFPTx+x7Kd+gotbTo+tVvlkPwvd6i0U0rO0pasjnbgBTEq2dPDI52276CFxgTT+N84EOp4+4P0jcwrhRyRM1gYiZiC2952JWZTwEu7ONwcXNS0FkmFAwkQ0M-0Xdumz"); | |
549 | + headers.put("access_token",getLoginToken().get("access_token")); | |
335 | 550 | //上传数据 |
336 | - String result=repeatPost(url,jsonString); | |
551 | + String result=repeatPost(url,jsonString,headers); | |
337 | 552 | if(StringUtils.isNotEmpty(result)){ |
338 | 553 | List<UploadResult_Public2> results=JsonUtil.jsonToList(result, UploadResult.class); |
339 | 554 | if("0".equals(results.get(0).getCode())){ |
340 | - baseResponseList.add("新增产后42天---"+model.getId()+"---code:"+results.get(0).getCode()+"message:"+results.get(0).getMessage()); | |
341 | - LogUtil.taskInfo("新增产后42天---"+model.getId()+"---code:"+results.get(0).getCode()+"message:"+results.get(0).getMessage()); | |
342 | 555 | }else { |
343 | 556 | baseResponseList.add("新增产后42天---"+model.getId()+"---code:"+results.get(0).getCode()+"message:"+results.get(0).getMessage()); |
344 | 557 | LogUtil.error("新增产后42天---"+model.getId()+"---code:"+results.get(0).getCode()+"message:"+results.get(0).getMessage(),null); |
345 | 558 | |
346 | 559 | |
... | ... | @@ -369,11 +582,14 @@ |
369 | 582 | for (MatdeliverFollowModel model : models) { |
370 | 583 | try { |
371 | 584 | //数据转换 |
372 | - saveMaternalPostpartumFollowupInfo modelInfo=new saveMaternalPostpartumFollowupInfo(); | |
585 | + saveMaternalPostpartumFollowupInfo modelInfo = new saveMaternalPostpartumFollowupInfo(); | |
373 | 586 | modelInfo.convertToDataModel(model); |
374 | 587 | String jsonString = JSON.toJSONString(modelInfo); |
588 | + Map<String,String> headers = new HashMap<>(); | |
589 | + headers.put("partner-license","zuMEenBpJFPTx+x7Kd+gotbTo+tVvlkPwvd6i0U0rO0pasjnbgBTEq2dPDI52276CFxgTT+N84EOp4+4P0jcwrhRyRM1gYiZiC2952JWZTwEu7ONwcXNS0FkmFAwkQ0M-0Xdumz"); | |
590 | + headers.put("access_token",getLoginToken().get("access_token")); | |
375 | 591 | //上传数据 |
376 | - String result=repeatPost(url,jsonString); | |
592 | + String result=repeatPost(url,jsonString,headers); | |
377 | 593 | if(StringUtils.isNotEmpty(result)){ |
378 | 594 | List<UploadResult_Public2> results=JsonUtil.jsonToList(result, UploadResult.class); |
379 | 595 | if("0".equals(results.get(0).getCode())){ |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/SmnTaskFacade.java
View file @
daa6862
... | ... | @@ -30,37 +30,37 @@ |
30 | 30 | private OrganizationService organizationService; |
31 | 31 | |
32 | 32 | /** |
33 | - * 添加肌萎缩 10 -14周 | |
33 | + * 添加肌萎缩 0 -22周 | |
34 | 34 | */ |
35 | 35 | public void addSmnJob() { |
36 | - Date endDate = DateUtil.addDay(DateUtil.formatDate(new Date()), -70); | |
37 | - Date start = DateUtil.addDay(DateUtil.formatDate(new Date()), -98); | |
38 | - PatientsQuery patientsQuery = new PatientsQuery(); | |
39 | - patientsQuery.setLastMensesEnd(endDate); | |
40 | - patientsQuery.setLastMensesStart(start); | |
41 | - patientsQuery.setYn(YnEnums.YES.getId()); | |
42 | - patientsQuery.setDueStatus(0); | |
43 | - //排查本院隐藏建档 | |
44 | - patientsQuery.setExtEnable(false); | |
45 | - patientsQuery.setBuildTypeNot(1); | |
46 | - patientsQuery.setType(1); | |
47 | - List<Patients> patientses = patientService.queryPatient(patientsQuery); | |
48 | - int batchSize = 200; | |
49 | - if (CollectionUtils.isNotEmpty(patientses)) { | |
50 | - | |
51 | - int end = 0; | |
52 | - List<Patients> patient; | |
53 | - for (int i = 0; i < patientses.size(); ) { | |
54 | - end = i + batchSize; | |
55 | - if (end > patientses.size()) { | |
56 | - end = patientses | |
57 | - .size(); | |
36 | + Date endDate = DateUtil.addDay(DateUtil.formatDate(new Date()), 0); | |
37 | + Date start = DateUtil.addDay(DateUtil.formatDate(new Date()), -154); | |
38 | + PatientsQuery patientsQuery = new PatientsQuery(); | |
39 | + patientsQuery.setLastMensesEnd(endDate); | |
40 | + patientsQuery.setLastMensesStart(start); | |
41 | + patientsQuery.setYn(YnEnums.YES.getId()); | |
42 | + patientsQuery.setDueStatus(0); | |
43 | + //排查本院隐藏建档 | |
44 | + patientsQuery.setExtEnable(false); | |
45 | + patientsQuery.setBuildTypeNot(1); | |
46 | + patientsQuery.setType(1); | |
47 | + List<Patients> patientses = patientService.queryPatient(patientsQuery); | |
48 | + int batchSize = 200; | |
49 | + if (CollectionUtils.isNotEmpty(patientses)) { | |
50 | + System.out.println("size ----- "+ patientses.size()); | |
51 | + int end = 0; | |
52 | + List<Patients> patient; | |
53 | + for (int i = 0; i < patientses.size(); ) { | |
54 | + end = i + batchSize; | |
55 | + if (end > patientses.size()) { | |
56 | + end = patientses | |
57 | + .size(); | |
58 | + } | |
59 | + patient = patientses.subList(i, end); | |
60 | + i += batchSize; | |
61 | + new Thread(new PatientSmnWorker(patient)).start(); | |
58 | 62 | } |
59 | - patient = patientses.subList(i, end); | |
60 | - i += batchSize; | |
61 | - new Thread(new PatientSmnWorker(patient)).start(); | |
62 | 63 | } |
63 | - } | |
64 | 64 | } |
65 | 65 | |
66 | 66 | private class PatientSmnWorker extends Thread { |