PharmaceuticalServiceMapper.xml 69 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711
  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="PharmaceuticalServiceMapper">
  6. <!--档案管理查询-->
  7. <select id="selectArchivesList" parameterType="pd" resultType="pd">
  8. select *,DATE_FORMAT(updateTime, '%Y-%m-%d %H:%i:%s') AS updateTime2 from s_dtp_ysfw_archive_management where 1=1
  9. <if test="serviceTypeNumber!= null and serviceTypeNumber!=''">
  10. and serviceTypeNumber=#{serviceTypeNumber}
  11. </if>
  12. <if test="serviceTypeName!= null and serviceTypeName!=''">
  13. and serviceTypeName=#{serviceTypeName}
  14. </if>
  15. <if test="followUpPerson!= null and followUpPerson!=''">
  16. and followUpPerson=#{followUpPerson}
  17. </if>
  18. <if test="gender!= null and gender!=''">
  19. and gender=#{gender}
  20. </if>
  21. <if test="name!= null and name!=''">
  22. and name=#{name}
  23. </if>
  24. <if test="genericName!= null and genericName!=''">
  25. and genericName=#{genericName}
  26. </if>
  27. <if test="acceptFollowUp!= null and acceptFollowUp!=''">
  28. and acceptFollowUp=#{acceptFollowUp}
  29. </if>
  30. <if test="archiveCompleteStatus!= null and archiveCompleteStatus!=''">
  31. and archiveCompleteStatus=#{archiveCompleteStatus}
  32. </if>
  33. <if test="followUpPerson!= null and followUpPerson!=''">
  34. and followUpPerson=#{followUpPerson}
  35. </if>
  36. <if test="storeName!= null and storeName!=''">
  37. and storeName=#{storeName}
  38. </if>
  39. <if test="disease!= null and disease!=''">
  40. and disease=#{disease}
  41. </if>
  42. <if test="flipStatus!= null and flipStatus!=''">
  43. and flipStatus=#{flipStatus}
  44. </if>
  45. <if test="updateTime!= null and updateTime!=''">
  46. and updateTime like concat(#{updateTime}, '%')
  47. </if>
  48. <if test="joinProject!= null and joinProject!=''">
  49. and joinProject=#{joinProject}
  50. </if>
  51. <if test="charityAssistance!= null and charityAssistance!=''">
  52. and charityAssistance=#{charityAssistance}
  53. </if>
  54. <if test="id !=null and id !='' ">
  55. and id = #{id}
  56. </if>
  57. </select>
  58. <!-- 检查患者是否存在name LIKE CONCAT('%', #{name}, '%') -->
  59. <select id="checkPatientIsExist" parameterType="pd" resultType="pd">
  60. select name,phoneNumber from s_dtp_ysfw_archive_management where 1=1
  61. <if test="name!= null and name!=''">
  62. and name =#{name}
  63. </if>
  64. <if test="documentNumber!= null and documentNumber!=''">
  65. and documentNumber=#{documentNumber}
  66. </if>
  67. <if test="phoneNumber!= null and phoneNumber!=''">
  68. and phoneNumber=#{phoneNumber}
  69. </if>
  70. </select>
  71. <select id="slectPatientByNameOrPhone" parameterType="pd" resultType="pd">
  72. select * from s_dtp_ysfw_archive_management where 1=1 AND name LIKE CONCAT('%', #{query}, '%') or phoneNumber=#{query}
  73. </select>
  74. <select id="slectPatientByNameOrPhoneOrIdCard" parameterType="pd" resultType="pd">
  75. select * from s_dtp_ysfw_archive_management where 1=1 AND name LIKE CONCAT('%', #{query}, '%') or phoneNumber=#{query} or documentNumber=#{query}
  76. </select>
  77. <select id="slectPatientById" parameterType="pd" resultType="pd">
  78. select * from s_dtp_ysfw_archive_management where 1=1 AND id=#{id}
  79. </select>
  80. <select id="selectPatientById" parameterType="pd" resultType="pd">
  81. select * from s_dtp_ysfw_archive_management where 1=1 and id=#{patientId}
  82. </select>
  83. <!-- 插入新的档案记录 -->
  84. <insert id="insertArchiveRecord" parameterType="pd">
  85. INSERT INTO s_dtp_ysfw_archive_management
  86. <trim prefix="(" suffix=")" prefixOverrides="," suffixOverrides=",">
  87. <if test="realNameStatus != null">realNameStatus,</if>
  88. <if test="name != null and name != ''">name,</if>
  89. <if test="gender != null">gender,</if>
  90. <if test="age != null">age,</if>
  91. <if test="dateBirth != null">dateBirth,</if>
  92. <if test="phoneNumber != null and phoneNumber != ''">phoneNumber,</if>
  93. <if test="documentNumber != null and documentNumber != ''">documentNumber,</if>
  94. <if test="idCardImg != null and idCardImg != ''">idCardImg,</if>
  95. <if test="landlineNumber != null and landlineNumber != ''">landlineNumber,</if>
  96. <if test="documentType != null and documentType != ''">documentType,</if>
  97. <if test="createTime != null">createTime,</if>
  98. <if test="archiveCreator != null and archiveCreator != ''">archiveCreator,</if>
  99. <if test="creator != null and creator != ''">creator,</if>
  100. <if test="archiveCompleteStatus != null">archiveCompleteStatus,</if>
  101. <if test="contactRelation != null and contactRelation != ''">contactRelation,</if>
  102. <if test="contactPhone != null and contactPhone != ''">contactPhone,</if>
  103. <if test="contactName != null and contactName != ''">contactName,</if>
  104. <if test="flipStatus != null">flipStatus,</if>
  105. <if test="chronicTumorType != null and chronicTumorType != ''">chronicTumorType,</if>
  106. <if test="nation != null and nation != ''">nation,</if>
  107. <if test="nativePlace != null and nativePlace != ''">nativePlace,</if>
  108. <if test="height != null">height,</if>
  109. <if test="weight != null">weight,</if>
  110. <if test="BMI != null and BMI != ''">BMI,</if>
  111. <if test="storeId != null and storeId != ''">storeId,</if>
  112. <if test="insurance != null and insurance != ''">insurance,</if>
  113. <if test="socialSecurityCard != null and socialSecurityCard != ''">socialSecurityCard,</if>
  114. <if test="timeFirstDiagnosis != null">timeFirstDiagnosis,</if>
  115. <if test="diseaseType != null and diseaseType != ''">diseaseType,</if>
  116. <if test="healingLineCollection != null and healingLineCollection != ''">healingLineCollection,</if>
  117. <if test="disease != null and disease != ''">disease,</if>
  118. <if test="ownedStore != null and ownedStore != ''">ownedStore,</if>
  119. <if test="archiveCompleter != null and archiveCompleter != ''">archiveCompleter,</if>
  120. <if test="acceptFollowUp != null">acceptFollowUp,</if>
  121. <if test="followUpPerson != null and followUpPerson != ''">followUpPerson,</if>
  122. <if test="charityAssistance != null">charityAssistance,</if>
  123. <if test="manufacturer != null and manufacturer != ''">manufacturer,</if>
  124. <if test="joinProject != null">joinProject,</if>
  125. <if test="mdmCode != null and mdmCode != ''">mdmCode,</if>
  126. <if test="productName != null and productName != ''">productName,</if>
  127. <if test="storeName != null and storeName != ''">storeName,</if>
  128. <if test="followUpStatus != null">followUpStatus,</if>
  129. <if test="noFlipCause != null and noFlipCause != ''">noFlipCause,</if>
  130. <if test="genericName != null and genericName != ''">genericName,</if>
  131. <if test="updateTime != null and updateTime != ''">updateTime,</if>
  132. <if test="dl != null and dl != ''">dl,</if>
  133. <if test="xl != null and xl != ''">xl,</if>
  134. <if test="addr != null and addr != ''">addr</if>
  135. </trim>
  136. <trim prefix=" VALUES (" suffix=")" prefixOverrides="," suffixOverrides=",">
  137. <if test="realNameStatus != null">#{realNameStatus},</if>
  138. <if test="name != null and name != ''">#{name},</if>
  139. <if test="gender != null">#{gender},</if>
  140. <if test="age != null">#{age},</if>
  141. <if test="dateBirth != null">#{dateBirth},</if>
  142. <if test="phoneNumber != null and phoneNumber != ''">#{phoneNumber},</if>
  143. <if test="documentNumber != null and documentNumber != ''">#{documentNumber},</if>
  144. <if test="idCardImg != null and idCardImg != ''">#{idCardImg},</if>
  145. <if test="landlineNumber != null and landlineNumber != ''">#{landlineNumber},</if>
  146. <if test="documentType != null and documentType != ''">#{documentType},</if>
  147. <if test="createTime != null">#{createTime},</if>
  148. <if test="archiveCreator != null and archiveCreator != ''">#{archiveCreator},</if>
  149. <if test="creator != null and creator != ''">#{creator},</if>
  150. <if test="archiveCompleteStatus != null">#{archiveCompleteStatus},</if>
  151. <if test="contactRelation != null and contactRelation != ''">#{contactRelation},</if>
  152. <if test="contactPhone != null and contactPhone != ''">#{contactPhone},</if>
  153. <if test="contactName != null and contactName != ''">#{contactName},</if>
  154. <if test="flipStatus != null">#{flipStatus},</if>
  155. <if test="chronicTumorType != null and chronicTumorType != ''">#{chronicTumorType},</if>
  156. <if test="nation != null and nation != ''">#{nation},</if>
  157. <if test="nativePlace != null and nativePlace != ''">#{nativePlace},</if>
  158. <if test="height != null">#{height},</if>
  159. <if test="weight != null">#{weight},</if>
  160. <if test="BMI != null and BMI != ''">#{BMI},</if>
  161. <if test="storeId != null and storeId != ''">#{storeId},</if>
  162. <if test="insurance != null and insurance != ''">#{insurance},</if>
  163. <if test="socialSecurityCard != null and socialSecurityCard != ''">#{socialSecurityCard},</if>
  164. <if test="timeFirstDiagnosis != null">#{timeFirstDiagnosis},</if>
  165. <if test="diseaseType != null and diseaseType != ''">#{diseaseType},</if>
  166. <if test="healingLineCollection != null and healingLineCollection != ''">#{healingLineCollection},</if>
  167. <if test="disease != null and disease != ''">#{disease},</if>
  168. <if test="ownedStore != null and ownedStore != ''">#{ownedStore},</if>
  169. <if test="archiveCompleter != null and archiveCompleter != ''">#{archiveCompleter},</if>
  170. <if test="acceptFollowUp != null">#{acceptFollowUp},</if>
  171. <if test="followUpPerson != null and followUpPerson != ''">#{followUpPerson},</if>
  172. <if test="charityAssistance != null">#{charityAssistance},</if>
  173. <if test="manufacturer != null and manufacturer != ''">#{manufacturer},</if>
  174. <if test="joinProject != null">#{joinProject},</if>
  175. <if test="mdmCode != null and mdmCode != ''">#{mdmCode},</if>
  176. <if test="productName != null and productName != ''">#{productName},</if>
  177. <if test="storeName != null and storeName != ''">#{storeName},</if>
  178. <if test="followUpStatus != null">#{followUpStatus},</if>
  179. <if test="noFlipCause != null and noFlipCause != ''">#{noFlipCause},</if>
  180. <if test="genericName != null and genericName != ''">#{genericName},</if>
  181. <if test="updateTime != null and updateTime != ''">#{updateTime},</if>
  182. <if test="dl != null and dl != ''">#{dl},</if>
  183. <if test="xl != null and xl != ''">#{xl},</if>
  184. <if test="addr != null and addr != ''">#{addr}</if>
  185. </trim>
  186. </insert>
  187. <!-- 更新档案记录 -->
  188. <update id="updateArchiveRecord" parameterType="pd">
  189. UPDATE s_dtp_ysfw_archive_management
  190. SET
  191. <if test="realNameStatus != null ">realNameStatus = #{realNameStatus},</if>
  192. <if test="gender != null and gender != ''">gender = #{gender},</if>
  193. <if test="age != null and age != ''" >age = #{age},</if>
  194. <if test="dateBirth != null and dateBirth != ''">dateBirth = #{dateBirth},</if>
  195. <if test="phoneNumber != null and phoneNumber != ''">phoneNumber = #{phoneNumber},</if>
  196. <if test="documentNumber != null and documentNumber != ''">documentNumber=#{documentNumber},</if>
  197. <if test="idCardImg != null and idCardImg != ''">idCardImg=#{idCardImg},</if>
  198. <if test="landlineNumber != null and landlineNumber != ''">landlineNumber = #{landlineNumber},</if>
  199. <if test="archiveCompleteStatus != null">archiveCompleteStatus = #{archiveCompleteStatus},</if>
  200. <if test="contactRelation != null and contactRelation != ''">contactRelation = #{contactRelation},</if>
  201. <if test="contactPhone != null and contactPhone != ''">contactPhone = #{contactPhone},</if>
  202. <if test="contactName != null and contactName != ''">contactName = #{contactName},</if>
  203. <if test="flipStatus != null">flipStatus = #{flipStatus},</if>
  204. <if test="chronicTumorType != null and chronicTumorType != ''">chronicTumorType = #{chronicTumorType},</if>
  205. <if test="nation != null and nation != ''">nation = #{nation},</if>
  206. <if test="nativePlace != null and nativePlace != ''">nativePlace = #{nativePlace},</if>
  207. <if test="height != null and height != ''">height = #{height},</if>
  208. <if test="weight != null and weight != ''">weight = #{weight},</if>
  209. <if test="BMI != null and BMI != ''">BMI = #{BMI},</if>
  210. <if test="insurance != null and insurance != ''">insurance = #{insurance},</if>
  211. <if test="socialSecurityCard != null and socialSecurityCard != ''">socialSecurityCard = #{socialSecurityCard},</if>
  212. <if test="timeFirstDiagnosis != null">timeFirstDiagnosis = #{timeFirstDiagnosis},</if>
  213. <if test="diseaseType != null and diseaseType != ''">diseaseType = #{diseaseType},</if>
  214. <if test="healingLineCollection != null and healingLineCollection != ''">healingLineCollection = #{healingLineCollection},</if>
  215. <if test="disease != null and disease != ''">disease = #{disease},</if>
  216. <if test="ownedStore != null and ownedStore != ''">ownedStore = #{ownedStore},</if>
  217. <if test="archiveCompleter != null and archiveCompleter != ''">archiveCompleter = #{archiveCompleter},</if>
  218. <if test="acceptFollowUp != null">acceptFollowUp = #{acceptFollowUp},</if>
  219. <if test="followUpPerson != null and followUpPerson != ''">followUpPerson = #{followUpPerson},</if>
  220. <if test="charityAssistance != null">charityAssistance = #{charityAssistance},</if>
  221. <if test="manufacturer != null and manufacturer != ''">manufacturer = #{manufacturer},</if>
  222. <if test="joinProject != null and gender != ''">joinProject = #{joinProject},</if>
  223. <if test="mdmCode != null and mdmCode != ''">mdmCode = #{mdmCode},</if>
  224. <if test="productName != null and productName != ''">productName = #{productName},</if>
  225. <if test="storeName != null and storeName != ''">storeName = #{storeName},</if>
  226. <if test="storeId != null and storeId != ''">storeId = #{storeId},</if>
  227. <if test="noFlipCause != null and noFlipCause != ''">noFlipCause = #{noFlipCause},</if>
  228. <if test="followUpStatus != null and followUpStatus != ''">followUpStatus = #{followUpStatus},</if>
  229. <if test="genericName != null and genericName != ''">genericName = #{genericName},</if>
  230. updateTime = #{updateTime}
  231. WHERE id = #{id}
  232. </update>
  233. <!--患者绑定微信上翻-->
  234. <update id="ShaoMaShangFan" parameterType="pd">
  235. update s_dtp_ysfw_archive_management
  236. <trim prefix="SET" suffixOverrides="," prefixOverrides=",">
  237. <if test="openId != null and openId != ''">
  238. openId = #{openId},
  239. </if>
  240. <if test="flipStatus != null and flipStatus != ''">
  241. flipStatus = #{flipStatus},
  242. </if>
  243. <if test="updateTime != null and updateTime != ''">
  244. updateTime = #{updateTime},
  245. </if>
  246. <if test="archiveCreator != null and archiveCreator != ''">
  247. archiveCreator = #{archiveCreator},
  248. </if>
  249. </trim>
  250. where id = #{id}
  251. </update>
  252. <!--患者解除绑定-->
  253. <update id="unbound" parameterType="pd">
  254. update s_dtp_ysfw_archive_management
  255. <trim prefix="SET" suffixOverrides="," prefixOverrides=",">
  256. <if test="openId != null and openId != ''">
  257. openId = #{openId},
  258. </if>
  259. <if test="flipStatus != null and flipStatus != ''">
  260. flipStatus = #{flipStatus},
  261. </if>
  262. <if test="noFlipCause != null and noFlipCause != ''">
  263. noFlipCause = #{noFlipCause},
  264. </if>
  265. <if test="updateTime != null and updateTime != ''">
  266. updateTime = #{updateTime},
  267. </if>
  268. <if test="archiveCreator != null and archiveCreator != ''">
  269. archiveCreator = #{archiveCreator},
  270. </if>
  271. </trim>
  272. where id = #{id}
  273. </update>
  274. <!--档案管理修改-->
  275. <update id="updateArchives" parameterType="pd">
  276. update s_dtp_ysfw_archive_management
  277. <trim prefix="SET" suffixOverrides="," prefixOverrides=",">
  278. <if test="realNameStatus != null and realNameStatus!=''">
  279. realNameStatus = #{realNameStatus},
  280. </if>
  281. <if test="name != null and name != ''">
  282. name = #{name},
  283. </if>
  284. <if test="gender != null and gender != ''">
  285. gender = #{gender},
  286. </if>
  287. <if test="age != null and age != ''">
  288. age = #{age},
  289. </if>
  290. <if test="dateBirth != null and dateBirth != ''">
  291. dateBirth = #{dateBirth},
  292. </if>
  293. <if test="phoneNumber != null and phoneNumber != ''">
  294. phoneNumber = #{phoneNumber},
  295. </if>
  296. <if test="documentNumber != null and documentNumber != ''">
  297. documentNumber = #{documentNumber},
  298. </if>
  299. <if test="idCardImg != null and idCardImg != ''">
  300. idCardImg = #{idCardImg},
  301. </if>
  302. <if test="landlineNumber != null and landlineNumber != ''">
  303. landlineNumber = #{landlineNumber},
  304. </if>
  305. <if test="documentType != null and documentType != ''">
  306. documentType = #{documentType},
  307. </if>
  308. <if test="archiveCreator != null and archiveCreator != ''">
  309. archiveCreator = #{archiveCreator},
  310. </if>
  311. <if test="creator != null and creator != ''">
  312. creator = #{creator},
  313. </if>
  314. <if test="archiveCompleteStatus != null">
  315. archiveCompleteStatus = #{archiveCompleteStatus},
  316. </if>
  317. <if test="contactRelation != null and contactRelation != ''">
  318. contactRelation = #{contactRelation},
  319. </if>
  320. <if test="contactPhone != null and contactPhone != ''">
  321. contactPhone = #{contactPhone},
  322. </if>
  323. <if test="contactName != null and contactName != ''">
  324. contactName = #{contactName},
  325. </if>
  326. <if test="flipStatus != null and flipStatus != ''">
  327. flipStatus = #{flipStatus},
  328. </if>
  329. <if test="noFlipCause != null and noFlipCause != ''">
  330. noFlipCause = #{noFlipCause},
  331. </if>
  332. <if test="chronicTumorType != null and chronicTumorType != ''">
  333. chronicTumorType = #{chronicTumorType},
  334. </if>
  335. <if test="nation != null and nation != ''">
  336. nation = #{nation},
  337. </if>
  338. <if test="nativePlace != null and nativePlace != ''">
  339. nativePlace = #{nativePlace},
  340. </if>
  341. <if test="height != null and height != ''">
  342. height = #{height},
  343. </if>
  344. <if test="weight != null and weight != ''">
  345. weight = #{weight},
  346. </if>
  347. <if test="BMI != null and BMI != ''">
  348. BMI = #{BMI},
  349. </if>
  350. <if test="insurance != null and insurance != ''">
  351. insurance = #{insurance},
  352. </if>
  353. <if test="socialSecurityCard != null and socialSecurityCard != ''">
  354. socialSecurityCard = #{socialSecurityCard},
  355. </if>
  356. <if test="timeFirstDiagnosis != null and timeFirstDiagnosis != ''">
  357. timeFirstDiagnosis = #{timeFirstDiagnosis},
  358. </if>
  359. <if test="diseaseType != null and diseaseType != ''">
  360. diseaseType = #{diseaseType},
  361. </if>
  362. <if test="healingLineCollection != null and healingLineCollection != ''">
  363. healingLineCollection = #{healingLineCollection},
  364. </if>
  365. <if test="disease != null and disease != ''">
  366. disease = #{disease},
  367. </if>
  368. <if test="ownedStore != null and ownedStore != ''">
  369. ownedStore = #{ownedStore},
  370. </if>
  371. <if test="archiveCompleter != null and archiveCompleter != ''">
  372. archiveCompleter = #{archiveCompleter},
  373. </if>
  374. <if test="acceptFollowUp != null and acceptFollowUp != ''">
  375. acceptFollowUp = #{acceptFollowUp},
  376. </if>
  377. <if test="followUpPerson != null and followUpPerson != ''">
  378. followUpPerson = #{followUpPerson},
  379. </if>
  380. <if test="charityAssistance != null and charityAssistance != ''">
  381. charityAssistance = #{charityAssistance},
  382. </if>
  383. <if test="manufacturer != null and manufacturer != ''">
  384. manufacturer = #{manufacturer},
  385. </if>
  386. <if test="joinProject != null and joinProject != ''">
  387. joinProject = #{joinProject},
  388. </if>
  389. <if test="mdmCode != null and mdmCode != ''">
  390. mdmCode = #{mdmCode},
  391. </if>
  392. <if test="productName != null and productName != ''">
  393. productName = #{productName},
  394. </if>
  395. <if test="storeName != null and storeName != ''">
  396. storeName = #{storeName},
  397. </if>
  398. <if test="storeId != null and storeId != ''">
  399. storeId = #{storeId},
  400. </if>
  401. <if test="followUpStatus != null and followUpStatus != ''">
  402. followUpStatus = #{followUpStatus},
  403. </if>
  404. <if test="genericName != null and genericName != ''">
  405. genericName = #{genericName},
  406. </if>
  407. <if test="waist != null and waist != ''">
  408. waist = #{waist},
  409. </if>
  410. <if test="hip != null and hip != ''">
  411. hip = #{hip},
  412. </if>
  413. <if test="bloodPressure != null and bloodPressure != ''">
  414. bloodPressure = #{bloodPressure},
  415. </if>
  416. <if test="bloodSugar != null and bloodSugar != ''">
  417. bloodSugar = #{bloodSugar},
  418. </if>
  419. <if test="medicalHistory != null and medicalHistory != ''">
  420. medicalHistory = #{medicalHistory},
  421. </if>
  422. <if test="hasSurgicalTraumaHistory != null">
  423. hasSurgicalTraumaHistory = #{hasSurgicalTraumaHistory},
  424. </if>
  425. <if test="infectiousDiseaseHistory != null and infectiousDiseaseHistory != ''">
  426. infectiousDiseaseHistory = #{infectiousDiseaseHistory},
  427. </if>
  428. <if test="allergyHistory != null and allergyHistory != ''">
  429. allergyHistory = #{allergyHistory},
  430. </if>
  431. <if test="businessBelonging != null and businessBelonging != ''">
  432. businessBelonging = #{businessBelonging},
  433. </if>
  434. <if test="zlfq != null and zlfq != ''">
  435. zlfq = #{zlfq},
  436. </if>
  437. <if test="jytb != null and jytb != ''">
  438. jytb = #{jytb},
  439. </if>
  440. <if test="treatmentStage != null and treatmentStage != ''">
  441. treatmentStage = #{treatmentStage},
  442. </if>
  443. <if test="fzjc != null and fzjc != ''">
  444. fzjc = #{fzjc},
  445. </if>
  446. <if test="pdl1 != null and pdl1 != ''">
  447. pdl1 = #{pdl1},
  448. </if>
  449. <if test="zlsd != null and zlsd != ''">
  450. zlsd = #{zlsd},
  451. </if>
  452. <if test="dl != null and dl != ''">dl=#{dl},</if>
  453. <if test="xl != null and xl != ''">xl=#{xl},</if>
  454. <if test="addr != null and addr != ''">addr=#{addr},</if>
  455. <if test="contactName != null and contactName != ''">contactName=#{contactName},</if>
  456. <if test="contactPhone != null and contactPhone != ''">contactPhone=#{contactPhone},</if>
  457. <if test="tnb != null and tnb != ''">
  458. tnb = #{tnb},
  459. </if>
  460. <if test="tnbhbz != null and tnbhbz != ''">
  461. tnbhbz = #{tnbhbz},
  462. </if>
  463. <if test="gxy != null and gxy != ''">
  464. gxy = #{gxy},
  465. </if>
  466. <if test="gxyhbz != null and gxyhbz != ''">
  467. gxyhbz = #{gxyhbz},
  468. </if>
  469. <if test="gxz != null and gxz != ''">
  470. gxz = #{gxz},
  471. </if>
  472. <if test="gxzhbz != null and gxzhbz != ''">
  473. gxzhbz = #{gxzhbz},
  474. </if>
  475. </trim>
  476. where id = #{id}
  477. </update>
  478. <!--档案管理删除-->
  479. <delete id="archivesRemove" parameterType="pd">
  480. <if test="ids != null">
  481. delete from s_dtp_ysfw_archive_management where
  482. <if test="ids != null">
  483. id in(#{ids})
  484. </if>
  485. </if>
  486. </delete>
  487. <!--随访任务 查询-->
  488. <select id="selectFollowUpList" parameterType="pd" resultType="pd">
  489. select *,DATE_FORMAT(updatedAt, '%Y-%m-%d %H:%i:%s') AS updateTime2 from s_dtp_ysfw_follow_up_task where 1=1
  490. <if test="id != null and id != ''">
  491. and id=#{id}
  492. </if>
  493. <if test="appointmentDate != null and appointmentDate != ''">
  494. and appointmentDate=#{appointmentDate}
  495. </if>
  496. <if test="businessBelonging != null and businessBelonging != ''">
  497. and businessBelonging=#{businessBelonging}
  498. </if>
  499. <if test="taskName != null and taskName != ''">
  500. and taskName=#{taskName}
  501. </if>
  502. <if test="taskTheme != null and taskTheme != ''">
  503. and taskTheme=#{taskTheme}
  504. </if>
  505. <if test="patientName != null and patientName != ''">
  506. and patientName=#{patientName}
  507. </if>
  508. <if test="gender != null and gender != ''">
  509. and gender=#{gender}
  510. </if>
  511. <if test="age != null and age != ''">
  512. and age=#{age}
  513. </if>
  514. <if test="followUpSummary != null and followUpSummary != ''">
  515. and followUpSummary=#{followUpSummary}
  516. </if>
  517. <if test="disease != null and disease != ''">
  518. and disease=#{disease}
  519. </if>
  520. <if test="storeName != null and storeName != ''">
  521. and storeName=#{storeName}
  522. </if>
  523. <if test="genericName != null and genericName != ''">
  524. and genericName=#{genericName}
  525. </if>
  526. <if test="productName != null and productName != ''">
  527. and productName=#{productName}
  528. </if>
  529. <if test="taskFollower != null and taskFollower != ''">
  530. and taskFollower=#{taskFollower}
  531. </if>
  532. <if test="actualFollowUpTime != null and actualFollowUpTime != ''">
  533. and actualFollowUpTime=#{actualFollowUpTime}
  534. </if>
  535. <if test="callConnectedCount != null and callConnectedCount != ''">
  536. and callConnectedCount=#{callConnectedCount}
  537. </if>
  538. <if test="outboundCallCount != null and outboundCallCount != ''">
  539. and outboundCallCount=#{outboundCallCount}
  540. </if>
  541. <if test="nextOutboundCallCount != null and nextOutboundCallCount != ''">
  542. and nextOutboundCallCount=#{nextOutboundCallCount}
  543. </if>
  544. <if test="taskStatus != null and taskStatus != ''">
  545. and taskStatus=#{taskStatus}
  546. </if>
  547. <if test="lastOutboundStatus != null and lastOutboundStatus != ''">
  548. and lastOutboundStatus=#{lastOutboundStatus}
  549. </if>
  550. <if test="createdAt != null and createdAt != ''">
  551. and createdAt=#{createdAt}
  552. </if>
  553. <if test="updatedAt != null and updatedAt != ''">
  554. and updatedAt=#{updatedAt}
  555. </if>
  556. </select>
  557. <!--随访任务 修改-->
  558. <update id="updateFollowUp" parameterType="pd" >
  559. <if test="up != null and up!=''">
  560. update s_dtp_ysfw_follow_up_task
  561. </if>
  562. <trim prefix=" SET " suffix="" prefixOverrides="," suffixOverrides=",">
  563. <if test="appointmentDate != null and appointmentDate != ''">
  564. appointmentDate=#{appointmentDate},
  565. </if>
  566. <if test="businessBelonging != null and businessBelonging != ''">
  567. businessBelonging=#{businessBelonging},
  568. </if>
  569. <if test="taskName != null and taskName != ''">
  570. taskName=#{taskName},
  571. </if>
  572. <if test="taskTheme != null and taskTheme != ''">
  573. taskTheme=#{taskTheme},
  574. </if>
  575. <if test="patientName != null and patientName != ''">
  576. patientName=#{patientName},
  577. </if>
  578. <if test="gender != null and gender != ''">
  579. gender=#{gender},
  580. </if>
  581. <if test="age != null and age != ''">
  582. age=#{age},
  583. </if>
  584. <if test="followUpSummary != null and followUpSummary != ''">
  585. followUpSummary=#{followUpSummary},
  586. </if>
  587. <if test="disease != null and disease != ''">
  588. disease=#{disease},
  589. </if>
  590. <if test="storeName != null and storeName != ''">
  591. storeName=#{storeName},
  592. </if>
  593. <if test="genericName != null and genericName != ''">
  594. genericName=#{genericName},
  595. </if>
  596. <if test="productName != null and productName != ''">
  597. productName=#{productName},
  598. </if>
  599. <if test="taskFollower != null and taskFollower != ''">
  600. taskFollower=#{taskFollower},
  601. </if>
  602. <if test="actualFollowUpTime != null and actualFollowUpTime != ''">
  603. actualFollowUpTime=#{actualFollowUpTime},
  604. </if>
  605. <if test="callConnectedCount != null and callConnectedCount != ''">
  606. callConnectedCount=#{callConnectedCount},
  607. </if>
  608. <if test="outboundCallCount != null and outboundCallCount != ''">
  609. outboundCallCount=#{outboundCallCount},
  610. </if>
  611. <if test="nextOutboundCallCount != null and nextOutboundCallCount != ''">
  612. nextOutboundCallCount=#{nextOutboundCallCount},
  613. </if>
  614. <if test="taskStatus != null and taskStatus != ''">
  615. taskStatus=#{taskStatus},
  616. </if>
  617. <if test="lastOutboundStatus != null and lastOutboundStatus != ''">
  618. lastOutboundStatus=#{lastOutboundStatus},
  619. </if>
  620. <if test="createdAt != null and createdAt != ''">
  621. createdAt=#{createdAt},
  622. </if>
  623. <if test="updatedAt != null and updatedAt != ''">
  624. updatedAt=#{updatedAt},
  625. </if>
  626. </trim>
  627. <if test="up != null and up!=''">
  628. <if test="id!= null and id!=''">
  629. where id=#{id}
  630. </if>
  631. </if>
  632. </update>
  633. <!--随访任务 删除-->
  634. <delete id="followUpRemove" parameterType="pd">
  635. <if test="ids != null">
  636. delete from s_dtp_ysfw_follow_up_task where
  637. <if test="ids != null">
  638. id in(#{ids})
  639. </if>
  640. </if>
  641. </delete>
  642. <!--随访跟进人分配 查询-->
  643. <select id="selectFollowUpAssignList" parameterType="pd" resultType="pd">
  644. select *,DATE_FORMAT(updatedAt, '%Y-%m-%d %H:%i:%s') AS updateTime2 from s_dtp_ysfw_follow_up_assign where 1=1
  645. <if test="id != null and id != ''">
  646. and id=#{id}
  647. </if>
  648. <if test="patientName != null and patientName != ''">
  649. and patientName=#{patientName}
  650. </if>
  651. <if test="patientPhone != null and patientPhone != ''">
  652. and patientPhone=#{patientPhone}
  653. </if>
  654. <if test="gender != null and gender != ''">
  655. and gender=#{gender}
  656. </if>
  657. <if test="age != null and age != ''">
  658. and age=#{age}
  659. </if>
  660. <if test="disease != null and disease != ''">
  661. and disease=#{disease}
  662. </if>
  663. <if test="clinicalDiagnosis != null">
  664. and clinicalDiagnosis=#{clinicalDiagnosis}
  665. </if>
  666. <if test="medicineName != null and medicineName != ''">
  667. and medicineName=#{medicineName}
  668. </if>
  669. <if test="lastPurchaseDate != null">
  670. and lastPurchaseDate=#{lastPurchaseDate}
  671. </if>
  672. <if test="filingDate != null">
  673. and filingDate=#{filingDate}
  674. </if>
  675. <if test="followUpPersonName != null and followUpPersonName != ''">
  676. and followUpPersonName=#{followUpPersonName}
  677. </if>
  678. <if test="followUpPersonPhone != null and followUpPersonPhone != ''">
  679. and followUpPersonPhone=#{followUpPersonPhone}
  680. </if>
  681. <if test="followUpPersonRole != null and followUpPersonRole != ''">
  682. and followUpPersonRole=#{followUpPersonRole}
  683. </if>
  684. <if test="storeName != null and storeName != ''">
  685. and storeName=#{storeName}
  686. </if>
  687. <if test="patientAssignmentStatus != null and patientAssignmentStatus != ''">
  688. and patientAssignmentStatus=#{patientAssignmentStatus}
  689. </if>
  690. <if test="terminatedEmployeeName != null">
  691. and terminatedEmployeeName=#{terminatedEmployeeName}
  692. </if>
  693. <if test="terminatedEmployeePhone != null">
  694. and terminatedEmployeePhone=#{terminatedEmployeePhone}
  695. </if>
  696. <if test="terminatedEmployeeStore != null">
  697. and terminatedEmployeeStore=#{terminatedEmployeeStore}
  698. </if>
  699. <if test="createdAt != null">
  700. and createdAt=#{createdAt}
  701. </if>
  702. <if test="updatedAt != null">
  703. and updatedAt=#{updatedAt}
  704. </if>
  705. </select>
  706. <!--随访跟进人分配 修改-->
  707. <update id="updateFollowUpAssign" parameterType="pd" >
  708. <if test="up != null and up!=''">
  709. update s_dtp_ysfw_follow_up_assign
  710. </if>
  711. <trim prefix=" SET " suffix="" prefixOverrides="," suffixOverrides=",">
  712. <if test="patientName != null and patientName != ''">
  713. patientName=#{patientName},
  714. </if>
  715. <if test="patientPhone != null and patientPhone != ''">
  716. patientPhone=#{patientPhone},
  717. </if>
  718. <if test="gender != null and gender != ''">
  719. gender=#{gender},
  720. </if>
  721. <if test="age != null and age != ''">
  722. age=#{age},
  723. </if>
  724. <if test="disease != null and disease != ''">
  725. disease=#{disease},
  726. </if>
  727. <if test="clinicalDiagnosis != null">
  728. clinicalDiagnosis=#{clinicalDiagnosis},
  729. </if>
  730. <if test="medicineName != null and medicineName != ''">
  731. medicineName=#{medicineName},
  732. </if>
  733. <if test="lastPurchaseDate != null">
  734. lastPurchaseDate=#{lastPurchaseDate},
  735. </if>
  736. <if test="filingDate != null">
  737. filingDate=#{filingDate},
  738. </if>
  739. <if test="followUpPersonName != null and followUpPersonName != ''">
  740. followUpPersonName=#{followUpPersonName},
  741. </if>
  742. <if test="followUpPersonPhone != null and followUpPersonPhone != ''">
  743. followUpPersonPhone=#{followUpPersonPhone},
  744. </if>
  745. <if test="followUpPersonRole != null and followUpPersonRole != ''">
  746. followUpPersonRole=#{followUpPersonRole},
  747. </if>
  748. <if test="storeName != null and storeName != ''">
  749. storeName=#{storeName},
  750. </if>
  751. <if test="patientAssignmentStatus != null and patientAssignmentStatus != ''">
  752. patientAssignmentStatus=#{patientAssignmentStatus},
  753. </if>
  754. <if test="terminatedEmployeeName != null">
  755. terminatedEmployeeName=#{terminatedEmployeeName},
  756. </if>
  757. <if test="terminatedEmployeePhone != null">
  758. terminatedEmployeePhone=#{terminatedEmployeePhone},
  759. </if>
  760. <if test="terminatedEmployeeStore != null">
  761. terminatedEmployeeStore=#{terminatedEmployeeStore},
  762. </if>
  763. <if test="createdAt != null">
  764. createdAt=#{createdAt},
  765. </if>
  766. <if test="updatedAt != null">
  767. updatedAt=#{updatedAt},
  768. </if>
  769. </trim>
  770. <if test="up != null and up!=''">
  771. <if test="id!= null and id!=''">
  772. where id=#{id}
  773. </if>
  774. </if>
  775. </update>
  776. <!--随访跟进人分配 删除-->
  777. <delete id="followUpAssignRemove" parameterType="pd">
  778. <if test="ids != null">
  779. delete from s_dtp_ysfw_follow_up_assign where
  780. <if test="ids != null">
  781. id in(#{ids})
  782. </if>
  783. </if>
  784. </delete>
  785. <!--根据所属们id查询患者信息-->
  786. <select id="getAllPatients" parameterType="pd" resultType="pd">
  787. select id ,name ,storeName ,storeId from s_dtp_ysfw_archive_management where 1=1 and storeId=#{DeptId}
  788. </select>
  789. <select id="selectConsultationAndDrug" parameterType="pd" resultType="pd">
  790. SELECT
  791. pc.id AS id,
  792. pc.storeName,
  793. pc.storeId,
  794. pc.patientId,
  795. pc.createdBy,
  796. pc.createdDate,
  797. pc.patientName,
  798. pc.patientPhone,
  799. pc.gender,
  800. pc.age,
  801. pc.KnowledgeLink,
  802. pc.questionType,
  803. pc.consultationQuestion,
  804. pc.pharmacistAnswer,
  805. pc.consultationTime,
  806. pc.disease,
  807. pc.genericName,
  808. pc.productName,
  809. pd.id AS prescriptionDrugId,
  810. pd.productName AS prescriptionProductName,
  811. pd.genericName AS prescriptionGenericName,
  812. pd.mdmCode AS prescriptionmdmCode,
  813. pd.prescriptionNumber
  814. FROM
  815. s_dtp_ysfw_patient_consultation pc
  816. LEFT JOIN
  817. s_dtp_cfdj_prescription_drug pd ON pc.patientId = pd.patientId
  818. WHERE
  819. pc.storeId = #{storeId}
  820. <if test="createdDate != null">
  821. AND pc.createdDate=#{createdDate}
  822. </if>
  823. <if test="query != null and query != ''">
  824. AND (pc.patientName LIKE CONCAT('%', #{query}, '%')
  825. OR pc.patientPhone = #{query})
  826. </if>
  827. <if test="questionType != null and questionType != ''">
  828. AND pc.questionType=#{questionType}
  829. </if>
  830. <if test="consultationQuestion != null and consultationQuestion != ''">
  831. AND pc.consultationQuestion=#{consultationQuestion}
  832. </if>
  833. <if test="pharmacistAnswer != null and pharmacistAnswer != ''">
  834. AND pc.pharmacistAnswer=#{pharmacistAnswer}
  835. </if>
  836. <if test="beginTime != null and beginTime!='' and endTime != null and endTime!=''">
  837. and pc.consultationTime between #{beginTime} and #{endTime}
  838. </if>
  839. <if test="disease != null and disease != ''">
  840. AND pc.disease=#{disease}
  841. </if>
  842. <if test="product != null and product != ''">
  843. AND pd.genericName =#{product} OR pd.productName = #{product} OR pd.mdmCode = #{product}
  844. </if>
  845. ORDER BY
  846. pc.id ASC
  847. </select>
  848. <!--患者咨询根据id-->
  849. <select id="findPatientCounselingById" parameterType="pd" resultType="pd">
  850. select * from s_dtp_ysfw_patient_consultation where 1=1 and id=#{id}
  851. </select>
  852. <!--患者咨询 查询所有-->
  853. <select id="selectPatientCounselingList" parameterType="pd" resultType="pd">
  854. select *,DATE_FORMAT(consultationTime, '%Y-%m-%d %H:%i:%s') AS updateTime2 from s_dtp_ysfw_patient_consultation where 1=1
  855. <if test="id != null and id != ''">
  856. and id=#{id}
  857. </if>
  858. <if test="createdBy != null and createdBy != ''">
  859. AND createdBy=#{createdBy}
  860. </if>
  861. <if test="createdDate != null">
  862. AND createdDate=#{createdDate}
  863. </if>
  864. <if test="patientName != null and patientName != ''">
  865. AND patientName=#{patientName}
  866. </if>
  867. <if test="patientPhone != null and patientPhone != ''">
  868. AND patientPhone=#{patientPhone}
  869. </if>
  870. <if test="questionType != null and questionType != ''">
  871. AND questionType=#{questionType}
  872. </if>
  873. <if test="consultationQuestion != null and consultationQuestion != ''">
  874. AND consultationQuestion=#{consultationQuestion}
  875. </if>
  876. <if test="pharmacistAnswer != null and pharmacistAnswer != ''">
  877. AND pharmacistAnswer=#{pharmacistAnswer}
  878. </if>
  879. <if test="consultationTime != null">
  880. AND consultationTime=#{consultationTime}
  881. </if>
  882. <if test="disease != null and disease != ''">
  883. AND disease=#{disease}
  884. </if>
  885. <if test="genericName != null and genericName != ''">
  886. AND genericName=#{genericName}
  887. </if>
  888. <if test="productName != null and productName != ''">
  889. AND productName=#{productName}
  890. </if>
  891. </select>
  892. <insert id="insertPatientConsultation" parameterType="pd">
  893. INSERT INTO s_dtp_ysfw_patient_consultation
  894. <trim prefix="(" suffix=")" prefixOverrides="," suffixOverrides=",">
  895. <if test="createdBy != null and createdBy !=''">createdBy,</if>
  896. <if test="createdDate != null and createdDate !=''">createdDate,</if>
  897. <if test="patientName != null and patientName != ''">patientName,</if>
  898. <if test="patientPhone != null and patientPhone != ''">patientPhone,</if>
  899. <if test="gender != null">gender,</if>
  900. <if test="age != null">age,</if>
  901. <if test="KnowledgeLink != null and KnowledgeLink != ''">KnowledgeLink,</if>
  902. <if test="questionType != null and questionType != ''">questionType,</if>
  903. <if test="consultationQuestion != null and consultationQuestion != ''">consultationQuestion,</if>
  904. <if test="pharmacistAnswer != null and pharmacistAnswer != ''">pharmacistAnswer,</if>
  905. <if test="consultationTime != null">consultationTime,</if>
  906. <if test="contactRelation != null and contactRelation != ''">contactRelation,</if>
  907. <if test="disease != null and disease != ''">disease,</if>
  908. <if test="genericName != null and genericName != ''">genericName,</if>
  909. <if test="productName != null and productName != ''">productName,</if>
  910. <if test="storeId != null">storeId,</if>
  911. <if test="storeName != null and storeName != ''">storeName,</if>
  912. <if test="patientId != null">patientId,</if>
  913. </trim>
  914. <trim prefix=" VALUES (" suffix=")" prefixOverrides="," suffixOverrides=",">
  915. <if test="createdBy != null and createdBy !=''">#{createdBy},</if>
  916. <if test="createdDate != null and createdDate !=''">#{createdDate},</if>
  917. <if test="patientName != null and patientName != ''">#{patientName},</if>
  918. <if test="patientPhone != null and patientPhone != ''">#{patientPhone},</if>
  919. <if test="gender != null">#{gender},</if>
  920. <if test="age != null">#{age},</if>
  921. <if test="KnowledgeLink != null and KnowledgeLink != ''">#{KnowledgeLink},</if>
  922. <if test="questionType != null and questionType != ''">#{questionType},</if>
  923. <if test="consultationQuestion != null and consultationQuestion != ''">#{consultationQuestion},</if>
  924. <if test="pharmacistAnswer != null and pharmacistAnswer != ''">#{pharmacistAnswer},</if>
  925. <if test="consultationTime != null and consultationTime != ''">#{consultationTime},</if>
  926. <if test="contactRelation != null and contactRelation != ''">#{contactRelation},</if>
  927. <if test="disease != null and disease != ''">#{disease},</if>
  928. <if test="genericName != null and genericName != ''">#{genericName},</if>
  929. <if test="productName != null and productName != ''">#{productName},</if>
  930. <if test="storeId != null">#{storeId},</if>
  931. <if test="storeName != null and storeName != ''">#{storeName},</if>
  932. <if test="patientId != null and patientId != ''">#{patientId},</if>
  933. </trim>
  934. </insert>
  935. <!--患者咨询 修改-->
  936. <update id="updatePatientCounseling" parameterType="pd" >
  937. <if test="up != null and up!=''">
  938. update s_dtp_ysfw_patient_consultation
  939. </if>
  940. <trim prefix=" SET " suffix="" prefixOverrides="," suffixOverrides=",">
  941. <if test="regenerator != null and regenerator != ''">
  942. regenerator=#{regenerator},
  943. </if>
  944. <if test="updateDate != null and updateDate !=''">
  945. updateDate=#{updateDate},
  946. </if>
  947. <if test="questionType != null and questionType != ''">
  948. questionType=#{questionType},
  949. </if>
  950. <if test="KnowledgeLink != null and KnowledgeLink != ''">
  951. KnowledgeLink=#{KnowledgeLink},
  952. </if>
  953. <if test="contactRelation != null and contactRelation != ''">
  954. contactRelation=#{contactRelation},
  955. </if>
  956. <if test="consultationQuestion != null and consultationQuestion != ''">
  957. consultationQuestion=#{consultationQuestion},
  958. </if>
  959. <if test="pharmacistAnswer != null and pharmacistAnswer != ''">
  960. pharmacistAnswer=#{pharmacistAnswer},
  961. </if>
  962. <if test="consultationTime != null">
  963. consultationTime=#{consultationTime},
  964. </if>
  965. </trim>
  966. <if test="up != null and up!=''">
  967. <if test="id!= null and id!=''">
  968. where id=#{id}
  969. </if>
  970. </if>
  971. </update>
  972. <!--患者咨询 删除-->
  973. <delete id="patientCounselingRemove" parameterType="pd">
  974. <if test="ids != null">
  975. delete from s_dtp_ysfw_patient_consultation where
  976. <if test="ids != null">
  977. id in(#{ids})
  978. </if>
  979. </if>
  980. </delete>
  981. <!--随访满意度评价 查询-->
  982. <select id="selectFindFollowUpEvaluationList" parameterType="pd" resultType="pd">
  983. select * from s_ysfw_follow_up_evaluation where 1=1
  984. <if test="id != null and id != ''">
  985. AND id = #{id}
  986. </if>
  987. <if test="businessId != null and businessId != ''">
  988. AND businessId = #{businessId}
  989. </if>
  990. <if test="businessName != null and businessName != ''">
  991. AND businessName = #{businessName}
  992. </if>
  993. <if test="createdBy != null and createdBy != ''">
  994. AND createdBy = #{createdBy}
  995. </if>
  996. <if test="createdDate != null">
  997. AND createdDate = #{createdDate}
  998. </if>
  999. <if test="patientName != null and patientName != ''">
  1000. AND patientName = #{patientName}
  1001. </if>
  1002. <if test="followUpTask != null and followUpTask != ''">
  1003. AND followUpTask = #{followUpTask}
  1004. </if>
  1005. <if test="taskFollower != null and taskFollower != ''">
  1006. AND taskFollower = #{taskFollower}
  1007. </if>
  1008. <if test="evaluationDate != null and evaluationDate != ''" >
  1009. AND evaluationDate = #{evaluationDate}
  1010. </if>
  1011. <if test="beginTime != null and beginTime!='' and endTime != null and endTime!=''">
  1012. and evaluationDate between #{beginTime} and #{endTime}
  1013. </if>
  1014. <if test="chainStoreName != null and chainStoreName != ''">
  1015. AND chainStoreName = #{chainStoreName}
  1016. </if>
  1017. <if test="storeName != null and storeName != ''">
  1018. AND storeName = #{storeName}
  1019. </if>
  1020. <if test="taskId != null and taskId != ''">
  1021. AND taskId = #{taskId}
  1022. </if>
  1023. </select>
  1024. <!--随访满意度评价 修改-->
  1025. <update id="updateFindFollowUpEvaluation" parameterType="pd" >
  1026. <if test="up != null and up!=''">
  1027. update s_ysfw_follow_up_evaluation
  1028. </if>
  1029. <trim prefix=" SET " suffix="" prefixOverrides="," suffixOverrides=",">
  1030. <if test="businessName != null and businessName != ''">
  1031. businessName = #{businessName},
  1032. </if>
  1033. <if test="createdBy != null and createdBy != ''">
  1034. createdBy = #{createdBy},
  1035. </if>
  1036. <if test="createdDate != null">
  1037. createdDate = #{createdDate},
  1038. </if>
  1039. <if test="patientName != null and patientName != ''">
  1040. patientName = #{patientName},
  1041. </if>
  1042. <if test="followUpTask != null and followUpTask != ''">
  1043. followUpTask = #{followUpTask},
  1044. </if>
  1045. <if test="taskFollower != null and taskFollower != ''">
  1046. taskFollower = #{taskFollower},
  1047. </if>
  1048. <if test="evaluationDate != null">
  1049. evaluationDate = #{evaluationDate},
  1050. </if>
  1051. <if test="chainStoreName != null and chainStoreName != ''">
  1052. chainStoreName = #{chainStoreName},
  1053. </if>
  1054. <if test="storeName != null and storeName != ''">
  1055. storeName = #{storeName},
  1056. </if>
  1057. <if test="taskId != null and taskId != ''">
  1058. taskId = #{taskId},
  1059. </if>
  1060. </trim>
  1061. <if test="up != null and up!=''">
  1062. <if test="id!= null and id!=''">
  1063. where id=#{id}
  1064. </if>
  1065. </if>
  1066. </update>
  1067. <!--随访满意度评价 删除-->
  1068. <delete id="findFollowUpEvaluationRemove" parameterType="pd">
  1069. <if test="ids != null">
  1070. delete from s_ysfw_follow_up_evaluation where
  1071. <if test="ids != null">
  1072. id in(#{ids})
  1073. </if>
  1074. </if>
  1075. </delete>
  1076. <!--查询患者基础信息-->
  1077. <select id="selectPatientBasicInfo" parameterType="pd" resultType="pd">
  1078. SELECT * FROM s_dtp_ysfw_patientbasicinfor WHERE 1=1
  1079. <if test="id != null and id != ''">
  1080. AND id = #{id}
  1081. </if>
  1082. <if test="currentEconomicSituation != null and currentEconomicSituation != ''">
  1083. AND currentEconomicSituation = #{currentEconomicSituation}
  1084. </if>
  1085. <if test="patientAwareness != null and patientAwareness != ''">
  1086. AND patientAwareness = #{patientAwareness}
  1087. </if>
  1088. <if test="followUpFeedbackDoctor != null and followUpFeedbackDoctor != ''">
  1089. AND followUpFeedbackDoctor = #{followUpFeedbackDoctor}
  1090. </if>
  1091. <if test="bloodPressureStatus != null and bloodPressureStatus != ''">
  1092. AND bloodPressureStatus = #{bloodPressureStatus}
  1093. </if>
  1094. <if test="heartRate != null and heartRate != ''">
  1095. AND heartRate = #{heartRate}
  1096. </if>
  1097. <if test="smokingHistory != null and smokingHistory != ''">
  1098. AND smokingHistory = #{smokingHistory}
  1099. </if>
  1100. <if test="drinkingHistory != null and drinkingHistory != ''">
  1101. AND drinkingHistory = #{drinkingHistory}
  1102. </if>
  1103. <if test="exerciseHabit != null and exerciseHabit != ''">
  1104. AND exerciseHabit = #{exerciseHabit}
  1105. </if>
  1106. <if test="dietaryPreference != null and dietaryPreference != ''">
  1107. AND dietaryPreference = #{dietaryPreference}
  1108. </if>
  1109. <if test="sleepCondition != null and sleepCondition != ''">
  1110. AND sleepCondition = #{sleepCondition}
  1111. </if>
  1112. <if test="pathologicalStage != null and pathologicalStage != ''">
  1113. AND pathologicalStage = #{pathologicalStage}
  1114. </if>
  1115. <if test="treatmentStage != null and treatmentStage != ''">
  1116. AND treatmentStage = #{treatmentStage}
  1117. </if>
  1118. <if test="accompanyingSymptoms != null and accompanyingSymptoms != ''">
  1119. AND accompanyingSymptoms = #{accompanyingSymptoms}
  1120. </if>
  1121. <if test="hasGeneticTesting != null and hasGeneticTesting != ''">
  1122. AND hasGeneticTesting = #{hasGeneticTesting}
  1123. </if>
  1124. <if test="hasImmuneTesting != null and hasImmuneTesting != ''">
  1125. AND hasImmuneTesting = #{hasImmuneTesting}
  1126. </if>
  1127. <if test="medicalHistory != null and medicalHistory != ''">
  1128. AND medicalHistory = #{medicalHistory}
  1129. </if>
  1130. <if test="medicalHistoryDescription != null and medicalHistoryDescription != ''">
  1131. AND medicalHistoryDescription = #{medicalHistoryDescription}
  1132. </if>
  1133. <if test="infectiousDiseaseHistory != null and infectiousDiseaseHistory != ''">
  1134. AND infectiousDiseaseHistory = #{infectiousDiseaseHistory}
  1135. </if>
  1136. <if test="infectiousDiseaseHistoryDescription != null and infectiousDiseaseHistoryDescription != ''">
  1137. AND infectiousDiseaseHistoryDescription = #{infectiousDiseaseHistoryDescription}
  1138. </if>
  1139. <if test="allergyHistory != null and allergyHistory != ''">
  1140. AND allergyHistory = #{allergyHistory}
  1141. </if>
  1142. <if test="pastAdverseDrugReactionHistory != null and pastAdverseDrugReactionHistory != ''">
  1143. AND pastAdverseDrugReactionHistory = #{pastAdverseDrugReactionHistory}
  1144. </if>
  1145. <if test="hasSurgicalTraumaHistory != null and hasSurgicalTraumaHistory != ''">
  1146. AND hasSurgicalTraumaHistory = #{hasSurgicalTraumaHistory}
  1147. </if>
  1148. <if test="multipleTreatmentReasonsDescription != null and multipleTreatmentReasonsDescription != ''">
  1149. AND multipleTreatmentReasonsDescription = #{multipleTreatmentReasonsDescription}
  1150. </if>
  1151. <if test="familyHistoryId != null and familyHistoryId != ''">
  1152. AND familyHistoryId = #{familyHistoryId}
  1153. </if>
  1154. <if test="previousMedicationId != null and previousMedicationId != ''">
  1155. AND previousMedicationId = #{previousMedicationId}
  1156. </if>
  1157. <if test="contactPersonId != null and contactPersonId != ''">
  1158. AND contactPersonId = #{contactPersonId}
  1159. </if>
  1160. <if test="archiveId != null and archiveId != ''">
  1161. AND archiveId = #{archiveId}
  1162. </if>
  1163. <if test="caregiver != null and caregiver != ''">
  1164. AND caregiver = #{caregiver}
  1165. </if>
  1166. <if test="createdBy != null and createdBy != ''">
  1167. AND createdBy = #{createdBy}
  1168. </if>
  1169. <if test="createdAt != null and createdAt != ''">
  1170. AND createdAt = #{createdAt}
  1171. </if>
  1172. <if test="basicInfoCompleter != null and basicInfoCompleter != ''">
  1173. AND basicInfoCompleter = #{basicInfoCompleter}
  1174. </if>
  1175. <if test="recordUpdateTimestamp != null and recordUpdateTimestamp != ''">
  1176. AND recordUpdateTimestamp = #{recordUpdateTimestamp}
  1177. </if>
  1178. <if test="status != null and status != ''">
  1179. AND status = #{status}
  1180. </if>
  1181. <if test="deleteMarker != null and deleteMarker != ''">
  1182. AND deleteMarker = #{deleteMarker}
  1183. </if>
  1184. </select>
  1185. <!--查询患者基础信息根据Id-->
  1186. <select id="selectPatientBasicInfoById" parameterType="pd" resultType="pd">
  1187. SELECT * FROM s_dtp_ysfw_patientbasicinfor WHERE 1=1
  1188. <if test="id != null and id != ''">
  1189. AND archiveId = #{id}
  1190. </if>
  1191. </select>
  1192. <!--添加患者基础信息-->
  1193. <insert id="insertPatientBasicInfo" parameterType="pd">
  1194. INSERT INTO s_dtp_ysfw_patientbasicinfor
  1195. <trim prefix="(" suffix=")" prefixOverrides="," suffixOverrides=",">
  1196. <if test="id != null and id != ''">id,</if>
  1197. <if test="currentEconomicSituation != null and currentEconomicSituation != ''">currentEconomicSituation,</if>
  1198. <if test="patientAwareness != null and patientAwareness != ''">patientAwareness,</if>
  1199. <if test="followUpFeedbackDoctor != null and followUpFeedbackDoctor != ''">followUpFeedbackDoctor,</if>
  1200. <if test="bloodPressureStatus != null and bloodPressureStatus != ''">bloodPressureStatus,</if>
  1201. <if test="heartRate != null and heartRate != ''">heartRate,</if>
  1202. <if test="smokingHistory != null and smokingHistory != ''">smokingHistory,</if>
  1203. <if test="drinkingHistory != null and drinkingHistory != ''">drinkingHistory,</if>
  1204. <if test="exerciseHabit != null and exerciseHabit != ''">exerciseHabit,</if>
  1205. <if test="dietaryPreference != null and dietaryPreference != ''">dietaryPreference,</if>
  1206. <if test="sleepCondition != null and sleepCondition != ''">sleepCondition,</if>
  1207. <if test="pathologicalStage != null and pathologicalStage != ''">pathologicalStage,</if>
  1208. <if test="treatmentStage != null and treatmentStage != ''">treatmentStage,</if>
  1209. <if test="accompanyingSymptoms != null and accompanyingSymptoms != ''">accompanyingSymptoms,</if>
  1210. <if test="hasGeneticTesting != null and hasGeneticTesting != ''">hasGeneticTesting,</if>
  1211. <if test="hasImmuneTesting != null and hasImmuneTesting != ''">hasImmuneTesting,</if>
  1212. <if test="medicalHistory != null and medicalHistory != ''">medicalHistory,</if>
  1213. <if test="medicalHistoryDescription != null and medicalHistoryDescription != ''">medicalHistoryDescription,</if>
  1214. <if test="infectiousDiseaseHistory != null and infectiousDiseaseHistory != ''">infectiousDiseaseHistory,</if>
  1215. <if test="infectiousDiseaseHistoryDescription != null and infectiousDiseaseHistoryDescription != ''">infectiousDiseaseHistoryDescription,</if>
  1216. <if test="allergyHistory != null and allergyHistory != ''">allergyHistory,</if>
  1217. <if test="pastAdverseDrugReactionHistory != null and pastAdverseDrugReactionHistory != ''">pastAdverseDrugReactionHistory,</if>
  1218. <if test="hasSurgicalTraumaHistory != null and hasSurgicalTraumaHistory != ''">hasSurgicalTraumaHistory,</if>
  1219. <if test="multipleTreatmentReasonsDescription != null and multipleTreatmentReasonsDescription != ''">multipleTreatmentReasonsDescription,</if>
  1220. <if test="familyHistoryId != null and familyHistoryId != ''">familyHistoryId,</if>
  1221. <if test="previousMedicationId != null and previousMedicationId != ''">previousMedicationId,</if>
  1222. <if test="contactPersonId != null and contactPersonId != ''">contactPersonId,</if>
  1223. <if test="archiveId != null and archiveId != ''">archiveId,</if>
  1224. <if test="caregiver != null and caregiver != ''">caregiver,</if>
  1225. <if test="createdBy != null and createdBy != ''">createdBy,</if>
  1226. <if test="createdAt != null and createdAt != ''">createdAt,</if>
  1227. <if test="basicInfoCompleter != null and basicInfoCompleter != ''">basicInfoCompleter,</if>
  1228. <if test="recordUpdateTimestamp != null and recordUpdateTimestamp != ''">recordUpdateTimestamp,</if>
  1229. <if test="status != null and status != ''">status,</if>
  1230. <if test="deleteMarker != null and deleteMarker != ''">deleteMarker</if>
  1231. </trim>
  1232. <trim prefix="VALUES (" suffix=")" prefixOverrides="," suffixOverrides=",">
  1233. <if test="id != null and id != ''">#{id},</if>
  1234. <if test="currentEconomicSituation != null and currentEconomicSituation != ''">#{currentEconomicSituation},</if>
  1235. <if test="patientAwareness != null and patientAwareness != ''">#{patientAwareness},</if>
  1236. <if test="followUpFeedbackDoctor != null and followUpFeedbackDoctor != ''">#{followUpFeedbackDoctor},</if>
  1237. <if test="bloodPressureStatus != null and bloodPressureStatus != ''">#{bloodPressureStatus},</if>
  1238. <if test="heartRate != null and heartRate != ''">#{heartRate},</if>
  1239. <if test="smokingHistory != null and smokingHistory != ''">#{smokingHistory},</if>
  1240. <if test="drinkingHistory != null and drinkingHistory != ''">#{drinkingHistory},</if>
  1241. <if test="exerciseHabit != null and exerciseHabit != ''">#{exerciseHabit},</if>
  1242. <if test="dietaryPreference != null and dietaryPreference != ''">#{dietaryPreference},</if>
  1243. <if test="sleepCondition != null and sleepCondition != ''">#{sleepCondition},</if>
  1244. <if test="pathologicalStage != null and pathologicalStage != ''">#{pathologicalStage},</if>
  1245. <if test="treatmentStage != null and treatmentStage != ''">#{treatmentStage},</if>
  1246. <if test="accompanyingSymptoms != null and accompanyingSymptoms != ''">#{accompanyingSymptoms},</if>
  1247. <if test="hasGeneticTesting != null and hasGeneticTesting != ''">#{hasGeneticTesting},</if>
  1248. <if test="hasImmuneTesting != null and hasImmuneTesting != ''">#{hasImmuneTesting},</if>
  1249. <if test="medicalHistory != null and medicalHistory != ''">#{medicalHistory},</if>
  1250. <if test="medicalHistoryDescription != null and medicalHistoryDescription != ''">#{medicalHistoryDescription},</if>
  1251. <if test="infectiousDiseaseHistory != null and infectiousDiseaseHistory != ''">#{infectiousDiseaseHistory},</if>
  1252. <if test="infectiousDiseaseHistoryDescription != null and infectiousDiseaseHistoryDescription != ''">#{infectiousDiseaseHistoryDescription},</if>
  1253. <if test="allergyHistory != null and allergyHistory != ''">#{allergyHistory},</if>
  1254. <if test="pastAdverseDrugReactionHistory != null and pastAdverseDrugReactionHistory != ''">#{pastAdverseDrugReactionHistory},</if>
  1255. <if test="hasSurgicalTraumaHistory != null and hasSurgicalTraumaHistory != ''">#{hasSurgicalTraumaHistory},</if>
  1256. <if test="multipleTreatmentReasonsDescription != null and multipleTreatmentReasonsDescription != ''">#{multipleTreatmentReasonsDescription},</if>
  1257. <if test="familyHistoryId != null and familyHistoryId != ''">#{familyHistoryId},</if>
  1258. <if test="previousMedicationId != null and previousMedicationId != ''">#{previousMedicationId},</if>
  1259. <if test="contactPersonId != null and contactPersonId != ''">#{contactPersonId},</if>
  1260. <if test="archiveId != null and archiveId != ''">#{archiveId},</if>
  1261. <if test="caregiver != null and caregiver != ''">#{caregiver},</if>
  1262. <if test="createdBy != null and createdBy != ''">#{createdBy},</if>
  1263. <if test="createdAt != null and createdAt != ''">#{createdAt},</if>
  1264. <if test="basicInfoCompleter != null and basicInfoCompleter != ''">#{basicInfoCompleter},</if>
  1265. <if test="recordUpdateTimestamp != null and recordUpdateTimestamp != ''">#{recordUpdateTimestamp},</if>
  1266. <if test="status != null and status != ''">#{status},</if>
  1267. <if test="deleteMarker != null and deleteMarker != ''">#{deleteMarker}</if>
  1268. </trim>
  1269. </insert>
  1270. <!--修改患者基础信息-->
  1271. <update id="updatePatientBasicInfo" parameterType="pd">
  1272. UPDATE s_dtp_ysfw_patientbasicinfor SET
  1273. <trim prefix="" suffixOverrides="," prefixOverrides=",">
  1274. <if test="currentEconomicSituation != null and currentEconomicSituation != ''">
  1275. currentEconomicSituation = #{currentEconomicSituation},
  1276. </if>
  1277. <if test="patientAwareness != null and patientAwareness != ''">
  1278. patientAwareness = #{patientAwareness},
  1279. </if>
  1280. <if test="followUpFeedbackDoctor != null and followUpFeedbackDoctor != ''">
  1281. followUpFeedbackDoctor = #{followUpFeedbackDoctor},
  1282. </if>
  1283. <if test="bloodPressureStatus != null and bloodPressureStatus != ''">
  1284. bloodPressureStatus = #{bloodPressureStatus},
  1285. </if>
  1286. <if test="heartRate != null and heartRate != ''">
  1287. heartRate = #{heartRate},
  1288. </if>
  1289. <if test="smokingHistory != null and smokingHistory != ''">
  1290. smokingHistory = #{smokingHistory},
  1291. </if>
  1292. <if test="drinkingHistory != null and drinkingHistory != ''">
  1293. drinkingHistory = #{drinkingHistory},
  1294. </if>
  1295. <if test="exerciseHabit != null and exerciseHabit != ''">
  1296. exerciseHabit = #{exerciseHabit},
  1297. </if>
  1298. <if test="dietaryPreference != null and dietaryPreference != ''">
  1299. dietaryPreference = #{dietaryPreference},
  1300. </if>
  1301. <if test="sleepCondition != null and sleepCondition != ''">
  1302. sleepCondition = #{sleepCondition},
  1303. </if>
  1304. <if test="pathologicalStage != null and pathologicalStage != ''">
  1305. pathologicalStage = #{pathologicalStage},
  1306. </if>
  1307. <if test="treatmentStage != null and treatmentStage != ''">
  1308. treatmentStage = #{treatmentStage},
  1309. </if>
  1310. <if test="accompanyingSymptoms != null and accompanyingSymptoms != ''">
  1311. accompanyingSymptoms = #{accompanyingSymptoms},
  1312. </if>
  1313. <if test="hasGeneticTesting != null and hasGeneticTesting != ''">
  1314. hasGeneticTesting = #{hasGeneticTesting},
  1315. </if>
  1316. <if test="hasImmuneTesting != null and hasImmuneTesting != ''">
  1317. hasImmuneTesting = #{hasImmuneTesting},
  1318. </if>
  1319. <if test="medicalHistory != null and medicalHistory != ''">
  1320. medicalHistory = #{medicalHistory},
  1321. </if>
  1322. <if test="medicalHistoryDescription != null and medicalHistoryDescription != ''">
  1323. medicalHistoryDescription = #{medicalHistoryDescription},
  1324. </if>
  1325. <if test="infectiousDiseaseHistory != null and infectiousDiseaseHistory != ''">
  1326. infectiousDiseaseHistory = #{infectiousDiseaseHistory},
  1327. </if>
  1328. <if test="infectiousDiseaseHistoryDescription != null and infectiousDiseaseHistoryDescription != ''">
  1329. infectiousDiseaseHistoryDescription = #{infectiousDiseaseHistoryDescription},
  1330. </if>
  1331. <if test="allergyHistory != null and allergyHistory != ''">
  1332. allergyHistory = #{allergyHistory},
  1333. </if>
  1334. <if test="pastAdverseDrugReactionHistory != null and pastAdverseDrugReactionHistory != ''">
  1335. pastAdverseDrugReactionHistory = #{pastAdverseDrugReactionHistory},
  1336. </if>
  1337. <if test="hasSurgicalTraumaHistory != null and hasSurgicalTraumaHistory != ''">
  1338. hasSurgicalTraumaHistory = #{hasSurgicalTraumaHistory},
  1339. </if>
  1340. <if test="multipleTreatmentReasonsDescription != null and multipleTreatmentReasonsDescription != ''">
  1341. multipleTreatmentReasonsDescription = #{multipleTreatmentReasonsDescription},
  1342. </if>
  1343. <if test="familyHistoryId != null and familyHistoryId != ''">
  1344. familyHistoryId = #{familyHistoryId},
  1345. </if>
  1346. <if test="previousMedicationId != null and previousMedicationId != ''">
  1347. previousMedicationId = #{previousMedicationId},
  1348. </if>
  1349. <if test="contactPersonId != null and contactPersonId != ''">
  1350. contactPersonId = #{contactPersonId},
  1351. </if>
  1352. <if test="archiveId != null and archiveId != ''">
  1353. archiveId = #{archiveId},
  1354. </if>
  1355. <if test="caregiver != null and caregiver != ''">
  1356. caregiver = #{caregiver},
  1357. </if>
  1358. <if test="createdBy != null and createdBy != ''">
  1359. createdBy = #{createdBy},
  1360. </if>
  1361. <if test="createdAt != null and createdAt != ''">
  1362. createdAt = #{createdAt},
  1363. </if>
  1364. <if test="basicInfoCompleter != null and basicInfoCompleter != ''">
  1365. basicInfoCompleter = #{basicInfoCompleter},
  1366. </if>
  1367. <if test="recordUpdateTimestamp != null and recordUpdateTimestamp != ''">
  1368. recordUpdateTimestamp = #{recordUpdateTimestamp},
  1369. </if>
  1370. <if test="status != null and status != ''">
  1371. status = #{status},
  1372. </if>
  1373. <if test="deleteMarker != null and deleteMarker != ''">
  1374. deleteMarker = #{deleteMarker}
  1375. </if>
  1376. </trim>
  1377. WHERE id = #{id}
  1378. </update>
  1379. <!--假删除患者基础信息表-->
  1380. <update id="deletePatientBasicInfo" parameterType="pd">
  1381. UPDATE s_dtp_ysfw_patientbasicinfor SET status = 0 ,deleteMarker =1 WHERE id = #{id}
  1382. </update>
  1383. <!--物理患者基础信息表-->
  1384. <update id="delPatientBasicInfo" parameterType="pd">
  1385. DELETE FROM s_dtp_ysfw_patientbasicinfor WHERE id = #{id}
  1386. </update>
  1387. <!--联系人信息查询-->
  1388. <select id="selectContacts" parameterType="pd" resultType="pd">
  1389. SELECT * FROM s_dtp_ysfw_contacts WHERE 1=1
  1390. <if test="id != null and id != ''">
  1391. AND id = #{id}
  1392. </if>
  1393. <if test="archiveId != null and archiveId != ''">
  1394. AND archiveId = #{archiveId}
  1395. </if>
  1396. <if test="contactPhone != null and contactPhone != ''">
  1397. AND contactPhone = #{contactPhone}
  1398. </if>
  1399. <if test="contactName != null and contactName != ''">
  1400. AND contactName = #{contactName}
  1401. </if>
  1402. <if test="contactRelationship != null and contactRelationship != ''">
  1403. AND contactRelationship = #{contactRelationship}
  1404. </if>
  1405. <if test="createdBy != null and createdBy != ''">
  1406. AND createdBy = #{createdBy}
  1407. </if>
  1408. <if test="status != null and status != ''">
  1409. AND status = #{status}
  1410. </if>
  1411. </select>
  1412. <!--联系人信息添加-->
  1413. <insert id="insertContact" parameterType="pd">
  1414. INSERT INTO s_dtp_ysfw_contacts
  1415. <trim prefix="(" suffix=")" prefixOverrides="," suffixOverrides=",">
  1416. <if test="archiveId != null and archiveId != ''">archiveId,</if>
  1417. <if test="contactPhone != null and contactPhone != ''">contactPhone,</if>
  1418. <if test="contactName != null and contactNamecontactName != ''">contactName,</if>
  1419. <if test="contactRelationship != null and contactRelationship != ''">contactRelationship,</if>
  1420. <if test="createdBy != null and createdBy != ''">createdBy,</if>
  1421. <if test="createdAt != null and createdAt != ''">createdAt,</if>
  1422. <if test="updatedAt != null and updatedAt != ''">updatedAt,</if>
  1423. <if test="status != null and status != ''">status</if>
  1424. </trim>
  1425. <trim prefix="VALUES (" suffix=")" prefixOverrides="," suffixOverrides=",">
  1426. <if test="archiveId != null and archiveId != ''">#{archiveId},</if>
  1427. <if test="contactPhone != null and contactPhone != ''">#{contactPhone},</if>
  1428. <if test="contactName != null and contactName != ''">#{contactName},</if>
  1429. <if test="contactRelationship != null and contactRelationship != ''">#{contactRelationship},</if>
  1430. <if test="createdBy != null and createdBy != ''">#{createdBy},</if>
  1431. <if test="createdAt != null and createdAt != ''">#{createdAt},</if>
  1432. <if test="updatedAt != null and updatedAt != ''">#{updatedAt},</if>
  1433. <if test="status != null and status != ''">#{status}</if>
  1434. </trim>
  1435. </insert>
  1436. <!--联系人信息修改-->
  1437. <update id="updateContact" parameterType="pd">
  1438. UPDATE s_dtp_ysfw_contacts SET
  1439. <trim prefix="" suffixOverrides="," prefixOverrides=",">
  1440. <if test="archiveId != null and archiveId != ''">
  1441. archiveId = #{archiveId},
  1442. </if>
  1443. <if test="contactPhone != null and contactPhone != ''">
  1444. contactPhone = #{contactPhone},
  1445. </if>
  1446. <if test="contactName != null and contactName != ''">
  1447. contactName = #{contactName},
  1448. </if>
  1449. <if test="contactRelationship != null and contactRelationship != ''">
  1450. contactRelationship = #{contactRelationship},
  1451. </if>
  1452. <if test="createdBy != null and createdBy != ''">
  1453. createdBy = #{createdBy},
  1454. </if>
  1455. <if test="status != null and status != ''">
  1456. status = #{status}
  1457. </if>
  1458. </trim>
  1459. WHERE id = #{id}
  1460. </update>
  1461. <select id="findhistoryByarchiveId" parameterType="pd" resultType="pd">
  1462. SELECT * FROM s_dtp_ysfw_family_history WHERE 1=1 and archiveId = #{archiveId}
  1463. </select>
  1464. <select id="findrecordsByarchiveId" parameterType="pd" resultType="pd">
  1465. SELECT * FROM s_dtp_ysfw_medication_records WHERE 1=1 and archiveId = #{archiveId}
  1466. </select>
  1467. <select id="findcontactsByarchiveId" parameterType="pd" resultType="pd">
  1468. SELECT * FROM s_dtp_ysfw_contacts WHERE 1=1 and archiveId = #{archiveId}
  1469. </select>
  1470. <!--家族病史表信息查询-->
  1471. <select id="selectFamilyHistories" parameterType="pd" resultType="pd">
  1472. SELECT * FROM s_dtp_ysfw_family_history WHERE 1=1
  1473. <if test="id != null and id != ''">
  1474. AND id = #{id}
  1475. </if>
  1476. <if test="archiveId != null and archiveId != ''">
  1477. AND archiveId = #{archiveId}
  1478. </if>
  1479. <if test="disease != null and disease != ''">
  1480. AND disease = #{disease}
  1481. </if>
  1482. <if test="member != null and member != ''">
  1483. AND member = #{member}
  1484. </if>
  1485. <if test="createdBy != null and createdBy != ''">
  1486. AND createdBy = #{createdBy}
  1487. </if>
  1488. <if test="status != null and status != ''">
  1489. AND status = #{status}
  1490. </if>
  1491. </select>
  1492. <!--家族病史表信息添加-->
  1493. <insert id="insertFamilyHistory" parameterType="pd">
  1494. INSERT INTO s_dtp_ysfw_family_history
  1495. <trim prefix="(" suffix=")" prefixOverrides="," suffixOverrides=",">
  1496. <if test="archiveId != null and archiveId != ''">archiveId,</if>
  1497. <if test="disease != null and disease != ''">disease,</if>
  1498. <if test="member != null and member != ''">member,</if>
  1499. <if test="createdBy != null and createdBy != ''">createdBy,</if>
  1500. <if test="createdAt != null and createdAt != ''">createdAt,</if>
  1501. <if test="updatedAt != null and updatedAt != ''">updatedAt,</if>
  1502. <if test="status != null and status != ''">status</if>
  1503. </trim>
  1504. <trim prefix="VALUES (" suffix=")" prefixOverrides="," suffixOverrides=",">
  1505. <if test="archiveId != null and archiveId != ''">#{archiveId},</if>
  1506. <if test="disease != null and disease != ''">#{disease},</if>
  1507. <if test="member != null and member != ''">#{member},</if>
  1508. <if test="createdBy != null and createdBy != ''">#{createdBy},</if>
  1509. <if test="createdAt != null and createdAt != ''">#{createdAt},</if>
  1510. <if test="updatedAt != null and updatedAt != ''">#{updatedAt},</if>
  1511. <if test="status != null and status != ''">#{status}</if>
  1512. </trim>
  1513. </insert>
  1514. <!--家族病史表信息修改-->
  1515. <update id="updateFamilyHistory" parameterType="pd">
  1516. UPDATE s_dtp_ysfw_family_history SET
  1517. <trim prefix="" suffixOverrides="," prefixOverrides=",">
  1518. <if test="archiveId != null and archiveId != ''">
  1519. archiveId = #{archiveId},
  1520. </if>
  1521. <if test="disease != null and disease != ''">
  1522. disease = #{disease},
  1523. </if>
  1524. <if test="member != null and member != ''">
  1525. member = #{member},
  1526. </if>
  1527. <if test="createdBy != null and createdBy != ''">
  1528. createdBy = #{createdBy},
  1529. </if>
  1530. <if test="status != null and status != ''">
  1531. status = #{status}
  1532. </if>
  1533. </trim>
  1534. WHERE id = #{id}
  1535. </update>
  1536. <!--用药情况表表信息查询-->
  1537. <select id="selectMedicationRecords" parameterType="pd" resultType="pd">
  1538. SELECT * FROM s_dtp_ysfw_medication_records WHERE 1=1
  1539. <if test="id != null and id != ''">
  1540. AND id = #{id}
  1541. </if>
  1542. <if test="archiveId != null and archiveId != ''">
  1543. AND archiveId = #{archiveId}
  1544. </if>
  1545. <if test="medicationDescription != null and medicationDescription != ''">
  1546. AND medicationDescription = #{medicationDescription}
  1547. </if>
  1548. <if test="medicationType != null and medicationType != ''">
  1549. AND medicationType = #{medicationType}
  1550. </if>
  1551. <if test="createdBy != null and createdBy != ''">
  1552. AND createdBy = #{createdBy}
  1553. </if>
  1554. <if test="status != null and status != ''">
  1555. AND status = #{status}
  1556. </if>
  1557. </select>
  1558. <!--用药情况表表信息添加-->
  1559. <insert id="insertMedicationRecord" parameterType="pd">
  1560. INSERT INTO s_dtp_ysfw_medication_records
  1561. <trim prefix="(" suffix=")" prefixOverrides="," suffixOverrides=",">
  1562. <if test="archiveId != null and archiveId != ''">archiveId,</if>
  1563. <if test="medicationDescription != null and medicationDescription != ''">medicationDescription,</if>
  1564. <if test="medicationType != null and medicationType != ''">medicationType,</if>
  1565. <if test="createdBy != null and createdBy != ''">createdBy,</if>
  1566. <if test="createdAt != null and createdAt != ''">createdAt,</if>
  1567. <if test="updatedAt != null and updatedAt != ''">updatedAt,</if>
  1568. <if test="status != null and status != ''">status</if>
  1569. </trim>
  1570. <trim prefix="VALUES (" suffix=")" prefixOverrides="," suffixOverrides=",">
  1571. <if test="archiveId != null and archiveId != ''">#{archiveId},</if>
  1572. <if test="medicationDescription != null and medicationDescription != ''">#{medicationDescription},</if>
  1573. <if test="medicationType != null and medicationType != ''">#{medicationType},</if>
  1574. <if test="createdBy != null and createdBy != ''">#{createdBy},</if>
  1575. <if test="createdAt != null and createdAt != ''">#{createdAt},</if>
  1576. <if test="updatedAt != null and updatedAt != ''">#{updatedAt},</if>
  1577. <if test="status != null and status != ''">#{status}</if>
  1578. </trim>
  1579. </insert>
  1580. <!--用药情况表表信息修改-->
  1581. <update id="updateMedicationRecord" parameterType="pd">
  1582. UPDATE s_dtp_ysfw_medication_records SET
  1583. <trim prefix="" suffixOverrides="," prefixOverrides=",">
  1584. <if test="archiveId != null and archiveId != ''">
  1585. archiveId = #{archiveId},
  1586. </if>
  1587. <if test="medicationDescription != null and medicationDescription != ''">
  1588. medicationDescription = #{medicationDescription},
  1589. </if>
  1590. <if test="medicationType != null and medicationType != ''">
  1591. medicationType = #{medicationType},
  1592. </if>
  1593. <if test="created_by != null and created_by != ''">
  1594. createdBy = #{createdBy},
  1595. </if>
  1596. <if test="status != null and status != ''">
  1597. status = #{status}
  1598. </if>
  1599. </trim>
  1600. WHERE id = #{id}
  1601. </update>
  1602. <!--物理删除家 联系人表,族病史表,用药情况表-->
  1603. <update id="physicalDeleteContact" parameterType="pd">
  1604. DELETE FROM s_dtp_ysfw_contacts WHERE id = #{id}
  1605. </update>
  1606. <update id="physicalDeleteFamilyHistory" parameterType="pd">
  1607. DELETE FROM s_dtp_ysfw_family_history WHERE id = #{id}
  1608. </update>
  1609. <update id="physicalDeleteMedicationRecord" parameterType="pd">
  1610. DELETE FROM s_dtp_ysfw_medication_records WHERE id = #{id}
  1611. </update>
  1612. <!--物理删除家 联系人表,族病史表,用药情况表根据档案 archiveId 删除-->
  1613. <update id="DeleteContact" parameterType="pd">
  1614. DELETE FROM s_dtp_ysfw_contacts WHERE archiveId = #{archiveId}
  1615. </update>
  1616. <update id="DeleteFamilyHistory" parameterType="pd">
  1617. DELETE FROM s_dtp_ysfw_family_history WHERE archiveId = #{archiveId}
  1618. </update>
  1619. <update id="DeleteMedicationRecord" parameterType="pd">
  1620. DELETE FROM s_dtp_ysfw_medication_records WHERE archiveId = #{archiveId}
  1621. </update>
  1622. <!--查询对应患者的用药购药信息-->
  1623. <select id="getDrugPurchaseList" parameterType="pd" resultType="pd">
  1624. select
  1625. sddpr.prescriptionNumber , -- 销售
  1626. sdpr.salesOrderNumber, -- 处方编号
  1627. sddpr.prescriptionDate, -- 处方日期
  1628. sdpr.hospital, -- 医院
  1629. sdpr.prescribingDoctor, -- 处方医生
  1630. sdpr.department, -- 科室
  1631. sdpr.attendingDoctor, -- 主管医生
  1632. sdpr.clinicalDiagnosis, -- 临床诊断
  1633. sddpr.genericName,-- 药品通用名
  1634. sddpr.productName,-- 商品名
  1635. sddpr.medicationRoute,-- 用药途径
  1636. sddpr.dosageFrequency,-- 用药频次
  1637. sddpr.singleDoseUnit,-- 单次剂量
  1638. sdpr.registrant,-- 登记人
  1639. sdpr.registrationDate,-- 登记日期
  1640. sdpr.saleDate,-- 销售日期
  1641. sddpr.pharmacyName -- 购药门店名称
  1642. from s_dtp_drug_purchase_record sddpr
  1643. left join s_dtp_prescription_registration sdpr on sddpr.prescriptionNumber=sdpr.prescriptionNumber
  1644. where sdpr.patientId=#{id}
  1645. </select>
  1646. </mapper>