289 lines
11 KiB
XML
289 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.cm.population.dao.mentaldisorders.IMentalDisordersDao">
|
|
|
|
<resultMap id="mentalDisordersDTO" type="com.cm.population.pojo.dtos.mentaldisorders.MentalDisordersDTO">
|
|
<id column="mental_disorders_id" property="mentalDisordersId"/>
|
|
<result column="guardian_id_card" property="guardianIdCard"/>
|
|
<result column="manage_user" property="manageUser"/>
|
|
<result column="manage_user_dictionary_name" property="manageUserDictionaryName"/>
|
|
<result column="treatment" property="treatment"/>
|
|
<result column="last_trouble_date" property="lastTroubleDate"/>
|
|
<result column="trouble_number" property="troubleNumber"/>
|
|
<result column="first_onset_date" property="firstOnsetDate"/>
|
|
<result column="family_economy" property="familyEconomy"/>
|
|
<result column="is_subsistence" property="isSubsistence"/>
|
|
<result column="is_subsistence_dictionary_name" property="isSubsistenceDictionaryName"/>
|
|
<result column="help_info" property="helpInfo"/>
|
|
<result column="help_info_dictionary_name" property="helpInfoDictionaryName"/>
|
|
<result column="guardian_phone" property="guardianPhone"/>
|
|
<result column="risk_level" property="riskLevel"/>
|
|
<result column="receive_org_name" property="receiveOrgName"/>
|
|
<result column="id_card_number" property="idCardNumber"/>
|
|
<result column="diagnosis_type" property="diagnosisType"/>
|
|
<result column="hospitalization" property="hospitalization"/>
|
|
<result column="hospitalization_dictionary_name" property="hospitalizationDictionaryName"/>
|
|
<result column="guardian_name" property="guardianName"/>
|
|
<result column="has_caus_trouble" property="hasCausTrouble"/>
|
|
<result column="has_caus_trouble_dictionary_name" property="hasCausTroubleDictionaryName"/>
|
|
<result column="hospital_name" property="hospitalName"/>
|
|
<result column="full_name" property="fullName"/>
|
|
<result column="gender" property="gender"/>
|
|
<result column="telephone" property="telephone"/>
|
|
<result column="native_place" property="nativePlace"/>
|
|
<result column="current_residence" property="currentResidence"/>
|
|
</resultMap>
|
|
|
|
<!-- 新增肇事肇祸等严重精神障碍患者 -->
|
|
<insert id="saveMentalDisorders" parameterType="map">
|
|
INSERT INTO gen_mental_disorders(
|
|
mental_disorders_id,
|
|
guardian_id_card,
|
|
manage_user,
|
|
treatment,
|
|
last_trouble_date,
|
|
trouble_number,
|
|
first_onset_date,
|
|
family_economy,
|
|
is_subsistence,
|
|
help_info,
|
|
guardian_phone,
|
|
risk_level,
|
|
receive_org_name,
|
|
id_card_number,
|
|
diagnosis_type,
|
|
hospitalization,
|
|
guardian_name,
|
|
has_caus_trouble,
|
|
hospital_name,
|
|
creator,
|
|
gmt_create,
|
|
modifier,
|
|
gmt_modified,
|
|
is_delete
|
|
) VALUES(
|
|
#{mentalDisordersId},
|
|
#{guardianIdCard},
|
|
#{manageUser},
|
|
#{treatment},
|
|
#{lastTroubleDate},
|
|
#{troubleNumber},
|
|
#{firstOnsetDate},
|
|
#{familyEconomy},
|
|
#{isSubsistence},
|
|
#{helpInfo},
|
|
#{guardianPhone},
|
|
#{riskLevel},
|
|
#{receiveOrgName},
|
|
#{idCardNumber},
|
|
#{diagnosisType},
|
|
#{hospitalization},
|
|
#{guardianName},
|
|
#{hasCausTrouble},
|
|
#{hospitalName},
|
|
#{creator},
|
|
#{gmtCreate},
|
|
#{modifier},
|
|
#{gmtModified},
|
|
#{isDelete}
|
|
)
|
|
</insert>
|
|
|
|
<!-- 删除肇事肇祸等严重精神障碍患者 -->
|
|
<update id="removeMentalDisorders" parameterType="map">
|
|
UPDATE
|
|
gen_mental_disorders
|
|
SET
|
|
is_delete = 1,
|
|
modifier = #{modifier},
|
|
gmt_modified = #{gmtModified}
|
|
WHERE
|
|
mental_disorders_id IN
|
|
<foreach collection="mentalDisordersIds" index="index" open="(" separator="," close=")">
|
|
#{mentalDisordersIds[${index}]}
|
|
</foreach>
|
|
</update>
|
|
|
|
<!-- 删除肇事肇祸等严重精神障碍患者(物理) -->
|
|
<update id="deleteMentalDisorders" parameterType="map">
|
|
DELETE FROM
|
|
gen_mental_disorders
|
|
WHERE
|
|
mental_disorders_id IN
|
|
<foreach collection="mentalDisordersIds" index="index" open="(" separator="," close=")">
|
|
#{mentalDisordersIds[${index}]}
|
|
</foreach>
|
|
</update>
|
|
|
|
<!-- 修改肇事肇祸等严重精神障碍患者 -->
|
|
<update id="updateMentalDisorders" parameterType="map">
|
|
UPDATE
|
|
gen_mental_disorders
|
|
SET
|
|
<if test="guardianIdCard != null and guardianIdCard != ''">
|
|
guardian_id_card = #{guardianIdCard},
|
|
</if>
|
|
<if test="manageUser != null and manageUser != ''">
|
|
manage_user = #{manageUser},
|
|
</if>
|
|
<if test="treatment != null and treatment != ''">
|
|
treatment = #{treatment},
|
|
</if>
|
|
<if test="lastTroubleDate != null and lastTroubleDate != ''">
|
|
last_trouble_date = #{lastTroubleDate},
|
|
</if>
|
|
<if test="troubleNumber != null and troubleNumber != ''">
|
|
trouble_number = #{troubleNumber},
|
|
</if>
|
|
<if test="firstOnsetDate != null and firstOnsetDate != ''">
|
|
first_onset_date = #{firstOnsetDate},
|
|
</if>
|
|
<if test="familyEconomy != null and familyEconomy != ''">
|
|
family_economy = #{familyEconomy},
|
|
</if>
|
|
<if test="isSubsistence != null and isSubsistence != ''">
|
|
is_subsistence = #{isSubsistence},
|
|
</if>
|
|
<if test="helpInfo != null and helpInfo != ''">
|
|
help_info = #{helpInfo},
|
|
</if>
|
|
<if test="guardianPhone != null and guardianPhone != ''">
|
|
guardian_phone = #{guardianPhone},
|
|
</if>
|
|
<if test="riskLevel != null and riskLevel != ''">
|
|
risk_level = #{riskLevel},
|
|
</if>
|
|
<if test="receiveOrgName != null and receiveOrgName != ''">
|
|
receive_org_name = #{receiveOrgName},
|
|
</if>
|
|
<if test="idCardNumber != null and idCardNumber != ''">
|
|
id_card_number = #{idCardNumber},
|
|
</if>
|
|
<if test="diagnosisType != null and diagnosisType != ''">
|
|
diagnosis_type = #{diagnosisType},
|
|
</if>
|
|
<if test="hospitalization != null and hospitalization != ''">
|
|
hospitalization = #{hospitalization},
|
|
</if>
|
|
<if test="guardianName != null and guardianName != ''">
|
|
guardian_name = #{guardianName},
|
|
</if>
|
|
<if test="hasCausTrouble != null and hasCausTrouble != ''">
|
|
has_caus_trouble = #{hasCausTrouble},
|
|
</if>
|
|
<if test="hospitalName != null and hospitalName != ''">
|
|
hospital_name = #{hospitalName},
|
|
</if>
|
|
modifier = #{modifier},
|
|
gmt_modified = #{gmtModified}
|
|
WHERE
|
|
mental_disorders_id = #{mentalDisordersId}
|
|
</update>
|
|
|
|
<!-- 肇事肇祸等严重精神障碍患者详情 -->
|
|
<select id="getMentalDisorders" parameterType="map" resultMap="mentalDisordersDTO">
|
|
SELECT
|
|
t1.guardian_id_card,
|
|
t1.manage_user,
|
|
t1.treatment,
|
|
t1.last_trouble_date,
|
|
t1.trouble_number,
|
|
t1.first_onset_date,
|
|
t1.family_economy,
|
|
t1.is_subsistence,
|
|
t1.help_info,
|
|
t1.guardian_phone,
|
|
t1.risk_level,
|
|
t1.receive_org_name,
|
|
t1.id_card_number,
|
|
t1.diagnosis_type,
|
|
t1.hospitalization,
|
|
t1.guardian_name,
|
|
t1.has_caus_trouble,
|
|
t1.hospital_name,
|
|
t1.mental_disorders_id,
|
|
t2.full_name,
|
|
t2.gender,
|
|
t2.telephone
|
|
FROM
|
|
gen_mental_disorders t1
|
|
LEFT JOIN gen_base_population_info t2 ON t1.id_card_number = t2.id_card_number AND t2.is_delete = '0'
|
|
WHERE
|
|
t1.is_delete = 0
|
|
<if test="mentalDisordersId != null and mentalDisordersId != ''">
|
|
AND
|
|
t1.mental_disorders_id = #{mentalDisordersId}
|
|
</if>
|
|
<if test="idCardNumber != null and idCardNumber != ''">
|
|
AND t1.id_card_number = #{idCardNumber}
|
|
</if>
|
|
</select>
|
|
|
|
<!-- 肇事肇祸等严重精神障碍患者列表 -->
|
|
<select id="listMentalDisorders" parameterType="map" resultMap="mentalDisordersDTO">
|
|
SELECT
|
|
t1.guardian_id_card,
|
|
t1.manage_user,
|
|
t1.treatment,
|
|
t1.last_trouble_date,
|
|
t1.trouble_number,
|
|
t1.first_onset_date,
|
|
t1.family_economy,
|
|
t1.is_subsistence,
|
|
t1.help_info,
|
|
t1.guardian_phone,
|
|
t1.risk_level,
|
|
t1.receive_org_name,
|
|
t1.id_card_number,
|
|
t1.diagnosis_type,
|
|
t1.hospitalization,
|
|
t1.guardian_name,
|
|
t1.has_caus_trouble,
|
|
t1.hospital_name,
|
|
t1.mental_disorders_id,
|
|
t2.full_name,
|
|
t2.gender,
|
|
t2.telephone,
|
|
t2.native_place,
|
|
CONCAT(t2.current_residence,t2.current_residence_addr) current_residence
|
|
FROM
|
|
gen_mental_disorders t1
|
|
LEFT JOIN gen_base_population_info t2 ON t1.id_card_number = t2.id_card_number AND t2.is_delete = '0'
|
|
WHERE
|
|
t1.is_delete = 0
|
|
<if test="keywords != null and keywords != ''">
|
|
AND (
|
|
t1.id_card_number LIKE CONCAT('%', #{keywords}, '%')
|
|
OR
|
|
t2.full_name LIKE CONCAT('%', #{keywords}, '%')
|
|
<!-- 这里添加其他条件 -->
|
|
)
|
|
</if>
|
|
<if test="startTime != null and startTime != ''">
|
|
AND
|
|
LEFT(t1.gmt_create, 10) <![CDATA[ >= ]]> #{startTime}
|
|
</if>
|
|
<if test="endTime != null and endTime != ''">
|
|
AND
|
|
LEFT(t1.gmt_create, 10) <![CDATA[ <= ]]> #{endTime}
|
|
</if>
|
|
<if test="mentalDisordersIds != null and mentalDisordersIds.size > 0">
|
|
AND
|
|
t1.mental_disorders_id IN
|
|
<foreach collection="mentalDisordersIds" index="index" open="(" separator="," close=")">
|
|
#{mentalDisordersIds[${index}]}
|
|
</foreach>
|
|
</if>
|
|
</select>
|
|
|
|
<!-- 肇事肇祸等严重精神障碍患者统计 -->
|
|
<select id="countMentalDisorders" parameterType="map" resultType="Integer">
|
|
SELECT
|
|
COUNT(*)
|
|
FROM
|
|
gen_mental_disorders t1
|
|
WHERE
|
|
t1.is_delete = 0
|
|
</select>
|
|
|
|
</mapper> |