551 lines
18 KiB
XML
551 lines
18 KiB
XML
<?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.xinelu.manage.mapper.patientinfo.PatientInfoMapper">
|
|
<resultMap type="com.xinelu.manage.domain.patientinfo.PatientInfo" id="PatientInfoResult">
|
|
<result property="id" column="id" />
|
|
<result property="patientName" column="patient_name" />
|
|
<result property="patientPhone" column="patient_phone" />
|
|
<result property="familyMemberPhone" column="family_member_phone" />
|
|
<result property="birthDate" column="birth_date" />
|
|
<result property="cardNo" column="card_no" />
|
|
<result property="sex" column="sex" />
|
|
<result property="address" column="address" />
|
|
<result property="patientType" column="patient_type" />
|
|
<result property="signStatus" column="sign_status" />
|
|
<result property="signPatientRecordId" column="sign_patient_record_id" />
|
|
<result property="serviceStatus" column="service_status" />
|
|
<result property="signTime" column="sign_time" />
|
|
<result property="certificateIssuingDoctor" column="certificate_issuing_doctor" />
|
|
<result property="visitMethod" column="visit_method" />
|
|
<result property="mainDiagnosis" column="main_diagnosis" />
|
|
<result property="attendingPhysician" column="attending_physician" />
|
|
<result property="hospitalAgencyId" column="hospital_agency_id" />
|
|
<result property="hospitalAgencyName" column="hospital_agency_name" />
|
|
<result property="campusAgencyId" column="campus_agency_id" />
|
|
<result property="campusAgencyName" column="campus_agency_name" />
|
|
<result property="departmentId" column="department_id" />
|
|
<result property="departmentName" column="department_name" />
|
|
<result property="wardId" column="ward_id" />
|
|
<result property="wardName" column="ward_name" />
|
|
<result property="admissionNumber" column="admission_number" />
|
|
<result property="responsibleNurse" column="responsible_nurse" />
|
|
<result property="visitSerialNumber" column="visit_serial_number" />
|
|
<result property="surgicalName" column="surgical_name" />
|
|
<result property="admissionDate" column="admission_date" />
|
|
<result property="dischargeDate" column="discharge_date" />
|
|
<result property="medicalRecordContent" column="medical_record_content" />
|
|
<result property="appointmentTreatmentGroup" column="appointment_treatment_group" />
|
|
<result property="registrationNo" column="registration_no" />
|
|
<result property="registrationDate" column="registration_date" />
|
|
<result property="appointmentDate" column="appointment_date" />
|
|
<result property="outpatientNumber" column="outpatient_number" />
|
|
<result property="visitTime" column="visit_time" />
|
|
<result property="dischargeMethod" column="discharge_method" />
|
|
<result property="openId" column="open_id" />
|
|
<result property="unionId" column="union_id" />
|
|
<result property="patientSource" column="patient_source" />
|
|
<result property="delFlag" column="del_flag" />
|
|
<result property="createBy" column="create_by" />
|
|
<result property="createTime" column="create_time" />
|
|
<result property="updateBy" column="update_by" />
|
|
<result property="updateTime" column="update_time" />
|
|
</resultMap>
|
|
|
|
<sql id="selectPatientInfoVo">
|
|
select id,
|
|
patient_name,
|
|
patient_phone,
|
|
family_member_phone,
|
|
birth_date,
|
|
card_no,
|
|
sex,
|
|
address,
|
|
patient_type,
|
|
sign_status,
|
|
sign_time,
|
|
certificate_issuing_doctor, visit_method, main_diagnosis, attending_physician,
|
|
hospital_agency_id, hospital_agency_name, campus_agency_id, campus_agency_name, department_id, department_name, ward_id, ward_name,
|
|
admission_number, responsible_nurse, visit_serial_number, surgical_name,
|
|
admission_date, discharge_date, medical_record_content, appointment_treatment_group,
|
|
registration_no, registration_date, appointment_date, outpatient_number, visit_time, discharge_method,
|
|
open_id, union_id, patient_source, del_flag, create_by, create_time, update_by, update_time
|
|
from patient_info
|
|
</sql>
|
|
|
|
<select id="selectPatientInfoList" parameterType="com.xinelu.manage.dto.patientinfo.PatientInfoDto" resultMap="PatientInfoResult">
|
|
<include refid="selectPatientInfoVo" />
|
|
<where>
|
|
del_flag = 0
|
|
<if test="patientName != null and patientName != ''">
|
|
and patient_name = #{patientName}
|
|
</if>
|
|
<if test="patientPhone != null and patientPhone != ''">
|
|
and patient_phone like concat('%', #{patientPhone}, '%')
|
|
</if>
|
|
<if test="cardNo != null and cardNo != ''">
|
|
and card_no = #{cardNo}
|
|
</if>
|
|
<if test="patientType != null and patientType != ''">
|
|
<choose>
|
|
<when test="patientType == 'OUTPATIENT_DISCHARGE'.toString()">
|
|
and (patient_type = 'OUTPATIENT' or patient_type = 'DISCHARGED_PATIENT')
|
|
</when>
|
|
<otherwise>
|
|
and patient_type = #{patientType}
|
|
</otherwise>
|
|
</choose>
|
|
</if>
|
|
<if test="mainDiagnosis != null and mainDiagnosis != ''">
|
|
and main_diagnosis like concat('%', #{mainDiagnosis}, '%')
|
|
</if>
|
|
<if test="hospitalAgencyId != null ">
|
|
and hospital_agency_id = #{hospitalAgencyId}
|
|
</if>
|
|
<if test="campusAgencyId != null ">
|
|
and campus_agency_id = #{campusAgencyId}
|
|
</if>
|
|
<if test="departmentId != null ">
|
|
and department_id = #{departmentId}
|
|
</if>
|
|
<if test="wardId != null ">
|
|
and ward_id = #{wardId}
|
|
</if>
|
|
<if test="attendingPhysician != null and attendingPhysician != ''">
|
|
and attending_physician = #{attendingPhysician}
|
|
</if>
|
|
<if test="visitMethod != null and visitMethod != ''">
|
|
and visit_method = #{visitMethod}
|
|
</if>
|
|
|
|
<if test="surgicalName != null and surgicalName != ''">
|
|
and surgical_name like concat('%', #{surgicalName}, '%')
|
|
</if>
|
|
<if test="visitTimeStart != null ">
|
|
and visit_time >= #{visitTimeStart}
|
|
</if>
|
|
<if test="visitTimeEnd != null ">
|
|
and visit_time <= #{visitTimeEnd}
|
|
</if>
|
|
<if test="admissionDateStart != null ">
|
|
and admission_date >= #{admissionDateStart}
|
|
</if>
|
|
<if test="admissionDateEnd != null ">
|
|
and admission_date <= #{admissionDateEnd}
|
|
</if>
|
|
<if test="appointmentDateStart != null ">
|
|
and appointment_date >= #{appointmentDateStart}
|
|
</if>
|
|
<if test="appointmentDateEnd != null ">
|
|
and appointment_date <= #{appointmentDateEnd}
|
|
</if>
|
|
<if test="appointmentTreatmentGroup != null and appointmentTreatmentGroup != ''">
|
|
and appointment_treatment_group = #{appointmentTreatmentGroup}
|
|
</if>
|
|
<if test="certificateIssuingDoctor != null and certificateIssuingDoctor != ''">
|
|
and certificate_issuing_doctor = #{certificateIssuingDoctor}
|
|
</if>
|
|
<if test="registrationNo != null and registrationNo != ''">
|
|
and registration_no = #{registrationNo}
|
|
</if>
|
|
<if test="visitSerialNumber != null and visitSerialNumber != ''">
|
|
and visit_serial_number = #{visitSerialNumber}
|
|
</if>
|
|
<if test="responsibleNurse != null and responsibleNurse != ''">
|
|
and responsible_nurse = #{responsibleNurse}
|
|
</if>
|
|
<if test="patientSource != null and patientSource != ''">
|
|
and patient_source = #{patientSource}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<select id="selectPatientInfoById" parameterType="Long" resultMap="PatientInfoResult">
|
|
<include refid="selectPatientInfoVo" />
|
|
where id = #{id}
|
|
</select>
|
|
|
|
<insert id="insertPatientInfo" parameterType="com.xinelu.manage.domain.patientinfo.PatientInfo" useGeneratedKeys="true" keyProperty="id">
|
|
insert into patient_info
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="patientName != null">
|
|
patient_name,
|
|
</if>
|
|
<if test="patientPhone != null">patient_phone,
|
|
</if>
|
|
<if test="familyMemberPhone != null">family_member_phone,
|
|
</if>
|
|
<if test="birthDate != null">birth_date,
|
|
</if>
|
|
<if test="cardNo != null">card_no,
|
|
</if>
|
|
<if test="sex != null">sex,
|
|
</if>
|
|
<if test="address != null">address,
|
|
</if>
|
|
<if test="patientType != null">patient_type,
|
|
</if>
|
|
<if test="signStatus != null">sign_status,
|
|
</if>
|
|
<if test="signPatientRecordId != null">sign_patient_record_id,
|
|
</if>
|
|
<if test="serviceStatus != null">service_status,
|
|
</if>
|
|
<if test="signTime != null">sign_time,
|
|
</if>
|
|
<if test="certificateIssuingDoctor != null">certificate_issuing_doctor,
|
|
</if>
|
|
<if test="visitMethod != null">visit_method,
|
|
</if>
|
|
<if test="mainDiagnosis != null">main_diagnosis,
|
|
</if>
|
|
<if test="attendingPhysician != null">attending_physician,
|
|
</if>
|
|
<if test="hospitalAgencyId != null">hospital_agency_id,
|
|
</if>
|
|
<if test="hospitalAgencyName != null">hospital_agency_name,
|
|
</if>
|
|
<if test="campusAgencyId != null">campus_agency_id,
|
|
</if>
|
|
<if test="campusAgencyName != null">campus_agency_name,
|
|
</if>
|
|
<if test="departmentId != null">department_id,
|
|
</if>
|
|
<if test="departmentName != null">department_name,
|
|
</if>
|
|
<if test="wardId != null">ward_id,
|
|
</if>
|
|
<if test="wardName != null">ward_name,
|
|
</if>
|
|
<if test="admissionNumber != null">
|
|
admission_number,
|
|
</if>
|
|
<if test="responsibleNurse != null">
|
|
responsible_nurse,
|
|
</if>
|
|
<if test="visitSerialNumber != null">
|
|
visit_serial_number,
|
|
</if>
|
|
<if test="surgicalName != null">
|
|
surgical_name,
|
|
</if>
|
|
<if test="admissionDate != null">
|
|
admission_date,
|
|
</if>
|
|
<if test="dischargeDate != null">
|
|
discharge_date,
|
|
</if>
|
|
<if test="medicalRecordContent != null">medical_record_content,
|
|
</if>
|
|
<if test="appointmentTreatmentGroup != null">appointment_treatment_group,
|
|
</if>
|
|
<if test="registrationNo != null">registration_no,
|
|
</if>
|
|
<if test="registrationDate != null">registration_date,
|
|
</if>
|
|
<if test="appointmentDate != null">appointment_date,
|
|
</if>
|
|
<if test="outpatientNumber != null">outpatient_number,
|
|
</if>
|
|
<if test="visitTime != null">visit_time,
|
|
</if>
|
|
<if test="dischargeMethod != null">discharge_method,
|
|
</if>
|
|
<if test="openId != null">open_id,
|
|
</if>
|
|
<if test="unionId != null">union_id,
|
|
</if>
|
|
<if test="patientSource != null">patient_source,
|
|
</if>
|
|
<if test="delFlag != null">del_flag,
|
|
</if>
|
|
<if test="createBy != null">create_by,
|
|
</if>
|
|
<if test="createTime != null">create_time,
|
|
</if>
|
|
<if test="updateBy != null">update_by,
|
|
</if>
|
|
<if test="updateTime != null">update_time,
|
|
</if>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="patientName != null">#{patientName},
|
|
</if>
|
|
<if test="patientPhone != null">#{patientPhone},
|
|
</if>
|
|
<if test="familyMemberPhone != null">#{familyMemberPhone},
|
|
</if>
|
|
<if test="birthDate != null">#{birthDate},
|
|
</if>
|
|
<if test="cardNo != null">#{cardNo},
|
|
</if>
|
|
<if test="sex != null">#{sex},
|
|
</if>
|
|
<if test="address != null">#{address},
|
|
</if>
|
|
<if test="patientType != null">#{patientType},
|
|
</if>
|
|
<if test="signStatus != null">#{signStatus},
|
|
</if>
|
|
<if test="signPatientRecordId != null">#{signPatientRecordId},
|
|
</if>
|
|
<if test="serviceStatus != null">#{serviceStatus},
|
|
</if>
|
|
<if test="signTime != null">#{signTime},
|
|
</if>
|
|
<if test="certificateIssuingDoctor != null">#{certificateIssuingDoctor},
|
|
</if>
|
|
<if test="visitMethod != null">#{visitMethod},
|
|
</if>
|
|
<if test="mainDiagnosis != null">#{mainDiagnosis},
|
|
</if>
|
|
<if test="attendingPhysician != null">#{attendingPhysician},
|
|
</if>
|
|
<if test="hospitalAgencyId != null">#{hospitalAgencyId},
|
|
</if>
|
|
<if test="hospitalAgencyName != null">#{hospitalAgencyName},
|
|
</if>
|
|
<if test="campusAgencyId != null">#{campusAgencyId},
|
|
</if>
|
|
<if test="campusAgencyName != null">#{campusAgencyName},
|
|
</if>
|
|
<if test="departmentId != null">#{departmentId},
|
|
</if>
|
|
<if test="departmentName != null">#{departmentName},
|
|
</if>
|
|
<if test="wardId != null">#{wardId},
|
|
</if>
|
|
<if test="wardName != null">#{wardName},
|
|
</if>
|
|
<if test="admissionNumber != null">#{admissionNumber},
|
|
</if>
|
|
<if test="responsibleNurse != null">#{responsibleNurse},
|
|
</if>
|
|
<if test="visitSerialNumber != null">#{visitSerialNumber},
|
|
</if>
|
|
<if test="surgicalName != null">#{surgicalName},
|
|
</if>
|
|
<if test="admissionDate != null">#{admissionDate},
|
|
</if>
|
|
<if test="dischargeDate != null">#{dischargeDate},
|
|
</if>
|
|
<if test="medicalRecordContent != null">#{medicalRecordContent},
|
|
</if>
|
|
<if test="appointmentTreatmentGroup != null">#{appointmentTreatmentGroup},
|
|
</if>
|
|
<if test="registrationNo != null">#{registrationNo},
|
|
</if>
|
|
<if test="registrationDate != null">#{registrationDate},
|
|
</if>
|
|
<if test="appointmentDate != null">#{appointmentDate},
|
|
</if>
|
|
<if test="outpatientNumber != null">#{outpatientNumber},
|
|
</if>
|
|
<if test="visitTime != null">#{visitTime},
|
|
</if>
|
|
<if test="dischargeMethod != null">#{dischargeMethod},
|
|
</if>
|
|
<if test="openId != null">#{openId},
|
|
</if>
|
|
<if test="unionId != null">#{unionId},
|
|
</if>
|
|
<if test="patientSource != null">#{patientSource},
|
|
</if>
|
|
<if test="delFlag != null">#{delFlag},
|
|
</if>
|
|
<if test="createBy != null">#{createBy},
|
|
</if>
|
|
<if test="createTime != null">#{createTime},
|
|
</if>
|
|
<if test="updateBy != null">#{updateBy},
|
|
</if>
|
|
<if test="updateTime != null">#{updateTime},
|
|
</if>
|
|
</trim>
|
|
</insert>
|
|
|
|
<update id="updatePatientInfo" parameterType="com.xinelu.manage.domain.patientinfo.PatientInfo">
|
|
update patient_info
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
<if test="patientName != null">
|
|
patient_name = #{patientName},
|
|
</if>
|
|
<if test="patientPhone != null">
|
|
patient_phone = #{patientPhone},
|
|
</if>
|
|
<if test="familyMemberPhone != null">
|
|
family_member_phone = #{familyMemberPhone},
|
|
</if>
|
|
<if test="birthDate != null">
|
|
birth_date = #{birthDate},
|
|
</if>
|
|
<if test="cardNo != null">
|
|
card_no = #{cardNo},
|
|
</if>
|
|
<if test="sex != null">
|
|
sex = #{sex},
|
|
</if>
|
|
<if test="address != null">
|
|
address = #{address},
|
|
</if>
|
|
<if test="patientType != null">
|
|
patient_type = #{patientType},
|
|
</if>
|
|
<if test="signStatus != null">sign_status =
|
|
#{signStatus},
|
|
</if>
|
|
<if test="signPatientRecordId != null">sign_patient_record_id = #{signPatientRecordId},
|
|
</if>
|
|
<if test="serviceStatus != null">service_status = #{serviceStatus},
|
|
</if>
|
|
<if test="signTime != null">sign_time =
|
|
#{signTime},
|
|
</if>
|
|
<if test="certificateIssuingDoctor != null">certificate_issuing_doctor =
|
|
#{certificateIssuingDoctor},
|
|
</if>
|
|
<if test="visitMethod != null">visit_method =
|
|
#{visitMethod},
|
|
</if>
|
|
<if test="mainDiagnosis != null">main_diagnosis =
|
|
#{mainDiagnosis},
|
|
</if>
|
|
<if test="attendingPhysician != null">attending_physician =
|
|
#{attendingPhysician},
|
|
</if>
|
|
<if test="hospitalAgencyId != null">hospital_agency_id =
|
|
#{hospitalAgencyId},
|
|
</if>
|
|
<if test="hospitalAgencyName != null">hospital_agency_name =
|
|
#{hospitalAgencyName},
|
|
</if>
|
|
<if test="campusAgencyId != null">campus_agency_id =
|
|
#{campusAgencyId},
|
|
</if>
|
|
<if test="campusAgencyName != null">campus_agency_name =
|
|
#{campusAgencyName},
|
|
</if>
|
|
<if test="departmentId != null">department_id =
|
|
#{departmentId},
|
|
</if>
|
|
<if test="departmentName != null">department_name =
|
|
#{departmentName},
|
|
</if>
|
|
<if test="wardId != null">ward_id =
|
|
#{wardId},
|
|
</if>
|
|
<if test="wardName != null">ward_name =
|
|
#{wardName},
|
|
</if>
|
|
<if test="admissionNumber != null">admission_number =
|
|
#{admissionNumber},
|
|
</if>
|
|
<if test="responsibleNurse != null">responsible_nurse =
|
|
#{responsibleNurse},
|
|
</if>
|
|
<if test="visitSerialNumber != null">visit_serial_number =
|
|
#{visitSerialNumber},
|
|
</if>
|
|
<if test="surgicalName != null">surgical_name =
|
|
#{surgicalName},
|
|
</if>
|
|
<if test="admissionDate != null">
|
|
admission_date = #{admissionDate},
|
|
</if>
|
|
<if test="dischargeDate != null">
|
|
discharge_date = #{dischargeDate},
|
|
</if>
|
|
<if test="medicalRecordContent != null">medical_record_content =
|
|
#{medicalRecordContent},
|
|
</if>
|
|
<if test="appointmentTreatmentGroup != null">appointment_treatment_group =
|
|
#{appointmentTreatmentGroup},
|
|
</if>
|
|
<if test="registrationNo != null">registration_no =
|
|
#{registrationNo},
|
|
</if>
|
|
<if test="registrationDate != null">registration_date =
|
|
#{registrationDate},
|
|
</if>
|
|
<if test="appointmentDate != null">appointment_date =
|
|
#{appointmentDate},
|
|
</if>
|
|
<if test="outpatientNumber != null">outpatient_number =
|
|
#{outpatientNumber},
|
|
</if>
|
|
<if test="visitTime != null">visit_time =
|
|
#{visitTime},
|
|
</if>
|
|
<if test="dischargeMethod != null">discharge_method =
|
|
#{dischargeMethod},
|
|
</if>
|
|
<if test="openId != null">open_id =
|
|
#{openId},
|
|
</if>
|
|
<if test="unionId != null">union_id =
|
|
#{unionId},
|
|
</if>
|
|
<if test="patientSource != null">patient_source =
|
|
#{patientSource},
|
|
</if>
|
|
<if test="delFlag != null">del_flag =
|
|
#{delFlag},
|
|
</if>
|
|
<if test="createBy != null">create_by =
|
|
#{createBy},
|
|
</if>
|
|
<if test="createTime != null">create_time =
|
|
#{createTime},
|
|
</if>
|
|
<if test="updateBy != null">update_by =
|
|
#{updateBy},
|
|
</if>
|
|
<if test="updateTime != null">update_time =
|
|
#{updateTime},
|
|
</if>
|
|
</trim>
|
|
where id = #{id}
|
|
</update>
|
|
|
|
<update id="deletePatientInfoById" parameterType="Long">
|
|
update patient_info set del_flag = 1
|
|
where id = #{id}
|
|
</update>
|
|
|
|
<update id="deletePatientInfoByIds" parameterType="String">
|
|
update patient_info set del_flag = 1 where id in
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</update>
|
|
|
|
<select id="getPatientInfoByOpenId" parameterType="string" resultType="patientInfo">
|
|
SELECT
|
|
id,
|
|
community_code,
|
|
area_code,
|
|
patient_code,
|
|
patient_name,
|
|
card_no,
|
|
user_id,
|
|
unionid,
|
|
openid,
|
|
phone,
|
|
address,
|
|
urgent_contact_name,
|
|
urgent_contact_phone,
|
|
community_alias_name,
|
|
home_longitude,
|
|
home_latitude,
|
|
head_picture_url
|
|
FROM
|
|
patient_info
|
|
<where>
|
|
del_flag = 0
|
|
<if test="openId != null and openId != ''">
|
|
and openid = #{openId}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
</mapper> |