Commit 346abd0e8a6d1b8b986607bd45aa35344095b5e1

Authored by liquanyu
1 parent 45bb5599a4

初诊修改优化

Showing 3 changed files with 157 additions and 132 deletions

platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/impl/PatientDaoImpl.java View file @ 346abd0
... ... @@ -41,7 +41,7 @@
41 41 public void updatePatientOneCol(String id, Object colValue) {
42 42 this.mongoTemplate.updateFirst(new Query(Criteria.where("id").is(id)), Update.update("nextCheckTime", colValue), Patients.class);
43 43 //为了使修改为空的时候能够同步到线上
44   - //updatePatient( findById(id), id);
  44 + updatePatient( findById(id), id);
45 45 }
46 46  
47 47 @Override
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/AntenatalExaminationService.java View file @ 346abd0
... ... @@ -18,7 +18,9 @@
18 18 import org.apache.commons.collections.CollectionUtils;
19 19 import org.apache.commons.lang.StringUtils;
20 20 import org.springframework.beans.factory.annotation.Autowired;
  21 +import org.springframework.beans.factory.annotation.Qualifier;
21 22 import org.springframework.data.domain.Sort;
  23 +import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
22 24 import org.springframework.stereotype.Service;
23 25 import org.springframework.util.Assert;
24 26  
25 27  
... ... @@ -41,7 +43,11 @@
41 43 @Autowired
42 44 private PatientsService patientsService;
43 45  
  46 + @Autowired
  47 + @Qualifier("commonThreadPool")
  48 + private ThreadPoolTaskExecutor commonThreadPool;
44 49  
  50 +
45 51 @Autowired
46 52 private AntExRecordService recordService;
47 53  
48 54  
49 55  
50 56  
51 57  
52 58  
53 59  
54 60  
55 61  
56 62  
57 63  
58 64  
59 65  
60 66  
61 67  
62 68  
63 69  
64 70  
65 71  
66 72  
67 73  
... ... @@ -142,118 +148,124 @@
142 148 * 的是否是节点中的首次节点
143 149 * @param pid
144 150 */
145   - public void handleCheckPoint(String pid)
  151 + public void handleCheckPoint(final String pid)
