针灸质控中心平台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

115 lines
3.7 KiB

<?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.acupuncture.system.persist.dao.PmsTreatmentDao">
<select id="query" resultType="com.acupuncture.system.domain.vo.PmsTreatmentVo$TreatmentVO"
parameterType="com.acupuncture.system.domain.dto.PmsTreatmentDto$TreatmentQueryDTO">
select
id,
patient_id as patientId,
name,
gender,
age,
birth_date as birthDate,
ethnicity,
education_years as educationYears,
phone,
id_card_type as idCardType,
id_card as idCard,
visit_type as visitType,
visit_number as visitNumber,
visit_time as visitTime,
discharge_time as dischargeTime,
doctor,
dept_name as deptName,
diagnosis_code as diagnosisCode,
diagnosis_name as diagnosisName,
status,
create_by as createBy,
create_time as createTime
from pms_treatment
where del_flag = 0
<if test="query.keywords != null and query.keywords != ''">
AND (
name LIKE CONCAT('%', #{query.keywords}, '%')
OR pinyin_full LIKE CONCAT('%', #{query.keywords}, '%')
OR pinyin_simple LIKE CONCAT('%', #{query.keywords}, '%')
OR phone LIKE CONCAT('%', #{query.keywords}, '%')
OR diagnosis_name LIKE CONCAT('%', #{query.keywords}, '%')
)
</if>
<if test="query.patientId != null">
AND patient_id = #{query.patientId}
</if>
<if test="query.gender != null">
AND gender = #{query.gender}
</if>
<if test="query.phone != null and query.phone != ''">
AND phone = #{query.phone}
</if>
<if test="query.visitType != null">
AND visit_type = #{query.visitType}
</if>
<if test="query.startAge != null">
AND age &gt;= #{query.startAge}
</if>
<if test="query.endAge != null">
AND age &lt;= #{query.endAge}
</if>
<if test="query.status != null">
AND status = #{query.status}
</if>
<if test="query.doctor != null and query.doctor != ''">
AND doctor = #{query.doctor}
</if>
order by create_time desc
</select>
<insert id="batchInsertRecord">
insert into pms_treatment_record
(
id,
treatment_id,
question_code,
answer,
time,
source_id,
create_by,
create_time
)
values
<foreach collection="list" item="item" index="index" separator="," open="" close="">
(
#{item.id},
#{item.treatmentId},
#{item.questionCode},
#{item.answer},
#{item.time},
#{item.sourceId},
#{item.createBy},
#{item.createTime}
)
</foreach>
</insert>
<select id="selectRecord" resultType="com.acupuncture.system.domain.vo.PmsTreatmentVo$TreatmentRecord">
select
id,
treatment_id as treatmentId,
question_code as questionCode,
answer as answerString,
time,
source_id as sourceId,
create_by as createBy,
create_time as createTime
from pms_treatment_record
where treatment_id = #{treatmentId}
<if test="codeList != null and codeList.size() > 0">
and question_code in
<foreach collection="codeList" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
order by source_id asc, id desc
</select>
</mapper>