<?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.lemon.lifecenter.mapper.PatientSymptomSimMapper">
	<insert id="insertSymptom" parameterType="PatientSymptomSimDTO" useGeneratedKeys="true">
	<![CDATA[
	    INSERT INTO patient_symptom_sim (patient_idx, cough_check, dyspnea_check, cold_fit_check, muscle_pain_check, headache_check, sore_throat_check,
	    	smell_palate_check, fatigue_check, appetite_loss_check, sputum_check, ocin_check, vomiting_check, diarrhea_check, dizziness_check,
	    	nose_check, etc_check, etc_content, recorded_by, create_date)
        VALUE (#{patientIdx}, #{coughCheck}, #{dyspneaCheck}, #{coldFitCheck}, #{musclePainCheck}, #{headacheCheck}, #{soreThroatCheck}, 
        	#{smellPalateCheck}, #{fatigueCheck}, #{appetiteLossCheck}, #{sputumCheck}, #{ocinCheck}, #{vomitingCheck}, #{diarrheaCheck}, #{dizzinessCheck}, 
        	#{noseCheck}, #{etcCheck}, #{etcContent}, #{recordedBy}, NOW())
	]]>
	</insert>
    <select id="selectSymptomCount" parameterType="PatientSymptomSimDTO" resultType="int">
	<![CDATA[
	    SELECT count(*) AS total
		FROM patient_symptom_sim
		WHERE patient_idx = #{patientIdx}
	]]>
    </select>
    <select id="selectSymptomList" parameterType="PatientSymptomSimDTO" resultType="PatientSymptomSimDTO">
    <![CDATA[
	    SELECT	create_date			AS createDate,
	    		cough_check         AS  coughCheck,
				dyspnea_check       AS dyspneaCheck,
				cold_fit_check      AS coldFitCheck,
				muscle_pain_check   AS musclePainCheck,
				headache_check      AS headacheCheck,
				sore_throat_check   AS soreThroatCheck,
				smell_palate_check  AS smellPalateCheck,
				fatigue_check       AS fatigueCheck,
				appetite_loss_check AS appetiteLossCheck,
				sputum_check        AS sputumCheck,
				ocin_check          AS ocinCheck,
				vomiting_check      AS vomitingCheck,
				diarrhea_check      AS diarrheaCheck,
				dizziness_check     AS dizzinessCheck,
				nose_check          AS noseCheck,
				etc_check           AS etcCheck,
				etc_content         AS etcContent,
				recorded_by			AS recordedBy
		FROM patient_symptom_sim
		WHERE 
			patient_idx = #{patientIdx}		
		ORDER BY create_date DESC
	]]>
    </select>
</mapper>