|
@@ -11,6 +11,7 @@ import cn.hnthyy.thmz.entity.his.mz.MzPatientMi;
|
|
|
import cn.hnthyy.thmz.entity.his.mz.MzZyReq;
|
|
|
import cn.hnthyy.thmz.entity.thmz.User;
|
|
|
import cn.hnthyy.thmz.enums.GenderEnum;
|
|
|
+import cn.hnthyy.thmz.enums.NumberEnum;
|
|
|
import cn.hnthyy.thmz.enums.ZyReqEnum;
|
|
|
import cn.hnthyy.thmz.service.his.RegionService;
|
|
|
import cn.hnthyy.thmz.service.his.ResponceTypeService;
|
|
@@ -23,6 +24,7 @@ import cn.hnthyy.thmz.service.thmz.UserDeptRelationService;
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
import cn.hutool.core.convert.Convert;
|
|
|
+import cn.hutool.core.date.DateUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
@@ -95,7 +97,7 @@ public class ZyReqController {
|
|
|
*/
|
|
|
@UserLoginToken
|
|
|
@RequestMapping(value = "/printZyReq", method = {RequestMethod.GET})
|
|
|
- public Map<String, Object> printZyReq(@RequestParam("patientId") String patientId) {
|
|
|
+ public Map<String, Object> printZyReq(@RequestParam("patientId") String patientId,@RequestParam(value = "visitDate",required = false,defaultValue = "") String visitDate) {
|
|
|
Map<String, Object> resultMap = new HashMap<>();
|
|
|
try {
|
|
|
if (StringUtils.isBlank(patientId)) {
|
|
@@ -109,22 +111,27 @@ public class ZyReqController {
|
|
|
resultMap.put("message", "打印入院通知单失败,当前病人没有对应的住院证");
|
|
|
return resultMap;
|
|
|
}
|
|
|
- MzZyReq mzZyReq = list.get(0);
|
|
|
- if(mzZyReq!=null){
|
|
|
- if(mzZyReq.getDeptCode()!=null && StringUtils.isNotBlank(mzZyReq.getDeptCode())){
|
|
|
- mzZyReq.setDeptName(zdUnitCodeService.queryDeptNameByIdInCache(mzZyReq.getDeptCode()));
|
|
|
- }
|
|
|
- if(mzZyReq.getReqDept()!=null && StringUtils.isNotBlank(mzZyReq.getReqDept())){
|
|
|
- mzZyReq.setReqDeptName(zdUnitCodeService.queryDeptNameByIdInCache(mzZyReq.getReqDept()));
|
|
|
- mzZyReq.setReqWardName(mzZyReq.getReqDeptName());
|
|
|
- }
|
|
|
- if(mzZyReq.getSmallDept()!=null && StringUtils.isNotBlank(mzZyReq.getSmallDept())){
|
|
|
- mzZyReq.setSmallDeptName(zdUnitCodeService.queryDeptNameByIdInCache(mzZyReq.getSmallDept()));
|
|
|
- }
|
|
|
- if(mzZyReq.getDoctorCode()!=null && StringUtils.isNotBlank(mzZyReq.getDoctorCode())){
|
|
|
- Employee employee= employeeService.queryByUserCode(mzZyReq.getDoctorCode());
|
|
|
- mzZyReq.setDoctorName(employee!=null?employee.getEmployeeName():"");
|
|
|
+ List<MzZyReq> mzZyReqList = list.stream().filter(item -> !NumberEnum.FOUR.getCode().equals(item.getReqStatus())).collect(Collectors.toList());
|
|
|
+ if(CollUtil.isEmpty(mzZyReqList)){
|
|
|
+ resultMap.put("code", -1);
|
|
|
+ resultMap.put("message", "打印入院通知单失败,当前病人没有对应的住院证");
|
|
|
+ return resultMap;
|
|
|
+ }
|
|
|
+ MzZyReq mzZyReq ;
|
|
|
+ if(StrUtil.isNotBlank(visitDate)){
|
|
|
+ List<MzZyReq> collect = mzZyReqList.stream().filter(item -> DateUtil.format(item.getVisitDate(), "yyyy-MM-dd HH:mm:ss").equals(visitDate)).collect(Collectors.toList());
|
|
|
+ if(CollUtil.isNotEmpty(collect)){
|
|
|
+ mzZyReq = collect.get(0);
|
|
|
+ }else {
|
|
|
+ resultMap.put("code", -1);
|
|
|
+ resultMap.put("message", "打印入院通知单失败,当前病人没有对应的住院证");
|
|
|
+ return resultMap;
|
|
|
}
|
|
|
+ }else {
|
|
|
+ mzZyReq = mzZyReqList.get(0);
|
|
|
+ }
|
|
|
+ if(mzZyReq!=null){
|
|
|
+ dealMzyReq(mzZyReq);
|
|
|
if(mzZyReq.getRouteOfAdmission() !=null){
|
|
|
List<Map<String, Object>> mapList = mzZdCommonService.queryRouteOfAdmission();
|
|
|
Map<Integer, List<Map<String, Object>>> codeMap = mapList.stream().collect(Collectors.groupingBy(item -> Convert.toInt(item.get("code"))));
|
|
@@ -149,6 +156,41 @@ public class ZyReqController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ @PostMapping("/queryZyzByPatientId")
|
|
|
+ public R queryZyzByPatientId(@RequestBody MzZyReq param){
|
|
|
+ AssertUtil.isNotBlank(param.getPatientId(),"门诊号不能为空");
|
|
|
+ List<MzZyReq> list = mzZyReqService.queryMzZyReqByPatientId(param.getPatientId(),null);
|
|
|
+ if(CollUtil.isNotEmpty(list)){
|
|
|
+ List<MzZyReq> collect = list.stream().filter(item -> !NumberEnum.FOUR.getCode().equals(item.getReqStatus())).collect(Collectors.toList());
|
|
|
+ if(CollUtil.isNotEmpty(collect)){
|
|
|
+ for(MzZyReq mzZyReq : collect){
|
|
|
+ dealMzyReq(mzZyReq);
|
|
|
+ }
|
|
|
+ return R.ok().put("data", collect);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return R.ok().put("data", null);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ private void dealMzyReq(MzZyReq mzZyReq) {
|
|
|
+ if (mzZyReq.getDeptCode() != null && StringUtils.isNotBlank(mzZyReq.getDeptCode())) {
|
|
|
+ mzZyReq.setDeptName(zdUnitCodeService.queryDeptNameByIdInCache(mzZyReq.getDeptCode()));
|
|
|
+ }
|
|
|
+ if (mzZyReq.getReqDept() != null && StringUtils.isNotBlank(mzZyReq.getReqDept())) {
|
|
|
+ mzZyReq.setReqDeptName(zdUnitCodeService.queryDeptNameByIdInCache(mzZyReq.getReqDept()));
|
|
|
+ mzZyReq.setReqWardName(mzZyReq.getReqDeptName());
|
|
|
+ }
|
|
|
+ if (mzZyReq.getSmallDept() != null && StringUtils.isNotBlank(mzZyReq.getSmallDept())) {
|
|
|
+ mzZyReq.setSmallDeptName(zdUnitCodeService.queryDeptNameByIdInCache(mzZyReq.getSmallDept()));
|
|
|
+ }
|
|
|
+ if (mzZyReq.getDoctorCode() != null && StringUtils.isNotBlank(mzZyReq.getDoctorCode())) {
|
|
|
+ Employee employee = employeeService.queryByUserCode(mzZyReq.getDoctorCode());
|
|
|
+ mzZyReq.setDoctorName(employee != null ? employee.getEmployeeName() : "");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
// /**
|
|
|
// * 保存病人的住院证
|
|
|
// *
|