bzd_wsp 4 mesiacov pred
rodič
commit
75181486db

+ 580 - 0
health-system/src/main/resources/mapper/mdyy/DTPCFDJMapper.xml

@@ -0,0 +1,580 @@
+<?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="DTPCFDJMapper">
+
+    <!-- 查询 -->
+    <select id="selectPrescriptionRegistration" parameterType="pd" resultType="pd">
+        select * from s_dtp_prescription_registration where 1=1
+        <if test="hospital != null and hospital != ''">
+            and hospital = #{hospital}
+        </if>
+        <if test="prescribingDoctor != null and prescribingDoctor != ''">
+            and prescribingDoctor = #{prescribingDoctor}
+        </if>
+        <if test="department != null and department != ''">
+            and department = #{department}
+        </if>
+        <if test="prescriptionDiagnosis != null and prescriptionDiagnosis != ''">
+            and prescriptionDiagnosis = #{prescriptionDiagnosis}
+        </if>
+        <if test="attendingDoctor != null and attendingDoctor != ''">
+            and attendingDoctor = #{attendingDoctor}
+        </if>
+        <if test="clinicalDiagnosis != null and clinicalDiagnosis != ''">
+            and clinicalDiagnosis = #{clinicalDiagnosis}
+        </if>
+        <if test="prescriptionImageUrl != null and prescriptionImageUrl != ''">
+            and prescriptionImageUrl = #{prescriptionImageUrl}
+        </if>
+        <if test="prescriptionIssueDate != null">
+            and prescriptionIssueDate = #{prescriptionIssueDate}
+        </if>
+        <if test="saleDate != null">
+            and saleDate = #{saleDate}
+        </if>
+        <if test="registrationDate != null">
+            and registrationDate = #{registrationDate}
+        </if>
+        <if test="drugVarietyCount != null">
+            and drugVarietyCount = #{drugVarietyCount}
+        </if>
+        <if test="drugQuantity != null">
+            and drugQuantity = #{drugQuantity}
+        </if>
+        <if test="invoiceCode != null and invoiceCode != ''">
+            and invoiceCode = #{invoiceCode}
+        </if>
+        <if test="invoiceImageUrl != null and invoiceImageUrl != ''">
+            and invoiceImageUrl = #{invoiceImageUrl}
+        </if>
+        <if test="registerPharmacistName != null and registerPharmacistName != ''">
+            and registerPharmacistName = #{registerPharmacistName}
+        </if>
+        <if test="registrant != null and registrant != ''">
+            and registrant = #{registrant}
+        </if>
+        <if test="reviewingName != null and reviewingName != ''">
+            and reviewingName = #{reviewingName}
+        </if>
+        <if test="prescriptionNumber != null and prescriptionNumber != ''">
+            and prescriptionNumber = #{prescriptionNumber}
+        </if>
+        <if test="salesOrderNumber != null and salesOrderNumber != ''">
+            and salesOrderNumber = #{salesOrderNumber}
+        </if>
+        <if test="patientId != null">
+            and patientId = #{patientId}
+        </if>
+        <if test="patientName != null and patientName != ''">
+            and patientName = #{patientName}
+        </if>
+        <if test="patientPhone != null and patientPhone != ''">
+            and patientPhone = #{patientPhone}
+        </if>
+        <if test="gender != null">
+            and gender = #{gender}
+        </if>
+        <if test="age != null">
+            and age = #{age}
+        </if>
+        <if test="drugsLinkId != null">
+            and drugsLinkId = #{drugsLinkId}
+        </if>
+        <if test="status != null">
+            and status = #{status}
+        </if>
+        <if test="reviewStatus != null">
+            and reviewStatus = #{reviewStatus}
+        </if>
+        <if test="prescriptionType != null">
+            and prescriptionType = #{prescriptionType}
+        </if>
+        <if test="source != null and source != ''">
+            and source = #{source}
+        </if>
+        <if test="drugRoute != null and drugRoute != ''">
+            and drugRoute = #{drugRoute}
+        </if>
+        <if test="storeId != null and storeId != ''">
+            and storeId = #{storeId}
+        </if>
+        <if test="storeName != null and storeName != ''">
+            and storeName = #{storeName}
+        </if>
+        <if test="createdBy != null and createdBy != ''">
+            and createdBy = #{createdBy}
+        </if>
+        <if test="createdTime != null">
+            and createdTime = #{createdTime}
+        </if>
+        <if test="updatedBy != null and updatedBy != ''">
+            and updatedBy = #{updatedBy}
+        </if>
+        <if test="updatedTime != null">
+            and updatedTime = #{updatedTime}
+        </if>
+        <if test="remarks != null and remarks != ''">
+            and remarks = #{remarks}
+        </if>
+    </select>
+
+    <!-- 根据patientId查询单条记录 -->
+    <select id="selectOneByPatientId" parameterType="pd" resultType="pd">
+        SELECT *
+        FROM s_dtp_prescription_registration t1
+        WHERE patientId = #{patientId}
+          AND registrationDate = (
+            SELECT MAX(registrationDate)
+            FROM s_dtp_prescription_registration
+            WHERE patientId = #{patientId}
+        )
+    </select>
+    <!-- 根据prescriptionNumber查询多条条记录 -->
+    <select id="selectListRecordByPrescriptionNumber" parameterType="pd" resultType="pd">
+        select * from s_dtp_drug_purchase_record where prescriptionNumber=#{prescriptionNumber}
+    </select>
+    <!-- 根据ID查询单条记录 -->
+    <select id="selectOneById" parameterType="pd" resultType="pd">
+        select * from s_dtp_prescription_registration where id=#{id}
+    </select>
+    <!-- 插入新记录 -->
+    <insert id="insertPrescriptionRegistration" parameterType="pd">
+        insert into s_dtp_prescription_registration
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="hospital != null and hospital != ''">
+                hospital,
+            </if>
+            <if test="prescribingDoctor != null and prescribingDoctor != ''">
+                prescribingDoctor,
+            </if>
+            <if test="department != null and department != ''">
+                department,
+            </if>
+            <if test="prescriptionDiagnosis != null and prescriptionDiagnosis != ''">
+                prescriptionDiagnosis,
+            </if>
+            <if test="attendingDoctor != null and attendingDoctor != ''">
+                attendingDoctor,
+            </if>
+            <if test="clinicalDiagnosis != null and clinicalDiagnosis != ''">
+                clinicalDiagnosis,
+            </if>
+            <if test="prescriptionImageUrl != null and prescriptionImageUrl != ''">
+                prescriptionImageUrl,
+            </if>
+            <if test="prescriptionIssueDate != null">
+                prescriptionIssueDate,
+            </if>
+            <if test="saleDate != null">
+                saleDate,
+            </if>
+            <if test="registrationDate != null">
+                registrationDate,
+            </if>
+            <if test="drugVarietyCount != null">
+                drugVarietyCount,
+            </if>
+            <if test="drugQuantity != null">
+                drugQuantity,
+            </if>
+            <if test="invoiceCode != null and invoiceCode != ''">
+                invoiceCode,
+            </if>
+            <if test="invoiceImageUrl != null and invoiceImageUrl != ''">
+                invoiceImageUrl,
+            </if>
+            <if test="registerPharmacistName != null and registerPharmacistName != ''">
+                registerPharmacistName,
+            </if>
+            <if test="registrant != null and registrant != ''">
+                registrant,
+            </if>
+            <if test="reviewingName != null and reviewingName != ''">
+                reviewingName,
+            </if>
+            <if test="prescriptionNumber != null and prescriptionNumber != ''">
+                prescriptionNumber,
+            </if>
+            <if test="salesOrderNumber != null and salesOrderNumber != ''">
+                salesOrderNumber,
+            </if>
+            <if test="patientId != null">
+                patientId,
+            </if>
+            <if test="patientName != null and patientName != ''">
+                patientName,
+            </if>
+            <if test="patientPhone != null and patientPhone != ''">
+                patientPhone,
+            </if>
+            <if test="gender != null  and gender != ''">
+                gender,
+            </if>
+            <if test="age != null  and age != ''">
+                age,
+            </if>
+            <if test="drugsLinkId != null  and drugsLinkId != ''" >
+                drugsLinkId,
+            </if>
+            <if test="status != null  and status != ''">
+                status,
+            </if>
+            <if test="reviewStatus != null  and reviewStatus != ''">
+                reviewStatus,
+            </if>
+            <if test="prescriptionType != null  and prescriptionType != ''">
+                prescriptionType,
+            </if>
+            <if test="source != null and source != ''">
+                source,
+            </if>
+            <if test="drugRoute != null and drugRoute != ''">
+                drugRoute,
+            </if>
+            <if test="storeId != null and storeId != ''">
+                storeId,
+            </if>
+            <if test="storeName != null and storeName != ''">
+                storeName,
+            </if>
+            <if test="createdBy != null and createdBy != ''">
+                createdBy,
+            </if>
+            <if test="createdTime != null">
+                createdTime,
+            </if>
+            <if test="updatedBy != null and updatedBy != ''">
+                updatedBy,
+            </if>
+            <if test="updatedTime != null">
+                updatedTime,
+            </if>
+            <if test="remarks != null and remarks != ''">
+                remarks
+            </if>
+        </trim>
+        VALUES
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="hospital != null and hospital != ''">
+                #{hospital},
+            </if>
+            <if test="prescribingDoctor != null and prescribingDoctor != ''">
+                #{prescribingDoctor},
+            </if>
+            <if test="department != null and department != ''">
+                #{department},
+            </if>
+            <if test="prescriptionDiagnosis != null and prescriptionDiagnosis != ''">
+                #{prescriptionDiagnosis},
+            </if>
+            <if test="attendingDoctor != null and attendingDoctor != ''">
+                #{attendingDoctor},
+            </if>
+            <if test="clinicalDiagnosis != null and clinicalDiagnosis != ''">
+                #{clinicalDiagnosis},
+            </if>
+            <if test="prescriptionImageUrl != null and prescriptionImageUrl != ''">
+                #{prescriptionImageUrl},
+            </if>
+            <if test="prescriptionIssueDate != null">
+                #{prescriptionIssueDate},
+            </if>
+            <if test="saleDate != null">
+                #{saleDate},
+            </if>
+            <if test="registrationDate != null">
+                #{registrationDate},
+            </if>
+            <if test="drugVarietyCount != null">
+                #{drugVarietyCount},
+            </if>
+            <if test="drugQuantity != null">
+                #{drugQuantity},
+            </if>
+            <if test="invoiceCode != null and invoiceCode != ''">
+                #{invoiceCode},
+            </if>
+            <if test="invoiceImageUrl != null and invoiceImageUrl != ''">
+                #{invoiceImageUrl},
+            </if>
+            <if test="registerPharmacistName != null and registerPharmacistName != ''">
+                #{registerPharmacistName},
+            </if>
+            <if test="registrant != null and registrant != ''">
+                #{registrant},
+            </if>
+            <if test="reviewingName != null and reviewingName != ''">
+                #{reviewingName},
+            </if>
+            <if test="prescriptionNumber != null and prescriptionNumber != ''">
+                #{prescriptionNumber},
+            </if>
+            <if test="salesOrderNumber != null and salesOrderNumber != ''">
+                #{salesOrderNumber},
+            </if>
+            <if test="patientId != null">
+                #{patientId},
+            </if>
+            <if test="patientName != null and patientName != ''">
+                #{patientName},
+            </if>
+            <if test="patientPhone != null and patientPhone != ''">
+                #{patientPhone},
+            </if>
+            <if test="gender != null  and gender != ''">
+                #{gender},
+            </if>
+            <if test="age != null  and age != ''">
+                #{age},
+            </if>
+            <if test="drugsLinkId != null  and drugsLinkId != ''" >
+                #{drugsLinkId},
+            </if>
+            <if test="status != null  and status != ''">
+                #{status},
+            </if>
+            <if test="reviewStatus != null  and reviewStatus != ''">
+                #{reviewStatus},
+            </if>
+            <if test="prescriptionType != null  and prescriptionType != ''">
+                #{prescriptionType},
+            </if>
+            <if test="source != null and source != ''">
+                #{source},
+            </if>
+            <if test="drugRoute != null and drugRoute != ''">
+                #{drugRoute},
+            </if>
+            <if test="storeId != null and storeId != ''">
+                #{storeId},
+            </if>
+            <if test="storeName != null and storeName != ''">
+                #{storeName},
+            </if>
+            <if test="createdBy != null and createdBy != ''">
+                #{createdBy},
+            </if>
+            <if test="createdTime != null">
+                #{createdTime},
+            </if>
+            <if test="updatedBy != null and updatedBy != ''">
+                #{updatedBy},
+            </if>
+            <if test="updatedTime != null">
+                #{updatedTime},
+            </if>
+            <if test="remarks != null and remarks != ''">
+                #{remarks}
+            </if>
+        </trim>
+    </insert>
+
+    <!-- 更新记录 -->
+    <update id="updatePrescriptionRegistration" parameterType="pd">
+        update s_dtp_prescription_registration
+        <trim prefix="SET " suffix="" prefixOverrides="," suffixOverrides=",">
+            <if test="hospital != null and hospital != ''">
+                hospital = #{hospital},
+            </if>
+            <if test="prescribingDoctor != null and prescribingDoctor != ''">
+                prescribingDoctor = #{prescribingDoctor},
+            </if>
+            <if test="department != null and department != ''">
+                department = #{department},
+            </if>
+            <if test="prescriptionDiagnosis != null and prescriptionDiagnosis != ''">
+                prescriptionDiagnosis = #{prescriptionDiagnosis},
+            </if>
+            <if test="attendingDoctor != null and attendingDoctor != ''">
+                attendingDoctor = #{attendingDoctor},
+            </if>
+            <if test="clinicalDiagnosis != null and clinicalDiagnosis != ''">
+                clinicalDiagnosis = #{clinicalDiagnosis},
+            </if>
+            <if test="prescriptionImageUrl != null and prescriptionImageUrl != ''">
+                prescriptionImageUrl = #{prescriptionImageUrl},
+            </if>
+            <if test="prescriptionIssueDate != null">
+                prescriptionIssueDate = #{prescriptionIssueDate},
+            </if>
+            <if test="saleDate != null">
+                saleDate = #{saleDate},
+            </if>
+            <if test="registrationDate != null">
+                registrationDate = #{registrationDate},
+            </if>
+            <if test="drugVarietyCount != null">
+                drugVarietyCount = #{drugVarietyCount},
+            </if>
+            <if test="drugQuantity != null">
+                drugQuantity = #{drugQuantity},
+            </if>
+            <if test="invoiceCode != null and invoiceCode != ''">
+                invoiceCode = #{invoiceCode},
+            </if>
+            <if test="invoiceImageUrl != null and invoiceImageUrl != ''">
+                invoiceImageUrl = #{invoiceImageUrl},
+            </if>
+            <if test="registerPharmacistName != null and registerPharmacistName != ''">
+                registerPharmacistName = #{registerPharmacistName},
+            </if>
+            <if test="registrant != null and registrant != ''">
+                registrant = #{registrant},
+            </if>
+            <if test="reviewingName != null and reviewingName != ''">
+                reviewingName = #{reviewingName},
+            </if>
+            <if test="prescriptionNumber != null and prescriptionNumber != ''">
+                prescriptionNumber = #{prescriptionNumber},
+            </if>
+            <if test="salesOrderNumber != null and salesOrderNumber != ''">
+                salesOrderNumber = #{salesOrderNumber},
+            </if>
+            <if test="patientId != null">
+                patientId = #{patientId},
+            </if>
+            <if test="patientName != null and patientName != ''">
+                patientName = #{patientName},
+            </if>
+            <if test="patientPhone != null and patientPhone != ''">
+                patientPhone = #{patientPhone},
+            </if>
+            <if test="gender != null">
+                gender = #{gender},
+            </if>
+            <if test="age != null">
+                age = #{age},
+            </if>
+            <if test="drugsLinkId != null">
+                drugsLinkId = #{drugsLinkId},
+            </if>
+            <if test="status != null">
+                status = #{status},
+            </if>
+            <if test="reviewStatus != null">
+                reviewStatus = #{reviewStatus},
+            </if>
+            <if test="prescriptionType != null">
+                prescriptionType = #{prescriptionType},
+            </if>
+            <if test="source != null and source != ''">
+                source = #{source},
+            </if>
+            <if test="drugRoute != null and drugRoute != ''">
+                drugRoute = #{drugRoute},
+            </if>
+            <if test="storeId != null and storeId != ''">
+                storeId = #{storeId},
+            </if>
+            <if test="storeName != null and storeName != ''">
+                storeName = #{storeName},
+            </if>
+            <if test="createdBy != null and createdBy != ''">
+                createdBy = #{createdBy},
+            </if>
+            <if test="createdTime != null">
+                createdTime = #{createdTime},
+            </if>
+            <if test="updatedBy != null and updatedBy != ''">
+                updatedBy = #{updatedBy},
+            </if>
+            <if test="updatedTime != null">
+                updatedTime = #{updatedTime},
+            </if>
+            <if test="remarks != null and remarks != ''">
+                remarks = #{remarks}
+            </if>
+        </trim>
+        <if test="id != null">
+            where id = #{id}
+        </if>
+    </update>
+
+
+    <insert id="batchAddDrugPurchaseRecord" parameterType="java.util.List">
+        INSERT INTO s_dtp_drug_purchase_record
+        <trim prefix="(" suffix=")" prefixOverrides="," suffixOverrides=",">
+            <if test="dataList[0].mdmCode != null and dataList[0].mdmCode != ''">mdmCode,</if>
+            <if test="dataList[0].productName != null and dataList[0].productName != ''">productName,</if>
+            <if test="dataList[0].genericName != null and dataList[0].genericName != ''">genericName,</if>
+            <if test="dataList[0].specification != null and dataList[0].specification != ''">specification,</if>
+            <if test="dataList[0].manufacturerShortName != null and dataList[0].manufacturerShortName != ''">manufacturerShortName,</if>
+            <if test="dataList[0].administrationMethod != null and dataList[0].administrationMethod != ''">administrationMethod,</if>
+            <if test="dataList[0].packageQuantity != null">packageQuantity,</if>
+            <if test="dataList[0].singleDoseValue != null">singleDoseValue,</if>
+            <if test="dataList[0].singleDoseUnit != null and dataList[0].singleDoseUnit != ''">singleDoseUnit,</if>
+            <if test="dataList[0].dosageFrequency != null and dataList[0].dosageFrequency != ''">dosageFrequency,</if>
+            <if test="dataList[0].dosageFrequencyDays != null">dosageFrequencyDays,</if>
+            <if test="dataList[0].dvalueDays != null and  dataList[0].dvalueDays != ''">dvalueDays,</if>
+            <if test="dataList[0].medicationRoute != null and dataList[0].medicationRoute != ''">medicationRoute,</if>
+            <if test="dataList[0].sales != null and dataList[0].sales != ''">sales,</if>
+            <if test="dataList[0].prescriptionNumber != null and dataList[0].prescriptionNumber != ''">prescriptionNumber,</if>
+            <if test="dataList[0].prescriptionDate != null">prescriptionDate,</if>
+            <if test="dataList[0].hospital != null and dataList[0].hospital != ''">hospital,</if>
+            <if test="dataList[0].prescribingDoctor != null and dataList[0].prescribingDoctor != ''">prescribingDoctor,</if>
+            <if test="dataList[0].department != null and dataList[0].department != ''">department,</if>
+            <if test="dataList[0].attendingPhysician != null and dataList[0].attendingPhysician != ''">attendingPhysician,</if>
+            <if test="dataList[0].clinicalDiagnosis != null and dataList[0].clinicalDiagnosis != ''">clinicalDiagnosis,</if>
+            <if test="dataList[0].registrant != null and dataList[0].registrant != ''">registrant,</if>
+            <if test="dataList[0].registrationDate != null">registrationDate,</if>
+            <if test="dataList[0].saleDate != null">saleDate,</if>
+            <if test="dataList[0].pharmacyName != null and dataList[0].pharmacyName != ''">pharmacyName,</if>
+            <if test="dataList[0].storeId != null">storeId,</if>
+            <if test="dataList[0].createdBy != null and dataList[0].createdBy != ''">createdBy,</if>
+            <if test="dataList[0].createdTime != null">createdTime,</if>
+            <if test="dataList[0].updatedBy != null and dataList[0].updatedBy != ''">updatedBy,</if>
+            <if test="dataList[0].updatedTime != null">updatedTime,</if>
+            <if test="dataList[0].remarks != null and dataList[0].remarks != ''">remarks</if>
+        </trim>
+        VALUES
+        <foreach item="item" index="index" collection="dataList" separator=",">
+            <trim prefix="(" suffix=")" prefixOverrides="," suffixOverrides=",">
+                <if test="item.mdmCode != null and item.mdmCode != ''">#{item.mdmCode},</if>
+                <if test="item.productName != null and item.productName != ''">#{item.productName},</if>
+                <if test="item.genericName != null and item.genericName != ''">#{item.genericName},</if>
+                <if test="item.specification != null and item.specification != ''">#{item.specification},</if>
+                <if test="item.manufacturerShortName != null and item.manufacturerShortName != ''">#{item.manufacturerShortName},</if>
+                <if test="item.administrationMethod != null and item.administrationMethod != ''">#{item.administrationMethod},</if>
+                <if test="item.packageQuantity != null">#{item.packageQuantity},</if>
+                <if test="item.singleDoseValue != null">#{item.singleDoseValue},</if>
+                <if test="item.singleDoseUnit != null and item.singleDoseUnit != ''">#{item.singleDoseUnit},</if>
+                <if test="item.dosageFrequency != null and item.dosageFrequency != ''">#{item.dosageFrequency},</if>
+                <if test="item.dosageFrequencyDays != null">#{item.dosageFrequencyDays},</if>
+                <if test="item.dvalueDays != null and  item.dvalueDays != ''">#{item.dvalueDays},</if>
+                <if test="item.medicationRoute != null and item.medicationRoute != ''">#{item.medicationRoute},</if>
+                <if test="item.sales != null and item.sales != ''">#{item.sales},</if>
+                <if test="item.prescriptionNumber != null and item.prescriptionNumber != ''">#{item.prescriptionNumber},</if>
+                <if test="item.prescriptionDate != null">#{item.prescriptionDate},</if>
+                <if test="item.hospital != null and item.hospital != ''">#{item.hospital},</if>
+                <if test="item.prescribingDoctor != null and item.prescribingDoctor != ''">#{item.prescribingDoctor},</if>
+                <if test="item.department != null and item.department != ''">#{item.department},</if>
+                <if test="item.attendingPhysician != null and item.attendingPhysician != ''">#{item.attendingPhysician},</if>
+                <if test="item.clinicalDiagnosis != null and item.clinicalDiagnosis != ''">#{item.clinicalDiagnosis},</if>
+                <if test="item.registrant != null and item.registrant != ''">#{item.registrant},</if>
+                <if test="item.registrationDate != null">#{item.registrationDate},</if>
+                <if test="item.saleDate != null">#{item.saleDate},</if>
+                <if test="item.pharmacyName != null and item.pharmacyName != ''">#{item.pharmacyName},</if>
+                <if test="item.storeId != null">#{item.storeId},</if>
+                <if test="item.createdBy != null and item.createdBy != ''">#{item.createdBy},</if>
+                <if test="item.createdTime != null">#{item.createdTime},</if>
+                <if test="item.updatedBy != null and item.updatedBy != ''">#{item.updatedBy},</if>
+                <if test="item.updatedTime != null">#{item.updatedTime},</if>
+                <if test="item.remarks != null and item.remarks != ''">#{item.remarks}</if>
+            </trim>
+        </foreach>
+    </insert>
+
+
+    <!-- 删除记录 -->
+    <delete id="deletePrescriptionRegistrationByIds" parameterType="java.util.List">
+        <if test="list != null and list.size() > 0">
+            delete from s_dtp_prescription_registration
+            where id in
+            <foreach item="id" index="index" collection="list" open="(" separator="," close=")">
+                #{id}
+            </foreach>
+        </if>
+    </delete>
+</mapper>