Commit 57e87c6a0859fda34366de5febf6613613ec25c7

Authored by dongqin
1 parent 1027486867

兼容多产程

Showing 1 changed file with 35 additions and 0 deletions

platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/ViewFacade.java View file @ 57e87c6
... ... @@ -130,6 +130,7 @@
130 130 import com.lyms.platform.pojo.FilePathModel;
131 131 import com.lyms.platform.pojo.MaternalDeliverModel;
132 132 import com.lyms.platform.pojo.Patients;
  133 +import com.lyms.platform.pojo.PersonModel;
133 134 import com.lyms.platform.pojo.PlantformConfigModel;
134 135 import com.lyms.platform.pojo.PostReviewModel;
135 136 import com.lyms.platform.pojo.ReferralApplyOrderModel;
... ... @@ -5664,6 +5665,11 @@
5664 5665 return deliverMap;
5665 5666 }
5666 5667  
  5668 + String patientId = getPatientId(idCard);
  5669 + if (StringUtils.isNotEmpty(patientId)) {
  5670 + patientsQuery.setId(patientId);
  5671 + }
  5672 +
5667 5673 List<Map<String, Object>> deliverList = new ArrayList<>();
5668 5674 List<Patients> list = patientsService.queryPatient1(patientsQuery, "created");
5669 5675  
... ... @@ -5889,6 +5895,35 @@
5889 5895 }
5890 5896  
5891 5897 return deliverMap;
  5898 + }
  5899 +
  5900 + /**
  5901 + * 根据身份证号查询主建档id(多孕程)
  5902 + *
  5903 + * @param idCard
  5904 + * @return patientId/null
  5905 + */
  5906 + private String getPatientId(String idCard) {
  5907 + PersonModel personModel = mongoTemplate.findOne(Query.query(Criteria.where("cardNo").is(idCard).and("type").ne(2)), PersonModel.class);
  5908 + if (personModel != null) {
  5909 + String personModelId = personModel.getId();
  5910 + List<MaternalDeliverModel> models = mongoTemplate.find(Query.query(Criteria.where("pid").is(personModelId)).
  5911 + with(new Sort(Sort.Direction.DESC, "created")), MaternalDeliverModel.class);
  5912 + if (CollectionUtils.isNotEmpty(models)) {
  5913 + MaternalDeliverModel deliverModel = models.get(0);
  5914 + String parentId = deliverModel.getParentId();
  5915 + Patients patientsModel = mongoTemplate.findOne(Query.query(Criteria.where("id").is(parentId)), Patients.class);
  5916 + if (patientsModel != null) {
  5917 + String sourceId = patientsModel.getSource();
  5918 + if (StringUtils.isNotEmpty(sourceId)) {
  5919 + return sourceId;
  5920 + } else {
  5921 + return personModel.getId();
  5922 + }
  5923 + }
  5924 + }
  5925 + }
  5926 + return null;
5892 5927 }
5893 5928  
5894 5929 public Map<String, Object> getMatDeliverInfo(String hospitalName, String idCard) {