Commit dafff9c3ecdc7f456c6fd8a9a0de8af12ffb5f10
1 parent
470fd5be7a
Exists in
master
and in
6 other branches
改bug
Showing 1 changed file with 8 additions and 6 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/utils/MongoUtil.java
View file @
dafff9c
| ... | ... | @@ -541,12 +541,14 @@ |
| 541 | 541 | public String doHidePatient(String parentId, String hospitalId) { |
| 542 | 542 | Patients patients = mongoTemplate.findById(parentId, Patients.class); |
| 543 | 543 | if(patients != null && !hospitalId.equals(patients.getHospitalId())) { |
| 544 | - patients.setId(null); | |
| 545 | - patients.setHospitalId(hospitalId); | |
| 546 | - patients.setEnable("2"); | |
| 547 | - patients.setSource(patients.getId()); | |
| 548 | - patients.setCreated(new Date()); | |
| 549 | - patientsService.addPatient(patients); | |
| 544 | + if(!mongoTemplate.exists(Query.query(Criteria.where("source").is(parentId).and("hospitalId").is(hospitalId)), Patients.class)) { | |
| 545 | + patients.setId(null); | |
| 546 | + patients.setHospitalId(hospitalId); | |
| 547 | + patients.setEnable("2"); | |
| 548 | + patients.setSource(patients.getId()); | |
| 549 | + patients.setCreated(new Date()); | |
| 550 | + patientsService.addPatient(patients); | |
| 551 | + } | |
| 550 | 552 | } |
| 551 | 553 | return patients.getId(); |
| 552 | 554 | } |