Commit f9caed9bdc39a9b1f029cc29f66aaaecc744e469

Authored by cfl
1 parent 175aeba695
Exists in master and in 2 other branches dev, luanping

增加自动建档生成初检记录功能

Showing 3 changed files with 201 additions and 11 deletions

platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/RemoteController.java View file @ f9caed9
... ... @@ -3,6 +3,7 @@
3 3 import com.fasterxml.jackson.annotation.JsonAlias;
4 4 import com.lyms.platform.biz.service.ArchiveDataServicer;
5 5 import com.lyms.platform.biz.service.BasicConfigService;
  6 +import com.lyms.platform.biz.service.GuidelinesService;
6 7 import com.lyms.platform.biz.service.PatientsService;
7 8 import com.lyms.platform.common.annotation.TokenRequired;
8 9 import com.lyms.platform.common.base.BaseController;
9 10  
... ... @@ -14,9 +15,11 @@
14 15 import com.lyms.platform.common.result.BaseResponse;
15 16 import com.lyms.platform.common.result.RespBuilder;
16 17 import com.lyms.platform.common.utils.*;
  18 +import com.lyms.platform.operate.web.facade.AntenatalExaminationFacade;
17 19 import com.lyms.platform.operate.web.facade.AutoMatchFacade;
18 20 import com.lyms.platform.operate.web.facade.BookbuildingFacade;
19 21 import com.lyms.platform.operate.web.facade.RemoteFacade;
  22 +import com.lyms.platform.operate.web.request.AntExcAddRequest;
20 23 import com.lyms.platform.operate.web.request.WomanBookArchiveRequest;
21 24 import com.lyms.platform.operate.web.request.YunBookbuildingAddRequest;
22 25 import com.lyms.platform.operate.web.utils.CommonsHelper;
... ... @@ -26,6 +29,7 @@
26 29 import com.lyms.platform.permission.service.AssistBuildService;
27 30 import com.lyms.platform.pojo.*;
28 31 import com.lyms.platform.query.ArchiveDataQuery;
  32 +import com.lyms.platform.query.GuidelinesQuery;
29 33 import com.lyms.platform.query.PatientsQuery;
30 34 import org.apache.commons.collections.CollectionUtils;
31 35 import org.apache.commons.httpclient.HttpClient;
32 36  
... ... @@ -64,8 +68,13 @@
64 68 private BasicConfigService basicConfigService;
65 69 @Autowired
66 70 private AutoMatchFacade autoMatchFacade;
  71 + @Autowired
  72 + private AntenatalExaminationFacade antenatalExaminationFacade;
67 73  
68 74 @Autowired
  75 + private GuidelinesService guidelinesService;
  76 +
  77 + @Autowired
69 78 private RemoteFacade remoteFacade;
70 79  
71 80 @Autowired
72 81  
... ... @@ -313,11 +322,14 @@
313 322 ArchiveUsers archiveUsers = JsonUtil.jkstr2Obj(archiveUser, ArchiveUsers.class);
314 323 ArchiveAreas resort = JsonUtil.jkstr2Obj(healthResort, ArchiveAreas.class);
315 324 ArchiveHistoryDTO archiveHistory = JsonUtil.jkstr2Obj(archiveHistoryDTO, ArchiveHistoryDTO.class);
316   - //组装建档保存
  325 +
  326 + final String idCard = archiveUsers.getIdCard();
  327 + final String assistUserId = archiveUsers.getAssistUserId();
  328 + //组装建档保存参数
317 329 YunBookbuildingAddRequest request = new YunBookbuildingAddRequest();
318 330 request.setHospitalId(archiveUsers.getHospitalId());
319 331 request.setPregnantName(archiveUsers.getName());
320   - request.setPregnantCertificateNum(archiveUsers.getIdCard());
  332 + request.setPregnantCertificateNum(idCard);
321 333 request.setPregnantCertificateTypeId("70ae1d93-2964-46bc-83fa-bec9ff605b1c");//身份证
322 334 request.setBirthday(DateUtil.getBirthFromIdCard(archiveUsers.getIdCard()));
323 335 request.setPregnantPhone(archiveUsers.getPhone());
324 336  
... ... @@ -343,8 +355,179 @@
343 355  
344 356 request.setContactName(archiveUsers.getContactName());
345 357 request.setContactPhone(archiveUsers.getContactPhone());
  358 + final String cDueWeek = request.getcDueWeek();
