Commit c1169818919d6645e1c37f57ffa6a76e12241fff

Authored by gengxiaokai
1 parent 0fd4c7441d
Exists in master and in 1 other branch dev

滦平分娩接口

Showing 3 changed files with 286 additions and 384 deletions

platform-operate-api/src/main/java/com/lyms/hospitalapi/lpfy/IlpFyFmService.java View file @ c116981
1 1 package com.lyms.hospitalapi.lpfy;
2 2  
  3 +import com.lyms.hospitalapi.dzfy.Fm;
  4 +
  5 +import java.util.List;
  6 +
3 7 /**
4 8 * Created by Administrator on 2018/1/10.
5 9 */
6 10 public interface IlpFyFmService {
7 11  
8   - public void queryFmPatient(String start,String end,String phone);
  12 + public void queryFmPatient(List<Fm> list);
9 13  
10 14 }
platform-operate-api/src/main/java/com/lyms/hospitalapi/lpfy/LpfyFmService.java View file @ c116981
... ... @@ -103,392 +103,18 @@
103 103 //queryFmPatient(startStr, endStr, null);
104 104 }
105 105  
106   - public void syncByPhone(String startStr,String endStr,String phone) {
107   - queryFmPatient(startStr, endStr, phone);
  106 + public void syncByPhone(List<Fm> list) {
  107 + queryFmPatient(list);
108 108 }
109 109  
110 110  
111 111  
112   - public void queryFmPatient(String start,String end,String phone) {
  112 + public void queryFmPatient(List<Fm> allList) {
113 113  
114   - String cloumns = " ID as ID,\n" +
115   - " 住院编号 as BHNUM,\n" +
116   - " 就诊卡号 as VCCARDNO,\n" +
117   - " 手机号码 as PHONE,\n" +
118   - " 姓名 as NAME,\n" +
119   - " 身份证号 as IDCARD,\n" +
120   - " CREATED as CREATED,\t\n" +
121   - " CONVERT(char(19),婴儿产出时日,120) as BABY_DELIVERY_TIME,\n" +
122   - " 婴儿性别 as BABY_SEX,\n" +
123   - " 孕周 as DUE_WEEK,\n" +
124   - // " DUE_DAY as DUE_DAY,\n" +
125   - " 胎次 as FETUS_NUM,\n" +
126   - " 窒息 as BABY_ASPHYXIAM,\n" +
127   - " CONVERT(int,left(体重,len(体重)-1)) as BABY_WEIGHT,\n" +
128   - " CONVERT(int,left(身长,len(身长)-2)) as BABY_HEIGHT,\n" +
129   - " CONVERT(int,left(Apgar评分1,len(Apgar评分1)-1)) as BABY_APGAR_SCORE_ONE,\n" +
130   - " CONVERT(int,left(Apgar评分5,len(Apgar评分5)-1)) as BABY_APGAR_SCORE_FIVE,\n" +
131   - " CONVERT(int,left(Apgar评分10,len(Apgar评分10)-1)) as BABY_APGAR_SCORE_TEN,\n" +
132   - " 妊娠结局 as BABY_PREGNANCY_OUT,\n" +
133   - " 分娩方式 as TMCSIDE,\n" +
134   - // " TMCTYPE as TMCTYPE,\n" +
135   - " 产妇离开产室情况 as MATERNAL_INFO,\n" +
136   - " 会阴切开术 as PERINEAL_CONDITION,\n" +
137   - //" 失血量 as SH_LOSE_BLOOD,\n" +
138   - " 失血量 as sxl,\n" +
139   - // " TH_LOSE_BLOOD as TH_LOSE_BLOOD,\n" +
140   - // " 接生者 as DELIVER_DOCTOR,\n" +
141   - // " 产程第一期 as PROD_PROCESS_ONE,\n" +
142   - " 产程第一期 as ccOne,\n" +
143   - // " 第二期 as PROD_PROCESS_TWO,\n" +
144   - " 第二期 as ccTwo,\n" +
145   - // " 第三期 as PROD_PROCESS_THREE,\n" +
146   - " 第三期 as ccThree,\n" +
147   - //" 总计 as TOTAL_PROCESS,\n" +
148   - " 总计 as total,\n" +
149   - " CONVERT(int,胎盘数量) as PLACENTA_NUM,\n" +
150   - //" DELIVER_HOSPITAL as DELIVER_HOSPITAL,\n" +
151   - " 产妇居住地址 as ADDR,\n"+
152   - " 接生者 as DELIVER_DOCTOR";
  114 + saveFm sfm = new saveFm(allList);
  115 + Thread t = new Thread(sfm);
  116 + t.start();
153 117  
154   -
155   - Connection conn = com.lyms.hospitalapi.lpfy.ConnTools.makeHisConnection();
156   - QueryRunner queryRunner = new QueryRunner();
157   - SimpleDateFormat fmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
158   - try {
159   -
160   - String sql ="select "+cloumns+" from lis_cs.v_deliveryinfo where " +
161   - " CREATED > to_date('"+start+"', 'yyyy-mm-dd hh24:mi:ss') and CREATED <= to_date('"+end+"', 'yyyy-mm-dd hh24:mi:ss')" ;
162   - if (phone != null)
163   - {
164   - sql+=" and 手机号码 = '"+phone+"'";
165   - }
166   - List<Fm> list = queryRunner.query(conn, sql, new BeanListHandler<Fm>(Fm.class));
167   - ExceptionUtils.catchException("size====" + list.size());
168   -
169   - /*List<Fm> list=new ArrayList<Fm>();
170   - list.add(fm1);*/
171   - if(CollectionUtils.isNotEmpty(list)){
172   -
173   - for(Fm fm:list){
174   - System.out.println("fm=" + fm.toString());
175   - int a = 0;//用来判断是否建了儿童档案,如果建了儿童档案就不保存分娩记录
176   - int count = 0;
177   - List<Users> users = new ArrayList<Users>();
178   - String id = fm.getID();//获取所有的孕妇ID,方便孕妇产下双胞胎而用
179   -
180   - //用来查询这个孕妇分娩的最近日期的sql
181   - String dateSql = "select max(CONVERT(char(19),CREATED,120)) as babyDate from xlhhis..v_fmjl where " +
182   - " ID='"+id+"'" ;
183   -
184   - //获取到这个孕妇的最近的分娩日期
185   - List<Fm> dateList = queryRunner.query(conn, dateSql, new BeanListHandler<Fm>(Fm.class));
186   - Calendar calendar = Calendar.getInstance();
187   - calendar.setTime(fmt.parse(dateList.get(0).getBabyDate()));
188   - calendar.add(Calendar.DAY_OF_MONTH, -1);
189   - Date sDate = calendar.getTime();
190   - String startDate = fmt.format(sDate);
191   - String endDate = dateList.get(0).getBabyDate();
192   -
193   - //查询这个孕妇最近日期所有分娩记录的sql
194   - String allSql = "select "+cloumns+" from xlhhis..v_fmjl where " +
195   - " CREATED > CONVERT(char(19),'"+startDate+"',120) and CREATED <= CONVERT(char(19),'"+endDate+"',120)" +
196   - " and ID='"+id+"'" ;
197   -
198   - //查出这个ID对应孕妇在这个时间段的分娩记录
199   - List<Fm> allList = queryRunner.query(conn, allSql, new BeanListHandler<Fm>(Fm.class));
200   -
201   - /*List<Fm> allList = new ArrayList<Fm>();
202   - allList.add(fm);*/
203   -
204   - Date dueDate = null;
205   - List<MatDeliverAddRequest.Baby> babies = new ArrayList<>();
206   - MatDeliverAddRequest deliverAddRequest = new MatDeliverAddRequest();
207   - for(Fm allFm:allList){
208   -
209   - if ("死胎".equals(allFm.getBABY_PREGNANCY_OUT()))
210   - {
211   - continue;
212   - }
213   - if (StringUtils.isEmpty(allFm.getPHONE()) && StringUtils.isEmpty(allFm.getIDCARD()))
214   - {
215   - continue;
216   - }
217   -
218   - //将中间字段的值整理赋值到正式字段中
219   - int sxl = allFm.getSxl().length();
220   - allFm.setSH_LOSE_BLOOD(Integer.parseInt(allFm.getSxl().substring(0,sxl-2)));//失血量
221   -
222   - String[] oneShi = allFm.getCcOne().split("时");
223   - int one = Integer.parseInt(oneShi[0])*60;
224   - String[] oneFen = oneShi[1].split("分");
225   - allFm.setPROD_PROCESS_ONE(one+Integer.parseInt(oneFen[0]));//第一产程
226   -
227   - String[] twoShi = allFm.getCcTwo().split("时");
228   - int two = Integer.parseInt(twoShi[0])*60;
229   - String[] twoFen = twoShi[1].split("分");
230   - allFm.setPROD_PROCESS_TWO(two+Integer.parseInt(twoFen[0]));//第二产程
231   -
232   - String[] threeShi = allFm.getCcThree().split("时");
233   - int three = Integer.parseInt(threeShi[0])*60;
234   - String[] threeFen = threeShi[1].split("分");
235   - allFm.setPROD_PROCESS_THREE(three+Integer.parseInt(threeFen[0]));//第三产程
236   -
237   - String[] totalShi = allFm.getTotal().split("时");
238   - int total = Integer.parseInt(totalShi[0])*60;
239   - String[] totalFen = totalShi[1].split("分");
240   - allFm.setTOTAL_PROCESS(String.valueOf(total+Integer.parseInt(totalFen[0])));//总产程
241   -
242   -
243   - PatientsQuery query = new PatientsQuery();
244   - query.setYn(YnEnums.YES.getId());
245   - query.setType(1); //孕妇
246   - query.setDueStatus(0); //未终止妊娠
247   - String[] strs = new String[]{allFm.getPHONE(),allFm.getIDCARD()};
248   - query.setPc(strs);
249   -
250   - //查询该孕妇是否在孕产婴系统中建档
251   - List<Patients> patientses = patientsService.queryPatient(query);
252   - Patients patient = new Patients();
253   - if(CollectionUtils.isNotEmpty(patientses)){
254   - ExceptionUtils.catchException("patientses"+patientses);
255   - patient = patientses.get(0);
256   - UsersQuery usersQuery = new UsersQuery();
257   - usersQuery.setYn(YnEnums.YES.getId());
258   - usersQuery.setOrgId(new Integer(Integer.parseInt(HOSPITALID)));
259   - usersQuery.setName("产房");
260   - users = usersService.queryUsers(usersQuery);
261   -
262   - if (CollectionUtils.isNotEmpty(users) && users.get(0).getId() != null) {
263   -
264   - Date dateTime = fmt.parse(allFm.getBABY_DELIVERY_TIME());
265   - if(dateTime!=null){
266   - if (!com.lyms.platform.common.utils.StringUtils.isNotEmpty(allFm.getBABY_DELIVERY_TIME().toString())) {
267   - continue;
268   - }else{
269   - dueDate = dateTime;
270   - }
271   - }else{
272   - continue;
273   - }
274   -
275   - Map<String, Map<String,String>> map = new HashMap<>();
276   - Map<String, String> map1 = new HashMap<>();
277   - Map<String, String> map2 = new HashMap<>();
278   - Map<String, String> map3 = new HashMap<>();
279   - Map<String, String> totalMap = new HashMap<>();
280   -
281   - Integer prod_Process_One = allFm.getPROD_PROCESS_ONE();
282   - Integer prod_Process_Two = allFm.getPROD_PROCESS_TWO();
283   - Integer prod_Process_Three = allFm.getPROD_PROCESS_THREE();
284   - if(prod_Process_One!=null){
285   - map1.put("h",String.valueOf(prod_Process_One.intValue()/60));
286   - map1.put("m",String.valueOf(prod_Process_One.intValue()%60));
287   - map.put("one", map1);
288   - }
289   - if(prod_Process_Two!=null){
290   - map2.put("h",String.valueOf(prod_Process_Two.intValue()/60));
291   - map2.put("m",String.valueOf(prod_Process_Two.intValue()%60));
292   - map.put("two",map2);
293   - }
294   - if(prod_Process_Three!=null){
295   - map3.put("h",String.valueOf(prod_Process_Three.intValue()/60));
296   - map3.put("m",String.valueOf(prod_Process_Three.intValue()%60));
297   - map.put("three",map3);
298   - }
299   -
300   - int hProcess = Integer.parseInt(allFm.getTOTAL_PROCESS())/60;//总产程小时数
301   - int mProcess = Integer.parseInt(allFm.getTOTAL_PROCESS())%60;//总产程分钟数
302   - totalMap.put("h",String.valueOf(hProcess));
303   - totalMap.put("m",String.valueOf(mProcess));
304   -
305   - deliverAddRequest.setProdprocess(map);
306   - deliverAddRequest.setTotalprocess(totalMap);
307   - deliverAddRequest.setDeliverDoctor(allFm.getDELIVER_DOCTOR());
308   - deliverAddRequest.setDueDate(DateUtil.getyyyy_MM_dd(dueDate));
309   - deliverAddRequest.setParentId(patient.getId());
310   - deliverAddRequest.setPid(patient.getPid());
311   - deliverAddRequest.setOperationCause("-");
312   - String week = "";
313   - if (StringUtils.isNotEmpty(allFm.getDUE_WEEK())) {
314   -
315   - week = allFm.getDUE_WEEK() + "周";
316   - if (StringUtils.isNotEmpty(allFm.getDUE_WEEK()) && StringUtils.isNotEmpty(allFm.getDUE_DAY()))
317   - {
318   - week += allFm.getDUE_DAY() + "天";
319   - }
320   -
321   - deliverAddRequest.setDueWeek(week);
322   - }
323   -
324   - deliverAddRequest.setTireNumber(allFm.getFETUS_NUM());// 胎数(之前赋值为死值1)
325   - Integer placenta_Num = allFm.getPLACENTA_NUM();
326   - if(placenta_Num!=null){
327   - deliverAddRequest.setPlacenta(allFm.getPLACENTA_NUM().toString());// 胎盘(之前赋值为死值1)
328   - }
329   - if ("完好".equals(allFm.getPERINEAL_CONDITION()) || "".equals(allFm.getPERINEAL_CONDITION())) {
330   - deliverAddRequest.setPerinealCondition("full");
331   - } else if ("会阴切开".equals(allFm.getPERINEAL_CONDITION()) || "侧切".equals(allFm.getPERINEAL_CONDITION())) {
332   - deliverAddRequest.setPerinealCondition("split");
333   - }
334   -
335   - if ("一度裂伤".equals(allFm.getPERINEAL_CONDITION())) {
336   - deliverAddRequest.setSiLielevel(1);
337   - } else if ("二度裂伤".equals(allFm.getPERINEAL_CONDITION())) {
338   - deliverAddRequest.setSiLielevel(2);
339   - } else if ("三度裂伤".equals(allFm.getPERINEAL_CONDITION())) {
340   - deliverAddRequest.setSiLielevel(3);
341   - }
342   -
343   - Integer th_Lose = allFm.getTH_LOSE_BLOOD();
344   - if(th_Lose!=null){
345   - if (StringUtils.isNotEmpty(allFm.getTH_LOSE_BLOOD().toString())) {
346   - deliverAddRequest.settHloseBloodL(Double.parseDouble(allFm.getTH_LOSE_BLOOD().toString()));
347   - }
348   - }
349   -
350   - Map deliveryMode = new HashMap(); //分娩方式
351   -
352   - String fmfs = "";
353   - if (allFm.getDELIVERY_MODE() != null && "剖宫产".equals(allFm.getDELIVERY_MODE()))
354   - {
355   - fmfs = FmTypeEnums.O1.getId();
356   - }
357   - else
358   - {
359   - fmfs = FmTypeEnums.O.getId();
360   - }
361   - deliveryMode.put("fmfs",fmfs);
362   - deliverAddRequest.setDeliveryMode(deliveryMode);
363   - //胎盘信息
364   - List<MaternalDeliverModel.ExtPlacenta> extPlacentas = new ArrayList<>();
365   - MaternalDeliverModel.ExtPlacenta extPlacenta = new MaternalDeliverModel.ExtPlacenta();
366   - String tpmcType = ""; //胎盘娩出方式
367   - if ("手术产".equals(allFm.getTMCTYPE()) || "手取胎盘".equals(allFm.getTMCTYPE())) {
368   - tpmcType = TpmcTypeEnums.O2.getId();
369   - } else if ("自然产出".equals(allFm.getTMCTYPE()) || "自然娩出".equals(allFm.getTMCTYPE())) {
370   - tpmcType = TpmcTypeEnums.O.getId();
371   - }
372   - extPlacenta.setTpmcType(tpmcType);
373   - extPlacentas.add(extPlacenta);
374   - deliverAddRequest.setExtPlacentas(extPlacentas);
375   -
376   -
377   - //儿童
378   - MatDeliverAddRequest.Baby baby = new MatDeliverAddRequest.Baby();
379   - Map<String, String> as = new HashMap<>();
380   - Integer pf1 = allFm.getBABY_APGAR_SCORE_ONE();
381   - Integer pf5 = allFm.getBABY_APGAR_SCORE_FIVE();
382   - Integer pf10 = allFm.getBABY_APGAR_SCORE_TEN();
383   - if(pf1!=null){
384   - as.put("pf1", allFm.getBABY_APGAR_SCORE_ONE().toString());
385   - }
386   - if(pf5!=null){
387   - as.put("pf5", allFm.getBABY_APGAR_SCORE_FIVE().toString());
388   - }
389   - if(pf10!=null){
390   - as.put("pf10", allFm.getBABY_APGAR_SCORE_TEN().toString());
391   - }
392   -
393   -
394   - baby.setApgarScore(as);
395   - baby.setBabyGender("男".equals(allFm.getBABY_SEX()) ? "1" : "0");
396   - Integer babyHeight = allFm.getBABY_HEIGHT();
397   - Integer babyWeight = allFm.getBABY_WEIGHT();
398   - Integer baby_Asphyxiam = allFm.getBABY_ASPHYXIAM();
399   - if(babyHeight!=null){
400   - baby.setBabyHeight(allFm.getBABY_HEIGHT().toString());//新生儿生长
401   - }
402   - if(babyWeight!=null){
403   - baby.setBabyWeight(allFm.getBABY_WEIGHT().toString());//新生儿重量
404   - }
405   - if(baby_Asphyxiam!=null){
406   - baby.setAsphyxiaM(allFm.getBABY_ASPHYXIAM().toString()); //窒息分钟
407   - }
408   -
409   - baby.setDeformity((allFm.getBABY_DEFORMITY()==null?0:1)); //畸形 0非畸形 1畸形
410   -
411   - String baby_Pregnancy_Out = allFm.getBABY_PREGNANCY_OUT();
412   - if(baby_Pregnancy_Out!=null && StringUtils.isNotEmpty(baby_Pregnancy_Out)){
413   - baby.setPregnancyOut(RenShenJieJuEnums.getIdByName(allFm.getBABY_PREGNANCY_OUT())); // 妊娠结局
414   - }
415   -
416   - baby.setDueTime(fmt.format(dueDate));//分娩时间
417   - babies.add(baby);
418   -
419   - }
420   - }else{
421   - a=1;
422   - //滦平服务器有分娩记录,但是在这边系统没有对应孕妇 取分娩信息建档儿童数据
423   - List<String> names = buildBabyName(allList);
424   -
425   - Date dateTime = fmt.parse(allFm.getBABY_DELIVERY_TIME());
426   - if(dateTime!=null){
427   - if (!com.lyms.platform.common.utils.StringUtils.isNotEmpty(allFm.getBABY_DELIVERY_TIME().toString())) {
428   - continue;
429   - }else{
430   - dueDate = dateTime;
431   - }
432   - }
433   -
434   - //String babyName = allFm.getNAME()+("男".equals(allFm.getBABY_SEX()) ? "之子" : "之女");
435   - String babyName = allFm.getNAME()+names.get(count).toString();
436   - FmItem fmitem=new FmItem();
437   - fmitem.setCcqk(allFm.getBABY_PREGNANCY_OUT());
438   - fmitem.setYexb(allFm.getBABY_SEX());
439   - fmitem.setRc(allFm.getDUE_WEEK());
440   - fmitem.setFmfs(allFm.getDELIVERY_MODE());
441   - Integer fetus_Num = allFm.getFETUS_NUM();
442   - if(fetus_Num!=null){
443   - fmitem.setDjt(allFm.getFETUS_NUM().toString());
444   - }
445   - fmitem.setCjc("");
446   - Integer babyHeight = allFm.getBABY_HEIGHT();
447   - Integer babyWeight = allFm.getBABY_WEIGHT();
448   - if(babyHeight!=null){
449   - fmitem.setSc(allFm.getBABY_HEIGHT().toString());
450   - }
451   - if(babyWeight!=null){
452   - fmitem.setTz(allFm.getBABY_WEIGHT().toString());
453   - }
454   - Integer pf1 = allFm.getBABY_APGAR_SCORE_ONE();
455   - Integer pf5 = allFm.getBABY_APGAR_SCORE_FIVE();
456   - Integer pf10 = allFm.getBABY_APGAR_SCORE_TEN();
457   - if(pf1!=null){
458   - fmitem.setYfz(allFm.getBABY_APGAR_SCORE_ONE().toString());
459   - }
460   - if(pf5!=null){
461   - fmitem.setWfz(allFm.getBABY_APGAR_SCORE_FIVE().toString());
462   - }
463   - if(pf10!=null){
464   - fmitem.setSfz(allFm.getBABY_APGAR_SCORE_TEN().toString());
465   - }
466   - fmitem.setSfgw("");
467   - Integer baby_Deformity = allFm.getBABY_DEFORMITY();
468   - if(baby_Deformity!=null){
469   - fmitem.setJx(allFm.getBABY_DEFORMITY().toString());
470   - }
471   - count+=1;
472   - buildBaby(fmitem, patient,allFm, dueDate, babyName);
473   -
474   - }
475   - }
476   -
477   - if(a==0){
478   - deliverAddRequest.setBabies(babies);
479   - deliverAddRequest.setFmHospital(HOSPITALID); //设置为德州妇幼
480   - ExceptionUtils.catchException("deliverAddRequest===" + deliverAddRequest);
481   - if(users!=null && users.size()>0){
482   - matDeliverFacade.addOrUpdateMatDeliver(deliverAddRequest, users.get(0).getId());
483   - }
484   - }
485   - }
486   - }
487   -
488   - } catch (Exception e) {
489   - ExceptionUtils.catchException(e, "sql执行异常");
490   - e.printStackTrace();
491   - }
492 118 }
493 119  
494 120 private List buildBabyName(List<Fm> items) {
495 121  
496 122  
... ... @@ -662,13 +288,285 @@
662 288  
663 289 public class saveFm implements Runnable{
664 290  
665   - private List<Fm> list;
  291 + private List<Fm> allList;
666 292  
667 293 public saveFm(List<Fm> list){
668   - this.list=list;
  294 + this.allList=list;
669 295 }
670 296  
671 297 public void run(){
  298 +
  299 + SimpleDateFormat fmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  300 + try {
  301 +
  302 + System.out.println("fm=" + allList.toString());
  303 + int a =0;//用来判断是否建了儿童档案,如果建了儿童档案就不保存分娩记录
  304 + int count = 0;
  305 + List<Users> users = new ArrayList<Users>();
  306 +
  307 + Date dueDate = null;
  308 + List<MatDeliverAddRequest.Baby> babies = new ArrayList<>();
  309 + MatDeliverAddRequest deliverAddRequest = new MatDeliverAddRequest();
  310 + for(Fm allFm:allList){
  311 +
  312 + a=0;
  313 + count=0;
  314 + if (!"活产".equals(allFm.getBABY_PREGNANCY_OUT()))
  315 + {
  316 + continue;
  317 + }
  318 + if (StringUtils.isEmpty(allFm.getPHONE()) && StringUtils.isEmpty(allFm.getIDCARD()))
  319 + {
  320 + continue;
  321 + }
  322 +
  323 + PatientsQuery query = new PatientsQuery();
  324 + query.setYn(YnEnums.YES.getId());
  325 + query.setType(1); //孕妇
  326 + query.setDueStatus(0); //未终止妊娠
  327 + String[] strs = new String[]{allFm.getPHONE(),allFm.getIDCARD()};
  328 + query.setPc(strs);
  329 +
  330 + //查询该孕妇是否在孕产婴系统中建档
  331 + List<Patients> patientses = patientsService.queryPatient(query);
  332 + Patients patient = new Patients();
  333 + if(CollectionUtils.isNotEmpty(patientses)){
  334 + ExceptionUtils.catchException("patientses"+patientses);
  335 + patient = patientses.get(0);
  336 + UsersQuery usersQuery = new UsersQuery();
  337 + usersQuery.setYn(YnEnums.YES.getId());
  338 + usersQuery.setOrgId(new Integer(Integer.parseInt(HOSPITALID)));
  339 + usersQuery.setName("产房");
  340 + users = usersService.queryUsers(usersQuery);
  341 +
  342 + if (CollectionUtils.isNotEmpty(users) && users.get(0).getId() != null) {
  343 +
  344 + Date dateTime = fmt.parse(allFm.getBABY_DELIVERY_TIME());
  345 + if(dateTime!=null){
  346 + if (!com.lyms.platform.common.utils.StringUtils.isNotEmpty(allFm.getBABY_DELIVERY_TIME().toString())) {
  347 + continue;
  348 + }else{
  349 + dueDate = dateTime;
  350 + }
  351 + }else{
  352 + continue;
  353 + }
  354 +
  355 + Map<String, Map<String,String>> map = new HashMap<>();
  356 + Map<String, String> map1 = new HashMap<>();
  357 + Map<String, String> map2 = new HashMap<>();
  358 + Map<String, String> map3 = new HashMap<>();
  359 + Map<String, String> totalMap = new HashMap<>();
  360 +
  361 + Integer prod_Process_One = allFm.getPROD_PROCESS_ONE();
  362 + Integer prod_Process_Two = allFm.getPROD_PROCESS_TWO();
  363 + Integer prod_Process_Three = allFm.getPROD_PROCESS_THREE();
  364 + if(prod_Process_One!=null){
  365 + map1.put("h",String.valueOf(prod_Process_One.intValue()/60));
  366 + map1.put("m",String.valueOf(prod_Process_One.intValue()%60));
  367 + map.put("one", map1);
  368 + }
  369 + if(prod_Process_Two!=null){
  370 + map2.put("h",String.valueOf(prod_Process_Two.intValue()/60));
  371 + map2.put("m",String.valueOf(prod_Process_Two.intValue()%60));
  372 + map.put("two",map2);
  373 + }
  374 + if(prod_Process_Three!=null){
  375 + map3.put("h",String.valueOf(prod_Process_Three.intValue()/60));
  376 + map3.put("m",String.valueOf(prod_Process_Three.intValue()%60));
  377 + map.put("three",map3);
  378 + }
  379 +
  380 + /* int hProcess = Integer.parseInt(allFm.getTOTAL_PROCESS())/60;//总产程小时数
  381 + int mProcess = Integer.parseInt(allFm.getTOTAL_PROCESS())%60;//总产程分钟数
  382 + totalMap.put("h",String.valueOf(hProcess));
  383 + totalMap.put("m",String.valueOf(mProcess));*/
  384 +
  385 + deliverAddRequest.setProdprocess(map);
  386 + deliverAddRequest.setTotalprocess(totalMap);
  387 + deliverAddRequest.setDeliverDoctor(allFm.getDELIVER_DOCTOR());
  388 + deliverAddRequest.setDueDate(DateUtil.getyyyy_MM_dd(dueDate));
  389 + deliverAddRequest.setParentId(patient.getId());
  390 + deliverAddRequest.setPid(patient.getPid());
  391 + deliverAddRequest.setOperationCause("-");
  392 + String week = "";
  393 + if (StringUtils.isNotEmpty(allFm.getDUE_WEEK())) {
  394 +
  395 + week = allFm.getDUE_WEEK() + "周";
  396 + if (StringUtils.isNotEmpty(allFm.getDUE_WEEK()) && StringUtils.isNotEmpty(allFm.getDUE_DAY()))
  397 + {
  398 + week += allFm.getDUE_DAY() + "天";
  399 + }
  400 +
  401 + deliverAddRequest.setDueWeek(week);
  402 + }
  403 +
  404 + deliverAddRequest.setTireNumber(allFm.getFETUS_NUM());// 胎数(之前赋值为死值1)
  405 + Integer placenta_Num = allFm.getPLACENTA_NUM();
  406 + if(placenta_Num!=null){
  407 + deliverAddRequest.setPlacenta(allFm.getPLACENTA_NUM().toString());// 胎盘(之前赋值为死值1)
  408 + }
  409 + if ("完好".equals(allFm.getPERINEAL_CONDITION()) || "".equals(allFm.getPERINEAL_CONDITION())) {
  410 + deliverAddRequest.setPerinealCondition("full");
  411 + } else if ("会阴切开".equals(allFm.getPERINEAL_CONDITION()) || "侧切".equals(allFm.getPERINEAL_CONDITION())) {
  412 + deliverAddRequest.setPerinealCondition("split");
  413 + }
  414 +
  415 + if ("一度裂伤".equals(allFm.getPERINEAL_CONDITION())) {
  416 + deliverAddRequest.setSiLielevel(1);
  417 + } else if ("二度裂伤".equals(allFm.getPERINEAL_CONDITION())) {
  418 + deliverAddRequest.setSiLielevel(2);
  419 + } else if ("三度裂伤".equals(allFm.getPERINEAL_CONDITION())) {
  420 + deliverAddRequest.setSiLielevel(3);
  421 + }
  422 +
  423 + Integer th_Lose = allFm.getTH_LOSE_BLOOD();
  424 + if(th_Lose!=null){
  425 + if (StringUtils.isNotEmpty(allFm.getTH_LOSE_BLOOD().toString())) {
  426 + deliverAddRequest.settHloseBloodL(Double.parseDouble(allFm.getTH_LOSE_BLOOD().toString()));
  427 + }
  428 + }
  429 +
  430 + Map deliveryMode = new HashMap(); //分娩方式
  431 +
  432 + String fmfs = "";
  433 + if (allFm.getDELIVERY_MODE() != null && "剖宫产".equals(allFm.getDELIVERY_MODE()))
  434 + {
  435 + fmfs = FmTypeEnums.O1.getId();
  436 + }
  437 + else
  438 + {
  439 + fmfs = FmTypeEnums.O.getId();
  440 + }
  441 + deliveryMode.put("fmfs",fmfs);
  442 + deliverAddRequest.setDeliveryMode(deliveryMode);
  443 + //胎盘信息
  444 + List<MaternalDeliverModel.ExtPlacenta> extPlacentas = new ArrayList<>();
  445 + MaternalDeliverModel.ExtPlacenta extPlacenta = new MaternalDeliverModel.ExtPlacenta();
  446 + String tpmcType = ""; //胎盘娩出方式
  447 + if ("手术产".equals(allFm.getTMCTYPE()) || "手取胎盘".equals(allFm.getTMCTYPE())) {
  448 + tpmcType = TpmcTypeEnums.O2.getId();
  449 + } else if ("自然产出".equals(allFm.getTMCTYPE()) || "自然娩出".equals(allFm.getTMCTYPE())) {
  450 + tpmcType = TpmcTypeEnums.O.getId();
  451 + }
  452 + extPlacenta.setTpmcType(tpmcType);
  453 + extPlacentas.add(extPlacenta);
  454 + deliverAddRequest.setExtPlacentas(extPlacentas);
  455 +
  456 +
  457 + //儿童
  458 + MatDeliverAddRequest.Baby baby = new MatDeliverAddRequest.Baby();
  459 + Map<String, String> as = new HashMap<>();
  460 + String pf1 = allFm.getSBABY_APGAR_SCORE_ONE();
  461 + String pf5 = allFm.getSBABY_APGAR_SCORE_FIVE();
  462 + String pf10 = allFm.getSBABY_APGAR_SCORE_TEN();
  463 + if(pf1!=null){
  464 + as.put("pf1", allFm.getSBABY_APGAR_SCORE_ONE());
  465 + }
  466 + if(pf5!=null){
  467 + as.put("pf5", allFm.getSBABY_APGAR_SCORE_FIVE());
  468 + }
  469 + if(pf10!=null){
  470 + as.put("pf10", allFm.getSBABY_APGAR_SCORE_TEN());
  471 + }
  472 +
  473 +
  474 + baby.setApgarScore(as);
  475 + baby.setBabyGender("男".equals(allFm.getBABY_SEX()) ? "1" : "0");
  476 + String babyHeight = allFm.getSBABY_HEIGHT();
  477 + String babyWeight = allFm.getSBABY_WEIGHT();
  478 + Integer baby_Asphyxiam = allFm.getBABY_ASPHYXIAM();
  479 + if(babyHeight!=null){
  480 + baby.setBabyHeight(allFm.getSBABY_HEIGHT());//新生儿生长
  481 + }
  482 + if(babyWeight!=null){
  483 + baby.setBabyWeight(allFm.getSBABY_WEIGHT());//新生儿重量
  484 + }
  485 + if(baby_Asphyxiam!=null){
  486 + baby.setAsphyxiaM(allFm.getBABY_ASPHYXIAM().toString()); //窒息分钟
  487 + }
  488 +
  489 + baby.setDeformity((allFm.getBABY_DEFORMITY()==null?0:1)); //畸形 0非畸形 1畸形
  490 +
  491 + String baby_Pregnancy_Out = allFm.getBABY_PREGNANCY_OUT();
  492 + if(baby_Pregnancy_Out!=null && StringUtils.isNotEmpty(baby_Pregnancy_Out)){
  493 + baby.setPregnancyOut(RenShenJieJuEnums.getIdByName(allFm.getBABY_PREGNANCY_OUT())); // 妊娠结局
  494 + }
  495 +
  496 + baby.setDueTime(fmt.format(dueDate));//分娩时间
  497 + babies.add(baby);
  498 +
  499 + }
  500 + }else{
  501 + a=1;
  502 + //滦平服务器有分娩记录,但是在这边系统没有对应孕妇 取分娩信息建档儿童数据
  503 + List<String> names = buildBabyName(allList);
  504 +
  505 + Date dateTime = fmt.parse(allFm.getBABY_DELIVERY_TIME());
  506 + if(dateTime!=null){
  507 + if (!com.lyms.platform.common.utils.StringUtils.isNotEmpty(allFm.getBABY_DELIVERY_TIME().toString())) {
  508 + continue;
  509 + }else{
  510 + dueDate = dateTime;
  511 + }
  512 + }
  513 +
  514 + //String babyName = allFm.getNAME()+("男".equals(allFm.getBABY_SEX()) ? "之子" : "之女");
  515 + String babyName = allFm.getNAME()+names.get(count).toString();
  516 + FmItem fmitem=new FmItem();
  517 + fmitem.setCcqk(allFm.getBABY_PREGNANCY_OUT());
  518 + fmitem.setYexb(allFm.getBABY_SEX());
  519 + fmitem.setRc(allFm.getDUE_WEEK());
  520 + fmitem.setFmfs(allFm.getDELIVERY_MODE());
  521 + Integer fetus_Num = allFm.getFETUS_NUM();
  522 + if(fetus_Num!=null){
  523 + fmitem.setDjt(allFm.getFETUS_NUM().toString());
  524 + }
  525 + fmitem.setCjc("");
  526 + String babyHeight = allFm.getSBABY_HEIGHT();
  527 + String babyWeight = allFm.getSBABY_WEIGHT();
  528 + if(babyHeight!=null){
  529 + fmitem.setSc(allFm.getSBABY_HEIGHT());
  530 + }
  531 + if(babyWeight!=null){
  532 + fmitem.setTz(allFm.getSBABY_WEIGHT());
  533 + }
  534 + String pf1 = allFm.getSBABY_APGAR_SCORE_ONE();
  535 + String pf5 = allFm.getSBABY_APGAR_SCORE_FIVE();
  536 + String pf10 = allFm.getSBABY_APGAR_SCORE_TEN();
  537 + if(pf1!=null){
  538 + fmitem.setYfz(allFm.getSBABY_APGAR_SCORE_ONE());
  539 + }
  540 + if(pf5!=null){
  541 + fmitem.setWfz(allFm.getSBABY_APGAR_SCORE_FIVE());
  542 + }
  543 + if(pf10!=null){
  544 + fmitem.setSfz(allFm.getSBABY_APGAR_SCORE_TEN());
  545 + }
  546 + fmitem.setSfgw("");
  547 + Integer baby_Deformity = allFm.getBABY_DEFORMITY();
  548 + if(baby_Deformity!=null){
  549 + fmitem.setJx(allFm.getBABY_DEFORMITY().toString());
  550 + }
  551 + count+=1;
  552 + buildBaby(fmitem, patient,allFm, dueDate, babyName);
  553 +
  554 + }
  555 + }
  556 +
  557 + if(a==0){
  558 + deliverAddRequest.setBabies(babies);
  559 + deliverAddRequest.setFmHospital(HOSPITALID); //设置为滦平妇幼
  560 + ExceptionUtils.catchException("deliverAddRequest===" + deliverAddRequest);
  561 + if(users!=null && users.size()>0){
  562 + matDeliverFacade.addOrUpdateMatDeliver(deliverAddRequest, users.get(0).getId());
  563 + }
  564 + }
  565 +
  566 + } catch (Exception e) {
  567 + ExceptionUtils.catchException(e, "sql执行异常");
  568 + e.printStackTrace();
  569 + }
672 570  
673 571 }
674 572 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/FmController.java View file @ c116981
... ... @@ -27,7 +27,7 @@
27 27 public BaseResponse saveLisData(@RequestBody List<Fm> models,
28 28 HttpServletRequest httpServletRequest){
29 29  
30   - //lpfyFmService.saveFmData(models);
  30 + lpfyFmService.queryFmPatient(models);
31 31  
32 32 return null;
33 33 }