<?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.lyms.platform.permission.dao.ChildrenRecordMapper">
<resultMap id="ChildrenRecordResultMap" type="com.lyms.platform.permission.model.ChildrenRecord">
<result column="ID" property="id" jdbcType="VARCHAR"/>
<result column="CHILD_ID" property="childId" jdbcType="VARCHAR"/>
<result column="GESTATIONAL_WEEK" property="gestationalWeek" jdbcType="VARCHAR"/>
<result column="CHILDBIRTH_TYPE" property="childbirthType" jdbcType="INTEGER"/>
<result column="FETUS_NUM" property="fetusNum" jdbcType="INTEGER"/>
<result column="BIRTH_NUM" property="birthNum" jdbcType="INTEGER"/>
<result column="WEIGHT" property="weight" jdbcType="FLOAT"/>
<result column="HEIGHT" property="height" jdbcType="FLOAT"/>
<result column="HEAD_CIRCLE" property="headCircle" jdbcType="FLOAT"/>
<result column="APGAR_SCORE_ONE" property="apgarScoreOne" jdbcType="INTEGER"/>
<result column="APGAR_SCORE_FIVE" property="apgarScoreFive" jdbcType="INTEGER"/>
<result column="APGAR_SCORE_TEN" property="apgarScoreTen" jdbcType="INTEGER"/>
<result column="IS_DEFORMITY" property="isDeformity" jdbcType="INTEGER"/>
<result column="BIRTH_HOSPITAL" property="birthHospital" jdbcType="VARCHAR"/>
<result column="MEDICAL_CARD_NUMBER" property="medicalCardNumber" jdbcType="VARCHAR"/>
<result column="INPATIENT_NUMBER" property="inpatientNumber" jdbcType="VARCHAR"/>
<result column="SERVICE_TYPE" property="serviceType" jdbcType="INTEGER"/>
<result column="SERVICE_STATUS" property="serviceStatus" jdbcType="INTEGER"/>
<result column="REMARK" property="remark" jdbcType="VARCHAR"/>
<result column="CREATE_TIME" property="createTime" jdbcType="TIMESTAMP"/>
</resultMap>
<insert id="addChildrenRecord" parameterType="com.lyms.platform.permission.model.ChildrenRecord">
insert into CHILDREN_RECORD (ID,CHILD_ID,GESTATIONAL_WEEK,CHILDBIRTH_TYPE,FETUS_NUM,BIRTH_NUM,WEIGHT,HEIGHT,HEAD_CIRCLE,APGAR_SCORE_ONE,APGAR_SCORE_FIVE,APGAR_SCORE_TEN,IS_DEFORMITY,BIRTH_HOSPITAL,MEDICAL_CARD_NUMBER,INPATIENT_NUMBER,SERVICE_TYPE,SERVICE_STATUS,REMARK,CREATE_TIME) values (#{id},#{childId},#{gestationalWeek},#{childbirthType},#{fetusNum},#{birthNum},#{weight},#{height},#{headCircle},#{apgarScoreOne},#{apgarScoreFive},#{apgarScoreTen},#{isDeformity},#{birthHospital},#{medicalCardNumber},#{inpatientNumber},#{serviceType},#{serviceStatus},#{remark},#{createTime})
</insert>
<update id="updateChildrenRecord" parameterType="com.lyms.platform.permission.model.ChildrenRecord">
update CHILDREN_RECORD
<set>
<if test="id != null and id != ''">
ID = #{id,jdbcType=VARCHAR},
</if>
<if test="childId != null and childId != ''">
CHILD_ID = #{childId,jdbcType=VARCHAR},
</if>
<if test="gestationalWeek != null and gestationalWeek != ''">
GESTATIONAL_WEEK = #{gestationalWeek,jdbcType=VARCHAR},
</if>
<if test="childbirthType != null and childbirthType >= 0">
CHILDBIRTH_TYPE = #{childbirthType,jdbcType=INTEGER},
</if>
<if test="fetusNum != null and fetusNum >= 0">
FETUS_NUM = #{fetusNum,jdbcType=INTEGER},
</if>
<if test="birthNum != null and birthNum >= 0">
BIRTH_NUM = #{birthNum,jdbcType=INTEGER},
</if>
<if test="weight != null">
WEIGHT = #{weight,jdbcType=FLOAT},
</if>
<if test="height != null">
HEIGHT = #{height,jdbcType=FLOAT},
</if>
<if test="headCircle != null">
HEAD_CIRCLE = #{headCircle,jdbcType=FLOAT},
</if>
<if test="apgarScoreOne != null and apgarScoreOne >= 0">
APGAR_SCORE_ONE = #{apgarScoreOne,jdbcType=INTEGER},
</if>
<if test="apgarScoreFive != null and apgarScoreFive >= 0">
APGAR_SCORE_FIVE = #{apgarScoreFive,jdbcType=INTEGER},
</if>
<if test="apgarScoreTen != null and apgarScoreTen >= 0">
APGAR_SCORE_TEN = #{apgarScoreTen,jdbcType=INTEGER},
</if>
<if test="isDeformity != null and isDeformity >= 0">
IS_DEFORMITY = #{isDeformity,jdbcType=INTEGER},
</if>
<if test="birthHospital != null and birthHospital != ''">
BIRTH_HOSPITAL = #{birthHospital,jdbcType=VARCHAR},
</if>
<if test="medicalCardNumber != null and medicalCardNumber != ''">
MEDICAL_CARD_NUMBER = #{medicalCardNumber,jdbcType=VARCHAR},
</if>
<if test="inpatientNumber != null and inpatientNumber != ''">
INPATIENT_NUMBER = #{inpatientNumber,jdbcType=VARCHAR},
</if>
<if test="serviceType != null and serviceType >= 0">
SERVICE_TYPE = #{serviceType,jdbcType=INTEGER},
</if>
<if test="serviceStatus != null and serviceStatus >= 0">
SERVICE_STATUS = #{serviceStatus,jdbcType=INTEGER},
</if>
<if test="remark != null and remark != ''">
REMARK = #{remark,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
CREATE_TIME = #{createTime,jdbcType=TIMESTAMP},
</if>
</set>
</update>
<delete id="deleteChildrenRecord" parameterType="java.lang.String">
</delete>
<select id="getChildrenRecord" resultMap="ChildrenRecordResultMap" parameterType="java.lang.String">
select ID,CHILD_ID,GESTATIONAL_WEEK,CHILDBIRTH_TYPE,FETUS_NUM,BIRTH_NUM,WEIGHT,HEIGHT,HEAD_CIRCLE,APGAR_SCORE_ONE,APGAR_SCORE_FIVE,APGAR_SCORE_TEN,IS_DEFORMITY,BIRTH_HOSPITAL,MEDICAL_CARD_NUMBER,INPATIENT_NUMBER,SERVICE_TYPE,SERVICE_STATUS,REMARK,CREATE_TIME
</select>
<sql id="orderAndLimit">
<if test="sort != null and sort != '' ">
order by ${sort}
<if test="need != null">
limit #{offset, jdbcType=INTEGER} , #{limit, jdbcType=INTEGER}
</if>
</if>
</sql>
<sql id="ChildrenRecordCondition">
<where>
1 = 1
<if test="id != null and id != ''">
and ID = #{id,jdbcType=VARCHAR}
</if>
<if test="childId != null and childId != ''">
and CHILD_ID = #{childId,jdbcType=VARCHAR}
</if>
<if test="gestationalWeek != null and gestationalWeek != ''">
and GESTATIONAL_WEEK = #{gestationalWeek,jdbcType=VARCHAR}
</if>
<if test="childbirthType != null and childbirthType >= 0">
and CHILDBIRTH_TYPE = #{childbirthType,jdbcType=INTEGER}
</if>
<if test="fetusNum != null and fetusNum >= 0">
and FETUS_NUM = #{fetusNum,jdbcType=INTEGER}
</if>
<if test="birthNum != null and birthNum >= 0">
and BIRTH_NUM = #{birthNum,jdbcType=INTEGER}
</if>
<if test="weight != null">
and WEIGHT = #{weight,jdbcType=FLOAT}
</if>
<if test="height != null">
and HEIGHT = #{height,jdbcType=FLOAT}
</if>
<if test="headCircle != null">
and HEAD_CIRCLE = #{headCircle,jdbcType=FLOAT}
</if>
<if test="apgarScoreOne != null and apgarScoreOne >= 0">
and APGAR_SCORE_ONE = #{apgarScoreOne,jdbcType=INTEGER}
</if>
<if test="apgarScoreFive != null and apgarScoreFive >= 0">
and APGAR_SCORE_FIVE = #{apgarScoreFive,jdbcType=INTEGER}
</if>
<if test="apgarScoreTen != null and apgarScoreTen >= 0">
and APGAR_SCORE_TEN = #{apgarScoreTen,jdbcType=INTEGER}
</if>
<if test="isDeformity != null and isDeformity >= 0">
and IS_DEFORMITY = #{isDeformity,jdbcType=INTEGER}
</if>
<if test="birthHospital != null and birthHospital != ''">
and BIRTH_HOSPITAL = #{birthHospital,jdbcType=VARCHAR}
</if>
<if test="medicalCardNumber != null and medicalCardNumber != ''">
and MEDICAL_CARD_NUMBER = #{medicalCardNumber,jdbcType=VARCHAR}
</if>
<if test="inpatientNumber != null and inpatientNumber != ''">
and INPATIENT_NUMBER = #{inpatientNumber,jdbcType=VARCHAR}
</if>
<if test="serviceType != null and serviceType >= 0">
and SERVICE_TYPE = #{serviceType,jdbcType=INTEGER}
</if>
<if test="serviceStatus != null and serviceStatus >= 0">
and SERVICE_STATUS = #{serviceStatus,jdbcType=INTEGER}
</if>
<if test="remark != null and remark != ''">
and REMARK = #{remark,jdbcType=VARCHAR}
</if>
<if test="createTime != null">
and CREATE_TIME = #{createTime,jdbcType=TIMESTAMP}
</if>
</where>
</sql>
<select id="queryChildrenRecord" resultMap="ChildrenRecordResultMap"
parameterType="com.lyms.platform.permission.model.ChildrenRecordQuery">
select
ID,CHILD_ID,GESTATIONAL_WEEK,CHILDBIRTH_TYPE,FETUS_NUM,BIRTH_NUM,WEIGHT,HEIGHT,HEAD_CIRCLE,APGAR_SCORE_ONE,APGAR_SCORE_FIVE,APGAR_SCORE_TEN,IS_DEFORMITY,BIRTH_HOSPITAL,MEDICAL_CARD_NUMBER,INPATIENT_NUMBER,SERVICE_TYPE,SERVICE_STATUS,REMARK,CREATE_TIME
from CHILDREN_RECORD
<include refid="ChildrenRecordCondition"/>
<include refid="orderAndLimit"/>
</select>
<select id="queryChildrenRecordCount" resultType="int"
parameterType="com.lyms.platform.permission.model.ChildrenRecordQuery">
select count(1) from CHILDREN_RECORD
<include refid="ChildrenRecordCondition"/>
</select>
</mapper>