From afbf03f80cc6608045455c509ea216b1b0fc1458 Mon Sep 17 00:00:00 2001 From: jiangjiazhi Date: Fri, 13 Jan 2017 17:22:39 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=86=E5=A8=A9=E4=BD=9C=E5=BA=9F=E4=BA=A7?= =?UTF-8?q?=E6=A3=80=E5=8A=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../operate/web/worker/AntExRecordWorker.java | 126 +++++++++++++++++++++ 1 file changed, 126 insertions(+) create mode 100644 platform-operate-api/src/main/java/com/lyms/platform/operate/web/worker/AntExRecordWorker.java diff --git a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/worker/AntExRecordWorker.java b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/worker/AntExRecordWorker.java new file mode 100644 index 0000000..76e9b6a --- /dev/null +++ b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/worker/AntExRecordWorker.java @@ -0,0 +1,126 @@ +package com.lyms.platform.operate.web.worker; + +import com.lyms.platform.biz.service.AntExRecordService; +import com.lyms.platform.biz.service.BasicConfigService; +import com.lyms.platform.biz.service.CommonService; +import com.lyms.platform.common.utils.ExceptionUtils; +import com.lyms.platform.common.utils.StringUtils; +import com.lyms.platform.operate.web.result.AntExManagerResult; +import com.lyms.platform.operate.web.result.RiskPatientsResult; +import com.lyms.platform.operate.web.utils.CommonsHelper; +import com.lyms.platform.permission.model.Organization; +import com.lyms.platform.permission.model.Users; +import com.lyms.platform.permission.service.OrganizationService; +import com.lyms.platform.permission.service.UsersService; +import com.lyms.platform.pojo.AntExRecordModel; +import com.lyms.platform.query.AntExRecordQuery; +import org.apache.commons.lang.math.NumberUtils; + +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.Callable; + +/** + * 产检记录 + *

+ * Created by Administrator on 2017/1/13 0013. + */ +public class AntExRecordWorker implements Callable> { + + private List record; + private boolean isRegion; + private OrganizationService organizationService; + private UsersService usersService; + private AntExRecordService recordService; + private CommonService commonService; + private String hospital; + + private BasicConfigService basicConfigService; + + public AntExRecordWorker(List record, + boolean isRegion, + OrganizationService organizationService, + UsersService usersService, + AntExRecordService recordService, + CommonService commonService, + String hospital, + BasicConfigService basicConfigService) { + this.record = record; + this.isRegion = isRegion; + this.organizationService = organizationService; + this.usersService = usersService; + this.recordService = recordService; + this.commonService = commonService; + this.hospital = hospital; + this.basicConfigService = basicConfigService; + } + + @Override + public List call() { + List data = new ArrayList<>(); + for (AntExRecordModel e : record) { + try { + AntExManagerResult antExManagerResult = new AntExManagerResult(); + antExManagerResult.convertToResult(e); + if (isRegion) { + //产检医院 + if (StringUtils.isNotEmpty(e.getHospitalId())) { + Organization org = organizationService.getOrganization(Integer.valueOf(e.getHospitalId())); + if (null != org) { + antExManagerResult.setCheckHospital(org.getName()); + } else { + antExManagerResult.setCheckHospital(e.getHospitalId()); + } + } + antExManagerResult.setAddr(CommonsHelper.getResidence(e.getProvinceRegisterId(), e.getCityRegisterId(), e.getAreaRegisterId(), e.getStreetRegisterId(), e.getAddressRegister(), basicConfigService)); + } + + //登记人 + if (org.apache.commons.lang.StringUtils.isNotEmpty(e.getBuildDoctor())) { + if (NumberUtils.isNumber(e.getBuildDoctor())) { + Users users = usersService.getUsers(NumberUtils.toInt(e.getBuildDoctor())); + if (null != users) { + antExManagerResult.setlName(users.getName()); + } else { + antExManagerResult.setlName(e.getBuildDoctor()); + } + } else { + antExManagerResult.setlName(e.getBuildDoctor()); + } + } + //产检医生 + if (org.apache.commons.lang.StringUtils.isNotEmpty(e.getCheckDoctor())) { + if (NumberUtils.isNumber(e.getCheckDoctor())) { + Users users = usersService.getUsers(NumberUtils.toInt(e.getCheckDoctor())); + if (null != users) { + antExManagerResult.setCheckDoctor(users.getName()); + } else { + antExManagerResult.setCheckDoctor(e.getCheckDoctor()); + } + } else { + antExManagerResult.setCheckDoctor(e.getCheckDoctor()); + } + } + + AntExRecordQuery antExRecordQuery1 = new AntExRecordQuery(); + antExRecordQuery1.setCheckTimeEnd(e.getCheckTime()); + antExRecordQuery1.setPid(e.getPid()); + antExRecordQuery1.setHospitalId(hospital); + + //本院低次 + int dichi = recordService.count(antExRecordQuery1); + antExRecordQuery1.setHospitalId(null); + + antExManagerResult.settTimes(recordService.count(antExRecordQuery1)); + antExManagerResult.setChTimes(dichi); + //高危因素 + antExManagerResult.setrLevel(commonService.findRiskLevel(e.gethLevel())); + antExManagerResult.setRiskFactor(commonService.resloveFactor(e.gethRisk())); + data.add(antExManagerResult); + }catch (Exception e1){ + ExceptionUtils.catchException(e1,"antex worker error."); + } + } + return data; + } +} -- 1.8.3.1