123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234 |
- <?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.InpMedOrderInpMapper" >
- <resultMap id="BaseResultMap" type="com.xinxin.topro.inpnurseservice.mysqlmodel.InpMedOrderInp" >
- <id column="IMO_ID" property="imoId" jdbcType="INTEGER" />
- <result column="HI_ID" property="hiId" jdbcType="INTEGER" />
- <result column="PatientNo" property="patientno" jdbcType="VARCHAR" />
- <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="IMO_Order_ID" property="imoOrderId" jdbcType="VARCHAR" />
- <result column="IMO_Item_Code" property="imoItemCode" jdbcType="VARCHAR" />
- <result column="IMO_Order_Name" property="imoOrderName" jdbcType="VARCHAR" />
- <result column="IMO_Item_Explain" property="imoItemExplain" jdbcType="VARCHAR" />
- <result column="IMO_Item_SupID" property="imoItemSupid" jdbcType="VARCHAR" />
- <result column="IMO_Item_OrderID" property="imoItemOrderid" jdbcType="VARCHAR" />
- <result column="IMO_FirstDay_Times" property="imoFirstdayTimes" jdbcType="DOUBLE" />
- <result column="IMO_Entrust" property="imoEntrust" jdbcType="VARCHAR" />
- <result column="IMO_Med_Usage" property="imoMedUsage" jdbcType="VARCHAR" />
- <result column="IMO_IsLong" property="imoIslong" jdbcType="INTEGER" />
- <result column="IMO_Status" property="imoStatus" jdbcType="INTEGER" />
- <result column="IMO_Order_Type" property="imoOrderType" jdbcType="INTEGER" />
- <result column="IMO_Med_Type" property="imoMedType" jdbcType="INTEGER" />
- <result column="IMO_Med_Way" property="imoMedWay" jdbcType="VARCHAR" />
- <result column="IMO_Item_Name" property="imoItemName" jdbcType="VARCHAR" />
- <result column="IMO_Item_Spec" property="imoItemSpec" jdbcType="VARCHAR" />
- <result column="IMO_Item_Dose" property="imoItemDose" jdbcType="DOUBLE" />
- <result column="IMO_Item_DoseUnit" property="imoItemDoseunit" jdbcType="VARCHAR" />
- <result column="IMO_Once_Dose" property="imoOnceDose" jdbcType="DOUBLE" />
- <result column="IMO_Once_DoseUnit" property="imoOnceDoseunit" jdbcType="VARCHAR" />
- <result column="IMO_IsEmer" property="imoIsemer" jdbcType="INTEGER" />
- <result column="IMO_PIVA" property="imoPiva" jdbcType="INTEGER" />
- <result column="IMO_AdviceNo" property="imoAdviceno" jdbcType="VARCHAR" />
- <result column="IMO_IsSkinTest" property="imoIsskintest" jdbcType="INTEGER" />
- <result column="IMO_SkinTest_Result" property="imoSkintestResult" jdbcType="VARCHAR" />
- <result column="IMO_Opener" property="imoOpener" jdbcType="VARCHAR" />
- <result column="IMO_Open_Time" property="imoOpenTime" jdbcType="TIMESTAMP" />
- <result column="IMO_Stoper" property="imoStoper" jdbcType="VARCHAR" />
- <result column="IMO_Stop_Time" property="imoStopTime" jdbcType="TIMESTAMP" />
- <result column="IMO_StopChecker" property="imoStopchecker" jdbcType="VARCHAR" />
- <result column="IMO_StopCheck_Time" property="imoStopcheckTime" jdbcType="TIMESTAMP" />
- <result column="IMO_Revoker" property="imoRevoker" jdbcType="VARCHAR" />
- <result column="IMO_Revoke_Time" property="imoRevokeTime" jdbcType="TIMESTAMP" />
- <result column="IMO_Revoke_Reason" property="imoRevokeReason" jdbcType="VARCHAR" />
- <result column="IMO_Checker" property="imoChecker" jdbcType="VARCHAR" />
- <result column="IMO_Check_Time" property="imoCheckTime" jdbcType="TIMESTAMP" />
- <result column="IMO_Excutor" property="imoExcutor" jdbcType="VARCHAR" />
- <result column="IMO_Excute_Time" property="imoExcuteTime" jdbcType="TIMESTAMP" />
- <result column="IMO_Drug_Days" property="imoDrugDays" jdbcType="INTEGER" />
- <result column="IMO_Rate" property="imoRate" jdbcType="VARCHAR" />
- <result column="IMO_Rate_Unit" property="imoRateUnit" jdbcType="VARCHAR" />
- <result column="IMO_Prescription_Num" property="imoPrescriptionNum" jdbcType="INTEGER" />
- <result column="IMO_Dosage_Form" property="imoDosageForm" jdbcType="VARCHAR" />
- </resultMap>
- <resultMap id="ListResultMap" type="com.xinxin.topro.inpnurseservice.vo.InpMedOrderInpVO" extends="BaseResultMap">
- <result column="adviceNo" property="adviceNo" jdbcType="VARCHAR" />
- </resultMap>
- <sql id="Base_Column_List" >
- IMO_ID, HI_ID, PatientNo, DD_DepDm, DW_WardDm, DB_BedNo, IMO_Order_ID, IMO_Item_Code,
- IMO_Order_Name, IMO_Item_Explain, IMO_Item_SupID, IMO_Item_OrderID, IMO_FirstDay_Times,
- IMO_Entrust, IMO_Med_Usage, IMO_IsLong, IMO_Status, IMO_Order_Type, IMO_Med_Type,
- IMO_Med_Way, IMO_Item_Name, IMO_Item_Spec, IMO_Item_Dose, IMO_Item_DoseUnit, IMO_Once_Dose,
- IMO_Once_DoseUnit, IMO_IsEmer, IMO_PIVA, IMO_AdviceNo, IMO_IsSkinTest, IMO_SkinTest_Result,
- IMO_Opener, IMO_Open_Time, IMO_Stoper, IMO_Stop_Time, IMO_StopChecker, IMO_StopCheck_Time,
- IMO_Revoker, IMO_Revoke_Time, IMO_Revoke_Reason, IMO_Checker, IMO_Check_Time, IMO_Excutor,
- IMO_Excute_Time, IMO_Drug_Days, IMO_Rate, IMO_Rate_Unit, IMO_Prescription_Num, IMO_Dosage_Form
- </sql>
- <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
- select
- <include refid="Base_Column_List" />
- from inp_med_order
- where IMO_ID = #{imoId,jdbcType=INTEGER}
- </select>
- <select id="selectActiveByNamePatient" resultMap="ListResultMap">
- select
- <include refid="Base_Column_List" />,
- (select DMW_Name from dic_med_way dmw where dmw.DMW_IsDel = 0 and dmw.DMW_Code = imo.IMO_AdviceNo) adviceNo
- from inp_med_order imo
- where imo.IMO_Revoke_Time is null
- and imo.PatientNo = #{patientNo,jdbcType=VARCHAR}
- and imo.HI_ID = #{hiId,jdbcType=INTEGER}
- <if test="name != null and name != ''">
- and imo.IMO_Order_Name like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
- </if>
- </select>
- <select id="selectByItemCode" resultType="com.xinxin.topro.inpnurseservice.response.InpMedOrderResponse">
- SELECT
- imo.IMO_ID AS imoId,
- dd.DD_DepName AS dept,
- ip.IP_Med_Rec AS medRec,
- ip.DB_BedNo AS bedNo,
- ip.IP_Name AS ipName,
- CASE
- WHEN ip.IP_Sex='1' THEN '男'
- WHEN ip.IP_Sex='2' THEN '女'
- ELSE '其他'
- END AS sex,
- f_getAge(ip.IP_Birth, ip.IP_Admit_Time) AS age,
- imo.IMO_Order_Name AS orderName,
- CASE
- WHEN imo.IMO_Open_Time IS NULL THEN ''
- ELSE DATE_FORMAT(imo.IMO_Open_Time,'%Y-%m-%d %H:%i:%s')
- END AS begTime,
- CASE
- WHEN imo.IMO_Stop_Time IS NULL THEN ''
- ELSE DATE_FORMAT(imo.IMO_Stop_Time,'%Y-%m-%d %H:%i:%s')
- END AS endTime,
- imo.IMO_Med_Usage AS medUsage,
- su.UI_Name AS openerName
- FROM
- inp_med_order imo
- LEFT JOIN inp_patient ip ON ip.IP_PatientNo = imo.PatientNo
- LEFT JOIN dic_department dd ON dd.DD_DepDm = imo.DD_DepDm
- LEFT JOIN sys_userinfo su ON su.UI_Code = imo.IMO_Opener
- WHERE
- imo.IMO_Item_Code = #{imoItemCode,jdbcType=VARCHAR}
- AND imo.DW_WardDm = #{dwWardDm,jdbcType=VARCHAR}
- AND imo.IMO_Open_Time <![CDATA[>]]> #{begDate}
- AND imo.IMO_Open_Time <![CDATA[<=]]> #{endDate}
- AND imo.IMO_Status IN (1, 2, 3, 4, 5)
- GROUP BY IMO_ID
- ORDER BY imo.IMO_Open_Time DESC
- </select>
- <select id="selectLongByCode" resultMap="BaseResultMap">
- select
- <include refid="Base_Column_List" />
- from inp_med_order
- where IMO_Status IN (1, 2, 3, 4, 5)
- and IMO_IsLong = 1
- and PatientNo = #{patientNo,jdbcType=VARCHAR}
- and HI_ID = #{hiId,jdbcType=INTEGER}
- and IMO_Item_Code = #{imoItemCode,jdbcType=VARCHAR}
- <if test="begDate != null">
- AND (IMO_Stop_Time <![CDATA[>]]> #{begDate,jdbcType=TIMESTAMP} or IMO_Stop_Time is null)
- </if>
- <if test="endDate != null">
- AND IMO_Open_Time <![CDATA[<]]> #{endDate,jdbcType=TIMESTAMP}
- </if>
- order by IMO_Open_Time
- </select>
- <select id="selectPatientNoAndOrderCode" resultMap="BaseResultMap">
- select
- <include refid="Base_Column_List" />
- from inp_med_order a
- where a.PatientNo = #{patientNo,jdbcType=VARCHAR}
- and a.IMO_Status in(1,2,3,4,5)
- AND a.IMO_Item_Code in
- <foreach item='item' index='index' collection='list' open='(' separator=',' close=')'>#{item} </foreach>
- order by a.IMO_Open_Time desc
- </select>
- <select id="selectByHiId" resultMap="BaseResultMap">
- select
- <include refid="Base_Column_List" />
- from inp_med_order
- where IMO_Status <![CDATA[<>]]> -1
- <if test="hiId != null">
- AND HI_ID = #{hiId,jdbcType=INTEGER}
- </if>
- <if test="dwWarddm != null">
- AND DW_WardDm = #{dwWarddm,jdbcType=VARCHAR}
- </if>
- <if test="time != null">
- AND IMO_Stop_Time <![CDATA[>]]> #{time,jdbcType=TIMESTAMP}
- </if>
- <if test="time != null">
- AND IMO_Open_Time <![CDATA[<=]]> #{time,jdbcType=TIMESTAMP}
- </if>
- order by IMO_Open_Time desc
- </select>
- <select id="selectByHiIdOrderCode" resultMap="BaseResultMap">
- select
- <include refid="Base_Column_List" />
- from inp_med_order
- where IMO_Status <![CDATA[<>]]> -1
- <if test="hiId != null">
- AND HI_ID = #{hiId,jdbcType=INTEGER}
- </if>
- <if test="dwWarddm != null">
- AND DW_WardDm = #{dwWarddm,jdbcType=VARCHAR}
- </if>
- <if test="list != null">
- AND IMO_Item_Code in
- <foreach item='item' index='index' collection='list' open='(' separator=',' close=')'>#{item} </foreach>
- </if>
- order by IMO_Open_Time desc
- </select>
- <select id="selectByHiIdNewOrderCode" resultMap="BaseResultMap">
- select
- PatientNo,DW_WardDm, DB_BedNo,IMO_Item_Code,IMO_Med_Usage,IMO_Open_Time,IMO_Stop_Time
- from inp_med_order
- where IMO_Status <![CDATA[<>]]> -1
- <if test="hiId != null">
- AND HI_ID = #{hiId,jdbcType=INTEGER}
- </if>
- <if test="dwWarddm != null">
- AND DW_WardDm = #{dwWarddm,jdbcType=VARCHAR}
- </if>
- <if test="list != null">
- AND IMO_Item_Code in
- <foreach item='item' index='index' collection='list' open='(' separator=',' close=')'>#{item} </foreach>
- </if>
- order by IMO_Open_Time desc
- </select>
- <select id="selectByDwWardDm" resultType="java.lang.String">
- SELECT PatientNo FROM
- inp_med_order
- WHERE
- DW_WardDm = #{dwWardDm,jdbcType=VARCHAR}
- AND IMO_Stop_Time <![CDATA[>]]> #{startTime,jdbcType=TIMESTAMP}
- AND IMO_Open_Time <![CDATA[<=]]> #{endTime,jdbcType=TIMESTAMP}
- AND IMO_Status IN (1, 2, 3, 4, 5)
- </select>
- <select id="selectByPatientNos" resultMap="BaseResultMap">
- select
- <include refid="Base_Column_List" />
- from inp_med_order
- where IMO_Status IN (1, 2, 3, 4, 5)
- AND DW_WardDm = #{dwWarddm,jdbcType=VARCHAR}
- AND PatientNo IN
- <foreach collection="patientNos" index="index" item="item" separator="," open="(" close=")">
- #{item,jdbcType=VARCHAR}
- </foreach>
- order by IMO_Open_Time desc
- </select>
- </mapper>
|