PostDischargePatientManage/postdischarge-manage/src/main/resources/mapper/manage/patientquestionoptionresult/PatientQuestionOptionResultMapper.xml
2026-01-29 11:23:00 +08:00

288 lines
11 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.patientquestionoptionresult.PatientQuestionOptionResultMapper">
<resultMap type="com.xinelu.manage.domain.patientquestionoptionresult.PatientQuestionOptionResult" id="PatientQuestionOptionResult">
<result property="id" column="id"/>
<result property="questionSubjectResultId" column="question_subject_result_id"/>
<result property="questionnaireSubjectId" column="questionnaire_subject_id"/>
<result property="questionName" column="question_name"/>
<result property="optionName" column="option_name"/>
<result property="optionAnswer" column="option_answer"/>
<result property="optionScore" column="option_score"/>
<result property="optionChooseSign" column="option_choose_sign"/>
<result property="optionSubmitAnswer" column="option_submit_answer"/>
<result property="optionSort" column="option_sort"/>
<result property="optionRemark" column="option_remark"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
<result property="contentedFlag" column="contented_flag"/>
<result property="remarkableFlag" column="remarkable_flag"/>
<result property="questionSubjectOptionId" column="question_subject_option_id"/>
</resultMap>
<sql id="selectPatientQuestionOptionResultVo">
select id,
question_subject_result_id,
questionnaire_subject_id,
question_name,
option_name,
option_answer,
option_score,
option_choose_sign,
option_submit_answer,
option_sort,
option_remark,
create_by,
create_time,
update_by,
update_time,
contented_flag,
remarkable_flag,
question_subject_option_id
from patient_question_option_result
</sql>
<select id="selectPatientQuestionOptionResultList" parameterType="PatientQuestionOptionResult"
resultMap="PatientQuestionOptionResult">
<include refid="selectPatientQuestionOptionResultVo"/>
<where>
<if test="questionSubjectResultId != null ">
and question_subject_result_id = #{questionSubjectResultId}
</if>
<if test="questionnaireSubjectId != null ">
and questionnaire_subject_id = #{questionnaireSubjectId}
</if>
<if test="questionName != null and questionName != ''">
and question_name like concat('%', #{questionName}, '%')
</if>
<if test="optionName != null and optionName != ''">
and option_name like concat('%', #{optionName}, '%')
</if>
<if test="optionAnswer != null and optionAnswer != ''">
and option_answer = #{optionAnswer}
</if>
<if test="optionScore != null ">
and option_score = #{optionScore}
</if>
<if test="optionChooseSign != null ">
and option_choose_sign = #{optionChooseSign}
</if>
<if test="optionSubmitAnswer != null and optionSubmitAnswer != ''">
and option_submit_answer = #{optionSubmitAnswer}
</if>
<if test="optionSort != null ">
and option_sort = #{optionSort}
</if>
<if test="optionRemark != null and optionRemark != ''">
and option_remark = #{optionRemark}
</if>
<if test="contentedFlag != null and contentedFlag != ''">
and contented_flag = #{contentedFlag}
</if>
<if test="remarkableFlag != null and remarkableFlag != ''">
and remarkable_flag = #{remarkableFlag}
</if>
<if test="questionSubjectOptionId != null and questionSubjectOptionId != ''">
and question_subject_option_id = #{questionSubjectOptionId}
</if>
</where>
</select>
<select id="selectPatientQuestionOptionResultById" parameterType="Long"
resultMap="PatientQuestionOptionResult">
<include refid="selectPatientQuestionOptionResultVo"/>
where id = #{id}
</select>
<insert id="insertPatientQuestionOptionResult" parameterType="PatientQuestionOptionResult" useGeneratedKeys="true"
keyProperty="id">
insert into patient_question_option_result
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="questionSubjectResultId != null">question_subject_result_id,
</if>
<if test="questionnaireSubjectId != null">questionnaire_subject_id,
</if>
<if test="questionName != null">question_name,
</if>
<if test="optionName != null">option_name,
</if>
<if test="optionAnswer != null">option_answer,
</if>
<if test="optionScore != null">option_score,
</if>
<if test="optionChooseSign != null">option_choose_sign,
</if>
<if test="optionSubmitAnswer != null">option_submit_answer,
</if>
<if test="optionSort != null">option_sort,
</if>
<if test="optionRemark != null">option_remark,
</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>
<if test="contentedFlag != null">contented_flag,
</if>
<if test="remarkableFlag != null">remarkable_flag,
</if>
<if test="questionSubjectOptionId != null">question_subject_option_id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="questionSubjectResultId != null">#{questionSubjectResultId},
</if>
<if test="questionnaireSubjectId != null">#{questionnaireSubjectId},
</if>
<if test="questionName != null">#{questionName},
</if>
<if test="optionName != null">#{optionName},
</if>
<if test="optionAnswer != null">#{optionAnswer},
</if>
<if test="optionScore != null">#{optionScore},
</if>
<if test="optionChooseSign != null">#{optionChooseSign},
</if>
<if test="optionSubmitAnswer != null">#{optionSubmitAnswer},
</if>
<if test="optionSort != null">#{optionSort},
</if>
<if test="optionRemark != null">#{optionRemark},
</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>
<if test="contentedFlag != null">#{contentedFlag},
</if>
<if test="remarkableFlag != null">#{remarkableFlag},
</if>
<if test="questionSubjectOptionId != null">#{questionSubjectOptionId},
</if>
</trim>
</insert>
<insert id="saveQuestionOptionList">
insert into patient_question_option_result(
question_subject_result_id,
questionnaire_subject_id,
question_name,
option_name,
option_answer,
option_score,
option_choose_sign,
option_submit_answer,
option_sort,
option_remark,
create_by,
create_time,
contented_flag,
remarkable_flag,
question_subject_option_id
) values
<foreach item="item" index="index" collection="list" separator=",">
(
#{item.questionSubjectResultId},
#{item.questionnaireSubjectId},
#{item.questionName},
#{item.optionName},
#{item.optionAnswer},
#{item.optionScore},
#{item.optionChooseSign},
#{item.optionSubmitAnswer},
#{item.optionSort},
#{item.optionRemark},
#{item.createBy},
#{item.createTime},
#{item.contentedFlag},
#{item.remarkableFlag},
#{item.questionSubjectOptionId}
)
</foreach>
</insert>
<update id="updatePatientQuestionOptionResult" parameterType="PatientQuestionOptionResult">
update patient_question_option_result
<trim prefix="SET" suffixOverrides=",">
<if test="questionSubjectResultId != null">question_subject_result_id =
#{questionSubjectResultId},
</if>
<if test="questionnaireSubjectId != null">questionnaire_subject_id =
#{questionnaireSubjectId},
</if>
<if test="questionName != null">question_name =
#{questionName},
</if>
<if test="optionName != null">option_name =
#{optionName},
</if>
<if test="optionAnswer != null">option_answer =
#{optionAnswer},
</if>
<if test="optionScore != null">option_score =
#{optionScore},
</if>
<if test="optionChooseSign != null">option_choose_sign =
#{optionChooseSign},
</if>
<if test="optionSubmitAnswer != null">option_submit_answer =
#{optionSubmitAnswer},
</if>
<if test="optionSort != null">option_sort =
#{optionSort},
</if>
<if test="optionRemark != null">option_remark =
#{optionRemark},
</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>
<if test="contentedFlag != null">contented_flag =
#{contentedFlag},
</if>
<if test="remarkableFlag != null">remarkable_flag =
#{remarkableFlag},
</if>
<if test="questionSubjectOptionId != null">question_subject_option_id =
#{questionSubjectOptionId},
</if>
</trim>
where id = #{id}
</update>
<delete id="deletePatientQuestionOptionResultById" parameterType="Long">
delete
from patient_question_option_result
where id = #{id}
</delete>
<delete id="deletePatientQuestionOptionResultByIds" parameterType="String">
delete from patient_question_option_result where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>