|
|
@@ -27,6 +27,8 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.Comparator;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
@@ -64,22 +66,23 @@ public class ZyReqController {
|
|
|
resultMap.put("message", "查询病人的住院证失败,病人id为空");
|
|
|
return resultMap;
|
|
|
}
|
|
|
+ List<MzZyReq> result = new ArrayList<>();
|
|
|
List<MzZyReq> list = mzZyReqService.queryMzZyReqByPatientId(patientId,ZyReqEnum.CONFIRMED.code);
|
|
|
if(CollUtil.isNotEmpty(list)){
|
|
|
- resultMap.put("code", 0);
|
|
|
- resultMap.put("message", "查询病人的住院证成功");
|
|
|
- resultMap.put("data", list.get(0));
|
|
|
- return resultMap;
|
|
|
+ result.addAll(list);
|
|
|
}
|
|
|
List<MzZyReq> temp = mzZyReqService.queryMzZyReqByPatientId(patientId,ZyReqEnum.UN_CONFIRM.code);
|
|
|
- if (CollUtil.isEmpty(temp)) {
|
|
|
+ if(CollUtil.isNotEmpty(temp)){
|
|
|
+ result.addAll(temp);
|
|
|
+ }
|
|
|
+ if (CollUtil.isEmpty(result)) {
|
|
|
resultMap.put("code", -1);
|
|
|
resultMap.put("message", "查询病人的住院证失败,当前病人没有对应的住院证");
|
|
|
return resultMap;
|
|
|
}
|
|
|
resultMap.put("code", 0);
|
|
|
resultMap.put("message", "查询病人的住院证成功");
|
|
|
- resultMap.put("data", temp.get(0));
|
|
|
+ resultMap.put("data", result.stream().sorted(Comparator.comparing(MzZyReq::getVisitDate).reversed()).findFirst().get());
|
|
|
return resultMap;
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|