ソースを参照

Merge remote-tracking branch 'origin/dev/prec20191118_new' into dev/prec20191118_new

wangfeng 5 年 前
コミット
81016f090d
28 ファイル変更1478 行追加162 行削除
  1. 11 0
      aipt-service/src/main/java/com/diagbot/client/TranServiceClient.java
  2. 8 0
      aipt-service/src/main/java/com/diagbot/client/hystrix/TranServiceHystrix.java
  3. 173 0
      aipt-service/src/main/java/com/diagbot/dto/GetTopPatientInfoDjDTO.java
  4. 23 0
      aipt-service/src/main/java/com/diagbot/facade/PatientInfoFacade.java
  5. 62 0
      aipt-service/src/main/java/com/diagbot/vo/GetTopPatientInfoDjVO.java
  6. 9 0
      aipt-service/src/main/java/com/diagbot/web/PatientInfoController.java
  7. 93 0
      common/src/main/java/com/diagbot/util/IdCard.java
  8. 11 0
      prec-service/src/main/java/com/diagbot/client/AiptServiceClient.java
  9. 8 0
      prec-service/src/main/java/com/diagbot/client/hystrix/AiptServiceHystrix.java
  10. 173 0
      prec-service/src/main/java/com/diagbot/dto/GetTopPatientInfoDjDTO.java
  11. 47 36
      prec-service/src/main/java/com/diagbot/dto/SignInDTO.java
  12. 4 1
      prec-service/src/main/java/com/diagbot/facade/InquiryInfoFacade.java
  13. 7 5
      prec-service/src/main/java/com/diagbot/facade/PatientInfoFacade.java
  14. 30 24
      prec-service/src/main/java/com/diagbot/vo/GetInquiryDetailVO.java
  15. 62 0
      prec-service/src/main/java/com/diagbot/vo/GetTopPatientInfoDjVO.java
  16. 20 2
      prec-service/src/main/java/com/diagbot/vo/SignInVO.java
  17. 4 2
      prec-service/src/main/java/com/diagbot/web/PatientInfoController.java
  18. 145 0
      tran-service/src/main/java/com/diagbot/dto/GetTopPatientInfoDjDTO.java
  19. 48 0
      tran-service/src/main/java/com/diagbot/dto/RegisterInfoDTO.java
  20. 46 0
      tran-service/src/main/java/com/diagbot/dto/RegisterInfoDetailDTO.java
  21. 55 45
      tran-service/src/main/java/com/diagbot/dto/SignInDTO.java
  22. 318 0
      tran-service/src/main/java/com/diagbot/facade/PatientInfoDjFacade.java
  23. 1 39
      tran-service/src/main/java/com/diagbot/facade/PatientInfoFacade.java
  24. 10 0
      tran-service/src/main/java/com/diagbot/mapper/PatientInfoMapper.java
  25. 46 0
      tran-service/src/main/java/com/diagbot/vo/GetTopPatientInfoDjVO.java
  26. 15 2
      tran-service/src/main/java/com/diagbot/vo/SignInVO.java
  27. 22 5
      tran-service/src/main/java/com/diagbot/web/PatientInfoController.java
  28. 27 1
      tran-service/src/main/resources/mapper/PatientInfoMapper.xml

+ 11 - 0
aipt-service/src/main/java/com/diagbot/client/TranServiceClient.java

@@ -4,12 +4,14 @@ import com.diagbot.client.bean.HosCodeVO;
 import com.diagbot.client.hystrix.TranServiceHystrix;
 import com.diagbot.dto.GetDiseaseIcdDTO;
 import com.diagbot.dto.GetTopPatientInfoDTO;
+import com.diagbot.dto.GetTopPatientInfoDjDTO;
 import com.diagbot.dto.HospitalDeptInfoDTO;
 import com.diagbot.dto.IndexDataDTO;
 import com.diagbot.dto.RespDTO;
 import com.diagbot.dto.SysSetInfoDTO;
 import com.diagbot.vo.DiseaseIcdVO;
 import com.diagbot.vo.GetDiseaseIcdVO;
+import com.diagbot.vo.GetTopPatientInfoDjVO;
 import com.diagbot.vo.GetTopPatientInfoVO;
 import com.diagbot.vo.HospitalDeptInfoVO;
 import com.diagbot.vo.HospitalSetVO;
@@ -59,6 +61,15 @@ public interface TranServiceClient {
     @PostMapping("/patientInfo/getTopPatientInfo")
     RespDTO<GetTopPatientInfoDTO> getTopPatientInfo(@RequestBody GetTopPatientInfoVO getTopPatientInfoVO);
 
+    /**
+     * 对接-获取页面顶部病人医生科室信息
+     *
+     * @param getTopPatientInfoDjVO
+     * @return
+     */
+    @PostMapping("/patientInfo/getTopPatientInfoDj")
+    RespDTO<GetTopPatientInfoDjDTO> getTopPatientInfoDj(@RequestBody GetTopPatientInfoDjVO getTopPatientInfoDjVO);
+
     /**
      * 根据医院编码和套餐名称获取化验公表映射关系
      *

+ 8 - 0
aipt-service/src/main/java/com/diagbot/client/hystrix/TranServiceHystrix.java

@@ -4,12 +4,14 @@ import com.diagbot.client.TranServiceClient;
 import com.diagbot.client.bean.HosCodeVO;
 import com.diagbot.dto.GetDiseaseIcdDTO;
 import com.diagbot.dto.GetTopPatientInfoDTO;
+import com.diagbot.dto.GetTopPatientInfoDjDTO;
 import com.diagbot.dto.HospitalDeptInfoDTO;
 import com.diagbot.dto.IndexDataDTO;
 import com.diagbot.dto.RespDTO;
 import com.diagbot.dto.SysSetInfoDTO;
 import com.diagbot.vo.DiseaseIcdVO;
 import com.diagbot.vo.GetDiseaseIcdVO;
+import com.diagbot.vo.GetTopPatientInfoDjVO;
 import com.diagbot.vo.GetTopPatientInfoVO;
 import com.diagbot.vo.HospitalDeptInfoVO;
 import com.diagbot.vo.HospitalSetVO;
@@ -52,6 +54,12 @@ public class TranServiceHystrix implements TranServiceClient {
         return null;
     }
 
+    @Override
+    public RespDTO<GetTopPatientInfoDjDTO> getTopPatientInfoDj(GetTopPatientInfoDjVO getTopPatientInfoDjVO) {
+        log.error("【hystrix】调用{}异常", "getTopPatientInfoDj");
+        return null;
+    }
+
     /**
      * 根据医院编码和套餐名称获取化验公表映射关系
      *

+ 173 - 0
aipt-service/src/main/java/com/diagbot/dto/GetTopPatientInfoDjDTO.java

@@ -0,0 +1,173 @@
+package com.diagbot.dto;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.Date;
+
+/**
+ * @author rgb
+ * @Description
+ * @time 2018年11月19日下午4:57:43
+ */
+@ApiModel(value = "页面顶部病人医生科室信息查询接口出参")
+@Getter
+@Setter
+public class GetTopPatientInfoDjDTO {
+
+    /**
+     * 医院id
+     */
+    @ApiModelProperty(value = "医院id")
+    private Long hospitalId;
+
+    /**
+     * 医院编码
+     */
+    @ApiModelProperty(value = "医院编码")
+    private String hospitalCode;
+
+    /**
+     * 医院名称
+     */
+    @ApiModelProperty(value = "医院名称")
+    private String hospitalName;
+
+    /**
+     * 子医院id
+     */
+    @ApiModelProperty(value = "子医院id")
+    private Long sonHospitalId;
+
+    /**
+     * 子医院编码
+     */
+    @ApiModelProperty(value = "子医院编码")
+    private String sonHospitalCode;
+
+    /**
+     * 子医院名称
+     */
+    @ApiModelProperty(value = "子医院名称")
+    private String sonHospitalName;
+
+    /**
+     * 医院科室id
+     */
+    @ApiModelProperty(value = "医院科室id")
+    private Long hospitalDeptId;
+
+    /**
+     * 自己科室id
+     */
+    @ApiModelProperty(value = "自己科室id")
+    private Long selfDeptId;
+
+    /**
+     * 自己科室名称
+     */
+    @ApiModelProperty(value = "自己科室名称")
+    private String selfDeptName;
+
+    /**
+     * 医院科室编码
+     */
+    @ApiModelProperty(value = "医院科室编码")
+    private String hospitalDeptCode;
+
+    /**
+     * 医院科室名称
+     */
+    @ApiModelProperty(value = "医院科室名称")
+    private String hospitalDeptName;
+
+    /**
+     * 医生id
+     */
+    @ApiModelProperty(value = "医生id")
+    private Long doctorId;
+
+    /**
+     * 医生编码
+     */
+    @ApiModelProperty(value = "医生编码")
+    private String doctorCode;
+
+    /**
+     * 医生姓名
+     */
+    @ApiModelProperty(value = "医生姓名")
+    private String doctorName;
+
+    /**
+     * 病人id
+     */
+    @ApiModelProperty(value = "病人id")
+    private Long patientId;
+
+    /**
+     * 病人编号
+     */
+    @ApiModelProperty(value = "病人编号")
+    private String patientCode;
+
+    /**
+     * 病人姓名
+     */
+    @ApiModelProperty(value = "病人姓名")
+    private String patientName;
+
+    /**
+     * 病人性别
+     */
+    @ApiModelProperty(value = "病人性别")
+    private String patientSex;
+
+    /**
+     * 病人年龄
+     */
+    @ApiModelProperty(value = "病人年龄")
+    private Integer patientAge;
+
+    /**
+     * 病人证件号码
+     */
+    @ApiModelProperty(value = "病人证件号码")
+    private String patientIdNo;
+
+    /**
+     * 系统时间
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
+    @ApiModelProperty(value = "系统时间")
+    private Date systemTime;
+
+    /**
+     * 出生日期
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
+    @ApiModelProperty(value = "出生日期")
+    private Date birthday;
+
+    /**
+     * 门诊号
+     */
+    @ApiModelProperty(value = "门诊号")
+    private String recordId;
+
+    /**
+     * 模式分类
+     */
+    @ApiModelProperty(value = "模式分类")
+    private Integer modeClassify;
+
+    /**
+     * 模式值
+     */
+    @ApiModelProperty(value = "模式值")
+    private Integer modeValue;
+
+}

+ 23 - 0
aipt-service/src/main/java/com/diagbot/facade/PatientInfoFacade.java

@@ -2,11 +2,13 @@ package com.diagbot.facade;
 
 import com.diagbot.client.TranServiceClient;
 import com.diagbot.dto.GetTopPatientInfoDTO;
+import com.diagbot.dto.GetTopPatientInfoDjDTO;
 import com.diagbot.dto.RespDTO;
 import com.diagbot.entity.Concept;
 import com.diagbot.enums.LexiconTypeEnum;
 import com.diagbot.util.RespDTOUtil;
 import com.diagbot.vo.ConceptBaseVO;
+import com.diagbot.vo.GetTopPatientInfoDjVO;
 import com.diagbot.vo.GetTopPatientInfoVO;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
@@ -46,4 +48,25 @@ public class PatientInfoFacade {
         return getTopPatientInfoDTO;
     }
 
+    /**
+     * 对接-页面顶部病人医生科室信息查询
+     *
+     * @param getTopPatientInfoDjVO
+     * @return
+     */
+    public GetTopPatientInfoDjDTO getTopPatientInfoDj(@RequestBody GetTopPatientInfoDjVO getTopPatientInfoDjVO) {
+        RespDTO<GetTopPatientInfoDjDTO> respDTO = tranServiceClient.getTopPatientInfoDj(getTopPatientInfoDjVO);
+        RespDTOUtil.respNGDealCover(respDTO, "获取页面顶部病人医生科室信息失败");
+
+        GetTopPatientInfoDjDTO getTopPatientInfoDjDTO = respDTO.data;
+
+        ConceptBaseVO conceptBaseVO = new ConceptBaseVO();
+        conceptBaseVO.setLibType(LexiconTypeEnum.DEPARTMENT.getKey());
+        conceptBaseVO.setName(getTopPatientInfoDjDTO.getSelfDeptName());
+        Concept concept = conceptFacade.exist(conceptBaseVO);
+        getTopPatientInfoDjDTO.setSelfDeptId(concept.getId());
+
+        return getTopPatientInfoDjDTO;
+    }
+
 }

