Commit 88201def0f2b764a52e87da0dc31e43641cb3be0

Authored by zhangchao
1 parent 869c7a21d9
Exists in dev

#fix:优化贫血专病管理

Showing 2 changed files with 493 additions and 2 deletions

platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PatientFacade.java View file @ 88201de
... ... @@ -1500,7 +1500,7 @@
1500 1500 if (CollectionUtils.isNotEmpty(patientses)) {
1501 1501 if (type == 1) {
1502 1502 //处理全部孕妇的情况
1503   - data = convertToTwinsPatient(riskPatientsQueryRequest, patientses, userId, hospital);
  1503 + data = convertToAnaemiaPatient(riskPatientsQueryRequest, patientses, userId, hospital);
1504 1504 }
1505 1505 }
1506 1506 // patientsQuery.mysqlBuild(data.size());
... ... @@ -2405,7 +2405,27 @@
2405 2405  
2406 2406 return data;
2407 2407 }
2408   -
  2408 + private List convertToAnaemiaPatient(RiskPatientsQueryRequest riskPatientsQueryRequest, List <Patients> patientses, Integer userId, String hospital) {
  2409 + List data = new ArrayList <>();
  2410 + int batchSize = 4;
  2411 + int end = 0;
  2412 + List <Future> listFuture = new ArrayList <>();
  2413 + for (int i = 0; i < patientses.size(); i += batchSize) {
  2414 + end = (end + batchSize);
  2415 + if (end > patientses.size()) {
  2416 + end = patientses.size();
  2417 + }
  2418 + listFuture.add(commonThreadPool.submit(new AnaemiaPatientWorker(riskPatientsQueryRequest, patientses.subList(i, end), usersService, hospital, antExService, basicConfigService, patientsService, organizationService)));
  2419 + }
  2420 + for (Future f : listFuture) {
  2421 + try {
  2422 + data.addAll((List) f.get(30, TimeUnit.SECONDS));
  2423 + } catch (Exception e) {
  2424 + ExceptionUtils.catchException(e, "convertToAnaemiaPatient get result Future error.");
  2425 + }
  2426 + }
  2427 + return data;
  2428 + }
