Browse Source

对接接口修改(获取患者信息)

wangyu 6 years ago
parent
commit
30baabb957

+ 15 - 6
icss-service/src/main/java/com/diagbot/client/TranServiceClient.java

@@ -1,21 +1,22 @@
 package com.diagbot.client;
 
-import java.util.List;
-
-import org.springframework.cloud.openfeign.FeignClient;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-
 import com.diagbot.client.hystrix.TranServiceHystrix;
 import com.diagbot.dto.DoctorInfoDTO;
 import com.diagbot.dto.HospitalDeptInfoDTO;
 import com.diagbot.dto.HospitalInfoDTO;
 import com.diagbot.dto.LisConfigDTO;
+import com.diagbot.dto.PatientInfoDTO;
 import com.diagbot.dto.RespDTO;
 import com.diagbot.vo.DoctorInfoVO;
 import com.diagbot.vo.HospitalDeptInfoVO;
 import com.diagbot.vo.HospitalInfoVO;
 import com.diagbot.vo.LisHospitalCodeVO;
+import com.diagbot.vo.PatientInfoVO;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+
+import java.util.List;
 
 /**
  * @Description: 调用信息对接层服务
@@ -57,4 +58,12 @@ public interface TranServiceClient {
      */
     @PostMapping("/tranLisConfig/getLisConfigByhospitalId")
     RespDTO<List<LisConfigDTO>> getLisConfigByhospitalId(@RequestBody LisHospitalCodeVO lisHospitalCodeVO);
+
+    /**
+     * 获取患者信息
+     * @param patientInfoVO
+     * @return
+     */
+    @PostMapping("/patientInfo/getPatientInfo")
+    RespDTO<PatientInfoDTO> getPatientInfo( @RequestBody PatientInfoVO patientInfoVO);
 }

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

@@ -5,12 +5,14 @@ import com.diagbot.dto.DoctorInfoDTO;
 import com.diagbot.dto.HospitalDeptInfoDTO;
 import com.diagbot.dto.HospitalInfoDTO;
 import com.diagbot.dto.LisConfigDTO;
+import com.diagbot.dto.PatientInfoDTO;
 import com.diagbot.dto.RespDTO;
 import com.diagbot.vo.DoctorInfoVO;
 import com.diagbot.vo.HospitalDeptInfoVO;
 import com.diagbot.vo.HospitalInfoVO;
 import com.diagbot.vo.LisHospitalCodeVO;
 
+import com.diagbot.vo.PatientInfoVO;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Component;
 
@@ -47,6 +49,12 @@ public class TranServiceHystrix implements TranServiceClient {
 		log.error("【hystrix】调用{}异常", "getLisConfigByhospitalId");
 		return null;
 	}
+
+    @Override
+    public RespDTO<PatientInfoDTO> getPatientInfo(PatientInfoVO patientInfoVO) {
+        log.error("【hystrix】调用{}异常", "getPatientInfo");
+        return null;
+    }
 //    @Override
 //    public Response<ResponseData> bayesPageData(SearchData searchData) {
 //        log.error("【hystrix】调用{}异常", "bayesPageData");

+ 13 - 3
icss-service/src/main/java/com/diagbot/facade/PatientInfoFacade.java

@@ -1,12 +1,16 @@
 package com.diagbot.facade;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.diagbot.client.TranServiceClient;
 import com.diagbot.dto.GetTopPatientInfoDTO;
 import com.diagbot.dto.PatientInfoDTO;
+import com.diagbot.dto.RespDTO;
 import com.diagbot.entity.DeptInfo;
 import com.diagbot.entity.DoctorPageMode;
 import com.diagbot.entity.PatientInfo;
 import com.diagbot.enums.IsDeleteEnum;
+import com.diagbot.exception.CommonErrorCode;
+import com.diagbot.exception.CommonException;
 import com.diagbot.service.impl.PatientInfoServiceImpl;
 import com.diagbot.util.DateUtil;
 import com.diagbot.vo.GetTopPatientInfoVO;
