Commit acb4d742d3f6667f5b3c002c5b412bfabbe3e904
1 parent
1229779e22
Exists in
master
and in
6 other branches
更新
Showing 1 changed file with 29 additions and 22 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/IndividualCaseServiceImpl.java
View file @
acb4d74
| ... | ... | @@ -28,6 +28,7 @@ |
| 28 | 28 | import com.lyms.platform.permission.service.OrganizationService; |
| 29 | 29 | import com.lyms.platform.permission.service.UsersService; |
| 30 | 30 | import com.lyms.platform.pojo.AntExChuModel; |
| 31 | +import com.lyms.platform.pojo.AntExRecordModel; | |
| 31 | 32 | import com.lyms.platform.pojo.AntenatalExaminationModel; |
| 32 | 33 | import com.lyms.platform.pojo.BasicConfig; |
| 33 | 34 | import com.lyms.platform.pojo.HosptialHighRisk; |
| 34 | 35 | |
| 35 | 36 | |
| 36 | 37 | |
| 37 | 38 | |
| 38 | 39 | |
| 39 | 40 | |
| ... | ... | @@ -60,34 +61,40 @@ |
| 60 | 61 | */ |
| 61 | 62 | @Override |
| 62 | 63 | public BaseResponse highRiskList(String personId, Integer userId) { |
| 63 | - String orgId = autoMatchFacade.getHospitalId(userId); | |
| 64 | + // String orgId = autoMatchFacade.getHospitalId(userId); | |
| 64 | 65 | List<IndividualCaseResult> results = new LinkedList<>(); |
| 65 | - List<PersonModel> personModels = mongoTemplate.find(Query.query(Criteria.where("id").is(personId)), PersonModel.class); | |
| 66 | + List<PersonModel> personModels = mongoTemplate.find(Query.query(Criteria.where("id").is(personId).and("type").ne(2)), PersonModel.class); | |
| 66 | 67 | if (CollectionUtils.isNotEmpty(personModels)) { |
| 67 | - List<Patients> patients = mongoTemplate.find(Query.query(Criteria.where("pid").is(personId).and("hospitalId").is(orgId)).with(new Sort(Sort.Direction.DESC, "lastMenses")), Patients.class); | |
| 68 | + List<Patients> patients = mongoTemplate.find(Query.query(Criteria.where("pid").is(personId)).with(new Sort(Sort.Direction.DESC, "created")), Patients.class); | |
| 68 | 69 | if (CollectionUtils.isNotEmpty(patients)) { |
| 69 | - Patients patient = patients.get(0); | |
| 70 | - String patientId = patient.getId(); | |
| 71 | - List<AntExChuModel> antExChuModels = mongoTemplate.find(Query.query(Criteria.where("parentId").is(patientId).and("hospitalId").is(orgId)), AntExChuModel.class); | |
| 72 | - if (CollectionUtils.isNotEmpty(antExChuModels)) { | |
| 73 | - AntExChuModel antExChuModel = antExChuModels.get(0); | |
| 74 | - String hospitalId = antExChuModel.getHospitalId(); | |
| 75 | - String highRisks = antExChuModel.getHighrisk(); | |
| 76 | - String otherHighRisk = antExChuModel.getOtherHighRisk(); | |
| 77 | - IndividualCaseResult<IndividualCaseResult.Infos> result = getInfosIndividualCaseResult(patient, antExChuModel.getProdDoctor(), highRisks, antExChuModel.getHighriskDesc(), otherHighRisk, antExChuModel.getCheckTime(), hospitalId); | |
| 78 | - results.add(result); | |
| 79 | - | |
| 80 | - } | |
| 81 | - List<AntenatalExaminationModel> antenatalExaminationModels = mongoTemplate.find(Query.query(Criteria.where("parentId").is(patientId).and("hospitalId").is(orgId)).with(new Sort(Sort.Direction.DESC, "created")), AntenatalExaminationModel.class); | |
| 82 | - if (CollectionUtils.isNotEmpty(antenatalExaminationModels)) { | |
| 83 | - for (AntenatalExaminationModel examinationModel : antenatalExaminationModels) { | |
| 84 | - String riskFactors = examinationModel.getRiskFactor(); | |
| 85 | - String otherRisk = examinationModel.getOtherRisk(); | |
| 86 | - String hospitalId = examinationModel.getHospitalId(); | |
| 87 | - IndividualCaseResult<IndividualCaseResult.Infos> result = getInfosIndividualCaseResult(patient, examinationModel.getCheckDoctor(), riskFactors, examinationModel.getHighriskDesc(), otherRisk, examinationModel.getCheckDate(), hospitalId); | |
| 70 | + Patients p = patients.get(0); | |
| 71 | + Date lastMenses = p.getLastMenses(); | |
| 72 | + List<Patients> patientsList = mongoTemplate.find(Query.query(Criteria.where("pid").is(personId).and("created").gte(lastMenses)), Patients.class); | |
| 73 | + for (Patients model : patientsList) { | |
| 74 | + String patientId = model.getId(); | |
| 75 | + List<AntExChuModel> antExChuModels = mongoTemplate.find(Query.query(Criteria.where("parentId").is(patientId)), AntExChuModel.class); | |
| 76 | + if (CollectionUtils.isNotEmpty(antExChuModels)) { | |
| 77 | + AntExChuModel antExChuModel = antExChuModels.get(0); | |
| 78 | + String hospitalId = antExChuModel.getHospitalId(); | |
| 79 | + String highRisks = antExChuModel.getHighrisk(); | |
| 80 | + String otherHighRisk = antExChuModel.getOtherHighRisk(); | |
| 81 | + IndividualCaseResult<IndividualCaseResult.Infos> result = getInfosIndividualCaseResult(model, antExChuModel.getProdDoctor(), highRisks, antExChuModel.getHighriskDesc(), otherHighRisk, antExChuModel.getCheckTime(), hospitalId); | |
| 88 | 82 | results.add(result); |
| 83 | + | |
| 89 | 84 | } |
| 85 | + List<AntenatalExaminationModel> antenatalExaminationModels = mongoTemplate.find(Query.query(Criteria.where("parentId").is(patientId)).with(new Sort(Sort.Direction.DESC, "created")), AntenatalExaminationModel.class); | |
| 86 | + if (CollectionUtils.isNotEmpty(antenatalExaminationModels)) { | |
| 87 | + for (AntenatalExaminationModel examinationModel : antenatalExaminationModels) { | |
| 88 | + String riskFactors = examinationModel.getRiskFactor(); | |
| 89 | + String otherRisk = examinationModel.getOtherRisk(); | |
| 90 | + String hospitalId = examinationModel.getHospitalId(); | |
| 91 | + IndividualCaseResult<IndividualCaseResult.Infos> result = getInfosIndividualCaseResult(model, examinationModel.getCheckDoctor(), riskFactors, examinationModel.getHighriskDesc(), otherRisk, examinationModel.getCheckDate(), hospitalId); | |
| 92 | + results.add(result); | |
| 93 | + } | |
| 94 | + } | |
| 90 | 95 | } |
| 96 | + | |
| 97 | + | |
| 91 | 98 | BaseResponse baseResponse = new BaseResponse(); |
| 92 | 99 | Collections.sort(results); |
| 93 | 100 | baseResponse.setObject(results); |