Browse Source

对接接口修改

wangyu 6 years ago
parent
commit
fdf4db2af1

+ 10 - 0
icss-service/src/main/java/com/diagbot/client/TranServiceClient.java

@@ -1,7 +1,14 @@
 package com.diagbot.client;
 
 import com.diagbot.client.hystrix.TranServiceHystrix;
+import com.diagbot.dto.DoctorInfoDTO;
+import com.diagbot.dto.RespDTO;
+import com.diagbot.vo.DoctorInfoVO;
 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: 调用信息对接层服务
@@ -12,4 +19,7 @@ import org.springframework.cloud.openfeign.FeignClient;
 public interface TranServiceClient {
 //    @PostMapping(value = "/web/doc/algorithm/neural")
 //    Response<ResponseData> bayesPageData(@RequestBody SearchData searchData);
+
+    @PostMapping("/doctorInfo/getDoctorInfo")
+    RespDTO<List<DoctorInfoDTO>> getDoctorInfo(@RequestBody DoctorInfoVO doctorInfoVo);
 }

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

@@ -1,9 +1,15 @@
 package com.diagbot.client.hystrix;
 
 import com.diagbot.client.TranServiceClient;
+import com.diagbot.dto.DoctorInfoDTO;
+import com.diagbot.dto.RespDTO;
+import com.diagbot.vo.DoctorInfoVO;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Component;
 
+import javax.validation.Valid;
+import java.util.List;
+
 /**
  * @Description: 调用信息对接层服务
  * @author: gaodm
@@ -12,6 +18,11 @@ import org.springframework.stereotype.Component;
 @Component
 @Slf4j
 public class TranServiceHystrix implements TranServiceClient {
+    @Override
+    public RespDTO<List<DoctorInfoDTO>> getDoctorInfo(@Valid DoctorInfoVO doctorInfoVo) {
+        log.error("【hystrix】调用{}异常", "getDoctorInfo");
+        return null;
+    }
 //    @Override
 //    public Response<ResponseData> bayesPageData(SearchData searchData) {
 //        log.error("【hystrix】调用{}异常", "bayesPageData");

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

@@ -1,8 +1,13 @@
 package com.diagbot.facade;
 
+import com.diagbot.client.TranServiceClient;
 import com.diagbot.dto.DoctorInfoDTO;
+import com.diagbot.dto.RespDTO;
+import com.diagbot.exception.CommonErrorCode;
+import com.diagbot.exception.CommonException;
 import com.diagbot.service.impl.DoctorInfoServiceImpl;
 import com.diagbot.vo.DoctorInfoVO;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
 import java.util.List;
@@ -14,7 +19,8 @@ import java.util.List;
  */
 @Component
 public class DoctorInfoFacade extends DoctorInfoServiceImpl {
-
+    @Autowired
+    private TranServiceClient tranServiceClient;
     /**
      * 获取医生信息
      *
@@ -22,7 +28,11 @@ public class DoctorInfoFacade extends DoctorInfoServiceImpl {
      * @return
      */
     public List<DoctorInfoDTO> getDoctorInfo(DoctorInfoVO doctorInfoVo) {
-        List<DoctorInfoDTO> doctorInfoDTOList = this.getDoctorInfos(doctorInfoVo.getDoctorCode(), doctorInfoVo.getHosptialCode(), doctorInfoVo.getDeptCode());
-        return doctorInfoDTOList;
+        RespDTO<List<DoctorInfoDTO>> doctorInfoDTOList = tranServiceClient.getDoctorInfo(doctorInfoVo);
+        if (doctorInfoDTOList == null || !"0".equals(doctorInfoDTOList.code)) {
+            throw new CommonException(CommonErrorCode.RPC_ERROR,
+                    "获取用医生信息失败");
+        }
+        return doctorInfoDTOList.data;
     }
 }

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

@@ -13,7 +13,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;
 import java.util.List;
@@ -30,7 +29,7 @@ import java.util.List;
 @RequestMapping("/doctorInfo")
 @Api(value = "医生信息API", tags = { "医生信息API" })
 @SuppressWarnings("unchecked")
