|
|
@@ -7,31 +7,94 @@
|
|
|
<result column="device_id" property="deviceId"/>
|
|
|
<result column="alias" property="alias"/>
|
|
|
<result column="type" property="type"/>
|
|
|
- <result column="total_dose" property="configuration"/>
|
|
|
- <result column="first_dose" property="configuration"/>
|
|
|
- <result column="max_dose" property="configuration"/>
|
|
|
- <result column="append_dose" property="configuration"/>
|
|
|
- <result column="continue_dose" property="configuration"/>
|
|
|
- <result column="self_control_lock_time" property="configuration"/>
|
|
|
+ <result column="total_dose" property="totalDose"/>
|
|
|
+ <result column="first_dose" property="firstDose"/>
|
|
|
+ <result column="max_dose" property="maxDose"/>
|
|
|
+ <result column="append_dose" property="appendDose"/>
|
|
|
+ <result column="continue_dose" property="continueDose"/>
|
|
|
+ <result column="self_control_lock_time" property="selfControlLockTime"/>
|
|
|
+ <result column="patient_code" property="patientCode"/>
|
|
|
|
|
|
</resultMap>
|
|
|
|
|
|
- <select id="selectAll" resultMap="deviceConfigurationResult">
|
|
|
+ <select id="selectByQuery" resultMap="deviceConfigurationResult" parameterType="com.nb.web.service.bus.service.dto.DeviceConfigurationQuery">
|
|
|
SELECT
|
|
|
dc.id AS id,
|
|
|
d.device_id AS device_id,
|
|
|
d.alias AS alias,
|
|
|
d.type AS type,
|
|
|
- dc.total_dose as totalDose,
|
|
|
- dc.first_dose as firstDose,
|
|
|
- dc.max_dose as maxDose,
|
|
|
- dc.append_dose as appendDose,
|
|
|
- dc.continue_dose as continueDose,
|
|
|
- dc.self_control_lock_time as selfControlLockTime
|
|
|
+ dc.total_dose as total_dose,
|
|
|
+ dc.first_dose as first_dose,
|
|
|
+ dc.max_dose as max_dose,
|
|
|
+ dc.append_dose as append_dose,
|
|
|
+ dc.continue_dose as continue_dose,
|
|
|
+ dc.self_control_lock_time as self_control_lock_time,
|
|
|
+ dc.patient_code as patient_code
|
|
|
FROM
|
|
|
- bus_device AS d
|
|
|
+ (select * from bus_device
|
|
|
+ <where>
|
|
|
+ <if test="query.deviceId!=null">
|
|
|
+ device_id = #{query.deviceId}
|
|
|
+ </if>
|
|
|
+ <if test="query.alias!=null">
|
|
|
+ and alias like concat('%',#{query.alias},'%')
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ )AS d
|
|
|
LEFT JOIN bus_device_configuration AS dc ON d.device_id = dc.device_id
|
|
|
+ <where>
|
|
|
+ <if test="query.deviceTypes != null and query.deviceTypes.size > 0">
|
|
|
+ d.type in
|
|
|
+ <foreach item="type" index="index" collection="query.deviceTypes" open="(" separator="," close=")">
|
|
|
+ #{type, jdbcType=VARCHAR}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
ORDER BY
|
|
|
device_id
|
|
|
</select>
|
|
|
+ <insert id="insertNew" parameterType="com.nb.web.api.entity.BusDeviceConfigurationEntity">
|
|
|
+ INSERT INTO bus_device_configuration ( device_id, alias, type, tenant_id, total_dose, first_dose, max_dose, append_dose, continue_dose, self_control_lock_time, patient_code ) SELECT
|
|
|
+ #{entity.deviceId},
|
|
|
+ #{entity.alias},
|
|
|
+ #{entity.type, jdbcType=VARCHAR},
|
|
|
+ #{entity.tenantId},
|
|
|
+ #{entity.totalDose},
|
|
|
+ #{entity.firstDose},
|
|
|
+ #{entity.maxDose},
|
|
|
+ #{entity.appendDose},
|
|
|
+ #{entity.continueDose},
|
|
|
+ #{entity.selfControlLockTime},
|
|
|
+ #{entity.patientCode}
|
|
|
+ FROM
|
|
|
+ DUAL
|
|
|
+ WHERE
|
|
|
+ NOT EXISTS (
|
|
|
+ SELECT
|
|
|
+ device_id
|
|
|
+ FROM
|
|
|
+ bus_device_configuration
|
|
|
+ WHERE
|
|
|
+ device_id = #{entity.deviceId}
|
|
|
+ )
|
|
|
+
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <update id="updateByDeviceId" parameterType="com.nb.web.api.entity.BusDeviceConfigurationEntity">
|
|
|
+ UPDATE bus_device_configuration
|
|
|
+ <set>
|
|
|
+ alias = #{entity.alias},
|
|
|
+ type = #{entity.type, jdbcType=VARCHAR},
|
|
|
+ tenant_id = #{entity.tenantId},
|
|
|
+ total_dose = #{entity.totalDose},
|
|
|
+ first_dose = #{entity.firstDose},
|
|
|
+ max_dose = #{entity.maxDose},
|
|
|
+ append_dose = #{entity.appendDose},
|
|
|
+ continue_dose = #{entity.continueDose},
|
|
|
+ self_control_lock_time = #{entity.selfControlLockTime},
|
|
|
+ patient_code = #{entity.patientCode}
|
|
|
+ </set>
|
|
|
+ WHERE
|
|
|
+ device_id = #{entity.deviceId}
|
|
|
+ </update>
|
|
|
</mapper>
|