Commit a5d30f60a746514ef5bf537e75533a9eecf96b0d
1 parent
96b7db9e7b
Exists in
master
and in
6 other branches
自动生成追访信息
Showing 3 changed files with 95 additions and 15 deletions
platform-dal/src/main/java/com/lyms/platform/query/TrackDownRecordQuery.java
View file @
a5d30f6
| ... | ... | @@ -201,7 +201,9 @@ |
| 201 | 201 | MongoCondition condition = MongoCondition.newInstance(); |
| 202 | 202 | |
| 203 | 203 | if (status!=null) { |
| 204 | - condition = condition.and("status", status, MongoOper.IS); | |
| 204 | + if(status!=3){//查询全部 | |
| 205 | + condition = condition.and("status", status, MongoOper.IS); | |
| 206 | + } | |
| 205 | 207 | } else { |
| 206 | 208 | //默认只查询显示的数据 |
| 207 | 209 | condition = condition.and("status", 1, MongoOper.IS); |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/TrackDownFacade.java
View file @
a5d30f6
| ... | ... | @@ -266,10 +266,11 @@ |
| 266 | 266 | if (CollectionUtils.isNotEmpty(downRecordList) && null != downTypeHandler) { |
| 267 | 267 | for (TrackDownRecord trackDownRecord : downRecordList) { |
| 268 | 268 | //追访类型 |
| 269 | + Integer trackType = trackDownRecord.getTrackType(); | |
| 270 | + | |
| 269 | 271 | //查询的追访类型 |
| 270 | 272 | trackDownRecord.setTrackType(downQueryRequest.getTrackType()); |
| 271 | 273 | Map map = downTypeHandler.build(trackDownRecord, mongoTemplate); |
| 272 | - Integer trackType = trackDownRecord.getTrackType(); | |
| 273 | 274 | if(downQueryRequest.getTrackType()==TrackDownDateEnums.D.getId()){ |
| 274 | 275 | if(trackType == TrackDownDateEnums.C.getId()){ |
| 275 | 276 | trackType = TrackDownDateEnums.D.getId(); |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/TrackDownServiceImpl.java
View file @
a5d30f6
| ... | ... | @@ -112,15 +112,16 @@ |
| 112 | 112 | private List<Map<String, Object>> getResidentMainData(List<ResidentsArchiveModel> residentsArchiveModels) { |
| 113 | 113 | List<Map<String, Object>> archiveModelList = new ArrayList<>(); |
| 114 | 114 | |
| 115 | + | |
| 115 | 116 | for (ResidentsArchiveModel archiveModel : residentsArchiveModels) { |
| 116 | 117 | Map<String, Object> temp = new HashMap<>(); |
| 117 | 118 | temp.put("bookbuild", 3);//孕期建档默认空白 |
| 118 | 119 | temp.put("cqsc", 3);//产前筛查默认空白 |
| 119 | 120 | temp.put("fm", 3);//分娩空白 |
| 120 | 121 | temp.put("chfc", 3);//产后复查空白 |
| 121 | - Long checkNum = mongoTemplate.count(Query.query(Criteria.where("certificateNum").is(archiveModel.getCertificateNum()).and("yn").is(1)), PremaritalCheckup.class); | |
| 122 | 122 | temp.put("resident", 1); // 妇女建档 |
| 123 | 123 | temp.put("check", 3); // 婚检 |
| 124 | + Long checkNum = mongoTemplate.count(Query.query(Criteria.where("certificateNum").is(archiveModel.getCertificateNum()).and("yn").is(1)), PremaritalCheckup.class); | |
| 124 | 125 | |
| 125 | 126 | |
| 126 | 127 | PatientsQuery patientsQuery = new PatientsQuery(); |
| 127 | 128 | |
| 128 | 129 | |
| ... | ... | @@ -142,16 +143,15 @@ |
| 142 | 143 | temp.put("bookbuild", 1); // 孕期建档 1=勾勾 2=叉叉 |
| 143 | 144 | temp.put("bookbuildDate", DateUtil.getyyyy_MM_dd(patients.getBookbuildingDate())); |
| 144 | 145 | |
| 145 | - | |
| 146 | - if(patients.getDueStatus() == 1||patients.getIsAutoFm() == 1){//终止妊娠,或自动分娩 | |
| 146 | + if (patients.getDueStatus() == 1 || (patients.getIsAutoFm()!=null&& patients.getIsAutoFm() == 1)) {//终止妊娠,或自动分娩 | |
| 147 | 147 | temp.put("fm", 2); // 分娩 1=勾勾 2=叉叉 |
| 148 | - }else if (patients.getType() == 3) { | |
| 148 | + } else if (patients.getType() == 3) { | |
| 149 | 149 | temp.put("fm", 1); // 分娩 1=勾勾 2=叉叉 |
| 150 | 150 | temp.put("fmType", patients.getFmType()); // 分娩方式 1: 顺产,2:剖宫产 |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | //孕检次数 |
| 154 | - temp.put("yjcount", mongoTemplate.count(Query.query(Criteria.where("parentId").is(patients.getId()).and("yn").is(1)), AntenatalExaminationModel.class) + mongoTemplate.count(Query.query(Criteria.where("parentId").is(patients.getId()).and("yn").is(1)), AntExChuModel.class)); | |
| 154 | + temp.put("yjcount", getChuzhenCount(patients.getId())); | |
| 155 | 155 | if (patients.getType() == 3) { |
| 156 | 156 | //产后复查 |
| 157 | 157 | PostReviewQuery postReviewQuery = new PostReviewQuery(); |
| ... | ... | @@ -190,6 +190,32 @@ |
| 190 | 190 | temp.put("phone", StringUtils.encryPhone(archiveModel.getPhone())); |
| 191 | 191 | temp.put("age", DateUtil.getAge(archiveModel.getBirthday())); |
| 192 | 192 | temp.put("residentDate", DateUtil.getyyyy_MM_dd(archiveModel.getBuildDay())); // 妇女建档日期 |
| 193 | + | |
| 194 | + TrackDownRecordQuery downRecordQuery = new TrackDownRecordQuery(); | |
| 195 | + downRecordQuery.setSource(archiveModel.getId()); | |
| 196 | + downRecordQuery.setStatus(0); | |
| 197 | + List<TrackDownRecord> records = trackDownRecordService.queryTrackDown(downRecordQuery); | |
| 198 | + TrackDownRecord trackDownRecord = null; | |
| 199 | + if (org.apache.commons.collections.CollectionUtils.isNotEmpty(records)) {//存在则进行修改,只修改基本信息,不修改显示状态和追访类型 | |
| 200 | + trackDownRecord = records.get(0); | |
| 201 | + } else {//根据patient查询是否存在追访信息 | |
| 202 | + //根据医院id和身份证或手机号进行查询 | |
| 203 | + downRecordQuery = new TrackDownRecordQuery(); | |
| 204 | + downRecordQuery.setStatus(3); | |
| 205 | + downRecordQuery.setHospitalId(archiveModel.getHospitalId()); | |
| 206 | + if (StringUtils.isNotEmpty(archiveModel.getCertificateNum())) { | |
| 207 | + downRecordQuery.setCardNo(archiveModel.getCertificateNum()); | |
| 208 | + } else if (StringUtils.isNotEmpty(archiveModel.getPhone())) { | |
| 209 | + downRecordQuery.setPhone(archiveModel.getPhone()); | |
| 210 | + } | |
| 211 | + records = trackDownRecordService.queryTrackDown(downRecordQuery); | |
| 212 | + if (org.apache.commons.collections.CollectionUtils.isNotEmpty(records)) {// | |
| 213 | + trackDownRecord = records.get(0); | |
| 214 | + } | |
| 215 | + } | |
| 216 | + | |
| 217 | + isExitTrackDown(trackDownRecord, temp); | |
| 218 | + | |
| 193 | 219 | archiveModelList.add(temp); |
| 194 | 220 | } |
| 195 | 221 | return archiveModelList; |
| ... | ... | @@ -198,6 +224,7 @@ |
| 198 | 224 | private List<Map<String, Object>> getPatientMainData(List<Patients> patients) { |
| 199 | 225 | List<Map<String, Object>> restList = new ArrayList<>(); |
| 200 | 226 | for (Patients patient : patients) { // type: 1=孕期 3=产后 |
| 227 | + | |
| 201 | 228 | Map<String, Object> temp = new HashMap<>(); |
| 202 | 229 | temp.put("bookbuild", 1); |
| 203 | 230 | temp.put("cqsc", 3);//产前筛查默认空白 |
| 204 | 231 | |
| 205 | 232 | |
| ... | ... | @@ -231,17 +258,15 @@ |
| 231 | 258 | temp.put("bookbuild", 1); // 孕期建档 1=勾勾 2=叉叉 |
| 232 | 259 | |
| 233 | 260 | |
| 234 | - | |
| 235 | - | |
| 236 | - if(patient.getDueStatus() == 1||patient.getIsAutoFm() == 1){//终止妊娠,或自动分娩 | |
| 261 | + if (patient.getDueStatus() == 1 || (patient.getIsAutoFm()!=null&&patient.getIsAutoFm() == 1)) {//终止妊娠,或自动分娩 | |
| 237 | 262 | temp.put("fm", 2); // 分娩 1=勾勾 2=叉叉 |
| 238 | - }else if (patient.getType() == 3) { //本院已分娩 | |
| 263 | + } else if (patient.getType() == 3) { //本院已分娩 | |
| 239 | 264 | temp.put("fm", 1); // 孕期建档 1=勾勾 2=叉叉 |
| 240 | 265 | temp.put("fmType", patient.getFmType()); // 分娩方式 1: 顺产,2:剖宫产 |
| 241 | 266 | } |
| 242 | 267 | |
| 243 | 268 | //孕检次数 |
| 244 | - temp.put("yjcount", mongoTemplate.count(Query.query(Criteria.where("parentId").is(patient.getId()).and("yn").is(1)), AntenatalExaminationModel.class) + mongoTemplate.count(Query.query(Criteria.where("parentId").is(patient.getId()).and("yn").is(1)), AntExChuModel.class)); | |
| 269 | + temp.put("yjcount", getChuzhenCount(patient.getId())); | |
| 245 | 270 | |
| 246 | 271 | if (patient.getType() == 3) {//分娩后 |
| 247 | 272 | //产后复查 |
| 248 | 273 | |
| ... | ... | @@ -273,14 +298,66 @@ |
| 273 | 298 | temp.put("cqsc", 2);//产前筛查 |
| 274 | 299 | } |
| 275 | 300 | } |
| 301 | + | |
| 302 | + //查询是否存在追访记录,如果有则修改,没有则新增 | |
| 303 | + TrackDownRecordQuery downRecordQuery = new TrackDownRecordQuery(); | |
| 304 | + downRecordQuery.setParentId(patient.getId()); | |
| 305 | + downRecordQuery.setStatus(3); | |
| 306 | + TrackDownRecord track = null; | |
| 307 | + List<TrackDownRecord> records = trackDownRecordService.queryTrackDown(downRecordQuery); | |
| 308 | + if (CollectionUtils.isNotEmpty(records)) { | |
| 309 | + track = records.get(0); | |
| 310 | + } | |
| 311 | + isExitTrackDown(track, temp); | |
| 312 | + | |
| 276 | 313 | restList.add(temp); |
| 277 | 314 | } |
| 278 | 315 | return restList; |
| 279 | 316 | } |
| 280 | 317 | |
| 281 | - private int isExitTrackDown(String parentId, TrackDownDateEnums trackDownDateEnums) { | |
| 282 | - return mongoTemplate.exists(Query.query(Criteria.where("parentId").is(parentId).and("yn").is(1) | |
| 283 | - .and("trackDownDateType").is(trackDownDateEnums.getId()).and("trackDownTransfer").in(Arrays.asList(2, 3))), TrackDown.class) ? 2 : 3; | |
| 318 | + /** | |
| 319 | + * 数据未空流程处理 | |
| 320 | + * | |
| 321 | + * @param trackDownRecord | |
| 322 | + * @param map | |
| 323 | + */ | |
| 324 | + private void isExitTrackDown(TrackDownRecord trackDownRecord, Map<String, Object> map) { | |
| 325 | + if (trackDownRecord != null) { | |
| 326 | + if ((int) map.get("bookbuild") == 3) {//孕期建档 | |
| 327 | + //如果当前流程已经结束流程,则显示X | |
| 328 | + if (trackDownRecord.getTrackType() <= TrackDownDateEnums.B.getId()) { | |
| 329 | + map.put("bookbuild", 2); | |
| 330 | + } | |
| 331 | + } | |
| 332 | + | |
| 333 | + if ((int) map.get("cqsc") == 3) {//产前筛查 | |
| 334 | + //如果当前流程已经结束流程,则显示X | |
| 335 | + if (trackDownRecord.getTrackType() <= TrackDownDateEnums.C.getId()) { | |
| 336 | + map.put("cqsc", 2); | |
| 337 | + } | |
| 338 | + } | |
| 339 | + | |
| 340 | + if ((int) map.get("fm") == 3) {//分娩 | |
| 341 | + //如果当前流程已经结束流程,则显示X | |
| 342 | + if (trackDownRecord.getTrackType() <= TrackDownDateEnums.E.getId()) { | |
| 343 | + map.put("fm", 2); | |
| 344 | + } | |
| 345 | + } | |
| 346 | + | |
| 347 | + if ((int) map.get("chfc") == 3) {//产后复查 | |
| 348 | + //如果当前流程已经结束流程,则显示X | |
| 349 | + if (trackDownRecord.getTrackType() <= TrackDownDateEnums.F.getId()) { | |
| 350 | + map.put("chfc", 2); | |
| 351 | + } | |
| 352 | + } | |
| 353 | + | |
| 354 | + if ((int) map.get("check") == 3) {//婚检 | |
| 355 | + //如果当前流程已经结束流程,则显示X | |
| 356 | + if (trackDownRecord.getTrackType() <= TrackDownDateEnums.A.getId()) { | |
| 357 | + map.put("check", 2); | |
| 358 | + } | |
| 359 | + } | |
| 360 | + } | |
| 284 | 361 | } |
| 285 | 362 | |
| 286 | 363 |