123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- <?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.concept_dept_name as selfDeptName,
- 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.identity_num as patientIdentityNum,
- d.phone as patientPhone,
- 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 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
- 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>
- <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,
- a.id as sonHospitalId,
- a.`code` as sonHospitalCode,
- a.`name` as sonHospitalName,
- 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,
- case when d.identity_num is null or d.identity_num='' then d.id_no else d.identity_num end as patientIdNo,
- d.phone as patientPhone,
- 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`=#{sonHospitalCode}
- </select>
- </mapper>
|