Commit 1f69b69d035519ab4af7cf27aa49cf70d844f333

Authored by liquanyu
1 parent 0413d45905

update

Showing 1 changed file with 6 additions and 5 deletions

platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/DefectiveChildServiceImpl.java View file @ 1f69b69
... ... @@ -5,6 +5,7 @@
5 5 import java.util.List;
6 6  
7 7 import com.lyms.platform.operate.web.facade.AutoMatchFacade;
  8 +import org.apache.commons.collections.CollectionUtils;
8 9 import org.springframework.beans.BeanUtils;
9 10 import org.springframework.beans.factory.annotation.Autowired;
10 11 import org.springframework.data.domain.Sort;
11 12  
12 13  
... ... @@ -255,17 +256,17 @@
255 256 public BaseResponse getPatientInfoByIdCard(CommonParamRequest param,Integer userId) {
256 257 String hospitalId = autoMatchFacade.getHospitalId(userId);
257 258 String inHospitalNo = param.getCardNo();
258   - List<DefectiveChildModelResult> results = new LinkedList<>();
  259 + DefectiveChildModelResult result = null;
259 260 if (StringUtils.isNotEmpty(inHospitalNo)) {
260 261 List<DefectiveChildModel> defectiveChildModels = mongoTemplate.find(Query.query(Criteria.where("inHospitalNo").is(inHospitalNo).
261 262 and("hospitalId").is(hospitalId)), DefectiveChildModel.class);
262   - for (DefectiveChildModel model : defectiveChildModels) {
263   - DefectiveChildModelResult result = getResultByModel(model);
264   - results.add(result);
  263 + if (CollectionUtils.isNotEmpty(defectiveChildModels))
  264 + {
  265 + result = getResultByModel(defectiveChildModels.get(0));
265 266 }
266 267 }
267 268 BaseResponse baseResponse = new BaseResponse();
268   - baseResponse.setObject(results);
  269 + baseResponse.setObject(result);
269 270 return baseResponse;
270 271 }
271 272 }