Commit 5f42901bbb35ed144179d18e51c80e9acc17677e

Authored by haorp
1 parent 513d583a32
Exists in dev

产妇建档

Showing 1 changed file with 41 additions and 61 deletions

platform-operate-api/src/main/java/com/lyms/platform/operate/web/matnRehabPC/service/impl/MatnRehabServiceImpl.java View file @ 5f42901
1 1 package com.lyms.platform.operate.web.matnRehabPC.service.impl;
2 2  
3   -import com.lyms.platform.biz.service.MatDeliverService;
4   -import com.lyms.platform.biz.service.PatientWeightService2;
5 3 import com.lyms.platform.biz.service.PatientsService;
6 4 import com.lyms.platform.common.constants.ErrorCodeConstants;
7 5 import com.lyms.platform.common.result.BaseObjectResponse;
8   -import com.lyms.platform.operate.web.facade.ViewFacade;
  6 +import com.lyms.platform.common.utils.DateUtil;
9 7 import com.lyms.platform.operate.web.matnRehabPC.service.MatnRehabService;
10 8 import com.lyms.platform.permission.model.MedicalRecordVo;
11 9 import com.lyms.platform.permission.model.PatientService;
12 10 import com.lyms.platform.permission.service.AppointmentService;
13 11 import com.lyms.platform.permission.service.PatientServiceService;
14   -import com.lyms.platform.pojo.MaternalDeliverModel;
15   -import com.lyms.platform.pojo.PatientWeight;
16 12 import com.lyms.platform.pojo.Patients;
17   -import com.lyms.platform.query.MatDeliverQuery;
18 13 import com.lyms.platform.query.PatientsQuery;
19 14 import org.apache.commons.collections.CollectionUtils;
20 15 import org.springframework.beans.factory.annotation.Autowired;
21   -import org.springframework.data.mongodb.core.query.Criteria;
22   -import org.springframework.data.mongodb.core.query.Query;
23 16 import org.springframework.stereotype.Service;
24 17  
25 18 import java.util.Date;
  19 +import java.util.HashMap;