@@ -27,6 +31,8 @@ public class PatientInfoFacade extends PatientInfoServiceImpl {
     private DoctorPageModeFacade doctorPageModeFacade;
     @Autowired
     private DeptInfoFacade deptInfoFacade;
+    @Autowired
+    TranServiceClient tranServiceClient;
 
     /**
      * 获取患者信息
@@ -34,9 +40,13 @@ public class PatientInfoFacade extends PatientInfoServiceImpl {
      * @param patientInfoVO
      * @return
      */
-    public PatientInfoDTO getPatientInfo(@RequestBody PatientInfoVO patientInfoVO) {
-        PatientInfoDTO patientInfoDTO = this.getPatientInfos(patientInfoVO.getPatientCode(), patientInfoVO.getHospitalCode());
-        return patientInfoDTO;
+    public PatientInfoDTO getPatientInfo(PatientInfoVO patientInfoVO) {
+        RespDTO<PatientInfoDTO> patientInfoDTO = tranServiceClient.getPatientInfo(patientInfoVO);
+        if (patientInfoDTO == null || !"0".equals(patientInfoDTO.code)) {
+            throw new CommonException(CommonErrorCode.RPC_ERROR,
+                    "获取患者信息失败");
+        }
+        return patientInfoDTO.data;
     }
 
     /**

+ 1 - 2
icss-service/src/main/java/com/diagbot/web/PatientInfoController.java

@@ -15,7 +15,6 @@ import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
-import springfox.documentation.annotations.ApiIgnore;
 
 import javax.validation.Valid;
 
@@ -40,7 +39,7 @@ public class PatientInfoController {
                     "hospitalCode:医院编号,必填<br>")
     @PostMapping("/getPatientInfo")
     @SysLogger("getPatientInfo")
-    @ApiIgnore
+    /*@ApiIgnore*/
     public RespDTO<PatientInfoDTO> getPatientInfo(@Valid @RequestBody PatientInfoVO patientInfoVO) {
         PatientInfoDTO data = patientInfoFacade.getPatientInfo(patientInfoVO);
         return RespDTO.onSuc(data);

+ 158 - 0
tran-service/src/main/java/com/diagbot/dto/GetTopPatientInfoDTO.java

@@ -0,0 +1,158 @@
+/**
+ * 
+ */
+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;
+
+/**
+ * @Description
+ * @author rgb
+ * @time 2018年11月19日下午4:57:43
+ */
+@ApiModel(value="页面顶部病人医生科室信息查询接口出参")
+@Getter
+@Setter
+public class GetTopPatientInfoDTO {
+	
+	/**
+	 * 医院id
+	 */
+	@ApiModelProperty(value="医院id")
+	private Long hospitalId;
+	
+	/**
+     * 医院编码
+     */
+	@ApiModelProperty(value="医院编码")
+    private String hospitalCode;
+
+    /**
+     * 医院名称
+     */
+	@ApiModelProperty(value="医院名称")
+    private String hospitalName;
+    
+    /**
+	 * 医院科室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;
+	
+}

+ 114 - 0
tran-service/src/main/java/com/diagbot/dto/PatientInfoDTO.java

@@ -0,0 +1,114 @@
+package com.diagbot.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.Date;
+
+/**
+ * @Description:
+ * @author: wangyu
+ * @time: 2018/11/19 13:05
+ */
+@Getter
+@Setter
+public class PatientInfoDTO {
+    /**
+     * 主键
+     */
+    private Long id;
+    /**
+     * 医院编码
+     */
+    private String hospitalCode;
+
+    /**
+     * 医院患者编号
+     */
+    private String code;
+
+    /**
+     * 患者姓名
+     */
+    private String name;
+
+    /**
+     * 性别
+     */
+    private Integer sex;
+
+    /**
+     * 出生日期
+     */
+    private Date birthday;
+
+    /**
+     * 证件类型
+     */
+    private String idType;
+
+    /**
+     * 证件号码
+     */
+    private String idNo;
+
+    /**
+     * 家庭住址
+     */
+    private String address;
+
+    /**
+     * 联系电话
+     */
+    private String phone;
+
+    /**
+     * 身份证号
+     */
+    private String identityNum;
+
+    /**
+     * 家庭邮编
+     */
+    private String postcode;
+
+    /**
+     * 联系人
+     */
+    private String contacts;
+
+    /**
+     * 联系人电话
+     */
+    private String contactPhone;
+
+    /**
+     * 就职单位名称
+     */
+    private String workUnit;
+
+    /**
+     * 职业
+     */
+    private String operation;
+
+    /**
+     * 国籍
+     */
+    private String country;
+
+    /**
+     * 民族
+     */
+    private String nationality;
+
+    /**
+     * 婚姻状况:0未婚,1已婚,2未知
+     */
+    private Integer matrimony;
+
+    /**
+     * 备注
+     */
+    private String remark;
+}

+ 357 - 0
tran-service/src/main/java/com/diagbot/entity/PatientInfo.java

@@ -0,0 +1,357 @@
+package com.diagbot.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * <p>
+ * 患者信息表
+ * </p>
+ *
+ * @author wangyu
+ * @since 2018-11-20
+ */
+@TableName("tran_patient_info")
+public class PatientInfo implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Long id;
+
+    /**
+     * 是否删除,N:未删除,Y:删除
+     */
+    private String isDeleted;
+
+    /**
+     * 记录创建时间
+     */
+    private Date gmtCreate;
+
+    /**
+     * 记录修改时间,如果时间是1970年则表示纪录未修改
+     */
+    private Date gmtModified;
+
+    /**
+     * 创建人,0表示无创建人值
+     */
+    private String creator;
+
+    /**
+     * 修改人,如果为0则表示纪录未修改
+     */
+    private String modifier;
+
+    /**
+     * 医院编码
+     */
+    private String hospitalCode;
+
+    /**
+     * 医院患者编号
+     */
+    private String code;
+
+    /**
+     * 患者姓名
+     */
+    private String name;
+
+    /**
+     * 性别
+     */
+    private Integer sex;
+
+    /**
+     * 出生日期
+     */
+    private Date birthday;
+
+    /**
+     * 证件类型
+     */
+    private String idType;
+
+    /**
+     * 证件号码
+     */
+    private String idNo;
+
+    /**
+     * 家庭住址
+     */
+    private String address;
+
+    /**
+     * 联系电话
+     */
+    private String phone;
+
+    /**
+     * 身份证号
+     */
+    private String identityNum;
+
+    /**
+     * 家庭邮编
+     */
+    private String postcode;
+
+    /**
+     * 联系人
+     */
+    private String contacts;
+
+    /**
+     * 联系人电话
+     */
+    private String contactPhone;
+
+    /**
+     * 就职单位名称
+     */
+    private String workUnit;
+
+    /**
+     * 职业
+     */
+    private String operation;
+
+    /**
+     * 国籍
+     */
+    private String country;
+
+    /**
+     * 民族
+     */
+    private String nationality;
+
+    /**
+     * 婚姻状况:0未婚,1已婚,2未知
+     */
+    private Integer matrimony;
+
+    /**
+     * 备注
+     */
+    private String remark;
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+    public String getIsDeleted() {
+        return isDeleted;
+    }
+
+    public void setIsDeleted(String isDeleted) {
+        this.isDeleted = isDeleted;
+    }
+    public Date getGmtCreate() {
+        return gmtCreate;
+    }
+
+    public void setGmtCreate(Date gmtCreate) {
+        this.gmtCreate = gmtCreate;
+    }
+    public Date getGmtModified() {
+        return gmtModified;
+    }
+
+    public void setGmtModified(Date gmtModified) {
+        this.gmtModified = gmtModified;
+    }
+    public String getCreator() {
+        return creator;
+    }
+
+    public void setCreator(String creator) {
+        this.creator = creator;
+    }
+    public String getModifier() {
+        return modifier;
+    }
+
+    public void setModifier(String modifier) {
+        this.modifier = modifier;
+    }
+    public String getHospitalCode() {
+        return hospitalCode;
+    }
+
+    public void setHospitalCode(String hospitalCode) {
+        this.hospitalCode = hospitalCode;
+    }
+    public String getCode() {
+        return code;
+    }
+
+    public void setCode(String code) {
+        this.code = code;
+    }
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public Integer getSex() {
+		return sex;
+	}
+
+	public void setSex(Integer sex) {
+		this.sex = sex;
+	}
+
+	public Date getBirthday() {
+        return birthday;
+    }
+
+    public void setBirthday(Date birthday) {
+        this.birthday = birthday;
+    }
+    public String getIdType() {
+        return idType;
+    }
+
+    public void setIdType(String idType) {
+        this.idType = idType;
+    }
+    public String getIdNo() {
+        return idNo;
+    }
+
+    public void setIdNo(String idNo) {
+        this.idNo = idNo;
+    }
+    public String getAddress() {
+        return address;
+    }
+
+    public void setAddress(String address) {
+        this.address = address;
+    }
+    public String getPhone() {
+        return phone;
+    }
+
+    public void setPhone(String phone) {
+        this.phone = phone;
+    }
+    public String getIdentityNum() {
+        return identityNum;
+    }
+
+    public void setIdentityNum(String identityNum) {
+        this.identityNum = identityNum;
+    }
+    public String getPostcode() {
+        return postcode;
+    }
+
+    public void setPostcode(String postcode) {
+        this.postcode = postcode;
+    }
+    public String getContacts() {
+        return contacts;
+    }
+
+    public void setContacts(String contacts) {
+        this.contacts = contacts;
+    }
+    public String getContactPhone() {
+        return contactPhone;
+    }
+
+    public void setContactPhone(String contactPhone) {
+        this.contactPhone = contactPhone;
+    }
+    public String getWorkUnit() {
+        return workUnit;
+    }
+
+    public void setWorkUnit(String workUnit) {
+        this.workUnit = workUnit;
+    }
+    public String getOperation() {
+        return operation;
+    }
+
+    public void setOperation(String operation) {
+        this.operation = operation;
+    }
+    public String getCountry() {
+        return country;
+    }
+
+    public void setCountry(String country) {
+        this.country = country;
+    }
+    public String getNationality() {
+        return nationality;
+    }
+
+    public void setNationality(String nationality) {
+        this.nationality = nationality;
+    }
+    public Integer getMatrimony() {
+        return matrimony;
+    }
+
+    public void setMatrimony(Integer matrimony) {
+        this.matrimony = matrimony;
+    }
+    public String getRemark() {
+        return remark;
+    }
+
+    public void setRemark(String remark) {
+        this.remark = remark;
+    }
+
+    @Override
+    public String toString() {
+        return "PatientInfo{" +
+        "id=" + id +
+        ", isDeleted=" + isDeleted +
+        ", gmtCreate=" + gmtCreate +
+        ", gmtModified=" + gmtModified +
+        ", creator=" + creator +
+        ", modifier=" + modifier +
+        ", hospitalCode=" + hospitalCode +
+        ", code=" + code +
+        ", name=" + name +
+        ", sex=" + sex +
+        ", birthday=" + birthday +
+        ", idType=" + idType +
+        ", idNo=" + idNo +
+        ", address=" + address +
+        ", phone=" + phone +
+        ", identityNum=" + identityNum +
+        ", postcode=" + postcode +
+        ", contacts=" + contacts +
+        ", contactPhone=" + contactPhone +
+        ", workUnit=" + workUnit +
+        ", operation=" + operation +
+        ", country=" + country +
+        ", nationality=" + nationality +
+        ", matrimony=" + matrimony +
+        ", remark=" + remark +
+        "}";
+    }
+}

+ 81 - 0
tran-service/src/main/java/com/diagbot/facade/PatientInfoFacade.java

@@ -0,0 +1,81 @@
+package com.diagbot.facade;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.diagbot.dto.PatientInfoDTO;
+import com.diagbot.entity.PatientInfo;
+import com.diagbot.enums.IsDeleteEnum;
+import com.diagbot.service.impl.PatientInfoServiceImpl;
+import com.diagbot.vo.PatientInfoVO;
+import org.springframework.stereotype.Component;
+
+/**
+ * @Description: 患者业务逻辑
+ * @author: wangyu
+ * @time: 2018/11/19 13:19
+ */
+@Component
+public class PatientInfoFacade extends PatientInfoServiceImpl {
+
+    /*@Autowired
+    private DoctorPageModeFacade doctorPageModeFacade;*/
+    /*@Autowired
+    private DeptInfoFacade deptInfoFacade;*/
+
+    /**
+     * 获取患者信息
+     *
+     * @param patientInfoVO
+     * @return
+     */
+    public PatientInfoDTO getPatientInfo(PatientInfoVO patientInfoVO) {
+        PatientInfoDTO patientInfoDTO = this.getPatientInfos(patientInfoVO.getPatientCode(), patientInfoVO.getHospitalCode());
+        return patientInfoDTO;
+    }
+
+    /**
+     * 页面顶部病人医生科室信息查询
+     *
+     * @param getTopPatientInfoVO
+     * @return
+     *//*
+    public GetTopPatientInfoDTO getTopPatientInfo(@RequestBody GetTopPatientInfoVO getTopPatientInfoVO) {
+        GetTopPatientInfoDTO getTopPatientInfoDTO = baseMapper.getTopPatientInfo(getTopPatientInfoVO);
+        getTopPatientInfoDTO.setSystemTime(DateUtil.now());
+        getTopPatientInfoDTO.setRecordId(getTopPatientInfoVO.getRecordId());
+        getTopPatientInfoDTO.setPatientAge(DateUtil.yearCompare(getTopPatientInfoDTO.getBirthday(), DateUtil.now()));
+
+        QueryWrapper<DeptInfo> deptInfoQ = new QueryWrapper<>();
+        deptInfoQ.eq("is_deleted", IsDeleteEnum.N.getKey())
+                .eq("id", getTopPatientInfoDTO.getSelfDeptId());
+        DeptInfo deptInfo = deptInfoFacade.getOne(deptInfoQ);
+        if (null != deptInfo) {
+            getTopPatientInfoDTO.setSelfDeptName(deptInfo.getName());
+        }
+
+        QueryWrapper<DoctorPageMode> doctorPageModeQe = new QueryWrapper<>();
+        doctorPageModeQe.eq("is_deleted", IsDeleteEnum.N.getKey());
+        doctorPageModeQe.eq("doctor_id", getTopPatientInfoDTO.getDoctorId());
+        DoctorPageMode doctorPageMode = doctorPageModeFacade.getOne(doctorPageModeQe);
+        if (doctorPageMode != null) {
+            getTopPatientInfoDTO.setModeClassify(doctorPageMode.getModeClassify());
+            getTopPatientInfoDTO.setModeValue(doctorPageMode.getModeValue());
+        }
+        return getTopPatientInfoDTO;
+    }
+*/
+    /**
+     * 通过医院编码、病人编码获取病人信息
+     *
+     * @param hospitalCode 医院编码
+     * @param patientCode  病人编码
+     * @return
+     */
+    public PatientInfo getPatientByCode(String hospitalCode, String patientCode) {
+        QueryWrapper<PatientInfo> queryWrapper = new QueryWrapper<PatientInfo>();
+        queryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey());
+        queryWrapper.eq("hospital_code", hospitalCode);
+        queryWrapper.eq("code", patientCode);
+        return this.getOne(queryWrapper);
+    }
+
+}

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

@@ -0,0 +1,30 @@
+package com.diagbot.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.diagbot.dto.GetTopPatientInfoDTO;
+import com.diagbot.dto.PatientInfoDTO;
+import com.diagbot.entity.PatientInfo;
+import com.diagbot.vo.GetTopPatientInfoVO;
+import org.apache.ibatis.annotations.Param;
+import org.springframework.web.bind.annotation.RequestBody;
+
+/**
+ * @Description: 患者信息
+ * @Author: wangyu
+ * @Date: 13:09 2018/11/19
+ */
+public interface PatientInfoMapper extends BaseMapper<PatientInfo> {
+    /**
+     * 获取患者信息
+     * @param patientCode,hospitalCode
+     * @return
+     */
+    public PatientInfoDTO getPatientInfos(@Param("patientCode") String patientCode, @Param("hospitalCode") String hospitalCode);
+    
+    /**
+     * 顶部病人医生科室信息查询
+     * @param getTopPatientInfoVO
+     * @return
+     */
+    GetTopPatientInfoDTO getTopPatientInfo(@RequestBody GetTopPatientInfoVO getTopPatientInfoVO);
+}

+ 18 - 0
tran-service/src/main/java/com/diagbot/service/PatientInfoService.java

@@ -0,0 +1,18 @@
+package com.diagbot.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.diagbot.dto.PatientInfoDTO;
+import com.diagbot.entity.PatientInfo;
+
+/**
+ * <p>
+ * 患者信息表 服务类
+ * </p>
+ *
+ * @author wangyu
+ * @since 2018-11-19
+ */
+public interface PatientInfoService extends IService<PatientInfo> {
+
+    public PatientInfoDTO getPatientInfos(String patientCode, String hospitalCode);
+}

+ 25 - 0
tran-service/src/main/java/com/diagbot/service/impl/PatientInfoServiceImpl.java

@@ -0,0 +1,25 @@
+package com.diagbot.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.diagbot.dto.PatientInfoDTO;
+import com.diagbot.entity.PatientInfo;
+import com.diagbot.mapper.PatientInfoMapper;
+import com.diagbot.service.PatientInfoService;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * 患者信息表 服务实现类
+ * </p>
+ *
+ * @author wangyu
+ * @since 2018-11-19
+ */
+@Service
+public class PatientInfoServiceImpl extends ServiceImpl<PatientInfoMapper, PatientInfo> implements PatientInfoService {
+
+    @Override
+    public PatientInfoDTO getPatientInfos(String patientCode, String hospitalCode) {
+        return baseMapper.getPatientInfos(patientCode, hospitalCode);
+    }
+}

+ 59 - 0
tran-service/src/main/java/com/diagbot/vo/GetTopPatientInfoVO.java

@@ -0,0 +1,59 @@
+/**
+ * 
+ */
+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;
+
+/**
+ * @Description
+ * @author rgb
+ * @time 2018年11月19日下午4:58:37
+ */
+@ApiModel(value="页面顶部病人医生科室信息查询接口传参")
+@Getter
+@Setter
+public class GetTopPatientInfoVO {
+	
+	/**
+	 * 医院编号
+	 */
+	@ApiModelProperty(value="医院编号",required=true)
+	@NotBlank(message="医院编号必填")
+	private String hospitalCode;
+	
+	/**
+	 * 医院科室编号
+	 */
+	@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 - 0
tran-service/src/main/java/com/diagbot/vo/PatientInfoVO.java

@@ -0,0 +1,20 @@
+package com.diagbot.vo;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import javax.validation.constraints.NotNull;
+
+/**
+ * @Description:
+ * @author: wangyu
+ * @time: 2018/11/19 11:14
+ */
+@Getter
+@Setter
+public class PatientInfoVO {
+    @NotNull(message = "请输入病人编码")
+    private String patientCode;
+    @NotNull(message = "请输入医院编码")
+    private String hospitalCode;
+}

+ 59 - 0
tran-service/src/main/java/com/diagbot/web/PatientInfoController.java

@@ -0,0 +1,59 @@
+package com.diagbot.web;
+
+
+import com.diagbot.annotation.SysLogger;
+import com.diagbot.dto.PatientInfoDTO;
+import com.diagbot.dto.RespDTO;
+import com.diagbot.facade.PatientInfoFacade;
+import com.diagbot.vo.PatientInfoVO;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import springfox.documentation.annotations.ApiIgnore;
+
+import javax.validation.Valid;
+
+/**
+ * <p>
+ * 患者信息表 前端控制器
+ * </p>
+ *
+ * @author wangyu
+ * @since 2018-11-19
+ */
+@RestController
+@RequestMapping("/patientInfo")
+@Api(value = "患者信息API", tags = { "患者信息API" })
+@SuppressWarnings("unchecked")
+public class PatientInfoController {
+    @Autowired
+    private PatientInfoFacade patientInfoFacade;
+
+    @ApiOperation(value = "患者信息——查询[by:wangyu]",
+            notes = "patientCode:患者编号,必填<br>" +
+                    "hospitalCode:医院编号,必填<br>")
+    @PostMapping("/getPatientInfo")
+    @SysLogger("getPatientInfo")
+    @ApiIgnore
+    public RespDTO<PatientInfoDTO> getPatientInfo(@Valid @RequestBody PatientInfoVO patientInfoVO) {
+        PatientInfoDTO data = patientInfoFacade.getPatientInfo(patientInfoVO);
+        return RespDTO.onSuc(data);
+    }
+
+
+   /* @ApiOperation(value = "页面顶部病人医生科室信息——查询[by:rengb]",
+            notes = "hospitalCode:医院编号,必填<br>" +
+                    "hospitalDeptCode:医院科室编号,必填<br>" +
+                    "doctorCode:医院医生编号,必填<br>" +
+                    "patientCode:医院患者编号,必填<br>")
+    @PostMapping("/getTopPatientInfo")
+    @SysLogger("getTopPatientInfo")
+    public RespDTO<GetTopPatientInfoDTO> getTopPatientInfo(@Valid @RequestBody GetTopPatientInfoVO getTopPatientInfoVO) {
+        return RespDTO.onSuc(patientInfoFacade.getTopPatientInfo(getTopPatientInfoVO));
+    }*/
+
+}

+ 69 - 0
tran-service/src/main/resources/mapper/PatientInfoMapper.xml

@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.diagbot.mapper.PatientInfoMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.diagbot.entity.PatientInfo">
+        <id column="id" property="id" />
+        <result column="is_deleted" property="isDeleted" />
+        <result column="gmt_create" property="gmtCreate" />
+        <result column="gmt_modified" property="gmtModified" />
+        <result column="creator" property="creator" />
+        <result column="modifier" property="modifier" />
+        <result column="hospital_code" property="hospitalCode" />
+        <result column="code" property="code" />
+        <result column="name" property="name" />
+        <result column="sex" property="sex" />
+        <result column="birthday" property="birthday" />
+        <result column="id_type" property="idType" />
+        <result column="id_no" property="idNo" />
+        <result column="address" property="address" />
+        <result column="phone" property="phone" />
+        <result column="identity_num" property="identityNum" />
+        <result column="postcode" property="postcode" />
+        <result column="contacts" property="contacts" />
+        <result column="contact_phone" property="contactPhone" />
+        <result column="work_unit" property="workUnit" />
+        <result column="operation" property="operation" />
+        <result column="country" property="country" />
+        <result column="nationality" property="nationality" />
+        <result column="matrimony" property="matrimony" />
+        <result column="remark" property="remark" />
+    </resultMap>
+
+    <select id="getPatientInfos" resultType="com.diagbot.dto.PatientInfoDTO">
+        SELECT a.* FROM `tran_patient_info` a
+        LEFT JOIN tran_hospital_info b ON a.hospital_code = b.`code`
+        WHERE a.is_deleted = 'N' AND b.is_deleted = 'N'
+        AND a.`code` = #{patientCode} AND b.`code` = #{hospitalCode}
+    </select>
+    
+    <select id="getTopPatientInfo" parameterType="com.diagbot.vo.GetTopPatientInfoVO" resultType="com.diagbot.dto.GetTopPatientInfoDTO">
+   		SELECT
+		a.id as hospitalId,
+		a.`code` as hospitalCode,
+		a.`name` as hospitalName,
+		b.id as hospitalDeptId,
+		b.dept_id as selfDeptId,
+		b.`code` as hospitalDeptCode,
+		b.`name` as hospitalDeptName,
+		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_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 and b.`code`=c.hospital_dept_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>