PharmaceuticalServiceMapper.xml 67 KB

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