针灸质控中心平台
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.
 
 
 
 
 

253 lines
8.4 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,
member_id as memberId,
create_by as createBy,
create_time as createTime
from pms_treatment
where del_flag = 0
<if test="tenantId != null">
AND tenant_id = #{tenantId}
</if>
<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 id_card 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>
<if test="query.name != null and query.name != ''">
AND name = #{query.name}
</if>
order by create_time desc
</select>
<select id="adminQuery" resultType="com.acupuncture.system.domain.vo.PmsTreatmentVo$TreatmentVO"
parameterType="com.acupuncture.system.domain.dto.PmsTreatmentDto$TreatmentQueryDTO">
select
t.id,
t.patient_id as patientId,
t.name,
t.gender,
t.age,
t.birth_date as birthDate,
t.ethnicity,
t.education_years as educationYears,
t.phone,
t.id_card_type as idCardType,
t.id_card as idCard,
t.visit_type as visitType,
t.visit_number as visitNumber,
t.visit_time as visitTime,
t.discharge_time as dischargeTime,
t.doctor,
t.dept_name as deptName,
t.diagnosis_code as diagnosisCode,
t.diagnosis_name as diagnosisName,
t.status,
t.tenant_id as tenantId,
t.create_by as createBy,
t.create_time as createTime,
d.name as tenantName
from v_pms_treatment t
left join
dms_tenant d on t.tenant_id = d.id
where t.del_flag = 0
and t.status = 2
<if test="query.tenantId != null">
AND t.tenant_id = #{query.tenantId}
</if>
<if test="query.keywords != null and query.keywords != ''">
AND (
t.name LIKE CONCAT('%', #{query.keywords}, '%')
OR t.pinyin_full LIKE CONCAT('%', #{query.keywords}, '%')
OR t.pinyin_simple LIKE CONCAT('%', #{query.keywords}, '%')
OR t.phone LIKE CONCAT('%', #{query.keywords}, '%')
or t.id_card LIKE CONCAT('%', #{query.keywords}, '%')
)
</if>
<if test="query.patientId != null">
AND t.patient_id = #{query.patientId}
</if>
<if test="query.gender != null">
AND t.gender = #{query.gender}
</if>
<if test="query.phone != null and query.phone != ''">
AND t.phone = #{query.phone}
</if>
<if test="query.visitType != null">
AND t.visit_type = #{query.visitType}
</if>
<if test="query.startAge != null">
AND t.age &gt;= #{query.startAge}
</if>
<if test="query.endAge != null">
AND t.age &lt;= #{query.endAge}
</if>
<if test="query.status != null">
AND t.status = #{query.status}
</if>
<if test="query.doctor != null and query.doctor != ''">
AND t.doctor = #{query.doctor}
</if>
<if test="query.name != null and query.name != ''">
AND t.name = #{query.name}
</if>
order by t.create_time desc
</select>
<select id="adminQueryTreatment" resultType="com.acupuncture.system.domain.vo.PmsTreatmentVo$TreatmentRecordVO">
select
t.id,
t.patient_id as patientId,
t.name,
t.gender,
t.age,
t.birth_date as birthDate,
t.ethnicity,
t.education_years as educationYears,
t.phone,
t.id_card_type as idCardType,
t.id_card as idCard,
t.visit_type as visitType,
t.visit_number as visitNumber,
t.visit_time as visitTime,
t.discharge_time as dischargeTime,
t.doctor,
t.dept_name as deptName,
t.diagnosis_code as diagnosisCode,
t.diagnosis_name as diagnosisName,
t.status,
t.create_by as createBy,
t.create_time as createTime,
d.name as tenantName
from
v_pms_treatment t
left join
dms_tenant d on t.tenant_id = d.id
where t.del_flag = 0
and t.id = #{id}
</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
del_flag = 0
and 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>
<select id="adminSelectRecord" 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 v_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>