DTPMapper.xml 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="DTPMapper">
  6. <!--处方登记 -->
  7. <select id="RecipeRegisterList" parameterType="pd" resultType="pd">
  8. select id, orderId, saleOrderNumber, genericName, productName, specification, quantity, manufacturer, mdmCode,
  9. posMemberName, posMemberPhone, prescriptionType, orderTime, prescriptionNumber, hospital, department,
  10. doctor, patientName, patientPhone, storeName, registrar, completionTime, deliveryMethod, paymentCode,
  11. paymentMethod, status ,create_time as createTime from s_dtp_cfdj_prescription
  12. <where>
  13. <if test="id != null">AND id = #{id}</if>
  14. <if test="orderId != null and orderId!=''">AND orderId = #{orderId}</if>
  15. <if test="saleOrderNumber != null and saleOrderNumber!=''">AND saleOrderNumber = #{saleOrderNumber}</if>
  16. <if test="genericName != null and genericName!=''">AND genericName = #{genericName}</if>
  17. <if test="productName != null and productName!=''">AND productName = #{productName}</if>
  18. <if test="specification != null and specification!=''">AND specification = #{specification}</if>
  19. <if test="quantity != null and quantity!=''">AND quantity = #{quantity}</if>
  20. <if test="manufacturer != null and manufacturer!=''">AND manufacturer = #{manufacturer}</if>
  21. <if test="mdmCode != null and mdmCode!=''">AND mdmCode = #{mdmCode}</if>
  22. <if test="posMemberName != null and posMemberName!=''">AND posMemberName = #{posMemberName}</if>
  23. <if test="posMemberPhone != null and posMemberPhone!=''">AND posMemberPhone = #{posMemberPhone}</if>
  24. <if test="prescriptionType != null and prescriptionType!=''">AND prescriptionType=#{prescriptionType}</if>
  25. <if test="orderTime != null and orderTime!=''">AND orderTime = #{orderTime}</if>
  26. <if test="prescriptionNumber != null and prescriptionNumber!=''">AND prescriptionNumber = #{prescriptionNumber}</if>
  27. <if test="hospital != null and hospital!=''">AND hospital = #{hospital}</if>
  28. <if test="department != null and department!=''">AND department = #{department}</if>
  29. <if test="doctor != null and doctor!=''">AND doctor = #{doctor}</if>
  30. <if test="query != null and query!=''">
  31. AND patientName LIKE CONCAT('%', #{query}, '%') or patientPhone = #{query}
  32. </if>
  33. <if test="storeName != null and storeName!=''">AND storeName = #{storeName}</if>
  34. <if test="registrar != null and registrar!=''">AND registrar = #{registrar}</if>
  35. <if test="completionTime != null and completionTime!=''">AND completionTime = #{completionTime}</if>
  36. <if test="deliveryMethod != null and deliveryMethod!=''">AND deliveryMethod=#{deliveryMethod}</if>
  37. <if test="paymentCode != null and paymentCode!=''">AND paymentCode = #{paymentCode}</if>
  38. <if test="paymentMethod != null and paymentMethod!=''">AND paymentMethod = #{paymentMethod}</if>
  39. <if test="status != null and status!=''">AND status = #{status}</if>
  40. <if test="createTime != null and createTime!=''">AND create_time = #{createTime}</if>
  41. and del_flag = '0'
  42. </where>
  43. order by create_time desc
  44. </select>
  45. <insert id="insertRecipe" parameterType="pd">
  46. insert into s_dtp_cfdj_prescription
  47. <trim prefix="(" suffix=")" prefixOverrides="," suffixOverrides=",">
  48. <if test="orderId != null and orderId!=''">orderId,</if>
  49. <if test="saleOrderNumber != null and saleOrderNumber!=''">saleOrderNumber,</if>
  50. <if test="genericName != null and genericName!=''">genericName,</if>
  51. <if test="productName != null and productName!=''">productName,</if>
  52. <if test="specification != null and specification!=''">specification,</if>
  53. <if test="quantity != null and quantity!=''">quantity,</if>
  54. <if test="manufacturer != null and manufacturer!=''">manufacturer,</if>
  55. <if test="mdmCode != null and mdmCode!=''">mdmCode,</if>
  56. <if test="posMemberName != null and posMemberName!=''">posMemberName,</if>
  57. <if test="posMemberPhone != null and posMemberPhone!=''">posMemberPhone,</if>
  58. <if test="prescriptionType != null and prescriptionType!=''">prescriptionType,</if>
  59. <if test="orderTime != null and orderTime!=''">orderTime,</if>
  60. <if test="prescriptionNumber != null and prescriptionNumber!=''">prescriptionNumber,</if>
  61. <if test="hospital != null and hospital!=''">hospital,</if>
  62. <if test="department != null and department!=''">department,</if>
  63. <if test="doctor != null and doctor!=''">doctor,</if>
  64. <if test="patientName != null and patientName!=''">patientName,</if>
  65. <if test="patientPhone != null and patientPhone!=''">patientPhone,</if>
  66. <if test="storeName != null and storeName!=''">storeName,</if>
  67. <if test="registrar != null and registrar!=''">registrar,</if>
  68. <if test="completionTime != null and completionTime!=''">completionTime,</if>
  69. <if test="deliveryMethod != null and deliveryMethod!=''">deliveryMethod,</if>
  70. <if test="paymentCode != null and paymentCode!=''">paymentCode,</if>
  71. <if test="paymentMethod != null and paymentMethod!=''">paymentMethod,</if>
  72. <if test="status != null and status!=''">status},</if>
  73. <if test="createTime != null and createTime!=''">create_time,</if>
  74. </trim>
  75. <trim prefix=" VALUES (" suffix=")" prefixOverrides="," suffixOverrides=",">
  76. <if test="orderId != null and orderId!=''">#{orderId},</if>
  77. <if test="saleOrderNumber != null and saleOrderNumber!=''">#{saleOrderNumber},</if>
  78. <if test="genericName != null and genericName!=''">#{genericName},</if>
  79. <if test="productName != null and productName!=''">#{productName},</if>
  80. <if test="specification != null and specification!=''">#{specification},</if>
  81. <if test="quantity != null and quantity!=''">#{quantity},</if>
  82. <if test="manufacturer != null and manufacturer!=''">#{manufacturer},</if>
  83. <if test="mdmCode != null and mdmCode!=''">#{mdmCode},</if>
  84. <if test="posMemberName != null and posMemberName!=''">#{posMemberName},</if>
  85. <if test="posMemberPhone != null and posMemberPhone!=''">#{posMemberPhone},</if>
  86. <if test="prescriptionType != null and prescriptionType!=''">#{prescriptionType},</if>
  87. <if test="orderTime != null and orderTime!=''">#{orderTime},</if>
  88. <if test="prescriptionNumber != null and prescriptionNumber!=''">#{prescriptionNumber},</if>
  89. <if test="hospital != null and hospital!=''">#{hospital},</if>
  90. <if test="department != null and department!=''">#{department},</if>
  91. <if test="doctor != null and doctor!=''">#{doctor},</if>
  92. <if test="patientName != null and patientName!=''">#{patientName},</if>
  93. <if test="patientPhone != null and patientPhone!=''">#{patientPhone},</if>
  94. <if test="storeName != null and storeName!=''">#{storeName},</if>
  95. <if test="registrar != null and registrar!=''">#{registrar},</if>
  96. <if test="completionTime != null and completionTime!=''">#{completionTime},</if>
  97. <if test="deliveryMethod != null and deliveryMethod!=''">#{deliveryMethod},</if>
  98. <if test="paymentCode != null and paymentCode!=''">#{paymentCode},</if>
  99. <if test="paymentMethod != null and paymentMethod!=''">#{paymentMethod},</if>
  100. <if test="status != null and status!=''">#{status},</if>
  101. <if test="createTime != null and createTime!=''">#{createTime},</if>
  102. </trim>
  103. </insert>
  104. <delete id="deleteRecipe" parameterType="pd">
  105. <if test="ids != null and ids!=''">
  106. delete from s_dtp_cfdj_prescription
  107. where id in (${ids})
  108. </if>
  109. </delete>
  110. <update id="updateRecipe" parameterType="pd">
  111. update s_dtp_cfdj_prescription
  112. <trim prefix=" SET " suffix="" prefixOverrides="," suffixOverrides=",">
  113. <if test="orderId != null and orderId!=''">orderId=#{orderId},</if>
  114. <if test="saleOrderNumber != null and saleOrderNumber!=''">saleOrderNumber=#{saleOrderNumber},</if>
  115. <if test="genericName != null and genericName!=''">genericName=#{genericName},</if>
  116. <if test="productName != null and productName!=''">productName=#{productName},</if>
  117. <if test="specification != null">specification=#{specification},</if>
  118. <if test="quantity != null">quantity=#{quantity},</if>
  119. <if test="manufacturer != null">manufacturer=#{manufacturer},</if>
  120. <if test="mdmCode != null">mdmCode=#{mdmCode},</if>
  121. <if test="posMemberName != null and posMemberName!=''">posMemberName=#{posMemberName},</if>
  122. <if test="posMemberPhone != null and posMemberPhone!=''">posMemberPhone=#{posMemberPhone},</if>
  123. <if test="prescriptionType != null and prescriptionType!=''">prescriptionType=#{prescriptionType},</if>
  124. <if test="orderTime != null">orderTime=#{orderTime},</if>
  125. <if test="prescriptionNumber != null and prescriptionNumber!=''">prescriptionNumber=#{prescriptionNumber},</if>
  126. <if test="hospital != null">hospital=#{hospital},</if>
  127. <if test="department != null">department=#{department},</if>
  128. <if test="doctor != null">doctor=#{doctor},</if>
  129. <if test="patientName != null and patientName!=''">patientName=#{patientName},</if>
  130. <if test="patientPhone != null and patientPhone!=''">patientPhone=#{patientPhone},</if>
  131. <if test="storeName != null">storeName=#{storeName},</if>
  132. <if test="registrar != null">registrar=#{registrar},</if>
  133. <if test="completionTime != null and completionTime!=''">completionTime=#{completionTime},</if>
  134. <if test="deliveryMethod != null and deliveryMethod!=''">deliveryMethod=#{deliveryMethod},</if>
  135. <if test="paymentCode != null and paymentCode!=''">paymentCode=#{paymentCode},</if>
  136. <if test="paymentMethod != null and paymentMethod!=''">paymentMethod=#{paymentMethod},</if>
  137. <if test="status != null and status!=''">status=#{status},</if>
  138. <if test="createTime != null and createTime!=''">create_time=#{createTime},</if>
  139. </trim>
  140. where id=#{id}
  141. </update>
  142. <select id="checkPatientNameAndPhoneUnique" parameterType="pd" resultType="pd">
  143. select patientName, patientPhone from s_dtp_cfdj_prescription where patientName=#{patientName} and patientPhone=#{patientPhone} and del_flag = '0' limit 1
  144. </select>
  145. <select id="selectOne" parameterType="pd" resultType="pd">
  146. select id, orderId, saleOrderNumber, genericName, productName, specification, quantity, manufacturer, mdmCode,
  147. posMemberName, posMemberPhone, prescriptionType, orderTime, prescriptionNumber, hospital, department,
  148. doctor, patientName, patientPhone, storeName, registrar, completionTime, deliveryMethod, paymentCode,
  149. paymentMethod, status ,create_time as createTime from s_dtp_cfdj_prescription where id=#{id}
  150. </select>
  151. <!--冷链配送管理 -->
  152. <select id="DistributionOrderList" parameterType="pd" resultType="pd">
  153. select id, orderNumber, chainName, storeName, deliveryStatus, coldChainType,orderSource,recipientName,
  154. recipientPhone,recipientAddress,departureTemperature,arrivalTemperature,signaturePhoto,isOnlineSignature,
  155. deliveryBoxNumber,icePackNumber,deliveryPerson, expectedDeliveryTime, actualDeliveryTime, creationTime, updatedTime,
  156. createdBy, createdDate
  157. from s_dtp_llps_distribution_order
  158. <where>
  159. <if test="id != null">AND id = #{id}</if>
  160. <if test="orderNumber != null and orderNumber!=''">AND orderNumber = #{orderNumber}</if>
  161. <if test="chainName != null and chainName!=''">AND chainName = #{chainName}</if>
  162. <if test="storeName != null and storeName!=''">AND storeName = #{storeName}</if>
  163. <if test="deliveryStatus != null and deliveryStatus!=''">AND deliveryStatus = #{deliveryStatus}</if>
  164. <if test="recipientName != null and recipientName!=''">AND recipientName = #{recipientName}</if>
  165. <if test="recipientPhone != null and recipientPhone!=''">AND recipientPhone = #{recipientPhone}</if>
  166. <if test="recipientAddress != null and recipientAddress!=''">AND recipientAddress = #{recipientAddress}</if>
  167. <if test="deliveryPerson != null and deliveryPerson!=''">AND deliveryPerson = #{deliveryPerson}</if>
  168. <if test="expectedDeliveryTime != null and expectedDeliveryTime!=''">AND expectedDeliveryTime = #{expectedDeliveryTime}</if>
  169. <if test="actualDeliveryTime != null and actualDeliveryTime!=''">AND actualDeliveryTime = #{actualDeliveryTime}</if>
  170. <if test="creationTime != null and creationTime!=''">AND creationTime = #{creationTime}</if>
  171. <if test="updatedTime != null and updatedTime!=''">AND updatedTime = #{updatedTime}</if>
  172. <if test="createdBy != null and createdBy!=''">AND createdBy = #{createdBy}</if>
  173. <if test="createdDate != null and createdDate!=''">AND createdDate = #{createdDate}</if>
  174. <if test="query != null and query!=''">
  175. AND recipientName LIKE CONCAT('%', #{query}, '%') or recipientPhone = #{query}
  176. </if>
  177. and del_flag= '0'
  178. </where>
  179. order by create_time desc
  180. </select>
  181. <insert id="insertDistributionOrder" parameterType="pd">
  182. insert into s_dtp_llps_distribution_order
  183. <trim prefix="(" suffix=")" prefixOverrides="," suffixOverrides=",">
  184. <if test="orderNumber != null and orderNumber!=''">orderNumber,</if>
  185. <if test="chainName != null and chainName!=''">chainName,</if>
  186. <if test="storeName != null and storeName!=''">storeName,</if>
  187. <if test="deliveryStatus != null and deliveryStatus!=''">deliveryStatus,</if>
  188. <if test="recipientName != null and recipientName!=''">recipientName,</if>
  189. <if test="recipientPhone != null and recipientPhone!=''">recipientPhone,</if>
  190. <if test="recipientAddress != null and recipientAddress!=''">recipientAddress,</if>
  191. <if test="deliveryPerson != null and deliveryPerson!=''">deliveryPerson,</if>
  192. <if test="expectedDeliveryTime != null and expectedDeliveryTime!=''">expectedDeliveryTime,</if>
  193. <if test="actualDeliveryTime != null and actualDeliveryTime!=''">actualDeliveryTime,</if>
  194. <if test="createdBy != null and createdBy!=''">createdBy,</if>
  195. <if test="createdDate != null and createdDate!=''">createdDate,</if>
  196. <if test="creationTime != null and creationTime!=''">creationTime,</if>
  197. <if test="updatedTime != null and updatedTime!=''">updatedTime,</if>
  198. <if test="createTime != null and createTime!=''">create_time,</if>
  199. <if test="coldChainType != null and coldChainType != ''">coldChainType ,</if>
  200. <if test="orderSource != null and orderSource != ''">orderSource,</if>
  201. <if test="departureTemperature != null">departureTemperature,</if>
  202. <if test="arrivalTemperature != null">arrivalTemperature,</if>
  203. <if test="signaturePhoto != null and signaturePhoto != ''">signaturePhoto,</if>
  204. <if test="isOnlineSignature != null">isOnlineSignature ,</if>
  205. <if test="deliveryBoxNumber != null and deliveryBoxNumber != ''">deliveryBoxNumber ,</if>
  206. <if test="icePackNumber != null and icePackNumber != ''">icePackNumber,</if>
  207. <if test="paymentSequence != null">paymentSequence,</if>
  208. </trim>
  209. <trim prefix=" VALUES (" suffix=")" prefixOverrides="," suffixOverrides=",">
  210. <if test="orderNumber != null and orderNumber!=''">#{orderNumber},</if>
  211. <if test="chainName != null and chainName!=''">#{chainName},</if>
  212. <if test="storeName != null and storeName!=''">#{storeName},</if>
  213. <if test="deliveryStatus != null and deliveryStatus!=''">#{deliveryStatus},</if>
  214. <if test="recipientName != null and recipientName!=''">#{recipientName},</if>
  215. <if test="recipientPhone != null and recipientPhone!=''">#{recipientPhone},</if>
  216. <if test="recipientAddress != null and recipientAddress!=''">#{recipientAddress},</if>
  217. <if test="deliveryPerson != null and deliveryPerson!=''">#{deliveryPerson},</if>
  218. <if test="expectedDeliveryTime != null and expectedDeliveryTime!=''">#{expectedDeliveryTime},</if>
  219. <if test="actualDeliveryTime != null and actualDeliveryTime!=''">#{actualDeliveryTime},</if>
  220. <if test="createdBy != null and createdBy!=''">#{createdBy},</if>
  221. <if test="createdDate != null and createdDate!=''">#{createdDate},</if>
  222. <if test="creationTime != null and creationTime!=''">#{creationTime},</if>
  223. <if test="updatedTime != null and updatedTime!=''">#{updatedTime},</if>
  224. <if test="createTime != null and createTime!=''">#{createTime},</if>
  225. <if test="coldChainType != null and coldChainType != ''">#{coldChainType} ,</if>
  226. <if test="orderSource != null and orderSource != ''">#{orderSource},</if>
  227. <if test="departureTemperature != null">#{departureTemperature},</if>
  228. <if test="arrivalTemperature != null">#{arrivalTemperature},</if>
  229. <if test="signaturePhoto != null and signaturePhoto != ''">#{signaturePhoto},</if>
  230. <if test="isOnlineSignature != null">#{isOnlineSignature} ,</if>
  231. <if test="deliveryBoxNumber != null and deliveryBoxNumber != ''">#{deliveryBoxNumber} ,</if>
  232. <if test="icePackNumber != null and icePackNumber != ''">#{icePackNumber},</if>
  233. <if test="paymentSequence != null">#{paymentSequence},</if>
  234. </trim>
  235. </insert>
  236. <update id="updateDistributionOrder" parameterType="pd">
  237. update s_dtp_llps_distribution_order
  238. <set>
  239. <if test="orderNumber != null and orderNumber != ''">orderNumber = #{orderNumber},</if>
  240. <if test="chainName != null and chainName != ''">chainName = #{chainName},</if>
  241. <if test="storeName != null and storeName != ''">storeName = #{storeName},</if>
  242. <if test="deliveryStatus != null">deliveryStatus = #{deliveryStatus},</if>
  243. <if test="recipientName != null and recipientName != ''">recipientName = #{recipientName},</if>
  244. <if test="recipientPhone != null and recipientPhone != ''">recipientPhone = #{recipientPhone},</if>
  245. <if test="recipientAddress != null and recipientAddress != ''">recipientAddress = #{recipientAddress},</if>
  246. <if test="deliveryPerson != null and deliveryPerson != ''">deliveryPerson = #{deliveryPerson},</if>
  247. <if test="expectedDeliveryTime != null">expectedDeliveryTime = #{expectedDeliveryTime},</if>
  248. <if test="actualDeliveryTime != null">actualDeliveryTime = #{actualDeliveryTime},</if>
  249. <if test="createdBy != null and createdBy != ''">createdBy = #{createdBy},</if>
  250. <if test="createdDate != null">createdDate = #{createdDate},</if>
  251. <if test="creationTime != null">creationTime = #{creationTime},</if>
  252. <if test="updatedTime != null">updatedTime = #{updatedTime},</if>
  253. <if test="createTime != null">create_time = #{createTime},</if>
  254. <if test="coldChainType != null and coldChainType != ''">coldChainType = #{coldChainType},</if>
  255. <if test="orderSource != null and orderSource != ''">orderSource = #{orderSource},</if>
  256. <if test="departureTemperature != null">departureTemperature = #{departureTemperature},</if>
  257. <if test="arrivalTemperature != null">arrivalTemperature = #{arrivalTemperature},</if>
  258. <if test="signaturePhoto != null and signaturePhoto != ''">signaturePhoto = #{signaturePhoto},</if>
  259. <if test="isOnlineSignature != null">isOnlineSignature = #{isOnlineSignature},</if>
  260. <if test="deliveryBoxNumber != null and deliveryBoxNumber != ''">deliveryBoxNumber = #{deliveryBoxNumber},</if>
  261. <if test="icePackNumber != null and icePackNumber != ''">icePackNumber = #{icePackNumber},</if>
  262. <if test="paymentSequence != null">paymentSequence = #{paymentSequence},</if>
  263. </set>
  264. where id = #{id}
  265. </update>
  266. <update id="softDeleteColdOrder" parameterType="pd">
  267. <if test="ids != null and ids.size() > 0">
  268. update s_dtp_llps_distribution_order
  269. set del_flag = 1
  270. where id in
  271. <foreach item="id" index="index" collection="ids" open="(" separator="," close=")">
  272. #{id}
  273. </foreach>
  274. </if>
  275. </update>
  276. </mapper>