+ 62 - 0
aipt-service/src/main/java/com/diagbot/vo/GetTopPatientInfoDjVO.java

@@ -0,0 +1,62 @@
+package com.diagbot.vo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+
+import javax.validation.constraints.NotBlank;
+
+/**
+ * @author rgb
+ * @Description
+ * @time 2018年11月19日下午4:58:37
+ */
+@ApiModel(value = "页面顶部病人医生科室信息查询接口传参")
+@Getter
+@Setter
+public class GetTopPatientInfoDjVO {
+
+    /**
+     * 医院编号
+     */
+    @ApiModelProperty(value = "医院编号", required = true)
+    @NotBlank(message = "医院编号必填")
+    private String hospitalCode;
+
+    /**
+     * 子医院编号
+     */
+    @ApiModelProperty(value = "子医院编号")
+    private String sonHospitalCode;
+
+    /**
+     * 医院科室编号
+     */
+    @ApiModelProperty(value = "医院科室编号", required = true)
+    @NotBlank(message = "医院科室编号必填")
+    private String hospitalDeptCode;
+
+    /**
+     * 医院医生编号
+     */
+    @ApiModelProperty(value = "医院医生编号", required = true)
+    @NotBlank(message = "医院医生编号必填")
+    private String doctorCode;
+
+    /**
+     * 医院患者编号
+     */
+    @ApiModelProperty(value = "医院患者编号", required = true)
+    @NotBlank(message = "医院患者编号必填")
+    private String patientCode;
+
+    /**
+     * 门诊号
+     */
+    @ApiModelProperty(value = "门诊号", required = true)
+    @NotBlank(message = "门诊号必填")
+    private String recordId;
+
+
+}

+ 9 - 0
aipt-service/src/main/java/com/diagbot/web/PatientInfoController.java

@@ -2,8 +2,10 @@ package com.diagbot.web;
 
 import com.diagbot.annotation.SysLogger;
 import com.diagbot.dto.GetTopPatientInfoDTO;
+import com.diagbot.dto.GetTopPatientInfoDjDTO;
 import com.diagbot.dto.RespDTO;
 import com.diagbot.facade.PatientInfoFacade;
+import com.diagbot.vo.GetTopPatientInfoDjVO;
 import com.diagbot.vo.GetTopPatientInfoVO;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -44,4 +46,11 @@ public class PatientInfoController {
         return RespDTO.onSuc(patientInfoFacade.getTopPatientInfo(getTopPatientInfoVO));
     }
 
+    @ApiOperation(value = "知识库标准化-对接-页面顶部病人医生科室信息——查询[by:rengb]")
+    @PostMapping("/getTopPatientInfoDj")
+    @SysLogger("getTopPatientInfoDj")
+    public RespDTO<GetTopPatientInfoDjDTO> getTopPatientInfoDj(@Valid @RequestBody GetTopPatientInfoDjVO getTopPatientInfoDjVO) {
+        return RespDTO.onSuc(patientInfoFacade.getTopPatientInfoDj(getTopPatientInfoDjVO));
+    }
+
 }

+ 93 - 0
common/src/main/java/com/diagbot/util/IdCard.java

@@ -0,0 +1,93 @@
+package com.diagbot.util;
+
+import java.util.Calendar;
+
+/**
+ * @Description:
+ * @author: rengb
+ * @time: 2019/11/20 13:18
+ */
+public class IdCard {
+    /**
+     * 中国公民身份证号码最小长度。
+     */
+    public final int CHINA_ID_MIN_LENGTH = 15;
+
+    /**
+     * 中国公民身份证号码最大长度。
+     */
+    public final int CHINA_ID_MAX_LENGTH = 18;
+
+    /**
+     * 根据身份编号获取年龄
+     *
+     * @param idCard 身份编号
+     * @return 年龄
+     */
+    public static int getAgeByIdCard(String idCard) {
+        int iAge = 0;
+        Calendar cal = Calendar.getInstance();
+        String year = idCard.substring(6, 10);
+        int iCurrYear = cal.get(Calendar.YEAR);
+        iAge = iCurrYear - Integer.valueOf(year);
+        return iAge;
+    }
+
+    /**
+     * 根据身份编号获取生日
+     *
+     * @param idCard 身份编号
+     * @return 生日(yyyyMMdd)
+     */
+    public static String getBirthByIdCard(String idCard) {
+        return idCard.substring(6, 14);
+    }
+
+    /**
+     * 根据身份编号获取生日年
+     *
+     * @param idCard 身份编号
+     * @return 生日(yyyy)
+     */
+    public static Short getYearByIdCard(String idCard) {
+        return Short.valueOf(idCard.substring(6, 10));
+    }
+
+    /**
+     * 根据身份编号获取生日月
+     *
+     * @param idCard 身份编号
+     * @return 生日(MM)
+     */
+    public static Short getMonthByIdCard(String idCard) {
+        return Short.valueOf(idCard.substring(10, 12));
+    }
+
+    /**
+     * 根据身份编号获取生日天
+     *
+     * @param idCard 身份编号
+     * @return 生日(dd)
+     */
+    public static Short getDateByIdCard(String idCard) {
+        return Short.valueOf(idCard.substring(12, 14));
+    }
+
+    /**
+     * 根据身份编号获取性别
+     *
+     * @param idCard 身份编号
+     * @return 性别(1- 男 ,2 - 女 , 0 - 未知)
+     */
+    public static int getGenderByIdCard(String idCard) {
+        int sGender = 0;
+
+        String sCardNum = idCard.substring(16, 17);
+        if (Integer.parseInt(sCardNum) % 2 != 0) {
+            sGender = 1;//男
+        } else {
+            sGender = 2;//女
+        }
+        return sGender;
+    }
+}

+ 11 - 0
prec-service/src/main/java/com/diagbot/client/AiptServiceClient.java

