Commit 78cf6e35699cd517aaca0e33d878cb10d17681f1
1 parent
fddc135795
Exists in
master
and in
1 other branch
code update
Showing 3 changed files with 427 additions and 332 deletions
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/JdbcUtil.java
View file @
78cf6e3
1 | 1 | package com.lyms.platform.biz; |
2 | 2 | |
3 | +import com.lyms.platform.common.dao.operator.MongoCondition; | |
4 | +import com.lyms.platform.common.dao.operator.MongoOper; | |
5 | +import com.lyms.platform.common.dao.operator.MongoQuery; | |
3 | 6 | import com.lyms.platform.common.enums.*; |
4 | -import com.lyms.platform.common.utils.DateUtil; | |
5 | -import com.lyms.platform.common.utils.JsonUtil; | |
7 | +import com.lyms.platform.common.utils.*; | |
8 | +import com.lyms.platform.common.utils.ReflectionUtils; | |
6 | 9 | import com.lyms.platform.common.utils.StringUtils; |
7 | -import com.lyms.platform.common.utils.SystemConfig; | |
8 | 10 | import com.lyms.platform.pojo.*; |
11 | +import com.lyms.platform.query.BasicConfigQuery; | |
9 | 12 | import org.apache.commons.collections.CollectionUtils; |
13 | +import org.apache.commons.lang.math.NumberUtils; | |
10 | 14 | import org.apache.velocity.anakia.Escape; |
11 | 15 | import org.bson.types.ObjectId; |
12 | 16 | import org.springframework.context.ApplicationContext; |
13 | 17 | import org.springframework.context.support.ClassPathXmlApplicationContext; |
14 | 18 | import org.springframework.data.mongodb.core.MongoTemplate; |
19 | +import org.springframework.data.mongodb.core.query.Query; | |
20 | +import org.springframework.data.mongodb.core.query.Update; | |
21 | +import org.springframework.util.*; | |
15 | 22 | |
16 | 23 | |
17 | 24 | import java.sql.*; |
18 | 25 | |
19 | 26 | |
20 | 27 | |
21 | 28 | |
22 | 29 | |
23 | 30 | |
24 | 31 | |
25 | 32 | |
26 | 33 | |
27 | 34 | |
28 | 35 | |
29 | 36 | |
30 | 37 | |
31 | 38 | |
32 | 39 | |
33 | 40 | |
34 | 41 | |
35 | 42 | |
36 | 43 | |
37 | 44 | |
38 | 45 | |
39 | 46 | |
40 | 47 | |
41 | 48 | |
42 | 49 | |
43 | 50 | |
44 | 51 | |
45 | 52 | |
46 | 53 | |
47 | 54 | |
48 | 55 | |
49 | 56 | |
50 | 57 | |
51 | 58 | |
52 | 59 | |
53 | 60 | |
54 | 61 | |
55 | 62 | |
56 | 63 | |
57 | 64 | |
58 | 65 | |
59 | 66 | |
60 | 67 | |
61 | 68 | |
62 | 69 | |
63 | 70 | |
64 | 71 | |
65 | 72 | |
66 | 73 | |
67 | 74 | |
68 | 75 | |
69 | 76 | |
70 | 77 | |
71 | 78 | |
72 | 79 | |
73 | 80 | |
74 | 81 | |
75 | 82 | |
76 | 83 | |
77 | 84 | |
78 | 85 | |
79 | 86 | |
80 | 87 | |
81 | 88 | |
82 | 89 | |
... | ... | @@ -171,393 +178,371 @@ |
171 | 178 | |
172 | 179 | public static void syncPatientData(String hospitalId) |
173 | 180 | { |
174 | - List<Map<String,Object>> list = getListDataBySql(" SELECT * FROM ( SELECT A.*, ROWNUM RN FROM " + | |
175 | - "(select replace(mp.P_NO,'-','') as PID,mp.*,p_birthday,p_name,floor((trunc(sysdate) - trunc(mp.P_LASTMENSTRUALPERIOD)+1) /7) as weeks from MOMMY_PATIENT mp left join Plat_Patient pp" + | |
176 | - " on mp.p_platpatientid=pp.p_id where mp.p_hospitalid = '"+hospitalId+"') A WHERE ROWNUM <= 30 and weeks < 42) WHERE RN >= 0 "); | |
177 | 181 | |
182 | + int num = 1; | |
178 | 183 | |
179 | - MongoTemplate mongoTemplate = getMongoTemplate(); | |
184 | + while (true) { | |
185 | + List<Map<String, Object>> list = getListDataBySql(" SELECT * FROM ( SELECT A.*, ROWNUM RN FROM " + | |
186 | + "(select replace(mp.P_NO,'-','') as PID,mp.*,p_birthday,p_name,floor((trunc(sysdate) - trunc(mp.P_LASTMENSTRUALPERIOD)+1) /7) as weeks from MOMMY_PATIENT mp left join Plat_Patient pp" + | |
187 | + " on mp.p_platpatientid=pp.p_id where mp.p_hospitalid = '" + hospitalId + "') A WHERE ROWNUM < "+(num+20)+" and weeks < 42) WHERE RN >= "+num+" "); | |
188 | + num=num+20; | |
189 | + MongoTemplate mongoTemplate = getMongoTemplate(); | |
180 | 190 | |
181 | - for(Map<String,Object> map : list) | |
182 | - { | |
183 | - Patients patients = new Patients(); | |
184 | - PersonModel person = new PersonModel(); | |
191 | + for (Map<String, Object> map : list) { | |
192 | + Patients patients = new Patients(); | |
193 | + PersonModel person = new PersonModel(); | |
185 | 194 | |
186 | 195 | |
187 | - int type = 1; | |
188 | - Integer weeks = getInteger(map.get("WEEKS")); | |
189 | - List<Map<String,Object>> chanList = null; | |
190 | - if (StringUtils.isNotEmpty(getString(map.get("P_ID")))) | |
191 | - { | |
192 | - chanList = getListDataBySql("select * from MOMMY_PREGDELIVERYRECORD p where p.pdr_patientid = '"+getString(map.get("p_id"))+"' order by p.PDR_CHILDBIRTHDAY desc "); | |
193 | - } | |
194 | - if (weeks >= 42 || CollectionUtils.isNotEmpty(chanList)) | |
195 | - { | |
196 | - Date fmDate = null; | |
197 | - if (CollectionUtils.isNotEmpty(chanList)) | |
198 | - { | |
199 | - fmDate = getDate(chanList.get(0).get("PDR_CHILDBIRTHDAY")); | |
196 | + int type = 1; | |
197 | + Integer weeks = getInteger(map.get("WEEKS")); | |
198 | + List<Map<String, Object>> chanList = null; | |
199 | + if (StringUtils.isNotEmpty(getString(map.get("P_ID")))) { | |
200 | + chanList = getListDataBySql("select * from MOMMY_PREGDELIVERYRECORD p where p.pdr_patientid = '" + getString(map.get("p_id")) + "' order by p.PDR_CHILDBIRTHDAY desc "); | |
200 | 201 | } |
201 | - else | |
202 | - { | |
203 | - fmDate = DateUtil.addDay(getDate(map.get("P_LASTMENSTRUALPERIOD")),42*7); | |
202 | + if (weeks >= 42 || CollectionUtils.isNotEmpty(chanList)) { | |
203 | + Date fmDate = null; | |
204 | + if (CollectionUtils.isNotEmpty(chanList)) { | |
205 | + fmDate = getDate(chanList.get(0).get("PDR_CHILDBIRTHDAY")); | |
206 | + } else { | |
207 | + fmDate = DateUtil.addDay(getDate(map.get("P_LASTMENSTRUALPERIOD")), 42 * 7); | |
208 | + } | |
209 | + patients.setFmDate(fmDate); | |
210 | + | |
211 | + type = 3; | |
204 | 212 | } |
205 | - patients.setFmDate(fmDate); | |
206 | 213 | |
207 | - type = 3; | |
208 | - } | |
214 | + patients.setDueDate(DateUtil.addDay(getDate(map.get("P_LASTMENSTRUALPERIOD")), 42 * 7)); | |
215 | + person.setCreated(new Date()); | |
209 | 216 | |
210 | - patients.setDueDate(DateUtil.addDay(getDate(map.get("P_LASTMENSTRUALPERIOD")), 42 * 7)); | |
211 | - person.setCreated(new Date()); | |
212 | 217 | |
218 | + person.setType(type); | |
219 | + person.setYn(YnEnums.YES.getId()); | |
220 | + person.setBirth(getDate(map.get("P_BIRTHDAY"))); | |
221 | + person.setCardNo(getString(map.get("P_CARDNO"))); | |
222 | + person.setName(getString(map.get("P_NAME"))); | |
223 | + person.setPhone(getString(map.get("P_MOBILEPHONE"))); | |
224 | + person.setCreated(getDate(map.get("P_FILINGTIME"))); | |
225 | + person.setModified(getDate(map.get("P_OPERTIME"))); | |
226 | + mongoTemplate.save(person); | |
213 | 227 | |
214 | - person.setType(type); | |
215 | - person.setYn(YnEnums.YES.getId()); | |
216 | - person.setBirth(getDate(map.get("P_BIRTHDAY"))); | |
217 | - person.setCardNo(getString(map.get("P_CARDNO"))); | |
218 | - person.setName(getString(map.get("P_NAME"))); | |
219 | - person.setPhone(getString(map.get("P_MOBILEPHONE"))); | |
220 | - person.setCreated(getDate(map.get("P_FILINGTIME"))); | |
221 | - person.setModified(getDate(map.get("P_OPERTIME"))); | |
222 | - mongoTemplate.save(person); | |
223 | 228 | |
229 | + patients.setPid(person.getId()); | |
230 | + patients.setId(String.valueOf(map.get("PID"))); | |
231 | + patients.setYn(getInteger(map.get("P_ISVALID"))); //是否有效 | |
232 | + patients.setBuildType(0); | |
233 | + patients.setBirth(getDate(map.get("P_BIRTHDAY"))); | |
234 | + patients.setCreated(getDate(map.get("P_FILINGTIME"))); | |
235 | + patients.setModified(getDate(map.get("P_OPERTIME"))); | |
236 | + patients.setDueStatus(0); | |
224 | 237 | |
225 | - patients.setPid(person.getId()); | |
226 | - patients.setId(String.valueOf(map.get("PID"))); | |
227 | - patients.setYn(getInteger(map.get("P_ISVALID"))); //是否有效 | |
228 | - patients.setBuildType(0); | |
229 | - patients.setBirth(getDate(map.get("P_BIRTHDAY"))); | |
230 | - patients.setCreated(getDate(map.get("P_FILINGTIME"))); | |
231 | - patients.setModified(getDate(map.get("P_OPERTIME"))); | |
232 | - patients.setDueStatus(0); | |
238 | + if (StringUtils.isNotEmpty(getString(map.get("P_CARDNO")))) { | |
239 | + String cardType = getString(map.get("P_CARDTYPE")); //证件类型 | |
240 | + String cardTypeName = getString(getOralceSingleObjBySql("select dc_name from plat_datacontent where dc_id='" + cardType + "'")); | |
241 | + if (cardTypeName != null && !"".equals(cardTypeName)) { | |
242 | + String id = getMongoBasicConfig(cardTypeName, SystemConfig.CERTE_TYPE_ID); | |
243 | + patients.setPcerteTypeId(id); | |
244 | + } | |
233 | 245 | |
234 | - | |
235 | - | |
236 | - | |
237 | - | |
238 | - if (StringUtils.isNotEmpty(getString(map.get("P_CARDNO")))) | |
239 | - { | |
240 | - String cardType = getString(map.get("P_CARDTYPE")); //证件类型 | |
241 | - String cardTypeName = getString(getOralceSingleObjBySql("select dc_name from plat_datacontent where dc_id='" + cardType + "'")); | |
242 | - if (cardTypeName != null && !"".equals(cardTypeName)) | |
243 | - { | |
244 | - String id = getMongoBasicConfig(cardTypeName, SystemConfig.CERTE_TYPE_ID); | |
245 | - patients.setPcerteTypeId(id); | |
246 | + patients.setCardNo(getString(map.get("P_CARDNO"))); //证件号码 | |
247 | + } else { | |
248 | + patients.setCardNo(getString(map.get("P_MOBILEPHONE"))); //证件号码 | |
249 | + patients.setPcerteTypeId("57e0a21c0cf209b410a82cda"); | |
246 | 250 | } |
247 | 251 | |
248 | - patients.setCardNo(getString(map.get("P_CARDNO"))); //证件号码 | |
249 | - } | |
250 | - else | |
251 | - { | |
252 | - patients.setCardNo(getString(map.get("P_MOBILEPHONE"))); //证件号码 | |
253 | - patients.setPcerteTypeId("57e0a21c0cf209b410a82cda"); | |
254 | - } | |
252 | + //---------------------居住地址 | |
253 | + String proviceId = getString(map.get("P_ADDRESSPROVINCE")); | |
254 | + if (proviceId != null && !"".equals(proviceId)) { | |
255 | + String juzhudiProviceName = getOracleBasicConfig(proviceId); | |
256 | + String id1 = getMongoBasicConfig(juzhudiProviceName, SystemConfig.CHINA_BASIC_ID); | |
257 | + patients.setProvinceId(id1); //居住地省 | |
255 | 258 | |
256 | - //---------------------居住地址 | |
257 | - String proviceId = getString(map.get("P_ADDRESSPROVINCE")); | |
258 | - if (proviceId != null && !"".equals(proviceId)) | |
259 | - { | |
260 | - String juzhudiProviceName = getOracleBasicConfig(proviceId); | |
261 | - String id1 = getMongoBasicConfig(juzhudiProviceName, SystemConfig.CHINA_BASIC_ID); | |
262 | - patients.setProvinceId(id1); //居住地省 | |
259 | + String cityId = getString(map.get("P_ADDRESSCITY")); | |
260 | + if (cityId != null && !"".equals(cityId)) { | |
261 | + String juzhudiCityName = getOracleBasicConfig(cityId); | |
262 | + String id2 = getMongoBasicConfig(juzhudiCityName, id1); | |
263 | + patients.setCityId(id2); //居住地市 | |
264 | + String areaId = getString(getString(map.get("P_ADDRESSCOUNTY"))); | |
265 | + if (areaId != null && !"".equals(areaId)) { | |
266 | + String juzhudiAreaName = getOracleBasicConfig(areaId); | |
267 | + String id3 = getMongoBasicConfig(juzhudiAreaName, id2); | |
268 | + patients.setAreaId(id3); //居住区 | |
263 | 269 | |
264 | - String cityId = getString(map.get("P_ADDRESSCITY")); | |
265 | - if (cityId != null && !"".equals(cityId)) | |
266 | - { | |
267 | - String juzhudiCityName = getOracleBasicConfig(cityId); | |
268 | - String id2 = getMongoBasicConfig(juzhudiCityName, id1); | |
269 | - patients.setCityId(id2); //居住地市 | |
270 | - String areaId = getString(getString(map.get("P_ADDRESSCOUNTY"))); | |
271 | - if (areaId != null && !"".equals(areaId)) | |
272 | - { | |
273 | - String juzhudiAreaName = getOracleBasicConfig(areaId); | |
274 | - String id3 = getMongoBasicConfig(juzhudiAreaName, id2); | |
275 | - patients.setAreaId(id3); //居住区 | |
276 | - | |
277 | - String streetId = getString(map.get("P_TOWNSHIP")); | |
278 | - if (streetId != null && !"".equals(streetId)) | |
279 | - { | |
280 | - String juzhudiStreetName = getOracleBasicConfig(streetId); | |
281 | - String id4 = getMongoBasicConfig(juzhudiStreetName, id3); | |
282 | - patients.setStreetId(id4); //街道 镇 | |
270 | + String streetId = getString(map.get("P_TOWNSHIP")); | |
271 | + if (streetId != null && !"".equals(streetId)) { | |
272 | + String juzhudiStreetName = getOracleBasicConfig(streetId); | |
273 | + String id4 = getMongoBasicConfig(juzhudiStreetName, id3); | |
274 | + patients.setStreetId(id4); //街道 镇 | |
275 | + } | |
283 | 276 | } |
284 | 277 | } |
285 | 278 | } |
286 | - } | |
287 | 279 | |
288 | - patients.setAddress(getString(map.get("P_ADDRESSSTREET"))); // 详细地址 | |
280 | + patients.setAddress(getString(map.get("P_ADDRESSSTREET"))); // 详细地址 | |
289 | 281 | |
290 | - //---------------------居住地址 | |
282 | + //---------------------居住地址 | |
291 | 283 | |
292 | - String pprofessionTypeId = getString(map.get("P_OCCUPATIONID")); | |
293 | - if (pprofessionTypeId != null && !"".equals(pprofessionTypeId)) | |
294 | - { | |
295 | - String pprofessionTypeName = getOracleBasicConfig(pprofessionTypeId); | |
296 | - String id = getMongoBasicConfig(pprofessionTypeName, SystemConfig.PROFESSION_TYPE_ID); | |
297 | - patients.setPprofessionTypeId(id); // 职业 | |
298 | - } | |
284 | + String pprofessionTypeId = getString(map.get("P_OCCUPATIONID")); | |
285 | + if (pprofessionTypeId != null && !"".equals(pprofessionTypeId)) { | |
286 | + String pprofessionTypeName = getOracleBasicConfig(pprofessionTypeId); | |
287 | + String id = getMongoBasicConfig(pprofessionTypeName, SystemConfig.PROFESSION_TYPE_ID); | |
288 | + patients.setPprofessionTypeId(id); // 职业 | |
289 | + } | |
299 | 290 | |
300 | - patients.setPhone(getString(map.get("P_MOBILEPHONE"))); //孕妇手机号码 | |
301 | - patients.setUsername(getString(map.get("P_NAME"))); //孕妇姓名 | |
302 | - patients.setBookbuildingDate(getDate(map.get("P_FILINGTIME"))); //建档日期 | |
303 | - patients.setLastMenses(getDate(map.get("P_LASTMENSTRUALPERIOD"))); //末次月经 | |
291 | + patients.setPhone(getString(map.get("P_MOBILEPHONE"))); //孕妇手机号码 | |
292 | + patients.setUsername(getString(map.get("P_NAME"))); //孕妇姓名 | |
293 | + patients.setBookbuildingDate(getDate(map.get("P_FILINGTIME"))); //建档日期 | |
294 | + patients.setLastMenses(getDate(map.get("P_LASTMENSTRUALPERIOD"))); //末次月经 | |
304 | 295 | |
305 | - String buildHospitalId = getString(map.get("P_HOSPITALID")); //医院ID | |
296 | + String buildHospitalId = getString(map.get("P_HOSPITALID")); //医院ID | |
306 | 297 | |
307 | 298 | |
308 | - Integer P_RESIDETYPE = getInteger(map.get("P_RESIDETYPE")); //居住类别 | |
309 | - if (P_RESIDETYPE != null && P_RESIDETYPE == 0) | |
310 | - { | |
311 | - patients.setPliveTypeId("57624bf90cf23d4631523e9e"); | |
312 | - } | |
313 | - else if (P_RESIDETYPE != null && (P_RESIDETYPE == 1 || P_RESIDETYPE == 2)) | |
314 | - { | |
315 | - patients.setPliveTypeId("57624c090cf23d4631523e9f"); | |
316 | - } | |
299 | + Integer P_RESIDETYPE = getInteger(map.get("P_RESIDETYPE")); //居住类别 | |
300 | + if (P_RESIDETYPE != null && P_RESIDETYPE == 0) { | |
301 | + patients.setPliveTypeId("57624bf90cf23d4631523e9e"); | |
302 | + } else if (P_RESIDETYPE != null && (P_RESIDETYPE == 1 || P_RESIDETYPE == 2)) { | |
303 | + patients.setPliveTypeId("57624c090cf23d4631523e9f"); | |
304 | + } | |
317 | 305 | |
318 | 306 | |
319 | - Integer P_ACCOUNTTYPE = getInteger(map.get("P_ACCOUNTTYPE")); //户口类别 | |
320 | - if (P_ACCOUNTTYPE != null && P_ACCOUNTTYPE == 0) | |
321 | - { | |
322 | - patients.setPliveTypeId("57624c440cf23d4631523ea1"); | |
323 | - } | |
324 | - else if (P_ACCOUNTTYPE != null && P_ACCOUNTTYPE == 1) | |
325 | - { | |
326 | - patients.setPliveTypeId("57624c5e0cf23d4631523ea2"); | |
327 | - } | |
307 | + Integer P_ACCOUNTTYPE = getInteger(map.get("P_ACCOUNTTYPE")); //户口类别 | |
308 | + if (P_ACCOUNTTYPE != null && P_ACCOUNTTYPE == 0) { | |
309 | + patients.setPliveTypeId("57624c440cf23d4631523ea1"); | |
310 | + } else if (P_ACCOUNTTYPE != null && P_ACCOUNTTYPE == 1) { | |
311 | + patients.setPliveTypeId("57624c5e0cf23d4631523ea2"); | |
312 | + } | |
328 | 313 | |
329 | - if (buildHospitalId != null && !"".equals(buildHospitalId)) | |
330 | - { | |
331 | - String hname = getString(getOralceSingleObjBySql("select h_name from plat_hospital h where h.h_isvalid=1 and h_id = '" + buildHospitalId + "'")); | |
332 | - String id = getString(getMysqlSingleObjBySql("select id from organization where name = '" + hname + "'")); | |
333 | - patients.setHospitalId(id); | |
334 | - } | |
314 | + if (buildHospitalId != null && !"".equals(buildHospitalId)) { | |
315 | + String hname = getString(getOralceSingleObjBySql("select h_name from plat_hospital h where h.h_isvalid=1 and h_id = '" + buildHospitalId + "'")); | |
316 | + String id = getString(getMysqlSingleObjBySql("select id from organization where name = '" + hname + "'")); | |
317 | + patients.setHospitalId(id); | |
318 | + } | |
335 | 319 | |
336 | - patients.setType(type); //患者类型 | |
320 | + patients.setType(type); //患者类型 | |
337 | 321 | |
338 | - String doctorId = getString(map.get("P_FILINGOPER")); | |
339 | - if (doctorId != null && !"".equals(doctorId)) | |
340 | - { | |
341 | - String hname = getString(getOralceSingleObjBySql("select e.e_name from mommy_employee e where e.e_id = '" + doctorId + "'")); | |
342 | - String id = getString(getMysqlSingleObjBySql("select id from users where name = '" + hname + "'")); | |
343 | - patients.setBookbuildingDoctor(id); //建档医生(创建者) | |
344 | - } | |
322 | + String doctorId = getString(map.get("P_FILINGOPER")); | |
323 | + if (doctorId != null && !"".equals(doctorId)) { | |
324 | + String hname = getString(getOralceSingleObjBySql("select e.e_name from mommy_employee e where e.e_id = '" + doctorId + "'")); | |
325 | + String id = getString(getMysqlSingleObjBySql("select id from users where name = '" + hname + "'")); | |
326 | + patients.setBookbuildingDoctor(id); //建档医生(创建者) | |
327 | + } | |
345 | 328 | |
346 | - Integer isvip = getInteger(map.get("P_ISVIP")); //vip | |
347 | - if (isvip != null) | |
348 | - { | |
349 | - //会员状态 0不是会员 1 是 | |
350 | - if (0 == isvip) | |
351 | - { | |
352 | - patients.setServiceType(ServiceTypeEnums.STANDARD_SERVICE.getId()); | |
353 | - patients.setServiceStatus(ServiceStatusEnums.STANDARD_OPEN.getId()); | |
329 | + Integer isvip = getInteger(map.get("P_ISVIP")); //vip | |
330 | + if (isvip != null) { | |
331 | + //会员状态 0不是会员 1 是 | |
332 | + if (0 == isvip) { | |
333 | + patients.setServiceType(ServiceTypeEnums.STANDARD_SERVICE.getId()); | |
334 | + patients.setServiceStatus(ServiceStatusEnums.STANDARD_OPEN.getId()); | |
335 | + } else if (1 == isvip) { | |
336 | + patients.setServiceType(ServiceTypeEnums.ADD_SERVICE.getId()); | |
337 | + patients.setServiceStatus(ServiceStatusEnums.ADD_OPEN.getId()); | |
338 | + } | |
354 | 339 | } |
355 | - else if (1 == isvip) | |
356 | - { | |
357 | - patients.setServiceType(ServiceTypeEnums.ADD_SERVICE.getId()); | |
358 | - patients.setServiceStatus(ServiceStatusEnums.ADD_OPEN.getId()); | |
359 | - } | |
360 | - } | |
361 | 340 | |
362 | 341 | |
363 | - String plevel = getString(map.get("P_EDUCATIONLEVEL"));//孕妇文化程度 | |
364 | - if (plevel != null && !"".equals(plevel)) | |
365 | - { | |
366 | - String plevelName = getOracleBasicConfig(plevel); | |
367 | - String id = getMongoBasicConfig(plevelName, SystemConfig.LEVEL_TYPE_ID); | |
368 | - patients.setPlevelTypeId(id); | |
369 | - } | |
342 | + String plevel = getString(map.get("P_EDUCATIONLEVEL"));//孕妇文化程度 | |
343 | + if (plevel != null && !"".equals(plevel)) { | |
344 | + String plevelName = getOracleBasicConfig(plevel); | |
345 | + String id = getMongoBasicConfig(plevelName, SystemConfig.LEVEL_TYPE_ID); | |
346 | + patients.setPlevelTypeId(id); | |
347 | + } | |
370 | 348 | |
371 | 349 | |
372 | - String guoJi = getString(map.get("P_COUNTRY"));//孕妇国籍 | |
373 | - if (guoJi != null && !"".equals(guoJi)) | |
374 | - { | |
375 | - String guoJiName = getOracleBasicConfig(guoJi); | |
376 | - String id = getMongoBasicConfig(guoJiName, SystemConfig.COUNTRY_TYPE_ID); | |
377 | - patients.setPcountryId(id); | |
378 | - } | |
350 | + String guoJi = getString(map.get("P_COUNTRY"));//孕妇国籍 | |
351 | + if (guoJi != null && !"".equals(guoJi)) { | |
352 | + String guoJiName = getOracleBasicConfig(guoJi); | |
353 | + String id = getMongoBasicConfig(guoJiName, SystemConfig.COUNTRY_TYPE_ID); | |
354 | + patients.setPcountryId(id); | |
355 | + } | |
379 | 356 | |
380 | - patients.setPworkUnit(getString(map.get("P_UNITWORK")));//孕妇工作单位 | |
357 | + patients.setPworkUnit(getString(map.get("P_UNITWORK")));//孕妇工作单位 | |
381 | 358 | |
382 | - String pnation = getString(map.get("P_NATION")); | |
383 | - if (pnation != null && !"".equals(pnation)) | |
384 | - { | |
385 | - String pnationName = getOracleBasicConfig(pnation); | |
386 | - String id = getMongoBasicConfig(pnationName, SystemConfig.NATION_TYPE_ID); | |
387 | - patients.setPnationId(id); | |
388 | - } | |
359 | + String pnation = getString(map.get("P_NATION")); | |
360 | + if (pnation != null && !"".equals(pnation)) { | |
361 | + String pnationName = getOracleBasicConfig(pnation); | |
362 | + String id = getMongoBasicConfig(pnationName, SystemConfig.NATION_TYPE_ID); | |
363 | + patients.setPnationId(id); | |
364 | + } | |
389 | 365 | |
390 | - //---------------------户口地址 | |
391 | - String huKouproviceId = getString(map.get("P_RRPROVINCE")); | |
392 | - if (huKouproviceId != null && !"".equals(huKouproviceId)) | |
393 | - { | |
394 | - String proviceName = getOracleBasicConfig(huKouproviceId); | |
395 | - String id1 = getMongoBasicConfig(proviceName, SystemConfig.LIVE_TYPE_ID); | |
396 | - patients.setProvinceRegisterId(id1); //户口地省 | |
366 | + //---------------------户口地址 | |
367 | + String huKouproviceId = getString(map.get("P_RRPROVINCE")); | |
368 | + if (huKouproviceId != null && !"".equals(huKouproviceId)) { | |
369 | + String proviceName = getOracleBasicConfig(huKouproviceId); | |
370 | + String id1 = getMongoBasicConfig(proviceName, SystemConfig.LIVE_TYPE_ID); | |
371 | + patients.setProvinceRegisterId(id1); //户口地省 | |
397 | 372 | |
398 | - String huKoucityId = getString(map.get("P_RRCITY")); | |
399 | - if (huKoucityId != null && !"".equals(huKoucityId)) | |
400 | - { | |
401 | - String cityName = getOracleBasicConfig(huKoucityId); | |
402 | - String id2 = getMongoBasicConfig(cityName, id1); | |
403 | - patients.setCityRegisterId(id2); //户口地市 | |
373 | + String huKoucityId = getString(map.get("P_RRCITY")); | |
374 | + if (huKoucityId != null && !"".equals(huKoucityId)) { | |
375 | + String cityName = getOracleBasicConfig(huKoucityId); | |
376 | + String id2 = getMongoBasicConfig(cityName, id1); | |
377 | + patients.setCityRegisterId(id2); //户口地市 | |
404 | 378 | |
405 | - String huKouareaId = getString(getString(map.get("P_RRCOUNTY"))); | |
406 | - if (huKouareaId != null && !"".equals(huKouareaId)) | |
407 | - { | |
408 | - String areaName = getOracleBasicConfig(huKouareaId); | |
409 | - String id3 = getMongoBasicConfig(areaName, id2); | |
410 | - patients.setAreaRegisterId(id3); //户口居住区 | |
379 | + String huKouareaId = getString(getString(map.get("P_RRCOUNTY"))); | |
380 | + if (huKouareaId != null && !"".equals(huKouareaId)) { | |
381 | + String areaName = getOracleBasicConfig(huKouareaId); | |
382 | + String id3 = getMongoBasicConfig(areaName, id2); | |
383 | + patients.setAreaRegisterId(id3); //户口居住区 | |
411 | 384 | |
412 | - String huKoustreetId = getString(map.get("P_RRTOWNSHIP")); | |
413 | - if (huKoustreetId != null && !"".equals(huKoustreetId)) | |
414 | - { | |
415 | - String streetName = getOracleBasicConfig(huKoustreetId); | |
416 | - String id4 = getMongoBasicConfig(streetName, id3); | |
417 | - patients.setStreetRegisterId(id4); //户口街道 镇 | |
385 | + String huKoustreetId = getString(map.get("P_RRTOWNSHIP")); | |
386 | + if (huKoustreetId != null && !"".equals(huKoustreetId)) { | |
387 | + String streetName = getOracleBasicConfig(huKoustreetId); | |
388 | + String id4 = getMongoBasicConfig(streetName, id3); | |
389 | + patients.setStreetRegisterId(id4); //户口街道 镇 | |
418 | 390 | |
391 | + } | |
419 | 392 | } |
420 | - } | |
421 | 393 | |
394 | + } | |
422 | 395 | } |
423 | - } | |
424 | - patients.setAddressRegister(getString(map.get("P_RRSTREET"))); // 详细地址 | |
396 | + patients.setAddressRegister(getString(map.get("P_RRSTREET"))); // 详细地址 | |
425 | 397 | |
426 | - //---------------------户口地址 | |
398 | + //---------------------户口地址 | |
427 | 399 | |
428 | - //----------------------产后修养地 | |
400 | + //----------------------产后修养地 | |
429 | 401 | |
430 | - String chanHouproviceId = getString(map.get("P_POSTPARTUMPROVINCE")); | |
431 | - if (chanHouproviceId != null && !"".equals(chanHouproviceId)) | |
432 | - { | |
433 | - String proviceName = getOracleBasicConfig(chanHouproviceId); | |
434 | - String id1 = getMongoBasicConfig(proviceName, SystemConfig.LIVE_TYPE_ID); | |
435 | - patients.setProvincePostRestId(id1); | |
402 | + String chanHouproviceId = getString(map.get("P_POSTPARTUMPROVINCE")); | |
403 | + if (chanHouproviceId != null && !"".equals(chanHouproviceId)) { | |
404 | + String proviceName = getOracleBasicConfig(chanHouproviceId); | |
405 | + String id1 = getMongoBasicConfig(proviceName, SystemConfig.LIVE_TYPE_ID); | |
406 | + patients.setProvincePostRestId(id1); | |
436 | 407 | |
437 | - String chanhoucityId = getString(map.get("P_POSTPARTUMCITY")); | |
438 | - if (chanhoucityId != null && !"".equals(chanhoucityId)) | |
439 | - { | |
440 | - String cityName = getOracleBasicConfig(chanhoucityId); | |
441 | - String id2 = getMongoBasicConfig(cityName, id1); | |
442 | - patients.setCityPostRestId(id2); | |
408 | + String chanhoucityId = getString(map.get("P_POSTPARTUMCITY")); | |
409 | + if (chanhoucityId != null && !"".equals(chanhoucityId)) { | |
410 | + String cityName = getOracleBasicConfig(chanhoucityId); | |
411 | + String id2 = getMongoBasicConfig(cityName, id1); | |
412 | + patients.setCityPostRestId(id2); | |
443 | 413 | |
444 | - String chanhouareaId = getString(getString(map.get("P_POSTPARTUMCOUNTY"))); | |
445 | - if (chanhouareaId != null && !"".equals(chanhouareaId)) | |
446 | - { | |
447 | - String areaName = getOracleBasicConfig(chanhouareaId); | |
448 | - String id3 = getMongoBasicConfig(areaName, id2); | |
449 | - patients.setAreaPostRestId(id3); | |
414 | + String chanhouareaId = getString(getString(map.get("P_POSTPARTUMCOUNTY"))); | |
415 | + if (chanhouareaId != null && !"".equals(chanhouareaId)) { | |
416 | + String areaName = getOracleBasicConfig(chanhouareaId); | |
417 | + String id3 = getMongoBasicConfig(areaName, id2); | |
418 | + patients.setAreaPostRestId(id3); | |
450 | 419 | |
451 | - String chanhoustreetId = getString(map.get("P_POSTPARTUMTOWNSHIP")); | |
452 | - if (chanhoustreetId != null && !"".equals(chanhoustreetId)) | |
453 | - { | |
454 | - String streetName = getOracleBasicConfig(chanhoustreetId); | |
455 | - String id4 = getMongoBasicConfig(streetName, id3); | |
456 | - patients.setStreetPostRestId(id4); | |
420 | + String chanhoustreetId = getString(map.get("P_POSTPARTUMTOWNSHIP")); | |
421 | + if (chanhoustreetId != null && !"".equals(chanhoustreetId)) { | |
422 | + String streetName = getOracleBasicConfig(chanhoustreetId); | |
423 | + String id4 = getMongoBasicConfig(streetName, id3); | |
424 | + patients.setStreetPostRestId(id4); | |
425 | + } | |
457 | 426 | } |
458 | 427 | } |
459 | 428 | } |
460 | - } | |
461 | 429 | |
462 | - patients.setAddressPostRest(getString(map.get("P_POSTPARTUMSTREET"))); // 详细地址 | |
430 | + patients.setAddressPostRest(getString(map.get("P_POSTPARTUMSTREET"))); // 详细地址 | |
463 | 431 | |
464 | - //----------------------产后修养地 | |
432 | + //----------------------产后修养地 | |
465 | 433 | |
466 | - patients.setHusbandName(getString(map.get("P_HUSBANDNAME"))); //丈夫名称 | |
467 | - patients.setHusbandBirth(getDate(map.get("P_HUSBANDBIRTHDAY"))); //丈夫生日 | |
468 | - patients.setHusbandPhone(getString(map.get("P_HUSBANDMOBILEPHONE"))); //丈夫电话 | |
469 | - patients.setHworkUnit(getString(map.get("P_HUSBANDUNITWORK"))); //丈夫工作单位 | |
434 | + patients.setHusbandName(getString(map.get("P_HUSBANDNAME"))); //丈夫名称 | |
435 | + patients.setHusbandBirth(getDate(map.get("P_HUSBANDBIRTHDAY"))); //丈夫生日 | |
436 | + patients.setHusbandPhone(getString(map.get("P_HUSBANDMOBILEPHONE"))); //丈夫电话 | |
437 | + patients.setHworkUnit(getString(map.get("P_HUSBANDUNITWORK"))); //丈夫工作单位 | |
470 | 438 | |
471 | - String hprofessionTypeId = getString(map.get("P_HUSBANDOCCUPATIONID"));// 职业 | |
472 | - if (hprofessionTypeId != null && !"".equals(hprofessionTypeId)) | |
473 | - { | |
474 | - String professionTypeName = getOracleBasicConfig(hprofessionTypeId); | |
475 | - String id = getMongoBasicConfig(professionTypeName, SystemConfig.PROFESSION_TYPE_ID); | |
476 | - patients.setHprofessionTypeId(id); | |
477 | - } | |
439 | + String hprofessionTypeId = getString(map.get("P_HUSBANDOCCUPATIONID"));// 职业 | |
440 | + if (hprofessionTypeId != null && !"".equals(hprofessionTypeId)) { | |
441 | + String professionTypeName = getOracleBasicConfig(hprofessionTypeId); | |
442 | + String id = getMongoBasicConfig(professionTypeName, SystemConfig.PROFESSION_TYPE_ID); | |
443 | + patients.setHprofessionTypeId(id); | |
444 | + } | |
478 | 445 | |
479 | - String P_HUSBANDCARDTYPE = getString(map.get("P_HUSBANDCARDTYPE")); //丈夫证件类型 | |
480 | - String hcardTypeName = getString(getOralceSingleObjBySql("select dc_name from plat_datacontent where dc_id='" + P_HUSBANDCARDTYPE + "'")); | |
481 | - if (hcardTypeName != null && !"".equals(hcardTypeName)) | |
482 | - { | |
483 | - String id = getMongoBasicConfig(hcardTypeName, SystemConfig.CERTE_TYPE_ID); | |
484 | - patients.setHcertificateTypeId(id); | |
485 | - } | |
486 | - patients.setHcertificateNum(getString(map.get("P_HUSBANDCARDNO"))); //证件号码 | |
446 | + String P_HUSBANDCARDTYPE = getString(map.get("P_HUSBANDCARDTYPE")); //丈夫证件类型 | |
447 | + String hcardTypeName = getString(getOralceSingleObjBySql("select dc_name from plat_datacontent where dc_id='" + P_HUSBANDCARDTYPE + "'")); | |
448 | + if (hcardTypeName != null && !"".equals(hcardTypeName)) { | |
449 | + String id = getMongoBasicConfig(hcardTypeName, SystemConfig.CERTE_TYPE_ID); | |
450 | + patients.setHcertificateTypeId(id); | |
451 | + } | |
452 | + patients.setHcertificateNum(getString(map.get("P_HUSBANDCARDNO"))); //证件号码 | |
487 | 453 | |
488 | 454 | |
489 | - String hlevel = getString(map.get("P_HUSBANDEDUCATIONLEVEL"));//丈夫文化程度 | |
490 | - if (hlevel != null && !"".equals(hlevel)) | |
491 | - { | |
492 | - String plevelName = getOracleBasicConfig(hlevel); | |
493 | - String id = getMongoBasicConfig(plevelName, SystemConfig.LEVEL_TYPE_ID); | |
494 | - patients.setHlevelTypeId(id); | |
495 | - } | |
455 | + String hlevel = getString(map.get("P_HUSBANDEDUCATIONLEVEL"));//丈夫文化程度 | |
456 | + if (hlevel != null && !"".equals(hlevel)) { | |
457 | + String plevelName = getOracleBasicConfig(hlevel); | |
458 | + String id = getMongoBasicConfig(plevelName, SystemConfig.LEVEL_TYPE_ID); | |
459 | + patients.setHlevelTypeId(id); | |
460 | + } | |
496 | 461 | |
497 | 462 | |
498 | - String hguoji = getString(map.get("P_HUSBANDCOUNTRY"));//丈夫国籍 | |
499 | - if (hguoji != null && !"".equals(hguoji)) | |
500 | - { | |
501 | - String guoJiName = getOracleBasicConfig(hguoji); | |
502 | - String id = getMongoBasicConfig(guoJiName, SystemConfig.COUNTRY_TYPE_ID); | |
503 | - patients.setHcountryId(id); | |
504 | - } | |
463 | + String hguoji = getString(map.get("P_HUSBANDCOUNTRY"));//丈夫国籍 | |
464 | + if (hguoji != null && !"".equals(hguoji)) { | |
465 | + String guoJiName = getOracleBasicConfig(hguoji); | |
466 | + String id = getMongoBasicConfig(guoJiName, SystemConfig.COUNTRY_TYPE_ID); | |
467 | + patients.setHcountryId(id); | |
468 | + } | |
505 | 469 | |
506 | - String P_HUSBANDNATION = getString(map.get("P_HUSBANDNATION")); //丈夫民族 | |
507 | - if (P_HUSBANDNATION != null && !"".equals(P_HUSBANDNATION)) | |
508 | - { | |
509 | - String pnationName = getOracleBasicConfig(P_HUSBANDNATION); | |
510 | - String id = getMongoBasicConfig(pnationName, SystemConfig.NATION_TYPE_ID); | |
511 | - patients.setHnationId(id); | |
512 | - } | |
470 | + String P_HUSBANDNATION = getString(map.get("P_HUSBANDNATION")); //丈夫民族 | |
471 | + if (P_HUSBANDNATION != null && !"".equals(P_HUSBANDNATION)) { | |
472 | + String pnationName = getOracleBasicConfig(P_HUSBANDNATION); | |
473 | + String id = getMongoBasicConfig(pnationName, SystemConfig.NATION_TYPE_ID); | |
474 | + patients.setHnationId(id); | |
475 | + } | |
513 | 476 | |
514 | - //------丈夫户口所在地 | |
477 | + //------丈夫户口所在地 | |
515 | 478 | |
516 | - String hproviceId = getString(map.get("P_HUSBANDRRPROVINCE")); | |
517 | - if (hproviceId != null && !"".equals(hproviceId)) | |
518 | - { | |
519 | - String name = getOracleBasicConfig(hproviceId); | |
520 | - String id1 = getMongoBasicConfig(name, SystemConfig.LIVE_TYPE_ID); | |
521 | - patients.setProvincePostRestId(id1); | |
479 | + String hproviceId = getString(map.get("P_HUSBANDRRPROVINCE")); | |
480 | + if (hproviceId != null && !"".equals(hproviceId)) { | |
481 | + String name = getOracleBasicConfig(hproviceId); | |
482 | + String id1 = getMongoBasicConfig(name, SystemConfig.LIVE_TYPE_ID); | |
483 | + patients.setProvincePostRestId(id1); | |
522 | 484 | |
523 | - String hcityId = getString(map.get("P_HUSBANDRRCITY")); | |
524 | - if (hcityId != null && !"".equals(hcityId)) | |
525 | - { | |
526 | - String nameCity = getOracleBasicConfig(hcityId); | |
527 | - String id2 = getMongoBasicConfig(nameCity, id1); | |
528 | - patients.setCityPostRestId(id2); | |
485 | + String hcityId = getString(map.get("P_HUSBANDRRCITY")); | |
486 | + if (hcityId != null && !"".equals(hcityId)) { | |
487 | + String nameCity = getOracleBasicConfig(hcityId); | |
488 | + String id2 = getMongoBasicConfig(nameCity, id1); | |
489 | + patients.setCityPostRestId(id2); | |
529 | 490 | |
530 | - String hareId = getString(getString(map.get("P_HUSBANDRRCOUNTY"))); | |
531 | - if (hareId != null && !"".equals(hareId)) | |
532 | - { | |
533 | - String nameArea = getOracleBasicConfig(hareId); | |
534 | - String id3 = getMongoBasicConfig(nameArea, id2); | |
535 | - patients.setAreaPostRestId(id3); | |
491 | + String hareId = getString(getString(map.get("P_HUSBANDRRCOUNTY"))); | |
492 | + if (hareId != null && !"".equals(hareId)) { | |
493 | + String nameArea = getOracleBasicConfig(hareId); | |
494 | + String id3 = getMongoBasicConfig(nameArea, id2); | |
495 | + patients.setAreaPostRestId(id3); | |
536 | 496 | |
537 | - String hstreetId = getString(map.get("P_HUSBANDRRTOWNSHIP")); | |
538 | - if (hstreetId != null && !"".equals(hstreetId)) | |
539 | - { | |
540 | - String nameStreet = getOracleBasicConfig(hstreetId); | |
541 | - String id4 = getMongoBasicConfig(nameStreet, id3); | |
542 | - patients.setStreetPostRestId(id4); | |
497 | + String hstreetId = getString(map.get("P_HUSBANDRRTOWNSHIP")); | |
498 | + if (hstreetId != null && !"".equals(hstreetId)) { | |
499 | + String nameStreet = getOracleBasicConfig(hstreetId); | |
500 | + String id4 = getMongoBasicConfig(nameStreet, id3); | |
501 | + patients.setStreetPostRestId(id4); | |
502 | + } | |
543 | 503 | } |
544 | 504 | } |
545 | 505 | } |
546 | - } | |
547 | 506 | |
548 | - patients.setAddressPostRest(getString(map.get("P_HUSBANDRRSTREET"))); // 详细地址 | |
549 | - patients.setHworkUnit(getString(map.get("P_FILENUMBER"))); //建档编号 | |
550 | - patients.setFileCode(getString(map.get("P_CLINICNO"))); //就诊卡号 | |
507 | + patients.setAddressPostRest(getString(map.get("P_HUSBANDRRSTREET"))); // 详细地址 | |
508 | + patients.setHworkUnit(getString(map.get("P_FILENUMBER"))); //建档编号 | |
509 | + patients.setFileCode(getString(map.get("P_CLINICNO"))); //就诊卡号 | |
551 | 510 | |
552 | - mongoTemplate.save(patients); | |
553 | - syncChuZhen(person.getId(),patients.getId(),mongoTemplate); | |
554 | - syncFuzhen(person.getId(),patients.getId(),mongoTemplate); | |
511 | + mongoTemplate.save(patients); | |
512 | + syncChuZhen(person.getId(), patients.getId(), mongoTemplate); | |
513 | + syncFuzhen(person.getId(), patients.getId(), mongoTemplate); | |
514 | + } | |
555 | 515 | } |
556 | 516 | } |
557 | 517 | |
558 | 518 | private static void syncChuZhen(String pid,String parentId, MongoTemplate mongoTemplate) |
559 | 519 | { |
560 | - List<Map<String,Object>> list = getListDataBySql(" SELECT * FROM MOMMY_FIRSTEXAMINE f where replace(f.FE_TRIAGEORDERNO,'-','') = '" + parentId + "'"); | |
520 | +// List<Map<String,Object>> list = getListDataBySql(" SELECT * FROM MOMMY_FIRSTEXAMINE f where replace(f.FE_TRIAGEORDERNO,'-','') = '" + parentId + "'"); | |
521 | + List<Map<String,Object>> list = getListDataBySql(" SELECT F.*,\n" + | |
522 | + " '[\"'||REPLACE(TT.HIGH_RISK_ID,',','\",\"')||'\"]' AS RISKFACTOR,\n" + | |
523 | + " TT.HIGH_RISK_VALUE AS RISKSCORE\n" + | |
524 | + "FROM MOMMY_FIRSTEXAMINE f \n" + | |
525 | + "--高危数据\n" + | |
526 | + "LEFT JOIN \n" + | |
527 | + " (\n" + | |
528 | + " SELECT T.ME_EXAMINID,WMSYS.WM_CONCAT(T.HIGH_RISK_FACTOR) AS HIGH_RISK_FACTOR,WMSYS.WM_CONCAT(DISTINCT T.HIGH_RISK_GRADE) AS HIGH_RISK_GRADE,SUM(T.HIGH_RISK_VALUE) AS HIGH_RISK_VALUE,WMSYS.WM_CONCAT(T.HIGH_RISK_ID) AS HIGH_RISK_ID\n" + | |
529 | + " FROM \n" + | |
530 | + " (SELECT J.ME_EXAMINID,K.DC_NAME AS HIGH_RISK_FACTOR,L.DC_NAME AS HIGH_RISK_GRADE,TO_NUMBER(K.DC_NO) AS HIGH_RISK_VALUE,LL.ID AS HIGH_RISK_ID\n" + | |
531 | + " FROM \n" + | |
532 | + " --高危风险关系表\n" + | |
533 | + " MOMMY_EXAMINWARNING J\n" + | |
534 | + " --高危内容\n" + | |
535 | + " INNER JOIN PLAT_DATACONTENT K ON J.ME_WORNINGID = K.DC_ID AND K.DC_ISVALID=1 AND K.DC_DATATYPEID='fb43fd5a-b153-4cb9-9180-c46f5612ba43' AND K.DC_NAME<>'其他'\n" + | |
536 | + " --高危等级\n" + | |
537 | + " INNER JOIN PLAT_DATACONTENT L ON K.DC_PARENTID=L.DC_ID AND L.DC_ISVALID=1\n" + | |
538 | + " INNER JOIN LYMS_BASICCONFIG LL ON K.DC_NAME=LL.NAME\n" + | |
539 | + " -- UNION ALL \n" + | |
540 | + " --其他高危评分\n" + | |
541 | + " --SELECT M.ID,M.MO_CONTENT,M.MO_COLORNAME,M.MO_VALUES FROM MOMMY_OTHERWORNING M\n" + | |
542 | + " )T\n" + | |
543 | + " GROUP BY T.ME_EXAMINID \n" + | |
544 | + " )TT ON F.FE_ID=TT.ME_EXAMINID\n" + | |
545 | + "where replace(f.FE_TRIAGEORDERNO,'-','') = '" + parentId + "'\n"); | |
561 | 546 | for(Map<String,Object> map : list) |
562 | 547 | { |
563 | 548 | AntExChuModel chuModel = new AntExChuModel(); |
564 | 549 | |
... | ... | @@ -592,8 +577,8 @@ |
592 | 577 | chuModel.setCestationInfo(getString(map.get(""))); |
593 | 578 | chuModel.setGonggao(getString(map.get("FE_UTERUSHEIGHT"))); |
594 | 579 | chuModel.setFuwei(getString(map.get("FE_ABGIRTH"))); |
580 | + chuModel.setYn(YnEnums.YES.getId()); | |
595 | 581 | |
596 | - | |
597 | 582 | String doctorId = getString(map.get("FE_DOCTOR")); |
598 | 583 | if (doctorId != null && !"".equals(doctorId)) |
599 | 584 | { |
... | ... | @@ -643,6 +628,38 @@ |
643 | 628 | chuModel.setBp(JsonUtil.obj2Str(bpmap)); |
644 | 629 | } |
645 | 630 | |
631 | + | |
632 | + if (StringUtils.isNotEmpty(getString(map.get("RISKFACTOR")))) | |
633 | + { | |
634 | + chuModel.setHighrisk(getString(map.get("RISKFACTOR"))); | |
635 | + } | |
636 | + else | |
637 | + { | |
638 | + chuModel.setHighrisk("[]"); | |
639 | + } | |
640 | + | |
641 | + Patients pat = new Patients(); | |
642 | + | |
643 | + if (StringUtils.isNotEmpty(getString(map.get("RISKFACTOR")))) | |
644 | + { | |
645 | + List<String> rlist = JsonUtil.toList(getString(map.get("RISKFACTOR")), String.class); | |
646 | + pat.setRiskFactorId(rlist); | |
647 | + List<String> llist = queryRisk(rlist,true,mongoTemplate); | |
648 | + pat.setRiskLevelId(JsonUtil.array2JsonString(llist)); | |
649 | + pat.setLastRhTime(getDate(map.get("FE_ROCTORTIME"))); | |
650 | + } | |
651 | + else | |
652 | + { | |
653 | + pat.setRiskFactorId(new ArrayList<String>()); | |
654 | + } | |
655 | + | |
656 | + pat.setRiskScore(getInteger(map.get("RISKSCORE"))); | |
657 | + | |
658 | + Query query = new MongoQuery(new MongoCondition("id", parentId, MongoOper.IS)).convertToMongoQuery(); | |
659 | + Update update = MongoConvertHelper | |
660 | + .convertToNativeUpdate(ReflectionUtils.getUpdateField(pat)); | |
661 | + mongoTemplate.updateMulti(query, update, pat.getClass()); | |
662 | + | |
646 | 663 | mongoTemplate.save(chuModel); |
647 | 664 | } |
648 | 665 | } |
... | ... | @@ -756,7 +773,7 @@ |
756 | 773 | " --SELECT M.ID,M.MO_CONTENT,M.MO_COLORNAME,M.MO_VALUES FROM MOMMY_OTHERWORNING M\n" + |
757 | 774 | " )T\n" + |
758 | 775 | " GROUP BY T.ME_EXAMINID \n" + |
759 | - " )TT ON A.ER_ID=TT.ME_EXAMINID where replace(p_no,'-','') = '" + parentId + "') A WHERE ROWNUM <= 10 ) WHERE RN >= 0 "; | |
776 | + " )TT ON A.ER_ID=TT.ME_EXAMINID where replace(p_no,'-','') = '" + parentId + "' ORDER BY B.P_NO,A.ER_CHECKDATE ASC ) A WHERE ROWNUM <= 10 ) WHERE RN >= 0 "; | |
760 | 777 | |
761 | 778 | |
762 | 779 | List<Map<String, Object>> list = getListDataBySql(sql); |
763 | 780 | |
764 | 781 | |
765 | 782 | |
766 | 783 | |
... | ... | @@ -824,14 +841,75 @@ |
824 | 841 | |
825 | 842 | antxModel.setChiefComplaint(getString(map.get("CHIEFCOMPLAINT"))); |
826 | 843 | antxModel.setcDueWeek(getString(map.get("CDUEWEEK"))); |
844 | + | |
845 | + | |
846 | + Patients pat = new Patients(); | |
847 | + | |
848 | + | |
849 | + if (StringUtils.isNotEmpty(getString(map.get("RISKFACTOR")))) | |
850 | + { | |
851 | + List<String> rlist = JsonUtil.toList(getString(map.get("RISKFACTOR")), String.class); | |
852 | + pat.setRiskFactorId(rlist); | |
853 | + List<String> llist = queryRisk(rlist,true,mongoTemplate); | |
854 | + pat.setRiskLevelId(JsonUtil.array2JsonString(llist)); | |
855 | + pat.setLastRhTime(getDate(map.get("CHECKDATE"))); | |
856 | + } | |
857 | + else | |
858 | + { | |
859 | + pat.setRiskFactorId(new ArrayList<String>()); | |
860 | + } | |
861 | + pat.setRiskScore(getInteger(map.get("RISKSCORE"))); | |
862 | + | |
863 | + Query query = new MongoQuery(new MongoCondition("id", parentId, MongoOper.IS)).convertToMongoQuery(); | |
864 | + Update update = MongoConvertHelper | |
865 | + .convertToNativeUpdate(ReflectionUtils.getUpdateField(pat)); | |
866 | + mongoTemplate.updateMulti(query, update, pat.getClass()); | |
867 | + | |
827 | 868 | mongoTemplate.save(antxModel); |
828 | 869 | } |
829 | 870 | } |
830 | 871 | |
872 | + | |
873 | + public static List<String> queryRisk(List<String> id, boolean n,MongoTemplate mongoTemplate) { | |
874 | + BasicConfigQuery | |
875 | + basicConfigQuery = new BasicConfigQuery(); | |
876 | + List<String> dat1a = new ArrayList(); | |
877 | + if (CollectionUtils.isNotEmpty(id)) { | |
878 | + for (String i : id) { | |
879 | + basicConfigQuery.setId(i); | |
880 | + List<BasicConfig> basicConfigs = mongoTemplate.find(basicConfigQuery.convertToQuery().convertToMongoQuery(), BasicConfig.class); | |
881 | + if (CollectionUtils.isNotEmpty(basicConfigs)) { | |
882 | + for (BasicConfig basicConfig : basicConfigs) { | |
883 | + BasicConfigQuery | |
884 | + bquery = new BasicConfigQuery(); | |
885 | + bquery.setId(basicConfig.getParentId()); | |
886 | + List<BasicConfig> basicConfig1s = | |
887 | + mongoTemplate.find(bquery.convertToQuery().convertToMongoQuery(), BasicConfig.class); | |
888 | + BasicConfig basicConfig1 = basicConfig1s.get(0); | |
889 | + if (null != basicConfig1) { | |
890 | + dat1a.add(basicConfig1.getId()); | |
891 | + } | |
892 | + } | |
893 | + } | |
894 | + } | |
895 | + } | |
896 | + return dat1a; | |
897 | + } | |
898 | + | |
831 | 899 | public static void syncBabyData(String hospitalId) { |
832 | - List<Map<String, Object>> list = getListDataBySql(" SELECT * FROM ( SELECT A.*, ROWNUM RN FROM (select replace(m.PI_ID,'-','') as ID,m.* from MOMMY_PATIENTINFO m where m.pi_bookbuildinghospitalid='"+hospitalId+"') A WHERE ROWNUM <= 20 ) WHERE RN >= 0 "); | |
833 | 900 | |
901 | + int num = 1; | |
834 | 902 | |
903 | + while (true) | |
904 | + { | |
905 | + | |
906 | + | |
907 | + | |
908 | + List<Map<String, Object>> list = getListDataBySql(" SELECT * FROM ( SELECT A.*, ROWNUM RN FROM " + | |
909 | + " (select replace(m.PI_ID,'-','') as ID,m.* from MOMMY_PATIENTINFO m where m.pi_bookbuildinghospitalid='"+hospitalId+"') " + | |
910 | + " A WHERE ROWNUM < "+(num+20)+" ) WHERE RN >= "+num+" "); | |
911 | + | |
912 | + num = num+20; | |
835 | 913 | MongoTemplate mongoTemplate = getMongoTemplate(); |
836 | 914 | |
837 | 915 | for (Map<String, Object> map : list) { |
... | ... | @@ -1019,6 +1097,7 @@ |
1019 | 1097 | mongoTemplate.save(model); |
1020 | 1098 | syncBabyCheck(model.getId(),mongoTemplate); |
1021 | 1099 | } |
1100 | + } | |
1022 | 1101 | } |
1023 | 1102 | |
1024 | 1103 | public static void syncBabyCheck(String parentId,MongoTemplate mongoTemplate) |
... | ... | @@ -1319,6 +1398,12 @@ |
1319 | 1398 | } |
1320 | 1399 | } |
1321 | 1400 | |
1401 | + public static void syncData(String hid) | |
1402 | + { | |
1403 | + syncBabyData(hid); | |
1404 | + syncPatientData(hid); | |
1405 | + } | |
1406 | + | |
1322 | 1407 | public static void main(String[] args) |
1323 | 1408 | { |
1324 | 1409 | // MongoTemplate template = getMongoTemplate(); |
... | ... | @@ -1330,7 +1415,7 @@ |
1330 | 1415 | // System.out.print(list); |
1331 | 1416 | // DBCollection conn = template.getCollection("lyms_patient_test"); |
1332 | 1417 | // conn.up |
1333 | - | |
1418 | + syncBabyData("62"); | |
1334 | 1419 | syncPatientData("62"); |
1335 | 1420 | } |
1336 | 1421 | } |
platform-biz-patient-service/src/main/resources/database.properties
View file @
78cf6e3
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/TestController.java
View file @
78cf6e3
1 | 1 | package com.lyms.platform.operate.web.controller; |
2 | 2 | |
3 | +import com.lyms.platform.operate.web.utils.JdbcUtil; | |
3 | 4 | import org.springframework.stereotype.Controller; |
4 | 5 | import org.springframework.web.bind.annotation.RequestMapping; |
5 | 6 | import org.springframework.web.bind.annotation.RequestMethod; |
7 | +import org.springframework.web.bind.annotation.RequestParam; | |
6 | 8 | import org.springframework.web.bind.annotation.ResponseBody; |
7 | 9 | |
8 | 10 | import java.util.ArrayList; |
... | ... | @@ -85,6 +87,14 @@ |
85 | 87 | list.add(m); |
86 | 88 | |
87 | 89 | return list; |
90 | + } | |
91 | + | |
92 | + | |
93 | + @RequestMapping(value = "/syncData", method = RequestMethod.GET) | |
94 | + public void syncData( @RequestParam(required = true) String hid) { | |
95 | + System.out.print("同步开始>>>>>>>>>>>>>>>>>>>>>>>>>"); | |
96 | + com.lyms.platform.biz.JdbcUtil.syncData(hid); | |
97 | + System.out.print("同步结束>>>>>>>>>>>>>>>>>>>>>>>>>"); | |
88 | 98 | } |
89 | 99 | } |