Commit fbdf67285e6e23cb7a198228e20353df2ed14bc2
1 parent
2b1853276e
Exists in
master
and in
7 other branches
分娩作废产检劵
Showing 1 changed file with 35 additions and 37 deletions
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/AntExRecordService.java
View file @
fbdf672
1 | 1 | package com.lyms.platform.biz.service; |
2 | 2 | |
3 | 3 | import com.lyms.platform.biz.dal.IAntExRecordDao; |
4 | +import com.lyms.platform.biz.dal.IAntExRecordMDao; | |
4 | 5 | import com.lyms.platform.common.dao.operator.MongoQuery; |
5 | 6 | import com.lyms.platform.common.enums.YnEnums; |
7 | +import com.lyms.platform.common.utils.BeanUtils; | |
6 | 8 | import com.lyms.platform.common.utils.DateUtil; |
7 | 9 | import com.lyms.platform.common.utils.JsonUtil; |
8 | -import com.lyms.platform.pojo.AntExChuModel; | |
9 | -import com.lyms.platform.pojo.AntExRecordModel; | |
10 | -import com.lyms.platform.pojo.AntenatalExaminationModel; | |
11 | -import com.lyms.platform.pojo.Patients; | |
10 | +import com.lyms.platform.pojo.*; | |
12 | 11 | import com.lyms.platform.query.AntExChuQuery; |
13 | 12 | import com.lyms.platform.query.AntExQuery; |
14 | 13 | import com.lyms.platform.query.AntExRecordQuery; |
15 | 14 | |
... | ... | @@ -42,12 +41,40 @@ |
42 | 41 | private PatientsService patientsService; |
43 | 42 | @Autowired |
44 | 43 | private CommonService commonService; |
44 | + @Autowired | |
45 | + private IAntExRecordMDao iAntExRecordMDao; | |
45 | 46 | |
46 | 47 | public List aggregateOne(AntExRecordQuery antExRecordQuery) { |
47 | 48 | return antExRecordDao.aggregateOne(antExRecordQuery.convertToQuery()); |
48 | 49 | } |
49 | 50 | |
50 | 51 | |
52 | + private void handRecord( AntExRecordModel record ){ | |
53 | + AntExRecordQuery antExRecordQuery = new AntExRecordQuery(); | |
54 | + antExRecordQuery.setParentId(record.getParentId()); | |
55 | + antExRecordQuery.setcId(record.getCheckDoctor()); | |
56 | + antExRecordQuery.setfId(record.getfId()); | |
57 | + Integer count = count(antExRecordQuery); | |
58 | + if (null == count || 0 == count) { | |
59 | + antExRecordDao.addOneRecord(record); | |
60 | + } | |
61 | + antExRecordQuery.setfId(null); | |
62 | + count = iAntExRecordMDao.count(antExRecordQuery.convertToQuery()); | |
63 | + if (null == count || 0 == count) { | |
64 | + AntExPRecordModel pRecordModel=new AntExPRecordModel(); | |
65 | + BeanUtils.copy(record, pRecordModel); | |
66 | + Patients p = patientsService.findOnePatientById(pRecordModel.getParentId()); | |
67 | + pRecordModel.sethRisk(p.getRiskFactorId()); | |
68 | + pRecordModel.sethScore(p.getRiskScore()); | |
69 | + try { | |
70 | + List list1 = JsonUtil.toList(p.getRiskLevelId(), List.class); | |
71 | + pRecordModel.sethLevel(list1); | |
72 | + }catch (Exception e){ | |
73 | + } | |
74 | + iAntExRecordMDao.addOneRecord(pRecordModel); | |
75 | + } | |
76 | + } | |
77 | + | |
51 | 78 | /** |
52 | 79 | * 同步初诊和复诊记录到产检管理里面 |
53 | 80 | * |
... | ... | @@ -63,14 +90,7 @@ |
63 | 90 | for (AntenatalExaminationModel antEx : list) { |
64 | 91 | AntExRecordModel record = convert(antEx); |
65 | 92 | if (null != record) { |
66 | - AntExRecordQuery antExRecordQuery = new AntExRecordQuery(); | |
67 | - antExRecordQuery.setParentId(record.getParentId()); | |
68 | - antExRecordQuery.setcId(record.getCheckDoctor()); | |
69 | - antExRecordQuery.setfId(record.getfId()); | |
70 | - Integer count = count(antExRecordQuery); | |
71 | - if (null == count || 0 == count) { | |
72 | - antExRecordDao.addOneRecord(record); | |
73 | - } | |
93 | + handRecord(record); | |
74 | 94 | } |
75 | 95 | } |
76 | 96 | |
... | ... | @@ -85,14 +105,7 @@ |
85 | 105 | for (AntExChuModel antEx : antExChuModelList) { |
86 | 106 | AntExRecordModel record = convert(antEx); |
87 | 107 | if (null != record) { |
88 | - AntExRecordQuery antExRecordQuery = new AntExRecordQuery(); | |
89 | - antExRecordQuery.setParentId(record.getParentId()); | |
90 | - antExRecordQuery.setcId(record.getCheckDoctor()); | |
91 | - antExRecordQuery.setfId(record.getfId()); | |
92 | - Integer count = count(antExRecordQuery); | |
93 | - if (null == count || 0 == count) { | |
94 | - antExRecordDao.addOneRecord(record); | |
95 | - } | |
108 | + handRecord(record); | |
96 | 109 | } |
97 | 110 | } |
98 | 111 | } |
... | ... | @@ -108,14 +121,7 @@ |
108 | 121 | for (AntenatalExaminationModel antEx : list) { |
109 | 122 | AntExRecordModel record = convert(antEx); |
110 | 123 | if (null != record) { |
111 | - AntExRecordQuery antExRecordQuery = new AntExRecordQuery(); | |
112 | - antExRecordQuery.setPid(record.getPid()); | |
113 | - antExRecordQuery.setcId(record.getCheckDoctor()); | |
114 | - antExRecordQuery.setfId(record.getfId()); | |
115 | - Integer count = count(antExRecordQuery); | |
116 | - if (null == count || 0 == count) { | |
117 | - antExRecordDao.addOneRecord(record); | |
118 | - } | |
124 | + handRecord(record); | |
119 | 125 | } |
120 | 126 | } |
121 | 127 | |
... | ... | @@ -130,14 +136,7 @@ |
130 | 136 | for (AntExChuModel antEx : antExChuModelList) { |
131 | 137 | AntExRecordModel record = convert(antEx); |
132 | 138 | if (null != record) { |
133 | - AntExRecordQuery antExRecordQuery = new AntExRecordQuery(); | |
134 | - antExRecordQuery.setPid(record.getPid()); | |
135 | - antExRecordQuery.setcId(record.getCheckDoctor()); | |
136 | - antExRecordQuery.setfId(record.getfId()); | |
137 | - Integer count = count(antExRecordQuery); | |
138 | - if (null == count || 0 == count) { | |
139 | - antExRecordDao.addOneRecord(record); | |
140 | - } | |
139 | + handRecord(record); | |
141 | 140 | } |
142 | 141 | } |
143 | 142 | } |
... | ... | @@ -155,7 +154,6 @@ |
155 | 154 | AntExRecordQuery antExRecordQuery1 = new AntExRecordQuery(); |
156 | 155 | antExRecordQuery1.setPid(parentId); |
157 | 156 | antExRecordDao.findAndMove(antExRecordQuery1.convertToQuery()); |
158 | - | |
159 | 157 | |
160 | 158 | syncSingle(parentId); |
161 | 159 | } |