@@ -5,11 +5,13 @@ import com.diagbot.client.hystrix.AiptServiceHystrix;
 import com.diagbot.dto.ConceptBaseDTO;
 import com.diagbot.dto.ConceptRetrievalDTO;
 import com.diagbot.dto.GetTopPatientInfoDTO;
+import com.diagbot.dto.GetTopPatientInfoDjDTO;
 import com.diagbot.dto.PushDTO;
 import com.diagbot.dto.RespDTO;
 import com.diagbot.dto.VersionWrapperDTO;
 import com.diagbot.vo.ConceptSearchVO;
 import com.diagbot.vo.ConceptUsualVO;
+import com.diagbot.vo.GetTopPatientInfoDjVO;
 import com.diagbot.vo.GetTopPatientInfoVO;
 import com.diagbot.vo.RetrievalVO;
 import com.diagbot.vo.VersionVO;
@@ -46,6 +48,15 @@ public interface AiptServiceClient {
     @PostMapping("/patientInfo/getTopPatientInfo")
     RespDTO<GetTopPatientInfoDTO> getTopPatientInfo(@RequestBody GetTopPatientInfoVO getTopPatientInfoVO);
 
+    /**
+     * 对接-获取页面顶部病人医生科室信息
+     *
+     * @param getTopPatientInfoDjVO
+     * @return
+     */
+    @PostMapping("/patientInfo/getTopPatientInfoDj")
+    RespDTO<GetTopPatientInfoDjDTO> getTopPatientInfoDj(@RequestBody GetTopPatientInfoDjVO getTopPatientInfoDjVO);
+
     /**
      * 常见症状
      *

+ 8 - 0
prec-service/src/main/java/com/diagbot/client/hystrix/AiptServiceHystrix.java

@@ -5,11 +5,13 @@ import com.diagbot.client.bean.SearchData;
 import com.diagbot.dto.ConceptBaseDTO;
 import com.diagbot.dto.ConceptRetrievalDTO;
 import com.diagbot.dto.GetTopPatientInfoDTO;
+import com.diagbot.dto.GetTopPatientInfoDjDTO;
 import com.diagbot.dto.PushDTO;
 import com.diagbot.dto.RespDTO;
 import com.diagbot.dto.VersionWrapperDTO;
 import com.diagbot.vo.ConceptSearchVO;
 import com.diagbot.vo.ConceptUsualVO;
+import com.diagbot.vo.GetTopPatientInfoDjVO;
 import com.diagbot.vo.GetTopPatientInfoVO;
 
 import com.diagbot.vo.RetrievalVO;
@@ -48,6 +50,12 @@ public class AiptServiceHystrix implements AiptServiceClient {
         return null;
     }
 
+    @Override
+    public RespDTO<GetTopPatientInfoDjDTO> getTopPatientInfoDj(GetTopPatientInfoDjVO getTopPatientInfoDjVO) {
+        log.error("【hystrix】调用{}异常", "getTopPatientInfoDj");
+        return null;
+    }
+
     @Override
     public RespDTO<List<ConceptBaseDTO>> getConceptUsual(@Valid ConceptUsualVO conceptUsualVO) {
         log.error("【hystrix】调用{}异常", "getConceptUsual");

+ 173 - 0
prec-service/src/main/java/com/diagbot/dto/GetTopPatientInfoDjDTO.java

@@ -0,0 +1,173 @@
+package com.diagbot.dto;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.Date;
+
+/**
+ * @author rgb
+ * @Description
+ * @time 2018年11月19日下午4:57:43
+ */
+@ApiModel(value = "页面顶部病人医生科室信息查询接口出参")
+@Getter
+@Setter
+public class GetTopPatientInfoDjDTO {
+
+    /**
+     * 医院id
+     */
+    @ApiModelProperty(value = "医院id")
+    private Long hospitalId;
+
+    /**
+     * 医院编码
+     */
+    @ApiModelProperty(value = "医院编码")
+    private String hospitalCode;
+
+    /**
+     * 医院名称
+     */
+    @ApiModelProperty(value = "医院名称")
+    private String hospitalName;
+
+    /**
+     * 子医院id
+     */
+    @ApiModelProperty(value = "子医院id")
+    private Long sonHospitalId;
+
+    /**
+     * 子医院编码
+     */
+    @ApiModelProperty(value = "子医院编码")
+    private String sonHospitalCode;
+
+    /**
+     * 子医院名称
+     */
+    @ApiModelProperty(value = "子医院名称")
+    private String sonHospitalName;
+
+    /**
+     * 医院科室id
+     */
+    @ApiModelProperty(value = "医院科室id")
+    private Long hospitalDeptId;
+
+    /**
+     * 自己科室id
+     */
+    @ApiModelProperty(value = "自己科室id")
+    private Long selfDeptId;
+
+    /**
+     * 自己科室名称
+     */
+    @ApiModelProperty(value = "自己科室名称")
+    private String selfDeptName;
+
+    /**
+     * 医院科室编码
+     */
+    @ApiModelProperty(value = "医院科室编码")
+    private String hospitalDeptCode;
+
+    /**
+     * 医院科室名称
+     */
+    @ApiModelProperty(value = "医院科室名称")
+    private String hospitalDeptName;
+
+    /**
+     * 医生id
+     */
+    @ApiModelProperty(value = "医生id")
+    private Long doctorId;
+
+    /**
+     * 医生编码
+     */
+    @ApiModelProperty(value = "医生编码")
+    private String doctorCode;
+
+    /**
+     * 医生姓名
+     */
+    @ApiModelProperty(value = "医生姓名")
+    private String doctorName;
+
+    /**
+     * 病人id
+     */
+    @ApiModelProperty(value = "病人id")
+    private Long patientId;
+
+    /**
+     * 病人编号
+     */
+    @ApiModelProperty(value = "病人编号")
+    private String patientCode;
+
+    /**
+     * 病人姓名
+     */
+    @ApiModelProperty(value = "病人姓名")
+    private String patientName;
+
+    /**
+     * 病人性别
+     */
+    @ApiModelProperty(value = "病人性别")
+    private String patientSex;
+
+    /**
+     * 病人年龄
+     */
+    @ApiModelProperty(value = "病人年龄")
+    private Integer patientAge;
+
+    /**
+     * 病人证件号码
+     */
+    @ApiModelProperty(value = "病人证件号码")
+    private String patientIdNo;
+
+    /**
+     * 系统时间
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
+    @ApiModelProperty(value = "系统时间")
+    private Date systemTime;
+
+    /**
+     * 出生日期
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
+    @ApiModelProperty(value = "出生日期")
+    private Date birthday;
+
+    /**
+     * 门诊号
+     */
+    @ApiModelProperty(value = "门诊号")
+    private String recordId;
+
+    //    /**
+    //     * 模式分类
+    //     */
+    //	@ApiModelProperty(value="模式分类")
+    //    private Integer modeClassify;
+    //
+    //    /**
+    //     * 模式值
+    //     */
+    //	@ApiModelProperty(value="模式值")
+    //    private Integer modeValue;
+
+}

+ 47 - 36
prec-service/src/main/java/com/diagbot/dto/SignInDTO.java

@@ -10,77 +10,88 @@ import lombok.Setter;
  * @author: rengb
  * @time: 2018/11/19 18:56
  */
-@ApiModel(value="患者登录接口出参")
+@ApiModel(value = "患者登录接口出参")
 @Getter
 @Setter
-public class SignInDTO{
-	
-	/**
+public class SignInDTO {
+
+    /**
      * 医院编码
      */
-	@ApiModelProperty(value="医院编码")
+    @ApiModelProperty(value = "医院编码")
     private String hospitalCode;
 
     /**
      * 医院名称
      */
-	@ApiModelProperty(value="医院名称")
+    @ApiModelProperty(value = "医院名称")
     private String hospitalName;
-	
-	/**
+
+    /**
+     * 子医院编号
+     */
+    @ApiModelProperty(value = "子医院编号")
+    private String sonHospitalCode;
+
+    /**
+     * 子医院名称
+     */
+    @ApiModelProperty(value = "子医院名称")
+    private String sonHospitalName;
+
+    /**
      * 医院科室编码
      */
-	@ApiModelProperty(value="医院科室编码")
+    @ApiModelProperty(value = "医院科室编码")
     private String hospitalDeptCode;
 
     /**
      * 医院科室名称
      */
-	@ApiModelProperty(value="医院科室名称")
+    @ApiModelProperty(value = "医院科室名称")
     private String hospitalDeptName;
-	
-	/**
+
+    /**
      * 医生编码
      */
-	@ApiModelProperty(value="医生编码")
+    @ApiModelProperty(value = "医生编码")
     private String doctorCode;
 
     /**
      * 医生姓名
      */
-	@ApiModelProperty(value="医生姓名")
+    @ApiModelProperty(value = "医生姓名")
     private String doctorName;
-	
-	/**
+
+    /**
      * 病人编号
      */
-	@ApiModelProperty(value="病人编号")
+    @ApiModelProperty(value = "病人编号")
     private String patientCode;
-	
-	/**
+
+    /**
      * 病人姓名
      */
-	@ApiModelProperty(value="病人姓名")
+    @ApiModelProperty(value = "病人姓名")
     private String patientName;
-	
-	/**
-	 * 挂号时间
-	 */
-	@ApiModelProperty(value="挂号时间")
-	private String recordTime;
-	
-	/**
+
+    /**
+     * 挂号时间
+     */
+    @ApiModelProperty(value = "挂号时间")
+    private String recordTime;
+
+    /**
      * 就诊号
      */
-	@ApiModelProperty(value="就诊号")
-	private String recordId;
-	
-	/**
+    @ApiModelProperty(value = "就诊号")
+    private String recordId;
+
+    /**
      * 挂号信息
      */
-	@ApiModelProperty(value="挂号信息")
-	private String registerNum;
-	
+    @ApiModelProperty(value = "挂号信息")
+    private String registerNum;
+
 
-		
 }

+ 4 - 1
prec-service/src/main/java/com/diagbot/facade/InquiryInfoFacade.java

@@ -236,7 +236,8 @@ public class InquiryInfoFacade extends InquiryInfoServiceImpl {
         }*/
         if (getInquiryDetailVO.getPatientId() == null
                 && StringUtil.isBlank(getInquiryDetailVO.getPatientCode())
-                && StringUtil.isBlank(getInquiryDetailVO.getPatientIdNo())) {
+                && (StringUtil.isBlank(getInquiryDetailVO.getPatientIdNo())
+                || StringUtil.isBlank(getInquiryDetailVO.getPatientName()))) {
             throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "患者信息(患者id或者患者编码或者患者病历号)必传!");
         }
 