26 20 import java.util.List;
27 21 import java.util.Map;
28 22  
... ... @@ -33,15 +27,6 @@
33 27 private PatientsService patientsService;
34 28  
35 29 @Autowired
36   - private ViewFacade viewFacade;
37   -
38   - @Autowired
39   - private MatDeliverService matDeliverService;
40   -
41   - @Autowired
42   - private PatientWeightService2 patientWeightService2;
43   -
44   - @Autowired
45 30 private AppointmentService appointmentService;
46 31  
47 32 @Autowired
48 33  
49 34  
50 35  
51 36  
52 37  
53 38  
... ... @@ -51,64 +36,59 @@
51 36 public BaseObjectResponse queryInfo(String phone) {
52 37 BaseObjectResponse baseObjectResponse = new BaseObjectResponse();
53 38 PatientsQuery patientsQuery = new PatientsQuery();
  39 + Map<String,Object> data = new HashMap<>();
54 40 // 查建档
55 41 patientsQuery.setPhone(phone);
56 42 patientsQuery.setType(3);
57 43 patientsQuery.setYn(1);
58 44 patientsQuery.setDesc("true");
59 45 patientsQuery.setSort("created");
  46 + patientsQuery.setHospitalId("2100002419");
60 47 List<Patients> patientsList = patientsService.queryPatient(patientsQuery);
61 48 if (CollectionUtils.isNotEmpty(patientsList)) {
62 49 Patients patients = patientsList.get(0);
63   - // 查分娩和复查表 给产后报告用
64   - MatDeliverQuery matDeliverQuery = new MatDeliverQuery();
65   - matDeliverQuery.setYn(1);
66   - matDeliverQuery.setParentId(patients.getId());
67   - matDeliverQuery.setPid(patients.getPid());
68   - List<MaternalDeliverModel> queryList = matDeliverService.query(matDeliverQuery);
69   - if (CollectionUtils.isNotEmpty(queryList)){
70   - MaternalDeliverModel model = queryList.get(0);
71   - baseObjectResponse =viewFacade.findMatDeliverData(model.getId());
72   - if(baseObjectResponse.getData() !=null){
73   - Map<String,Object> data = (Map<String, Object>) baseObjectResponse.getData();
74   - // 查体重表 给营养报告用
75   - List<PatientWeight> patientWeights = patientWeightService2.queryPatientWeight(Query.query(Criteria.where("patientId").is(patients.getId())));
76   - if(CollectionUtils.isNotEmpty(patientWeights)){
77   - PatientWeight patientWeight= patientWeights.get(0);
78   - data.put("patientWeight",patientWeight);
  50 + // 高危风险因素
  51 + if(CollectionUtils.isNotEmpty(patients.getRiskFactorId())){
  52 + data.put("rRisk",patients.getRiskFactorId());
  53 + }
  54 + // 产后
  55 + MedicalRecordVo medicalRecordVo = new MedicalRecordVo();
  56 + medicalRecordVo.setCardNo(patients.getCardNo());
  57 + medicalRecordVo.setPatientsType("0"); // 建档
  58 + // 诊断手术赋值
  59 + List<MedicalRecordVo> list = appointmentService.queryList(medicalRecordVo);
  60 + if(CollectionUtils.isNotEmpty(list)) {
  61 + MedicalRecordVo medicalRecordVo1 = list.get(0);
  62 + data.put("name", medicalRecordVo1.getName());
  63 + data.put("diagnosis", medicalRecordVo1.getMdtrtTag());
  64 + data.put("cardNo", medicalRecordVo1.getCardNo());
  65 + String age1 = medicalRecordVo1.getAge().substring(0, 8);
  66 + Date date = DateUtil.parseYYYYMMDD(age1);
  67 + int age = DateUtil.getYearSpace(new Date(), date);
  68 + medicalRecordVo1.setAge(String.valueOf(age));
  69 + data.put("age", String.valueOf(age));
  70 + data.put("weight", medicalRecordVo1.getWeight());
  71 + data.put("height", medicalRecordVo1.getHeight());
  72 + data.put("deliveryDate", medicalRecordVo1.getDeliveryTime());
  73 + }
  74 + // 查询服务是否开通
  75 + List<PatientService> patientServices = patientServiceService.getServiceListByParentId(patients.getId(),3);
  76 + if(CollectionUtils.isNotEmpty(patientServices)){
  77 + for (PatientService patientService : patientServices) {
  78 + // 产后康复服务对应码值
  79 + if(patientService.getSerType()==20){
  80 + data.put("serStatus","1");
79 81 }
80   -
81   - MedicalRecordVo medicalRecordVo = new MedicalRecordVo();
82   - medicalRecordVo.setCardNo(patients.getCardNo());
83   - // 诊断手术赋值
84   - List<MedicalRecordVo> list = appointmentService.queryList(medicalRecordVo);
85   - if(CollectionUtils.isNotEmpty(list)){
86   - MedicalRecordVo medicalRecordVo1 = list.get(0);
87   - data.put("diagnosis",medicalRecordVo1.getDiagnosis());
88   - data.put("operation",medicalRecordVo1.getOperation());
89   - }
90   -
91   - // 查询服务是否开通
92   - List<PatientService> patientServices = patientServiceService.getServiceListByParentId(patients.getId(),3);
93   - if(CollectionUtils.isNotEmpty(patientServices)){
94   - for (PatientService patientService : patientServices) {
95   - // 产后康复服务对应码值
96   - if(patientService.getSerType()==20){
97   - data.put("serStatus","1");
98   - }
99   - }
100   -
101   - }
102   - baseObjectResponse.setErrorcode(ErrorCodeConstants.SUCCESS);
103   - baseObjectResponse.setErrormsg("成功");
104   - baseObjectResponse.setData(data);
105 82 }
106   -
107   - return baseObjectResponse;
108 83 }
  84 + }else{
  85 + baseObjectResponse.setErrorcode(ErrorCodeConstants.SUCCESS);
  86 + baseObjectResponse.setErrormsg("该用户未建党,请核查");
  87 + baseObjectResponse.setData(data);
109 88 }
110 89 baseObjectResponse.setErrorcode(ErrorCodeConstants.SUCCESS);
111   - baseObjectResponse.setErrormsg("暂未符合要求的数据");
  90 + baseObjectResponse.setErrormsg("成功");
  91 + baseObjectResponse.setData(data);
112 92 return baseObjectResponse;
113 93  
114 94 }