<?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.ltkj.hosp.mapper.TjAskMedicalHistoryMapper">
|
|
<resultMap type="TjAskMedicalHistory" id="TjAskMedicalHistoryResult">
|
<result property="askId" column="ask_id"/>
|
<result property="cusId" column="cus_id"/>
|
<result property="cusName" column="cus_name"/>
|
<result property="openId" column="open_id"/>
|
<result property="work" column="work"/>
|
<result property="workStatus" column="work_status"/>
|
<result property="medicalHistory" column="medical_history"/>
|
<result property="chuchao" column="chuchao"/>
|
<result property="jingqi" column="jingqi"/>
|
<result property="zhouqi" column="zhouqi"/>
|
<result property="mociage" column="mociage"/>
|
<result property="zinv" column="zinv"/>
|
<result property="liuchan" column="liuchan"/>
|
<result property="zaochan" column="zaochan"/>
|
<result property="sichan" column="sichan"/>
|
<result property="yichangtai" column="yichangtai"/>
|
<result property="xiyan" column="xiyan"/>
|
<result property="xiyanpinlv" column="xiyanpinlv"/>
|
<result property="xiyanyear" column="xiyanyear"/>
|
<result property="yinjiu" column="yinjiu"/>
|
<result property="yinjiupinlv" column="yinjiupinlv"/>
|
<result property="yinjiuyear" column="yinjiuyear"/>
|
<result property="qita" column="qita"/>
|
<result property="remark" column="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="deleted" column="deleted"/>
|
<result property="fromBy" column="from_by"/>
|
<result property="zzsjj" column="zzsjj" typeHandler="com.ltkj.common.mybatis.JsonStringArrayTypeHandler"/>
|
<result property="contactPoison" column="contact_poison"/>
|
<result property="gongZhong" column="gong_zhong"/>
|
<result property="gongLing" column="gong_ling"/>
|
<result property="jhgl" column="jhgl"/>
|
<result property="medicalHistoryIds" column="medical_history_ids"/>
|
<result property="medicalHistoryOther" column="medical_history_other"/>
|
<result property="dwmc" column="dwmc"/>
|
<result property="ygdw" column="ygdw"/>
|
</resultMap>
|
|
<resultMap id="TjAskMedicalHistoryTjAskHistorysResult" type="TjAskMedicalHistory"
|
extends="TjAskMedicalHistoryResult">
|
<collection property="tjAskHistorysList" notNullColumn="sub_disease_id"
|
javaType="java.util.List" resultMap="TjAskHistorysResult"/>
|
</resultMap>
|
|
<resultMap type="TjAskHistorys" id="TjAskHistorysResult">
|
<result property="diseaseId" column="sub_disease_id"/>
|
<result property="askId" column="sub_ask_id"/>
|
<result property="diseaseName" column="sub_disease_name"/>
|
<result property="diseaseData" column="sub_disease_data"/>
|
<result property="diseaseCompany" column="sub_disease_company"/>
|
<result property="isOk" column="sub_is_ok"/>
|
<result property="remark" column="sub_remark"/>
|
<result property="createBy" column="sub_create_by"/>
|
<result property="createTime" column="sub_create_time"/>
|
<result property="updateBy" column="sub_update_by"/>
|
<result property="updateTime" column="sub_update_time"/>
|
<result property="deleted" column="sub_deleted"/>
|
</resultMap>
|
|
<sql id="selectTjAskMedicalHistoryVo">
|
select ask_id,
|
cus_id,
|
cus_name,
|
work,
|
work_status,
|
medical_history_ids,
|
medical_history,
|
medical_history_other,
|
chuchao,
|
jingqi,
|
zhouqi,
|
mociage,
|
zinv,
|
liuchan,
|
zaochan,
|
sichan,
|
yichangtai,
|
xiyan,
|
xiyanpinlv,
|
xiyanyear,
|
yinjiu,
|
yinjiupinlv,
|
yinjiuyear,
|
qita,
|
remark,
|
create_by,
|
create_time,
|
update_by,
|
update_time,
|
deleted,
|
from_by,
|
zzsjj,
|
contact_poison,
|
gong_zhong,
|
gong_ling,
|
jhgl,
|
dwmc,
|
ygdw
|
from tj_ask_medical_history
|
</sql>
|
|
<select id="selectTjAskMedicalHistoryList" parameterType="TjAskMedicalHistory"
|
resultMap="TjAskMedicalHistoryResult">
|
<include refid="selectTjAskMedicalHistoryVo"/>
|
<where>
|
<if test="cusName != null and cusName != ''">
|
and cus_name like concat('%', #{cusName}, '%')
|
</if>
|
</where>
|
</select>
|
|
<select id="selectTjAskMedicalHistoryByAskId" parameterType="Long"
|
resultMap="TjAskMedicalHistoryTjAskHistorysResult">
|
select a.ask_id,
|
a.cus_id,
|
a.cus_name,
|
a.work,
|
a.work_status,
|
a.medical_history_ids,
|
a.medical_history,
|
a.medical_history_other,
|
a.chuchao,
|
a.jingqi,
|
a.zhouqi,
|
a.mociage,
|
a.zinv,
|
a.liuchan,
|
a.zaochan,
|
a.sichan,
|
a.yichangtai,
|
a.xiyan,
|
a.xiyanpinlv,
|
a.xiyanyear,
|
a.yinjiu,
|
a.yinjiupinlv,
|
a.yinjiuyear,
|
a.qita,
|
a.remark,
|
a.create_by,
|
a.create_time,
|
a.update_by,
|
a.update_time,
|
a.deleted,
|
a.from_by,
|
b.disease_id as
|
sub_disease_id,
|
b.ask_id as
|
sub_ask_id,
|
b.disease_name as
|
sub_disease_name,
|
b.disease_data as
|
sub_disease_data,
|
b.disease_company as
|
sub_disease_company,
|
b.is_ok as
|
sub_is_ok,
|
b.remark as
|
sub_remark,
|
b.create_by as
|
sub_create_by,
|
b.create_time as
|
sub_create_time,
|
b.update_by as
|
sub_update_by,
|
b.update_time as
|
sub_update_time,
|
b.deleted as
|
sub_deleted,
|
a.dwmc,
|
a.ygdw
|
from tj_ask_medical_history a
|
left join tj_ask_historys b on b.ask_id = a.ask_id
|
where a.ask_id = #{askId}
|
</select>
|
|
<insert id="insertTjAskMedicalHistory" parameterType="TjAskMedicalHistory" useGeneratedKeys="true"
|
keyProperty="askId">
|
insert into tj_ask_medical_history
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="cusId != null">cus_id,
|
</if>
|
<if test="cusName != null">cus_name,
|
</if>
|
<if test="work != null">work,
|
</if>
|
<if test="workStatus != null">work_status,
|
</if>
|
<if test="medicalHistoryIds != null">medical_history_ids,
|
</if>
|
<if test="medicalHistory != null">medical_history,
|
</if>
|
<if test="medicalHistoryOther != null">medical_history_other,
|
</if>
|
<if test="chuchao != null">chuchao,
|
</if>
|
<if test="jingqi != null">jingqi,
|
</if>
|
<if test="zhouqi != null">zhouqi,
|
</if>
|
<if test="mociage != null">mociage,
|
</if>
|
<if test="zinv != null">zinv,
|
</if>
|
<if test="liuchan != null">liuchan,
|
</if>
|
<if test="zaochan != null">zaochan,
|
</if>
|
<if test="sichan != null">sichan,
|
</if>
|
<if test="yichangtai != null">yichangtai,
|
</if>
|
<if test="xiyan != null">xiyan,
|
</if>
|
<if test="xiyanpinlv != null">xiyanpinlv,
|
</if>
|
<if test="xiyanyear != null">xiyanyear,
|
</if>
|
<if test="yinjiu != null">yinjiu,
|
</if>
|
<if test="yinjiupinlv != null">yinjiupinlv,
|
</if>
|
<if test="yinjiuyear != null">yinjiuyear,
|
</if>
|
<if test="qita != null">qita,
|
</if>
|
<if test="remark != null">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="deleted != null">deleted,
|
</if>
|
<if test="fromBy != null">from_by,
|
</if>
|
<if test="dwmc != null">dwmc,
|
</if>
|
<if test="ygdw != null">ygdw,
|
</if>
|
</trim>
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<if test="cusId != null">#{cusId},
|
</if>
|
<if test="cusName != null">#{cusName},
|
</if>
|
<if test="work != null">#{work},
|
</if>
|
<if test="workStatus != null">#{workStatus},
|
</if>
|
<if test="medicalHistoryIds != null">#{medicalHistoryIds},
|
</if>
|
<if test="medicalHistory != null">#{medicalHistory},
|
</if>
|
<if test="medicalHistoryOther != null">#{medicalHistoryOther},
|
</if>
|
<if test="chuchao != null">#{chuchao},
|
</if>
|
<if test="jingqi != null">#{jingqi},
|
</if>
|
<if test="zhouqi != null">#{zhouqi},
|
</if>
|
<if test="mociage != null">#{mociage},
|
</if>
|
<if test="zinv != null">#{zinv},
|
</if>
|
<if test="liuchan != null">#{liuchan},
|
</if>
|
<if test="zaochan != null">#{zaochan},
|
</if>
|
<if test="sichan != null">#{sichan},
|
</if>
|
<if test="yichangtai != null">#{yichangtai},
|
</if>
|
<if test="xiyan != null">#{xiyan},
|
</if>
|
<if test="xiyanpinlv != null">#{xiyanpinlv},
|
</if>
|
<if test="xiyanyear != null">#{xiyanyear},
|
</if>
|
<if test="yinjiu != null">#{yinjiu},
|
</if>
|
<if test="yinjiupinlv != null">#{yinjiupinlv},
|
</if>
|
<if test="yinjiuyear != null">#{yinjiuyear},
|
</if>
|
<if test="qita != null">#{qita},
|
</if>
|
<if test="remark != null">#{remark},
|
</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="deleted != null">#{deleted},
|
</if>
|
<if test="fromBy != null">#{fromBy},
|
</if>
|
<if test="dwmc != null">#{dwmc},
|
</if>
|
<if test="ygdw != null">#{ygdw},
|
</if>
|
</trim>
|
</insert>
|
|
<update id="updateTjAskMedicalHistory" parameterType="TjAskMedicalHistory">
|
update tj_ask_medical_history
|
<trim prefix="SET" suffixOverrides=",">
|
<if test="cusId != null">cus_id =
|
#{cusId},
|
</if>
|
<if test="cusName != null">cus_name =
|
#{cusName},
|
</if>
|
<if test="work != null">work =
|
#{work},
|
</if>
|
<if test="workStatus != null">work_status =
|
#{workStatus},
|
</if>
|
<if test="medicalHistoryIds != null">medical_history_ids =
|
#{medicalHistoryIds},
|
</if>
|
<if test="medicalHistory != null">medical_history =
|
#{medicalHistory},
|
</if>
|
<if test="medicalHistoryOther != null">medical_history_other =
|
#{medicalHistoryOther},
|
</if>
|
<if test="chuchao != null">chuchao =
|
#{chuchao},
|
</if>
|
<if test="jingqi != null">jingqi =
|
#{jingqi},
|
</if>
|
<if test="zhouqi != null">zhouqi =
|
#{zhouqi},
|
</if>
|
<if test="mociage != null">mociage =
|
#{mociage},
|
</if>
|
<if test="zinv != null">zinv =
|
#{zinv},
|
</if>
|
<if test="liuchan != null">liuchan =
|
#{liuchan},
|
</if>
|
<if test="zaochan != null">zaochan =
|
#{zaochan},
|
</if>
|
<if test="sichan != null">sichan =
|
#{sichan},
|
</if>
|
<if test="yichangtai != null">yichangtai =
|
#{yichangtai},
|
</if>
|
<if test="xiyan != null">xiyan =
|
#{xiyan},
|
</if>
|
<if test="xiyanpinlv != null">xiyanpinlv =
|
#{xiyanpinlv},
|
</if>
|
<if test="xiyanyear != null">xiyanyear =
|
#{xiyanyear},
|
</if>
|
<if test="yinjiu != null">yinjiu =
|
#{yinjiu},
|
</if>
|
<if test="yinjiupinlv != null">yinjiupinlv =
|
#{yinjiupinlv},
|
</if>
|
<if test="yinjiuyear != null">yinjiuyear =
|
#{yinjiuyear},
|
</if>
|
<if test="qita != null">qita =
|
#{qita},
|
</if>
|
<if test="remark != null">remark =
|
#{remark},
|
</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="deleted != null">deleted =
|
#{deleted},
|
</if>
|
<if test="fromBy != null">from_By =
|
#{fromBy},
|
</if>
|
<if test="dwmc != null">dwmc =
|
#{dwmc},
|
</if>
|
<if test="ygdw != null">ygdw =
|
#{ygdw},
|
</if>
|
</trim>
|
where ask_id = #{askId}
|
</update>
|
|
<delete id="deleteTjAskMedicalHistoryByAskId" parameterType="Long">
|
delete
|
from tj_ask_medical_history
|
where ask_id = #{askId}
|
</delete>
|
|
<delete id="deleteTjAskMedicalHistoryByAskIds" parameterType="String">
|
delete from tj_ask_medical_history where ask_id in
|
<foreach item="askId" collection="array" open="(" separator="," close=")">
|
#{askId}
|
</foreach>
|
</delete>
|
|
<delete id="deleteTjAskHistorysByAskIds" parameterType="String">
|
delete from tj_ask_historys where ask_id in
|
<foreach item="askId" collection="array" open="(" separator="," close=")">
|
#{askId}
|
</foreach>
|
</delete>
|
|
<delete id="deleteTjAskHistorysByAskId" parameterType="Long">
|
delete
|
from tj_ask_historys
|
where ask_id = #{askId}
|
</delete>
|
|
<insert id="batchTjAskHistorys">
|
insert into tj_ask_historys
|
( disease_id , ask_id , disease_name , disease_data , disease_company , is_ok , remark , create_by , create_time
|
, update_by , update_time , deleted) values
|
<foreach item="item" index="index" collection="list" separator=",">
|
( #{item.diseaseId
|
}, #{item.askId
|
}, #{item.diseaseName
|
}, #{item.diseaseData
|
}, #{item.diseaseCompany
|
}, #{item.isOk
|
}, #{item.remark
|
}, #{item.createBy
|
}, #{item.createTime
|
}, #{item.updateBy
|
}, #{item.updateTime
|
}, #{item.deleted
|
})
|
</foreach>
|
</insert>
|
|
|
<select id="selectTjAskMedicalHistoryByTjNum" parameterType="String" resultMap="TjAskMedicalHistoryResult">
|
<include refid="selectTjAskMedicalHistoryVo"/>
|
where tj_num = #{tjNum}
|
and deleted=0
|
</select>
|
</mapper>
|