-@ApiIgnore
+/*@ApiIgnore*/
 public class DoctorInfoController {
 
     @Autowired

+ 11 - 0
tran-service/src/main/java/com/diagbot/dto/DoctorInfoDTO.java

@@ -0,0 +1,11 @@
+package com.diagbot.dto;
+
+import com.diagbot.entity.DoctorInfo;
+
+/**
+ * @Description:
+ * @author: wangyu
+ * @time: 2018/11/19 19:38
+ */
+public class DoctorInfoDTO extends DoctorInfo {
+}

+ 239 - 0
tran-service/src/main/java/com/diagbot/entity/DoctorInfo.java

@@ -0,0 +1,239 @@
+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_doctor_info")
+public class DoctorInfo 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 hospitalDeptCode;
+
+    /**
+     * 医院医生编码
+     */
+    private String code;
+
+    /**
+     * 医生姓名
+     */
+    private String name;
+
+    /**
+     * 医生性别
+     */
+    private Integer sex;
+
+    /**
+     * 证件类型
+     */
+    private String idType;
+
+    /**
+     * 证件号码
+     */
+    private String idNo;
+
+    /**
+     * 家庭住址
+     */
+    private String address;
+
+    /**
+     * 联系电话
+     */
+    private String phone;
+
+    /**
+     * 备注
+     */
+    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 getHospitalDeptCode() {
+        return hospitalDeptCode;
+    }
+
+    public void setHospitalDeptCode(String hospitalDeptCode) {
+        this.hospitalDeptCode = hospitalDeptCode;
+    }
+    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 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 getRemark() {
+        return remark;
+    }
+
+    public void setRemark(String remark) {
+        this.remark = remark;
+    }
+
+    @Override
+    public String toString() {
+        return "DoctorInfo{" +
+        "id=" + id +
+        ", isDeleted=" + isDeleted +
+        ", gmtCreate=" + gmtCreate +
+        ", gmtModified=" + gmtModified +
+        ", creator=" + creator +
+        ", modifier=" + modifier +
+        ", hospitalCode=" + hospitalCode +
+        ", hospitalDeptCode=" + hospitalDeptCode +
+        ", code=" + code +
+        ", name=" + name +
+        ", sex=" + sex +
+        ", idType=" + idType +
+        ", idNo=" + idNo +
+        ", address=" + address +
+        ", phone=" + phone +
+        ", remark=" + remark +
+        "}";
+    }
+}

+ 28 - 0
tran-service/src/main/java/com/diagbot/facade/DoctorInfoFacade.java

@@ -0,0 +1,28 @@
+package com.diagbot.facade;
+
+import com.diagbot.dto.DoctorInfoDTO;
+import com.diagbot.service.impl.DoctorInfoServiceImpl;
+import com.diagbot.vo.DoctorInfoVO;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+
+/**
+ * @Description:
+ * @author: wangyu
+ * @time: 2018/11/19 19:49
+ */
+@Component
+public class DoctorInfoFacade extends DoctorInfoServiceImpl {
+
+    /**
+     * 获取医生信息
+     *
+     * @param doctorInfoVo
+     * @return
+     */
+    public List<DoctorInfoDTO> getDoctorInfo(DoctorInfoVO doctorInfoVo) {
+        List<DoctorInfoDTO> doctorInfoDTOList = this.getDoctorInfos(doctorInfoVo.getDoctorCode(), doctorInfoVo.getHosptialCode(), doctorInfoVo.getDeptCode());
+        return doctorInfoDTOList;
+    }
+}

+ 28 - 0
tran-service/src/main/java/com/diagbot/mapper/DoctorInfoMapper.java

@@ -0,0 +1,28 @@
+package com.diagbot.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.diagbot.dto.DoctorInfoDTO;
+import com.diagbot.entity.DoctorInfo;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * <p>
+ * 医生信息表 Mapper 接口
+ * </p>
+ *
+ * @author rengb
+ * @since 2018-11-19
+ */
+public interface DoctorInfoMapper extends BaseMapper<DoctorInfo> {
+
+    /**
+     *  获取医生信息
+     * @param doctorCode
+     * @param hospitalCode
+     * @param deptCode
+     * @return
+     */
+    public List<DoctorInfoDTO> getDoctorInfos(@Param("doctorCode") String doctorCode, @Param("hospitalCode") String hospitalCode, @Param("deptCode") String deptCode);
+}

+ 29 - 0
tran-service/src/main/java/com/diagbot/service/DoctorInfoService.java

@@ -0,0 +1,29 @@
+package com.diagbot.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.diagbot.dto.DoctorInfoDTO;
+import com.diagbot.entity.DoctorInfo;
+
+import java.util.List;
+
+/**
+ * <p>
+ * 医生信息表 服务类
+ * </p>
+ *
+ * @author rengb
+ * @since 2018-11-19
+ */
+public interface DoctorInfoService extends IService<DoctorInfo> {
+
+
+    /**
+     * 获取医生信息
+     *
+     * @param doctorCode
+     * @param hospitalCode
+     * @param deptCode
+     * @return
+     */
+    public List<DoctorInfoDTO> getDoctorInfos(String doctorCode, String hospitalCode, String deptCode);
+}

