Commit 3ad11feca29f87b3f08c53396fb9b14bf0eb394c

Authored by wtt
1 parent 4bd6de294f
Exists in master and in 1 other branch dev

update

Showing 4 changed files with 483 additions and 8 deletions

platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BabyStatisticsController.java View file @ 3ad11fe
1 1 package com.lyms.platform.operate.web.controller;
2 2  
3 3 import com.lyms.platform.common.annotation.TokenRequired;
  4 +import com.lyms.platform.common.base.BaseController;
  5 +import com.lyms.platform.common.base.LoginContext;
4 6 import com.lyms.platform.common.result.BaseResponse;
  7 +import com.lyms.platform.operate.web.facade.AutoMatchFacade;
5 8 import com.lyms.platform.operate.web.facade.BabyStatisticsFacade;
6 9 import com.lyms.platform.operate.web.request.BabyStatisticsQueryRequest;
7 10 import org.springframework.beans.factory.annotation.Autowired;
... ... @@ -11,6 +14,9 @@
11 14 import org.springframework.web.bind.annotation.RequestMethod;
12 15 import org.springframework.web.bind.annotation.ResponseBody;
13 16  
  17 +import javax.servlet.http.HttpServletRequest;
  18 +import javax.validation.Valid;
  19 +
14 20 /**
15 21 * 儿保科计算公式统计查询控制类
16 22 * @Author: 武涛涛
17 23  
... ... @@ -18,9 +24,12 @@
18 24 */
19 25 @Controller
20 26 @RequestMapping("/babyStatistics")
21   -public class BabyStatisticsController {
  27 +public class BabyStatisticsController extends BaseController {
  28 +
22 29 @Autowired
23 30 private BabyStatisticsFacade babyStatisticsFacade;
  31 + @Autowired
  32 + private AutoMatchFacade autoMatchFacade;
24 33  
25 34 /**
26 35 儿童统计
... ... @@ -32,6 +41,33 @@
32 41 @RequestMapping(value = "/statistics2", method = RequestMethod.POST)
33 42 public BaseResponse statistics2(@RequestBody BabyStatisticsQueryRequest babyStatisticsQueryRequest) {
34 43 return babyStatisticsFacade.statistics2(babyStatisticsQueryRequest);
  44 + }
  45 +
  46 + /**
  47 + * 获取儿保检查中医生列表
  48 + * @Author: 武涛涛
  49 + * @Date: 2021/3/20 13:55
  50 + */
  51 + @TokenRequired
  52 + @ResponseBody
  53 + @RequestMapping(value = "/usersLists",method = RequestMethod.POST)
  54 + public BaseResponse usersLists( HttpServletRequest request) {
  55 + LoginContext loginState = (LoginContext) request.getAttribute("loginContext");
  56 + return babyStatisticsFacade.usersLists( loginState.getId());
  57 + }
  58 +
  59 +
  60 + /**
  61 + * 获取儿保检查中医生列表
  62 + * @Author: 武涛涛
  63 + * @Date: 2021/3/20 13:55
  64 + */
  65 + @TokenRequired
  66 + @ResponseBody
  67 + @RequestMapping(value = "/monthLists",method = RequestMethod.POST)
  68 + public BaseResponse monthLists(@RequestBody @Valid BabyStatisticsQueryRequest babyStatisticsQueryRequest, HttpServletRequest request) {
  69 + LoginContext loginState = (LoginContext) request.getAttribute("loginContext");
  70 + return babyStatisticsFacade.monthLists(babyStatisticsQueryRequest, loginState.getId());
35 71 }
36 72  
37 73 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyStatisticsFacade.java View file @ 3ad11fe
... ... @@ -11,16 +11,17 @@
11 11 import com.lyms.platform.operate.web.request.BabyStatisticsQueryRequest;
12 12 import com.lyms.platform.operate.web.service.impl.BaseServiceImpl;
13 13 import com.lyms.platform.operate.web.worker.BabyStatisticsWorker;
  14 +import com.lyms.platform.operate.web.worker.MonthListsWorker;
14 15 import com.lyms.platform.permission.dao.master.BabyPatientExtendEarHearingDiagnoseMapper;
15 16 import com.lyms.platform.permission.dao.master.BabyPatientExtendEarScreenMapper;
16   -import com.lyms.platform.permission.model.BabyPatientExtendEarHearingDiagnoseQuery;
17   -import com.lyms.platform.permission.model.BabyPatientExtendEarScreenQuery;
18   -import com.lyms.platform.permission.model.Organization;
19   -import com.lyms.platform.permission.model.OrganizationQuery;
  17 +import com.lyms.platform.permission.model.*;
20 18 import com.lyms.platform.permission.service.OrganizationService;
  19 +import com.lyms.platform.permission.service.UserRoleMapsService;
  20 +import com.lyms.platform.permission.service.UsersService;
21 21 import com.lyms.platform.pojo.BabyCheckModel;
22 22 import com.lyms.platform.pojo.BabyModel;
23 23 import org.apache.commons.collections.CollectionUtils;
  24 +import org.apache.commons.collections.Transformer;
24 25 import org.slf4j.Logger;
25 26 import org.slf4j.LoggerFactory;
26 27 import org.springframework.beans.factory.annotation.Autowired;
27 28  
28 29  
29 30  
30 31  
... ... @@ -54,17 +55,209 @@
54 55  
55 56 @Autowired
56 57 private IPatientDao iPatientDao;
57   -
58 58 @Autowired
59 59 private BabyPatientExtendEarScreenMapper babyPatientExtendEarScreenMapper;
60   -
61 60 @Autowired
62 61 private BabyPatientExtendEarHearingDiagnoseMapper babyPatientExtendEarHearingDiagnoseMapper;
63   -
64 62 @Autowired
65 63 @Qualifier("commonThreadPool")
66 64 private ThreadPoolTaskExecutor commonThreadPool;
  65 + @Autowired
  66 + private AutoMatchFacade autoMatchFacade;
  67 + @Autowired
  68 + private UserRoleMapsService userRoleMapsService;
  69 + @Autowired
  70 + private UsersService usersService;
67 71  
  72 + /**
  73 + * 获取儿保检查中医生列表
  74 + *
  75 + * @param userId
  76 + * @Author: 武涛涛
  77 + * @Date: 2021/3/25 19:53
  78 + */
  79 + public BaseResponse usersLists(Integer userId) {
  80 + List <Users> usersList = new ArrayList <>();
  81 + try {
  82 + String hospitalId = autoMatchFacade.getHospitalId(userId);
  83 + Criteria cz = Criteria.where("hospitalId").in(hospitalId).and("yn").ne(YnEnums.NO.getId());
  84 + AggregationOperation matchZ = Aggregation.match(cz);
  85 + AggregationOperation groupZ = Aggregation.group("checkDoctor");//.count().as("gwegllCount");
  86 + AggregationOperation fieldsZ = Aggregation.project("checkDoctor");
  87 + Aggregation aggregationZ = Aggregation.newAggregation(matchZ, groupZ, fieldsZ);
  88 + AggregationResults <HashMap> resultZ = this.mongoTemplate.aggregate(aggregationZ, "lyms_babycheck", HashMap.class);
  89 + if(resultZ !=null && CollectionUtils.isNotEmpty(resultZ.getMappedResults())){
  90 + List <HashMap> mappedResults = resultZ.getMappedResults();
  91 + List <Integer> ids = (List <Integer>) CollectionUtils.collect(mappedResults, new Transformer() {
  92 + @Override
  93 + public Object transform(Object o) {
  94 + HashMap hashMap = (HashMap) o;
  95 + return hashMap.get("_id");
  96 + }
  97 + });
  98 + UsersQuery usersQuery = new UsersQuery();
  99 + usersQuery.setIds(ids);
  100 + usersQuery.setOrgId(Integer.parseInt(hospitalId));
  101 + usersQuery.setEnable(YnEnums.YES.getId());
  102 + usersQuery.setYn(YnEnums.YES.getId());
  103 + usersList = usersService.queryUsers(usersQuery);
  104 + }
  105 + } catch (Exception e) {
  106 + e.printStackTrace();
  107 + }
  108 + return new BaseObjectResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功").setData(usersList);
  109 +
  110 + }
  111 +
  112 + /**
  113 + * 获取儿保检查套餐总数1月 3月 6月 8月 12月 18月 24月 30月 36月 4岁 5岁 6岁
  114 + * @param queryRequest
  115 + * @param userId
  116 + * @Author: 武涛涛
  117 + * @Date: 2021/3/25 19:53
  118 + */
  119 + public BaseResponse monthLists1(BabyStatisticsQueryRequest queryRequest,Integer userId) {
  120 + String hospitalId = autoMatchFacade.getHospitalId(userId);
  121 + long startTime=System.currentTimeMillis(); //获取开始时间
  122 + Map <String, Object> map = new HashMap <>();
  123 + //2.1 在根据 1月套餐数据,分别获取 3月 6月 8月 12月 18月 24月 30月 36月 4岁 5岁 6岁 检查套餐
  124 + List <String> tcType1 = getCountOne(queryRequest, hospitalId);
  125 + map.put("tcType1",tcType1.size() );
  126 + Long tcType3 = getTcType(queryRequest, hospitalId, tcType1, 3);
  127 + map.put("tcType3",tcType3 );
  128 +
  129 + Long tcType6 = getTcType(queryRequest, hospitalId, tcType1, 6);
  130 + map.put("tcType6",tcType6 );
  131 +
  132 + Long tcType8 = getTcType(queryRequest, hospitalId, tcType1, 8);
  133 + map.put("tcType8",tcType8 );
  134 + Long tcType12 = getTcType(queryRequest, hospitalId, tcType1, 12);
  135 + map.put("tcType12",tcType12 );
  136 +
  137 + Long tcType18 = getTcType(queryRequest, hospitalId, tcType1, 18);
  138 + map.put("tcType18",tcType18 );
  139 +
  140 + Long tcType24 = getTcType(queryRequest, hospitalId, tcType1, 24);
  141 + map.put("tcType24",tcType24 );
  142 +
  143 + Long tcType30 = getTcType(queryRequest, hospitalId, tcType1, 30);
  144 + map.put("tcType30",tcType30 );
  145 +
  146 + Long tcType36 = getTcType(queryRequest, hospitalId, tcType1, 36);
  147 + map.put("tcType36",tcType36 );
  148 +
  149 + Long tcType48 = getTcType(queryRequest, hospitalId, tcType1, 48);
  150 + map.put("tcType48",tcType48 );
  151 +
  152 + Long tcType60 = getTcType(queryRequest, hospitalId, tcType1, 60);
  153 + map.put("tcType60",tcType60 );
  154 +
  155 + Long tcType72 = getTcType(queryRequest, hospitalId, tcType1, 72);
  156 +
  157 + map.put("tcType72",tcType72 );
  158 +
  159 + long endTime=System.currentTimeMillis(); //获取结束时间
  160 + System.out.println("程序运行毫秒: " + (endTime - startTime) + "ms");
  161 +
  162 + return new BaseObjectResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功").setData(map);
  163 +
  164 + }
  165 + public BaseResponse monthLists(BabyStatisticsQueryRequest queryRequest,Integer userId) {
  166 + String hospitalId = autoMatchFacade.getHospitalId(userId);
  167 + List <Map <String, MonthTcType>> listMaps = monthTcTypeInit();
  168 +
  169 + long startTime=System.currentTimeMillis(); //获取开始时间
  170 + List <String> tcType1 = getCountOne(queryRequest, hospitalId);
  171 + List <Map> mapList = convertToMonthLists(listMaps, queryRequest, hospitalId, tcType1);
  172 + long endTime=System.currentTimeMillis(); //获取结束时间
  173 + System.out.println("程序运行毫秒: " + (endTime - startTime) + "ms");
  174 + return new BaseObjectResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功").setData(mapList);
  175 +
  176 + }
  177 +
  178 + private List <Map> convertToMonthLists( List< Map<String,MonthTcType>> listMaps,BabyStatisticsQueryRequest queryRequest,
  179 + String hospitalId, List <String> countOneList ) {
  180 + List <Map> data = new ArrayList <>();
  181 + int batchSize = 2;
  182 + int end = 0;
  183 + List <Future> listFuture = new ArrayList <>();
  184 + for (int i = 0; i < listMaps.size(); i += batchSize) {
  185 + end = (end + batchSize);
  186 + if (end > listMaps.size()) {
  187 + end = listMaps.size();
  188 + }
  189 + listFuture.add(commonThreadPool.submit(new MonthListsWorker(listMaps.subList(i, end), queryRequest, mongoTemplate,hospitalId,countOneList)));
  190 + }
  191 + if(listFuture != null){
  192 + for (Future f : listFuture) {
  193 + try {
  194 + if(f!=null && f.get(85, TimeUnit.SECONDS)!=null){
  195 + data.addAll((List <Map>) f.get(300, TimeUnit.SECONDS));
  196 + }
  197 + } catch (Exception e) {
  198 + ExceptionUtils.catchException(e, "convertToQuanWeight get result Future error.");
  199 + }
  200 + }
  201 + }
  202 + return data;
  203 + }
  204 + private Long getTcType(BabyStatisticsQueryRequest queryRequest, String hospitalId, List <String> countOneList,Integer tcType ) {
  205 + Criteria cz = Criteria.where("hospitalId").is(hospitalId)
  206 + .and("yn").ne(YnEnums.NO.getId()) .and("checkDoctor").is(queryRequest.getCheckDoctor()).and("buildId").in(countOneList).and("tcType").is(tcType);
  207 + if(StringUtils.isNotEmpty(queryRequest.getTimeStart()) && StringUtils.isNotEmpty(queryRequest.getTimeEnd())){
  208 + cz = cz.and("checkDate").gte(DateUtil.parseYMD(queryRequest.getTimeStart())).lte(DateUtil.parseYMDEnd(queryRequest.getTimeEnd()));
  209 + }
  210 + Query queryOne = new Query();
  211 + queryOne.addCriteria(cz);
  212 + return mongoTemplate.count(queryOne, BabyCheckModel.class);
  213 + }
  214 +
  215 + private List <String> getCountOne(BabyStatisticsQueryRequest queryRequest, String hospitalId) {
  216 + try {
  217 +
  218 + Criteria cz = Criteria.where("hospitalId").in(hospitalId).and("yn").ne(YnEnums.NO.getId()) .and("checkDoctor").is(queryRequest.getCheckDoctor()).and("tcType").is(1);
  219 + if(StringUtils.isNotEmpty(queryRequest.getTimeStart()) && StringUtils.isNotEmpty(queryRequest.getTimeEnd())){
  220 + cz = cz.and("checkDate").gte(DateUtil.parseYMD(queryRequest.getTimeStart())).lte(DateUtil.parseYMDEnd(queryRequest.getTimeEnd()));
  221 + }
  222 + AggregationOperation matchZ = Aggregation.match(cz);
  223 + AggregationOperation groupZ = Aggregation.group("buildId");//.count().as("gwegllCount");
  224 + AggregationOperation fieldsZ = Aggregation.project("buildId");
  225 + Aggregation aggregationZ = Aggregation.newAggregation(matchZ, groupZ, fieldsZ);
  226 + AggregationResults <HashMap> resultZ = this.mongoTemplate.aggregate(aggregationZ, "lyms_babycheck", HashMap.class);
  227 +
  228 + if(resultZ !=null && CollectionUtils.isNotEmpty(resultZ.getMappedResults())){
  229 + List <HashMap> mappedResults = resultZ.getMappedResults();
  230 + List <String> ids = (List <String>) CollectionUtils.collect(mappedResults, new Transformer() {
  231 + @Override
  232 + public Object transform(Object o) {
  233 + HashMap hashMap = (HashMap) o;
  234 + return hashMap.get("_id");
  235 + }
  236 + });
  237 + return ids;
  238 + }
  239 +
  240 + } catch (Exception e) {
  241 + e.printStackTrace();
  242 + }
  243 + return null;
  244 + }
  245 + private List<BabyCheckModel> getCountOne1(BabyStatisticsQueryRequest queryRequest, String hospitalId) {
  246 + try {
  247 + Criteria cz = Criteria.where("hospitalId").is(hospitalId)
  248 + .and("yn").ne(YnEnums.NO.getId()) .and("checkDoctor").is(queryRequest.getCheckDoctor()).and("tcType").is(1);
  249 + if(StringUtils.isNotEmpty(queryRequest.getTimeStart()) && StringUtils.isNotEmpty(queryRequest.getTimeEnd())){
  250 + cz = cz.and("checkDate").gte(DateUtil.parseYMD(queryRequest.getTimeStart())).lte(DateUtil.parseYMDEnd(queryRequest.getTimeEnd()));
  251 + }
  252 + Query queryOne = new Query();
  253 + queryOne.addCriteria(cz);
  254 + return mongoTemplate.find(queryOne, BabyCheckModel.class);
  255 + } catch (Exception e) {
  256 + e.printStackTrace();
  257 + }
  258 + return null;
  259 + }
  260 +
68 261 public BaseResponse statistics2(BabyStatisticsQueryRequest queryRequest) {
69 262 List < Map<Integer,Statistic>> listMaps = init();
70 263 long startTime=System.currentTimeMillis(); //获取开始时间
... ... @@ -106,6 +299,171 @@
106 299 }
107 300 return data;
108 301 }
  302 +
  303 + public interface MonthTcType {
  304 + abstract Map <String, Object> getMonthTcType(BabyStatisticsQueryRequest queryRequest,String hospitalId, List <String> tcType1s, Integer tcType);
  305 + }
  306 + //3月
  307 + class TcType3 implements MonthTcType{
  308 + @Override
  309 + public Map <String, Object> getMonthTcType(BabyStatisticsQueryRequest queryRequest, String hospitalId, List <String> tcType1s, Integer tcType) {
  310 + Map <String, Object> map = new HashMap <>();
  311 + Long tcType3 = getTcType(queryRequest, hospitalId, tcType1s, 3);
  312 + map.put("tcType3",tcType3 );
  313 + return map;
  314 + }
  315 + }
  316 + //6月
  317 + class TcType6 implements MonthTcType{
  318 + @Override
  319 + public Map <String, Object> getMonthTcType(BabyStatisticsQueryRequest queryRequest, String hospitalId, List <String> tcType1s, Integer tcType) {
  320 + Map <String, Object> map = new HashMap <>();
  321 + Long tcType6 = getTcType(queryRequest, hospitalId, tcType1s, 6);
  322 + map.put("tcType6",tcType6 );
  323 + return map;
  324 + }
  325 + }
  326 + //8月
  327 + class TcType8 implements MonthTcType{
  328 + @Override
  329 + public Map <String, Object> getMonthTcType(BabyStatisticsQueryRequest queryRequest, String hospitalId, List <String> tcType1s, Integer tcType) {
  330 + Map <String, Object> map = new HashMap <>();
  331 + Long tcType8 = getTcType(queryRequest, hospitalId, tcType1s, 8);
  332 + map.put("tcType8",tcType8 );
  333 + return map;
  334 + }
  335 + }
  336 + //12月
  337 + class TcType12 implements MonthTcType{
  338 + @Override
  339 + public Map <String, Object> getMonthTcType(BabyStatisticsQueryRequest queryRequest, String hospitalId, List <String> tcType1s, Integer tcType) {
  340 + Map <String, Object> map = new HashMap <>();
  341 + Long tcType12 = getTcType(queryRequest, hospitalId, tcType1s, 12);
  342 + map.put("tcType12",tcType12 );
  343 + return map;
  344 + }
  345 + }
  346 + //18月
  347 + class TcType18 implements MonthTcType{
  348 + @Override
  349 + public Map <String, Object> getMonthTcType(BabyStatisticsQueryRequest queryRequest, String hospitalId, List <String> tcType1s, Integer tcType) {
  350 + Map <String, Object> map = new HashMap <>();
  351 + Long tcType18 = getTcType(queryRequest, hospitalId, tcType1s, 18);
  352 + map.put("tcType18",tcType18 );
  353 + return map;
  354 + }
  355 + }
  356 + //24月
  357 + class TcType24 implements MonthTcType{
  358 + @Override
  359 + public Map <String, Object> getMonthTcType(BabyStatisticsQueryRequest queryRequest, String hospitalId, List <String> tcType1s, Integer tcType) {
  360 + Map <String, Object> map = new HashMap <>();
  361 + Long tcType24 = getTcType(queryRequest, hospitalId, tcType1s, 24);
  362 + map.put("tcType24",tcType24 );
  363 + return map;
  364 + }
  365 + }
  366 + //30月
  367 + class TcType30 implements MonthTcType{
  368 + @Override
  369 + public Map <String, Object> getMonthTcType(BabyStatisticsQueryRequest queryRequest, String hospitalId, List <String> tcType1s, Integer tcType) {
  370 + Map <String, Object> map = new HashMap <>();
  371 + Long tcType30 = getTcType(queryRequest, hospitalId, tcType1s, 24);
  372 + map.put("tcType30",tcType30 );
  373 + return map;
  374 + }
  375 + }
  376 + //36月
  377 + class TcType36 implements MonthTcType{
  378 + @Override
  379 + public Map <String, Object> getMonthTcType(BabyStatisticsQueryRequest queryRequest, String hospitalId, List <String> tcType1s, Integer tcType) {
  380 + Map <String, Object> map = new HashMap <>();
  381 + Long tcType36 = getTcType(queryRequest, hospitalId, tcType1s, 36);
  382 + map.put("tcType36",tcType36 );
  383 + return map;
  384 + }
  385 + }
  386 + //48月
  387 + class TcType48 implements MonthTcType{
  388 + @Override
  389 + public Map <String, Object> getMonthTcType(BabyStatisticsQueryRequest queryRequest, String hospitalId, List <String> tcType1s, Integer tcType) {
  390 + Map <String, Object> map = new HashMap <>();
  391 + Long tcType48 = getTcType(queryRequest, hospitalId, tcType1s, 48);
  392 + map.put("tcType48",tcType48 );
  393 + return map;
  394 + }
  395 + }
  396 +
  397 + //60月
  398 + class TcType60 implements MonthTcType{
  399 + @Override
  400 + public Map <String, Object> getMonthTcType(BabyStatisticsQueryRequest queryRequest, String hospitalId, List <String> tcType1s, Integer tcType) {
  401 + Map <String, Object> map = new HashMap <>();
  402 + Long tcType60 = getTcType(queryRequest, hospitalId, tcType1s, 60);
  403 + map.put("tcType60",tcType60 );
  404 + return map;
  405 + }
  406 + }
  407 +
  408 + //72月
  409 + class TcType72 implements MonthTcType{
  410 + @Override
  411 + public Map <String, Object> getMonthTcType(BabyStatisticsQueryRequest queryRequest, String hospitalId, List <String> tcType1s, Integer tcType) {
  412 + Map <String, Object> map = new HashMap <>();
  413 + Long tcType72 = getTcType(queryRequest, hospitalId, tcType1s, 72);
  414 + map.put("tcType72",tcType72 );
  415 + return map;
  416 + }
  417 + }
  418 +
  419 + private List< Map<String,MonthTcType>> monthTcTypeInit() {
  420 + List< Map<String,MonthTcType>> listMaps = new ArrayList <>() ;
  421 + Map<String,MonthTcType> tcType3 = new HashMap();
  422 + tcType3.put("tcType3", new TcType3());
  423 + listMaps.add(tcType3);
  424 +
  425 + Map<String,MonthTcType> TcType6 = new HashMap();
  426 + TcType6.put("TcType6", new TcType6());
  427 + listMaps.add(TcType6);
  428 +
  429 + Map<String,MonthTcType> TcType8 = new HashMap();
  430 + TcType8.put("TcType8", new TcType8());
  431 + listMaps.add(TcType8);
  432 +
  433 + Map<String,MonthTcType> TcType12 = new HashMap();
  434 + TcType12.put("TcType12", new TcType12());
  435 + listMaps.add(TcType12);
  436 +
  437 + Map<String,MonthTcType> TcType18 = new HashMap();
  438 + TcType18.put("TcType18", new TcType18());
  439 + listMaps.add(TcType18);
  440 +
  441 + Map<String,MonthTcType> TcType24 = new HashMap();
  442 + TcType24.put("TcType24", new TcType24());
  443 + listMaps.add(TcType24);
  444 +
  445 + Map<String,MonthTcType> TcType30 = new HashMap();
  446 + TcType30.put("TcType30", new TcType30());
  447 + listMaps.add(TcType30);
  448 +
  449 + Map<String,MonthTcType> TcType36 = new HashMap();
  450 + TcType36.put("TcType36", new TcType36());
  451 + listMaps.add(TcType36);
  452 +
  453 + Map<String,MonthTcType> TcType48 = new HashMap();
  454 + TcType48.put("TcType48", new TcType48());
  455 + listMaps.add(TcType48);
  456 +
  457 + Map<String,MonthTcType> TcType60 = new HashMap();
  458 + TcType60.put("TcType60", new TcType60());
  459 + listMaps.add(TcType60);
  460 +
  461 + Map<String,MonthTcType> TcType72 = new HashMap();
  462 + TcType72.put("TcType72", new TcType72());
  463 + listMaps.add(TcType72);
  464 + return listMaps;
  465 + }
  466 +
109 467  
110 468  
111 469 public interface Statistic {
platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/BabyStatisticsQueryRequest.java View file @ 3ad11fe
... ... @@ -2,7 +2,9 @@
2 2  
3 3 import com.lyms.platform.common.core.annotation.form.Form;
4 4  
  5 +import javax.validation.constraints.NotNull;
5 6  
  7 +
6 8 /**
7 9 * 儿保科计算公式统计查询入参类
8 10 *
... ... @@ -29,6 +31,17 @@
29 31 private String timeStart;
30 32 private String timeEnd;
31 33  
  34 + //产检医生
  35 + @NotNull(message = "产检医生ID不能为空")
  36 + private String checkDoctor;
  37 +
  38 + public String getCheckDoctor() {
  39 + return checkDoctor;
  40 + }
  41 +
  42 + public void setCheckDoctor(String checkDoctor) {
  43 + this.checkDoctor = checkDoctor;
  44 + }
32 45  
33 46 public String getSort() {
34 47 return sort;
platform-operate-api/src/main/java/com/lyms/platform/operate/web/worker/MonthListsWorker.java View file @ 3ad11fe
  1 +package com.lyms.platform.operate.web.worker;
  2 +
  3 +import com.lyms.platform.operate.web.facade.BabyStatisticsFacade.MonthTcType;
  4 +import com.lyms.platform.operate.web.facade.PatientFacade;
  5 +import com.lyms.platform.operate.web.request.BabyStatisticsQueryRequest;
  6 +import org.apache.commons.collections.CollectionUtils;
  7 +import org.slf4j.Logger;
  8 +import org.slf4j.LoggerFactory;
  9 +import org.springframework.data.mongodb.core.MongoTemplate;
  10 +
  11 +import java.util.ArrayList;
  12 +import java.util.List;
  13 +import java.util.Map;
  14 +import java.util.concurrent.Callable;
  15 +
  16 +/**
  17 + * 获取儿保检查套餐总数
  18 + *
  19 + * @Author: 武涛涛
  20 + */
  21 +public class MonthListsWorker implements Callable <List <Map>> {
  22 +
  23 + public static final int i = 1;
  24 + private static final Logger logger = LoggerFactory.getLogger(PatientFacade.class);
  25 +
  26 + private List <Map <String, MonthTcType>> mapList;
  27 + private BabyStatisticsQueryRequest babyStatisticsQueryRequest;
  28 + private MongoTemplate mongoTemplate;
  29 + private String hospitalId;
  30 + private List <String> countOneList;
  31 +
  32 + public MonthListsWorker(List <Map <String, MonthTcType>> mapList,
  33 + BabyStatisticsQueryRequest babyStatisticsQueryRequest,
  34 + MongoTemplate mongoTemplate,
  35 + String hospitalId,
  36 + List <String> countOneList //buildIds
  37 +
  38 + ) {
  39 + this.mapList = mapList;
  40 + this.babyStatisticsQueryRequest = babyStatisticsQueryRequest;
  41 + this.mongoTemplate = mongoTemplate;
  42 + this.hospitalId = hospitalId;
  43 + this.countOneList = countOneList;
  44 +
  45 + }
  46 +
  47 + @Override
  48 + public List <Map> call() throws Exception {
  49 + List <Map> data = new ArrayList <>();
  50 + for (int i = 0; i < mapList.size(); i++) {
  51 + if (CollectionUtils.isEmpty(countOneList)) {
  52 + continue;
  53 + }
  54 + Map <String, MonthTcType> integerStatisticMap = mapList.get(i);
  55 + for (Map.Entry <String, MonthTcType> entry : integerStatisticMap.entrySet()) {
  56 + // System.out.println("Key = " + entry.getKey() + ", Value = " + entry.getValue());
  57 + MonthTcType monthTcType = integerStatisticMap.get(entry.getKey());
  58 + if (monthTcType == null) {
  59 + continue;
  60 + }
  61 + Map <String, Object> map = monthTcType.getMonthTcType(babyStatisticsQueryRequest, hospitalId, countOneList, null);
  62 + data.add(map);
  63 + }
  64 + }
  65 + return data;
  66 + }
  67 +
  68 +}