Commit 2bb6a881c6a4095ba845626a8825c2a18025c438
1 parent
1e43ce88e5
Exists in
master
and in
6 other branches
儿童档案历史数据执行方法。-儿童首次高危确诊
Showing 2 changed files with 113 additions and 11 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BabyFirstRistRecordController.java
View file @
2bb6a88
| ... | ... | @@ -9,6 +9,7 @@ |
| 9 | 9 | import com.lyms.platform.pojo.Authentication; |
| 10 | 10 | import com.lyms.platform.query.AuthenticationQuery; |
| 11 | 11 | import com.lyms.platform.query.BabyFirstRistRecordQuery; |
| 12 | +import com.lyms.platform.query.BabyModelQuery; | |
| 12 | 13 | import org.springframework.beans.factory.annotation.Autowired; |
| 13 | 14 | import org.springframework.stereotype.Controller; |
| 14 | 15 | import org.springframework.web.bind.annotation.*; |
| ... | ... | @@ -42,6 +43,23 @@ |
| 42 | 43 | public BaseResponse queryListPage(BabyFirstRistRecordQuery ModelQuery, HttpServletRequest request) { |
| 43 | 44 | LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); |
| 44 | 45 | return babyFirstRistRecordFacade.queryListPage(ModelQuery,loginState.getId()); |
| 46 | + } | |
| 47 | + /** | |
| 48 | + * 儿童档案历史数据执行方法。-儿童首次高危确诊 | |
| 49 | + * 不会影响现有首次高危记录 | |
| 50 | + * hospitalIdList 放多个医院机构的id {n,n..} 必填 | |
| 51 | + * buildDateStart 年月日时间:2022-6-27 选填 | |
| 52 | + * buildDateEnd 年月日时间:2022-6-27 选填 | |
| 53 | + * @param babyQuery | |
| 54 | + * @param request | |
| 55 | + * @return | |
| 56 | + */ | |
| 57 | + @ResponseBody | |
| 58 | + @TokenRequired | |
| 59 | + @RequestMapping(value = "/historyDataFirstRist",method = RequestMethod.GET) | |
| 60 | + public BaseResponse historyDataFirstRist(BabyModelQuery babyQuery, HttpServletRequest request) { | |
| 61 | + LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); | |
| 62 | + return babyFirstRistRecordFacade.historyDataFirstRist(babyQuery,loginState.getId()); | |
| 45 | 63 | } |
| 46 | 64 | |
| 47 | 65 |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyFirstRistRecordFacade.java
View file @
2bb6a88
| 1 | 1 | package com.lyms.platform.operate.web.facade; |
| 2 | 2 | |
| 3 | -import com.lyms.platform.biz.service.AuthenticationService; | |
| 3 | +import com.lyms.platform.biz.service.BabyBookbuildingService; | |
| 4 | +import com.lyms.platform.biz.service.BabyCheckService; | |
| 4 | 5 | import com.lyms.platform.biz.service.BabyFistRistRecordService; |
| 5 | 6 | import com.lyms.platform.biz.service.BasicConfigService; |
| 6 | 7 | import com.lyms.platform.common.constants.ErrorCodeConstants; |
| 7 | -import com.lyms.platform.common.enums.OptActionEnums; | |
| 8 | 8 | import com.lyms.platform.common.enums.SexEnum; |
| 9 | 9 | import com.lyms.platform.common.enums.YnEnums; |
| 10 | 10 | import com.lyms.platform.common.result.BaseObjectResponse; |
| 11 | 11 | import com.lyms.platform.common.result.BaseResponse; |
| 12 | 12 | import com.lyms.platform.common.utils.*; |
| 13 | -import com.lyms.platform.operate.web.utils.CommonsHelper; | |
| 14 | -import com.lyms.platform.operate.web.utils.ResponseUtil; | |
| 15 | -import com.lyms.platform.permission.dao.master.CouponMapper; | |
| 16 | 13 | import com.lyms.platform.permission.model.Organization; |
| 17 | 14 | import com.lyms.platform.permission.model.Users; |
| 18 | 15 | import com.lyms.platform.permission.service.OrganizationService; |
| 19 | 16 | import com.lyms.platform.permission.service.UsersService; |
| 20 | -import com.lyms.platform.pojo.Authentication; | |
| 17 | +import com.lyms.platform.pojo.BabyCheckModel; | |
| 21 | 18 | import com.lyms.platform.pojo.BabyFirstRistRecord; |
| 19 | +import com.lyms.platform.pojo.BabyModel; | |
| 22 | 20 | import com.lyms.platform.pojo.BasicConfig; |
| 23 | -import com.lyms.platform.query.AuthenticationQuery; | |
| 21 | +import com.lyms.platform.query.BabyCheckModelQuery; | |
| 24 | 22 | import com.lyms.platform.query.BabyFirstRistRecordQuery; |
| 23 | +import com.lyms.platform.query.BabyModelQuery; | |
| 25 | 24 | import com.lyms.platform.query.BasicConfigQuery; |
| 26 | 25 | import org.apache.commons.collections.CollectionUtils; |
| 27 | 26 | import org.springframework.beans.factory.annotation.Autowired; |
| 27 | +import org.springframework.beans.factory.annotation.Qualifier; | |
| 28 | 28 | import org.springframework.data.domain.Sort; |
| 29 | -import org.springframework.data.mongodb.core.MongoTemplate; | |
| 30 | -import org.springframework.data.mongodb.core.query.Criteria; | |
| 31 | -import org.springframework.data.mongodb.core.query.Query; | |
| 29 | +import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; | |
| 32 | 30 | import org.springframework.stereotype.Component; |
| 31 | +import java.util.concurrent.Future; | |
| 32 | +import java.util.concurrent.Callable; | |
| 33 | 33 | |
| 34 | -import javax.servlet.http.HttpServletResponse; | |
| 35 | 34 | import java.util.*; |
| 36 | 35 | |
| 37 | 36 | @Component |
| 38 | 37 | public class BabyFirstRistRecordFacade { |
| 39 | 38 | @Autowired |
| 39 | + @Qualifier("commonThreadPool") | |
| 40 | + private ThreadPoolTaskExecutor commonThreadPool; | |
| 41 | + @Autowired | |
| 40 | 42 | private AutoMatchFacade autoMatchFacade; |
| 41 | 43 | @Autowired |
| 42 | 44 | private BasicConfigService basicConfigService; |
| ... | ... | @@ -48,6 +50,10 @@ |
| 48 | 50 | private UsersService usersService; |
| 49 | 51 | @Autowired |
| 50 | 52 | private OrganizationService organizationService; |
| 53 | + @Autowired | |
| 54 | + private BabyBookbuildingService babyBookbuildingService; | |
| 55 | + @Autowired | |
| 56 | + private BabyCheckService babyCheckService; | |
| 51 | 57 | |
| 52 | 58 | |
| 53 | 59 | |
| ... | ... | @@ -144,5 +150,83 @@ |
| 144 | 150 | return br; |
| 145 | 151 | } |
| 146 | 152 | |
| 153 | + public BaseResponse historyDataFirstRist(BabyModelQuery babyQuery, Integer id) { | |
| 154 | + BaseResponse br = new BaseResponse(); | |
| 155 | + if(CollectionUtils.isEmpty(babyQuery.getHospitalIdList())){ | |
| 156 | + br.setErrorcode(ErrorCodeConstants.PARAMETER_ERROR); | |
| 157 | + br.setErrormsg("参数错误"); | |
| 158 | + return br; | |
| 159 | + } | |
| 160 | + babyQuery.setYn(YnEnums.YES.getId()); | |
| 161 | + babyQuery.setHighRisk(1); | |
| 162 | + if (null!=babyQuery.getBuildDateEnd()) { | |
| 163 | + babyQuery.setBuildDateEnd(DateUtil.getDayLastSecond(babyQuery.getBuildDateEnd())); | |
| 164 | + } | |
| 165 | + List<BabyModel> list=babyBookbuildingService.queryBabyBuildByCond(babyQuery); | |
| 166 | + if(CollectionUtils.isNotEmpty(list)) { | |
| 167 | + int batchSize = 20; | |
| 168 | + int end = 0; | |
| 169 | + List<Future> listFuture = new ArrayList<>(); | |
| 170 | + for (int i = 0; i < list.size(); i += batchSize) { | |
| 171 | + end = (end + batchSize); | |
| 172 | + if (end > list.size()) { | |
| 173 | + end = list.size(); | |
| 174 | + } | |
| 175 | + final List<BabyModel> babyModels = list.subList(i, end); | |
| 176 | + listFuture.add(commonThreadPool.submit(new Callable() { | |
| 177 | + @Override | |
| 178 | + public Object call() throws Exception { | |
| 179 | + if (CollectionUtils.isNotEmpty(babyModels)) { | |
| 180 | + for (BabyModel model : babyModels) { | |
| 181 | + //儿保检查是否添加过高危 | |
| 182 | + int ristYn = 0; | |
| 183 | + //儿保检查记录 | |
| 184 | + BabyCheckModelQuery query = new BabyCheckModelQuery(); | |
| 185 | + query.setYn(YnEnums.YES.getId()); | |
| 186 | + query.setBuildId(model.getId()); | |
| 187 | + List<BabyCheckModel> babyCheckModels = babyCheckService.queryBabyCheckRecord(query); | |
| 188 | + for (BabyCheckModel babyCheckModel : babyCheckModels) { | |
| 189 | + BabyFirstRistRecord firstRistRecord = babyFistRistRecordService.queryByPId(babyCheckModel.getId()); | |
| 190 | + if (null != firstRistRecord) { | |
| 191 | + ristYn = 1; | |
| 192 | + break; | |
| 193 | + } | |
| 194 | + } | |
| 195 | + if (ristYn == 0) { | |
| 196 | + //建档记录是否添加过 | |
| 197 | + BabyFirstRistRecord firstRistRecord = babyFistRistRecordService.queryByPId(model.getId()); | |
| 198 | + //增加高危记录 | |
| 199 | + if (null == firstRistRecord) { | |
| 200 | + firstRistRecord=new BabyFirstRistRecord(); | |
| 201 | + firstRistRecord.setYn(YnEnums.YES.getId()); | |
| 202 | + firstRistRecord.setRistType(0);//初次高危发生类型 0:建档高危。1:检查高危 | |
| 203 | + firstRistRecord.setHospitalId(model.getHospitalId());//建档/检查医院 | |
| 204 | + firstRistRecord.setParentId(model.getId());//建档/检查 数据id | |
| 205 | + firstRistRecord.setName(model.getName()); | |
| 206 | + firstRistRecord.setSex(model.getSex()); | |
| 207 | + firstRistRecord.setBirth(model.getBirth()); | |
| 208 | + firstRistRecord.setHighRiskInfo(model.getHighRiskInfo()); | |
| 209 | + firstRistRecord.setDiagnose(model.getDiagnose()); | |
| 210 | + firstRistRecord.setDiagnosisTime(model.getBuildDate()); | |
| 211 | + firstRistRecord.setCheckDoctor(model.getBuildDoctor());//建档/检查医生 | |
| 212 | + firstRistRecord.setmName(model.getMname()); | |
| 213 | + firstRistRecord.setmPhone(model.getMphone()); | |
| 214 | + firstRistRecord.setmCertNo(model.getMcertNo()); | |
| 215 | + firstRistRecord.setFmHospitalId(model.getDeliverOrg()); | |
| 216 | + babyFistRistRecordService.add(firstRistRecord); | |
| 217 | + } | |
| 218 | + } | |
| 219 | + } | |
| 220 | + } | |
| 221 | + return null; | |
| 222 | + } | |
| 223 | + })); | |
| 224 | + } | |
| 225 | + | |
| 226 | + } | |
| 227 | + br.setErrorcode(ErrorCodeConstants.SUCCESS); | |
| 228 | + br.setErrormsg("成功"); | |
| 229 | + return br; | |
| 230 | + } | |
| 147 | 231 | } |