123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509 |
- <?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.xinxin.topro.inpnurseservice.mysqlmapper.InpGluMapper" >
- <resultMap id="BaseResultMap" type="com.xinxin.topro.inpnurseservice.mysqlmodel.InpGlu" >
- <id column="GLU_ID" property="gluId" jdbcType="INTEGER" />
- <result column="PatientNo" property="patientno" jdbcType="VARCHAR" />
- <result column="HI_ID" property="hiId" jdbcType="INTEGER" />
- <result column="DD_DepDm" property="ddDepdm" jdbcType="VARCHAR" />
- <result column="DW_WardDm" property="dwWarddm" jdbcType="VARCHAR" />
- <result column="DB_BedNo" property="dbBedno" jdbcType="VARCHAR" />
- <result column="GLU_Measure_Time" property="gluMeasureTime" jdbcType="TIMESTAMP" />
- <result column="GLU_Recordor" property="gluRecordor" jdbcType="VARCHAR" />
- <result column="GLU_Record_Time" property="gluRecordTime" jdbcType="TIMESTAMP" />
- <result column="GLU_Source" property="gluSource" jdbcType="INTEGER" />
- <result column="GLU_Value" property="gluValue" jdbcType="VARCHAR" />
- <result column="GLU_Time_Point" property="gluTimePoint" jdbcType="VARCHAR" />
- <result column="GLU_Unit" property="gluUnit" jdbcType="VARCHAR" />
- <result column="GLU_Nurse_Record" property="gluNurseRecord" jdbcType="VARCHAR" />
- <result column="GLU_IsRecord" property="gluIsrecord" jdbcType="INTEGER" />
- <result column="GLU_Operation_Time" property="gluOperationTime" jdbcType="TIMESTAMP" />
- <result column="GLU_Operator" property="gluOperator" jdbcType="VARCHAR" />
- <result column="GLU_IsDel" property="gluIsdel" jdbcType="INTEGER" />
- <result column="GLU_FormerID" property="gluFormerid" jdbcType="INTEGER" />
- <result column="GLU_IsAbnormal" property="gluIsabnormal" jdbcType="INTEGER" />
- <result column="GLU_Abnormal_Reason" property="gluAbnormalReason" jdbcType="VARCHAR" />
- <result column="GLU_Original" property="gluOriginal" jdbcType="VARCHAR" />
- <result column="GLU_Original_ID" property="gluOriginalId" jdbcType="INTEGER" />
- </resultMap>
- <resultMap id="ResultMap" type="com.xinxin.topro.inpnurseservice.vo.GluScheduleVO" >
- <id column="gluId" property="gluId" jdbcType="INTEGER" />
- <result column="visitno" property="visitno" jdbcType="VARCHAR" />
- <result column="bedno" property="bedno" jdbcType="VARCHAR" />
- <result column="ptname" property="ptname" jdbcType="VARCHAR" />
- <result column="chartno" property="chartno" jdbcType="VARCHAR" />
- <result column="gluValue" property="gluValue" jdbcType="VARCHAR" />
- <result column="gluAbnormalReason" property="gluAbnormalReason" jdbcType="VARCHAR" />
- <result column="sort" property="sort" jdbcType="VARCHAR" />
- <result column="measureTime" property="measureTime" jdbcType="TIMESTAMP" />
- <result column="timePoint" property="timePoint" jdbcType="VARCHAR" />
- </resultMap>
- <resultMap id="PDAMap" type="com.xinxin.topro.inpnurseservice.vo.PDAGluVO" >
- <result column="visitno" property="visitno" jdbcType="VARCHAR" />
- <result column="bedno" property="bedno" jdbcType="VARCHAR" />
- <result column="ptname" property="ptname" jdbcType="VARCHAR" />
- <result column="timePoint" property="timePoint" jdbcType="VARCHAR" />
- <result column="gluValue" property="gluValue" jdbcType="VARCHAR" />
- <result column="status" property="status" jdbcType="INTEGER" />
- </resultMap>
- <select id="newSelectSelective" resultMap="BaseResultMap" parameterType="java.lang.String" >
- SELECT
- a.GLU_ID, a.PatientNo, a.HI_ID, a.DD_DepDm, a.DW_WardDm, a.DB_BedNo, a.GLU_Measure_Time, a.GLU_Recordor,
- a.GLU_Record_Time, a.GLU_Source, a.GLU_Time_Point, a.GLU_Unit, g.IRM_Record GLU_Nurse_Record,
- a.GLU_IsRecord, a.GLU_Operation_Time, a.GLU_Operator, a.GLU_IsDel, a.GLU_FormerID, a.GLU_IsAbnormal,
- a.GLU_Abnormal_Reason,
- b.ui_name gluRecordorName,e.SDD_Detail_Name gluTimePointName,
- case when a.glu_abnormal_reason is null or a.glu_abnormal_reason = '' then a.glu_value else f.SDD_Detail_Name end glu_value
- from inp_glu a
- LEFT JOIN sys_userinfo b on a.glu_recordor = b.ui_code
- LEFT JOIN (SELECT SDD_Detail_Code,SDD_Detail_Name from sys_dictionary_detail c
- INNER JOIN sys_dictionary d on c.SD_ID = d.SD_ID and d.SD_DicDM = 'opportunity') e
- on a.GLU_Time_Point = e.SDD_Detail_Code
- LEFT JOIN (SELECT SDD_Detail_Code,SDD_Detail_Name from sys_dictionary_detail c
- INNER JOIN sys_dictionary d on c.SD_ID = d.SD_ID and d.SD_DicDM = 'glu_abnormal_reason') f
- on a.glu_abnormal_reason = f.SDD_Detail_Code
- LEFT JOIN inp_remark g ON a.PatientNo = g.PatientNo AND a.GLU_Measure_Time = g.IRM_Measure_Time
- LEFT JOIN inp_remark_original h ON g.irm_id = h.irm_id
- AND h.iro_original = 'BloodGlucose'
- AND g.irm_isdel = 0
- AND h.iro_isdel = 0
- where 1 = 1
- <if test="patientNo != null" >
- and a.PatientNo = #{patientNo,jdbcType=INTEGER}
- </if>
- <if test="startTime != null" >
- and a.glu_measure_time >= #{startTime,jdbcType=TIMESTAMP}
- </if>
- <if test="endTime != null" >
- and a.glu_measure_time <= #{endTime,jdbcType=TIMESTAMP}
- </if>
- and GLU_IsDel = 0
- ORDER BY GLU_Measure_Time desc
- </select>
- <sql id="Base_Column_List" >
- GLU_ID, PatientNo, HI_ID, DD_DepDm, DW_WardDm, DB_BedNo, GLU_Measure_Time, GLU_Recordor,
- GLU_Record_Time, GLU_Source, GLU_Value, GLU_Time_Point, GLU_Unit, GLU_Nurse_Record,
- GLU_IsRecord, GLU_Operation_Time, GLU_Operator, GLU_IsDel, GLU_FormerID, GLU_IsAbnormal,
- GLU_Abnormal_Reason, GLU_Original, GLU_Original_ID
- </sql>
- <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
- select
- <include refid="Base_Column_List" />
- from inp_glu
- where GLU_ID = #{gluId,jdbcType=INTEGER}
- </select>
- <select id="selectGlu" resultMap="BaseResultMap" >
- SELECT b.IRM_Record GLU_Nurse_Record, a.* from inp_glu a
- LEFT JOIN inp_remark b on a.PatientNo = b.PatientNo
- and a.GLU_Measure_Time = b.IRM_Measure_Time
- and b.IRM_IsDel=0
- where DATE_FORMAT(a.GLU_Measure_Time,'%Y-%m-%d %H:%i') = #{measureTime,jdbcType=VARCHAR}
- and a.GLU_IsDel = 0
- and a.PatientNo = #{patientNo,jdbcType=INTEGER}
- </select>
- <select id="selectSelective" resultMap="BaseResultMap" parameterType="java.lang.String" >
- SELECT
- a.GLU_ID, a.PatientNo, a.HI_ID, a.DD_DepDm, a.DW_WardDm, a.DB_BedNo, a.GLU_Measure_Time, a.GLU_Recordor,
- a.GLU_Record_Time, a.GLU_Source, a.GLU_Time_Point, a.GLU_Unit, p.IRM_Record GLU_Nurse_Record,
- a.GLU_IsRecord, a.GLU_Operation_Time, a.GLU_Operator, a.GLU_IsDel, a.GLU_FormerID, a.GLU_IsAbnormal,
- a.GLU_Abnormal_Reason,
- b.ui_name gluRecordorName,e.SDD_Detail_Name gluTimePointName,
- case when a.glu_abnormal_reason is null or a.glu_abnormal_reason = '' then a.glu_value else f.SDD_Detail_Name end glu_value
- from inp_glu a
- LEFT JOIN sys_userinfo b on a.glu_recordor = b.ui_code
- LEFT JOIN (SELECT SDD_Detail_Code,SDD_Detail_Name from sys_dictionary_detail c
- INNER JOIN sys_dictionary d on c.SD_ID = d.SD_ID and d.SD_DicDM = 'opportunity') e
- on a.GLU_Time_Point = e.SDD_Detail_Code
- LEFT JOIN (SELECT SDD_Detail_Code,SDD_Detail_Name from sys_dictionary_detail c
- INNER JOIN sys_dictionary d on c.SD_ID = d.SD_ID and d.SD_DicDM = 'glu_abnormal_reason') f
- on a.glu_abnormal_reason = f.SDD_Detail_Code
- LEFT JOIN (SELECT g.PatientNo,g.IRM_Measure_Time,g.IRM_Record from inp_remark g
- INNER JOIN inp_remark_original h on g.irm_id = h.irm_id and h.iro_original = 'BloodGlucose'
- and g.irm_isdel = 0 and h.iro_isdel = 0
- ) p on a.PatientNo = p.PatientNo and a.GLU_Measure_Time = p.IRM_Measure_Time
- where 1 = 1
- <if test="patientNo != null" >
- and a.PatientNo = #{patientNo,jdbcType=INTEGER}
- </if>
- <if test="startTime != null" >
- and a.glu_measure_time >= #{startTime,jdbcType=TIMESTAMP}
- </if>
- <if test="endTime != null" >
- and a.glu_measure_time <= #{endTime,jdbcType=TIMESTAMP}
- </if>
- and GLU_IsDel = 0
- ORDER BY GLU_Measure_Time desc
- </select>
- <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
- delete from inp_glu
- where GLU_ID = #{gluId,jdbcType=INTEGER}
- </delete>
- <insert id="insert" parameterType="com.xinxin.topro.inpnurseservice.mysqlmodel.InpGlu" useGeneratedKeys="true" keyColumn="GLU_ID" keyProperty="gluId">
- insert into inp_glu (GLU_ID, PatientNo, HI_ID,
- DD_DepDm, DW_WardDm, DB_BedNo,
- GLU_Measure_Time, GLU_Recordor, GLU_Record_Time,
- GLU_Source, GLU_Value, GLU_Time_Point,
- GLU_Unit, GLU_Nurse_Record, GLU_IsRecord,
- GLU_Operation_Time, GLU_Operator, GLU_IsDel,
- GLU_FormerID, GLU_IsAbnormal, GLU_Abnormal_Reason,
- GLU_Original, GLU_Original_ID
- )
- values (#{gluId,jdbcType=INTEGER}, #{patientno,jdbcType=INTEGER}, #{hiId,jdbcType=INTEGER},
- #{ddDepdm,jdbcType=VARCHAR}, #{dwWarddm,jdbcType=VARCHAR}, #{dbBedno,jdbcType=VARCHAR},
- #{gluMeasureTime,jdbcType=TIMESTAMP}, #{gluRecordor,jdbcType=VARCHAR}, #{gluRecordTime,jdbcType=TIMESTAMP},
- #{gluSource,jdbcType=INTEGER}, #{gluValue,jdbcType=VARCHAR}, #{gluTimePoint,jdbcType=VARCHAR},
- #{gluUnit,jdbcType=VARCHAR}, #{gluNurseRecord,jdbcType=VARCHAR}, #{gluIsrecord,jdbcType=INTEGER},
- #{gluOperationTime,jdbcType=TIMESTAMP}, #{gluOperator,jdbcType=VARCHAR}, #{gluIsdel,jdbcType=INTEGER},
- #{gluFormerid,jdbcType=INTEGER}, #{gluIsabnormal,jdbcType=INTEGER}, #{gluAbnormalReason,jdbcType=VARCHAR},
- #{gluOriginal,jdbcType=VARCHAR}, #{gluOriginalId,jdbcType=INTEGER}
- )
- </insert>
- <insert id="batchInsert" parameterType="java.util.List" useGeneratedKeys="true" keyColumn="GLU_ID" keyProperty="gluId">
- insert into inp_glu (GLU_ID, PatientNo, HI_ID,
- DD_DepDm, DW_WardDm, DB_BedNo,
- GLU_Measure_Time, GLU_Recordor, GLU_Record_Time,
- GLU_Source, GLU_Value, GLU_Time_Point,
- GLU_Unit, GLU_Nurse_Record, GLU_IsRecord,
- GLU_Operation_Time, GLU_Operator, GLU_IsDel,
- GLU_FormerID, GLU_IsAbnormal, GLU_Abnormal_Reason
- )
- values
- <foreach collection="list" item="item" separator=",">
- (#{item.gluId,jdbcType=INTEGER}, #{item.patientno,jdbcType=INTEGER}, #{item.hiId,jdbcType=INTEGER},
- #{item.ddDepdm,jdbcType=VARCHAR}, #{item.dwWarddm,jdbcType=VARCHAR}, #{item.dbBedno,jdbcType=VARCHAR},
- #{item.gluMeasureTime,jdbcType=TIMESTAMP}, #{item.gluRecordor,jdbcType=VARCHAR}, #{item.gluRecordTime,jdbcType=TIMESTAMP},
- #{item.gluSource,jdbcType=INTEGER}, #{item.gluValue,jdbcType=VARCHAR}, #{item.gluTimePoint,jdbcType=VARCHAR},
- #{item.gluUnit,jdbcType=VARCHAR}, #{item.gluNurseRecord,jdbcType=VARCHAR}, #{item.gluIsrecord,jdbcType=INTEGER},
- #{item.gluOperationTime,jdbcType=TIMESTAMP}, #{item.gluOperator,jdbcType=VARCHAR}, #{item.gluIsdel,jdbcType=INTEGER},
- #{item.gluFormerid,jdbcType=INTEGER}, #{item.gluIsabnormal,jdbcType=INTEGER}, #{item.gluAbnormalReason,jdbcType=VARCHAR}
- )
- </foreach>
- </insert>
- <update id="deleteByIds" parameterType="java.util.List" >
- update inp_glu
- set GLU_IsDel = -1
- where GLU_ID in <foreach collection="list" index="index" item="item" separator="," open="(" close=")">
- #{item.gluId,jdbcType=INTEGER}
- </foreach>
- </update>
- <insert id="insertSelective" parameterType="com.xinxin.topro.inpnurseservice.mysqlmodel.InpGlu" useGeneratedKeys="true" keyColumn="GLU_ID" keyProperty="gluId">
- insert into inp_glu
- <trim prefix="(" suffix=")" suffixOverrides="," >
- <if test="gluId != null" >
- GLU_ID,
- </if>
- <if test="patientno != null" >
- PatientNo,
- </if>
- <if test="hiId != null" >
- HI_ID,
- </if>
- <if test="ddDepdm != null" >
- DD_DepDm,
- </if>
- <if test="dwWarddm != null" >
- DW_WardDm,
- </if>
- <if test="dbBedno != null" >
- DB_BedNo,
- </if>
- <if test="gluMeasureTime != null" >
- GLU_Measure_Time,
- </if>
- <if test="gluRecordor != null" >
- GLU_Recordor,
- </if>
- <if test="gluRecordTime != null" >
- GLU_Record_Time,
- </if>
- <if test="gluSource != null" >
- GLU_Source,
- </if>
- <if test="gluValue != null" >
- GLU_Value,
- </if>
- <if test="gluTimePoint != null" >
- GLU_Time_Point,
- </if>
- <if test="gluUnit != null" >
- GLU_Unit,
- </if>
- <if test="gluNurseRecord != null" >
- GLU_Nurse_Record,
- </if>
- <if test="gluIsrecord != null" >
- GLU_IsRecord,
- </if>
- <if test="gluOperationTime != null" >
- GLU_Operation_Time,
- </if>
- <if test="gluOperator != null" >
- GLU_Operator,
- </if>
- <if test="gluIsdel != null" >
- GLU_IsDel,
- </if>
- <if test="gluFormerid != null" >
- GLU_FormerID,
- </if>
- <if test="gluIsabnormal != null" >
- GLU_IsAbnormal,
- </if>
- <if test="gluAbnormalReason != null" >
- GLU_Abnormal_Reason,
- </if>
- <if test="gluOriginal != null" >
- GLU_Original,
- </if>
- <if test="gluOriginalId != null" >
- GLU_Original_ID,
- </if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides="," >
- <if test="gluId != null" >
- #{gluId,jdbcType=INTEGER},
- </if>
- <if test="patientno != null" >
- #{patientno,jdbcType=INTEGER},
- </if>
- <if test="hiId != null" >
- #{hiId,jdbcType=INTEGER},
- </if>
- <if test="ddDepdm != null" >
- #{ddDepdm,jdbcType=VARCHAR},
- </if>
- <if test="dwWarddm != null" >
- #{dwWarddm,jdbcType=VARCHAR},
- </if>
- <if test="dbBedno != null" >
- #{dbBedno,jdbcType=VARCHAR},
- </if>
- <if test="gluMeasureTime != null" >
- #{gluMeasureTime,jdbcType=TIMESTAMP},
- </if>
- <if test="gluRecordor != null" >
- #{gluRecordor,jdbcType=VARCHAR},
- </if>
- <if test="gluRecordTime != null" >
- #{gluRecordTime,jdbcType=TIMESTAMP},
- </if>
- <if test="gluSource != null" >
- #{gluSource,jdbcType=INTEGER},
- </if>
- <if test="gluValue != null" >
- #{gluValue,jdbcType=VARCHAR},
- </if>
- <if test="gluTimePoint != null" >
- #{gluTimePoint,jdbcType=VARCHAR},
- </if>
- <if test="gluUnit != null" >
- #{gluUnit,jdbcType=VARCHAR},
- </if>
- <if test="gluNurseRecord != null" >
- #{gluNurseRecord,jdbcType=VARCHAR},
- </if>
- <if test="gluIsrecord != null" >
- #{gluIsrecord,jdbcType=INTEGER},
- </if>
- <if test="gluOperationTime != null" >
- #{gluOperationTime,jdbcType=TIMESTAMP},
- </if>
- <if test="gluOperator != null" >
- #{gluOperator,jdbcType=VARCHAR},
- </if>
- <if test="gluIsdel != null" >
- #{gluIsdel,jdbcType=INTEGER},
- </if>
- <if test="gluFormerid != null" >
- #{gluFormerid,jdbcType=INTEGER},
- </if>
- <if test="gluIsabnormal != null" >
- #{gluIsabnormal,jdbcType=INTEGER},
- </if>
- <if test="gluAbnormalReason != null" >
- #{gluAbnormalReason,jdbcType=VARCHAR},
- </if>
- <if test="gluOriginal != null" >
- #{gluOriginal,jdbcType=VARCHAR},
- </if>
- <if test="gluOriginalId != null" >
- #{gluOriginalId,jdbcType=INTEGER},
- </if>
- </trim>
- </insert>
- <update id="updateByPrimaryKeySelective" parameterType="com.xinxin.topro.inpnurseservice.mysqlmodel.InpGlu" >
- update inp_glu
- <set >
- <if test="patientno != null" >
- PatientNo = #{patientno,jdbcType=INTEGER},
- </if>
- <if test="hiId != null" >
- HI_ID = #{hiId,jdbcType=INTEGER},
- </if>
- <if test="ddDepdm != null" >
- DD_DepDm = #{ddDepdm,jdbcType=VARCHAR},
- </if>
- <if test="dwWarddm != null" >
- DW_WardDm = #{dwWarddm,jdbcType=VARCHAR},
- </if>
- <if test="dbBedno != null" >
- DB_BedNo = #{dbBedno,jdbcType=VARCHAR},
- </if>
- <if test="gluMeasureTime != null" >
- GLU_Measure_Time = #{gluMeasureTime,jdbcType=TIMESTAMP},
- </if>
- <if test="gluRecordor != null" >
- GLU_Recordor = #{gluRecordor,jdbcType=VARCHAR},
- </if>
- <if test="gluRecordTime != null" >
- GLU_Record_Time = #{gluRecordTime,jdbcType=TIMESTAMP},
- </if>
- <if test="gluSource != null" >
- GLU_Source = #{gluSource,jdbcType=INTEGER},
- </if>
- <if test="gluValue != null" >
- GLU_Value = #{gluValue,jdbcType=VARCHAR},
- </if>
- <if test="gluTimePoint != null" >
- GLU_Time_Point = #{gluTimePoint,jdbcType=VARCHAR},
- </if>
- <if test="gluUnit != null" >
- GLU_Unit = #{gluUnit,jdbcType=VARCHAR},
- </if>
- <if test="gluNurseRecord != null" >
- GLU_Nurse_Record = #{gluNurseRecord,jdbcType=VARCHAR},
- </if>
- <if test="gluIsrecord != null" >
- GLU_IsRecord = #{gluIsrecord,jdbcType=INTEGER},
- </if>
- <if test="gluOperationTime != null" >
- GLU_Operation_Time = #{gluOperationTime,jdbcType=TIMESTAMP},
- </if>
- <if test="gluOperator != null" >
- GLU_Operator = #{gluOperator,jdbcType=VARCHAR},
- </if>
- <if test="gluIsdel != null" >
- GLU_IsDel = #{gluIsdel,jdbcType=INTEGER},
- </if>
- <if test="gluFormerid != null" >
- GLU_FormerID = #{gluFormerid,jdbcType=INTEGER},
- </if>
- <if test="gluIsabnormal != null" >
- GLU_IsAbnormal = #{gluIsabnormal,jdbcType=INTEGER},
- </if>
- <if test="gluAbnormalReason != null" >
- GLU_Abnormal_Reason = #{gluAbnormalReason,jdbcType=VARCHAR},
- </if>
- <if test="gluOriginal != null" >
- GLU_Original = #{gluOriginal,jdbcType=VARCHAR},
- </if>
- <if test="gluOriginalId != null" >
- GLU_Original_ID = #{gluOriginalId,jdbcType=INTEGER},
- </if>
- </set>
- where GLU_ID = #{gluId,jdbcType=INTEGER}
- </update>
- <update id="updateBySource" parameterType="com.xinxin.topro.inpnurseservice.mysqlmodel.InpGlu" >
- update inp_glu
- set GLU_IsDel = #{gluIsdel,jdbcType=INTEGER}
- where GLU_Source = #{gluSource,jdbcType=INTEGER}
- and GLU_Original_ID = #{gluOriginalId,jdbcType=INTEGER}
- and GLU_Original = #{gluOriginal,jdbcType=VARCHAR}
- </update>
- <update id="updateByPrimaryKey" parameterType="com.xinxin.topro.inpnurseservice.mysqlmodel.InpGlu" >
- update inp_glu
- set PatientNo = #{patientno,jdbcType=INTEGER},
- HI_ID = #{hiId,jdbcType=INTEGER},
- DD_DepDm = #{ddDepdm,jdbcType=VARCHAR},
- DW_WardDm = #{dwWarddm,jdbcType=VARCHAR},
- DB_BedNo = #{dbBedno,jdbcType=VARCHAR},
- GLU_Measure_Time = #{gluMeasureTime,jdbcType=TIMESTAMP},
- GLU_Recordor = #{gluRecordor,jdbcType=VARCHAR},
- GLU_Record_Time = #{gluRecordTime,jdbcType=TIMESTAMP},
- GLU_Source = #{gluSource,jdbcType=INTEGER},
- GLU_Value = #{gluValue,jdbcType=VARCHAR},
- GLU_Time_Point = #{gluTimePoint,jdbcType=VARCHAR},
- GLU_Unit = #{gluUnit,jdbcType=VARCHAR},
- GLU_Nurse_Record = #{gluNurseRecord,jdbcType=VARCHAR},
- GLU_IsRecord = #{gluIsrecord,jdbcType=INTEGER},
- GLU_Operation_Time = #{gluOperationTime,jdbcType=TIMESTAMP},
- GLU_Operator = #{gluOperator,jdbcType=VARCHAR},
- GLU_IsDel = #{gluIsdel,jdbcType=INTEGER},
- GLU_FormerID = #{gluFormerid,jdbcType=INTEGER},
- GLU_IsAbnormal = #{gluIsabnormal,jdbcType=INTEGER},
- GLU_Abnormal_Reason = #{gluAbnormalReason,jdbcType=VARCHAR},
- GLU_Original = #{gluOriginal,jdbcType=VARCHAR},
- GLU_Original_ID = #{gluOriginalId,jdbcType=INTEGER}
- where GLU_ID = #{gluId,jdbcType=INTEGER}
- </update>
- <select id="selectGluSchedule" resultMap="ResultMap" >
- SELECT null gluId, a.PatientNo visitno,a.DB_BedNo bedno,b.IP_Med_Rec chartno,b.IP_Name ptname,c.DB_Sort sort,null gluAbnormalReason,null gluValue
- from inp_schedule a INNER JOIN inp_patient b on a.PatientNo = b.IP_PatientNo
- LEFT JOIN dic_bed c on b.DB_BedNo = c.DB_BedNo AND b.DW_WardDm = c.DW_WardDm
- WHERE a.HI_ID = #{Hiid,jdbcType=INTEGER} and a.DW_WardDm = #{wardDm,jdbcType=VARCHAR} and b.IP_Status = 0 and IFNULL(a.IS_IsReview,0) = 0
- and IS_Code = 'BloodGlucose' and date_format(a.IS_Review_Time,'%Y-%m-%d') = #{time,jdbcType=VARCHAR} and a.IS_Time_Point = #{timePoint,jdbcType=VARCHAR}
- UNION ALL
- SELECT a.GLU_ID gluId, a.PatientNo visitno,b.DB_BedNo bedno,b.IP_Med_Rec chartno,b.IP_Name ptname,c.DB_Sort sort,a.GLU_Abnormal_Reason gluAbnormalReason,a.GLU_Value gluValue
- from inp_glu a INNER JOIN inp_patient b on a.PatientNo = b.IP_PatientNo and b.ip_status = 0
- LEFT JOIN dic_bed c on b.DB_BedNo = c.DB_BedNo AND b.DW_WardDm = c.DW_WardDm AND b.DW_WardDm = c.DW_WardDm
- where DATE_FORMAT(GLU_Measure_Time,'%Y-%m-%d %H:%i') = #{measureTime,jdbcType=VARCHAR}
- and GLU_Time_Point = #{timePoint,jdbcType=VARCHAR} and a.GLU_IsDel = 0 and a.DW_WardDm = #{wardDm,jdbcType=VARCHAR}
- </select>
- <select id="selectHasInputGlu" resultMap="ResultMap" >
- SELECT a.GLU_ID gluId, a.PatientNo visitno,b.DB_BedNo bedno,b.IP_Med_Rec chartno,b.IP_Name ptname,c.DB_Sort sort,a.GLU_Abnormal_Reason gluAbnormalReason,a.GLU_Value gluValue
- from inp_glu a INNER JOIN inp_patient b on a.PatientNo = b.IP_PatientNo
- LEFT JOIN dic_bed c on b.DB_BedNo = c.DB_BedNo AND b.DW_WardDm = c.DW_WardDm
- where DATE_FORMAT(GLU_Measure_Time,'%Y-%m-%d %H:%i') = #{measureTime,jdbcType=VARCHAR}
- and GLU_Time_Point = #{timePoint,jdbcType=VARCHAR} and a.GLU_IsDel = 0 and a.DW_WardDm = #{wardDm,jdbcType=VARCHAR}
- </select>
- <select id="selectPDAGlu" resultMap="PDAMap" >
- SELECT e.sdd_detail_name timePoint,
- a.PatientNo visitno,
- b.DB_BedNo bedno,
- b.IP_Name ptname,
- CASE b.IP_Sex WHEN 1 THEN '男' WHEN 2 THEN '女' ELSE '未知' END as gender,
- 1 status,
- c.DB_Sort sort,
- a.GLU_Value gluValue
- from inp_glu a INNER JOIN inp_patient b on a.PatientNo = b.IP_PatientNo and b.ip_status = 0
- LEFT JOIN dic_bed c on b.DB_BedNo = c.DB_BedNo AND b.DW_WardDm = c.DW_WardDm
- left join (select sdd_detail_code,sdd_detail_name from sys_dictionary_detail where sd_id = (select distinct sd_id from sys_dictionary where sd_dicdm = 'opportunity')) e
- on a.GLU_Time_Point = e.sdd_detail_code
- where DATE_FORMAT(GLU_Measure_Time,'%Y-%m-%d') = #{dateTime,jdbcType=VARCHAR}
- and a.GLU_IsDel = 0 and a.DW_WardDm = #{wardDm,jdbcType=VARCHAR} order by sort
- </select>
- <select id="selectGluPatient" resultMap="ResultMap" >
- SELECT a.GLU_ID gluId, a.PatientNo visitno,b.DB_BedNo bedno,b.IP_Med_Rec chartno,b.IP_Name ptname,c.DB_Sort sort,
- a.GLU_Abnormal_Reason gluAbnormalReason,a.GLU_Value gluValue,a.GLU_Measure_Time measureTime,a.glu_time_point timePoint
- from inp_glu a INNER JOIN inp_patient b on a.PatientNo = b.IP_PatientNo
- LEFT JOIN dic_bed c on b.DB_BedNo = c.DB_BedNo AND b.DW_WardDm = c.DW_WardDm
- where a.GLU_Measure_Time
- between
- #{sTime,jdbcType=TIMESTAMP}
- and
- #{eTime,jdbcType=TIMESTAMP}
- <if test="dwWardDm !=null">
- and a.DW_WardDm = #{dwWardDm,jdbcType=VARCHAR}
- </if>
- and a.GLU_IsDel = 0
- <if test="keyword !=null">
- and (b.IP_Name like CONCAT('%', #{keyword,jdbcType=VARCHAR}, '%') or b.IP_Med_Rec like CONCAT('%', #{keyword,jdbcType=VARCHAR}, '%'))
- </if>
- </select>
- <select id="selectLastGlu" resultMap="BaseResultMap">
- SELECT PatientNo, glu_value from inp_glu where glu_id in (
- SELECT max(GLU_ID) FROM inp_glu
- where 1= 1
- <if test="patientNo !=null">
- and PatientNo = #{patientNo,jdbcType=INTEGER}
- </if>
- and glu_measure_time >= #{startTime,jdbcType=TIMESTAMP} and glu_measure_time <= #{endTime,jdbcType=TIMESTAMP}
- and GLU_IsDel = 0 GROUP BY PatientNo )
- </select>
- </mapper>
|