@@ -260,6 +261,8 @@ public class InquiryInfoFacade extends InquiryInfoServiceImpl {
                 "patient_code", getInquiryDetailVO.getPatientCode());
         inquiryInfoQe.eq(StringUtil.isNotBlank(getInquiryDetailVO.getPatientIdNo()),
                 "patient_id_no", getInquiryDetailVO.getPatientIdNo());
+        inquiryInfoQe.eq(StringUtil.isNotBlank(getInquiryDetailVO.getPatientName()),
+                "patient_name", getInquiryDetailVO.getPatientName());
         inquiryInfoQe.eq("inquiry_code", getInquiryDetailVO.getInquiryCode());
         String day = DateUtil.formatDateTime(DateUtil.getFirstTimeOfDay(DateUtil.addDay(DateUtil.now(),
                 -getInquiryDetailVO.getDayLimit())));

+ 7 - 5
prec-service/src/main/java/com/diagbot/facade/PatientInfoFacade.java

@@ -2,6 +2,8 @@ package com.diagbot.facade;
 
 import java.util.List;
 
+import com.diagbot.dto.GetTopPatientInfoDjDTO;
+import com.diagbot.vo.GetTopPatientInfoDjVO;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
@@ -31,16 +33,16 @@ public class PatientInfoFacade {
     /**
      * 页面顶部病人医生科室信息查询
      *
-     * @param getTopPatientInfoVO
+     * @param getTopPatientInfoDjVO
      * @return
      */
-    public GetTopPatientInfoDTO getTopPatientInfo(GetTopPatientInfoVO getTopPatientInfoVO) {
-        RespDTO<GetTopPatientInfoDTO> respDTO = aiptServiceClient.getTopPatientInfo(getTopPatientInfoVO);
+    public GetTopPatientInfoDjDTO getTopPatientInfo(GetTopPatientInfoDjVO getTopPatientInfoDjVO) {
+        RespDTO<GetTopPatientInfoDjDTO> respDTO = aiptServiceClient.getTopPatientInfoDj(getTopPatientInfoDjVO);
         RespDTOUtil.respNGDealCover(respDTO, "获取页面顶部病人医生科室信息失败");
 
-        GetTopPatientInfoDTO getTopPatientInfoDTO = respDTO.data;
+        GetTopPatientInfoDjDTO getTopPatientInfoDjDTO = respDTO.data;
 
-        return getTopPatientInfoDTO;
+        return getTopPatientInfoDjDTO;
     }
     
     /**

+ 30 - 24
prec-service/src/main/java/com/diagbot/vo/GetInquiryDetailVO.java

@@ -1,87 +1,93 @@
 package com.diagbot.vo;
 
-import javax.validation.constraints.NotBlank;
-
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Getter;
 import lombok.Setter;
 
+import javax.validation.constraints.NotBlank;
+
 /**
  * @Description:
  * @author: rengb
  * @time: 2018/11/19 18:58
  */
-@ApiModel(value="病历详情接口传参")
+@ApiModel(value = "病历详情接口传参")
 @Getter
 @Setter
 public class GetInquiryDetailVO {
 
-	/**
+    /**
      * 医院id
      */
-	@ApiModelProperty(value="医院id")
+    @ApiModelProperty(value = "医院id")
     private Long hospitalId;
-	
-	 /**
+
+    /**
      * 医院编码
      */
-	@ApiModelProperty(value="医院编码")
+    @ApiModelProperty(value = "医院编码")
     private String hospitalCode;
 
     /**
      * 医院科室id
      */
-	@ApiModelProperty(value="医院科室id")
+    @ApiModelProperty(value = "医院科室id")
     private Long hospitalDeptId;
 
     /**
      * 医院科室编码
      */
-	@ApiModelProperty(value="医院科室编码")
+    @ApiModelProperty(value = "医院科室编码")
     private String hospitalDeptCode;
 
     /**
      * 医生id
      */
-	@ApiModelProperty(value="医生id")
+    @ApiModelProperty(value = "医生id")
     private Long doctorId;
-	
+
     /**
      * 医生编码
      */
-	@ApiModelProperty(value="医生编码")
+    @ApiModelProperty(value = "医生编码")
     private String doctorCode;
 
     /**
      * 患者id
      */
-	@ApiModelProperty(value="患者id")
+    @ApiModelProperty(value = "患者id")
     private Long patientId;
-	
+
     /**
      * 患者编号
      */
-	@ApiModelProperty(value="患者编号")
+    @ApiModelProperty(value = "患者编号")
     private String patientCode;
-	
+
     /**
-     * 患者病历号
+     * 患者证件号码
      */
-	@ApiModelProperty(value="患者病历号")
+    @ApiModelProperty(value = "患者证件号码")
     private String patientIdNo;
-	
+
+    /**
+     * 患者姓名
+     */
+    @ApiModelProperty(value = "患者姓名")
+    private String patientName;
+
     /**
      * 就诊序列号
      */
-	@ApiModelProperty(value="就诊序列号",required=true)
-	@NotBlank(message="就诊序列号必传")
+    @ApiModelProperty(value = "就诊序列号", required = true)
+    @NotBlank(message = "就诊序列号必传")
     private String inquiryCode;
 
     /**
      * 有效天数限制
      */
-    @ApiModelProperty(value="有效天数限制")
-	private int dayLimit = 15;
+    @ApiModelProperty(value = "有效天数限制")
+    private int dayLimit = 15;
 
 }

+ 62 - 0
prec-service/src/main/java/com/diagbot/vo/GetTopPatientInfoDjVO.java

@@ -0,0 +1,62 @@
+package com.diagbot.vo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+
+import javax.validation.constraints.NotBlank;
+
+/**
+ * @author rgb
+ * @Description
+ * @time 2018年11月19日下午4:58:37
+ */
+@ApiModel(value = "页面顶部病人医生科室信息查询接口传参")
+@Getter
+@Setter
+public class GetTopPatientInfoDjVO {
+
+    /**
+     * 医院编号
+     */
+    @ApiModelProperty(value = "医院编号", required = true)
+    @NotBlank(message = "医院编号必填")
+    private String hospitalCode;
+
+    /**
+     * 子医院编号
+     */
+    @ApiModelProperty(value = "子医院编号")
+    private String sonHospitalCode;
+
+    /**
+     * 医院科室编号
+     */
+    @ApiModelProperty(value = "医院科室编号", required = true)
+    @NotBlank(message = "医院科室编号必填")
+    private String hospitalDeptCode;
+
+    /**
+     * 医院医生编号
+     */
+    @ApiModelProperty(value = "医院医生编号", required = true)
+    @NotBlank(message = "医院医生编号必填")
+    private String doctorCode;
+
+    /**
+     * 医院患者编号
+     */
+    @ApiModelProperty(value = "医院患者编号", required = true)
+    @NotBlank(message = "医院患者编号必填")
+    private String patientCode;
+
+    /**
+     * 门诊号
+     */
+    @ApiModelProperty(value = "门诊号", required = true)
+    @NotBlank(message = "门诊号必填")
+    private String recordId;
+
+
+}

+ 20 - 2
prec-service/src/main/java/com/diagbot/vo/SignInVO.java

@@ -1,12 +1,12 @@
 package com.diagbot.vo;
 
-import javax.validation.constraints.NotBlank;
-
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Getter;
 import lombok.Setter;
 
+import javax.validation.constraints.NotBlank;
+
 /**
  * @Description:
  * @author: rengb
@@ -23,6 +23,24 @@ public class SignInVO {
 	@ApiModelProperty(value="医院编号",required=true)
 	@NotBlank(message="医院编号必填")
 	private String hospitalCode;
+
+	/**
+	 * 医院名称
+	 */
+	@ApiModelProperty(value="医院名称")
+	private String hospitalName;
+
+	/**
+	 * 子医院编号
+	 */
+	@ApiModelProperty(value="子医院编号")
+	private String sonHospitalCode;
+
+	/**
+	 * 子医院名称
+	 */
+	@ApiModelProperty(value="子医院名称")
+	private String sonHospitalName;
 	
 	/**
      * 患者信息类型,101-身份证、102-病历号、103-手机号、104-市民卡卡号

+ 4 - 2
prec-service/src/main/java/com/diagbot/web/PatientInfoController.java

@@ -5,6 +5,8 @@ import java.util.List;
 
 import javax.validation.Valid;
 
+import com.diagbot.dto.GetTopPatientInfoDjDTO;
+import com.diagbot.vo.GetTopPatientInfoDjVO;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
@@ -46,8 +48,8 @@ public class PatientInfoController {
                     "patientCode:医院患者编号,必填<br>")
     @PostMapping("/getTopPatientInfo")
     @SysLogger("getTopPatientInfo")
-    public RespDTO<GetTopPatientInfoDTO> getTopPatientInfo(@Valid @RequestBody GetTopPatientInfoVO getTopPatientInfoVO) {
-        return RespDTO.onSuc(patientInfoFacade.getTopPatientInfo(getTopPatientInfoVO));
+    public RespDTO<GetTopPatientInfoDjDTO> getTopPatientInfo(@Valid @RequestBody GetTopPatientInfoDjVO getTopPatientInfoDjVO) {
+        return RespDTO.onSuc(patientInfoFacade.getTopPatientInfo(getTopPatientInfoDjVO));
     }
     
     @ApiOperation(value = "患者登录[by:rengb]")

+ 145 - 0
tran-service/src/main/java/com/diagbot/dto/GetTopPatientInfoDjDTO.java

@@ -0,0 +1,145 @@
+package com.diagbot.dto;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.Date;
+
+/**
+ * @author rgb
+ * @Description
+ * @time 2018年11月19日下午4:57:43
+ */
+@Getter
+@Setter
+public class GetTopPatientInfoDjDTO {
+
+    /**
+     * 医院id
+     */
+    private Long hospitalId;
+
+    /**
+     * 医院编码
+     */
+    private String hospitalCode;
+
+    /**
+     * 医院名称
+     */
+    private String hospitalName;
+
+    /**
+     * 子医院id
+     */
+    private Long sonHospitalId;
+
+    /**
+     * 子医院编码
+     */
+    private String sonHospitalCode;
+
+    /**
+     * 子医院名称
+     */
+    private String sonHospitalName;
+
+    /**
+     * 医院科室id
+     */
+    private Long hospitalDeptId;
+
+    /**
+     * 自己科室id
+     */
+    private Long selfDeptId;
+
+    /**
+     * 自己科室名称
+     */
+    private String selfDeptName;
+
+    /**
+     * 医院科室编码
+     */
+    private String hospitalDeptCode;
+
+    /**
+     * 医院科室名称
+     */
+    private String hospitalDeptName;
+
+    /**
+     * 医生id
+     */
+    private Long doctorId;
+
+    /**
+     * 医生编码
+     */
+    private String doctorCode;
+
+    /**
+     * 医生姓名
+     */
+    private String doctorName;
+
+    /**
+     * 病人id
+     */
+    private Long patientId;
+
+    /**
+     * 病人编号
+     */
+    private String patientCode;
+
+    /**
+     * 病人姓名
+     */
+    private String patientName;
+
+    /**
+     * 病人性别
+     */
+    private String patientSex;
+
+    /**
+     * 病人年龄
+     */
+    private Integer patientAge;
+
+    /**
+     * 病人证件号码
+     */
+    private String patientIdNo;
+
+    /**
+     * 系统时间
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
+    private Date systemTime;
+
+    /**
+     * 出生日期
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
+    private Date birthday;
+
+    /**
+     * 门诊号
+     */
+    private String recordId;
+
+    /**
+     * 模式分类
+     */
+    private Integer modeClassify;
+
+    /**
+     * 模式值
+     */
+    private Integer modeValue;
+
+}

+ 48 - 0
tran-service/src/main/java/com/diagbot/dto/RegisterInfoDTO.java

@@ -0,0 +1,48 @@
+package com.diagbot.dto;
+
+import com.diagbot.entity.PatientInfo;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.List;
+
+/**
+ * @Description: 对接-医院返回挂号信息
+ * @author: rengb
+ * @time: 2018/11/19 18:56
+ */
+@Getter
+@Setter
+public class RegisterInfoDTO {
+
+	/**
+	 * 医院编号
+	 */
+	private String hospitalCode;
+
+	/**
+	 * 医院名称
+	 */
+	private String hospitalName;
+
+	/**
+	 * 子医院编号
+	 */
+	private String sonHospitalCode;
+
+	/**
+	 * 子医院名称
+	 */
+	private String sonHospitalName;
+
+	/**
+	 * 病人信息
+	 */
+	private PatientInfo patientInfo;
+
+	/**
+	 * 详情
+	 */
+	private List<RegisterInfoDetailDTO> detail;
+		
+}

+ 46 - 0
tran-service/src/main/java/com/diagbot/dto/RegisterInfoDetailDTO.java

@@ -0,0 +1,46 @@
+package com.diagbot.dto;
+
+import com.diagbot.entity.DoctorInfo;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description: 对接-医院返回挂号信息-详情
+ * @author: rengb
+ * @time: 2019/11/20 9:57
+ */
+@Getter
+@Setter
+public class RegisterInfoDetailDTO {
+
+    /**
+     * 医院科室编码
+     */
+    private String hospitalDeptCode;
+
+    /**
+     * 医院科室名称
+     */
+    private String hospitalDeptName;
+
+    /**
+     * 医生信息
+     */
+    private DoctorInfo doctorInfo;
+
+    /**
+     * 挂号时间
+     */
+    private String recordTime;
+
+    /**
+     * 就诊号
+     */
+    private String recordId;
+
+    /**
+     * 挂号信息
+     */
+    private String registerNum;
+
+}

+ 55 - 45
tran-service/src/main/java/com/diagbot/dto/SignInDTO.java

@@ -1,6 +1,5 @@
 package com.diagbot.dto;
 
-import io.swagger.annotations.ApiModel;
 import lombok.Getter;
 import lombok.Setter;
 
@@ -9,12 +8,11 @@ import lombok.Setter;
  * @author: rengb
  * @time: 2018/11/19 18:56
  */
-@ApiModel(value="患者登录接口出参")
 @Getter
 @Setter
-public class SignInDTO{
-	
-	/**
+public class SignInDTO {
+
+    /**
      * 医院编码
      */
     private String hospitalCode;
@@ -23,8 +21,18 @@ public class SignInDTO{
      * 医院名称
      */
     private String hospitalName;
-	
-	/**
+
+    /**
+     * 子医院编号
+     */
+    private String sonHospitalCode;
+
+    /**
+     * 子医院名称
+     */
+    private String sonHospitalName;
+
+    /**
      * 医院科室编码
      */
     private String hospitalDeptCode;
@@ -33,8 +41,8 @@ public class SignInDTO{
      * 医院科室名称
      */
     private String hospitalDeptName;
-	
-	/**
+
+    /**
      * 医生编码
      */
     private String doctorCode;
@@ -43,50 +51,52 @@ public class SignInDTO{
      * 医生姓名
      */
     private String doctorName;
-	
-	/**
+
+    /**
      * 病人编号
      */
     private String patientCode;
-	
-	/**
+
+    /**
      * 病人姓名
      */
     private String patientName;
-	
-	/**
-	 * 挂号时间
-	 */
-	private String recordTime;
-	
-	/**
+
+    /**
+     * 挂号时间
+     */
+    private String recordTime;
+
+    /**
      * 就诊号
      */
-	private String recordId;
-	
-	/**
+    private String recordId;
+
+    /**
      * 挂号信息
      */
-	private String registerNum;
-
-	public SignInDTO(String hospitalCode, String hospitalName, String hospitalDeptCode, String hospitalDeptName,
-			String doctorCode, String doctorName, String patientCode, String patientName, String recordTime,
-			String recordId, String registerNum) {
-		this.hospitalCode = hospitalCode;
-		this.hospitalName = hospitalName;
-		this.hospitalDeptCode = hospitalDeptCode;
-		this.hospitalDeptName = hospitalDeptName;
-		this.doctorCode = doctorCode;
-		this.doctorName = doctorName;
-		this.patientCode = patientCode;
-		this.patientName = patientName;
-		this.recordTime = recordTime;
-		this.recordId = recordId;
-		this.registerNum = registerNum;
-	}
-	
-	
-	
-
-		
+    private String registerNum;
+
+    public SignInDTO() {
+
+    }
+
+    public SignInDTO(String hospitalCode, String hospitalName, String sonHospitalCode, String sonHospitalName,
+                     String hospitalDeptCode, String hospitalDeptName, String doctorCode, String doctorName,
+                     String patientCode, String patientName, String recordTime, String recordId, String registerNum) {
+        this.hospitalCode = hospitalCode;
+        this.hospitalName = hospitalName;
+        this.sonHospitalCode = sonHospitalCode;
+        this.sonHospitalName = sonHospitalName;
+        this.hospitalDeptCode = hospitalDeptCode;
+        this.hospitalDeptName = hospitalDeptName;
+        this.doctorCode = doctorCode;
+        this.doctorName = doctorName;
+        this.patientCode = patientCode;
+        this.patientName = patientName;
+        this.recordTime = recordTime;
+        this.recordId = recordId;
+        this.registerNum = registerNum;
+    }
+
 }

+ 318 - 0
tran-service/src/main/java/com/diagbot/facade/PatientInfoDjFacade.java

@@ -0,0 +1,318 @@
+package com.diagbot.facade;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.diagbot.dto.GetTopPatientInfoDjDTO;
+import com.diagbot.dto.RegisterInfoDTO;
+import com.diagbot.dto.SignInDTO;
+import com.diagbot.entity.DoctorInfo;
+import com.diagbot.entity.HospitalDept;
+import com.diagbot.entity.HospitalInfo;
+import com.diagbot.entity.PatientInfo;
+import com.diagbot.entity.SysSet;
+import com.diagbot.enums.VisibleIdTypeEnum;
+import com.diagbot.exception.CommonErrorCode;
+import com.diagbot.exception.CommonException;
+import com.diagbot.idc.VisibleIdCreater;
+import com.diagbot.service.DoctorInfoService;
+import com.diagbot.service.HospitalDeptService;
+import com.diagbot.service.impl.PatientInfoServiceImpl;
+import com.diagbot.util.BeanUtil;
+import com.diagbot.util.DateUtil;
+import com.diagbot.util.IdCard;
+import com.diagbot.util.ListUtil;
+import com.diagbot.util.StringUtil;
+import com.diagbot.vo.GetTopPatientInfoDjVO;
+import com.diagbot.vo.SignInVO;
+import com.google.common.collect.Lists;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+/**
+ * @Description: 对接-患者业务逻辑
+ * @author: wangyu
+ * @time: 2018/11/19 13:19
+ */
+@Component
+public class PatientInfoDjFacade extends PatientInfoServiceImpl {
+    @Autowired
+    private HospitalInfoFacade hospitalInfoFacade;
+    @Autowired
+    private HospitalDeptFacade hospitalDeptFacade;
+    @Autowired
+    @Qualifier("hospitalDeptServiceImpl")
+    private HospitalDeptService hospitalDeptService;
+    @Autowired
+    private DoctorInfoFacade doctorInfoFacade;
+    @Autowired
+    @Qualifier("doctorInfoServiceImpl")
+    private DoctorInfoService doctorInfoService;
+    @Autowired
+    private SysSetFacade sysSetFacade;
+
+    /**
+     * 对接-页面顶部病人医生科室信息——查询
+     *
+     * @param getTopPatientInfoDjVO
+     * @return
+     */
+    public GetTopPatientInfoDjDTO getTopPatientInfoDj(GetTopPatientInfoDjVO getTopPatientInfoDjVO) {
+        GetTopPatientInfoDjDTO getTopPatientInfoDjDTO = this.baseMapper.getTopPatientInfoDj(getTopPatientInfoDjVO);
+        getTopPatientInfoDjDTO.setSystemTime(DateUtil.now());
+        getTopPatientInfoDjDTO.setRecordId(getTopPatientInfoDjVO.getRecordId());
+        getTopPatientInfoDjDTO.setPatientAge(DateUtil.yearCompare(getTopPatientInfoDjDTO.getBirthday(), DateUtil.now()));
+        if (StringUtil.isNotBlank(getTopPatientInfoDjVO.getHospitalDeptCode())) {
+            String hospitalCode = getTopPatientInfoDjVO.getHospitalCode();
+            QueryWrapper<SysSet> sysSetQe = new QueryWrapper<>();
+            sysSetQe.eq("hospital_code", hospitalCode);
+            sysSetQe.eq("sys_type", 17);
+            sysSetQe.eq("code", "junior_hospital");
+            SysSet sysSet = sysSetFacade.getOne(sysSetQe, true);
+            if (sysSet != null && StringUtil.isNotBlank(sysSet.getValue())) {
+                if (StringUtil.isBlank(getTopPatientInfoDjVO.getSonHospitalCode())) {
+                    throw new CommonException(CommonErrorCode.RPC_ERROR, "子医院编码必传");
+                }
+                hospitalCode = getTopPatientInfoDjVO.getSonHospitalCode();
+                QueryWrapper<HospitalInfo> hospitalInfoQe = new QueryWrapper<>();
+                hospitalInfoQe.eq("code", hospitalCode);
+                HospitalInfo hospitalInfo = hospitalInfoFacade.getOne(hospitalInfoQe, true);
+                if (hospitalInfo != null) {
+                    getTopPatientInfoDjDTO.setSonHospitalId(hospitalInfo.getId());
+                    getTopPatientInfoDjDTO.setSonHospitalCode(hospitalInfo.getCode());
+                    getTopPatientInfoDjDTO.setSonHospitalName(hospitalInfo.getName());
+                }
+            }
+            QueryWrapper<HospitalDept> hospitalDeptQe = new QueryWrapper<>();
+            hospitalDeptQe.eq("hospital_code", hospitalCode);
+            hospitalDeptQe.eq("code", getTopPatientInfoDjVO.getHospitalDeptCode());
+            HospitalDept hospitalDept = hospitalDeptFacade.getOne(hospitalDeptQe, true);
+            if (hospitalDept != null) {
+                getTopPatientInfoDjDTO.setHospitalDeptId(hospitalDept.getId());
+                getTopPatientInfoDjDTO.setHospitalDeptCode(hospitalDept.getCode());
+                getTopPatientInfoDjDTO.setHospitalDeptName(hospitalDept.getName());
+                getTopPatientInfoDjDTO.setSelfDeptName(hospitalDept.getConceptDeptName());
+            }
+        }
+
+        return getTopPatientInfoDjDTO;
+    }
+
+    /**
+     * 患者登录
+     *
+     * @param signInVO
+     * @return
+     */
+    public List<SignInDTO> signIn(SignInVO signInVO) {
+        List<SignInDTO> retList = null;
+
+        QueryWrapper<SysSet> sysSetQe = new QueryWrapper<>();
+        sysSetQe.eq("hospital_code", signInVO.getHospitalCode());
+        sysSetQe.eq("sys_type", 17);
+        sysSetQe.and(i -> i.eq("code", "patientinfo").or().eq("code", "junior_hospital"));
+        Map<String, String> sysSetCodeValue = sysSetFacade.list(sysSetQe).stream()
+                .collect(Collectors.toMap(SysSet::getCode, i -> i.getValue()));
+
+        RegisterInfoDTO rif = getRegisterInfo(signInVO);
+        if (rif != null) {
+            generateByRif(rif, StringUtil.isNotBlank(sysSetCodeValue.get("junior_hospital")));
+            retList = rifConverSin(rif);
+        } else if (signInVO.getPatientInfoType().equals("101")
+                && StringUtil.isNotBlank(sysSetCodeValue.get("patientinfo"))
+                && sysSetCodeValue.get("patientinfo").equals("1")) {
+            retList = autoGenePatinfo(signInVO);
+        }
+
+        return retList;
+    }
+
+    /**
+     * 自动生成患者信息
+     *
+     * @param signInVO
+     * @return
+     */
+    private List<SignInDTO> autoGenePatinfo(SignInVO signInVO) {
+        List<SignInDTO> retList = Lists.newArrayList();
+        SignInDTO signInDTO = new SignInDTO();
+        signInDTO.setHospitalCode(signInVO.getHospitalCode());
+        signInDTO.setHospitalName(signInVO.getHospitalName());
+        signInDTO.setSonHospitalCode(signInVO.getSonHospitalCode());
+        signInDTO.setSonHospitalName(signInVO.getSonHospitalName());
+
+        QueryWrapper<PatientInfo> patientInfoQe = new QueryWrapper<>();
+        patientInfoQe.eq("id_no", signInVO.getPatientInfo());
+        patientInfoQe.eq("name", signInVO.getPatientName());
+        PatientInfo patientInfo = getOne(patientInfoQe, true);
+        if (patientInfo == null) {
+            patientInfo = new PatientInfo();
+            patientInfo.setSex(IdCard.getGenderByIdCard(signInVO.getPatientInfo()));
+            patientInfo.setBirthday(DateUtil.parseDate(IdCard.getBirthByIdCard(signInVO.getPatientInfo()), "yyyyMMdd"));
+
+            VisibleIdCreater visibleIdCreater = new VisibleIdCreater(0, 0);
+            patientInfo.setCode("" + visibleIdCreater.getNextId(VisibleIdTypeEnum.PATIENT_NO.getKey()));
+            patientInfo.setRemark("1");//自动生成标志
+
+            save(patientInfo);
+        }
+        signInDTO.setPatientCode(patientInfo.getCode());
+        signInDTO.setPatientName(patientInfo.getName());
+
+        retList.add(signInDTO);
+        return retList;
+    }
+
+    /**
+     * his返回的挂号信息转化给前端
+     *
+     * @param rif
+     * @return
+     */
+    private List<SignInDTO> rifConverSin(RegisterInfoDTO rif) {
+        List<SignInDTO> retList = Lists.newArrayList();
+        rif.getDetail().forEach(i -> {
+            SignInDTO signInDTO = new SignInDTO(
+                    rif.getHospitalCode(),
+                    rif.getHospitalName(),
+                    rif.getSonHospitalCode(),
+                    rif.getSonHospitalName(),
+                    i.getHospitalDeptCode(),
+                    i.getHospitalDeptName(),
+                    i.getDoctorInfo().getCode(),
+                    i.getDoctorInfo().getName(),
+                    rif.getPatientInfo().getCode(),
+                    rif.getPatientInfo().getName(),
+                    i.getRecordTime(),
+                    i.getRecordId(),
+                    i.getRegisterNum()
+            );
+            retList.add(signInDTO);
+        });
+        return retList;
+    }
+
+    /**
+     * 由挂号信息检查病人科室医生信息,有更新,无插入
+     *
+     * @param rif
+     * @param isHason 是否有子医院
+     */
+    private void generateByRif(RegisterInfoDTO rif, boolean isHason) {
+        String hospitalCode = rif.getHospitalCode();
+        String hospitalName = rif.getHospitalName();
+        String sonHospitalCode = rif.getSonHospitalCode();
+        String sonHospitalName = rif.getSonHospitalName();
+
+        PatientInfo patientInfo = rif.getPatientInfo();
+        QueryWrapper<PatientInfo> patientInfoQe = new QueryWrapper<>();
+        patientInfoQe.eq("hospital_code", hospitalCode);
+        patientInfoQe.eq("code", patientInfo.getCode());
+        PatientInfo patientInfoQuery = getOne(patientInfoQe, true);
+        if (patientInfoQuery == null) {
+            patientInfo.setHospitalCode(hospitalCode);
+            save(patientInfo);
+        } else {
+            BeanUtil.copyProperties(patientInfo, patientInfoQuery);
+            updateById(patientInfoQuery);
+        }
+
+        List<String> deptCodeList = rif.getDetail().stream()
+                .filter(i -> StringUtil.isNotBlank(i.getHospitalDeptCode()) && StringUtil.isNotBlank(i.getHospitalDeptName()))
+                .map(i -> i.getHospitalDeptCode())
+                .collect(Collectors.toList());
+        QueryWrapper<HospitalDept> hospitalDeptQe = new QueryWrapper<>();
+        hospitalDeptQe.eq("hospital_code", isHason ? sonHospitalCode : hospitalCode);
+        hospitalDeptQe.in("code", deptCodeList);
+        Map<String, HospitalDept> deptMap = hospitalDeptFacade.list(hospitalDeptQe)
+                .stream()
+                .collect(Collectors.toMap(HospitalDept::getCode, i -> i));
+        List<HospitalDept> deptSaveOrUpdateList = Lists.newArrayList();
+        rif.getDetail().stream()
+                .filter(i -> StringUtil.isNotBlank(i.getHospitalDeptCode()) && StringUtil.isNotBlank(i.getHospitalDeptName()))
+                .forEach(i -> {
+                    HospitalDept hospitalDeptQuery = deptMap.get(i.getHospitalDeptCode());
+                    if (hospitalDeptQuery == null) {
+                        HospitalDept hospitalDept = new HospitalDept();
+                        hospitalDept.setHospitalCode(isHason ? sonHospitalCode : hospitalCode);
+                        hospitalDept.setHospitalName(isHason ? sonHospitalName : hospitalName);
+                        hospitalDept.setCode(i.getHospitalDeptCode());
+                        hospitalDept.setName(i.getHospitalDeptName());
+                        hospitalDept.setconceptDeptName("全科");
+                        deptSaveOrUpdateList.add(hospitalDept);
+                    } else {
+                        hospitalDeptQuery.setName(i.getHospitalDeptName());
+                        deptSaveOrUpdateList.add(hospitalDeptQuery);
+                    }
+                });
+        if (ListUtil.isNotEmpty(deptSaveOrUpdateList)) {
+            hospitalDeptService.saveBatch(deptSaveOrUpdateList);
+        }
+
+        List<String> doctorCodeList = rif.getDetail().stream()
+                .filter(i -> i.getDoctorInfo() != null).map(i -> i.getDoctorInfo())
+                .filter(i -> StringUtil.isNotBlank(i.getCode()) && StringUtil.isNotBlank(i.getName()))
+                .map(i -> i.getCode()).collect(Collectors.toList());
+        QueryWrapper<DoctorInfo> doctorInfoQe = new QueryWrapper<>();
+        doctorInfoQe.eq("hospital_code", hospitalCode);
+        doctorInfoQe.in("code", doctorCodeList);
+        Map<String, DoctorInfo> doctorMap = doctorInfoFacade.list(doctorInfoQe)
+                .stream().collect(Collectors.toMap(DoctorInfo::getCode, i -> i));
+        List<DoctorInfo> doctorSaveOrUpdateList = Lists.newArrayList();
+        rif.getDetail().stream()
+                .filter(i -> i.getDoctorInfo() != null).map(i -> i.getDoctorInfo())
+                .filter(i -> StringUtil.isNotBlank(i.getCode()) && StringUtil.isNotBlank(i.getName()))
+                .forEach(i -> {
+                    DoctorInfo doctorInfo = new DoctorInfo();
+                    DoctorInfo doctorInfoQuery = doctorMap.get(i.getCode());
+                    if (doctorInfoQuery == null) {
+                        BeanUtil.copyProperties(i, doctorInfo);
+                        doctorInfo.setHospitalCode(hospitalCode);
+                    } else {
+                        BeanUtil.copyProperties(doctorInfoQuery, doctorInfo);
+                        BeanUtil.copyProperties(i, doctorInfo);
+                    }
+                    doctorSaveOrUpdateList.add(doctorInfo);
+                });
+        if (ListUtil.isNotEmpty(doctorSaveOrUpdateList)) {
+            doctorInfoService.saveOrUpdateBatch(doctorSaveOrUpdateList);
+        }
+    }
+
+    /**
+     * 对接---获取挂号信息
+     * 某一时刻患者只可能在一家医院,所以获取到的挂号信息只能是当前医院的,当出现江干的大小医院情况时可采用2种:
+     * 1、预问诊必须选择小医院,对方接口小医院要求必传;2、his返回时间最近的一家医院挂号信息(可能不准确)。
+     * 大小医院信息使用his返回来的(未选择小医院时有用)
+     *
+     * @param signInVO
+     * @return
+     */
+    private RegisterInfoDTO getRegisterInfo(SignInVO signInVO) {
+        //        String time = DateUtil.formatDateTime(new Date());
+        //        List<SignInDTO> list = Lists.newArrayList();
+        //        list.add(new SignInDTO("A001", "浙江大学医学院附属邵逸夫医院",
+        //                "D01", "全科", "YS001", "付医生",
+        //                "1600", "王明明", time, "4468352", "15"));
+        //        list.add(new SignInDTO("A001", "浙江大学医学院附属邵逸夫医院",
+        //                "D02", "儿科", "YS001", "付医生",
+        //                "1600", "王明明", time, "4468352", "18"));
+        //        if (signInVO.getPatientInfoType().equals("101")) {
+        //            if (signInVO.getPatientInfo().equals("10123439991230120X")) {
+        //                list.remove(1);
+        //            } else if (signInVO.getPatientInfo().equals("666666180002301234")) {
+        //                list.clear();
+        //            } else if (signInVO.getPatientInfo().equals("100000201901010000")) {
+        //                return null;
+        //            }
+        //        }
+
+        RegisterInfoDTO registerInfoDTO = new RegisterInfoDTO();
+
+        return null;
+    }
+
+}

+ 1 - 39
tran-service/src/main/java/com/diagbot/facade/PatientInfoFacade.java

@@ -2,18 +2,14 @@ package com.diagbot.facade;
 
 import com.diagbot.dto.GetTopPatientInfoDTO;
 import com.diagbot.dto.PatientInfoDTO;
-import com.diagbot.dto.SignInDTO;
 import com.diagbot.entity.PatientInfo;
 import com.diagbot.service.impl.PatientInfoServiceImpl;
 import com.diagbot.util.DateUtil;
 import com.diagbot.vo.GetTopPatientInfoVO;
 import com.diagbot.vo.PatientInfoVO;
-import com.diagbot.vo.SignInVO;
-import com.google.common.collect.Lists;
 import org.springframework.stereotype.Component;
 import org.springframework.web.bind.annotation.RequestBody;
 
-import java.util.Date;
 import java.util.List;
 import java.util.Map;
 import java.util.stream.Collectors;
@@ -26,11 +22,6 @@ import java.util.stream.Collectors;
 @Component
 public class PatientInfoFacade extends PatientInfoServiceImpl {
 
-    /*@Autowired
-    private DoctorPageModeFacade doctorPageModeFacade;*/
-    /*@Autowired
-    private DeptInfoFacade deptInfoFacade;*/
-
     /**
      * 获取患者信息
      *
@@ -69,33 +60,4 @@ public class PatientInfoFacade extends PatientInfoServiceImpl {
         return patientInfoMap;
     }
 
-    /**
-     * 患者登录
-     *
-     * @param signInVO
-     * @return
-     */
-    public List<SignInDTO> signIn(SignInVO signInVO) {
-        String time = DateUtil.formatDateTime(new Date());
-        List<SignInDTO> list = Lists.newArrayList();
-        list.add(new SignInDTO("A001", "浙江大学医学院附属邵逸夫医院",
-                "D01", "全科", "YS001", "付医生",
-                "1600", "王明明", time, "4468352", "15"));
-        list.add(new SignInDTO("A001", "浙江大学医学院附属邵逸夫医院",
-                "D02", "儿科", "YS001", "付医生",
-                "1600", "王明明", time, "4468352", "18"));
-        if (signInVO.getPatientInfoType().equals("101")) {
-            if (signInVO.getPatientInfo().equals("10123439991230120X")) {
-                list.remove(1);
-            } else if (signInVO.getPatientInfo().equals("666666180002301234")) {
-                list.clear();
-            } else if (signInVO.getPatientInfo().equals("100000201901010000")) {
-                return null;
-            }
-        }
-
-        return list;
-    }
-
-
-}
+}

+ 10 - 0
tran-service/src/main/java/com/diagbot/mapper/PatientInfoMapper.java

@@ -2,8 +2,10 @@ package com.diagbot.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.diagbot.dto.GetTopPatientInfoDTO;
+import com.diagbot.dto.GetTopPatientInfoDjDTO;
 import com.diagbot.dto.PatientInfoDTO;
 import com.diagbot.entity.PatientInfo;
+import com.diagbot.vo.GetTopPatientInfoDjVO;
 import com.diagbot.vo.GetTopPatientInfoVO;
 import org.apache.ibatis.annotations.Param;
 import org.springframework.web.bind.annotation.RequestBody;
@@ -27,4 +29,12 @@ public interface PatientInfoMapper extends BaseMapper<PatientInfo> {
      * @return
      */
     GetTopPatientInfoDTO getTopPatientInfo(@RequestBody GetTopPatientInfoVO getTopPatientInfoVO);
+
+    /**
+     * 对接-顶部病人医生科室信息查询
+     * @param getTopPatientInfoDjVO
+     * @return
+     */
+    GetTopPatientInfoDjDTO getTopPatientInfoDj(@RequestBody GetTopPatientInfoDjVO getTopPatientInfoDjVO);
+
 }

+ 46 - 0
tran-service/src/main/java/com/diagbot/vo/GetTopPatientInfoDjVO.java

@@ -0,0 +1,46 @@
+package com.diagbot.vo;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @author rgb
+ * @Description
+ * @time 2018年11月19日下午4:58:37
+ */
+@Getter
+@Setter
+public class GetTopPatientInfoDjVO {
+
+    /**
+     * 医院编号
+     */
+    private String hospitalCode;
+
+    /**
+     * 子医院编号
+     */
+    private String sonHospitalCode;
+
+    /**
+     * 医院科室编号
+     */
+    private String hospitalDeptCode;
+
+    /**
+     * 医院医生编号
+     */
+    private String doctorCode;
+
+    /**
+     * 医院患者编号
+     */
+    private String patientCode;
+
+    /**
+     * 门诊号
+     */
+    private String recordId;
+
+
+}

+ 15 - 2
tran-service/src/main/java/com/diagbot/vo/SignInVO.java

@@ -1,6 +1,5 @@
 package com.diagbot.vo;
 
-import io.swagger.annotations.ApiModel;
 import lombok.Getter;
 import lombok.Setter;
 
@@ -9,7 +8,6 @@ import lombok.Setter;
  * @author: rengb
  * @time: 2018/11/19 18:58
  */
-@ApiModel(value="患者登录接口传参")
 @Getter
 @Setter
 public class SignInVO {
@@ -18,6 +16,21 @@ public class SignInVO {
 	 * 医院编号
 	 */
 	private String hospitalCode;
+
+	/**
+	 * 医院名称
+	 */
+	private String hospitalName;
+
+	/**
+	 * 子医院编号
+	 */
+	private String sonHospitalCode;
+
+	/**
+	 * 子医院名称
+	 */
+	private String sonHospitalName;
 	
 	/**
      * 患者信息类型,101-身份证、102-病历号、103-手机号、104-市民卡卡号

+ 22 - 5
tran-service/src/main/java/com/diagbot/web/PatientInfoController.java

@@ -1,13 +1,15 @@
 package com.diagbot.web;
 
-
 import com.diagbot.annotation.SysLogger;
 import com.diagbot.dto.GetTopPatientInfoDTO;
+import com.diagbot.dto.GetTopPatientInfoDjDTO;
 import com.diagbot.dto.PatientInfoDTO;
 import com.diagbot.dto.RespDTO;
 import com.diagbot.dto.SignInDTO;
 import com.diagbot.entity.PatientInfo;
+import com.diagbot.facade.PatientInfoDjFacade;
 import com.diagbot.facade.PatientInfoFacade;
+import com.diagbot.vo.GetTopPatientInfoDjVO;
 import com.diagbot.vo.GetTopPatientInfoVO;
 import com.diagbot.vo.PatientInfoVO;
 import com.diagbot.vo.SignInVO;
@@ -39,6 +41,8 @@ import java.util.Map;
 public class PatientInfoController {
     @Autowired
     private PatientInfoFacade patientInfoFacade;
+    @Autowired
+    private PatientInfoDjFacade patientInfoDjFacade;
 
     @ApiOperation(value = "患者信息——查询[by:wangyu]",
             notes = "patientCode:患者编号,必填<br>" +
@@ -51,7 +55,6 @@ public class PatientInfoController {
         return RespDTO.onSuc(data);
     }
 
-
     @ApiOperation(value = "页面顶部病人医生科室信息——查询[by:rengb]",
             notes = "hospitalCode:医院编号,必填<br>" +
                     "hospitalDeptCode:医院科室编号,必填<br>" +
@@ -73,11 +76,25 @@ public class PatientInfoController {
         return RespDTO.onSuc(result);
     }
 
-    @ApiOperation(value = "患者登录[by:rengb]")
+    /**
+     * 患者登录[by:rengb]
+     */
     @PostMapping("/signIn")
     @SysLogger("signIn")
     public RespDTO<List<SignInDTO>> signIn(@RequestBody SignInVO signInVO) {
-        return RespDTO.onSuc(patientInfoFacade.signIn(signInVO));
+        return RespDTO.onSuc(patientInfoDjFacade.signIn(signInVO));
+    }
+
+    /**
+     * 对接-页面顶部病人医生科室信息——查询[by:rengb]
+     *
+     * @param getTopPatientInfoDjVO
+     * @return
+     */
+    @PostMapping("/getTopPatientInfoDj")
+    @SysLogger("getTopPatientInfoDj")
+    public RespDTO<GetTopPatientInfoDjDTO> getTopPatientInfoDj(@RequestBody GetTopPatientInfoDjVO getTopPatientInfoDjVO) {
+        return RespDTO.onSuc(patientInfoDjFacade.getTopPatientInfoDj(getTopPatientInfoDjVO));
     }
 
-}
+}

+ 27 - 1
tran-service/src/main/resources/mapper/PatientInfoMapper.xml

@@ -59,7 +59,7 @@
 		FROM tran_hospital_info a LEFT JOIN tran_hospital_dept b 
 		ON a.`code`=b.hospital_code and b.`status`=1 and b.is_deleted='N' and b.`code`=#{hospitalDeptCode} 	
 		LEFT JOIN tran_doctor_info c 
-		ON b.hospital_code=c.hospital_code 
+		ON a.code=c.hospital_code
 		<!-- and b.`code`=c.hospital_dept_code  -->
 		and c.is_deleted='N' and c.`code`=#{doctorCode}
 		LEFT JOIN tran_patient_info d 
@@ -68,4 +68,30 @@
 		AND a.`status`=1
 		AND a.`code`=#{hospitalCode} 
     </select>
+
+    <select id="getTopPatientInfoDj" parameterType="com.diagbot.vo.GetTopPatientInfoDjVO" resultType="com.diagbot.dto.GetTopPatientInfoDjDTO">
+        SELECT
+        a.id as hospitalId,
+        a.`code` as hospitalCode,
+        a.`name` as hospitalName,
+        c.id as doctorId,
+        c.`code` as doctorCode,
+        c.`name` as doctorName,
+        d.id as patientId,
+        d.`code` as patientCode,
+        d.`name` as patientName,
+        case when d.sex=1 then '男' when d.sex=2 then '女' else '未知' end as patientSex,
+        d.id_no as patientIdNo,
+        d.birthday as birthday
+        FROM tran_hospital_info a
+        LEFT JOIN tran_doctor_info c
+        ON a.code=c.hospital_code
+        and c.is_deleted='N' and c.`code`=#{doctorCode}
+        LEFT JOIN tran_patient_info d
+        ON a.code=d.hospital_code and d.is_deleted='N' and d.`code`=#{patientCode}
+        WHERE a.is_deleted='N'
+        AND a.`status`=1
+        AND a.`code`=#{hospitalCode}
+    </select>
+
 </mapper>