Commit afad2aa8950b290ebbcdada25194cda5808ab3aa

Authored by gengxiaokai
1 parent 09372a9069

德州分娩接口

Showing 2 changed files with 297 additions and 341 deletions

platform-operate-api/src/main/java/com/lyms/hospitalapi/dzfy/DzfyFmService.java View file @ afad2aa
... ... @@ -58,6 +58,9 @@
58 58 @Autowired
59 59 private QhdfyHisService qhdfyHisService;
60 60  
  61 + @Autowired
  62 + private DzfyHisService dzfyHisService;
  63 +
61 64 private static Map<Integer, String> ONE_ENUMS = new HashMap<>();
62 65  
63 66 private static Map<String, List> babyMap = new HashMap<>();
64 67  
65 68  
66 69  
67 70  
68 71  
69 72  
70 73  
71 74  
72 75  
73 76  
74 77  
75 78  
76 79  
... ... @@ -177,63 +180,54 @@
177 180 }
178 181  
179 182 public void queryFmPatient(String start,String end,String syxh) {
180   - List<String> IDlist=new ArrayList<String>();
  183 +
181 184 String cloumns = " ID as ID,\n" +
182 185 " BHNUM as BHNUM,\n" +
183 186 " VCCARDNO as VCCARDNO,\n" +
184 187 " PHONE as PHONE,\n" +
185   - " NAME as NAME,\n" +
  188 + " NAME as NAME,\n" +
186 189 " IDCARD as IDCARD,\n" +
187   - // " YEXH as yexh,\n" +
188 190 " CREATED as CREATED,\t\n" +
189 191 " BABY_DELIVERY_TIME as BABY_DELIVERY_TIME,\n" +
190   - // " SSJ as ssj,\n" +
191 192 " BABY_SEX as BABY_SEX,\n" +
192 193 " DUE_WEEK as DUE_WEEK,\n" +
193 194 " DUE_DAY as DUE_DAY,\n" +
194 195 " FETUS_NUM as FETUS_NUM,\n" +
195   - // " CJC as cjc,\n" +
196 196 " BABY_ASPHYXIAM as BABY_ASPHYXIAM,\n" +
197 197 " BABY_WEIGHT as BABY_WEIGHT,\n" +
198 198 " BABY_HEIGHT as BABY_HEIGHT,\n" +
199   - // " SH as sh,\n" +
200 199 " BABY_DEFORMITY as BABY_DEFORMITY,\n" +
201 200 " BABY_APGAR_SCORE_ONE as BABY_APGAR_SCORE_ONE,\n" +
202 201 " BABY_APGAR_SCORE_FIVE as BABY_APGAR_SCORE_FIVE,\n" +
203 202 " BABY_APGAR_SCORE_TEN as BABY_APGAR_SCORE_TEN,\n" +
204   - // " PFZ as pfz,\n" +
205 203 " BABY_PREGNANCY_OUT as BABY_PREGNANCY_OUT,\n" +
206 204 " TMCSIDE as TMCSIDE,\n" +
207 205 " TMCTYPE as TMCTYPE,\n" +
208   - // " YEQK as yeqk,\n" +
209 206 " MATERNAL_INFO as MATERNAL_INFO,\n" +
210   - // " SFFQ as sffq,\n" +
211   - // " FQYY as fqyy,\n" +
212 207 " PERINEAL_CONDITION as PERINEAL_CONDITION,\n" +
213   - // " HYQK1 as hyqk1,\n" +
214   - // " YC as yc,\n" +
215   - // " SFGW as sfgw,\n" +
216 208 " SH_LOSE_BLOOD as SH_LOSE_BLOOD,\n" +
217 209 " TH_LOSE_BLOOD as TH_LOSE_BLOOD,\n" +
218   - // " QJQK as qjqk,\n" +
219   - // " SRKS as srks,\n" +
220   - " DELIVER_DOCTOR as DELIVER_DOCTOR";
  210 + " DELIVER_DOCTOR as DELIVER_DOCTOR,\n" +
  211 + " PROD_PROCESS_ONE as PROD_PROCESS_ONE,\n" +
  212 + " PROD_PROCESS_TWO as PROD_PROCESS_TWO,\n" +
  213 + " PROD_PROCESS_THREE as PROD_PROCESS_THREE,\n" +
  214 + " TOTAL_PROCESS as TOTAL_PROCESS,\n" +
  215 + " PLACENTA_NUM as PLACENTA_NUM,\n" +
  216 + " DELIVER_HOSPITAL as DELIVER_HOSPITAL,\n" +
  217 + " DELIVER_DOCTOR as DELIVER_DOCTOR";
221 218  
  219 +
  220 + String idSql = " ID as ID";
  221 +
222 222 Connection conn = com.lyms.hospitalapi.dzfy.ConnTools.makeHisConnection();
223 223 QueryRunner queryRunner = new QueryRunner();
224 224 SimpleDateFormat fmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
225 225 SimpleDateFormat fmt2 = new SimpleDateFormat("yyyyMMdd");
226 226 SimpleDateFormat fmt1 = new SimpleDateFormat("yyyy-MM-dd HH:mm");
227 227 try {
228   - String sql ="select "+cloumns+" from zlhis.v_deliveryinfo where " +
229   - " to_date(CREATED,'yyyy-mm-dd hh24:mm:ss') > to_date('"+start+"', 'yyyy-mm-dd hh24:mm:ss') and to_date(CREATED,'yyyy-mm-dd hh24:mm:ss') <= to_date('"+end+"', 'yyyy-mm-dd hh24:mm:ss')" +
230   - " and ID not in (select id from zlhis.v_deliveryinfo where DELIVER_DOCTOR is not null and BABY_HEIGHT is not null and BABY_WEIGHT is not null and BABY_APGAR_SCORE_ONE is not null and BABY_PREGNANCY_OUT is not null ) " ;
  228 + String sql ="select "+idSql+" from zlhis.v_deliveryinfo where " +
  229 + " to_date(BABY_DELIVERY_TIME,'yyyy-mm-dd hh24:mm:ss') > to_date('"+start+"', 'yyyy-mm-dd hh24:mm:ss') and to_date(BABY_DELIVERY_TIME,'yyyy-mm-dd hh24:mm:ss') <= to_date('"+end+"', 'yyyy-mm-dd hh24:mm:ss')" ;
231 230  
232   - if (StringUtils.isNotEmpty(syxh))
233   - {
234   - sql+= " and ID='"+syxh+"'";
235   - }
236   -
237 231 List<Fm> list = queryRunner.query(conn, sql, new BeanListHandler<Fm>(Fm.class));
238 232 ExceptionUtils.catchException("size====" + list.size());
239 233  
240 234  
241 235  
242 236  
243 237  
244 238  
245 239  
246 240  
247 241  
248 242  
249 243  
250 244  
251 245  
252 246  
253 247  
254 248  
255 249  
256 250  
257 251  
258 252  
259 253  
260 254  
261 255  
262 256  
263 257  
264 258  
265 259  
266 260  
267 261  
268 262  
269 263  
270 264  
271 265  
... ... @@ -260,277 +254,233 @@
260 254 fm.setBABY_APGAR_SCORE_TEN(10);
261 255 list.add(fm);*/
262 256  
  257 + if(CollectionUtils.isNotEmpty(list)){
263 258  
  259 + for(Fm fm:list){
  260 + List<Users> users = new ArrayList<Users>();
  261 + String id = fm.getID();//获取所有的孕妇ID,方便孕妇产下双胞胎而用
  262 + String allSql = "select "+cloumns+" from zlhis.v_deliveryinfo where " +
  263 + " to_date(BABY_DELIVERY_TIME,'yyyy-mm-dd hh24:mm:ss') > to_date('"+start+"', 'yyyy-mm-dd hh24:mm:ss') and to_date(BABY_DELIVERY_TIME,'yyyy-mm-dd hh24:mm:ss') <= to_date('"+end+"', 'yyyy-mm-dd hh24:mm:ss')" +
  264 + " and ID='"+id+"'" ;
264 265  
  266 + //查出这个ID对应孕妇在这个时间段的分娩记录
  267 + List<Fm> allList = queryRunner.query(conn, allSql, new BeanListHandler<Fm>(Fm.class));
265 268  
266   -
267   - if (CollectionUtils.isNotEmpty(list)) {
268   -
269   - for(Fm f:list){
270   - String id=f.getID();
271   - if(!IDlist.contains(id)){
272   - IDlist.add(id);
273   - }
274   - }
275   -
276   - for(String id:IDlist){
277 269 Date dueDate = null;
278   - List<Users> users=new ArrayList<Users>();
279 270 List<MatDeliverAddRequest.Baby> babies = new ArrayList<>();
280 271 MatDeliverAddRequest deliverAddRequest = new MatDeliverAddRequest();
  272 + for(Fm allFm:allList){
281 273  
282   - for (Fm item : list) {
283   - if(item.getID().equals(id)){
284   - try{
  274 + if ("死胎".equals(allFm.getBABY_PREGNANCY_OUT()))
  275 + {
  276 + continue;
  277 + }
285 278  
286   - if ("死胎".equals(item.getBABY_PREGNANCY_OUT()))
287   - {
288   - continue;
289   - }
290   - ExceptionUtils.catchException("item===" + item);
291   - dueDate = item.getBABY_DELIVERY_TIME();
292   - if (!StringUtils.isNotEmpty(dueDate.toString())) {
293   - continue;
294   - }
  279 + PatientsQuery query = new PatientsQuery();
295 280  
296   - //根据患者ID查询分娩记录的基本信息
297   - FmPatInfo patInfo = getFmPatInfoById(item.getID());
298   - /*FmPatInfo patInfo = new FmPatInfo();
299   - patInfo.setSyxh("33299");
300   - patInfo.setName("小香香");
301   - patInfo.setCardNo("123654");
302   - patInfo.setPhone("18613211129");*/
  281 + //查询该孕妇是否在孕产婴系统中建档
  282 + List<Patients> patientses = patientsService.queryPatient(query);
  283 + Patients patient = new Patients();
  284 + if(CollectionUtils.isNotEmpty(patientses)){
  285 + ExceptionUtils.catchException("patientses"+patientses);
  286 + patient = patientses.get(0);
  287 + UsersQuery usersQuery = new UsersQuery();
  288 + usersQuery.setYn(YnEnums.YES.getId());
  289 + usersQuery.setOrgId(1000000114);
  290 + usersQuery.setName("产房");
  291 + users = usersService.queryUsers(usersQuery);
303 292  
304   - if (patInfo != null && StringUtils.isNotEmpty(patInfo.getPhone())) {
305   - PatientsQuery query = new PatientsQuery();
306   - query.setYn(YnEnums.YES.getId());
307   - query.setType(1); //孕妇
308   - query.setDueStatus(0); //未终止妊娠
309   - ExceptionUtils.catchException("phone="+patInfo.getPhone()+" cardNo="+ patInfo.getCardNo());
310   - String[] strs = new String[]{patInfo.getPhone(),patInfo.getCardNo()};
311   - query.setPc(strs);
  293 + if (CollectionUtils.isNotEmpty(users) && users.get(0).getId() != null) {
312 294  
313   - //查询该孕妇是否在孕产婴系统中建档
314   - List<Patients> patientses = patientsService.queryPatient(query);
315   - if (CollectionUtils.isNotEmpty(patientses)) {
  295 + Date dateTime = allFm.getBABY_DELIVERY_TIME();
  296 + if(dateTime!=null){
  297 + if (!com.lyms.platform.common.utils.StringUtils.isNotEmpty(allFm.getBABY_DELIVERY_TIME().toString())) {
  298 + continue;
  299 + }
  300 + }else{
  301 + continue;
  302 + }
316 303  
317   - ExceptionUtils.catchException("patientses"+patientses);
318   - Patients patient = patientses.get(0);
319   - UsersQuery usersQuery = new UsersQuery();
320   - usersQuery.setName(item.getDELIVER_DOCTOR());
321   - usersQuery.setYn(YnEnums.YES.getId());
322   - usersQuery.setOrgId(1000000114);
323   - users = usersService.queryUsers(usersQuery);
324   - if (!CollectionUtils.isNotEmpty(users)) {
325   - usersQuery.setName("产房");
326   - users = usersService.queryUsers(usersQuery);
327   - }
  304 + Map<String, String> map = new HashMap<>();
  305 + Map<String, String> totalMap = new HashMap<>();
328 306  
329   - if (CollectionUtils.isNotEmpty(users) && users.get(0).getId() != null) {
  307 + Integer prod_Process_One = allFm.getPROD_PROCESS_ONE();
  308 + Integer prod_Process_Two = allFm.getPROD_PROCESS_TWO();
  309 + Integer prod_Process_Three = allFm.getPROD_PROCESS_THREE();
  310 + if(prod_Process_One!=null){
  311 + map.put("one",allFm.getPROD_PROCESS_ONE().toString());
  312 + }
  313 + if(prod_Process_Two!=null){
  314 + map.put("two",allFm.getPROD_PROCESS_TWO().toString());
  315 + }
  316 + if(prod_Process_Three!=null){
  317 + map.put("three",allFm.getPROD_PROCESS_THREE().toString());
  318 + }
330 319  
  320 + int hProcess = Integer.parseInt(allFm.getTOTAL_PROCESS())/60;//总产程小时数
  321 + int mProcess = Integer.parseInt(allFm.getTOTAL_PROCESS())%60;//总产程分钟数
  322 + totalMap.put("h",String.valueOf(hProcess));
  323 + totalMap.put("m",String.valueOf(mProcess));
331 324  
332   - if (!com.lyms.platform.common.utils.StringUtils.isNotEmpty(item.getBABY_DELIVERY_TIME().toString())) {
333   - continue;
334   - }
335   - Map<String, String> map = new HashMap<>();
336   - Map<String, String> totalMap = new HashMap<>();
  325 + deliverAddRequest.setProdprocess(map);
  326 + deliverAddRequest.setTotalprocess(totalMap);
  327 + deliverAddRequest.setDeliverDoctor(allFm.getDELIVER_DOCTOR());
  328 + deliverAddRequest.setDueDate(DateUtil.getyyyy_MM_dd(dueDate));
  329 + deliverAddRequest.setParentId(patient.getId());
  330 + deliverAddRequest.setPid(patient.getPid());
  331 + deliverAddRequest.setOperationCause("-");
  332 + String week = "";
  333 + if (StringUtils.isNotEmpty(allFm.getDUE_WEEK())) {
337 334  
338   - Integer prod_Process_One = item.getPROD_PROCESS_ONE();
339   - Integer prod_Process_Two = item.getPROD_PROCESS_TWO();
340   - Integer prod_Process_Three = item.getPROD_PROCESS_THREE();
341   - if(prod_Process_One!=null){
342   - map.put("cc1",item.getPROD_PROCESS_ONE().toString());
343   - }
344   - if(prod_Process_Two!=null){
345   - map.put("cc2",item.getPROD_PROCESS_TWO().toString());
346   - }
347   - if(prod_Process_Three!=null){
348   - map.put("cc2",item.getPROD_PROCESS_THREE().toString());
349   - }
350   - totalMap.put("zcc",item.getTOTAL_PROCESS());
351   - deliverAddRequest.setTotalprocess(totalMap);
352   - deliverAddRequest.setProdprocess(map);
353   - deliverAddRequest.setDeliverDoctor(item.getDELIVER_DOCTOR());
354   - deliverAddRequest.setDueDate(DateUtil.getyyyy_MM_dd(dueDate));
355   - deliverAddRequest.setParentId(patient.getId());
356   - deliverAddRequest.setPid(patient.getPid());
357   - deliverAddRequest.setOperationCause("-");
358   - String week = "";
359   - if (StringUtils.isNotEmpty(item.getDUE_WEEK())) {
  335 + week = allFm.getDUE_WEEK() + "周";
  336 + if (StringUtils.isNotEmpty(allFm.getDUE_WEEK()) && StringUtils.isNotEmpty(allFm.getDUE_DAY()))
  337 + {
  338 + week += allFm.getDUE_DAY() + "天";
  339 + }
360 340  
361   - week = item.getDUE_WEEK() + "周";
362   - if (StringUtils.isNotEmpty(item.getDUE_WEEK()) && StringUtils.isNotEmpty(item.getDUE_DAY()))
363   - {
364   - week += item.getDUE_DAY() + "天";
365   - }
  341 + deliverAddRequest.setDueWeek(week);
  342 + }
366 343  
367   - deliverAddRequest.setDueWeek(week);
368   - }
  344 + deliverAddRequest.setTireNumber(allFm.getFETUS_NUM());// 胎数(之前赋值为死值1)
  345 + Integer placenta_Num = allFm.getPLACENTA_NUM();
  346 + if(placenta_Num!=null){
  347 + deliverAddRequest.setPlacenta(allFm.getPLACENTA_NUM().toString());// 胎盘(之前赋值为死值1)
  348 + }
  349 + if ("完好".equals(allFm.getPERINEAL_CONDITION()) || "".equals(allFm.getPERINEAL_CONDITION())) {
  350 + deliverAddRequest.setPerinealCondition("full");
  351 + } else if ("会阴切开".equals(allFm.getPERINEAL_CONDITION()) || "侧切".equals(allFm.getPERINEAL_CONDITION())) {
  352 + deliverAddRequest.setPerinealCondition("split");
  353 + }
369 354  
370   - deliverAddRequest.setTireNumber(item.getFETUS_NUM());// 胎数(之前赋值为死值1)
371   - Integer placenta_Num = item.getPLACENTA_NUM();
372   - if(placenta_Num!=null){
373   - deliverAddRequest.setPlacenta(item.getPLACENTA_NUM().toString());// 胎盘(之前赋值为死值1)
374   - }
375   - if ("完好".equals(item.getPERINEAL_CONDITION()) || "无".equals(item.getPERINEAL_CONDITION())) {
376   - deliverAddRequest.setPerinealCondition("full");
377   - } else if ("会阴切开".equals(item.getPERINEAL_CONDITION()) || "侧切".equals(item.getPERINEAL_CONDITION())) {
378   - deliverAddRequest.setPerinealCondition("split");
379   - }
  355 + if ("一度裂伤".equals(allFm.getPERINEAL_CONDITION())) {
  356 + deliverAddRequest.setSiLielevel(1);
  357 + } else if ("二度裂伤".equals(allFm.getPERINEAL_CONDITION())) {
  358 + deliverAddRequest.setSiLielevel(2);
  359 + } else if ("三度裂伤".equals(allFm.getPERINEAL_CONDITION())) {
  360 + deliverAddRequest.setSiLielevel(3);
  361 + }
380 362  
381   - if ("一度裂伤".equals(item.getPERINEAL_CONDITION())) {
382   - deliverAddRequest.setSiLielevel(1);
383   - } else if ("二度裂伤".equals(item.getPERINEAL_CONDITION())) {
384   - deliverAddRequest.setSiLielevel(2);
385   - } else if ("三度裂伤".equals(item.getPERINEAL_CONDITION())) {
386   - deliverAddRequest.setSiLielevel(3);
387   - }
  363 + Integer th_Lose = allFm.getTH_LOSE_BLOOD();
  364 + if(th_Lose!=null){
  365 + if (StringUtils.isNotEmpty(allFm.getTH_LOSE_BLOOD().toString())) {
  366 + deliverAddRequest.settHloseBloodL(Double.parseDouble(allFm.getTH_LOSE_BLOOD().toString()));
  367 + }
  368 + }
388 369  
389   - Integer th_Lose = item.getTH_LOSE_BLOOD();
390   - if(th_Lose!=null){
391   - if (StringUtils.isNotEmpty(item.getTH_LOSE_BLOOD().toString())) {
392   - deliverAddRequest.settHloseBloodL(Double.parseDouble(item.getTH_LOSE_BLOOD().toString()));
393   - }
394   - }
  370 + Map deliveryMode = new HashMap(); //分娩方式
395 371  
396   - Map deliveryMode = new HashMap(); //分娩方式
  372 + String fmfs = "";
  373 + if (allFm.getDELIVERY_MODE() != null && "剖宫产".equals(allFm.getDELIVERY_MODE()))
  374 + {
  375 + fmfs = FmTypeEnums.O1.getId();
  376 + }
  377 + else
  378 + {
  379 + fmfs = FmTypeEnums.O.getId();
  380 + }
  381 + deliveryMode.put("fmfs",fmfs);
  382 + deliverAddRequest.setDeliveryMode(deliveryMode);
  383 + //胎盘信息
  384 + List<MaternalDeliverModel.ExtPlacenta> extPlacentas = new ArrayList<>();
  385 + MaternalDeliverModel.ExtPlacenta extPlacenta = new MaternalDeliverModel.ExtPlacenta();
  386 + String tpmcType = ""; //胎盘娩出方式
  387 + if ("手术产".equals(allFm.getTMCTYPE()) || "手取胎盘".equals(allFm.getTMCTYPE())) {
  388 + tpmcType = TpmcTypeEnums.O2.getId();
  389 + } else if ("自然产出".equals(allFm.getTMCTYPE()) || "自然娩出".equals(allFm.getTMCTYPE())) {
  390 + tpmcType = TpmcTypeEnums.O.getId();
  391 + }
  392 + extPlacenta.setTpmcType(tpmcType);
  393 + extPlacentas.add(extPlacenta);
  394 + deliverAddRequest.setExtPlacentas(extPlacentas);
397 395  
398   - String fmfs = "";
399   - if (item.getTMCSIDE() != null && "剖宫产".equals(item.getTMCSIDE()))
400   - {
401   - fmfs = FmTypeEnums.O1.getId();
402   - }
403   - else
404   - {
405   - fmfs = FmTypeEnums.O.getId();
406   - }
407   - deliveryMode.put("fmfs",fmfs);
408   - deliverAddRequest.setDeliveryMode(deliveryMode);
409   - //胎盘信息
410   - List<MaternalDeliverModel.ExtPlacenta> extPlacentas = new ArrayList<>();
411   - MaternalDeliverModel.ExtPlacenta extPlacenta = new MaternalDeliverModel.ExtPlacenta();
412   - String tpmcType = ""; //胎盘娩出方式
413   - if ("手术产".equals(item.getTMCTYPE()) || "手取胎盘".equals(item.getTMCTYPE())) {
414   - tpmcType = TpmcTypeEnums.O2.getId();
415   - } else if ("自然产出".equals(item.getTMCTYPE()) || "自然娩出".equals(item.getTMCTYPE())) {
416   - tpmcType = TpmcTypeEnums.O.getId();
417   - }
418   - extPlacenta.setTpmcType(tpmcType);
419   - extPlacentas.add(extPlacenta);
420   - deliverAddRequest.setExtPlacentas(extPlacentas);
421 396  
  397 + //儿童
  398 + MatDeliverAddRequest.Baby baby = new MatDeliverAddRequest.Baby();
  399 + Map<String, String> as = new HashMap<>();
  400 + Integer pf1 = allFm.getBABY_APGAR_SCORE_ONE();
  401 + Integer pf5 = allFm.getBABY_APGAR_SCORE_FIVE();
  402 + Integer pf10 = allFm.getBABY_APGAR_SCORE_TEN();
  403 + if(pf1!=null){
  404 + as.put("pf1", allFm.getBABY_APGAR_SCORE_ONE().toString());
  405 + }
  406 + if(pf5!=null){
  407 + as.put("pf5", allFm.getBABY_APGAR_SCORE_FIVE().toString());
  408 + }
  409 + if(pf10!=null){
  410 + as.put("pf10", allFm.getBABY_APGAR_SCORE_TEN().toString());
  411 + }
422 412  
423   - //儿童
424   - MatDeliverAddRequest.Baby baby = new MatDeliverAddRequest.Baby();
425   - Map<String, String> as = new HashMap<>();
426   - Integer pf1 = item.getBABY_APGAR_SCORE_ONE();
427   - Integer pf5 = item.getBABY_APGAR_SCORE_FIVE();
428   - Integer pf10 = item.getBABY_APGAR_SCORE_TEN();
429   - if(pf1!=null){
430   - as.put("pf1", item.getBABY_APGAR_SCORE_ONE().toString());
431   - }
432   - if(pf5!=null){
433   - as.put("pf5", item.getBABY_APGAR_SCORE_FIVE().toString());
434   - }
435   - if(pf10!=null){
436   - as.put("pf10", item.getBABY_APGAR_SCORE_TEN().toString());
437   - }
438 413  
  414 + baby.setApgarScore(as);
  415 + baby.setBabyGender("男".equals(allFm.getBABY_SEX()) ? "1" : "0");
  416 + Integer babyHeight = allFm.getBABY_HEIGHT();
  417 + Integer babyWeight = allFm.getBABY_WEIGHT();
  418 + Integer baby_Asphyxiam = allFm.getBABY_ASPHYXIAM();
  419 + if(babyHeight!=null){
  420 + baby.setBabyHeight(allFm.getBABY_HEIGHT().toString());//新生儿生长
  421 + }
  422 + if(babyWeight!=null){
  423 + baby.setBabyWeight(allFm.getBABY_WEIGHT().toString());//新生儿重量
  424 + }
  425 + if(baby_Asphyxiam!=null){
  426 + baby.setAsphyxiaM(allFm.getBABY_ASPHYXIAM().toString()); //窒息分钟
  427 + }
439 428  
440   - baby.setApgarScore(as);
441   - baby.setBabyGender("男".equals(item.getBABY_SEX()) ? "1" : "0");
442   - Integer babyHeight = item.getBABY_HEIGHT();
443   - Integer babyWeight = item.getBABY_WEIGHT();
444   - Integer baby_Asphyxiam = item.getBABY_ASPHYXIAM();
445   - if(babyHeight!=null){
446   - baby.setBabyHeight(item.getBABY_HEIGHT().toString());//新生儿生长
447   - }
448   - if(babyWeight!=null){
449   - baby.setBabyWeight(item.getBABY_WEIGHT().toString());//新生儿重量
450   - }
451   - if(baby_Asphyxiam!=null){
452   - baby.setAsphyxiaM(item.getBABY_ASPHYXIAM().toString()); //窒息分钟
453   - }
  429 + baby.setDeformity((allFm.getBABY_DEFORMITY()==null?0:1)); //畸形 0非畸形 1畸形
454 430  
455   - baby.setDeformity("".equals(item.getBABY_DEFORMITY()) ? 0 : 1); //畸形 0非畸形 1畸形
  431 + String baby_Pregnancy_Out = allFm.getBABY_PREGNANCY_OUT();
  432 + if(baby_Pregnancy_Out!=null && StringUtils.isNotEmpty(baby_Pregnancy_Out)){
  433 + baby.setPregnancyOut(RenShenJieJuEnums.getIdByName(allFm.getBABY_PREGNANCY_OUT())); // 妊娠结局
  434 + }
456 435  
457   - String baby_Pregnancy_Out = item.getBABY_PREGNANCY_OUT();
458   - if(baby_Pregnancy_Out!=null && StringUtils.isNotEmpty(baby_Pregnancy_Out)){
459   - baby.setPregnancyOut(RenShenJieJuEnums.getIdByName(item.getBABY_PREGNANCY_OUT())); // 妊娠结局
460   - }
  436 + baby.setDueTime(fmt.format(dueDate));//分娩时间
  437 + babies.add(baby);
461 438  
462   - baby.setDueTime(fmt.format(dueDate));//分娩时间
463   - babies.add(baby);
  439 + }
  440 + }else{
464 441  
465   - }
  442 + //德州服务器有分娩记录,但是在这边系统没有对应孕妇 取分娩信息建档儿童数据
  443 + String babyName = allFm.getNAME()+("男".equals(allFm.getBABY_SEX()) ? "之子" : "之女");
  444 + FmItem fmitem=new FmItem();
  445 + fmitem.setCcqk(allFm.getBABY_PREGNANCY_OUT());
  446 + fmitem.setYexb(allFm.getBABY_SEX());
  447 + fmitem.setRc(allFm.getDUE_WEEK());
  448 + fmitem.setFmfs(allFm.getDELIVERY_MODE());
  449 + Integer fetus_Num = allFm.getFETUS_NUM();
  450 + if(fetus_Num!=null){
  451 + fmitem.setDjt(allFm.getFETUS_NUM().toString());
  452 + }
  453 + fmitem.setCjc("");
  454 + Integer babyHeight = allFm.getBABY_HEIGHT();
  455 + Integer babyWeight = allFm.getBABY_WEIGHT();
  456 + if(babyHeight!=null){
  457 + fmitem.setSc(allFm.getBABY_HEIGHT().toString());
  458 + }
  459 + if(babyWeight!=null){
  460 + fmitem.setTz(allFm.getBABY_WEIGHT().toString());
  461 + }
  462 + Integer pf1 = allFm.getBABY_APGAR_SCORE_ONE();
  463 + Integer pf5 = allFm.getBABY_APGAR_SCORE_FIVE();
  464 + Integer pf10 = allFm.getBABY_APGAR_SCORE_TEN();
  465 + if(pf1!=null){
  466 + fmitem.setYfz(allFm.getBABY_APGAR_SCORE_ONE().toString());
  467 + }
  468 + if(pf5!=null){
  469 + fmitem.setWfz(allFm.getBABY_APGAR_SCORE_FIVE().toString());
  470 + }
  471 + if(pf10!=null){
  472 + fmitem.setSfz(allFm.getBABY_APGAR_SCORE_TEN().toString());
  473 + }
  474 + fmitem.setSfgw("");
  475 + Integer baby_Deformity = allFm.getBABY_DEFORMITY();
  476 + if(baby_Deformity!=null){
  477 + fmitem.setJx(allFm.getBABY_DEFORMITY().toString());
  478 + }
  479 + buildBaby(fmitem, patient,allFm, dueDate, babyName);
466 480  
467   -
468   -
469   -
470   - }else{
471   - //德州服务器有分娩记录,但是在这边系统没有对应孕妇 取分娩信息建档儿童数据
472   - String babyName = patInfo.getName()+("男".equals(item.getBABY_SEX()) ? "之子" : "之女");
473   - FmItem fmitem=new FmItem();
474   - fmitem.setCcqk(item.getBABY_PREGNANCY_OUT());
475   - fmitem.setYexb(item.getBABY_SEX());
476   - fmitem.setRc(item.getDUE_WEEK());
477   - fmitem.setFmfs(item.getDELIVERY_MODE());
478   - Integer fetus_Num = item.getFETUS_NUM();
479   - if(fetus_Num!=null){
480   - fmitem.setDjt(item.getFETUS_NUM().toString());
481   - }
482   - fmitem.setCjc("");
483   - Integer babyHeight = item.getBABY_HEIGHT();
484   - Integer babyWeight = item.getBABY_WEIGHT();
485   - if(babyHeight!=null){
486   - fmitem.setSc(item.getBABY_HEIGHT().toString());
487   - }
488   - if(babyWeight!=null){
489   - fmitem.setTz(item.getBABY_WEIGHT().toString());
490   - }
491   - Integer pf1 = item.getBABY_APGAR_SCORE_ONE();
492   - Integer pf5 = item.getBABY_APGAR_SCORE_FIVE();
493   - Integer pf10 = item.getBABY_APGAR_SCORE_TEN();
494   - if(pf1!=null){
495   - fmitem.setYfz(item.getBABY_APGAR_SCORE_ONE().toString());
496   - }
497   - if(pf5!=null){
498   - fmitem.setWfz(item.getBABY_APGAR_SCORE_FIVE().toString());
499   - }
500   - if(pf10!=null){
501   - fmitem.setSfz(item.getBABY_APGAR_SCORE_TEN().toString());
502   - }
503   - fmitem.setSfgw("");
504   - Integer baby_Deformity = item.getBABY_DEFORMITY();
505   - if(baby_Deformity!=null){
506   - fmitem.setJx(item.getBABY_DEFORMITY().toString());
507   - }
508   - buildBaby(fmitem, patInfo, dueDate, babyName);
509   -
510   - }
511   -
512   -
513   - }else{
514   - //没有找到孕妇建档的基本信息 记录下来
515   - SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHH:mm:ss");
516   - String nowDate = format.format(new Date());
517   - Date date = item.getCREATED();
518   - if(date==null){
519   - saveFmrecord(item.getID(), format.parse(nowDate));
520   - }else {
521   - saveFmrecord(item.getID(), format.parse(item.getCREATED().toString()));
522   - }
523   - }
524   -
525   -
526   -
527   - }catch (Exception e){
528   - ExceptionUtils.catchException(e, "数据异常");
529   - continue;
530   - }
531   -
532 481 }
533 482  
  483 +
534 484 }
535 485  
536 486 deliverAddRequest.setBabies(babies);
537 487  
538 488  
539 489  
... ... @@ -540,23 +490,21 @@
540 490 matDeliverFacade.addOrUpdateMatDeliver(deliverAddRequest, users.get(0).getId());
541 491 }
542 492  
543   -
544 493 }
545 494  
546 495  
547 496  
548 497 }
549   -
550   -
551   - //DbUtils.closeQuietly(conn);
  498 + DbUtils.closeQuietly(conn);
552 499 } catch (Exception e) {
553 500 ExceptionUtils.catchException(e, "sql执行异常");
554 501 e.printStackTrace();
555 502 } finally {
556   - //DbUtils.closeQuietly(conn);
  503 + DbUtils.closeQuietly(conn);
557 504 }
558 505 }
559 506  
  507 +
560 508 private List buildBabyName(List<FmItem> items) {
561 509 String id = "";
562 510 if (items.size() > 2) {
563 511  
564 512  
... ... @@ -603,12 +551,13 @@
603 551 babyBookbuildingFacade.saveFmrecord(fmRecordModel);
604 552 }
605 553  
606   - public void buildBaby(FmItem item,FmPatInfo patInfo, Date dueDate, String babyName)
  554 + public void buildBaby(FmItem item,Patients patInfo,Fm fm, Date dueDate, String babyName)
607 555 {
608 556 try{
  557 +
609 558 ExceptionUtils.catchException("buildBaby====");
610   - // O("活产", "0"),O1("死胎", "1"),O2("浸软胎", "2"),O3("死产", "3");
611   - if (!"活产".equals(item.getCcqk()))
  559 +
  560 + if ("死胎".equals(fm.getBABY_PREGNANCY_OUT()))
612 561 {
613 562 return;
614 563 }
615 564  
616 565  
617 566  
618 567  
619 568  
620 569  
621 570  
622 571  
623 572  
624 573  
... ... @@ -616,54 +565,52 @@
616 565 UsersQuery usersQuery = new UsersQuery();
617 566 usersQuery.setYn(YnEnums.YES.getId());
618 567 usersQuery.setName("产房");
619   - usersQuery.setOrgId(216);
  568 + usersQuery.setOrgId(1000000114);
620 569 List<Users> users = usersService.queryUsers(usersQuery);
621 570  
622 571 BabyBookbuildingAddRequest request = new BabyBookbuildingAddRequest();
623   - request.setHospitalId("216");
  572 + request.setHospitalId("1000000114");
624 573  
625   - request.setMommyName(patInfo.getName()); //母亲姓名
626   -
627   - if (StringUtils.isNotEmpty(patInfo.getBirth()))
628   - {
  574 + request.setMommyName(fm.getNAME()); //母亲姓名
  575 + Date bir = patInfo.getBirth();
  576 + if(bir!=null){
629 577 try {
630 578 SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd");
631   - Date birth = format.parse(patInfo.getBirth());
  579 + Date birth = format.parse(bir.toString());
632 580 format = new SimpleDateFormat("yyyy-MM-dd");
633 581 request.setMommyBirthday(format.format(birth));
634 582 }catch (ParseException e)
635 583 {
636 584 ExceptionUtils.catchException(e,"孕妇生日解析异常");
637 585 }
638   -
639 586 }
640 587  
641 588  
642   - if (org.apache.commons.lang.StringUtils.isNotEmpty(patInfo.getCardNo()))
  589 +
  590 +
  591 +
  592 +
  593 + if (org.apache.commons.lang.StringUtils.isNotEmpty(fm.getIDCARD()))
643 594 {
644 595 request.setMommyCertificateTypeId("70ae1d93-2964-46bc-83fa-bec9ff605b1c"); //证件类型 (身份证号码)
645   - request.setMommyCertificateNum(patInfo.getCardNo()); //证件号
  596 + request.setMommyCertificateNum(fm.getIDCARD()); //证件号
646 597 }
647   - else if (StringUtils.isNotEmpty(patInfo.getPhone()))
  598 + else if (StringUtils.isNotEmpty(fm.getPHONE()))
648 599 {
649 600 request.setMommyCertificateTypeId("57e1dcd3f0f02e7ca519d6c6"); //证件类型 (手机号码)
650   - request.setMommyCertificateNum(patInfo.getPhone()); //证件号
  601 + request.setMommyCertificateNum(fm.getPHONE()); //证件号
651 602 }
652 603  
653   - request.setMommyPhone(patInfo.getPhone());
  604 + request.setMommyPhone(fm.getPHONE());
654 605  
655 606 request.setBabyName(babyName);
656 607 request.setSex("男".equals(item.getYexb()) ? 1 : 0);
657 608  
658 609 request.setBabyBirthday(DateUtil.getyyyy_MM_dd(dueDate)); //生日
659 610  
660   - if (StringUtils.isNotEmpty(item.getRc())) {
661   - String week = "";
662   - if (item.getRc().split("\\u002B").length > 1) {
663   - week = item.getRc().split("\\u002B")[0];
664   - } else {
665   - week = item.getRc();
666   - }
  611 + if (StringUtils.isNotEmpty(fm.getDUE_WEEK())) {
  612 + String week = fm.getDUE_WEEK();
  613 +
667 614 try {
668 615 request.setDueWeek(Integer.parseInt(week)); //分娩孕周
669 616 }catch (Exception e)
... ... @@ -673,7 +620,7 @@
673 620 }
674 621  
675 622 String fmfs = "";
676   - if (item.getFmfs() != null && "剖宫产".equals(item.getFmfs()))
  623 + if (fm.getDELIVERY_MODE() != null && "剖宫产".equals(fm.getDELIVERY_MODE()))
677 624 {
678 625 fmfs = FmTypeEnums.O1.getId();
679 626 }
680 627  
681 628  
682 629  
683 630  
684 631  
685 632  
686 633  
... ... @@ -683,38 +630,56 @@
683 630 }
684 631  
685 632 request.setDueType(fmfs);//分娩方式
686   - request.setFetusCount(item.getDjt()); //第几胎
687   - request.setDueCount(item.getCjc());//第几产
688   - DecimalFormat df = new DecimalFormat("#.00");
689   - double w = Double.parseDouble(item.getTz());
690   - request.setBabyWeight(df.format(w/1000)); //体重
691   - request.setBabyHeight(item.getSc()); //身长
  633 + //request.setFetusCount(item.getDjt()); //第几胎
  634 + //request.setDueCount(item.getCjc());//第几产
  635 + Integer weight = fm.getBABY_WEIGHT();
  636 + Integer height = fm.getBABY_HEIGHT();
  637 + if(weight!=null){
  638 + DecimalFormat df = new DecimalFormat("#.00");
  639 + double w = Double.parseDouble(weight.toString());
  640 + request.setBabyWeight(df.format(w/1000)); //体重
  641 + }
  642 + if(height!=null){
  643 + request.setBabyHeight(height.toString()); //身长
  644 + }
  645 +
692 646 Map<String,String> map = new HashMap<>();
693   - map.put("pf1",item.getYfz());
694   - map.put("pf5", item.getWfz());
695   - map.put("pf10", item.getSfz());
  647 + Integer pf1 = fm.getBABY_APGAR_SCORE_ONE();
  648 + Integer pf5 = fm.getBABY_APGAR_SCORE_FIVE();
  649 + Integer pf10 = fm.getBABY_APGAR_SCORE_TEN();
  650 + if(pf1!=null){
  651 + map.put("pf1", pf1.toString());
  652 + }
  653 + if(pf5!=null){
  654 + map.put("pf5", pf5.toString());
  655 + }
  656 + if(pf10!=null){
  657 + map.put("pf10", pf10.toString());
  658 + }
  659 +
696 660 request.setApgarScore(map);
697   - request.setDeliverOrg("216");
  661 + request.setDeliverOrg("1000000114");
698 662  
699 663 request.setBuildDoctor(users.get(0).getId() + "");
700 664 request.setBuildDate(DateUtil.getyyyy_MM_dd(dueDate));
701   - request.setHighRisk("是".equals(item.getSfgw()) ? 1 : 0); ////是否高危 0 非高危 1高危
702   - request.setMalformation("无".equals(item.getJx()) ? 0 : 1); //畸形 0非畸形 1畸形
  665 + //request.setHighRisk("是".equals(item.getSfgw()) ? 1 : 0); ////是否高危 0 非高危 1高危
  666 + request.setMalformation((fm.getBABY_DEFORMITY() == null ? 0 : 1)); //畸形 0非畸形 1畸形
  667 + //request.setMalformation("无".equals(item.getJx()) ? 0 : 1); //畸形 0非畸形 1畸形
703 668  
704 669 request.setServiceType(ServiceTypeEnums.STANDARD_SERVICE.getId()); //标准服务
705 670 request.setServiceStatus(ServiceStatusEnums.STANDARD_OPEN.getId()); //开通
706 671  
707   - if (patInfo != null && StringUtils.isNotEmpty(patInfo.getBlh()))
  672 + if (patInfo != null && StringUtils.isNotEmpty(fm.getBHNUM()))
708 673 {
709   - Map<String,Object> diags = qhdfyHisService.queryHisBabyDiagnosis(patInfo.getBlh());
  674 + Map<String,Object> diags = dzfyHisService.queryHisBabyDiagnosis(fm.getBHNUM());
710 675 if (diags != null && diags.size() > 0)
711 676 {
712   - request.setBlNo(patInfo.getBlh());
  677 + request.setBlNo(fm.getBHNUM());
713 678 request.setBabyDiagnosis(diags.get("diagnosisItem") == null ? "" : diags.get("diagnosisItem").toString());
714 679 }
715 680 }
716 681 babyBookbuildingFacade.addBabyBookbuilding(request, users.get(0).getId());
717   - //deleteFmHistoryRecord(item.getSyxh());
  682 +
718 683 }catch (Exception e)
719 684 {
720 685 ExceptionUtils.catchException(e, "buildBaby exception");
... ... @@ -740,13 +705,7 @@
740 705 if (CollectionUtils.isNotEmpty(list)) {
741 706 patInfo = list.get(0);
742 707 }
743   - /*else
744   - {
745   - List<FmPatInfo> list1 = queryRunner.query(conn, "SELECT SYXH as syxh, BRXM as name,'' as cardNo,BRXB as sex,'' as birth,LXDH as phone,ZYHM as blh FROM JHMK_BASY WHERE len(LXDH) = 11 and SYXH = '"+syxh+"'", new BeanListHandler<FmPatInfo>(FmPatInfo.class));
746   - if (CollectionUtils.isNotEmpty(list1)) {
747   - patInfo = list1.get(0);
748   - }
749   - }*/
  708 +
750 709 DbUtils.closeQuietly(conn);
751 710 return patInfo;
752 711  
platform-operate-api/src/main/java/com/lyms/hospitalapi/dzfy/DzfyHisService.java View file @ afad2aa
... ... @@ -604,10 +604,7 @@
604 604 // List<DiagnosisInfo> list = queryRunner.query(conn, "select cyzdmc as diagnosisItem from ZY_BRSYK where blh= '"+blNo+"'", new BeanListHandler<DiagnosisInfo>(DiagnosisInfo.class));
605 605 List<DiagnosisInfo> list = queryRunner.query(conn, "select DIAGNOSE as diagnosisItem from zlhis.v_kids_hdiagnose where BHNUM = '"+blNo+"'", new BeanListHandler<DiagnosisInfo>(DiagnosisInfo.class));
606 606 if (CollectionUtils.isNotEmpty(list)) {
607   -// for (DiagnosisInfo info:list) {
608   -// map.put("diagnosisItem", info.getDiagnosisItem());
609   -// break;
610   -// }
  607 +//
611 608  
612 609 for (int i = 0 ; i < list.size() ; i++)
613 610 {