346 359  
347 360 BaseObjectResponse baseObjectResponse = bookbuildingFacade.addPregnantBookbuilding(request, Integer.valueOf(archiveUsers.getAssistUserId()), false);
  361 + new Thread(new Runnable() {
  362 + @Override
  363 + public void run() {
  364 + System.out.println("start auto generate antexc......");
  365 + try {
  366 + //查询预约建档信息
  367 + ArchiveDataQuery query = new ArchiveDataQuery();
  368 + query.setIdCard(idCard);
  369 + List<ArchiveData> list = archiveDataServicer.query(query.convertToQuery());
  370 + if (CollectionUtils.isNotEmpty(list)) {
  371 + Map map = JsonUtil.str2Obj(list.get(0).getJsonData(), HashMap.class);
  372 + Map<String, Object> history = (Map<String, Object>) map.get("history");
  373 +
  374 + PatientsQuery patientsQuery = new PatientsQuery();
  375 + patientsQuery.setYn(YnEnums.YES.getId());
  376 + patientsQuery.setType(1);
  377 + patientsQuery.setCardNo(idCard);
  378 + List<Patients> patientsList = patientsService.queryPatient(patientsQuery);
  379 + Patients patients = patientsList.get(0);
  380 +
  381 + AntExcAddRequest antExcAddRequest = new AntExcAddRequest();
  382 + antExcAddRequest.setOperaterUserId(assistUserId);
  383 + antExcAddRequest.setPid(patients.getPid());
  384 + antExcAddRequest.setParentId(patients.getId());
  385 + antExcAddRequest.setName(patients.getUsername());
  386 + antExcAddRequest.setCheckTime(DateUtil.getyyyy_MM_dd_hms(new Date()));
  387 + antExcAddRequest.setProdDoctor(assistUserId);
  388 + antExcAddRequest.setcDueWeek(cDueWeek);
  389 +
  390 + if (history.get("bp") != null) {
  391 + antExcAddRequest.setBp((Map) history.get("bp"));
  392 + }
  393 + // 既往史
  394 + if (history.get("pastHistory") != null) {
  395 + String pastHistory = history.get("pastHistory").toString();
  396 + if (StringUtils.isNotEmpty(pastHistory)) {
  397 + HashMap pastHistoryMap = JsonUtil.jkstr2Obj(pastHistory, HashMap.class);
  398 + antExcAddRequest.setPastHistory(pastHistoryMap);
  399 + }
  400 + }
  401 + // 家族史
  402 + if (history.get("familyHistory") != null) {
  403 + String familyHistory = history.get("familyHistory").toString();
  404 + if (StringUtils.isNotEmpty(familyHistory)) {
  405 + HashMap familyHistoryMap = JsonUtil.jkstr2Obj(familyHistory, HashMap.class);
  406 + antExcAddRequest.setFamilyHistory(familyHistoryMap);
  407 + }
  408 + }
  409 + //个人史
  410 + if (history.get("personalHistory") != null) {
  411 + String personalHistory = history.get("personalHistory").toString();
  412 + if (StringUtils.isNotEmpty(personalHistory)) {
  413 + HashMap personalHistoryMap = JsonUtil.jkstr2Obj(personalHistory, HashMap.class);
  414 + antExcAddRequest.setPersonalHistory(personalHistoryMap);
  415 + }
  416 + }
  417 + //妇科手术史
  418 + if (history.get("fksxHistory") != null) {
  419 + String fksxHistory = history.get("fksxHistory").toString();
  420 + if (StringUtils.isNotEmpty(fksxHistory)) {
  421 + HashMap fksxHistoryMap = JsonUtil.jkstr2Obj(fksxHistory, HashMap.class);
  422 + antExcAddRequest.setFksxHistory(fksxHistoryMap);
  423 + }
  424 + }
  425 + //本次妊娠情况
  426 + if (history.get("cestationInfo") != null) {
  427 + String cestationInfo = history.get("cestationInfo").toString();
  428 + if (StringUtils.isNotEmpty(cestationInfo)) {
  429 + HashMap cestationInfoMap = JsonUtil.jkstr2Obj(cestationInfo, HashMap.class);
  430 + antExcAddRequest.setCestationInfo(cestationInfoMap);
  431 + }
  432 + }
  433 + //叶酸服用情况
  434 + if (history.get("ysfyHistory") != null) {
  435 + String ysfyHistory = history.get("ysfyHistory").toString();
  436 + if (StringUtils.isNotEmpty(ysfyHistory)) {
  437 + HashMap ysfyHistoryMap = JsonUtil.jkstr2Obj(ysfyHistory, HashMap.class);
  438 + antExcAddRequest.setYsfyHistory(ysfyHistoryMap);
  439 + }
  440 + }
  441 + //传染病史
  442 + if (history.get("infectDiseases") != null) {
  443 + String infectDiseases = history.get("infectDiseases").toString();
  444 + if (StringUtils.isNotEmpty(infectDiseases)) {
  445 + HashMap infectDiseasesMap = JsonUtil.jkstr2Obj(infectDiseases, HashMap.class);
  446 + antExcAddRequest.setInfectDiseases(infectDiseasesMap);
  447 + }
  448 + }
  449 +
  450 + //剖宫产次数
  451 + if (history.get("planedProd") != null) {
  452 + antExcAddRequest.setPlanedProd((Integer) history.get("planedProd"));
  453 + }
  454 + //顺产次数
  455 + if (history.get("delivery") != null) {
  456 + antExcAddRequest.setDelivery((Integer) history.get("delivery"));
  457 + }
  458 + //引产次数
  459 + if (history.get("yinchan") != null) {
  460 + antExcAddRequest.setYinchan((Integer) history.get("yinchan"));
  461 + }
  462 + //流产
  463 + if (history.get("abortion") != null) {
  464 + antExcAddRequest.setAbortion((Integer) history.get("abortion"));
  465 + }
  466 + //自然流产
  467 + if (history.get("abortionZR") != null) {
  468 + antExcAddRequest.setAbortionZR((Integer) history.get("abortionZR"));
  469 + }
  470 + //人工流产
  471 + if (history.get("abortionRG") != null) {
  472 + antExcAddRequest.setAbortionRG((Integer) history.get("abortionRG"));
  473 + }
  474 + //药物流产
  475 + if (history.get("yaowu") != null) {
  476 + antExcAddRequest.setYaowu((Integer) history.get("yaowu"));
  477 + }
  478 +
  479 + //孕次
  480 + if (history.get("pregnancyTimes") != null) {
  481 + antExcAddRequest.setPregnancyTimes((Integer) history.get("pregnancyTimes"));
  482 + }
  483 + //产次
  484 + antExcAddRequest.setProdTime((antExcAddRequest.getDelivery() != null ? antExcAddRequest.getDelivery() : 0)
  485 + + (antExcAddRequest.getPlanedProd() != null ? antExcAddRequest.getPlanedProd() : 0)
  486 + + (antExcAddRequest.getYinchan() != null ? antExcAddRequest.getYinchan() : 0)
  487 + + (antExcAddRequest.getAbortion() != null ? antExcAddRequest.getAbortion() : 0)
  488 + );
  489 +
  490 + if (history.get("yqWeight") != null) {
  491 + antExcAddRequest.setYqweight(history.get("yqWeight").toString());
  492 + antExcAddRequest.setYqWeight(history.get("yqWeight").toString());
  493 + }
  494 + if (history.get("weight") != null) {
  495 + antExcAddRequest.setWeight(history.get("weight").toString());
  496 + ;
  497 + }
  498 + if (history.get("height") != null) {
  499 + antExcAddRequest.setHeight(history.get("height").toString());
  500 +
  501 + }
  502 + if (StringUtils.isNotEmpty(antExcAddRequest.getWeight()) && StringUtils.isNotEmpty(antExcAddRequest.getHeight())) {
  503 + Double wh = Double.parseDouble(antExcAddRequest.getHeight()) / 100;
  504 + Double shen = wh * wh;
  505 + Double bmi = Double.parseDouble(antExcAddRequest.getWeight()) / shen;
  506 + antExcAddRequest.setBaricIndex(bmi + "");
  507 + }
  508 + //指导意见
  509 + GuidelinesQuery guidelinesQuery = new GuidelinesQuery();
  510 + guidelinesQuery.setType(1);
  511 + guidelinesQuery.setMaxStart(5);
  512 + guidelinesQuery.setMinEnd(5);
  513 + List<Guidelines> guidelines = guidelinesService.queryGuidelines(guidelinesQuery);
  514 + StringBuilder stringBuilder = new StringBuilder(128);
  515 + if (CollectionUtils.isNotEmpty(list)) {
  516 + for (Guidelines guideline : guidelines) {
  517 + stringBuilder.append(guideline.getCategory()).append(" ").append(guideline.getContent()).append("\r\n");
  518 + }
  519 + antExcAddRequest.setGuide(stringBuilder.toString());
  520 + }
  521 +
  522 + BaseResponse baseResponse = antenatalExaminationFacade.addOneAnetExChu(antExcAddRequest, Integer.valueOf(assistUserId));
  523 + System.out.println("auto generate antexc end," + baseResponse.toString());
  524 + }
  525 + }catch (Exception e){
  526 + e.printStackTrace();
  527 + }
  528 + }
  529 + }).start();
  530 +