146 152 {
147   - if(StringUtils.isEmpty(pid)){
148   - return;
149   - }
150   - PatientsQuery patientsQuery = new PatientsQuery();
151   - patientsQuery.setYn(YnEnums.YES.getId());
152   - patientsQuery.setPid(pid);
153   - List<Patients> pats = patientsService.queryPatient1(patientsQuery,"created");
  153 + commonThreadPool.execute(new Runnable() {
  154 + @Override
  155 + public void run() {
  156 + if(StringUtils.isEmpty(pid)){
  157 + return;
  158 + }
  159 + PatientsQuery patientsQuery = new PatientsQuery();
  160 + patientsQuery.setYn(YnEnums.YES.getId());
  161 + patientsQuery.setPid(pid);
  162 + List<Patients> pats = patientsService.queryPatient1(patientsQuery,"created");
154 163  
155   - Map<String,List<Patients>> temps = new HashMap<String, List<Patients>>();
  164 + Map<String,List<Patients>> temps = new HashMap<String, List<Patients>>();
156 165  
157   - if (CollectionUtils.isNotEmpty(pats))
158   - {
159   - for(Patients pat : pats)
160   - {
161   - if (pat.getLastMenses() != null)
  166 + if (CollectionUtils.isNotEmpty(pats))
162 167 {
163   - Object obj = temps.get(DateUtil.getyyyy_MM_dd(pat.getLastMenses()));
164   - if (obj != null)
  168 + for(Patients pat : pats)
165 169 {
166   - List<Patients> cc = (List<Patients>)obj;
167   - cc.add(pat);
168   - temps.put(DateUtil.getyyyy_MM_dd(pat.getLastMenses()),cc);
  170 + if (pat.getLastMenses() != null)
  171 + {
  172 + Object obj = temps.get(DateUtil.getyyyy_MM_dd(pat.getLastMenses()));
  173 + if (obj != null)
  174 + {
  175 + List<Patients> cc = (List<Patients>)obj;
  176 + cc.add(pat);
  177 + temps.put(DateUtil.getyyyy_MM_dd(pat.getLastMenses()),cc);
  178 + }
  179 + else
  180 + {
  181 + List<Patients> cc = new ArrayList<Patients>();
  182 + cc.add(pat);
  183 + temps.put(DateUtil.getyyyy_MM_dd(pat.getLastMenses()),cc);
  184 + }
  185 + }
169 186 }
170   - else
171   - {
172   - List<Patients> cc = new ArrayList<Patients>();
173   - cc.add(pat);
174   - temps.put(DateUtil.getyyyy_MM_dd(pat.getLastMenses()),cc);
175   - }
176 187 }
177   - }
178   - }
179 188  
180   - if (!temps.isEmpty())
181   - {
182   - for(String key : temps.keySet())
183   - {
184   - List<String> ids = new ArrayList<String>();
185   - List<Patients> patientses = temps.get(key);
186   - if (CollectionUtils.isNotEmpty(patientses))
  189 + if (!temps.isEmpty())
187 190 {
188   - for(Patients patients : patientses)
  191 + for(String key : temps.keySet())
189 192 {
190   - ids.add(patients.getId());
191   - }
192   - }
193   -
194   - if (CollectionUtils.isNotEmpty(ids))
195   - {
196   - AntExRecordQuery antExRecordQuery = new AntExRecordQuery();
197   - antExRecordQuery.setParentIds(ids);
198   - for (int i = 0 ; i < 7 ; i++)
199   - {
200   - if (i == 0)
  193 + List<String> ids = new ArrayList<String>();
  194 + List<Patients> patientses = temps.get(key);
  195 + if (CollectionUtils.isNotEmpty(patientses))
201 196 {
202   - antExRecordQuery.setcDueWeekStart(0);
203   - antExRecordQuery.setcDueWeekEnd((12 + 1) * 7 - 1);
  197 + for(Patients patients : patientses)
  198 + {
  199 + ids.add(patients.getId());
  200 + }
204 201 }
205   - else if (i == 1)
206   - {
207   - antExRecordQuery.setcDueWeekStart(13*7);
208   - antExRecordQuery.setcDueWeekEnd((15 + 1) * 7 - 1);
209   - }
210   - else if (i == 2)
211   - {
212   - antExRecordQuery.setcDueWeekStart(16*7);
213   - antExRecordQuery.setcDueWeekEnd((20 + 1) * 7 - 1);
214   - }
215   - else if (i == 3)
216   - {
217   - antExRecordQuery.setcDueWeekStart(21*7);
218   - antExRecordQuery.setcDueWeekEnd((24 + 1) * 7 - 1);
219   - }
220   - else if (i == 4)
221   - {
222   - antExRecordQuery.setcDueWeekStart(25*7);
223   - antExRecordQuery.setcDueWeekEnd((27 + 1) * 7 - 1);
224   - }
225   - else if (i == 5)
226   - {
227   - antExRecordQuery.setcDueWeekStart(28*7);
228   - antExRecordQuery.setcDueWeekEnd((36 + 1) * 7 - 1);
229   - }
230   - else if (i == 6)
231   - {
232   - antExRecordQuery.setcDueWeekStart(37*7);
233   - antExRecordQuery.setcDueWeekEnd((40 + 1) * 7 - 1);
234   - }
235 202  
236   - List<AntExRecordModel> list = recordService.queryAntExRecords(antExRecordQuery);
237   - if (CollectionUtils.isNotEmpty(list))
  203 + if (CollectionUtils.isNotEmpty(ids))
238 204 {
239   - for (int j = 0 ; j < list.size() ; j++)
  205 + AntExRecordQuery antExRecordQuery = new AntExRecordQuery();
  206 + antExRecordQuery.setParentIds(ids);
  207 + for (int i = 0 ; i < 7 ; i++)
240 208 {
241   - AntExRecordModel m = list.get(j);
242   - if (j == (list.size() - 1))
  209 + if (i == 0)
243 210 {
244   - m.setIsFirst(1);
  211 + antExRecordQuery.setcDueWeekStart(0);
  212 + antExRecordQuery.setcDueWeekEnd((12 + 1) * 7 - 1);
245 213 }
246   - else
  214 + else if (i == 1)
247 215 {
248   - m.setIsFirst(2);
  216 + antExRecordQuery.setcDueWeekStart(13*7);
  217 + antExRecordQuery.setcDueWeekEnd((15 + 1) * 7 - 1);
249 218 }
250   - recordService.updateOne(m,m.getId());
  219 + else if (i == 2)
  220 + {
  221 + antExRecordQuery.setcDueWeekStart(16*7);
  222 + antExRecordQuery.setcDueWeekEnd((20 + 1) * 7 - 1);
  223 + }
  224 + else if (i == 3)
  225 + {
  226 + antExRecordQuery.setcDueWeekStart(21*7);
  227 + antExRecordQuery.setcDueWeekEnd((24 + 1) * 7 - 1);
  228 + }
  229 + else if (i == 4)
  230 + {
  231 + antExRecordQuery.setcDueWeekStart(25*7);
  232 + antExRecordQuery.setcDueWeekEnd((27 + 1) * 7 - 1);
  233 + }
  234 + else if (i == 5)
  235 + {
  236 + antExRecordQuery.setcDueWeekStart(28*7);
  237 + antExRecordQuery.setcDueWeekEnd((36 + 1) * 7 - 1);
  238 + }
  239 + else if (i == 6)
  240 + {
  241 + antExRecordQuery.setcDueWeekStart(37*7);
  242 + antExRecordQuery.setcDueWeekEnd((40 + 1) * 7 - 1);
  243 + }
  244 +
  245 + List<AntExRecordModel> list = recordService.queryAntExRecords(antExRecordQuery);
  246 + if (CollectionUtils.isNotEmpty(list))
  247 + {
  248 + for (int j = 0 ; j < list.size() ; j++)
  249 + {
  250 + AntExRecordModel m = list.get(j);
  251 + if (j == (list.size() - 1))
  252 + {
  253 + m.setIsFirst(1);
  254 + }
  255 + else
  256 + {
  257 + m.setIsFirst(2);
  258 + }
  259 + recordService.updateOne(m,m.getId());
  260 + }
  261 + }
251 262 }
252 263 }
253 264 }
254 265 }
255 266 }
256   - }
  267 + });
  268 +
257 269 }
258 270  
259 271  
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AntenatalExaminationFacade.java View file @ 346abd0
... ... @@ -225,7 +225,7 @@
225 225 p1.setLastCheckEmployeeId(patients.getLastCheckEmployeeId());
226 226  
227 227 patientsService.updatePatient(p1);
228   - //--patientsService.updatePatientOneCol(masterPatients.getId(), com.lyms.platform.common.utils.StringUtils.isEmpty(nextCheckTime) ? null : DateUtil.parseYMD(nextCheckTime));
  228 + patientsService.updatePatientOneCol(masterPatients.getId(), com.lyms.platform.common.utils.StringUtils.isEmpty(nextCheckTime) ? null : DateUtil.parseYMD(nextCheckTime));
229 229 } else {
230 230 PatientsQuery patientsQuery1 = new PatientsQuery();
231 231 patientsQuery1.setSource(parentId);
... ... @@ -250,7 +250,7 @@
250 250 p1.setServiceStatus(patients.getServiceStatus());
251 251 p1.setLastCheckEmployeeId(patients.getLastCheckEmployeeId());
252 252 patientsService.updatePatient(p1);
253   - //--patientsService.updatePatientOneCol(p.getId(), com.lyms.platform.common.utils.StringUtils.isEmpty(nextCheckTime) ? null : DateUtil.parseYMD(nextCheckTime));
  253 + patientsService.updatePatientOneCol(p.getId(), com.lyms.platform.common.utils.StringUtils.isEmpty(nextCheckTime) ? null : DateUtil.parseYMD(nextCheckTime));
254 254 }
255 255 }
256 256 }
257 257  
... ... @@ -451,10 +451,10 @@
451 451 * @param excAddRequest
452 452 * @return
453 453 */
454   - public BaseResponse addOneAnetExChu(AntExcAddRequest excAddRequest, Integer userId) {
  454 + public BaseResponse addOneAnetExChu(final AntExcAddRequest excAddRequest, final Integer userId) {
455 455 StopWatch stopWatch = new StopWatch("addOneAnetExChu");
456 456  
457   - String hospitalId = autoMatchFacade.getHospitalId(userId);
  457 + final String hospitalId = autoMatchFacade.getHospitalId(userId);
458 458 /** 验证产检券是否可用 可用就改为已使用状态 */
459 459 if (StringUtils.isNotBlank(excAddRequest.getCouponCode()) && excAddRequest.getCouponType() != null) {
460 460 stopWatch.start("couponService.validate");
461 461  
462 462  
463 463  
464 464  
465 465  
466 466  
467 467  
... ... @@ -482,28 +482,36 @@
482 482 antenatalExaminationService.updateAntExChu(antExChuModel, antExChuModel.getId());
483 483  
484 484 antenatalExaminationService.updatePatientAbortion(antExChuModel.getId(), antExChuModel.getAbortionZR(), antExChuModel.getAbortionRG());
  485 + commonThreadPool.execute(new Runnable() {
  486 + @Override
  487 + public void run() {
485 488  
486   - Patients patients = patientsService.findOnePatientById(excAddRequest.getParentId());
487   - patients.setLastCheckEmployeeId(excAddRequest.getProdDoctor());
  489 + Patients patients = patientsService.findOnePatientById(excAddRequest.getParentId());
  490 + patients.setLastCheckEmployeeId(excAddRequest.getProdDoctor());
488 491  
489   - if (StringUtils.isNotEmpty(patients.getEnable()) && "0".equals(patients.getEnable())) {
490   - patients.setEnable("1");
491   - }
492   - //修改患者风险等级
493   -// updatePatientRiskLevel(antExChuModel, patients);
494   - patientsService.updateNextCheckTime(excAddRequest.getNextCheckTime(), patients.getId());
495   - patientsService.updatePatient(patients);
  492 + if (StringUtils.isNotEmpty(patients.getEnable()) && "0".equals(patients.getEnable())) {
  493 + patients.setEnable("1");
  494 + }
496 495  
  496 + patientsService.updateNextCheckTime(excAddRequest.getNextCheckTime(), patients.getId());
  497 + patientsService.updatePatient(patients);
497 498  
498   - //修改本系统最后的高危
499   - updateLastRisk(patients.getId());
500   - //修改本院最后一次定义高危
501   - updateLastRhTime(patients.getId(), hospitalId);
502 499  
503   - setLashCTimes(antExChuModel.getParentId());
  500 + //修改本系统最后的高危
  501 + updateLastRisk(patients.getId());
  502 + //修改本院最后一次定义高危
  503 + updateLastRhTime(patients.getId(), hospitalId);
504 504  
505   - antenatalExaminationService.updateAntExRecord(antExChuModel.getId(), 1);
  505 + setLashCTimes(excAddRequest.getParentId());
506 506  
  507 + antenatalExaminationService.updateAntExRecord(excAddRequest.getId(), 1);
  508 +
  509 + //修改数据
  510 + syncMaster(excAddRequest.getParentId(), excAddRequest.getNextCheckTime());
  511 + }
  512 + });
  513 +
  514 +
507 515 AntExChuQuery antExChuQuery = new AntExChuQuery();
508 516 antExChuQuery.setYn(YnEnums.YES.getId());
509 517 antExChuQuery.setId(antExChuModel.getId());
... ... @@ -511,8 +519,6 @@
511 519  
512 520 operateLogFacade.addModifyOptLog(userId, Integer.parseInt(hospitalId), list.get(0), antExChuModel, OptActionEnums.UPDATE.getId(), "修改初诊");
513 521  
514   - //修改数据
515   - syncMaster(excAddRequest.getParentId(), excAddRequest.getNextCheckTime());
516 522 } else {
517 523 AntExChuQuery antExChuQuery1 = new AntExChuQuery();
518 524 antExChuQuery1.setParentId(excAddRequest.getParentId());
... ... @@ -522,7 +528,7 @@
522 528 stopWatch.stop();
523 529  
524 530 if (CollectionUtils.isEmpty(data1)) {
525   - Patients patients = patientsService.findOnePatientById(excAddRequest.getParentId());
  531 + final Patients patients = patientsService.findOnePatientById(excAddRequest.getParentId());
526 532 PatientsQuery patientsQuery = new PatientsQuery();
527 533 patientsQuery.setPid(patients.getPid());
528 534 patientsQuery.setYn(YnEnums.YES.getId());
529 535  
530 536  
531 537  
532 538  
533 539  
... ... @@ -549,30 +555,37 @@
549 555 stopWatch.start("queryAntExChu");
550 556 antenatalExaminationService.addOneAntEx(antExChuModel);
551 557  
  558 + final String chuId = antExChuModel.getId();
  559 + final String chuParentId = antExChuModel.getParentId();
552 560  
553   - operateLogFacade.addAddOptLog(userId, Integer.parseInt(hospitalId), antExChuModel, OptActionEnums.ADD.getId(), "添加初诊");
  561 + commonThreadPool.execute(new Runnable() {
  562 + @Override
  563 + public void run() {
  564 + // stopWatch.stop();
  565 + /** 把优惠券设置为已使用状态 */
  566 + //stopWatch.start("couponService.use");
  567 + couponService.use(hospitalId, excAddRequest.getCouponCode(), userId, chuId);
  568 + //stopWatch.stop();
  569 + //修改患者风险等级
554 570  
555   - stopWatch.stop();
556   - /** 把优惠券设置为已使用状态 */
557   - stopWatch.start("couponService.use");
558   - couponService.use(hospitalId, excAddRequest.getCouponCode(), userId, antExChuModel.getId());
559   - stopWatch.stop();
560   - //修改患者风险等级
  571 + patients.setLastCheckEmployeeId(excAddRequest.getProdDoctor());
  572 + patientsService.updateNextCheckTime(excAddRequest.getNextCheckTime(), patients.getId());
  573 + patientsService.updatePatient(patients);
561 574  
562   - patients.setLastCheckEmployeeId(excAddRequest.getProdDoctor());
563   - patientsService.updateNextCheckTime(excAddRequest.getNextCheckTime(), patients.getId());
564   - patientsService.updatePatient(patients);
  575 + updateLastRisk(patients.getId());
565 576  
566   - updateLastRisk(patients.getId());
  577 + //修改本院最后一次定义高危
  578 + updateLastRhTime(patients.getId(), hospitalId);
  579 + setLashCTimes(chuParentId);
  580 + //stopWatch.start("updateAntExRecord");
  581 + antenatalExaminationService.updateAntExRecord(chuId, 1);
  582 + //stopWatch.stop();
  583 + syncMaster(excAddRequest.getParentId(), excAddRequest.getNextCheckTime());
  584 + }
  585 + });
567 586  
568   - //修改本院最后一次定义高危
569   - updateLastRhTime(patients.getId(), hospitalId);
570   - setLashCTimes(antExChuModel.getParentId());
571   - stopWatch.start("updateAntExRecord");
572   - antenatalExaminationService.updateAntExRecord(antExChuModel.getId(), 1);
573   - stopWatch.stop();
574   - syncMaster(excAddRequest.getParentId(), excAddRequest.getNextCheckTime());
575   - logger.info(stopWatch.toString());
  587 + operateLogFacade.addAddOptLog(userId, Integer.parseInt(hospitalId), antExChuModel, OptActionEnums.ADD.getId(), "添加初诊");
  588 +
576 589 if (null != patients.getBuildType() && patients.getBuildType() == 3) {
577 590 Patients patients1 = new Patients();
578 591 patients1.setEnable("1");