|
@@ -1,6 +1,7 @@
|
|
|
package com.diagbot.facade;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.diagbot.dto.GetHospitalRankInfoDTO;
|
|
|
import com.diagbot.dto.SysHospitalDTO;
|
|
|
import com.diagbot.dto.SysHospitalDeptInfoDTO;
|
|
|
import com.diagbot.dto.SysSetInfoDTO;
|
|
@@ -8,18 +9,24 @@ import com.diagbot.entity.HospitalInfo;
|
|
|
import com.diagbot.entity.SysSet;
|
|
|
import com.diagbot.enums.IsDeleteEnum;
|
|
|
import com.diagbot.enums.SysTypeEnum;
|
|
|
+import com.diagbot.exception.CommonErrorCode;
|
|
|
+import com.diagbot.exception.CommonException;
|
|
|
import com.diagbot.service.impl.SysSetServiceImpl;
|
|
|
import com.diagbot.util.BeanUtil;
|
|
|
import com.diagbot.util.IntegerUtil;
|
|
|
+import com.diagbot.util.StringUtil;
|
|
|
+import com.diagbot.vo.GetHospitalRankInfoVO;
|
|
|
import com.diagbot.vo.HospitalSetVO;
|
|
|
import com.diagbot.vo.SysHospitalCodeVO;
|
|
|
import com.diagbot.vo.SysHospitalInfoVO;
|
|
|
import com.google.common.collect.Lists;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
-import java.util.Arrays;
|
|
|
import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* @author wangfeng
|
|
@@ -29,6 +36,8 @@ import java.util.List;
|
|
|
@Component
|
|
|
public class SysSetFacade extends SysSetServiceImpl {
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private HospitalInfoFacade hospitalInfoFacade;
|
|
|
|
|
|
/**
|
|
|
* @param hospitalSetVO
|
|
@@ -79,4 +88,63 @@ public class SysSetFacade extends SysSetServiceImpl {
|
|
|
sysHospitalDTO.setJuniorHospital(hospitalDatas);
|
|
|
return sysHospitalDTO;
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取大小医院信息
|
|
|
+ *
|
|
|
+ * @param getHospitalRankInfoVO
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public GetHospitalRankInfoDTO getHospitalRankInfo(GetHospitalRankInfoVO getHospitalRankInfoVO) {
|
|
|
+ QueryWrapper<SysSet> sysSetQe = new QueryWrapper<>();
|
|
|
+ sysSetQe.and(qe1 -> qe1
|
|
|
+ .and(qe2 -> qe2
|
|
|
+ .eq("hospital_code", getHospitalRankInfoVO.getHospitalCode())
|
|
|
+ .eq("sys_type", SysTypeEnum.ICSS_SERVICE.getKey())
|
|
|
+ .eq("code", "connect_prec"))
|
|
|
+ .or(qe3 -> qe3
|
|
|
+ .eq("sys_type", SysTypeEnum.PREC_SERVICE.getKey())
|
|
|
+ .eq("code", "junior_hospital")
|
|
|
+ .like("value", getHospitalRankInfoVO.getHospitalCode())));
|
|
|
+ Map<String, SysSet> sysSetMap = list(sysSetQe).stream()
|
|
|
+ .collect(Collectors.toMap(SysSet::getCode, i -> i));
|
|
|
+
|
|
|
+ SysSet connectPrecSysSet = sysSetMap.get("connect_prec");
|
|
|
+ if (connectPrecSysSet == null
|
|
|
+ || StringUtil.isBlank(connectPrecSysSet.getValue())
|
|
|
+ || connectPrecSysSet.getValue().equals("0")) {
|
|
|
+ throw new CommonException(CommonErrorCode.RPC_ERROR, "不支持同时对接预问诊");
|
|
|
+ }
|
|
|
+
|
|
|
+ String hospitalCode = null, sonHospitalCode = null;
|
|
|
+ SysSet juniorHospitalSysSet = sysSetMap.get("junior_hospital");
|
|
|
+ if (juniorHospitalSysSet != null) {
|
|
|
+ hospitalCode = juniorHospitalSysSet.getHospitalCode();
|
|
|
+ sonHospitalCode = getHospitalRankInfoVO.getHospitalCode();
|
|
|
+ } else {
|
|
|
+ hospitalCode = getHospitalRankInfoVO.getHospitalCode();
|
|
|
+ }
|
|
|
+
|
|
|
+ QueryWrapper<HospitalInfo> hospitalInfoQe = new QueryWrapper<>();
|
|
|
+ hospitalInfoQe.eq("code", hospitalCode)
|
|
|
+ .or(StringUtil.isNotBlank(sonHospitalCode))
|
|
|
+ .eq("code", sonHospitalCode);
|
|
|
+ Map<String, HospitalInfo> hospitalInfoMap = hospitalInfoFacade.list(hospitalInfoQe)
|
|
|
+ .stream().collect(Collectors.toMap(HospitalInfo::getCode, i -> i));
|
|
|
+
|
|
|
+ HospitalInfo hospitalInfo = hospitalInfoMap.get(hospitalCode);
|
|
|
+ HospitalInfo sonHospitalInfo = hospitalInfoMap.get(sonHospitalCode);
|
|
|
+ GetHospitalRankInfoDTO getHospitalRankInfoDTO = new GetHospitalRankInfoDTO();
|
|
|
+ getHospitalRankInfoDTO.setHospitalId(hospitalInfo.getId());
|
|
|
+ getHospitalRankInfoDTO.setHospitalCode(hospitalInfo.getCode());
|
|
|
+ getHospitalRankInfoDTO.setHospitalName(hospitalInfo.getName());
|
|
|
+ if (sonHospitalInfo != null) {
|
|
|
+ getHospitalRankInfoDTO.setSonHospitalId(sonHospitalInfo.getId());
|
|
|
+ getHospitalRankInfoDTO.setSonHospitalCode(sonHospitalInfo.getCode());
|
|
|
+ getHospitalRankInfoDTO.setSonHospitalName(sonHospitalInfo.getName());
|
|
|
+ }
|
|
|
+
|
|
|
+ return getHospitalRankInfoDTO;
|
|
|
+ }
|
|
|
+
|
|
|
}
|