Commit f496f8fc325bb4e697818b258d4686f9d3d8c77e
1 parent
6ae8ee8a8a
Exists in
master
and in
1 other branch
全部孕妇管理增加按照排序
Showing 3 changed files with 674 additions and 0 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/TrackDownFacade.java
View file @
f496f8f
| 1 | +package com.lyms.platform.operate.web.facade; | |
| 2 | + | |
| 3 | +import com.lyms.platform.biz.service.BasicConfigService; | |
| 4 | +import com.lyms.platform.biz.service.TrackDownRecordService; | |
| 5 | +import com.lyms.platform.biz.service.TrackDownService; | |
| 6 | +import com.lyms.platform.common.constants.ErrorCodeConstants; | |
| 7 | +import com.lyms.platform.common.enums.TrackDownDateEnums; | |
| 8 | +import com.lyms.platform.common.enums.TrackDownTransferEnums; | |
| 9 | +import com.lyms.platform.common.result.BaseListResponse; | |
| 10 | +import com.lyms.platform.common.utils.DateUtil; | |
| 11 | +import com.lyms.platform.common.utils.StringUtils; | |
| 12 | +import com.lyms.platform.operate.web.request.TrackDownQueryRequest; | |
| 13 | +import com.lyms.platform.operate.web.utils.CommonsHelper; | |
| 14 | +import com.lyms.platform.pojo.TrackDown; | |
| 15 | +import com.lyms.platform.pojo.TrackDownRecord; | |
| 16 | +import com.lyms.platform.query.TrackDownRecordQuery; | |
| 17 | +import org.apache.commons.collections.CollectionUtils; | |
| 18 | +import org.slf4j.Logger; | |
| 19 | +import org.slf4j.LoggerFactory; | |
| 20 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 21 | +import org.springframework.data.domain.Sort; | |
| 22 | +import org.springframework.data.mongodb.core.MongoTemplate; | |
| 23 | +import org.springframework.data.mongodb.core.query.Criteria; | |
| 24 | +import org.springframework.data.mongodb.core.query.Query; | |
| 25 | +import org.springframework.stereotype.Component; | |
| 26 | + | |
| 27 | +import javax.annotation.PostConstruct; | |
| 28 | +import java.util.ArrayList; | |
| 29 | +import java.util.HashMap; | |
| 30 | +import java.util.List; | |
| 31 | +import java.util.Map; | |
| 32 | + | |
| 33 | + | |
| 34 | +/** | |
| 35 | + * 添加类的一句话简单描述。 | |
| 36 | + * <p/> | |
| 37 | + * 详细描述 | |
| 38 | + * <p/> | |
| 39 | + * 示例代码 | |
| 40 | + * <pre> | |
| 41 | + * </pre/> | |
| 42 | + * | |
| 43 | + * @author JIAZHI.JIANG | |
| 44 | + * @version BME V100R001 2018-01-17 16:40 | |
| 45 | + * @since BME V100R001C40B104 | |
| 46 | + */ | |
| 47 | +@Component | |
| 48 | +public class TrackDownFacade { | |
| 49 | + | |
| 50 | + //日志调测器 | |
| 51 | + private static final Logger logger = LoggerFactory.getLogger(TrackDownFacade.class); | |
| 52 | + | |
| 53 | + @Autowired | |
| 54 | + private TrackDownRecordService trackDownRecordService; | |
| 55 | + | |
| 56 | + @Autowired | |
| 57 | + private TrackDownService trackDownService; | |
| 58 | + | |
| 59 | + @Autowired | |
| 60 | + private BasicConfigService basicConfigService; | |
| 61 | + | |
| 62 | + private Map<Integer, TrackDownTypeHandler> trackDownTypeHandlerMap; | |
| 63 | + @Autowired | |
| 64 | + private MongoTemplate mongoTemplate; | |
| 65 | + @Autowired | |
| 66 | + private AutoMatchFacade autoMatchFacade; | |
| 67 | + | |
| 68 | + @PostConstruct | |
| 69 | + private void init() { | |
| 70 | + trackDownTypeHandlerMap = new HashMap<>(); | |
| 71 | + trackDownTypeHandlerMap.put(TrackDownDateEnums.A.getId(), new FQTrackDownTypeHandler()); | |
| 72 | + } | |
| 73 | + | |
| 74 | + /** | |
| 75 | + * 转换为本地的查询条件 | |
| 76 | + * | |
| 77 | + * @param downQueryRequest | |
| 78 | + * @return | |
| 79 | + */ | |
| 80 | + private TrackDownRecordQuery convertNaviteQuery(TrackDownQueryRequest downQueryRequest,Integer userId) { | |
| 81 | + TrackDownRecordQuery downRecordQuery = new TrackDownRecordQuery(); | |
| 82 | + downRecordQuery.setAreaId(downQueryRequest.getAreaId()); | |
| 83 | + downRecordQuery.setProvinceId(downQueryRequest.getProvinceId()); | |
| 84 | + downRecordQuery.setCityId(downQueryRequest.getCityId()); | |
| 85 | + downRecordQuery.setStreetId(downQueryRequest.getStreetId()); | |
| 86 | + downRecordQuery.setTrackType(downQueryRequest.getTrackType()); | |
| 87 | + downRecordQuery.setPage(downQueryRequest.getPage()); | |
| 88 | + downRecordQuery.setLimit(downQueryRequest.getLimit()); | |
| 89 | + downRecordQuery.setNeed("1"); | |
| 90 | + downRecordQuery.setSort("modified desc"); | |
| 91 | + downRecordQuery.setHospitalId(autoMatchFacade.getHospitalId(userId)); | |
| 92 | + return downRecordQuery; | |
| 93 | + } | |
| 94 | + | |
| 95 | + public BaseListResponse list(TrackDownQueryRequest downQueryRequest,Integer userId) { | |
| 96 | + //转换为本地的查询条件 | |
| 97 | + TrackDownRecordQuery downRecordQuery = convertNaviteQuery(downQueryRequest,userId); | |
| 98 | + | |
| 99 | + List<TrackDownRecord> downRecordList = trackDownRecordService.queryTrackDown(downRecordQuery); | |
| 100 | + | |
| 101 | + List<Map> data = new ArrayList<>(); | |
| 102 | + TrackDownTypeHandler downTypeHandler = trackDownTypeHandlerMap.get(downQueryRequest.getTrackType()); | |
| 103 | + if (CollectionUtils.isNotEmpty(downRecordList) && null != downTypeHandler) { | |
| 104 | + for (TrackDownRecord trackDownRecord : downRecordList) { | |
| 105 | + data.add(downTypeHandler.build(trackDownRecord, mongoTemplate)); | |
| 106 | + } | |
| 107 | + } | |
| 108 | + | |
| 109 | + return new BaseListResponse().setErrormsg(ErrorCodeConstants.SUCCESS_DESCRIPTION).setErrorcode(ErrorCodeConstants.SUCCESS).setData(data).setPageInfo(downRecordQuery.getPageInfo()); | |
| 110 | + } | |
| 111 | + | |
| 112 | + /** | |
| 113 | + * 构建返回字段 | |
| 114 | + */ | |
| 115 | + interface TrackDownTypeHandler { | |
| 116 | + | |
| 117 | + /** | |
| 118 | + * 构建返回字段内容 | |
| 119 | + * | |
| 120 | + * @param downRecord 追访记录 | |
| 121 | + * @param mongoTemplate 数据库连接 | |
| 122 | + * @return 返回的内容 | |
| 123 | + */ | |
| 124 | + Map build(TrackDownRecord downRecord, MongoTemplate mongoTemplate); | |
| 125 | + } | |
| 126 | + | |
| 127 | + /** | |
| 128 | + * 婚前检查返回的字段 | |
| 129 | + */ | |
| 130 | + class FQTrackDownTypeHandler implements TrackDownTypeHandler { | |
| 131 | + | |
| 132 | + @Override | |
| 133 | + public Map build(TrackDownRecord downRecord, MongoTemplate mongoTemplate) { | |
| 134 | + Map<String, Object> temp = new HashMap<>(); | |
| 135 | + temp.put("id", downRecord.getId()); | |
| 136 | + temp.put("pid", downRecord.getPid()); | |
| 137 | + temp.put("residentsArchiveId", downRecord.getParentId()); | |
| 138 | + temp.put("username", downRecord.getUsername()); | |
| 139 | + temp.put("cardNo", downRecord.getCardNo()); | |
| 140 | + temp.put("residenceAddress", CommonsHelper.getFullAddress(downRecord.getProvinceRegisterId(), downRecord.getCityRegisterId(), downRecord.getAreaRegisterId(), downRecord.getAddressRegister(), basicConfigService)); /** 居住地 */ | |
| 141 | + temp.put("phone", StringUtils.encryPhone(downRecord.getPhone())); | |
| 142 | + TrackDown trackDown = mongoTemplate.findOne(Query.query(Criteria.where("parentId").is(downRecord.getParentId()).and("yn").is(1)).with(new Sort(Sort.Direction.DESC, "created")), TrackDown.class); | |
| 143 | + temp.put("age", DateUtil.getAge(downRecord.getBirth())); | |
| 144 | + // 婚检追访结果 | |
| 145 | + temp.put("result", trackDown == null ? "--" : TrackDownTransferEnums.getName(trackDown.getTrackDownType())); | |
| 146 | + // 婚检追访时间 | |
| 147 | + temp.put("trackDownTime", trackDown == null ? "--" : DateUtil.getyyyy_MM_dd(trackDown.getTrackDownDate())); | |
| 148 | + // 预约时间 | |
| 149 | + temp.put("yyTime", trackDown == null ? "--" : DateUtil.getyyyy_MM_dd(trackDown.getReservatDate())); | |
| 150 | + return temp; | |
| 151 | + } | |
| 152 | + } | |
| 153 | + | |
| 154 | + | |
| 155 | + /** | |
| 156 | + * 产前检查返回的字段 | |
| 157 | + */ | |
| 158 | + class CJTrackDownTypeHandler implements TrackDownTypeHandler { | |
| 159 | + | |
| 160 | + @Override | |
| 161 | + public Map build(TrackDownRecord downRecord, MongoTemplate mongoTemplate) { | |
| 162 | + Map<String, Object> temp = new HashMap<>(); | |
| 163 | + temp.put("id", downRecord.getParentId()); | |
| 164 | + temp.put("pid", downRecord.getPid()); | |
| 165 | + temp.put("residentsArchiveId", ""); | |
| 166 | + temp.put("username", downRecord.getUsername()); | |
| 167 | + temp.put("cardNo", downRecord.getCardNo()); | |
| 168 | + temp.put("residenceAddress", CommonsHelper.getFullAddress(downRecord.getProvinceRegisterId(), downRecord.getCityRegisterId(), downRecord.getAreaRegisterId(), downRecord.getAddressRegister(), basicConfigService)); /** 居住地 */ | |
| 169 | + temp.put("phone", StringUtils.encryPhone(downRecord.getPhone())); | |
| 170 | + TrackDown trackDown = mongoTemplate.findOne(Query.query(Criteria.where("parentId").is(downRecord.getParentId()).and("yn").is(1)).with(new Sort(Sort.Direction.DESC, "created")), TrackDown.class); | |
| 171 | + temp.put("age", DateUtil.getAge(downRecord.getBirth())); | |
| 172 | + // 婚检追访结果 | |
| 173 | + temp.put("result", trackDown == null ? "--" : TrackDownTransferEnums.getName(trackDown.getTrackDownType())); | |
| 174 | + // 婚检追访时间 | |
| 175 | + temp.put("trackDownTime", trackDown == null ? "--" : DateUtil.getyyyy_MM_dd(trackDown.getTrackDownDate())); | |
| 176 | + // 预约时间 | |
| 177 | + temp.put("yyTime", trackDown == null ? "--" : DateUtil.getyyyy_MM_dd(trackDown.getReservatDate())); | |
| 178 | + return temp; | |
| 179 | + } | |
| 180 | + } | |
| 181 | +} |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/TrackDownJobFacade.java
View file @
f496f8f
| 1 | +package com.lyms.platform.operate.web.facade; | |
| 2 | + | |
| 3 | +import com.lyms.platform.biz.service.PatientsService; | |
| 4 | +import com.lyms.platform.biz.service.PremaritalCheckupService; | |
| 5 | +import com.lyms.platform.biz.service.ResidentsArchiveService; | |
| 6 | +import com.lyms.platform.biz.service.TrackDownRecordService; | |
| 7 | +import com.lyms.platform.common.constants.ErrorCodeConstants; | |
| 8 | +import com.lyms.platform.common.enums.TrackDownDateEnums; | |
| 9 | +import com.lyms.platform.common.enums.YnEnums; | |
| 10 | +import com.lyms.platform.common.result.BaseResponse; | |
| 11 | +import com.lyms.platform.common.utils.DateUtil; | |
| 12 | +import com.lyms.platform.common.utils.StringUtils; | |
| 13 | +import com.lyms.platform.pojo.Patients; | |
| 14 | +import com.lyms.platform.pojo.PremaritalCheckup; | |
| 15 | +import com.lyms.platform.pojo.ResidentsArchiveModel; | |
| 16 | +import com.lyms.platform.pojo.TrackDownRecord; | |
| 17 | +import com.lyms.platform.query.PatientsQuery; | |
| 18 | +import com.lyms.platform.query.PremaritalCheckupQuery; | |
| 19 | +import com.lyms.platform.query.ResidentsArchiveQuery; | |
| 20 | +import com.lyms.platform.query.TrackDownRecordQuery; | |
| 21 | +import org.apache.commons.collections.CollectionUtils; | |
| 22 | +import org.slf4j.Logger; | |
| 23 | +import org.slf4j.LoggerFactory; | |
| 24 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 25 | +import org.springframework.beans.factory.annotation.Qualifier; | |
| 26 | +import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; | |
| 27 | +import org.springframework.stereotype.Component; | |
| 28 | + | |
| 29 | +import javax.annotation.PostConstruct; | |
| 30 | +import java.util.ArrayList; | |
| 31 | +import java.util.Date; | |
| 32 | +import java.util.List; | |
| 33 | + | |
| 34 | + | |
| 35 | +/** | |
| 36 | + * 追访的任务功能 | |
| 37 | + * <p/> | |
| 38 | + * 主要实现不同的业务跑入到追访对应的列表中 | |
| 39 | + * <p/> | |
| 40 | + * 示例代码 | |
| 41 | + * <pre> | |
| 42 | + * </pre/> | |
| 43 | + * | |
| 44 | + * @author JIAZHI.JIANG | |
| 45 | + * @version BME V100R001 2018-01-18 11:03 | |
| 46 | + * @since BME V100R001C40B104 | |
| 47 | + */ | |
| 48 | +@Component | |
| 49 | +public class TrackDownJobFacade { | |
| 50 | + | |
| 51 | + //日志调测器 | |
| 52 | + private static final Logger logger = LoggerFactory.getLogger(TrackDownJobFacade.class); | |
| 53 | + | |
| 54 | + private List<TrackDownDataLoader> downJobHandlers = new ArrayList<>(); | |
| 55 | + | |
| 56 | + | |
| 57 | + @Autowired | |
| 58 | + @Qualifier("commonThreadPool") | |
| 59 | + private ThreadPoolTaskExecutor commonThreadPool; | |
| 60 | + | |
| 61 | + @Autowired | |
| 62 | + private TrackDownRecordService downRecordService; | |
| 63 | + | |
| 64 | + @Autowired | |
| 65 | + private PatientsService patientsService; | |
| 66 | + | |
| 67 | + @PostConstruct | |
| 68 | + private void init() { | |
| 69 | + //婚前检查数据加载 | |
| 70 | + downJobHandlers.add(new HJTrackDownDataLoader()); | |
| 71 | + //怀孕数据加载 | |
| 72 | + downJobHandlers.add(new HYTrackDownDataLoader()); | |
| 73 | + //产检数据加载 | |
| 74 | + downJobHandlers.add(new CJTrackDownDataLoader()); | |
| 75 | + //分娩数据加载 | |
| 76 | + downJobHandlers.add(new FMTrackDownDataLoader()); | |
| 77 | + } | |
| 78 | + | |
| 79 | + /** | |
| 80 | + * 妇女建档 | |
| 81 | + */ | |
| 82 | + @Autowired | |
| 83 | + private ResidentsArchiveService residentsArchiveService; | |
| 84 | + | |
| 85 | + | |
| 86 | + /** | |
| 87 | + * 婚前检查 | |
| 88 | + */ | |
| 89 | + @Autowired | |
| 90 | + private PremaritalCheckupService premaritalCheckupService; | |
| 91 | + | |
| 92 | + | |
| 93 | + public BaseResponse doBatchExecute(Integer d) { | |
| 94 | + for (final TrackDownDataLoader downDataLoader : downJobHandlers) { | |
| 95 | + commonThreadPool.execute(new Thread() { | |
| 96 | + @Override | |
| 97 | + public void run() { | |
| 98 | + downDataLoader.execute(); | |
| 99 | + } | |
| 100 | + }); | |
| 101 | + } | |
| 102 | + return new BaseResponse().setErrormsg(ErrorCodeConstants.SUCCESS_DESCRIPTION).setErrorcode(ErrorCodeConstants.SUCCESS); | |
| 103 | + } | |
| 104 | + | |
| 105 | + interface TrackDownDataLoader<T> { | |
| 106 | + //分页的条数 | |
| 107 | + int limit = 100; | |
| 108 | + | |
| 109 | + /** | |
| 110 | + * 执行处理方法 | |
| 111 | + */ | |
| 112 | + void execute(); | |
| 113 | + | |
| 114 | + /** | |
| 115 | + * 单条数据狐狸 | |
| 116 | + * | |
| 117 | + * @param model | |
| 118 | + */ | |
| 119 | + void handOneByOne(T model); | |
| 120 | + | |
| 121 | + /** | |
| 122 | + * 构建加入到追访列表的数据 | |
| 123 | + * | |
| 124 | + * @param model | |
| 125 | + * @return | |
| 126 | + */ | |
| 127 | + TrackDownRecord build(T model); | |
| 128 | + } | |
| 129 | + | |
| 130 | + /** | |
| 131 | + * 分娩追访数据加载 | |
| 132 | + */ | |
| 133 | + class FMTrackDownDataLoader implements TrackDownDataLoader<Patients> { | |
| 134 | + | |
| 135 | + @Override | |
| 136 | + public void execute() { | |
| 137 | + int page = 0; | |
| 138 | + List<Patients> data = null; | |
| 139 | + do { | |
| 140 | + PatientsQuery patientsQuery1 = new PatientsQuery(); | |
| 141 | + patientsQuery1.setYn(YnEnums.YES.getId()); | |
| 142 | + patientsQuery1.setSort("created asc"); | |
| 143 | + patientsQuery1.setNeed("1"); | |
| 144 | + patientsQuery1.setPage(page); | |
| 145 | + patientsQuery1.setLimit(limit); | |
| 146 | + patientsQuery1.setType(1); | |
| 147 | + //预产期前两周 | |
| 148 | + patientsQuery1.setDueDateStart(DateUtil.addDay(new Date(), -14)); | |
| 149 | + | |
| 150 | + logger.info("FMTrackDownDataLoader execute "); | |
| 151 | + //查询妇女建档 | |
| 152 | + data = patientsService.queryPatient(patientsQuery1); | |
| 153 | + if (CollectionUtils.isNotEmpty(data)) { | |
| 154 | + for (Patients model : data) { | |
| 155 | + handOneByOne(model); | |
| 156 | + } | |
| 157 | + } | |
| 158 | + page++; | |
| 159 | + } while (CollectionUtils.isNotEmpty(data) && data.size() == limit); | |
| 160 | + } | |
| 161 | + | |
| 162 | + @Override | |
| 163 | + public void handOneByOne(Patients model) { | |
| 164 | + TrackDownRecordQuery downRecordQuery = new TrackDownRecordQuery(); | |
| 165 | + downRecordQuery.setParentId(model.getId()); | |
| 166 | + List<TrackDownRecord> records = downRecordService.queryTrackDown(downRecordQuery); | |
| 167 | + if (CollectionUtils.isEmpty(records)) { | |
| 168 | + logger.info("FMTrackDownDataLoader addTrackDown by id :" + model.getId()); | |
| 169 | + downRecordService.addTrackDown(build(model)); | |
| 170 | + } | |
| 171 | + } | |
| 172 | + | |
| 173 | + @Override | |
| 174 | + public TrackDownRecord build(Patients model) { | |
| 175 | + TrackDownRecord downRecord = new TrackDownRecord(); | |
| 176 | + downRecord.setParentId(model.getId()); | |
| 177 | + downRecord.setPid(model.getPid()); | |
| 178 | + downRecord.setLastMenses(model.getLastMenses()); | |
| 179 | + downRecord.setUsername(model.getUsername()); | |
| 180 | + downRecord.setCityRegisterId(model.getCityRegisterId()); | |
| 181 | + downRecord.setBirth(model.getBirth()); | |
| 182 | + downRecord.setAreaRegisterId(model.getAreaRegisterId()); | |
| 183 | + downRecord.setCardNo(model.getCardNo()); | |
| 184 | + downRecord.setAddressRegister(model.getAddressRegister()); | |
| 185 | + downRecord.setHospitalId(model.getHospitalId()); | |
| 186 | + downRecord.setPhone(model.getPhone()); | |
| 187 | + downRecord.setStreetRegisterId(model.getStreetRegisterId()); | |
| 188 | + downRecord.setAreaRegisterId(model.getAreaRegisterId()); | |
| 189 | + downRecord.setStatus(1); | |
| 190 | + downRecord.setTrackType(TrackDownDateEnums.E.getId()); | |
| 191 | + downRecord.setDone(0); | |
| 192 | + return downRecord; | |
| 193 | + } | |
| 194 | + } | |
| 195 | + | |
| 196 | + | |
| 197 | + /** | |
| 198 | + * 产检追访数据加载 | |
| 199 | + */ | |
| 200 | + class CJTrackDownDataLoader implements TrackDownDataLoader<Patients> { | |
| 201 | + | |
| 202 | + @Override | |
| 203 | + public void execute() { | |
| 204 | + int page = 0; | |
| 205 | + List<Patients> data = null; | |
| 206 | + do { | |
| 207 | + PatientsQuery patientsQuery1 = new PatientsQuery(); | |
| 208 | + patientsQuery1.setYn(YnEnums.YES.getId()); | |
| 209 | + patientsQuery1.setSort("created asc"); | |
| 210 | + patientsQuery1.setNeed("1"); | |
| 211 | + patientsQuery1.setPage(page); | |
| 212 | + patientsQuery1.setLimit(limit); | |
| 213 | + patientsQuery1.setType(1); | |
| 214 | + | |
| 215 | + //查询妇女建档 | |
| 216 | + data = patientsService.queryPatient(patientsQuery1); | |
| 217 | + if (CollectionUtils.isNotEmpty(data)) { | |
| 218 | + for (Patients model : data) { | |
| 219 | + handOneByOne(model); | |
| 220 | + } | |
| 221 | + } | |
| 222 | + page++; | |
| 223 | + } while (CollectionUtils.isNotEmpty(data) && data.size() == limit); | |
| 224 | + } | |
| 225 | + | |
| 226 | + @Override | |
| 227 | + public void handOneByOne(Patients model) { | |
| 228 | + TrackDownRecordQuery downRecordQuery = new TrackDownRecordQuery(); | |
| 229 | + downRecordQuery.setParentId(model.getId()); | |
| 230 | + List<TrackDownRecord> records = downRecordService.queryTrackDown(downRecordQuery); | |
| 231 | + if (CollectionUtils.isEmpty(records)) { | |
| 232 | + logger.info("CJTrackDownDataLoader addTrackDown by id :" + model.getId()); | |
| 233 | + downRecordService.addTrackDown(build(model)); | |
| 234 | + } else { | |
| 235 | + //TODO 处理已经在追访列表的情况 | |
| 236 | + } | |
| 237 | + } | |
| 238 | + | |
| 239 | + @Override | |
| 240 | + public TrackDownRecord build(Patients model) { | |
| 241 | + TrackDownRecord downRecord = new TrackDownRecord(); | |
| 242 | + downRecord.setParentId(model.getId()); | |
| 243 | + downRecord.setPid(model.getPid()); | |
| 244 | + downRecord.setLastMenses(model.getLastMenses()); | |
| 245 | + downRecord.setUsername(model.getUsername()); | |
| 246 | + downRecord.setCityRegisterId(model.getCityRegisterId()); | |
| 247 | + downRecord.setBirth(model.getBirth()); | |
| 248 | + downRecord.setAreaRegisterId(model.getAreaRegisterId()); | |
| 249 | + downRecord.setCardNo(model.getCardNo()); | |
| 250 | + downRecord.setAddressRegister(model.getAddressRegister()); | |
| 251 | + downRecord.setHospitalId(model.getHospitalId()); | |
| 252 | + downRecord.setPhone(model.getPhone()); | |
| 253 | + downRecord.setStreetRegisterId(model.getStreetRegisterId()); | |
| 254 | + downRecord.setAreaRegisterId(model.getAreaRegisterId()); | |
| 255 | + downRecord.setDone(0); | |
| 256 | + downRecord.setStatus(1); | |
| 257 | + downRecord.setTrackType(TrackDownDateEnums.C.getId()); | |
| 258 | + return downRecord; | |
| 259 | + } | |
| 260 | + } | |
| 261 | + | |
| 262 | + /** | |
| 263 | + * 产筛追访数据加载 | |
| 264 | + */ | |
| 265 | + class CSTrackDownDataLoader implements TrackDownDataLoader<Patients> { | |
| 266 | + | |
| 267 | + @Override | |
| 268 | + public void execute() { | |
| 269 | + | |
| 270 | + } | |
| 271 | + | |
| 272 | + @Override | |
| 273 | + public void handOneByOne(Patients model) { | |
| 274 | + | |
| 275 | + } | |
| 276 | + | |
| 277 | + @Override | |
| 278 | + public TrackDownRecord build(Patients model) { | |
| 279 | + return null; | |
| 280 | + } | |
| 281 | + } | |
| 282 | + | |
| 283 | + /** | |
| 284 | + * 怀孕建档数据加载 | |
| 285 | + * <p/> | |
| 286 | + * 完成婚检流程并没有建档 | |
| 287 | + */ | |
| 288 | + class HYTrackDownDataLoader implements TrackDownDataLoader<ResidentsArchiveModel> { | |
| 289 | + | |
| 290 | + @Override | |
| 291 | + public void execute() { | |
| 292 | + int page = 0; | |
| 293 | + List<ResidentsArchiveModel> data = null; | |
| 294 | + do { | |
| 295 | + ResidentsArchiveQuery archiveQuery = new ResidentsArchiveQuery(); | |
| 296 | + archiveQuery.setYn(YnEnums.YES.getId()); | |
| 297 | + archiveQuery.setSort("created asc"); | |
| 298 | + archiveQuery.setNeed("1"); | |
| 299 | + archiveQuery.setPage(page); | |
| 300 | + archiveQuery.setLimit(limit); | |
| 301 | + //查询妇女建档 | |
| 302 | + data = residentsArchiveService.queryResident(archiveQuery); | |
| 303 | + if (CollectionUtils.isNotEmpty(data)) { | |
| 304 | + for (ResidentsArchiveModel model : data) { | |
| 305 | + handOneByOne(model); | |
| 306 | + } | |
| 307 | + } | |
| 308 | + page++; | |
| 309 | + } while (CollectionUtils.isNotEmpty(data) && data.size() == limit); | |
| 310 | + } | |
| 311 | + | |
| 312 | + @Override | |
| 313 | + public void handOneByOne(ResidentsArchiveModel model) { | |
| 314 | + PatientsQuery patientsQuery1 = new PatientsQuery(); | |
| 315 | + patientsQuery1.setCardNo(model.getCertificateNum()); | |
| 316 | + patientsQuery1.setPcerteTypeId(model.getCertificateTypeId()); | |
| 317 | + patientsQuery1.setType(1); | |
| 318 | + Integer count = patientsService.queryPatientCount(patientsQuery1); | |
| 319 | + if (null != count && count == 0) { | |
| 320 | + logger.info("HYTrackDownDataLoader addTrackDown by id :" + model.getId()); | |
| 321 | + downRecordService.addTrackDown(build(model)); | |
| 322 | + } | |
| 323 | + } | |
| 324 | + | |
| 325 | + @Override | |
| 326 | + public TrackDownRecord build(ResidentsArchiveModel model) { | |
| 327 | + TrackDownRecord record = new TrackDownRecord(); | |
| 328 | + record.setParentId(model.getId()); | |
| 329 | + record.setAddressRegister(model.getAddressRegister()); | |
| 330 | + record.setAreaRegisterId(model.getAreaRegisterId()); | |
| 331 | + record.setBirth(model.getBirthday()); | |
| 332 | + record.setCityRegisterId(model.getCityRegisterId()); | |
| 333 | + record.setUsername(model.getUsername()); | |
| 334 | + record.setStreetRegisterId(model.getStreetRegisterId()); | |
| 335 | + record.setPhone(model.getPhone()); | |
| 336 | + record.setHospitalId(model.getHospitalId()); | |
| 337 | + record.setStatus(1); | |
| 338 | + record.setDone(0); | |
| 339 | + record.setCardNo(model.getCertificateNum()); | |
| 340 | + record.setTrackType(TrackDownDateEnums.B.getId()); | |
| 341 | + return record; | |
| 342 | + } | |
| 343 | + } | |
| 344 | + | |
| 345 | + | |
| 346 | + /** | |
| 347 | + * 婚前检查数据加载 | |
| 348 | + * <p/> | |
| 349 | + * 该处查询的患者为院内存在妇女建档,且没有进行婚前检查并且追访过程中未流转至下一环节的患者信息 | |
| 350 | + */ | |
| 351 | + class HJTrackDownDataLoader implements TrackDownDataLoader<ResidentsArchiveModel> { | |
| 352 | + | |
| 353 | + @Override | |
| 354 | + public void execute() { | |
| 355 | + int page = 1; | |
| 356 | + List<ResidentsArchiveModel> data = null; | |
| 357 | + do { | |
| 358 | + ResidentsArchiveQuery archiveQuery = new ResidentsArchiveQuery(); | |
| 359 | + archiveQuery.setYn(YnEnums.YES.getId()); | |
| 360 | + archiveQuery.setSort("created asc"); | |
| 361 | + archiveQuery.setNeed("1"); | |
| 362 | + archiveQuery.setPage(page); | |
| 363 | + archiveQuery.setLimit(limit); | |
| 364 | + //查询妇女建档 | |
| 365 | + data = residentsArchiveService.queryResident(archiveQuery); | |
| 366 | + if (CollectionUtils.isNotEmpty(data)) { | |
| 367 | + for (ResidentsArchiveModel model : data) { | |
| 368 | + //单条数据处理 | |
| 369 | + handOneByOne(model); | |
| 370 | + } | |
| 371 | + } | |
| 372 | + page++; | |
| 373 | + } while (CollectionUtils.isNotEmpty(data) && data.size() == limit); | |
| 374 | + } | |
| 375 | + | |
| 376 | + /** | |
| 377 | + * 单条处理 | |
| 378 | + * | |
| 379 | + * @param model | |
| 380 | + */ | |
| 381 | + public void handOneByOne(ResidentsArchiveModel model) { | |
| 382 | + if (null != model && StringUtils.isNotEmpty(model.getId())) { | |
| 383 | + PremaritalCheckupQuery premaritalCheckupQuery = new PremaritalCheckupQuery(); | |
| 384 | + premaritalCheckupQuery.setYn(YnEnums.YES.getId()); | |
| 385 | + premaritalCheckupQuery.setParentId(model.getId()); | |
| 386 | + premaritalCheckupQuery.setSexType(1); | |
| 387 | + List<PremaritalCheckup> DATA = premaritalCheckupService.queryPremaritalCheckup(premaritalCheckupQuery); | |
| 388 | + | |
| 389 | + if (CollectionUtils.isEmpty(DATA)) { | |
| 390 | + logger.info("HJTrackDownDataLoader addTrackDown by id :" + model.getId()); | |
| 391 | + downRecordService.addTrackDown(build(model)); | |
| 392 | + } else { | |
| 393 | + //TODO 如果有婚检还存在的情况 | |
| 394 | + } | |
| 395 | + } | |
| 396 | + } | |
| 397 | + | |
| 398 | + /** | |
| 399 | + * 构建入追访列表的数据 | |
| 400 | + * | |
| 401 | + * @param model | |
| 402 | + * @return | |
| 403 | + */ | |
| 404 | + public TrackDownRecord build(ResidentsArchiveModel model) { | |
| 405 | + TrackDownRecord record = new TrackDownRecord(); | |
| 406 | + record.setParentId(model.getId()); | |
| 407 | + record.setAddressRegister(model.getAddressRegister()); | |
| 408 | + record.setAreaRegisterId(model.getAreaRegisterId()); | |
| 409 | + record.setBirth(model.getBirthday()); | |
| 410 | + record.setCityRegisterId(model.getCityRegisterId()); | |
| 411 | + record.setUsername(model.getUsername()); | |
| 412 | + record.setStreetRegisterId(model.getStreetRegisterId()); | |
| 413 | + record.setPhone(model.getPhone()); | |
| 414 | + record.setHospitalId(model.getHospitalId()); | |
| 415 | + record.setStatus(1); | |
| 416 | + record.setDone(0); | |
| 417 | + record.setCardNo(model.getCertificateNum()); | |
| 418 | + record.setTrackType(TrackDownDateEnums.A.getId()); | |
| 419 | + return record; | |
| 420 | + } | |
| 421 | + } | |
| 422 | +} |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/TrackDownQueryRequest.java
View file @
f496f8f
| 1 | +package com.lyms.platform.operate.web.request; | |
| 2 | + | |
| 3 | +/** | |
| 4 | + * 添加类的一句话简单描述。 | |
| 5 | + * <p/> | |
| 6 | + * 详细描述 | |
| 7 | + * <p/> | |
| 8 | + * 示例代码 | |
| 9 | + * <pre> | |
| 10 | + * </pre/> | |
| 11 | + * | |
| 12 | + * @author JIAZHI.JIANG | |
| 13 | + * @version BME V100R001 2018-01-17 17:05 | |
| 14 | + * @since BME V100R001C40B104 | |
| 15 | + */ | |
| 16 | +public class TrackDownQueryRequest extends BasePageQueryRequest{ | |
| 17 | + private String provinceId; | |
| 18 | + private String cityId; | |
| 19 | + private String areaId; | |
| 20 | + private String streetId; | |
| 21 | + private String key; | |
| 22 | + private Integer trackType; | |
| 23 | + | |
| 24 | + public String getProvinceId() { | |
| 25 | + return provinceId; | |
| 26 | + } | |
| 27 | + | |
| 28 | + public void setProvinceId(String provinceId) { | |
| 29 | + this.provinceId = provinceId; | |
| 30 | + } | |
| 31 | + | |
| 32 | + public String getCityId() { | |
| 33 | + return cityId; | |
| 34 | + } | |
| 35 | + | |
| 36 | + public void setCityId(String cityId) { | |
| 37 | + this.cityId = cityId; | |
| 38 | + } | |
| 39 | + | |
| 40 | + public String getAreaId() { | |
| 41 | + return areaId; | |
| 42 | + } | |
| 43 | + | |
| 44 | + public void setAreaId(String areaId) { | |
| 45 | + this.areaId = areaId; | |
| 46 | + } | |
| 47 | + | |
| 48 | + public String getStreetId() { | |
| 49 | + return streetId; | |
| 50 | + } | |
| 51 | + | |
| 52 | + public void setStreetId(String streetId) { | |
| 53 | + this.streetId = streetId; | |
| 54 | + } | |
| 55 | + | |
| 56 | + public String getKey() { | |
| 57 | + return key; | |
| 58 | + } | |
| 59 | + | |
| 60 | + public void setKey(String key) { | |
| 61 | + this.key = key; | |
| 62 | + } | |
| 63 | + | |
| 64 | + public Integer getTrackType() { | |
| 65 | + return trackType; | |
| 66 | + } | |
| 67 | + | |
| 68 | + public void setTrackType(Integer trackType) { | |
| 69 | + this.trackType = trackType; | |
| 70 | + } | |
| 71 | +} |