Commit 9cfdc61678256f6d14daca3d2e6df14f2a066394

Authored by jiangjiazhi
1 parent 24fee11452

分娩作废产检劵

Showing 1 changed file with 28 additions and 146 deletions

platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AntExRecordFacade.java View file @ 9cfdc61
... ... @@ -18,6 +18,8 @@
18 18 import com.lyms.platform.operate.web.utils.FunvCommonUtil;
19 19 import com.lyms.platform.operate.web.utils.UnitConstants;
20 20 import com.lyms.platform.operate.web.utils.UnitUtils;
  21 +import com.lyms.platform.operate.web.worker.AntExRecordWorker;
  22 +import com.lyms.platform.operate.web.worker.WorkHR;
21 23 import com.lyms.platform.permission.model.Organization;
22 24 import com.lyms.platform.permission.model.OrganizationQuery;
23 25 import com.lyms.platform.permission.model.Users;
24 26  
... ... @@ -29,12 +31,16 @@
29 31 import org.apache.commons.collections.MapUtils;
30 32 import org.apache.commons.lang.math.NumberUtils;
31 33 import org.springframework.beans.factory.annotation.Autowired;
  34 +import org.springframework.beans.factory.annotation.Qualifier;
  35 +import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
32 36 import org.springframework.stereotype.Component;
33 37  
34 38 import javax.servlet.http.HttpServletResponse;
35 39 import java.io.IOException;
36 40 import java.io.OutputStream;
37 41 import java.util.*;
  42 +import java.util.concurrent.Future;
  43 +import java.util.concurrent.TimeUnit;
38 44  
39 45 /**
40 46 * 产检管理
... ... @@ -61,6 +67,9 @@
61 67 private OrganizationService organizationService;
62 68 @Autowired
63 69 private DataPermissionService dataPermissionService;
  70 + @Autowired
  71 + @Qualifier("commonThreadPool")
  72 + private ThreadPoolTaskExecutor commonThreadPool;
64 73  
65 74 public void syncAntRecordToList(String hospitalId) {
66 75 recordService.syncAntRecordToList(hospitalId);
... ... @@ -214,8 +223,7 @@
214 223 List<AntExManagerResult> data = new ArrayList<>();
215 224 List<AntExRecordModel> antExRecordModelList = recordService.queryAntExRecords(antExRecordQuery);
216 225 if (CollectionUtils.isNotEmpty(antExRecordModelList)) {
217   - for (AntExRecordModel e : antExRecordModelList) {
218   - AntExManagerResult antExManagerResult = new AntExManagerResult();
  226 + /*AntExManagerResult antExManagerResult = new AntExManagerResult();
219 227 antExManagerResult.convertToResult(e);
220 228 if (isRegion) {
221 229 //产检医院
222 230  
223 231  
... ... @@ -270,10 +278,26 @@
270 278 antExManagerResult.setChTimes(dichi);
271 279 //高危因素
272 280 antExManagerResult.setrLevel(commonService.findRiskLevel(e.gethLevel()));
273   - antExManagerResult.setRiskFactor(commonService.resloveFactor(e.gethRisk()));
  281 + antExManagerResult.setRiskFactor(commonService.resloveFactor(e.gethRisk()));*/
274 282  
275   - data.add(antExManagerResult);
  283 +
  284 + int batchSize = 4;
  285 + int end = 0;
  286 + List<Future> listFuture = new ArrayList<>();
  287 + for (int i = 0; i < antExRecordModelList.size(); i += batchSize) {
  288 + end = (end + batchSize);
  289 + if (end > antExRecordModelList.size()) {
  290 + end = antExRecordModelList.size();
  291 + }
  292 + listFuture.add(commonThreadPool.submit(new AntExRecordWorker(antExRecordModelList.subList(i, end), isRegion, organizationService, usersService, recordService, commonService, hospital, basicConfigService)));
276 293 }
  294 + for (Future f : listFuture) {
  295 + try {
  296 + data.addAll((List) f.get(30, TimeUnit.SECONDS));
  297 + } catch (Exception e) {
  298 + ExceptionUtils.catchException(e, "antexrecord findList get result future error.");
  299 + }
  300 + }
