Sfoglia il codice sorgente

获取患者信息

wangyu 6 anni fa
parent
commit
b56eea9143

+ 15 - 0
icss-service/src/main/java/com/diagbot/dto/PatientInfoDTO.java

@@ -0,0 +1,15 @@
+package com.diagbot.dto;
+
+import com.diagbot.entity.PatientInfo;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @author: wangyu
+ * @time: 2018/11/19 13:05
+ */
+@Getter
+@Setter
+public class PatientInfoDTO extends PatientInfo {
+}

+ 35 - 0
icss-service/src/main/java/com/diagbot/facade/PatientInfoFacade.java

@@ -0,0 +1,35 @@
+package com.diagbot.facade;
+
+import com.diagbot.dto.PatientInfoDTO;
+import com.diagbot.dto.RespDTO;
+import com.diagbot.exception.CommonErrorCode;
+import com.diagbot.exception.CommonException;
+import com.diagbot.service.impl.PatientInfoServiceImpl;
+import com.diagbot.vo.PatientInfoVO;
+import org.springframework.stereotype.Component;
+import org.springframework.web.bind.annotation.RequestBody;
+
+import java.util.List;
+
+/**
+ * @Description: 患者业务逻辑
+ * @author: wangyu
+ * @time: 2018/11/19 13:19
+ */
+@Component
+public class PatientInfoFacade extends PatientInfoServiceImpl {
+
+    /**
+     * 获取患者信息
+     * @param patientInfoVO
+     * @return
+     */
+    public RespDTO<List<PatientInfoDTO>> getPatientInfo(@RequestBody PatientInfoVO patientInfoVO) {
+        List<PatientInfoDTO> patientInfoDTOList = this.getPatientInfos(patientInfoVO.getPatientCode(),patientInfoVO.getHosptialCode());
+        if(patientInfoDTOList == null || patientInfoDTOList.size() == 0){
+            throw new CommonException(CommonErrorCode.NOT_EXISTS,
+                    "获取患者信息失败");
+        }
+        return RespDTO.onSuc(patientInfoDTOList);
+    }
+}

+ 13 - 7
icss-service/src/main/java/com/diagbot/mapper/PatientInfoMapper.java

@@ -1,16 +1,22 @@
 package com.diagbot.mapper;
 
+import com.diagbot.dto.PatientInfoDTO;
 import com.diagbot.entity.PatientInfo;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
 
 /**
- * <p>
- * 患者信息表 Mapper 接口
- * </p>
- *
- * @author wangyu
- * @since 2018-11-19
+ * @Description: 患者信息
+ * @Author: wangyu
+ * @Date: 13:09 2018/11/19
  */
 public interface PatientInfoMapper extends BaseMapper<PatientInfo> {
-
+    /**
+     * 获取患者信息
+     * @param patientCode,hospitalCode
+     * @return
+     */
+    public List<PatientInfoDTO> getPatientInfos(@Param("patientCode") String patientCode, @Param("hospitalCode") String hospitalCode);
 }

+ 6 - 1
icss-service/src/main/java/com/diagbot/service/PatientInfoService.java

@@ -1,7 +1,11 @@
 package com.diagbot.service;
 
-import com.diagbot.entity.PatientInfo;
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.diagbot.dto.PatientInfoDTO;
+import com.diagbot.entity.PatientInfo;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
 
 /**
  * <p>
@@ -13,4 +17,5 @@ import com.baomidou.mybatisplus.extension.service.IService;
  */
 public interface PatientInfoService extends IService<PatientInfo> {
 
+    public List<PatientInfoDTO> getPatientInfos(@Param("patientCode") String patientCode, @Param("hospitalCode") String hospitalCode);
 }

+ 7 - 0
icss-service/src/main/java/com/diagbot/service/impl/PatientInfoServiceImpl.java

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

+ 20 - 0
icss-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 hosptialCode;
+}

+ 21 - 0
icss-service/src/main/java/com/diagbot/web/PatientInfoController.java

@@ -1,10 +1,21 @@
 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 java.util.List;
+
 /**
  * <p>
  * 患者信息表 前端控制器
@@ -17,5 +28,15 @@ import org.springframework.web.bind.annotation.RestController;
 @RequestMapping("/patientInfo")
 @Api(value = "患者信息API", tags = { "患者信息API" })
 public class PatientInfoController {
+    @Autowired
+    private PatientInfoFacade patientInfoFacade;
 
+    @ApiOperation(value = "患者信息——查询[by:wangyu]",
+            notes = "patientCode:患者编号,必填<br>" +
+                    "hospitalCode:医院编号,必填<br>")
+    @PostMapping("/getPatientInfo")
+    @SysLogger("getPatientInfo")
+    public RespDTO<List<PatientInfoDTO>> getPatientInfo(@RequestBody PatientInfoVO patientInfoVO) {
+        return patientInfoFacade.getPatientInfo(patientInfoVO);
+    }
 }

+ 6 - 0
icss-service/src/main/resources/mapper/PatientInfoMapper.xml

@@ -31,4 +31,10 @@
         <result column="remark" property="remark" />
     </resultMap>
 
+    <select id="getPatientInfos" resultType="com.diagbot.dto.PatientInfoDTO">
+        SELECT * FROM `icss_patient_info` a
+        LEFT JOIN icss_hospital_info b ON a.hospital_id = b.id
+        WHERE a.is_deleted = 'N'
+        AND a.`code` = #{patientCode} AND b.`code` = #{hospitalCode}
+    </select>
 </mapper>