348 531 if(baseObjectResponse.getErrorcode()==ErrorCodeConstants.SUCCESS){
349 532 writeString(response,"success");
350 533 return;
... ... @@ -353,6 +536,8 @@
353 536 catch (Exception e)
354 537 {
355 538 writeString(response,"fail");
  539 + e.printStackTrace();
  540 + return;
356 541 }
357 542 writeString(response,"fail");
358 543 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AntExRecordFacade.java View file @ f9caed9
... ... @@ -1763,15 +1763,16 @@
1763 1763 String riskFactor) {
1764 1764 WxMeasureInfoModel wxMeasureInfo = new WxMeasureInfoModel();
1765 1765 boolean falg = true;
  1766 + List<String> fhrList = new ArrayList<>();
  1767 + if(StringUtils.isNotEmpty(fhr)) {
  1768 + String[] split = fhr.split(",");
  1769 + for (String s : split) {
  1770 + fhrList.add(s);
  1771 + }
  1772 + }
1766 1773 if (StringUtils.isNotEmpty(pid) && StringUtils.isNotEmpty(hospitalId)) {
1767 1774 if (isOpenAutoSaveAntenatal(hospitalId)) {
1768   - List<String> fhrList = new ArrayList<>();
1769   - if(StringUtils.isNotEmpty(fhr)) {
1770   - String[] split = fhr.split(",");
1771   - for (String s : split) {
1772   - fhrList.add(s);
1773   - }
1774   - }
  1775 +
1775 1776 System.out.println("inputWxData enter 1");
1776 1777 List<AntenatalExaminationModel> examinationModel = mongoTemplate.find(Query.query(Criteria.where("pid").is(pid)), AntenatalExaminationModel.class);
1777 1778 if (CollectionUtils.isNotEmpty(examinationModel)) {
... ... @@ -1984,7 +1985,10 @@
1984 1985 yumInfosMap.put("inputTime", DateUtil.getyyyy_MM_dd(new Date()));
1985 1986 yumInfosMap.put("fuh", fuh);
1986 1987 yumInfosMap.put("abdominalGirth", abdominalGirth);
1987   - yumInfosMap.put("fhr", fhr);
  1988 + if(CollectionUtils.isNotEmpty(fhrList)){
  1989 + yumInfosMap.put("fhr", JsonUtil.array2JsonString(fhrList));
  1990 + }
  1991 +
1988 1992 yumInfosMap.put("edema", edema);
1989 1993 yumInfosMap.put("nextTime", nextTime);
1990 1994 yumInfosMap.put("sieveType", sieveType);
... ... @@ -23,7 +23,8 @@
23 23 <!--<module>platform-data-api</module>-->
24 24 <module>platform-operate-api</module>
25 25 <!---->
26   -<!-- <module>platform-job-index</module>-->
  26 + <module>platform-job-index</module>
  27 +
27 28 <!-- <module>platform-report-api</module>-->
28 29 <module>platform-reportData</module>
29 30 <!-- <module>regional-etl</module>-->