277 301 }
278 302 return new BaseListResponse().setData(data).setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功").setPageInfo(antExRecordQuery.getPageInfo());
279 303 }
... ... @@ -400,7 +424,6 @@
400 424 }
401 425 }
402 426 } else {
403   -// List<HashMap> list = patientsService.aggregateOne(patientsQuery1);
404 427 antExRecordQuery.setNeNullCheckDoctor(true);
405 428 List<HashMap> list = recordService.aggregateOne(antExRecordQuery);
406 429 for (HashMap map : list) {
... ... @@ -550,146 +573,5 @@
550 573 }
551 574  
552 575 }
553   -
554   -
555   - //查询复诊接口
556   - public BaseObjectResponse findAntenatalExamination(String id){
557   -
558   - BaseObjectResponse br = new BaseObjectResponse();
559   - if (org.apache.commons.lang.StringUtils.isEmpty(id)){
560   - br.setErrorcode(ErrorCodeConstants.PARAMETER_ERROR);
561   - br.setErrormsg("id为空");
562   - return br;
563   - }
564   -
565   - AntenatalExaminationModel data = antExService.findOneById(id);
566   - if (data==null || data.getYn()==YnEnums.NO.getId()){
567   - br.setErrorcode(ErrorCodeConstants.NO_DATA);
568   - br.setErrormsg("没有查询到数据");
569   - return br;
570   - }
571   -
572   -
573   - if (org.apache.commons.lang.StringUtils.isEmpty(data.getParentId())){
574   - br.setErrorcode(ErrorCodeConstants.PARAMETER_ERROR);
575   - br.setErrormsg("数据异常");
576   - return br;
577   - }
578   -
579   - Patients patients = patientsService.findOnePatientById(data.getParentId());
580   - if (patients==null || patients.getYn()==YnEnums.NO.getId()){
581   - br.setErrorcode(ErrorCodeConstants.PARAMETER_ERROR);
582   - br.setErrormsg("孕妇信息不存在");
583   - return br;
584   - }
585   -
586   - Map<String,Object> map= new HashMap<>();
587   - /* 基本信息 */
588   - //孕妇基本信息
589   - map.put("id",data.getId());
590   - map.put("username",patients.getUsername());
591   - map.put("birth",DateUtil.getyyyy_MM_dd(patients.getBirth()));
592   - map.put("age",DateUtil.getAge(patients.getBirth()));
593   - map.put("phone",patients.getPhone());
594   - map.put("fmWeek",patients.getFmWeek());
595   - map.put("dueDate",DateUtil.getyyyy_MM_dd(patients.getDueDate()));
596   - map.put("mremark",patients.getMremark());
597   - map.put("oRiskFactor",patients.getoRiskFactor());
598   - map.put("riskScore",patients.getRiskScore());
599   - //产检基本信息
600   - map.put("checkDate",DateUtil.getyyyy_MM_dd(data.getCheckDate()));
601   - map.put("currentDueDate",data.getCurrentDueDate());
602   - map.put("checkDoctor", data.getCheckDoctor());
603   - String hospital = "";
604   - if (org.apache.commons.lang.StringUtils.isNotEmpty(data.getHospitalId())){
605   - Organization organization = organizationService.getOrganization(Integer.parseInt(data.getHospitalId()));
606   - if (organization!=null && organization.getYn()==YnEnums.YES.getId()){
607   - hospital = organization.getName();
608   - }
609   - }
610   - map.put("hospital", hospital);
611   - map.put("nextCheckTime",DateUtil.getyyyy_MM_dd(data.getNextCheckTime()));
612   - map.put("cDueWeek", data.getcDueWeek());
613   -
614   - /* 复诊信息 */
615   - map.put("chiefComplaint", data.getChiefComplaint());
616   - map.put("weight", UnitUtils.unitSplice(data.getWeight(), UnitConstants.KG));
617   - // 血压
618   - String ssy = "";
619   - String szy = "";
620   - Map<String, String> chBpMap = JsonUtil.getMap(data.getBp());
621   - if (MapUtils.isNotEmpty(chBpMap)) {
622   - ssy = chBpMap.get("ssy");
623   - szy = chBpMap.get("szy");
624   - }
625   - map.put("bp", UnitUtils.unitSplice(ssy + "/" + szy, UnitConstants.MMHG));
626   - map.put("gongGao", UnitUtils.unitSplice(data.getGongGao(), UnitConstants.CM));
627   - map.put("abdominalCircumference", UnitUtils.unitSplice(data.getAbdominalCircumference(), UnitConstants.CM));
628   - String edema = "";
629   - if (org.apache.commons.lang.StringUtils.isNotEmpty(data.getEdema())){
630   - for (FuZhongEnums fuZhongEnums:FuZhongEnums.values()){
631   - if (data.getEdema().equals(fuZhongEnums.getId())){
632   - edema = fuZhongEnums.getName();
633   - }
634   - }
635   - }
636   - map.put("edema",edema);
637   -
638   - map.put("tireNumber", TaiShuEnums.getTitle(data.getTireNumber()));
639   - //胎儿情况
640   - List<Map> tireList = new ArrayList<>();
641   - if (CollectionUtils.isNotEmpty(data.getTireData())){
642   - for (Object temp : data.getTireData()){
643   - Map<String,String> tire = JsonUtil.getMap(temp.toString());
644   - String heartRate = tire.get("heartRate");
645   - String fetalPosition = tire.get("fetalPosition");
646   - String fetalPresentation = tire.get("fetalPresentation");
647   - String join = tire.get("join");
648   -
649   - Map<String,Object> tireMap = new HashMap<>();
650   - tireMap.put("heartRate",UnitUtils.unitSplice(heartRate, UnitConstants.CIFEN));
651   - tireMap.put("fetalPosition", FetalPositionEnums.getTitle(fetalPosition));
652   - tireMap.put("fetalPresentation", FetalEnums.getTitle(fetalPresentation));
653   - tireMap.put("join", JoinEnums.getTitle(join));
654   - tireList.add(tireMap);
655   - }
656   - }
657   - map.put("tireData",tireList);
658   -
659   - /* 辅助信息 */
660   - map.put("hemoglobin", UnitUtils.unitSplice(data.getHemoglobin(), UnitConstants.GL));
661   - map.put("urineProtein",data.getUrineProtein());
662   - map.put("bloodSugar", UnitUtils.unitSplice(data.getUrineProtein(), UnitConstants.MMOLL));
663   - map.put("bChao",data.getbChao());
664   -
665   - /* 诊断指导 */
666   - String diagnosis = "";
667   - if (org.apache.commons.lang.StringUtils.isNotEmpty(data.getDiagnosis())){
668   - List<String> temp = JsonUtil.toList(data.getDiagnosis(), String.class);
669   - if (CollectionUtils.isNotEmpty(temp)){
670   -
671   - StringBuilder sb = new StringBuilder();
672   -
673   - for (String sId : temp){
674   - sb.append(FunvCommonUtil.getBaseicConfigByid(sId, basicConfigService)).append(",");
675   - }
676   - if (sb.toString().endsWith(",")) {
677   - diagnosis = sb.substring(0, sb.length() - 1);
678   - }else {
679   - diagnosis = sb.toString();
680   - }
681   - }
682   - }
683   - map.put("diagnosis",diagnosis);
684   - map.put("treatmentOpinion",data.getTreatmentOpinion());
685   - map.put("guide",data.getGuide());
686   -
687   - br.setErrorcode(ErrorCodeConstants.SUCCESS);
688   - br.setErrormsg("成功");
689   - br.setData(map);
690   - return br;
691   - }
692   -
693   -
694 576 }