Commit d94987fd4c56eb6971f19b7c4aa8dc929c140aa5
1 parent
a9ae65bd44
Exists in
master
and in
6 other branches
追访数据个节点更新bug第二轮自测bug修改
Showing 5 changed files with 189 additions and 134 deletions
- platform-dal/src/main/java/com/lyms/platform/pojo/Patients.java
- platform-dal/src/main/java/com/lyms/platform/query/TrackDownRecordQuery.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BookbuildingFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/ResidentsArchiveFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/TrackDownServiceImpl.java
platform-dal/src/main/java/com/lyms/platform/pojo/Patients.java
View file @
d94987f
| ... | ... | @@ -1178,6 +1178,7 @@ |
| 1178 | 1178 | downRecord.setAreaRegisterId(getAreaRegisterId()); |
| 1179 | 1179 | //默认值 |
| 1180 | 1180 | downRecord.setHospitalId(getHospitalId()); |
| 1181 | + downRecord.setSource(getId()); | |
| 1181 | 1182 | downRecord.setStatus(1); |
| 1182 | 1183 | downRecord.setTrackType(TrackDownDateEnums.C.getId()); |
| 1183 | 1184 | return downRecord; |
platform-dal/src/main/java/com/lyms/platform/query/TrackDownRecordQuery.java
View file @
d94987f
| ... | ... | @@ -26,6 +26,7 @@ |
| 26 | 26 | * @since BME V100R001C40B104 |
| 27 | 27 | */ |
| 28 | 28 | public class TrackDownRecordQuery extends BaseQuery implements IConvertToNativeQuery { |
| 29 | + private String id; | |
| 29 | 30 | private String provinceId; |
| 30 | 31 | private String cityId; |
| 31 | 32 | private String areaId; |
| ... | ... | @@ -39,6 +40,8 @@ |
| 39 | 40 | private String residentsArchiveId; |
| 40 | 41 | private String source; |
| 41 | 42 | private String status; |
| 43 | + private String cardNo; | |
| 44 | + private String phone; | |
| 42 | 45 | /** |
| 43 | 46 | * 末次月经 |
| 44 | 47 | */ |
| ... | ... | @@ -49,6 +52,30 @@ |
| 49 | 52 | */ |
| 50 | 53 | private Date lastMensesEnd; |
| 51 | 54 | |
| 55 | + public String getPhone() { | |
| 56 | + return phone; | |
| 57 | + } | |
| 58 | + | |
| 59 | + public void setPhone(String phone) { | |
| 60 | + this.phone = phone; | |
| 61 | + } | |
| 62 | + | |
| 63 | + public String getId() { | |
| 64 | + return id; | |
| 65 | + } | |
| 66 | + | |
| 67 | + public void setId(String id) { | |
| 68 | + this.id = id; | |
| 69 | + } | |
| 70 | + | |
| 71 | + public String getCardNo() { | |
| 72 | + return cardNo; | |
| 73 | + } | |
| 74 | + | |
| 75 | + public void setCardNo(String cardNo) { | |
| 76 | + this.cardNo = cardNo; | |
| 77 | + } | |
| 78 | + | |
| 52 | 79 | public List getTrackTypes() { |
| 53 | 80 | return trackTypes; |
| 54 | 81 | } |
| 55 | 82 | |
| 56 | 83 | |
| 57 | 84 | |
| 58 | 85 | |
| 59 | 86 | |
| 60 | 87 | |
| 61 | 88 | |
| 62 | 89 | |
| 63 | 90 | |
| 64 | 91 | |
| 65 | 92 | |
| 66 | 93 | |
| ... | ... | @@ -168,55 +195,62 @@ |
| 168 | 195 | public void setTrackType(Integer trackType) { |
| 169 | 196 | this.trackType = trackType; |
| 170 | 197 | } |
| 198 | + | |
| 171 | 199 | @Override |
| 172 | 200 | public MongoQuery convertToQuery() { |
| 173 | - MongoCondition condition=MongoCondition.newInstance(); | |
| 201 | + MongoCondition condition = MongoCondition.newInstance(); | |
| 174 | 202 | |
| 175 | - if(StringUtils.isNotEmpty(status)){ | |
| 176 | - condition= condition.and("status",status, MongoOper.IS); | |
| 177 | - }else{ | |
| 203 | + if (StringUtils.isNotEmpty(status)) { | |
| 204 | + condition = condition.and("status", status, MongoOper.IS); | |
| 205 | + } else { | |
| 178 | 206 | //默认只查询显示的数据 |
| 179 | - condition= condition.and("status",1, MongoOper.IS); | |
| 207 | + condition = condition.and("status", 1, MongoOper.IS); | |
| 180 | 208 | } |
| 181 | 209 | |
| 182 | - if(StringUtils.isNotEmpty(provinceId)){ | |
| 183 | - condition= condition.and("provinceId",provinceId, MongoOper.IS); | |
| 210 | + if (StringUtils.isNotEmpty(id)) { | |
| 211 | + condition = condition.and("id", id, MongoOper.IS); | |
| 184 | 212 | } |
| 185 | - if(StringUtils.isNotEmpty(residentsArchiveId)){ | |
| 186 | - condition= condition.and("residentsArchiveId",residentsArchiveId, MongoOper.IS); | |
| 213 | + | |
| 214 | + if (StringUtils.isNotEmpty(phone)) { | |
| 215 | + condition = condition.and("phone", phone, MongoOper.IS); | |
| 187 | 216 | } |
| 188 | - if(StringUtils.isNotEmpty(cityId)){ | |
| 189 | - condition= condition.and("cityId",cityId, MongoOper.IS); | |
| 217 | + | |
| 218 | + if (StringUtils.isNotEmpty(cardNo)) { | |
| 219 | + condition = condition.and("cardNo", cardNo, MongoOper.IS); | |
| 190 | 220 | } |
| 191 | - if(StringUtils.isNotEmpty(areaId)){ | |
| 192 | - condition= condition.and("areaId",areaId, MongoOper.IS); | |
| 221 | + | |
| 222 | + if (StringUtils.isNotEmpty(provinceId)) { | |
| 223 | + condition = condition.and("provinceId", provinceId, MongoOper.IS); | |
| 193 | 224 | } |
| 194 | - if(StringUtils.isNotEmpty(hospitalId)){ | |
| 195 | - condition= condition.and("hospitalId",hospitalId, MongoOper.IS); | |
| 225 | + if (StringUtils.isNotEmpty(residentsArchiveId)) { | |
| 226 | + condition = condition.and("residentsArchiveId", residentsArchiveId, MongoOper.IS); | |
| 196 | 227 | } |
| 197 | - if(StringUtils.isNotEmpty(streetId)){ | |
| 228 | + if (StringUtils.isNotEmpty(cityId)) { | |
| 229 | + condition = condition.and("cityId", cityId, MongoOper.IS); | |
| 230 | + } | |
| 231 | + if (StringUtils.isNotEmpty(areaId)) { | |
| 232 | + condition = condition.and("areaId", areaId, MongoOper.IS); | |
| 233 | + } | |
| 234 | + if (StringUtils.isNotEmpty(hospitalId)) { | |
| 235 | + condition = condition.and("hospitalId", hospitalId, MongoOper.IS); | |
| 236 | + } | |
| 237 | + if (StringUtils.isNotEmpty(streetId)) { | |
| 198 | 238 | condition = condition.and("streetId", streetId, MongoOper.IS); |
| 199 | 239 | } |
| 200 | - if(null!=trackType){ | |
| 240 | + if (null != trackType) { | |
| 201 | 241 | condition = condition.and("trackType", trackType, MongoOper.IS); |
| 202 | 242 | } |
| 203 | 243 | if (null != trackTypes) { |
| 204 | 244 | condition = condition.and("trackType", trackTypes, MongoOper.IN); |
| 205 | 245 | } |
| 206 | 246 | |
| 207 | - if(StringUtils.isNotEmpty(source)&&StringUtils.isNotEmpty(parentId)){ | |
| 208 | - MongoCondition con1 = MongoCondition.newInstance("source", source, MongoOper.IS); | |
| 209 | - MongoCondition con2 = MongoCondition.newInstance("parentId", parentId, MongoOper.IS); | |
| 210 | - condition = condition.orCondition(new MongoCondition[]{con1, con2}); | |
| 211 | - | |
| 212 | - }else { | |
| 213 | - if (StringUtils.isNotEmpty(source)) { | |
| 214 | - condition = condition.and("source", source, MongoOper.IS); | |
| 215 | - } | |
| 216 | - if (StringUtils.isNotEmpty(parentId)) { | |
| 217 | - condition = condition.and("parentId", parentId, MongoOper.IS); | |
| 218 | - } | |
| 247 | + if (StringUtils.isNotEmpty(source)) { | |
| 248 | + condition = condition.and("source", source, MongoOper.IS); | |
| 219 | 249 | } |
| 250 | + if (StringUtils.isNotEmpty(parentId)) { | |
| 251 | + condition = condition.and("parentId", parentId, MongoOper.IS); | |
| 252 | + } | |
| 253 | + | |
| 220 | 254 | if (null != pids) { |
| 221 | 255 | condition = condition.and("pid", pids, MongoOper.IN); |
| 222 | 256 | } |
| ... | ... | @@ -224,7 +258,7 @@ |
| 224 | 258 | |
| 225 | 259 | Criteria c1 = null; |
| 226 | 260 | |
| 227 | - if(StringUtils.isNotEmpty(key)){ | |
| 261 | + if (StringUtils.isNotEmpty(key)) { | |
| 228 | 262 | MongoCondition c = MongoCondition.newInstance(); |
| 229 | 263 | MongoCondition con1 = MongoCondition.newInstance("phone", key, MongoOper.IS); |
| 230 | 264 | MongoCondition con2 = MongoCondition.newInstance("username", "^" + key, MongoOper.LIKE); |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BookbuildingFacade.java
View file @
d94987f
| ... | ... | @@ -279,48 +279,9 @@ |
| 279 | 279 | //新增孕妇档案 |
| 280 | 280 | Patients p = yunBookbuildingService.addPregnantBookbuilding(patient); |
| 281 | 281 | |
| 282 | - //添加产后追访信息 | |
| 283 | - TrackDownRecord trackDownRecord = patient.build(); | |
| 282 | + //添加追访信息 | |
| 283 | + addTrackDownInfo(userId, p, yunRequest); | |
| 284 | 284 | |
| 285 | - | |
| 286 | - ResidentsArchiveQuery archiveQuery = new ResidentsArchiveQuery(); | |
| 287 | - archiveQuery.setYn(YnEnums.YES.getId()); | |
| 288 | - archiveQuery.setHospitalId(yunRequest.getHospitalId()); | |
| 289 | - | |
| 290 | - boolean isSaveTrack = true; | |
| 291 | - | |
| 292 | - if (org.apache.commons.lang.StringUtils.isNotEmpty(patient.getCardNo())) { | |
| 293 | - archiveQuery.setCertificateNum(patient.getCardNo()); | |
| 294 | - List<ResidentsArchiveModel> residents = residentsArchiveService.queryResident(archiveQuery); | |
| 295 | - if (CollectionUtils.isNotEmpty(residents) && residents.get(0) != null) { | |
| 296 | - ResidentsArchiveModel archiveModel = residents.get(0); | |
| 297 | - //添加产后追访信息 | |
| 298 | - TrackDownRecordQuery downRecordQuery = new TrackDownRecordQuery(); | |
| 299 | - downRecordQuery.setSource(archiveModel.getId()); | |
| 300 | - List<TrackDownRecord> records = trackDownRecordService.queryTrackDown(downRecordQuery); | |
| 301 | - if (CollectionUtils.isNotEmpty(records)) {//修改 | |
| 302 | - TrackDownRecord trackDownRecord1 = records.get(0); | |
| 303 | - if (trackDownRecord1.getStatus() == 1 && trackDownRecord1.getTrackType() < TrackDownDateEnums.C.getId()) { | |
| 304 | - trackDownRecord.setHospitalId(yunRequest.getHospitalId()); | |
| 305 | - trackDownRecord.setSource(trackDownRecord1.getId()); | |
| 306 | - trackDownRecord.setTrackType(TrackDownDateEnums.C.getId()); | |
| 307 | - trackDownService.addOrupdateTrackDownRecord(userId, trackDownRecord); | |
| 308 | - isSaveTrack = false; | |
| 309 | - } | |
| 310 | - } | |
| 311 | - } | |
| 312 | - } | |
| 313 | - | |
| 314 | - //新增 | |
| 315 | - if(isSaveTrack){ | |
| 316 | - trackDownRecord.setHospitalId(yunRequest.getHospitalId()); | |
| 317 | - trackDownRecord.setSource(patient.getId()); | |
| 318 | - trackDownRecord.setStatus(1); | |
| 319 | - trackDownRecord.setTrackType(TrackDownDateEnums.C.getId()); | |
| 320 | - trackDownService.addOrupdateTrackDownRecord(userId, trackDownRecord); | |
| 321 | - } | |
| 322 | - | |
| 323 | - | |
| 324 | 285 | operateLogFacade.addAddOptLog(userId, Integer.valueOf(yunRequest.getHospitalId()), p, OptActionEnums.ADD.getId(), "孕妇建档"); |
| 325 | 286 | |
| 326 | 287 | /** 孕妇建档后把所有以前未使用的优惠券作废 */ |
| 327 | 288 | |
| ... | ... | @@ -425,7 +386,48 @@ |
| 425 | 386 | br.setErrormsg("成功"); |
| 426 | 387 | br.setData(p.getId()); |
| 427 | 388 | return br; |
| 389 | + } | |
| 428 | 390 | |
| 391 | + /** | |
| 392 | + * 添加或更新追访信息 | |
| 393 | + * @param userId | |
| 394 | + * @param patient | |
| 395 | + * @param yunRequest | |
| 396 | + */ | |
| 397 | + public void addTrackDownInfo(Integer userId, Patients patient, YunBookbuildingAddRequest yunRequest) { | |
| 398 | + //添加产后追访信息 | |
| 399 | + TrackDownRecord trackDownRecord = patient.build(); | |
| 400 | + //根据patient查询是否存在追访信息 | |
| 401 | + TrackDownRecordQuery downRecordQuery = new TrackDownRecordQuery(); | |
| 402 | + downRecordQuery.setParentId(patient.getId()); | |
| 403 | + List<TrackDownRecord> records = trackDownRecordService.queryTrackDown(downRecordQuery); | |
| 404 | + if (CollectionUtils.isNotEmpty(records)) {//存在则进行修改,只修改基本信息,不修改显示状态和追访类型 | |
| 405 | + TrackDownRecord trackDownRecord1 = records.get(0); | |
| 406 | + trackDownRecord.setId(trackDownRecord1.getId()); | |
| 407 | + } else {//不存在查询居民健康档案是否存在追访 | |
| 408 | + //查询居民健康档案 | |
| 409 | + ResidentsArchiveQuery archiveQuery = new ResidentsArchiveQuery(); | |
| 410 | + archiveQuery.setYn(YnEnums.YES.getId()); | |
| 411 | + archiveQuery.setHospitalId(yunRequest.getHospitalId()); | |
| 412 | + | |
| 413 | + if (StringUtils.isNotEmpty(patient.getCardNo())) { | |
| 414 | + archiveQuery.setCertificateNum(patient.getCardNo()); | |
| 415 | + List<ResidentsArchiveModel> residents = residentsArchiveService.queryResident(archiveQuery); | |
| 416 | + if (CollectionUtils.isNotEmpty(residents) && residents.get(0) != null) { | |
| 417 | + //居民健康档案 | |
| 418 | + ResidentsArchiveModel archiveModel = residents.get(0); | |
| 419 | + //添加产后追访信息 | |
| 420 | + downRecordQuery = new TrackDownRecordQuery(); | |
| 421 | + downRecordQuery.setSource(archiveModel.getId()); | |
| 422 | + records = trackDownRecordService.queryTrackDown(downRecordQuery); | |
| 423 | + if (CollectionUtils.isNotEmpty(records)) {//修改 | |
| 424 | + TrackDownRecord trackDownRecord1 = records.get(0); | |
| 425 | + trackDownRecord.setId(trackDownRecord1.getId()); | |
| 426 | + } | |
| 427 | + } | |
| 428 | + } | |
| 429 | + } | |
| 430 | + trackDownService.addOrupdateTrackDownRecord(userId, trackDownRecord); | |
| 429 | 431 | } |
| 430 | 432 | |
| 431 | 433 | /** |
| 432 | 434 | |
| 433 | 435 | |
| ... | ... | @@ -553,27 +555,10 @@ |
| 553 | 555 | |
| 554 | 556 | //添加产后追访信息 |
| 555 | 557 | TrackDownRecord trackDownRecord = patient.build(); |
| 556 | - //添加产后追访信息 | |
| 557 | - TrackDownRecordQuery downRecordQuery = new TrackDownRecordQuery(); | |
| 558 | - downRecordQuery.setParentId(trackDownRecord.getParentId()); | |
| 559 | 558 | |
| 560 | - List<TrackDownRecord> records = trackDownRecordService.queryTrackDown(downRecordQuery); | |
| 561 | - if (CollectionUtils.isNotEmpty(records)) { | |
| 562 | - TrackDownRecord trackDownRecord1 = records.get(0); | |
| 563 | - if (trackDownRecord1.getStatus() == 1 && trackDownRecord.getTrackType() != TrackDownDateEnums.C.getId()) { | |
| 564 | - trackDownRecord.setHospitalId(yunRequest.getHospitalId()); | |
| 565 | - trackDownRecord.setSource(patient.getId()); | |
| 566 | - trackDownRecord.setTrackType(TrackDownDateEnums.C.getId()); | |
| 567 | - trackDownService.addOrupdateTrackDownRecord(userId, trackDownRecord); | |
| 568 | - } | |
| 569 | - } else { | |
| 570 | - trackDownRecord.setHospitalId(yunRequest.getHospitalId()); | |
| 571 | - trackDownRecord.setSource(patient.getId()); | |
| 572 | - trackDownRecord.setStatus(1); | |
| 573 | - trackDownRecord.setTrackType(TrackDownDateEnums.C.getId()); | |
| 574 | - trackDownService.addOrupdateTrackDownRecord(userId, trackDownRecord); | |
| 575 | - } | |
| 576 | 559 | |
| 560 | + //添加追访信息 | |
| 561 | + addTrackDownInfo(userId, p, yunRequest); | |
| 577 | 562 | |
| 578 | 563 | operateLogFacade.addAddOptLog(userId, Integer.valueOf(patient.getHospitalId()), patient, OptActionEnums.ADD.getId(), "孕妇建档"); |
| 579 | 564 | |
| ... | ... | @@ -852,8 +837,7 @@ |
| 852 | 837 | yunBookbuildingService.updatePregnant(patient, id); |
| 853 | 838 | |
| 854 | 839 | //更新产后追访信息 |
| 855 | - TrackDownRecord trackDownRecord = patient.build(); | |
| 856 | - trackDownService.addOrupdateTrackDownRecord(userId, trackDownRecord); | |
| 840 | + addTrackDownInfo(userId,patient,yunRequest); | |
| 857 | 841 | |
| 858 | 842 | operateLogFacade.addModifyOptLog(userId, Integer.valueOf(beforePatient.getHospitalId()), beforePatient, patient, OptActionEnums.UPDATE.getId(), "孕妇建档修改"); |
| 859 | 843 |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/ResidentsArchiveFacade.java
View file @
d94987f
| ... | ... | @@ -27,6 +27,7 @@ |
| 27 | 27 | import com.lyms.platform.pojo.TrackDownRecord; |
| 28 | 28 | import com.lyms.platform.query.PremaritalCheckupQuery; |
| 29 | 29 | import com.lyms.platform.query.ResidentsArchiveQuery; |
| 30 | +import com.lyms.platform.query.TrackDownRecordQuery; | |
| 30 | 31 | import org.apache.commons.collections.CollectionUtils; |
| 31 | 32 | import org.apache.commons.lang.StringUtils; |
| 32 | 33 | import org.springframework.beans.factory.annotation.Autowired; |
| 33 | 34 | |
| ... | ... | @@ -297,9 +298,8 @@ |
| 297 | 298 | model.setId(id); |
| 298 | 299 | residentsArchiveService.updateResident(model,id); |
| 299 | 300 | |
| 300 | - TrackDownRecord record = model.build(); | |
| 301 | 301 | //修改追访基本信息 |
| 302 | - trackDownService.addOrupdateTrackDownRecord(userId,record); | |
| 302 | + addTrackDownInfo(userId,model); | |
| 303 | 303 | |
| 304 | 304 | }catch (Exception e){ |
| 305 | 305 | return new BaseResponse().setErrorcode(ErrorCodeConstants.SYSTEM_ERROR).setErrormsg("系统异常,修改数据失败"); |
| ... | ... | @@ -382,9 +382,8 @@ |
| 382 | 382 | |
| 383 | 383 | ResidentsArchiveModel residentsArchiveModel = residentsArchiveService.addResident(archiveModel); |
| 384 | 384 | |
| 385 | - //新增婚检追访信息 | |
| 386 | - TrackDownRecord record = residentsArchiveModel.build(); | |
| 387 | - trackDownService.addOrupdateTrackDownRecord(userId,record); | |
| 385 | + //新增婚检追访信息,默认进入婚检追访 | |
| 386 | + addTrackDownInfo(userId,residentsArchiveModel); | |
| 388 | 387 | |
| 389 | 388 | if (residentsArchiveModel == null || StringUtils.isEmpty(residentsArchiveModel.getId())){ |
| 390 | 389 | br.setErrorcode(ErrorCodeConstants.SYSTEM_ERROR); |
| ... | ... | @@ -396,6 +395,42 @@ |
| 396 | 395 | br.setErrormsg("成功"); |
| 397 | 396 | br.setData(residentsArchiveModel.getId()); |
| 398 | 397 | return br; |
| 398 | + } | |
| 399 | + | |
| 400 | + /** | |
| 401 | + * 婚检修改时应该判断是否有追访记录,可能在孕妇建档时已经生产了追访信息 | |
| 402 | + * @param userId | |
| 403 | + */ | |
| 404 | + public void addTrackDownInfo(Integer userId, ResidentsArchiveModel residentsArchiveModel) { | |
| 405 | + //新增婚检追访信息,默认进入婚检追访 | |
| 406 | + TrackDownRecord trackDownRecord = residentsArchiveModel.build(); | |
| 407 | + //先根据婚检id进行查询 | |
| 408 | + TrackDownRecordQuery downRecordQuery = new TrackDownRecordQuery(); | |
| 409 | + downRecordQuery.setSource(residentsArchiveModel.getId()); | |
| 410 | + List<TrackDownRecord> records = trackDownRecordService.queryTrackDown(downRecordQuery); | |
| 411 | + if (CollectionUtils.isNotEmpty(records)) {//存在则进行修改,只修改基本信息,不修改显示状态和追访类型 | |
| 412 | + TrackDownRecord trackDownRecord1 = records.get(0); | |
| 413 | + trackDownRecord.setId(trackDownRecord1.getId()); | |
| 414 | + } else {//根据patient查询是否存在追访信息 | |
| 415 | + //根据医院id和身份证或手机号进行查询 | |
| 416 | + downRecordQuery = new TrackDownRecordQuery(); | |
| 417 | + downRecordQuery.setHospitalId(residentsArchiveModel.getHospitalId()); | |
| 418 | + if(StringUtils.isNotEmpty(residentsArchiveModel.getCertificateNum())){ | |
| 419 | + downRecordQuery.setKey(residentsArchiveModel.getCertificateNum()); | |
| 420 | + }else if(StringUtils.isNotEmpty(residentsArchiveModel.getPhone())){ | |
| 421 | + downRecordQuery.setPhone(residentsArchiveModel.getPhone()); | |
| 422 | + } | |
| 423 | + records = trackDownRecordService.queryTrackDown(downRecordQuery); | |
| 424 | + if (CollectionUtils.isNotEmpty(records)) {//修改 | |
| 425 | + TrackDownRecord trackDownRecord1 = records.get(0); | |
| 426 | + trackDownRecord.setId(trackDownRecord1.getId()); | |
| 427 | + } | |
| 428 | + } | |
| 429 | + if("d75d1902-61a5-4a17-a68a-5b8a9826537b".equals(residentsArchiveModel.getMarriageId())){//已婚,自己进入孕妇建档追访 | |
| 430 | + trackDownRecord.setStatus(1); | |
| 431 | + trackDownRecord.setTrackType(TrackDownDateEnums.B.getId()); | |
| 432 | + } | |
| 433 | + trackDownService.addOrupdateTrackDownRecord(userId,trackDownRecord); | |
| 399 | 434 | } |
| 400 | 435 | |
| 401 | 436 |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/TrackDownServiceImpl.java
View file @
d94987f
| ... | ... | @@ -183,26 +183,27 @@ |
| 183 | 183 | @Override |
| 184 | 184 | public boolean addOrupdateTrackDownRecord(Integer userId, TrackDownRecord trackDownRecord) { |
| 185 | 185 | try { |
| 186 | - TrackDownRecordQuery downRecordQuery = new TrackDownRecordQuery(); | |
| 187 | - downRecordQuery.setSource(trackDownRecord.getSource()); | |
| 188 | - downRecordQuery.setParentId(trackDownRecord.getParentId()); | |
| 189 | - List<TrackDownRecord> records = trackDownRecordService.queryTrackDown(downRecordQuery); | |
| 190 | - if(CollectionUtils.isNotEmpty(records)){ | |
| 191 | - TrackDownRecord trackDownRecord1 = records.get(0); | |
| 192 | - //流程只能往下流转,不能往上回退 | |
| 193 | - if(trackDownRecord.getTrackType()!=null&&trackDownRecord1.getTrackType().intValue()>trackDownRecord.getTrackType()){ | |
| 194 | - trackDownRecord.setTrackType(trackDownRecord1.getTrackType()); | |
| 186 | + //先根据主键id进行查询 | |
| 187 | + if (StringUtils.isNotEmpty(trackDownRecord.getId())) { | |
| 188 | + TrackDownRecord trackDownRecord1 = trackDownRecordService.getTrackDown(trackDownRecord.getId()); | |
| 189 | + if (trackDownRecord1 != null) { | |
| 190 | + //流程只能往下流转,不能往上回退 | |
| 191 | + if (trackDownRecord.getTrackType() != null && trackDownRecord.getTrackType() < trackDownRecord1.getTrackType().intValue()) { | |
| 192 | + //用以前追访的类型和来源id | |
| 193 | + trackDownRecord.setTrackType(trackDownRecord1.getTrackType()); | |
| 194 | + trackDownRecord.setSource(trackDownRecord1.getSource()); | |
| 195 | + } | |
| 196 | + //由显示修改成不显示,后期数据更新时,不允许将不显示修改成显示。 | |
| 197 | + if (trackDownRecord1.getStatus() < trackDownRecord.getStatus()) { | |
| 198 | + trackDownRecord.setStatus(trackDownRecord1.getStatus()); | |
| 199 | + } | |
| 200 | + trackDownRecordService.updateTrackDown(trackDownRecord, trackDownRecord1.getId()); | |
| 201 | + return true; | |
| 195 | 202 | } |
| 196 | - //由显示修改成不显示,后期数据更新时,不允许将不显示修改成显示。 | |
| 197 | - if(trackDownRecord1.getStatus()>trackDownRecord.getStatus()){ | |
| 198 | - trackDownRecord1.setStatus(trackDownRecord.getStatus()); | |
| 199 | - } | |
| 200 | - trackDownRecordService.updateTrackDown(trackDownRecord,trackDownRecord1.getId()); | |
| 201 | - }else{ | |
| 202 | - trackDownRecordService.addTrackDown(trackDownRecord); | |
| 203 | 203 | } |
| 204 | + trackDownRecordService.addTrackDown(trackDownRecord); | |
| 204 | 205 | return true; |
| 205 | - }catch (Exception e){ | |
| 206 | + } catch (Exception e) { | |
| 206 | 207 | e.printStackTrace(); |
| 207 | 208 | return false; |
| 208 | 209 | } |
| 209 | 210 | |
| 210 | 211 | |
| ... | ... | @@ -217,11 +218,11 @@ |
| 217 | 218 | trackDown.setParentId(parentId); |
| 218 | 219 | } |
| 219 | 220 | //怀孕建档:怀孕建档流转至孕期检查的时候需要有孕妇的档案才可以扭转 |
| 220 | - if (TrackDownTransferEnums.B.getId() == trackDown.getTrackDownTransfer() && | |
| 221 | + if (TrackDownTransferEnums.B.getId() == trackDown.getTrackDownTransfer() && | |
| 221 | 222 | TrackDownDateEnums.B.getId() == trackDown.getTrackDownDateType() |
| 222 | - &&StringUtils.isNotEmpty(trackDown.getParentId())) { | |
| 223 | + && StringUtils.isNotEmpty(trackDown.getParentId())) { | |
| 223 | 224 | |
| 224 | - ResidentsArchiveModel archiveModel = residentsArchiveService.getResident(trackDown.getParentId()); | |
| 225 | + ResidentsArchiveModel archiveModel = residentsArchiveService.getResident(trackDown.getParentId()); | |
| 225 | 226 | //TODO 需要去验证或者绑定孕妇的建档记录,不然不能进行后续的操作 |
| 226 | 227 | PatientsQuery patientsQuery1 = new PatientsQuery(); |
| 227 | 228 | patientsQuery1.setCardNo(archiveModel.getCertificateNum()); |
| 228 | 229 | |
| 229 | 230 | |
| 230 | 231 | |
| 231 | 232 | |
| ... | ... | @@ -229,25 +230,25 @@ |
| 229 | 230 | patientsQuery1.setHospitalId(hospitalId); |
| 230 | 231 | patientsQuery1.setType(1); |
| 231 | 232 | patientsQuery1.setYn(YnEnums.YES.getId()); |
| 232 | - List<Patients> patientses= patientsService.queryPatient(patientsQuery1); | |
| 233 | - if(CollectionUtils.isNotEmpty(patientses)){ | |
| 233 | + List<Patients> patientses = patientsService.queryPatient(patientsQuery1); | |
| 234 | + if (CollectionUtils.isNotEmpty(patientses)) { | |
| 234 | 235 | TrackDownRecordQuery trackDownRecordQuery = new TrackDownRecordQuery(); |
| 235 | 236 | trackDownRecordQuery.setResidentsArchiveId(trackDown.getParentId()); |
| 236 | 237 | |
| 237 | 238 | TrackDownRecord trackDownRecord = new TrackDownRecord(); |
| 238 | 239 | trackDownRecord.setParentId(patientses.get(0).getId()); |
| 239 | 240 | //修改绑定建档信息的id |
| 240 | - trackDownRecordService.findAndMoidify(trackDownRecordQuery,trackDownRecord); | |
| 241 | - }else { | |
| 241 | + trackDownRecordService.findAndMoidify(trackDownRecordQuery, trackDownRecord); | |
| 242 | + } else { | |
| 242 | 243 | return new BaseResponse().setErrorcode(4016).setErrormsg("您还没有孕妇的档案,请去医院建档."); |
| 243 | 244 | } |
| 244 | 245 | } |
| 245 | 246 | //追访列表ID |
| 246 | - if(trackDown.getTrackDownRecId()!=null){ | |
| 247 | + if (trackDown.getTrackDownRecId() != null) { | |
| 247 | 248 | TrackDownRecord trackDownRecord = trackDownRecordService.getTrackDown(trackDown.getTrackDownRecId()); |
| 248 | - if(trackDownRecord!=null){ | |
| 249 | + if (trackDownRecord != null) { | |
| 249 | 250 | //当传入的状态和数据库一致时才能进行有效操作 |
| 250 | - if(trackDownRecord.getTrackType().intValue()==trackDown.getTrackDownDateType()){ | |
| 251 | + if (trackDownRecord.getTrackType().intValue() == trackDown.getTrackDownDateType()) { | |
| 251 | 252 | trackDown.setId(null); |
| 252 | 253 | trackDown.setYn(YnEnums.YES.getId()); |
| 253 | 254 | trackDown.setCreated(new Date()); |
| 254 | 255 | |
| 255 | 256 | |
| 256 | 257 | |
| ... | ... | @@ -255,17 +256,17 @@ |
| 255 | 256 | trackDown.setOperaterId(userId); |
| 256 | 257 | trackDown.setModified(new Date()); |
| 257 | 258 | trackDownService.add(trackDown); |
| 258 | - String recordId=trackDown.getTrackDownRecId(); | |
| 259 | + String recordId = trackDown.getTrackDownRecId(); | |
| 259 | 260 | updateRecordStatus(trackDown, recordId); |
| 260 | 261 | return RespBuilder.buildSuccess(trackDown.getId()); |
| 261 | - }else{ | |
| 262 | - return RespBuilder.buildErro(ResponseCode.DATA_ERROR,"数据已经被修改请回到列表刷新后再操作!"); | |
| 262 | + } else { | |
| 263 | + return RespBuilder.buildErro(ResponseCode.DATA_ERROR, "数据已经被修改请回到列表刷新后再操作!"); | |
| 263 | 264 | } |
| 264 | - }else{ | |
| 265 | - return RespBuilder.buildErro(ResponseCode.DATA_ERROR,"传入的trackDownRecId没有找到数据"); | |
| 265 | + } else { | |
| 266 | + return RespBuilder.buildErro(ResponseCode.DATA_ERROR, "传入的trackDownRecId没有找到数据"); | |
| 266 | 267 | } |
| 267 | - }else{ | |
| 268 | - return RespBuilder.buildErro(ResponseCode.DATA_ERROR,"请传入trackDownRecId"); | |
| 268 | + } else { | |
| 269 | + return RespBuilder.buildErro(ResponseCode.DATA_ERROR, "请传入trackDownRecId"); | |
| 269 | 270 | } |
| 270 | 271 | |
| 271 | 272 | |
| 272 | 273 | |
| 273 | 274 | |
| ... | ... | @@ -282,14 +283,14 @@ |
| 282 | 283 | if (TrackDownTransferEnums.B.getId() == trackDown.getTrackDownTransfer()) { |
| 283 | 284 | |
| 284 | 285 | TrackDownRecord trackDownRecord = new TrackDownRecord(); |
| 285 | - Integer nextId=TrackDownDateEnums.getEnum(trackDown.getTrackDownDateType()).getNextid(); | |
| 286 | + Integer nextId = TrackDownDateEnums.getEnum(trackDown.getTrackDownDateType()).getNextid(); | |
| 286 | 287 | trackDownRecord.setTrackType(nextId); |
| 287 | - trackDownRecordService.updateTrackDown(trackDownRecord,id); | |
| 288 | + trackDownRecordService.updateTrackDown(trackDownRecord, id); | |
| 288 | 289 | |
| 289 | 290 | } else if (TrackDownTransferEnums.C.getId() == trackDown.getTrackDownTransfer()) { |
| 290 | 291 | TrackDownRecord trackDownRecord = new TrackDownRecord(); |
| 291 | 292 | trackDownRecord.setStatus(0); |
| 292 | - trackDownRecordService.updateTrackDown(trackDownRecord,id); | |
| 293 | + trackDownRecordService.updateTrackDown(trackDownRecord, id); | |
| 293 | 294 | } |
| 294 | 295 | } |
| 295 | 296 |