FsPrescribeDataScrmMapper.xml 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346
  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="com.fs.his.mapper.FsPrescribeDataScrmMapper">
  6. <resultMap type="com.fs.his.domain.FsPrescribeDataScrm" id="FsPrescribeDataScrmResult">
  7. <id property="prescribeId" column="prescribe_id" />
  8. <result property="prescribeType" column="prescribe_type" />
  9. <result property="inquiryOrderId" column="inquiry_order_id" />
  10. <result property="orderCode" column="order_code" />
  11. <result property="storeOrderId" column="store_order_id" />
  12. <result property="userId" column="user_id" />
  13. <result property="patientId" column="patient_id" />
  14. <result property="prescribeCode" column="prescribe_code" />
  15. <result property="patientDescs" column="patient_descs" />
  16. <result property="nowIllness" column="now_illness" />
  17. <result property="historyIllness" column="history_illness" />
  18. <result property="patientAge" column="patient_age" />
  19. <result property="patientName" column="patient_name" />
  20. <result property="weight" column="weight" />
  21. <result property="isHistoryAllergic" column="is_history_allergic" />
  22. <result property="historyAllergic" column="history_allergic" />
  23. <result property="liverUnusual" column="liver_unusual" />
  24. <result property="renalUnusual" column="renal_unusual" />
  25. <result property="isLactation" column="is_lactation" />
  26. <result property="patientTel" column="patient_tel" />
  27. <result property="patientGender" column="patient_gender" />
  28. <result property="recordPic" column="record_pic" />
  29. <result property="prescribeImgUrl" column="prescribe_img_url" />
  30. <result property="prescribeImgStoreUrl" column="prescribe_img_store_url"/>
  31. <result property="auditReason" column="audit_reason" />
  32. <result property="diagnose" column="diagnose" />
  33. <result property="doctorId" column="doctor_id" />
  34. <result property="drugDoctorId" column="drug_doctor_id" />
  35. <result property="createTime" column="create_time" />
  36. <result property="status" column="status" />
  37. <result property="auditTime" column="audit_time" />
  38. <result property="usageJson" column="usage_json" />
  39. <result property="remark" column="remark" />
  40. <result property="storeId" column="store_id" />
  41. <result property="prescribeDoctorId" column="prescribe_doctor_id" />
  42. <result property="doctorSignUrl" column="doctor_sign_url" />
  43. <result property="prescribeDoctorSignUrl" column="prescribe_doctor_sign_url"/>
  44. <result property="drugDoctorSignUrl" column="drug_doctor_sign_url" />
  45. <result property="patientBirthday" column="patient_birthday" />
  46. <result property="recipeType" column="recipe_type" />
  47. <result property="prescribeCodeUrl" column="prescribe_code_url" />
  48. <result property="cycle" column="cycle" />
  49. <result property="icdCode" column="icd_code" />
  50. <result property="source" column="source" />
  51. <result property="doctorConfirm" column="doctor_confirm" />
  52. <result property="startOperateTime" column="start_operate_time" />
  53. <result property="endOperateTime" column="end_operate_time" />
  54. <result property="operateSecond" column="operate_second" />
  55. <result property="thirdPartyUserId" column="third_party_user_id" />
  56. <result property="isSendToThirdParty" column="is_send_to_third_party" />
  57. <result property="handwriteCollectionId" column="handwrite_collection_id"/>
  58. <result property="companyCustomerId" column="company_customer_id" />
  59. <result property="createBy" column="create_by" />
  60. <result property="updateBy" column="update_by" />
  61. <result property="updateTime" column="update_time" />
  62. </resultMap>
  63. <sql id="selectFsPrescribeDataScrmVo">
  64. select prescribe_id, prescribe_type, inquiry_order_id,order_code, store_order_id, user_id, patient_id,
  65. prescribe_code, patient_descs, now_illness, history_illness, patient_age, patient_name,
  66. weight, is_history_allergic, history_allergic, liver_unusual, renal_unusual, is_lactation,
  67. patient_tel, patient_gender, record_pic, prescribe_img_url, prescribe_img_store_url,
  68. audit_reason, diagnose, doctor_id, drug_doctor_id, create_time, status, audit_time,
  69. usage_json, remark, store_id, prescribe_doctor_id, doctor_sign_url,
  70. prescribe_doctor_sign_url, drug_doctor_sign_url, patient_birthday, recipe_type,
  71. prescribe_code_url, cycle, icd_code, source, doctor_confirm, start_operate_time,
  72. end_operate_time, operate_second, third_party_user_id, is_send_to_third_party,
  73. handwrite_collection_id, company_customer_id
  74. from fs_prescribe_data_scrm
  75. </sql>
  76. <select id="selectFsPrescribeDataScrmByPrescribeId" parameterType="Long" resultMap="FsPrescribeDataScrmResult">
  77. <include refid="selectFsPrescribeDataScrmVo"/>
  78. where prescribe_id = #{prescribeId}
  79. </select>
  80. <select id="selectFsPrescribeDataScrmList" parameterType="FsPrescribeDataScrm" resultMap="FsPrescribeDataScrmResult">
  81. <include refid="selectFsPrescribeDataScrmVo"/>
  82. <where>
  83. <if test="prescribeType != null"> and prescribe_type = #{prescribeType}</if>
  84. <if test="inquiryOrderId != null"> and inquiry_order_id = #{inquiryOrderId}</if>
  85. <if test="orderCode != null"> and order_code = #{orderCode}</if>
  86. <if test="storeOrderId != null"> and store_order_id = #{storeOrderId}</if>
  87. <if test="userId != null"> and user_id = #{userId}</if>
  88. <if test="patientId != null"> and patient_id = #{patientId}</if>
  89. <if test="prescribeCode != null and prescribeCode != ''"> and prescribe_code = #{prescribeCode}</if>
  90. <if test="patientName != null and patientName != ''"> and patient_name like concat('%', #{patientName}, '%')</if>
  91. <if test="patientTel != null and patientTel != ''"> and patient_tel = #{patientTel}</if>
  92. <if test="patientGender != null"> and patient_gender = #{patientGender}</if>
  93. <if test="diagnose != null and diagnose != ''"> and diagnose like concat('%', #{diagnose}, '%')</if>
  94. <if test="doctorId != null"> and doctor_id = #{doctorId}</if>
  95. <if test="drugDoctorId != null"> and drug_doctor_id = #{drugDoctorId}</if>
  96. <if test="status != null"> and status = #{status}</if>
  97. <if test="storeId != null"> and store_id = #{storeId}</if>
  98. <if test="prescribeDoctorId != null"> and prescribe_doctor_id = #{prescribeDoctorId}</if>
  99. <if test="source != null"> and source = #{source}</if>
  100. <if test="doctorConfirm != null"> and doctor_confirm = #{doctorConfirm}</if>
  101. <if test="isSendToThirdParty != null"> and is_send_to_third_party = #{isSendToThirdParty}</if>
  102. <if test="companyCustomerId != null"> and company_customer_id = #{companyCustomerId}</if>
  103. <!-- 按时间范围查询 -->
  104. <if test="params != null and beginTime != null and beginTime != ''">
  105. and create_time >= #{params.beginCreateTime}
  106. </if>
  107. <if test="params != null and endTime != null and endTime != ''">
  108. and create_time &lt;= #{params.endCreateTime}
  109. </if>
  110. </where>
  111. order by create_time desc
  112. </select>
  113. <select id="waitOpenPrescribeList" resultType="com.fs.qw.vo.FsPrescribeDataScrmVO">
  114. select pds.* from fs_prescribe_data_scrm pds
  115. left join fs_company_customer fcc on pds.prescribe_id = fcc.prescribe_id
  116. <where>
  117. pds.doctor_id = #{doctorId}
  118. <if test="prescribeType != null"> and prescribe_type = #{prescribeType}</if>
  119. <if test="orderCode != null"> and order_code = #{orderCode}</if>
  120. <if test="prescribeCode != null and prescribeCode != ''"> and prescribe_code = #{prescribeCode}</if>
  121. <if test="patientName != null and patientName != ''"> and patient_name like concat('%', #{patientName}, '%')</if>
  122. <if test="doctorId != null"> and doctor_id = #{doctorId}</if>
  123. <if test="doctorConfirm != null"> and doctor_confirm = #{doctorConfirm}</if>
  124. </where>
  125. order by create_time desc
  126. </select>
  127. <select id="pendingStorePrescribeList" resultType="com.fs.qw.vo.FsPrescribeDataScrmVO">
  128. select pds.* from fs_prescribe_data_scrm pds
  129. left join fs_company_customer fcc on pds.prescribe_id = fcc.prescribe_id
  130. <where>
  131. pds.drug_doctor_id = #{drugDoctorId} and doctor_confirm = 1 <!--必须是医生开方通过的才能进入待药师审核 -->
  132. <if test="orderCode != null"> and order_code = #{orderCode}</if>
  133. <if test="prescribeCode != null and prescribeCode != ''"> and prescribe_code = #{prescribeCode}</if>
  134. <if test="patientName != null and patientName != ''"> and patient_name like concat('%', #{patientName}, '%')</if>
  135. <if test="status != null"> and status = #{status}</if>
  136. </where>
  137. order by create_time desc
  138. </select>
  139. <select id="selectFsPrescribeDataScrmImgVOByPrescribeId"
  140. resultType="com.fs.his.vo.FsPrescribeDataScrmImgVO">
  141. select fpds.*,
  142. doctor.doctor_name as doctorName,
  143. doctor.sign_url as doctorSign,
  144. doctor.practise_code as practiseCode,
  145. doctor.position as doctorPosition,
  146. doctor.certificate_code as certificateCode,
  147. drug_fd.doctor_name as drugDoctorName,
  148. drug_fd.sign_url as drugDoctorSign
  149. from fs_prescribe_data_scrm fpds
  150. left join fs_doctor doctor on fpds.doctor_id = doctor.doctor_id
  151. left join fs_doctor drug_fd on fpds.drug_doctor_id = drug_fd.doctor_id
  152. left join fs_patient fp on fpds.patient_id = fp.patient_id
  153. </select>
  154. <insert id="insertFsPrescribeDataScrm" parameterType="FsPrescribeDataScrm" useGeneratedKeys="true" keyProperty="prescribeId">
  155. insert into fs_prescribe_data_scrm
  156. <trim prefix="(" suffix=")" suffixOverrides=",">
  157. <if test="prescribeType != null">prescribe_type,</if>
  158. <if test="inquiryOrderId != null">inquiry_order_id,</if>
  159. <if test="orderCode != null">order_code,</if>
  160. <if test="storeOrderId != null">store_order_id,</if>
  161. <if test="userId != null">user_id,</if>
  162. <if test="patientId != null">patient_id,</if>
  163. <if test="prescribeCode != null">prescribe_code,</if>
  164. <if test="patientDescs != null">patient_descs,</if>
  165. <if test="nowIllness != null">now_illness,</if>
  166. <if test="historyIllness != null">history_illness,</if>
  167. <if test="patientAge != null">patient_age,</if>
  168. <if test="patientName != null">patient_name,</if>
  169. <if test="weight != null">weight,</if>
  170. <if test="isHistoryAllergic != null">is_history_allergic,</if>
  171. <if test="historyAllergic != null">history_allergic,</if>
  172. <if test="liverUnusual != null">liver_unusual,</if>
  173. <if test="renalUnusual != null">renal_unusual,</if>
  174. <if test="isLactation != null">is_lactation,</if>
  175. <if test="patientTel != null">patient_tel,</if>
  176. <if test="patientGender != null">patient_gender,</if>
  177. <if test="recordPic != null">record_pic,</if>
  178. <if test="prescribeImgUrl != null">prescribe_img_url,</if>
  179. <if test="prescribeImgStoreUrl != null">prescribe_img_store_url,</if>
  180. <if test="auditReason != null">audit_reason,</if>
  181. <if test="diagnose != null">diagnose,</if>
  182. <if test="doctorId != null">doctor_id,</if>
  183. <if test="drugDoctorId != null">drug_doctor_id,</if>
  184. <if test="createTime != null">create_time,</if>
  185. <if test="status != null">status,</if>
  186. <if test="auditTime != null">audit_time,</if>
  187. <if test="usageJson != null">usage_json,</if>
  188. <if test="remark != null">remark,</if>
  189. <if test="storeId != null">store_id,</if>
  190. <if test="prescribeDoctorId != null">prescribe_doctor_id,</if>
  191. <if test="doctorSignUrl != null">doctor_sign_url,</if>
  192. <if test="prescribeDoctorSignUrl != null">prescribe_doctor_sign_url,</if>
  193. <if test="drugDoctorSignUrl != null">drug_doctor_sign_url,</if>
  194. <if test="patientBirthday != null">patient_birthday,</if>
  195. <if test="recipeType != null">recipe_type,</if>
  196. <if test="prescribeCodeUrl != null">prescribe_code_url,</if>
  197. <if test="cycle != null">cycle,</if>
  198. <if test="icdCode != null">icd_code,</if>
  199. <if test="source != null">source,</if>
  200. <if test="doctorConfirm != null">doctor_confirm,</if>
  201. <if test="startOperateTime != null">start_operate_time,</if>
  202. <if test="endOperateTime != null">end_operate_time,</if>
  203. <if test="operateSecond != null">operate_second,</if>
  204. <if test="thirdPartyUserId != null">third_party_user_id,</if>
  205. <if test="isSendToThirdParty != null">is_send_to_third_party,</if>
  206. <if test="handwriteCollectionId != null">handwrite_collection_id,</if>
  207. <if test="companyCustomerId != null">company_customer_id,</if>
  208. </trim>
  209. <trim prefix="values (" suffix=")" suffixOverrides=",">
  210. <if test="prescribeType != null">#{prescribeType},</if>
  211. <if test="inquiryOrderId != null">#{inquiryOrderId},</if>
  212. <if test="orderCode != null">#{orderCode},</if>
  213. <if test="storeOrderId != null">#{storeOrderId},</if>
  214. <if test="userId != null">#{userId},</if>
  215. <if test="patientId != null">#{patientId},</if>
  216. <if test="prescribeCode != null">#{prescribeCode},</if>
  217. <if test="patientDescs != null">#{patientDescs},</if>
  218. <if test="nowIllness != null">#{nowIllness},</if>
  219. <if test="historyIllness != null">#{historyIllness},</if>
  220. <if test="patientAge != null">#{patientAge},</if>
  221. <if test="patientName != null">#{patientName},</if>
  222. <if test="weight != null">#{weight},</if>
  223. <if test="isHistoryAllergic != null">#{isHistoryAllergic},</if>
  224. <if test="historyAllergic != null">#{historyAllergic},</if>
  225. <if test="liverUnusual != null">#{liverUnusual},</if>
  226. <if test="renalUnusual != null">#{renalUnusual},</if>
  227. <if test="isLactation != null">#{isLactation},</if>
  228. <if test="patientTel != null">#{patientTel},</if>
  229. <if test="patientGender != null">#{patientGender},</if>
  230. <if test="recordPic != null">#{recordPic},</if>
  231. <if test="prescribeImgUrl != null">#{prescribeImgUrl},</if>
  232. <if test="prescribeImgStoreUrl != null">#{prescribeImgStoreUrl},</if>
  233. <if test="auditReason != null">#{auditReason},</if>
  234. <if test="diagnose != null">#{diagnose},</if>
  235. <if test="doctorId != null">#{doctorId},</if>
  236. <if test="drugDoctorId != null">#{drugDoctorId},</if>
  237. <if test="createTime != null">#{createTime},</if>
  238. <if test="status != null">#{status},</if>
  239. <if test="auditTime != null">#{auditTime},</if>
  240. <if test="usageJson != null">#{usageJson},</if>
  241. <if test="remark != null">#{remark},</if>
  242. <if test="storeId != null">#{storeId},</if>
  243. <if test="prescribeDoctorId != null">#{prescribeDoctorId},</if>
  244. <if test="doctorSignUrl != null">#{doctorSignUrl},</if>
  245. <if test="prescribeDoctorSignUrl != null">#{prescribeDoctorSignUrl},</if>
  246. <if test="drugDoctorSignUrl != null">#{drugDoctorSignUrl},</if>
  247. <if test="patientBirthday != null">#{patientBirthday},</if>
  248. <if test="recipeType != null">#{recipeType},</if>
  249. <if test="prescribeCodeUrl != null">#{prescribeCodeUrl},</if>
  250. <if test="cycle != null">#{cycle},</if>
  251. <if test="icdCode != null">#{icdCode},</if>
  252. <if test="source != null">#{source},</if>
  253. <if test="doctorConfirm != null">#{doctorConfirm},</if>
  254. <if test="startOperateTime != null">#{startOperateTime},</if>
  255. <if test="endOperateTime != null">#{endOperateTime},</if>
  256. <if test="operateSecond != null">#{operateSecond},</if>
  257. <if test="thirdPartyUserId != null">#{thirdPartyUserId},</if>
  258. <if test="isSendToThirdParty != null">#{isSendToThirdParty},</if>
  259. <if test="handwriteCollectionId != null">#{handwriteCollectionId},</if>
  260. <if test="companyCustomerId != null">#{companyCustomerId},</if>
  261. </trim>
  262. </insert>
  263. <update id="updateFsPrescribeDataScrm" parameterType="FsPrescribeDataScrm">
  264. update fs_prescribe_data_scrm
  265. <trim prefix="SET" suffixOverrides=",">
  266. <if test="prescribeType != null">prescribe_type = #{prescribeType},</if>
  267. <if test="inquiryOrderId != null">inquiry_order_id = #{inquiryOrderId},</if>
  268. <if test="orderCode != null">order_code = #{orderCode},</if>
  269. <if test="storeOrderId != null">store_order_id = #{storeOrderId},</if>
  270. <if test="userId != null">user_id = #{userId},</if>
  271. <if test="patientId != null">patient_id = #{patientId},</if>
  272. <if test="prescribeCode != null">prescribe_code = #{prescribeCode},</if>
  273. <if test="patientDescs != null">patient_descs = #{patientDescs},</if>
  274. <if test="nowIllness != null">now_illness = #{nowIllness},</if>
  275. <if test="historyIllness != null">history_illness = #{historyIllness},</if>
  276. <if test="patientAge != null">patient_age = #{patientAge},</if>
  277. <if test="patientName != null">patient_name = #{patientName},</if>
  278. <if test="weight != null">weight = #{weight},</if>
  279. <if test="isHistoryAllergic != null">is_history_allergic = #{isHistoryAllergic},</if>
  280. <if test="historyAllergic != null">history_allergic = #{historyAllergic},</if>
  281. <if test="liverUnusual != null">liver_unusual = #{liverUnusual},</if>
  282. <if test="renalUnusual != null">renal_unusual = #{renalUnusual},</if>
  283. <if test="isLactation != null">is_lactation = #{isLactation},</if>
  284. <if test="patientTel != null">patient_tel = #{patientTel},</if>
  285. <if test="patientGender != null">patient_gender = #{patientGender},</if>
  286. <if test="recordPic != null">record_pic = #{recordPic},</if>
  287. <if test="prescribeImgUrl != null">prescribe_img_url = #{prescribeImgUrl},</if>
  288. <if test="prescribeImgStoreUrl != null">prescribe_img_store_url = #{prescribeImgStoreUrl},</if>
  289. <if test="auditReason != null">audit_reason = #{auditReason},</if>
  290. <if test="diagnose != null">diagnose = #{diagnose},</if>
  291. <if test="doctorId != null">doctor_id = #{doctorId},</if>
  292. <if test="drugDoctorId != null">drug_doctor_id = #{drugDoctorId},</if>
  293. <if test="createTime != null">create_time = #{createTime},</if>
  294. <if test="status != null">status = #{status},</if>
  295. <if test="auditTime != null">audit_time = #{auditTime},</if>
  296. <if test="usageJson != null">usage_json = #{usageJson},</if>
  297. <if test="remark != null">remark = #{remark},</if>
  298. <if test="storeId != null">store_id = #{storeId},</if>
  299. <if test="prescribeDoctorId != null">prescribe_doctor_id = #{prescribeDoctorId},</if>
  300. <if test="doctorSignUrl != null">doctor_sign_url = #{doctorSignUrl},</if>
  301. <if test="prescribeDoctorSignUrl != null">prescribe_doctor_sign_url = #{prescribeDoctorSignUrl},</if>
  302. <if test="drugDoctorSignUrl != null">drug_doctor_sign_url = #{drugDoctorSignUrl},</if>
  303. <if test="patientBirthday != null">patient_birthday = #{patientBirthday},</if>
  304. <if test="recipeType != null">recipe_type = #{recipeType},</if>
  305. <if test="prescribeCodeUrl != null">prescribe_code_url = #{prescribeCodeUrl},</if>
  306. <if test="cycle != null">cycle = #{cycle},</if>
  307. <if test="icdCode != null">icd_code = #{icdCode},</if>
  308. <if test="source != null">source = #{source},</if>
  309. <if test="doctorConfirm != null">doctor_confirm = #{doctorConfirm},</if>
  310. <if test="startOperateTime != null">start_operate_time = #{startOperateTime},</if>
  311. <if test="endOperateTime != null">end_operate_time = #{endOperateTime},</if>
  312. <if test="operateSecond != null">operate_second = #{operateSecond},</if>
  313. <if test="thirdPartyUserId != null">third_party_user_id = #{thirdPartyUserId},</if>
  314. <if test="isSendToThirdParty != null">is_send_to_third_party = #{isSendToThirdParty},</if>
  315. <if test="handwriteCollectionId != null">handwrite_collection_id = #{handwriteCollectionId},</if>
  316. <if test="companyCustomerId != null">company_customer_id = #{companyCustomerId},</if>
  317. </trim>
  318. where prescribe_id = #{prescribeId}
  319. </update>
  320. <delete id="deleteFsPrescribeDataScrmByPrescribeId" parameterType="Long">
  321. delete from fs_prescribe_data_scrm where prescribe_id = #{prescribeId}
  322. </delete>
  323. <delete id="deleteFsPrescribeDataScrmByPrescribeIds" parameterType="Long">
  324. delete from fs_prescribe_data_scrm where prescribe_id in
  325. <foreach collection="array" item="prescribeId" open="(" separator="," close=")">
  326. #{prescribeId}
  327. </foreach>
  328. </delete>
  329. <update id="clearPrescribeUrl">
  330. UPDATE fs_prescribe_data_scrm
  331. SET prescribe_img_url = NULL, prescribe_img_store_url = NULL
  332. WHERE prescribe_id = 1;
  333. </update>
  334. </mapper>