+ 27 - 0
tran-service/src/main/java/com/diagbot/service/impl/DoctorInfoServiceImpl.java

@@ -0,0 +1,27 @@
+package com.diagbot.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.diagbot.dto.DoctorInfoDTO;
+import com.diagbot.entity.DoctorInfo;
+import com.diagbot.mapper.DoctorInfoMapper;
+import com.diagbot.service.DoctorInfoService;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * <p>
+ * 医生信息表 服务实现类
+ * </p>
+ *
+ * @author rengb
+ * @since 2018-11-19
+ */
+@Service
+public class DoctorInfoServiceImpl extends ServiceImpl<DoctorInfoMapper, DoctorInfo> implements DoctorInfoService {
+
+    @Override
+    public List<DoctorInfoDTO> getDoctorInfos(String doctorCode, String hospitalCode, String deptCode) {
+        return baseMapper.getDoctorInfos(doctorCode, hospitalCode, deptCode);
+    }
+}

+ 22 - 0
tran-service/src/main/java/com/diagbot/vo/DoctorInfoVO.java

@@ -0,0 +1,22 @@
+package com.diagbot.vo;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import javax.validation.constraints.NotNull;
+
+/**
+ * @Description:
+ * @author: wangyu
+ * @time: 2018/11/19 19:38
+ */
+@Getter
+@Setter
+public class DoctorInfoVO {
+    @NotNull(message = "请输入科室编码")
+    private String deptCode;
+    @NotNull(message = "请输入医院编码")
+    private String hosptialCode;
+    @NotNull(message = "请输入医生编码")
+    private String doctorCode;
+}

+ 48 - 0
tran-service/src/main/java/com/diagbot/web/DoctorInfoController.java

@@ -0,0 +1,48 @@
+package com.diagbot.web;
+
+
+import com.diagbot.annotation.SysLogger;
+import com.diagbot.dto.DoctorInfoDTO;
+import com.diagbot.dto.RespDTO;
+import com.diagbot.facade.DoctorInfoFacade;
+import com.diagbot.vo.DoctorInfoVO;
+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 javax.validation.Valid;
+import java.util.List;
+
+/**
+ * <p>
+ * 医生信息表 前端控制器
+ * </p>
+ *
+ * @author wangyu
+ * @since 2018-11-19
+ */
+@RestController
+@RequestMapping("/doctorInfo")
+@Api(value = "医生信息API", tags = { "医生信息API" })
+@SuppressWarnings("unchecked")
+/*@ApiIgnore*/
+public class DoctorInfoController {
+
+    @Autowired
+    private DoctorInfoFacade doctorInfoFacade;
+
+    @ApiOperation(value = "医生信息——查询[by:wangyu]",
+            notes = "deptCode:科室编号,必填<br>" +
+                    "hospitalCode: 医院编号,必填<br>" +
+                    "doctorCode: 医生编号,必填<br>")
+    @PostMapping("/getDoctorInfo")
+    @SysLogger("getDoctorInfo")
+    public RespDTO<List<DoctorInfoDTO>> getDoctorInfo(@Valid @RequestBody DoctorInfoVO doctorInfoVo) {
+        List<DoctorInfoDTO> data = doctorInfoFacade.getDoctorInfo(doctorInfoVo);
+        return RespDTO.onSuc(data);
+    }
+}

+ 31 - 0
tran-service/src/main/resources/mapper/DoctorInfoMapper.xml

@@ -0,0 +1,31 @@
+<?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.DoctorInfoMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.diagbot.entity.DoctorInfo">
+        <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="hospital_dept_code" property="hospitalDeptCode" />
+        <result column="code" property="code" />
+        <result column="name" property="name" />
+        <result column="sex" property="sex" />
+        <result column="id_type" property="idType" />
+        <result column="id_no" property="idNo" />
+        <result column="address" property="address" />
+        <result column="phone" property="phone" />
+        <result column="remark" property="remark" />
+    </resultMap>
+
+    <select id="getDoctorInfos" resultType="com.diagbot.dto.DoctorInfoDTO">
+        SELECT a.* FROM `tran_doctor_info` a
+        LEFT JOIN tran_hospital_dept b ON a.hospital_dept_code = b.`code`
+        WHERE a.is_deleted = 'N' AND b.is_deleted = 'N'
+        AND a.`code` = #{doctorCode} AND b.hospital_code = #{hospitalCode} AND b.`code` = #{deptCode}
+    </select>
+</mapper>