|
|
@@ -29,45 +29,51 @@
|
|
|
<result property="updateTime" column="update_time" />
|
|
|
<result property="remark" column="remark" />
|
|
|
<result property="doctorId" column="doctor_id" />
|
|
|
+ <result property="companyUserId" column="company_user_id" />
|
|
|
</resultMap>
|
|
|
|
|
|
<sql id="selectFsDoctorPatientVo">
|
|
|
select id, patient_name, sex, age, phone, reception_time, reception_doctor, city,
|
|
|
present_illness, past_history, allergy_history, diagnosis, syndrome_type,
|
|
|
syndrome_regulation, treatment_opinion, precautions, doctor_signature,
|
|
|
- practice_certificate_no, doctor_id,
|
|
|
+ practice_certificate_no, doctor_id,company_user_id,
|
|
|
create_by, create_time, update_by, update_time, remark, del_flag
|
|
|
from fs_doctor_patient
|
|
|
</sql>
|
|
|
|
|
|
<select id="selectFsDoctorPatientList" parameterType="com.fs.his.domain.FsDoctorPatient" resultMap="FsDoctorPatientResult">
|
|
|
- <include refid="selectFsDoctorPatientVo"/>
|
|
|
- where del_flag = '0'
|
|
|
+ select fdp.*,cu.nick_name as companyUserName
|
|
|
+ from fs_doctor_patient fdp
|
|
|
+ left join company_user cu on fdp.company_user_id = cu.user_id
|
|
|
+ where fdp.del_flag = '0'
|
|
|
<if test="patientName != null and patientName != ''">
|
|
|
- and patient_name like concat('%', #{patientName}, '%')
|
|
|
+ and fdp.patient_name like concat('%', #{patientName}, '%')
|
|
|
</if>
|
|
|
<if test="sex != null and sex != ''">
|
|
|
- and sex = #{sex}
|
|
|
+ and fdp.sex = #{sex}
|
|
|
</if>
|
|
|
<if test="phone != null and phone != ''">
|
|
|
- and phone like concat('%', #{phone}, '%')
|
|
|
+ and fdp.phone like concat('%', #{phone}, '%')
|
|
|
</if>
|
|
|
<if test="receptionDoctor != null and receptionDoctor != ''">
|
|
|
- and reception_doctor like concat('%', #{receptionDoctor}, '%')
|
|
|
+ and fdp.reception_doctor like concat('%', #{receptionDoctor}, '%')
|
|
|
</if>
|
|
|
<if test="receptionTime != null">
|
|
|
- and reception_time = #{receptionTime}
|
|
|
+ and fdp.reception_time = #{receptionTime}
|
|
|
</if>
|
|
|
<if test="beginTime != null and beginTime != ''">
|
|
|
- and reception_time >= #{params.beginTime}
|
|
|
+ and fdp.reception_time >= #{beginTime}
|
|
|
</if>
|
|
|
<if test="endTime != null and endTime != ''">
|
|
|
- and reception_time <= #{params.endTime}
|
|
|
+ andfdp.reception_time <= #{endTime}
|
|
|
</if>
|
|
|
<if test="doctorId != null">
|
|
|
- and doctor_id = #{doctorId}
|
|
|
+ and fdp.doctor_id = #{doctorId}
|
|
|
+ </if>
|
|
|
+ <if test="companyUserId != null">
|
|
|
+ and fdp.company_user_id = #{companyUserId}
|
|
|
</if>
|
|
|
- order by reception_time desc
|
|
|
+ order by fdp.reception_time desc
|
|
|
</select>
|
|
|
|
|
|
<select id="selectFsDoctorPatientById" parameterType="Long" resultMap="FsDoctorPatientResult">
|
|
|
@@ -75,20 +81,57 @@
|
|
|
where id = #{id} and del_flag = '0'
|
|
|
</select>
|
|
|
|
|
|
+ <!-- 动态 insert 语句 -->
|
|
|
<insert id="insertFsDoctorPatient" parameterType="com.fs.his.domain.FsDoctorPatient" useGeneratedKeys="true" keyProperty="id">
|
|
|
- insert into fs_doctor_patient (
|
|
|
- patient_name, sex, age, phone, reception_time, reception_doctor, city,
|
|
|
- present_illness, past_history, allergy_history, diagnosis, syndrome_type,
|
|
|
- syndrome_regulation, treatment_opinion, precautions, doctor_signature,
|
|
|
- practice_certificate_no, doctor_id,
|
|
|
- create_by, create_time, remark
|
|
|
- ) values (
|
|
|
- #{patientName}, #{sex}, #{age}, #{phone}, #{receptionTime}, #{receptionDoctor}, #{city},
|
|
|
- #{presentIllness}, #{pastHistory}, #{allergyHistory}, #{diagnosis}, #{syndromeType},
|
|
|
- #{syndromeRegulation}, #{treatmentOpinion}, #{precautions}, #{doctorSignature},
|
|
|
- #{practiceCertificateNo}, #{doctorId},
|
|
|
- #{createBy}, sysdate(), #{remark}
|
|
|
- )
|
|
|
+ insert into fs_doctor_patient
|
|
|
+ <trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="patientName != null">patient_name,</if>
|
|
|
+ <if test="sex != null">sex,</if>
|
|
|
+ <if test="age != null">age,</if>
|
|
|
+ <if test="phone != null">phone,</if>
|
|
|
+ <if test="receptionTime != null">reception_time,</if>
|
|
|
+ <if test="receptionDoctor != null">reception_doctor,</if>
|
|
|
+ <if test="city != null">city,</if>
|
|
|
+ <if test="presentIllness != null">present_illness,</if>
|
|
|
+ <if test="pastHistory != null">past_history,</if>
|
|
|
+ <if test="allergyHistory != null">allergy_history,</if>
|
|
|
+ <if test="diagnosis != null">diagnosis,</if>
|
|
|
+ <if test="syndromeType != null">syndrome_type,</if>
|
|
|
+ <if test="syndromeRegulation != null">syndrome_regulation,</if>
|
|
|
+ <if test="treatmentOpinion != null">treatment_opinion,</if>
|
|
|
+ <if test="precautions != null">precautions,</if>
|
|
|
+ <if test="doctorSignature != null">doctor_signature,</if>
|
|
|
+ <if test="practiceCertificateNo != null">practice_certificate_no,</if>
|
|
|
+ <if test="doctorId != null">doctor_id,</if>
|
|
|
+ <if test="companyUserId != null">company_user_id,</if>
|
|
|
+ <if test="createBy != null">create_by,</if>
|
|
|
+ <if test="remark != null">remark,</if>
|
|
|
+ create_time
|
|
|
+ </trim>
|
|
|
+ <trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="patientName != null">#{patientName},</if>
|
|
|
+ <if test="sex != null">#{sex},</if>
|
|
|
+ <if test="age != null">#{age},</if>
|
|
|
+ <if test="phone != null">#{phone},</if>
|
|
|
+ <if test="receptionTime != null">#{receptionTime},</if>
|
|
|
+ <if test="receptionDoctor != null">#{receptionDoctor},</if>
|
|
|
+ <if test="city != null">#{city},</if>
|
|
|
+ <if test="presentIllness != null">#{presentIllness},</if>
|
|
|
+ <if test="pastHistory != null">#{pastHistory},</if>
|
|
|
+ <if test="allergyHistory != null">#{allergyHistory},</if>
|
|
|
+ <if test="diagnosis != null">#{diagnosis},</if>
|
|
|
+ <if test="syndromeType != null">#{syndromeType},</if>
|
|
|
+ <if test="syndromeRegulation != null">#{syndromeRegulation},</if>
|
|
|
+ <if test="treatmentOpinion != null">#{treatmentOpinion},</if>
|
|
|
+ <if test="precautions != null">#{precautions},</if>
|
|
|
+ <if test="doctorSignature != null">#{doctorSignature},</if>
|
|
|
+ <if test="practiceCertificateNo != null">#{practiceCertificateNo},</if>
|
|
|
+ <if test="doctorId != null">#{doctorId},</if>
|
|
|
+ <if test="companyUserId != null">#{companyUserId},</if>
|
|
|
+ <if test="createBy != null">#{createBy},</if>
|
|
|
+ <if test="remark != null">#{remark},</if>
|
|
|
+ NOW()
|
|
|
+ </trim>
|
|
|
</insert>
|
|
|
|
|
|
<update id="updateFsDoctorPatient" parameterType="com.fs.his.domain.FsDoctorPatient">
|
|
|
@@ -114,6 +157,7 @@
|
|
|
<if test="remark != null">remark = #{remark},</if>
|
|
|
<if test="updateBy != null">update_by = #{updateBy},</if>
|
|
|
<if test="doctorId != null">doctor_id = #{doctorId},</if>
|
|
|
+ <if test="companyUserId != null">company_user_id = #{companyUserId},</if>
|
|
|
update_time = sysdate()
|
|
|
</set>
|
|
|
where id = #{id}
|