2409 2429  
2410 2430 private List convertToQuanPatient(List <Patients> patientses, Integer userId, String hospital) {
2411 2431 List<QuanPatientsResult> data = new ArrayList <>();
platform-operate-api/src/main/java/com/lyms/platform/operate/web/worker/AnaemiaPatientWorker.java View file @ 88201de
  1 +package com.lyms.platform.operate.web.worker;
  2 +
  3 +import com.lyms.platform.biz.service.AntenatalExaminationService;
  4 +import com.lyms.platform.biz.service.BasicConfigService;
  5 +import com.lyms.platform.biz.service.PatientsService;
  6 +import com.lyms.platform.common.enums.ServiceStatusEnums;
  7 +import com.lyms.platform.common.enums.ServiceTypeEnums;
  8 +import com.lyms.platform.common.enums.YnEnums;
  9 +import com.lyms.platform.common.utils.DateUtil;
  10 +import com.lyms.platform.common.utils.ExceptionUtils;
  11 +import com.lyms.platform.common.utils.JsonUtil;
  12 +import com.lyms.platform.operate.web.facade.PatientFacade;
  13 +import com.lyms.platform.operate.web.request.RiskPatientsQueryRequest;
  14 +import com.lyms.platform.operate.web.result.HighScoreResult;
  15 +import com.lyms.platform.operate.web.result.QuanPatientsResult;
  16 +import com.lyms.platform.operate.web.result.TwinsPatientsResult;
  17 +import com.lyms.platform.operate.web.utils.CommonsHelper;
  18 +import com.lyms.platform.permission.model.Organization;
  19 +import com.lyms.platform.permission.model.Users;
  20 +import com.lyms.platform.permission.service.OrganizationService;
  21 +import com.lyms.platform.permission.service.UsersService;
  22 +import com.lyms.platform.pojo.AntExChuModel;
  23 +import com.lyms.platform.pojo.AntenatalExaminationModel;
  24 +import com.lyms.platform.pojo.BasicConfig;
  25 +import com.lyms.platform.pojo.Patients;
  26 +import com.lyms.platform.query.AntExChuQuery;
  27 +import com.lyms.platform.query.AntExQuery;
  28 +import org.apache.commons.collections.CollectionUtils;
  29 +import org.apache.commons.lang.StringUtils;
  30 +import org.apache.commons.lang.math.NumberUtils;
  31 +import org.slf4j.Logger;
  32 +import org.slf4j.LoggerFactory;
  33 +import org.springframework.util.StopWatch;
  34 +
  35 +import java.util.*;
  36 +import java.util.concurrent.Callable;
  37 +
  38 +/**
  39 + * 全部孕妇列表
  40 + */
  41 +public class AnaemiaPatientWorker implements Callable<List<QuanPatientsResult>> {
  42 +
  43 + private static final Logger logger = LoggerFactory.getLogger(PatientFacade.class);
  44 +
  45 + private List<Patients> patientses;
  46 +
  47 + private String hospital;
  48 + private UsersService usersService;
  49 + private AntenatalExaminationService antExService;
  50 + private BasicConfigService basicConfigService;
  51 + private PatientsService patientsService;
  52 + private OrganizationService organizationService;
  53 + private RiskPatientsQueryRequest riskPatientsQueryRequest;
  54 +
  55 + public AnaemiaPatientWorker(RiskPatientsQueryRequest riskPatientsQueryRequest,
  56 + List<Patients> patientses,
  57 + UsersService usersService,
  58 + String hospital,
  59 + AntenatalExaminationService antExService,
  60 + BasicConfigService basicConfigService, PatientsService patientsService, OrganizationService organizationService) {
  61 + this.riskPatientsQueryRequest = riskPatientsQueryRequest;
  62 + this.patientses = patientses;
  63 + this.usersService = usersService;
  64 + this.antExService = antExService;
  65 + this.hospital = hospital;
  66 + this.basicConfigService = basicConfigService;
  67 + this.patientsService = patientsService;
  68 + this.organizationService = organizationService;
  69 + }
  70 +
  71 + @Override
  72 + public List<QuanPatientsResult> call() throws Exception {
  73 + List data = new ArrayList<>();
  74 + AntExQuery antExQuery = new AntExQuery();
  75 + antExQuery.setYn(YnEnums.YES.getId());
  76 + AntExChuQuery antExChuQuery1 = new AntExChuQuery();
  77 +
  78 + antExChuQuery1.setYn(YnEnums.YES.getId());
  79 + String twinsType = "";
  80 + if(StringUtils.isNotEmpty(riskPatientsQueryRequest.getTwinsType())){
  81 + twinsType = riskPatientsQueryRequest.getTwinsType();
  82 + }
  83 +
  84 + for (Patients patients : patientses) {
  85 +
  86 + StopWatch stopWatch = new StopWatch("AnaemiaPatientWorker -" + patients.getId());
  87 + TwinsPatientsResult twinsPatientsResult = new TwinsPatientsResult();
  88 + twinsPatientsResult.setYi("-");
  89 + twinsPatientsResult.setEr("-");
  90 + twinsPatientsResult.setSan("-");
  91 + twinsPatientsResult.setSi("-");
  92 + twinsPatientsResult.setWu("-");
  93 + twinsPatientsResult.convertToResult(patients);
  94 + antExQuery.setPid(patients.getPid());
  95 + //增加查询本次产程条数
  96 + antExQuery.setStart(patients.getLastMenses());
  97 + if (StringUtils.isNotEmpty(patients.getBookbuildingDoctor())) {
  98 + if (NumberUtils.isNumber(patients.getBookbuildingDoctor())) {
  99 + Users users = usersService.getUsers(NumberUtils.toInt(patients.getBookbuildingDoctor()));
  100 + if (null != users) {
  101 + twinsPatientsResult.setlName(users.getName());
  102 + } else {
  103 + twinsPatientsResult.setlName(patients.getBookbuildingDoctor());
  104 + }
  105 + } else {
  106 + twinsPatientsResult.setlName(patients.getBookbuildingDoctor());
  107 + }
  108 + }
  109 + //筛查结果
  110 + String screenStr = basicConfigService.getScreenResult(patients.getScreenResult());
  111 + twinsPatientsResult.setScreenResult(screenStr);
  112 + twinsPatientsResult.setbTime(DateUtil.getyyyy_MM_dd(patients.getBookbuildingDate()));
  113 + stopWatch.start("query ant count");
  114 + antExChuQuery1.setPid(patients.getPid());
  115 + //antExChuQuery1.setParentId(patients.getId());
  116 + //增加查询本次产程条数
  117 + antExChuQuery1.setStart(patients.getLastMenses());
  118 + List<AntExChuModel> chu = antExService.queryAntExChu(antExChuQuery1.convertToQuery());
  119 + //复诊次数
  120 + List<AntenatalExaminationModel> ant = null;
  121 + if (CollectionUtils.isNotEmpty(chu)) {
  122 + for (AntExChuModel a : chu) {//唐山滦县导出判断初诊是否是本院
  123 + if (StringUtils.isNotEmpty(a.getHospitalId())) {
  124 + if (a.getHospitalId().equals(hospital)) {
  125 + twinsPatientsResult.setYi("本院");
  126 + } else {
  127 + twinsPatientsResult.setYi("外院");
  128 + }
  129 + break;
  130 + }
  131 + }
  132 + ant = antExService.queryAntenatalExamination(antExQuery.convertToQuery());
  133 + }
  134 +
  135 + //唐山滦县判断复诊是否是本院
  136 + if (CollectionUtils.isNotEmpty(ant)) {
  137 + for (int k = 0; k < ant.size(); k++) {
  138 + if (k >= 4) {
  139 + break;
  140 + }
  141 + if (0 == k) {
  142 + if (ant.get(k).getHospitalId().equals(hospital)) {
  143 + twinsPatientsResult.setEr("本院");
  144 + } else {
  145 + twinsPatientsResult.setEr("外院");
  146 + }
  147 + } else if (1 == k) {
  148 + if (ant.get(k).getHospitalId().equals(hospital)) {
  149 + twinsPatientsResult.setSan("本院");
  150 + } else {
  151 + twinsPatientsResult.setSan("外院");
  152 + }
  153 + } else if (2 == k) {
  154 + if (ant.get(k).getHospitalId().equals(hospital)) {
  155 + twinsPatientsResult.setSi("本院");
  156 + } else {
  157 + twinsPatientsResult.setSi("外院");
  158 + }
  159 + } else if (3 == k) {
  160 + if (ant.get(k).getHospitalId().equals(hospital)) {
  161 + twinsPatientsResult.setWu("本院");
  162 + } else {
  163 + twinsPatientsResult.setWu("外院");
  164 + }
  165 + }
  166 + }
  167 + }
  168 +
  169 + //系统初诊次数
  170 + int ichu = CollectionUtils.isEmpty(chu) ? 0 : chu.size();
  171 +
  172 + //系统复诊次数
  173 + int i = 0;
  174 + if (CollectionUtils.isNotEmpty(ant)) {
  175 + //复诊次数
  176 + i = ant.size();
  177 + sort(ant);
  178 + for (AntenatalExaminationModel a : ant) {
  179 + try {
  180 + if (StringUtils.isNotEmpty(a.getHospitalId())) {
  181 + Organization og = organizationService.getOrganization(Integer.valueOf(a.getHospitalId()));
  182 + if (null != og) {
  183 + twinsPatientsResult.setCurrentCh(og.getName());
  184 + break;
  185 + }
  186 + }
  187 + } catch (Exception e) {
  188 + twinsPatientsResult.setCurrentCh("");
  189 + }
  190 + }
  191 + } else {
  192 + for (AntExChuModel a : chu) {
  193 + try {
  194 + if (StringUtils.isNotEmpty(a.getHospitalId())) {
  195 + Organization og = organizationService.getOrganization(Integer.valueOf(a.getHospitalId()));
  196 + if (null != og) {
  197 + twinsPatientsResult.setCurrentCh(og.getName());
  198 + break;
  199 + }
  200 + }
  201 + } catch (Exception e) {
  202 + twinsPatientsResult.setCurrentCh("");
  203 + }
  204 + }
  205 + }
  206 +
  207 + twinsPatientsResult.setcTimes(i + ichu);
  208 +
  209 +
  210 + antExQuery.setHospitalId(hospital);
  211 + //本院初诊
  212 + int chi = countAntChu(chu, hospital);
  213 +
  214 + //本院复诊
  215 + int chb = capLocalHospital(hospital, ant);
  216 + twinsPatientsResult.setcHTimes(chi + chb);
  217 + stopWatch.stop();
  218 + String nextCheckTime = "";
  219 + stopWatch.start("query antex list");
  220 +
  221 +
  222 + if (null != patients.getNextCheckTime()) {
  223 + nextCheckTime = DateUtil.getyyyy_MM_dd(patients.getNextCheckTime());
  224 + }
  225 +
  226 + if (StringUtils.isNotEmpty(patients.getLastCheckEmployeeId())) {
  227 + if (NumberUtils.isNumber(patients.getLastCheckEmployeeId())) {
  228 + Users users = usersService.getUsers(NumberUtils.toInt(patients.getLastCheckEmployeeId()));
  229 + if (null != users) {
  230 + twinsPatientsResult.setCheckDoctor(users.getName());
  231 + } else {
  232 + twinsPatientsResult.setCheckDoctor(patients.getLastCheckEmployeeId());
  233 + }
  234 + } else {
  235 + twinsPatientsResult.setCheckDoctor(patients.getLastCheckEmployeeId());
  236 + }
  237 + }
  238 +
  239 +
  240 + stopWatch.stop();
  241 + stopWatch.start("query basicconfig");
  242 + //注册地址
  243 + twinsPatientsResult.setRegisterAddr(CommonsHelper.getResidence(patients.getProvinceId(), patients.getCityId(), patients.getAreaId(), patients.getStreetId(), patients.getAddress(), basicConfigService));
  244 + twinsPatientsResult.setAddr(CommonsHelper.getResidence(patients.getProvinceRegisterId(), patients.getCityRegisterId(), patients.getAreaRegisterId(), patients.getStreetRegisterId(), patients.getAddressRegister(), basicConfigService));
  245 + try {
  246 + twinsPatientsResult.setFirstBH(organizationService.getOrganization(Integer.valueOf(patients.getHospitalId())).getName());
  247 + } catch (Exception e) {
  248 + twinsPatientsResult.setFirstBH("");
  249 + }
  250 +
  251 + twinsPatientsResult.setServiceType(ServiceTypeEnums.getTitleById(patients.getServiceType()));
  252 + twinsPatientsResult.setServiceStatus(ServiceStatusEnums.getNameById(patients.getServiceStatus()));
  253 + //修改获取建档里面的高危等级不用在重新去算
  254 +// HighScoreResult highScoreResult = antenatalExaminationFacade.findLastRisk(patients.getPid(), true);
  255 +// twinsPatientsResult.setrLevel(highScoreResult.filter(highScoreResult.getLevel()));
  256 + twinsPatientsResult.setcTime(nextCheckTime);
  257 +
  258 +
  259 + //高危因素
  260 + List<String> factor = patients.getRiskFactorId();
  261 +
  262 + if (CollectionUtils.isNotEmpty(factor)) {
  263 + StringBuilder sb = new StringBuilder(56);
  264 + for (String srt : factor) {
  265 + if (StringUtils.isNotEmpty(srt)) {
  266 + BasicConfig basicConfig = basicConfigService.getOneBasicConfigById(srt);
  267 + if (null != basicConfig && sb.indexOf(basicConfig.getName()) == -1) {
  268 + //妊娠合并贫血(Hb 60-110g/L) 轻度缺铁性贫血(100-109g/L)中度缺铁性贫血(70-99g/L)轻度妊娠期贫血(100-109g/l)(缺铁性)
  269 + //轻度妊娠期贫血(100-109g/l)(巨幼细胞性) 轻度妊娠期贫血(100-109g/l)(再生障碍性) 中度妊娠期贫血(70-99g/l)(缺铁性)
  270 + //中度妊娠期贫血(70-99g/l)(巨幼细胞性) 中度妊娠期贫血(70-99g/l)(再生障碍性) 中度妊娠期贫血(70-99g/l)(未分类) 轻度妊娠期贫血(100-109g/l)(未分类)
  271 + //重度贫血(Hb40-60g/L) 极重度贫血(Hb<40g/L)极重度贫血(<40 g/L)(缺铁性)极重度贫血(<40 g/L)(巨幼细胞)
  272 + //极重度贫血(<40 g/L)(再生障碍性) 极重度贫血(<40 g/L)(未分类)重度妊娠期贫血(40-69g/L)(缺铁性)重度妊娠期贫血(40-69g/L)(巨幼细胞性)
  273 + //重度妊娠期贫血(40-69g/l)(再生障碍性) 重度妊娠期贫血(40-69g/l)(未分类)再生障碍性贫血
  274 +
  275 + if(basicConfig.getName().contains("贫血")){
  276 + sb.append(basicConfig.getName()).append(',');
  277 + }
  278 + }
  279 + }
  280 + }
  281 + if (sb.toString().endsWith(",")) {
  282 + twinsPatientsResult.setrFactor(sb.substring(0, sb.length() - 1));
  283 + } else {
  284 + twinsPatientsResult.setrFactor(sb.toString());
  285 + }
  286 +
  287 + /* if (!"-".equals(twinsPatientsResult.getrFactor()) && StringUtils.isNotEmpty(patients.getoRiskFactor())) {
  288 + twinsPatientsResult.setrFactor(twinsPatientsResult.getrFactor() + "," + patients.getoRiskFactor());
  289 + } else if (StringUtils.isNotEmpty(patients.getoRiskFactor())) {
  290 + twinsPatientsResult.setrFactor(patients.getoRiskFactor());
  291 + }*/
  292 + } else if (StringUtils.isNotEmpty(patients.getoRiskFactor())) {
  293 + twinsPatientsResult.setrFactor(patients.getoRiskFactor());
  294 + }
  295 + List level = new ArrayList();
  296 + if (StringUtils.isNotEmpty(patients.getRiskLevelId())) {
  297 + try {
  298 + List<String> list = JsonUtil.jkstr2Obj(patients.getRiskLevelId(), List.class);
  299 + for (String str : list) {
  300 + BasicConfig basicConfig = basicConfigService.getOneBasicConfigById(str);
  301 + if (null != basicConfig) {
  302 + Map map = new HashMap();
  303 + basicConfig.replenRisk(map);
  304 + // String name = basicConfig.getName();
  305 + // if (name.indexOf("预警") > -1) {
  306 + // name = name.replace("预警", "");
  307 + // }
  308 + // map.put("name", name);
  309 + // map.put("color", "risk_" + RiskDefaultTypeEnum.getColor(name));
  310 + level.add(map);
  311 + }
  312 + }
  313 + } catch (Exception e) {
  314 + ExceptionUtils.catchException(e, "patients.getRiskLevelId error.");
  315 + }
  316 +
  317 + twinsPatientsResult.setrLevel(HighScoreResult.filter(level));
  318 + }
  319 + twinsPatientsResult.setCardNo(patients.getCardNo());
  320 + twinsPatientsResult.setPcerteTypeId(patients.getPcerteTypeId());
  321 + stopWatch.stop();
  322 + if (twinsPatientsResult.getrFactor() != null) {
  323 +
  324 + if ("1".equals(twinsType)) {
  325 + if (twinsPatientsResult.getrFactor().contains("妊娠合并贫血(Hb 60-110g/L)")) {
  326 + data.add(twinsPatientsResult);
  327 + }
  328 +
  329 + } else if ("2".equals(twinsType)) {
  330 + if (twinsPatientsResult.getrFactor().contains("轻度缺铁性贫血(100-109g/L)")) {
  331 + data.add(twinsPatientsResult);
  332 + }
  333 + } else if ("3".equals(twinsType)) {
  334 + if (twinsPatientsResult.getrFactor().contains("中度缺铁性贫血(70-99g/L)")) {
  335 + data.add(twinsPatientsResult);
  336 + }
  337 + }else if ("4".equals(twinsType)) {
  338 + if (twinsPatientsResult.getrFactor().contains("轻度妊娠期贫血(100-109g/l)(缺铁性)")) {
  339 + data.add(twinsPatientsResult);
  340 + }
  341 +
  342 + } else if ("5".equals(twinsType)) {
  343 + if (twinsPatientsResult.getrFactor().contains("轻度妊娠期贫血(100-109g/l)(巨幼细胞性)")) {
  344 + data.add(twinsPatientsResult);
  345 + }
  346 + } else if ("6".equals(twinsType)) {
  347 + if (twinsPatientsResult.getrFactor().contains("轻度妊娠期贫血(100-109g/l)(再生障碍性)")) {
  348 + data.add(twinsPatientsResult);
  349 + }
  350 + }else if ("7".equals(twinsType)) {
  351 + if (twinsPatientsResult.getrFactor().contains("轻度妊娠期贫血(100-109g/l)(未分类)")) {
  352 + data.add(twinsPatientsResult);
  353 + }
  354 +
  355 + } else if ("8".equals(twinsType)) {
  356 + if (twinsPatientsResult.getrFactor().contains("中度妊娠期贫血(70-99g/l)(缺铁性)")) {
  357 + data.add(twinsPatientsResult);
  358 + }
  359 + } else if ("9".equals(twinsType)) {
  360 + if (twinsPatientsResult.getrFactor().contains("中度妊娠期贫血(70-99g/l)(巨幼细胞性)")) {
  361 + data.add(twinsPatientsResult);
  362 + }
  363 + }else if ("10".equals(twinsType)) {
  364 + if (twinsPatientsResult.getrFactor().contains("中度妊娠期贫血(70-99g/l)(再生障碍性)")) {
  365 + data.add(twinsPatientsResult);
  366 + }
  367 +
  368 + } else if ("11".equals(twinsType)) {
  369 + if (twinsPatientsResult.getrFactor().contains("中度妊娠期贫血(70-99g/l)(未分类)")) {
  370 + data.add(twinsPatientsResult);
  371 + }
  372 + } else if ("12".equals(twinsType)) {
  373 + if (twinsPatientsResult.getrFactor().contains("重度贫血(Hb40-60g/L)")) {
  374 + data.add(twinsPatientsResult);
  375 + }
  376 + }else if ("13".equals(twinsType)) {
  377 + if (twinsPatientsResult.getrFactor().contains("重度妊娠期贫血(40-69g/L)(缺铁性)")) {
  378 + data.add(twinsPatientsResult);
  379 + }
  380 +
  381 + } else if ("14".equals(twinsType)) {
  382 + if (twinsPatientsResult.getrFactor().contains("重度妊娠期贫血(40-69g/L)(巨幼细胞性)")) {
  383 + data.add(twinsPatientsResult);
  384 + }
  385 + } else if ("15".equals(twinsType)) {
  386 + if (twinsPatientsResult.getrFactor().contains("重度妊娠期贫血(40-69g/l)(再生障碍性)")) {
  387 + data.add(twinsPatientsResult);
  388 + }
  389 + }else if ("16".equals(twinsType)) {
  390 + if (twinsPatientsResult.getrFactor().contains("重度妊娠期贫血(40-69g/l)(未分类)")) {
  391 + data.add(twinsPatientsResult);
  392 + }
  393 +
  394 + } else if ("17".equals(twinsType)) {
  395 + if (twinsPatientsResult.getrFactor().contains("极重度贫血(Hb<40g/L)")) {
  396 + data.add(twinsPatientsResult);
  397 + }
  398 + } else if ("18".equals(twinsType)) {
  399 + if (twinsPatientsResult.getrFactor().contains("极重度贫血(Hb<40g/L)(缺铁性)")) {
  400 + data.add(twinsPatientsResult);
  401 + }
  402 + }else if ("19".equals(twinsType)) {
  403 + if (twinsPatientsResult.getrFactor().contains("极重度贫血(<40 g/L)(巨幼细胞)")) {
  404 + data.add(twinsPatientsResult);
  405 + }
  406 +
  407 + } else if ("20".equals(twinsType)) {
  408 + if (twinsPatientsResult.getrFactor().contains("极重度贫血(<40 g/L)(再生障碍性)")) {
  409 + data.add(twinsPatientsResult);
  410 + }
  411 + } else if ("21".equals(twinsType)) {
  412 + if (twinsPatientsResult.getrFactor().contains("极重度贫血(<40 g/L)(未分类)")) {
  413 + data.add(twinsPatientsResult);
  414 + }
  415 + }else if ("22".equals(twinsType)) {
  416 + if (twinsPatientsResult.getrFactor().contains("再生障碍性贫血")) {
  417 + data.add(twinsPatientsResult);
  418 + }
  419 + }else if (twinsPatientsResult.getrFactor().contains("贫血")) {
  420 + data.add(twinsPatientsResult);
  421 + }
  422 + }
  423 + logger.debug(stopWatch.toString());
  424 + }
  425 + return data;
  426 + }
  427 +
  428 + private int capLocalHospital(String hospitalId, List<AntenatalExaminationModel> list) {
  429 + if (CollectionUtils.isEmpty(list)) {
  430 + return 0;
  431 + }
  432 + int count = 0;
  433 + for (AntenatalExaminationModel model : list) {
  434 + if (model.getHospitalId().equals(hospitalId)) {
  435 + count++;
  436 + }
  437 + }
  438 + return count;
  439 + }
  440 +
  441 + //统计复查里面的本院检查数
  442 + private int countAntChu(List<AntExChuModel> list, String hospital) {
  443 + int count = 0;
  444 + if (CollectionUtils.isEmpty(list) || StringUtils.isEmpty(hospital)) {
  445 + return count;
  446 + }
  447 + for (AntExChuModel model : list) {
  448 + if (hospital.equals(model.getHospitalId())) {
  449 + count++;
  450 + }
  451 + }
  452 + return count;
  453 + }
  454 +
  455 + private void sort(List<AntenatalExaminationModel> list) {
  456 + if (CollectionUtils.isEmpty(list)) {
  457 + return;
  458 + }
  459 + Collections.sort(list, new Comparator<AntenatalExaminationModel>() {
  460 + @Override
  461 + public int compare(AntenatalExaminationModel o1, AntenatalExaminationModel o2) {
  462 + if (o1.getCreated().getTime() > o2.getCreated().getTime()) {
  463 + return 1;
  464 + } else if (o1.getCreated().getTime() < o2.getCreated().getTime()) {
  465 + return -1;
  466 + }
  467 + return 0;
  468 + }
  469 + });
  470 + }
  471 +}