Commit 3b38c2e8e25f21416bcd6e530db4c4305dd91492

Authored by yangfei
1 parent dca8c9e50c

自动生成追访信息

Showing 2 changed files with 27 additions and 19 deletions

platform-dal/src/main/java/com/lyms/platform/pojo/Patients.java View file @ 3b38c2e
... ... @@ -329,7 +329,7 @@
329 329 private Integer fmWeek;
330 330 // 分娩方式
331 331 private String fmType;
332   -
  332 + //1-自动分娩
333 333 private Integer isAutoFm;
334 334  
335 335 // 是否发放过优惠券
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/TrackDownServiceImpl.java View file @ 3b38c2e
... ... @@ -92,7 +92,7 @@
92 92 PatientsQuery patientsQuery = new PatientsQuery();
93 93 patientsQuery.setBookbuildingDateStart(buildStart);
94 94 patientsQuery.setBookbuildingDateEnd(buildEnd);
95   - patientsQuery.setTypeList(Arrays.asList(1,3));
  95 + patientsQuery.setTypeList(Arrays.asList(1, 3));
96 96 patientsQuery.setYn(YnEnums.YES.getId());
97 97 patientsQuery.setNeed("need");
98 98 patientsQuery.setLimit(limit);
99 99  
100 100  
... ... @@ -136,20 +136,23 @@
136 136 List<Patients> patientsList = patientsService.queryPatient(patientsQuery);
137 137  
138 138 if (CollectionUtils.isNotEmpty(patientsList)) {
139   - temp.put("check", checkNum>0?1:2); // 婚检 1=勾勾 2=叉叉
  139 + temp.put("check", checkNum > 0 ? 1 : 2); // 婚检 1=勾勾 2=叉叉
140 140  
141 141 Patients patients = patientsList.get(0);
142 142 temp.put("bookbuild", 1); // 孕期建档 1=勾勾 2=叉叉
143 143 temp.put("bookbuildDate", DateUtil.getyyyy_MM_dd(patients.getBookbuildingDate()));
144   - if (patients.getType() == 3) {
145   - temp.put("fm", 1); // 孕期建档 1=勾勾 2=叉叉
  144 +
  145 +
  146 + if(patients.getDueStatus() == 1||patients.getIsAutoFm() == 1){//终止妊娠,或自动分娩
  147 + temp.put("fm", 2); // 分娩 1=勾勾 2=叉叉
  148 + }else if (patients.getType() == 3) {
  149 + temp.put("fm", 1); // 分娩 1=勾勾 2=叉叉
146 150 temp.put("fmType", patients.getFmType()); // 分娩方式 1: 顺产,2:剖宫产
147 151 }
148 152  
149 153 //孕检次数
150 154 temp.put("yjcount", mongoTemplate.count(Query.query(Criteria.where("parentId").is(patients.getId()).and("yn").is(1)), AntenatalExaminationModel.class) + mongoTemplate.count(Query.query(Criteria.where("parentId").is(patients.getId()).and("yn").is(1)), AntExChuModel.class));
151 155 if (patients.getType() == 3) {
152   -
153 156 //产后复查
154 157 PostReviewQuery postReviewQuery = new PostReviewQuery();
155 158 postReviewQuery.setParentId(patients.getId());
... ... @@ -158,8 +161,8 @@
158 161 if (postInt > 0) {//大于0
159 162 temp.put("chfc", 1);
160 163 temp.put("chfcCount", postInt); // 复查次数
161   - }else{
162   - if(patients.getDueStatus()==1){//终止妊娠
  164 + } else {
  165 + if (patients.getDueStatus() == 1) {//终止妊娠
163 166 //当前孕妇是孕28周后,进入产后复查追访,否则结束流程
164 167 int dueWeek = DateUtil.getWeek2(patients.getLastMenses(), patients.getFmDate());
165 168 if (dueWeek < 28) {//进入产后复查
... ... @@ -202,7 +205,7 @@
202 205 temp.put("chfc", 3);//产后复查空白
203 206 //婚检查询
204 207 Long checkNum = mongoTemplate.count(Query.query(Criteria.where("certificateNum").is(patient.getCardNo()).and("yn").is(1)), PremaritalCheckup.class);
205   - temp.put("check", checkNum>0?1:2); // 婚检 1=勾勾 2=叉叉
  208 + temp.put("check", checkNum > 0 ? 1 : 2); // 婚检 1=勾勾 2=叉叉
206 209  
207 210 //妇女查询条件
208 211 ResidentsArchiveQuery query = new ResidentsArchiveQuery();
209 212  
... ... @@ -211,11 +214,11 @@
211 214 query.setHospitalId(patient.getHospitalId());
212 215 //妇女建档主数据
213 216 List<ResidentsArchiveModel> residentCount = residentsArchiveService.queryResident(query);
214   - if(CollectionUtils.isNotEmpty(residentCount)){
  217 + if (CollectionUtils.isNotEmpty(residentCount)) {
215 218 ResidentsArchiveModel residentsArchiveModel = residentCount.get(0);
216 219 temp.put("resident", 1); // 妇女建档
217 220 temp.put("residentDate", DateUtil.getyyyy_MM_dd(residentsArchiveModel.getBuildDay())); // 妇女建档日期
218   - }else{
  221 + } else {
219 222 temp.put("resident", 2); // 妇女建档
220 223 }
221 224 temp.put("id", patient.getId());
... ... @@ -227,8 +230,12 @@
227 230 temp.put("bookbuildDate", DateUtil.getyyyy_MM_dd(patient.getBookbuildingDate()));
228 231 temp.put("bookbuild", 1); // 孕期建档 1=勾勾 2=叉叉
229 232  
230   - //已分娩
231   - if (patient.getType() == 3) {
  233 +
  234 +
  235 +
  236 + if(patient.getDueStatus() == 1||patient.getIsAutoFm() == 1){//终止妊娠,或自动分娩
  237 + temp.put("fm", 2); // 分娩 1=勾勾 2=叉叉
  238 + }else if (patient.getType() == 3) { //本院已分娩
232 239 temp.put("fm", 1); // 孕期建档 1=勾勾 2=叉叉
233 240 temp.put("fmType", patient.getFmType()); // 分娩方式 1: 顺产,2:剖宫产
234 241 }
... ... @@ -236,7 +243,7 @@
236 243 //孕检次数
237 244 temp.put("yjcount", mongoTemplate.count(Query.query(Criteria.where("parentId").is(patient.getId()).and("yn").is(1)), AntenatalExaminationModel.class) + mongoTemplate.count(Query.query(Criteria.where("parentId").is(patient.getId()).and("yn").is(1)), AntExChuModel.class));
238 245  
239   - if(patient.getType() == 3){//分娩后
  246 + if (patient.getType() == 3) {//分娩后
240 247 //产后复查
241 248 PostReviewQuery postReviewQuery = new PostReviewQuery();
242 249 postReviewQuery.setParentId(patient.getId());
... ... @@ -245,8 +252,8 @@
245 252 if (postInt > 0) {//大于0
246 253 temp.put("chfc", 1);
247 254 temp.put("chfcCount", postInt); // 复查次数
248   - }else{
249   - if(patient.getDueStatus()==1){//终止妊娠
  255 + } else {
  256 + if (patient.getDueStatus() == 1) {//终止妊娠
250 257 //当前孕妇是孕28周后,进入产后复查追访,否则结束流程
251 258 int dueWeek = DateUtil.getWeek2(patient.getLastMenses(), patient.getFmDate());
252 259 if (dueWeek < 28) {//进入产后复查
253 260  
... ... @@ -545,9 +552,10 @@
545 552 Map<String, Object> temp = new HashMap<>();
546 553 temp.put("trackDownDate", DateUtil.getyyyy_MM_dd(trackDown.getTrackDownDate()));
547 554 temp.put("trackDownUser", trackDown.getTrackDownUserId());
548   - temp.put("trackDownType", TrackDownTypeEnums.getName(trackDown.getTrackDownDateType()));
  555 + temp.put("trackDownType", TrackDownTypeEnums.getName(trackDown.getTrackDownType()));
549 556 temp.put("result", StringUtils.isEmpty(trackDown.getResult()) ? "--" : trackDown.getResult());
550   - temp.put("reservatDate", DateUtil.getyyyy_MM_dd(trackDown.getReservatDate()));
  557 + Date resDate = trackDown.getReservatDate();
  558 + temp.put("reservatDate", resDate == null ? "--" : DateUtil.getyyyy_MM_dd(trackDown.getReservatDate()));
551 559 temp.put("trackDownTransfer", trackDown.getTrackDownTransfer());
552 560 if (TrackDownDateEnums.A.getId().equals(trackDown.getTrackDownDateType())) {
553 561 hqjcList.add(temp);
... ... @@ -589,7 +597,7 @@
589 597 } else {
590 598 criteria.and("trackDownDateType").in(trackType);
591 599 }
592   - List<TrackDown> trackDowns = mongoTemplate.find(Query.query(criteria), TrackDown.class);
  600 + List<TrackDown> trackDowns = mongoTemplate.find(Query.query(criteria).with(new Sort(Sort.Direction.DESC, "created")), TrackDown.class);
593 601  
594 602 for (TrackDown trackDown : trackDowns) {
595 603 Map<String, Object> temp = new HashMap<>();