|  | @@ -0,0 +1,108 @@
 | 
	
		
			
				|  |  | +<?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.fs.his.mapper.FsInquiryPatientInfoMapper">
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    <resultMap type="FsInquiryPatientInfo" id="FsInquiryPatientInfoResult">
 | 
	
		
			
				|  |  | +        <result property="id"    column="id"    />
 | 
	
		
			
				|  |  | +        <result property="patientId"    column="patient_id"    />
 | 
	
		
			
				|  |  | +        <result property="companyUserId"    column="company_user_id"    />
 | 
	
		
			
				|  |  | +        <result property="userId"    column="user_id"    />
 | 
	
		
			
				|  |  | +        <result property="inquiryOrderId"    column="inquiry_order_id"    />
 | 
	
		
			
				|  |  | +        <result property="courseId"    column="course_id"    />
 | 
	
		
			
				|  |  | +        <result property="diagnosisStatus"    column="diagnosis_status"    />
 | 
	
		
			
				|  |  | +        <result property="tag"    column="tag"    />
 | 
	
		
			
				|  |  | +        <result property="courseName"    column="course_name"    />
 | 
	
		
			
				|  |  | +        <result property="patientCondition"    column="patient_condition"    />
 | 
	
		
			
				|  |  | +        <result property="deptManager"    column="dept_manager"    />
 | 
	
		
			
				|  |  | +        <result property="doctorAdviceJson"    column="doctor_advice_json"    />
 | 
	
		
			
				|  |  | +        <result property="taboo"    column="taboo"    />
 | 
	
		
			
				|  |  | +        <result property="customerRequire"    column="customer_require"    />
 | 
	
		
			
				|  |  | +        <result property="professionalDoctor"    column="professional_doctor"    />
 | 
	
		
			
				|  |  | +        <result property="assistantDoctor"    column="assistant_doctor"    />
 | 
	
		
			
				|  |  | +        <result property="subTime"    column="sub_time"    />
 | 
	
		
			
				|  |  | +    </resultMap>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    <sql id="selectFsInquiryPatientInfoVo">
 | 
	
		
			
				|  |  | +        select id, patient_id, company_user_id, user_id, inquiry_order_id, course_id, diagnosis_status, tag, course_name, patient_condition, dept_manager, doctor_advice_json, taboo, customer_require, professional_doctor, assistant_doctor, sub_time from fs_inquiry_patient_info
 | 
	
		
			
				|  |  | +    </sql>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    <select id="selectFsInquiryPatientInfoInquiryOrderId" parameterType="Long" resultMap="FsInquiryPatientInfoResult">
 | 
	
		
			
				|  |  | +        <include refid="selectFsInquiryPatientInfoVo"/>
 | 
	
		
			
				|  |  | +        where inquiry_order_id = #{inquiryOrderId}
 | 
	
		
			
				|  |  | +    </select>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    <insert id="insertFsInquiryPatientInfo" parameterType="FsInquiryPatientInfo" useGeneratedKeys="true" keyProperty="id">
 | 
	
		
			
				|  |  | +        insert into fs_inquiry_patient_info
 | 
	
		
			
				|  |  | +        <trim prefix="(" suffix=")" suffixOverrides=",">
 | 
	
		
			
				|  |  | +            <if test="patientId != null">patient_id,</if>
 | 
	
		
			
				|  |  | +            <if test="companyUserId != null">company_user_id,</if>
 | 
	
		
			
				|  |  | +            <if test="userId != null">user_id,</if>
 | 
	
		
			
				|  |  | +            <if test="inquiryOrderId != null">inquiry_order_id,</if>
 | 
	
		
			
				|  |  | +            <if test="courseId != null">course_id,</if>
 | 
	
		
			
				|  |  | +            <if test="diagnosisStatus != null">diagnosis_status,</if>
 | 
	
		
			
				|  |  | +            <if test="tag != null">tag,</if>
 | 
	
		
			
				|  |  | +            <if test="courseName != null">course_name,</if>
 | 
	
		
			
				|  |  | +            <if test="patientCondition != null">patient_condition,</if>
 | 
	
		
			
				|  |  | +            <if test="deptManager != null">dept_manager,</if>
 | 
	
		
			
				|  |  | +            <if test="doctorAdviceJson != null">doctor_advice_json,</if>
 | 
	
		
			
				|  |  | +            <if test="taboo != null">taboo,</if>
 | 
	
		
			
				|  |  | +            <if test="customerRequire != null">customer_require,</if>
 | 
	
		
			
				|  |  | +            <if test="professionalDoctor != null">professional_doctor,</if>
 | 
	
		
			
				|  |  | +            <if test="assistantDoctor != null">assistant_doctor,</if>
 | 
	
		
			
				|  |  | +            <if test="subTime != null">sub_time,</if>
 | 
	
		
			
				|  |  | +            <if test="subDoctorId != null">sub_doctor_id</if>
 | 
	
		
			
				|  |  | +        </trim>
 | 
	
		
			
				|  |  | +        <trim prefix="values (" suffix=")" suffixOverrides=",">
 | 
	
		
			
				|  |  | +            <if test="patientId != null">#{patientId},</if>
 | 
	
		
			
				|  |  | +            <if test="companyUserId != null">#{companyUserId},</if>
 | 
	
		
			
				|  |  | +            <if test="userId != null">#{userId},</if>
 | 
	
		
			
				|  |  | +            <if test="inquiryOrderId != null">#{inquiryOrderId},</if>
 | 
	
		
			
				|  |  | +            <if test="courseId != null">#{courseId},</if>
 | 
	
		
			
				|  |  | +            <if test="diagnosisStatus != null">#{diagnosisStatus},</if>
 | 
	
		
			
				|  |  | +            <if test="tag != null">#{tag},</if>
 | 
	
		
			
				|  |  | +            <if test="courseName != null">#{courseName},</if>
 | 
	
		
			
				|  |  | +            <if test="patientCondition != null">#{patientCondition},</if>
 | 
	
		
			
				|  |  | +            <if test="deptManager != null">#{deptManager},</if>
 | 
	
		
			
				|  |  | +            <if test="doctorAdviceJson != null">#{doctorAdviceJson},</if>
 | 
	
		
			
				|  |  | +            <if test="taboo != null">#{taboo},</if>
 | 
	
		
			
				|  |  | +            <if test="customerRequire != null">#{customerRequire},</if>
 | 
	
		
			
				|  |  | +            <if test="professionalDoctor != null">#{professionalDoctor},</if>
 | 
	
		
			
				|  |  | +            <if test="assistantDoctor != null">#{assistantDoctor},</if>
 | 
	
		
			
				|  |  | +            <if test="subTime != null">#{subTime},</if>
 | 
	
		
			
				|  |  | +            <if test="subDoctorId != null">#{subDoctorId},</if>
 | 
	
		
			
				|  |  | +        </trim>
 | 
	
		
			
				|  |  | +    </insert>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    <update id="updateFsInquiryPatientInfo" parameterType="FsInquiryPatientInfo">
 | 
	
		
			
				|  |  | +        update fs_inquiry_patient_info
 | 
	
		
			
				|  |  | +        <trim prefix="SET" suffixOverrides=",">
 | 
	
		
			
				|  |  | +            <if test="patientId != null">patient_id = #{patientId},</if>
 | 
	
		
			
				|  |  | +            <if test="companyUserId != null">company_user_id = #{companyUserId},</if>
 | 
	
		
			
				|  |  | +            <if test="userId != null">user_id = #{userId},</if>
 | 
	
		
			
				|  |  | +            <if test="inquiryOrderId != null">inquiry_order_id = #{inquiryOrderId},</if>
 | 
	
		
			
				|  |  | +            <if test="courseId != null">course_id = #{courseId},</if>
 | 
	
		
			
				|  |  | +            <if test="diagnosisStatus != null">diagnosis_status = #{diagnosisStatus},</if>
 | 
	
		
			
				|  |  | +            <if test="tag != null">tag = #{tag},</if>
 | 
	
		
			
				|  |  | +            <if test="courseName != null">course_name = #{courseName},</if>
 | 
	
		
			
				|  |  | +            <if test="patientCondition != null">patient_condition = #{patientCondition},</if>
 | 
	
		
			
				|  |  | +            <if test="deptManager != null">dept_manager = #{deptManager},</if>
 | 
	
		
			
				|  |  | +            <if test="doctorAdviceJson != null">doctor_advice_json = #{doctorAdviceJson},</if>
 | 
	
		
			
				|  |  | +            <if test="taboo != null">taboo = #{taboo},</if>
 | 
	
		
			
				|  |  | +            <if test="customerRequire != null">customer_require = #{customerRequire},</if>
 | 
	
		
			
				|  |  | +            <if test="professionalDoctor != null">professional_doctor = #{professionalDoctor},</if>
 | 
	
		
			
				|  |  | +            <if test="assistantDoctor != null">assistant_doctor = #{assistantDoctor},</if>
 | 
	
		
			
				|  |  | +            <if test="subTime != null">sub_time = #{subTime},</if>
 | 
	
		
			
				|  |  | +            <if test="subDoctorId != null">sub_doctor_id = #{subDoctorId},</if>
 | 
	
		
			
				|  |  | +        </trim>
 | 
	
		
			
				|  |  | +        where id = #{id}
 | 
	
		
			
				|  |  | +    </update>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    <select id="selectUserAndCompanyUserByInquiryOrderId" resultType="com.fs.his.vo.FsInquiryPatientVO">
 | 
	
		
			
				|  |  | +        SELECT cu.nick_name companyUserName ,u.phone userPhone FROM fs_inquiry_order io
 | 
	
		
			
				|  |  | +        LEFT JOIN company_user cu ON cu.user_id = io.company_user_id
 | 
	
		
			
				|  |  | +        LEFT JOIN fs_user u ON u.user_id = io.user_id
 | 
	
		
			
				|  |  | +        WHERE io.order_id = #{inquiryOrderId}
 | 
	
		
			
				|  |  | +    </select>
 | 
	
		
			
				|  |  | +</mapper>
 |