12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667 |
- <?xml version="1.0" encoding="UTF-8" ?>
- <!DOCTYPE mapper
- PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
- "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mapper namespace="PharmaceuticalServiceMapper">
- <!--档案管理查询-->
- <select id="selectArchivesList" parameterType="pd" resultType="pd">
- select *,DATE_FORMAT(updateTime, '%Y-%m-%d %H:%i:%s') AS updateTime2 from s_dtp_ysfw_archive_management where 1=1
- <if test="serviceTypeNumber!= null and serviceTypeNumber!=''">
- and serviceTypeNumber=#{serviceTypeNumber}
- </if>
- <if test="serviceTypeName!= null and serviceTypeName!=''">
- and serviceTypeName=#{serviceTypeName}
- </if>
- <if test="followUpPerson!= null and followUpPerson!=''">
- and followUpPerson=#{followUpPerson}
- </if>
- <if test="gender!= null and gender!=''">
- and gender=#{gender}
- </if>
- <if test="name!= null and name!=''">
- and name=#{name}
- </if>
- <if test="genericName!= null and genericName!=''">
- and genericName=#{genericName}
- </if>
- <if test="acceptFollowUp!= null and acceptFollowUp!=''">
- and acceptFollowUp=#{acceptFollowUp}
- </if>
- <if test="archiveCompleteStatus!= null and archiveCompleteStatus!=''">
- and archiveCompleteStatus=#{archiveCompleteStatus}
- </if>
- <if test="followUpPerson!= null and followUpPerson!=''">
- and followUpPerson=#{followUpPerson}
- </if>
- <if test="storeName!= null and storeName!=''">
- and storeName=#{storeName}
- </if>
- <if test="disease!= null and disease!=''">
- and disease=#{disease}
- </if>
- <if test="flipStatus!= null and flipStatus!=''">
- and flipStatus=#{flipStatus}
- </if>
- <if test="updateTime!= null and updateTime!=''">
- and updateTime like concat(#{updateTime}, '%')
- </if>
- <if test="joinProject!= null and joinProject!=''">
- and joinProject=#{joinProject}
- </if>
- <if test="charityAssistance!= null and charityAssistance!=''">
- and charityAssistance=#{charityAssistance}
- </if>
- <if test="id !=null and id !='' ">
- and id = #{id}
- </if>
- </select>
- <!-- 检查患者是否存在name LIKE CONCAT('%', #{name}, '%') -->
- <select id="checkPatientIsExist" parameterType="pd" resultType="pd">
- select name,phoneNumber from s_dtp_ysfw_archive_management where 1=1
- <if test="name!= null and name!=''">
- and name =#{name}
- </if>
- <if test="documentNumber!= null and documentNumber!=''">
- and documentNumber=#{documentNumber}
- </if>
- <if test="phoneNumber!= null and phoneNumber!=''">
- and phoneNumber=#{phoneNumber}
- </if>
- </select>
- <select id="slectPatientByNameOrPhone" parameterType="pd" resultType="pd">
- select * from s_dtp_ysfw_archive_management where 1=1 AND name LIKE CONCAT('%', #{query}, '%') or phoneNumber=#{query}
- </select>
- <select id="slectPatientByNameOrPhoneOrIdCard" parameterType="pd" resultType="pd">
- select * from s_dtp_ysfw_archive_management where 1=1 AND name =#{query} or phoneNumber=#{query} or documentNumber=#{query}
- </select>
- <select id="selectPatientById" parameterType="pd" resultType="pd">
- select * from s_dtp_ysfw_archive_management where 1=1 and id=#{patientId}
- </select>
- <!-- 插入新的档案记录 -->
- <insert id="insertArchiveRecord" parameterType="pd">
- INSERT INTO s_dtp_ysfw_archive_management
- <trim prefix="(" suffix=")" prefixOverrides="," suffixOverrides=",">
- <if test="realNameStatus != null">realNameStatus,</if>
- <if test="name != null and name != ''">name,</if>
- <if test="gender != null">gender,</if>
- <if test="age != null">age,</if>
- <if test="dateBirth != null">dateBirth,</if>
- <if test="phoneNumber != null and phoneNumber != ''">phoneNumber,</if>
- <if test="documentNumber != null and documentNumber != ''">documentNumber,</if>
- <if test="idCardImg != null and idCardImg != ''">idCardImg,</if>
- <if test="landlineNumber != null and landlineNumber != ''">landlineNumber,</if>
- <if test="documentType != null and documentType != ''">documentType,</if>
- <if test="createTime != null">createTime,</if>
- <if test="archiveCreator != null and archiveCreator != ''">archiveCreator,</if>
- <if test="creator != null and creator != ''">creator,</if>
- <if test="archiveCompleteStatus != null">archiveCompleteStatus,</if>
- <if test="contactRelation != null and contactRelation != ''">contactRelation,</if>
- <if test="contactPhone != null and contactPhone != ''">contactPhone,</if>
- <if test="contactName != null and contactName != ''">contactName,</if>
- <if test="flipStatus != null">flipStatus,</if>
- <if test="chronicTumorType != null and chronicTumorType != ''">chronicTumorType,</if>
- <if test="nation != null and nation != ''">nation,</if>
- <if test="nativePlace != null and nativePlace != ''">nativePlace,</if>
- <if test="height != null">height,</if>
- <if test="weight != null">weight,</if>
- <if test="BMI != null and BMI != ''">BMI,</if>
- <if test="storeId != null and storeId != ''">storeId,</if>
- <if test="insurance != null and insurance != ''">insurance,</if>
- <if test="socialSecurityCard != null and socialSecurityCard != ''">socialSecurityCard,</if>
- <if test="timeFirstDiagnosis != null">timeFirstDiagnosis,</if>
- <if test="diseaseType != null and diseaseType != ''">diseaseType,</if>
- <if test="healingLineCollection != null and healingLineCollection != ''">healingLineCollection,</if>
- <if test="disease != null and disease != ''">disease,</if>
- <if test="ownedStore != null and ownedStore != ''">ownedStore,</if>
- <if test="archiveCompleter != null and archiveCompleter != ''">archiveCompleter,</if>
- <if test="acceptFollowUp != null">acceptFollowUp,</if>
- <if test="followUpPerson != null and followUpPerson != ''">followUpPerson,</if>
- <if test="charityAssistance != null">charityAssistance,</if>
- <if test="manufacturer != null and manufacturer != ''">manufacturer,</if>
- <if test="joinProject != null">joinProject,</if>
- <if test="mdmCode != null and mdmCode != ''">mdmCode,</if>
- <if test="productName != null and productName != ''">productName,</if>
- <if test="storeName != null and storeName != ''">storeName,</if>
- <if test="followUpStatus != null">followUpStatus,</if>
- <if test="noFlipCause != null and noFlipCause != ''">noFlipCause,</if>
- <if test="genericName != null and genericName != ''">genericName,</if>
- <if test="updateTime != null and updateTime != ''">updateTime</if>
- </trim>
- <trim prefix=" VALUES (" suffix=")" prefixOverrides="," suffixOverrides=",">
- <if test="realNameStatus != null">#{realNameStatus},</if>
- <if test="name != null and name != ''">#{name},</if>
- <if test="gender != null">#{gender},</if>
- <if test="age != null">#{age},</if>
- <if test="dateBirth != null">#{dateBirth},</if>
- <if test="phoneNumber != null and phoneNumber != ''">#{phoneNumber},</if>
- <if test="documentNumber != null and documentNumber != ''">#{documentNumber},</if>
- <if test="idCardImg != null and idCardImg != ''">#{idCardImg},</if>
- <if test="landlineNumber != null and landlineNumber != ''">#{landlineNumber},</if>
- <if test="documentType != null and documentType != ''">#{documentType},</if>
- <if test="createTime != null">#{createTime},</if>
- <if test="archiveCreator != null and archiveCreator != ''">#{archiveCreator},</if>
- <if test="creator != null and creator != ''">#{creator},</if>
- <if test="archiveCompleteStatus != null">#{archiveCompleteStatus},</if>
- <if test="contactRelation != null and contactRelation != ''">#{contactRelation},</if>
- <if test="contactPhone != null and contactPhone != ''">#{contactPhone},</if>
- <if test="contactName != null and contactName != ''">#{contactName},</if>
- <if test="flipStatus != null">#{flipStatus},</if>
- <if test="chronicTumorType != null and chronicTumorType != ''">#{chronicTumorType},</if>
- <if test="nation != null and nation != ''">#{nation},</if>
- <if test="nativePlace != null and nativePlace != ''">#{nativePlace},</if>
- <if test="height != null">#{height},</if>
- <if test="weight != null">#{weight},</if>
- <if test="BMI != null and BMI != ''">#{BMI},</if>
- <if test="storeId != null and storeId != ''">#{storeId},</if>
- <if test="insurance != null and insurance != ''">#{insurance},</if>
- <if test="socialSecurityCard != null and socialSecurityCard != ''">#{socialSecurityCard},</if>
- <if test="timeFirstDiagnosis != null">#{timeFirstDiagnosis},</if>
- <if test="diseaseType != null and diseaseType != ''">#{diseaseType},</if>
- <if test="healingLineCollection != null and healingLineCollection != ''">#{healingLineCollection},</if>
- <if test="disease != null and disease != ''">#{disease},</if>
- <if test="ownedStore != null and ownedStore != ''">#{ownedStore},</if>
- <if test="archiveCompleter != null and archiveCompleter != ''">#{archiveCompleter},</if>
- <if test="acceptFollowUp != null">#{acceptFollowUp},</if>
- <if test="followUpPerson != null and followUpPerson != ''">#{followUpPerson},</if>
- <if test="charityAssistance != null">#{charityAssistance},</if>
- <if test="manufacturer != null and manufacturer != ''">#{manufacturer},</if>
- <if test="joinProject != null">#{joinProject},</if>
- <if test="mdmCode != null and mdmCode != ''">#{mdmCode},</if>
- <if test="productName != null and productName != ''">#{productName},</if>
- <if test="storeName != null and storeName != ''">#{storeName},</if>
- <if test="followUpStatus != null">#{followUpStatus},</if>
- <if test="noFlipCause != null and noFlipCause != ''">#{noFlipCause},</if>
- <if test="genericName != null and genericName != ''">#{genericName},</if>
- <if test="updateTime != null and updateTime != ''">#{updateTime}</if>
- </trim>
- </insert>
- <!-- 更新档案记录 -->
- <update id="updateArchiveRecord" parameterType="pd">
- UPDATE s_dtp_ysfw_archive_management
- SET
- <if test="realNameStatus != null and realNameStatus != ''">realNameStatus = #{realNameStatus},</if>
- <if test="gender != null and gender != ''">gender = #{gender},</if>
- <if test="age != null and age != ''" >age = #{age},</if>
- <if test="dateBirth != null and dateBirth != ''">dateBirth = #{dateBirth},</if>
- <if test="phoneNumber != null and phoneNumber != ''">phoneNumber = #{phoneNumber},</if>
- <if test="documentNumber != null and documentNumber != ''">documentNumber=#{documentNumber},</if>
- <if test="idCardImg != null and idCardImg != ''">idCardImg=#{idCardImg},</if>
- <if test="landlineNumber != null and landlineNumber != ''">landlineNumber = #{landlineNumber},</if>
- <if test="archiveCompleteStatus != null">archiveCompleteStatus = #{archiveCompleteStatus},</if>
- <if test="contactRelation != null and contactRelation != ''">contactRelation = #{contactRelation},</if>
- <if test="contactPhone != null and contactPhone != ''">contactPhone = #{contactPhone},</if>
- <if test="contactName != null and contactName != ''">contactName = #{contactName},</if>
- <if test="flipStatus != null">flipStatus = #{flipStatus},</if>
- <if test="chronicTumorType != null and chronicTumorType != ''">chronicTumorType = #{chronicTumorType},</if>
- <if test="nation != null and nation != ''">nation = #{nation},</if>
- <if test="nativePlace != null and nativePlace != ''">nativePlace = #{nativePlace},</if>
- <if test="height != null and height != ''">height = #{height},</if>
- <if test="weight != null and weight != ''">weight = #{weight},</if>
- <if test="BMI != null and BMI != ''">BMI = #{BMI},</if>
- <if test="insurance != null and insurance != ''">insurance = #{insurance},</if>
- <if test="socialSecurityCard != null and socialSecurityCard != ''">socialSecurityCard = #{socialSecurityCard},</if>
- <if test="timeFirstDiagnosis != null">timeFirstDiagnosis = #{timeFirstDiagnosis},</if>
- <if test="diseaseType != null and diseaseType != ''">diseaseType = #{diseaseType},</if>
- <if test="healingLineCollection != null and healingLineCollection != ''">healingLineCollection = #{healingLineCollection},</if>
- <if test="disease != null and disease != ''">disease = #{disease},</if>
- <if test="ownedStore != null and ownedStore != ''">ownedStore = #{ownedStore},</if>
- <if test="archiveCompleter != null and archiveCompleter != ''">archiveCompleter = #{archiveCompleter},</if>
- <if test="acceptFollowUp != null">acceptFollowUp = #{acceptFollowUp},</if>
- <if test="followUpPerson != null and followUpPerson != ''">followUpPerson = #{followUpPerson},</if>
- <if test="charityAssistance != null">charityAssistance = #{charityAssistance},</if>
- <if test="manufacturer != null and manufacturer != ''">manufacturer = #{manufacturer},</if>
- <if test="joinProject != null and gender != ''">joinProject = #{joinProject},</if>
- <if test="mdmCode != null and mdmCode != ''">mdmCode = #{mdmCode},</if>
- <if test="productName != null and productName != ''">productName = #{productName},</if>
- <if test="storeName != null and storeName != ''">storeName = #{storeName},</if>
- <if test="storeId != null and storeId != ''">storeId = #{storeId},</if>
- <if test="noFlipCause != null and noFlipCause != ''">noFlipCause = #{noFlipCause},</if>
- <if test="followUpStatus != null and followUpStatus != ''">followUpStatus = #{followUpStatus},</if>
- <if test="genericName != null and genericName != ''">genericName = #{genericName},</if>
- updateTime = #{updateTime}
- WHERE id = #{id}
- </update>
- <!--患者绑定微信上翻-->
- <update id="ShaoMaShangFan" parameterType="pd">
- update s_dtp_ysfw_archive_management
- <trim prefix="SET" suffixOverrides="," prefixOverrides=",">
- <if test="openId != null and openId != ''">
- openId = #{openId},
- </if>
- <if test="flipStatus != null and flipStatus != ''">
- flipStatus = #{flipStatus},
- </if>
- <if test="updateTime != null and updateTime != ''">
- updateTime = #{updateTime},
- </if>
- <if test="archiveCreator != null and archiveCreator != ''">
- archiveCreator = #{archiveCreator},
- </if>
- </trim>
- where id = #{id}
- </update>
- <!--患者解除绑定-->
- <update id="unbound" parameterType="pd">
- update s_dtp_ysfw_archive_management
- <trim prefix="SET" suffixOverrides="," prefixOverrides=",">
- <if test="openId != null and openId != ''">
- openId = #{openId},
- </if>
- <if test="flipStatus != null and flipStatus != ''">
- flipStatus = #{flipStatus},
- </if>
- <if test="noFlipCause != null and noFlipCause != ''">
- noFlipCause = #{noFlipCause},
- </if>
- <if test="updateTime != null and updateTime != ''">
- updateTime = #{updateTime},
- </if>
- <if test="archiveCreator != null and archiveCreator != ''">
- archiveCreator = #{archiveCreator},
- </if>
- </trim>
- where id = #{id}
- </update>
- <!--档案管理修改-->
- <update id="updateArchives" parameterType="pd">
- update s_dtp_ysfw_archive_management
- <trim prefix="SET" suffixOverrides="," prefixOverrides=",">
- <if test="realNameStatus != null">
- realNameStatus = #{realNameStatus},
- </if>
- <if test="name != null and name != ''">
- name = #{name},
- </if>
- <if test="gender != null and gender != ''">
- gender = #{gender},
- </if>
- <if test="age != null and age != ''">
- age = #{age},
- </if>
- <if test="dateBirth != null and dateBirth != ''">
- dateBirth = #{dateBirth},
- </if>
- <if test="phoneNumber != null and phoneNumber != ''">
- phoneNumber = #{phoneNumber},
- </if>
- <if test="documentNumber != null and documentNumber != ''">
- documentNumber = #{documentNumber},
- </if>
- <if test="idCardImg != null and idCardImg != ''">
- idCardImg = #{idCardImg},
- </if>
- <if test="landlineNumber != null and landlineNumber != ''">
- landlineNumber = #{landlineNumber},
- </if>
- <if test="documentType != null and documentType != ''">
- documentType = #{documentType},
- </if>
- <if test="archiveCreator != null and archiveCreator != ''">
- archiveCreator = #{archiveCreator},
- </if>
- <if test="creator != null and creator != ''">
- creator = #{creator},
- </if>
- <if test="archiveCompleteStatus != null">
- archiveCompleteStatus = #{archiveCompleteStatus},
- </if>
- <if test="contactRelation != null and contactRelation != ''">
- contactRelation = #{contactRelation},
- </if>
- <if test="contactPhone != null and contactPhone != ''">
- contactPhone = #{contactPhone},
- </if>
- <if test="contactName != null and contactName != ''">
- contactName = #{contactName},
- </if>
- <if test="flipStatus != null and flipStatus != ''">
- flipStatus = #{flipStatus},
- </if>
- <if test="noFlipCause != null and noFlipCause != ''">
- noFlipCause = #{noFlipCause},
- </if>
- <if test="chronicTumorType != null and chronicTumorType != ''">
- chronicTumorType = #{chronicTumorType},
- </if>
- <if test="nation != null and nation != ''">
- nation = #{nation},
- </if>
- <if test="nativePlace != null and nativePlace != ''">
- nativePlace = #{nativePlace},
- </if>
- <if test="height != null and height != ''">
- height = #{height},
- </if>
- <if test="weight != null and weight != ''">
- weight = #{weight},
- </if>
- <if test="BMI != null and BMI != ''">
- BMI = #{BMI},
- </if>
- <if test="insurance != null and insurance != ''">
- insurance = #{insurance},
- </if>
- <if test="socialSecurityCard != null and socialSecurityCard != ''">
- socialSecurityCard = #{socialSecurityCard},
- </if>
- <if test="timeFirstDiagnosis != null and timeFirstDiagnosis != ''">
- timeFirstDiagnosis = #{timeFirstDiagnosis},
- </if>
- <if test="diseaseType != null and diseaseType != ''">
- diseaseType = #{diseaseType},
- </if>
- <if test="healingLineCollection != null and healingLineCollection != ''">
- healingLineCollection = #{healingLineCollection},
- </if>
- <if test="disease != null and disease != ''">
- disease = #{disease},
- </if>
- <if test="ownedStore != null and ownedStore != ''">
- ownedStore = #{ownedStore},
- </if>
- <if test="archiveCompleter != null and archiveCompleter != ''">
- archiveCompleter = #{archiveCompleter},
- </if>
- <if test="acceptFollowUp != null and acceptFollowUp != ''">
- acceptFollowUp = #{acceptFollowUp},
- </if>
- <if test="followUpPerson != null and followUpPerson != ''">
- followUpPerson = #{followUpPerson},
- </if>
- <if test="charityAssistance != null and charityAssistance != ''">
- charityAssistance = #{charityAssistance},
- </if>
- <if test="manufacturer != null and manufacturer != ''">
- manufacturer = #{manufacturer},
- </if>
- <if test="joinProject != null and joinProject != ''">
- joinProject = #{joinProject},
- </if>
- <if test="mdmCode != null and mdmCode != ''">
- mdmCode = #{mdmCode},
- </if>
- <if test="productName != null and productName != ''">
- productName = #{productName},
- </if>
- <if test="storeName != null and storeName != ''">
- storeName = #{storeName},
- </if>
- <if test="storeId != null and storeId != ''">
- storeId = #{storeId},
- </if>
- <if test="followUpStatus != null and followUpStatus != ''">
- followUpStatus = #{followUpStatus},
- </if>
- <if test="genericName != null and genericName != ''">
- genericName = #{genericName},
- </if>
- </trim>
- where id = #{id}
- </update>
- <!--档案管理删除-->
- <delete id="archivesRemove" parameterType="pd">
- <if test="ids != null">
- delete from s_dtp_ysfw_archive_management where
- <if test="ids != null">
- id in(#{ids})
- </if>
- </if>
- </delete>
- <!--随访任务 查询-->
- <select id="selectFollowUpList" parameterType="pd" resultType="pd">
- select *,DATE_FORMAT(updatedAt, '%Y-%m-%d %H:%i:%s') AS updateTime2 from s_dtp_ysfw_follow_up_task where 1=1
- <if test="id != null and id != ''">
- and id=#{id}
- </if>
- <if test="appointmentDate != null and appointmentDate != ''">
- and appointmentDate=#{appointmentDate}
- </if>
- <if test="businessBelonging != null and businessBelonging != ''">
- and businessBelonging=#{businessBelonging}
- </if>
- <if test="taskName != null and taskName != ''">
- and taskName=#{taskName}
- </if>
- <if test="taskTheme != null and taskTheme != ''">
- and taskTheme=#{taskTheme}
- </if>
- <if test="patientName != null and patientName != ''">
- and patientName=#{patientName}
- </if>
- <if test="gender != null and gender != ''">
- and gender=#{gender}
- </if>
- <if test="age != null and age != ''">
- and age=#{age}
- </if>
- <if test="followUpSummary != null and followUpSummary != ''">
- and followUpSummary=#{followUpSummary}
- </if>
- <if test="disease != null and disease != ''">
- and disease=#{disease}
- </if>
- <if test="storeName != null and storeName != ''">
- and storeName=#{storeName}
- </if>
- <if test="genericName != null and genericName != ''">
- and genericName=#{genericName}
- </if>
- <if test="productName != null and productName != ''">
- and productName=#{productName}
- </if>
- <if test="taskFollower != null and taskFollower != ''">
- and taskFollower=#{taskFollower}
- </if>
- <if test="actualFollowUpTime != null and actualFollowUpTime != ''">
- and actualFollowUpTime=#{actualFollowUpTime}
- </if>
- <if test="callConnectedCount != null and callConnectedCount != ''">
- and callConnectedCount=#{callConnectedCount}
- </if>
- <if test="outboundCallCount != null and outboundCallCount != ''">
- and outboundCallCount=#{outboundCallCount}
- </if>
- <if test="nextOutboundCallCount != null and nextOutboundCallCount != ''">
- and nextOutboundCallCount=#{nextOutboundCallCount}
- </if>
- <if test="taskStatus != null and taskStatus != ''">
- and taskStatus=#{taskStatus}
- </if>
- <if test="lastOutboundStatus != null and lastOutboundStatus != ''">
- and lastOutboundStatus=#{lastOutboundStatus}
- </if>
- <if test="createdAt != null and createdAt != ''">
- and createdAt=#{createdAt}
- </if>
- <if test="updatedAt != null and updatedAt != ''">
- and updatedAt=#{updatedAt}
- </if>
- </select>
- <!--随访任务 修改-->
- <update id="updateFollowUp" parameterType="pd" >
- <if test="up != null and up!=''">
- update s_dtp_ysfw_follow_up_task
- </if>
- <trim prefix=" SET " suffix="" prefixOverrides="," suffixOverrides=",">
- <if test="appointmentDate != null and appointmentDate != ''">
- appointmentDate=#{appointmentDate},
- </if>
- <if test="businessBelonging != null and businessBelonging != ''">
- businessBelonging=#{businessBelonging},
- </if>
- <if test="taskName != null and taskName != ''">
- taskName=#{taskName},
- </if>
- <if test="taskTheme != null and taskTheme != ''">
- taskTheme=#{taskTheme},
- </if>
- <if test="patientName != null and patientName != ''">
- patientName=#{patientName},
- </if>
- <if test="gender != null and gender != ''">
- gender=#{gender},
- </if>
- <if test="age != null and age != ''">
- age=#{age},
- </if>
- <if test="followUpSummary != null and followUpSummary != ''">
- followUpSummary=#{followUpSummary},
- </if>
- <if test="disease != null and disease != ''">
- disease=#{disease},
- </if>
- <if test="storeName != null and storeName != ''">
- storeName=#{storeName},
- </if>
- <if test="genericName != null and genericName != ''">
- genericName=#{genericName},
- </if>
- <if test="productName != null and productName != ''">
- productName=#{productName},
- </if>
- <if test="taskFollower != null and taskFollower != ''">
- taskFollower=#{taskFollower},
- </if>
- <if test="actualFollowUpTime != null and actualFollowUpTime != ''">
- actualFollowUpTime=#{actualFollowUpTime},
- </if>
- <if test="callConnectedCount != null and callConnectedCount != ''">
- callConnectedCount=#{callConnectedCount},
- </if>
- <if test="outboundCallCount != null and outboundCallCount != ''">
- outboundCallCount=#{outboundCallCount},
- </if>
- <if test="nextOutboundCallCount != null and nextOutboundCallCount != ''">
- nextOutboundCallCount=#{nextOutboundCallCount},
- </if>
- <if test="taskStatus != null and taskStatus != ''">
- taskStatus=#{taskStatus},
- </if>
- <if test="lastOutboundStatus != null and lastOutboundStatus != ''">
- lastOutboundStatus=#{lastOutboundStatus},
- </if>
- <if test="createdAt != null and createdAt != ''">
- createdAt=#{createdAt},
- </if>
- <if test="updatedAt != null and updatedAt != ''">
- updatedAt=#{updatedAt},
- </if>
- </trim>
- <if test="up != null and up!=''">
- <if test="id!= null and id!=''">
- where id=#{id}
- </if>
- </if>
- </update>
- <!--随访任务 删除-->
- <delete id="followUpRemove" parameterType="pd">
- <if test="ids != null">
- delete from s_dtp_ysfw_follow_up_task where
- <if test="ids != null">
- id in(#{ids})
- </if>
- </if>
- </delete>
- <!--随访跟进人分配 查询-->
- <select id="selectFollowUpAssignList" parameterType="pd" resultType="pd">
- select *,DATE_FORMAT(updatedAt, '%Y-%m-%d %H:%i:%s') AS updateTime2 from s_dtp_ysfw_follow_up_assign where 1=1
- <if test="id != null and id != ''">
- and id=#{id}
- </if>
- <if test="patientName != null and patientName != ''">
- and patientName=#{patientName}
- </if>
- <if test="patientPhone != null and patientPhone != ''">
- and patientPhone=#{patientPhone}
- </if>
- <if test="gender != null and gender != ''">
- and gender=#{gender}
- </if>
- <if test="age != null and age != ''">
- and age=#{age}
- </if>
- <if test="disease != null and disease != ''">
- and disease=#{disease}
- </if>
- <if test="clinicalDiagnosis != null">
- and clinicalDiagnosis=#{clinicalDiagnosis}
- </if>
- <if test="medicineName != null and medicineName != ''">
- and medicineName=#{medicineName}
- </if>
- <if test="lastPurchaseDate != null">
- and lastPurchaseDate=#{lastPurchaseDate}
- </if>
- <if test="filingDate != null">
- and filingDate=#{filingDate}
- </if>
- <if test="followUpPersonName != null and followUpPersonName != ''">
- and followUpPersonName=#{followUpPersonName}
- </if>
- <if test="followUpPersonPhone != null and followUpPersonPhone != ''">
- and followUpPersonPhone=#{followUpPersonPhone}
- </if>
- <if test="followUpPersonRole != null and followUpPersonRole != ''">
- and followUpPersonRole=#{followUpPersonRole}
- </if>
- <if test="storeName != null and storeName != ''">
- and storeName=#{storeName}
- </if>
- <if test="patientAssignmentStatus != null and patientAssignmentStatus != ''">
- and patientAssignmentStatus=#{patientAssignmentStatus}
- </if>
- <if test="terminatedEmployeeName != null">
- and terminatedEmployeeName=#{terminatedEmployeeName}
- </if>
- <if test="terminatedEmployeePhone != null">
- and terminatedEmployeePhone=#{terminatedEmployeePhone}
- </if>
- <if test="terminatedEmployeeStore != null">
- and terminatedEmployeeStore=#{terminatedEmployeeStore}
- </if>
- <if test="createdAt != null">
- and createdAt=#{createdAt}
- </if>
- <if test="updatedAt != null">
- and updatedAt=#{updatedAt}
- </if>
- </select>
- <!--随访跟进人分配 修改-->
- <update id="updateFollowUpAssign" parameterType="pd" >
- <if test="up != null and up!=''">
- update s_dtp_ysfw_follow_up_assign
- </if>
- <trim prefix=" SET " suffix="" prefixOverrides="," suffixOverrides=",">
- <if test="patientName != null and patientName != ''">
- patientName=#{patientName},
- </if>
- <if test="patientPhone != null and patientPhone != ''">
- patientPhone=#{patientPhone},
- </if>
- <if test="gender != null and gender != ''">
- gender=#{gender},
- </if>
- <if test="age != null and age != ''">
- age=#{age},
- </if>
- <if test="disease != null and disease != ''">
- disease=#{disease},
- </if>
- <if test="clinicalDiagnosis != null">
- clinicalDiagnosis=#{clinicalDiagnosis},
- </if>
- <if test="medicineName != null and medicineName != ''">
- medicineName=#{medicineName},
- </if>
- <if test="lastPurchaseDate != null">
- lastPurchaseDate=#{lastPurchaseDate},
- </if>
- <if test="filingDate != null">
- filingDate=#{filingDate},
- </if>
- <if test="followUpPersonName != null and followUpPersonName != ''">
- followUpPersonName=#{followUpPersonName},
- </if>
- <if test="followUpPersonPhone != null and followUpPersonPhone != ''">
- followUpPersonPhone=#{followUpPersonPhone},
- </if>
- <if test="followUpPersonRole != null and followUpPersonRole != ''">
- followUpPersonRole=#{followUpPersonRole},
- </if>
- <if test="storeName != null and storeName != ''">
- storeName=#{storeName},
- </if>
- <if test="patientAssignmentStatus != null and patientAssignmentStatus != ''">
- patientAssignmentStatus=#{patientAssignmentStatus},
- </if>
- <if test="terminatedEmployeeName != null">
- terminatedEmployeeName=#{terminatedEmployeeName},
- </if>
- <if test="terminatedEmployeePhone != null">
- terminatedEmployeePhone=#{terminatedEmployeePhone},
- </if>
- <if test="terminatedEmployeeStore != null">
- terminatedEmployeeStore=#{terminatedEmployeeStore},
- </if>
- <if test="createdAt != null">
- createdAt=#{createdAt},
- </if>
- <if test="updatedAt != null">
- updatedAt=#{updatedAt},
- </if>
- </trim>
- <if test="up != null and up!=''">
- <if test="id!= null and id!=''">
- where id=#{id}
- </if>
- </if>
- </update>
- <!--随访跟进人分配 删除-->
- <delete id="followUpAssignRemove" parameterType="pd">
- <if test="ids != null">
- delete from s_dtp_ysfw_follow_up_assign where
- <if test="ids != null">
- id in(#{ids})
- </if>
- </if>
- </delete>
- <!--根据所属们id查询患者信息-->
- <select id="getAllPatients" parameterType="pd" resultType="pd">
- select id ,name ,storeName ,storeId from s_dtp_ysfw_archive_management where 1=1 and storeId=#{DeptId}
- </select>
- <select id="selectConsultationAndDrug" parameterType="pd" resultType="pd">
- SELECT
- pc.id AS id,
- pc.storeName,
- pc.storeId,
- pc.patientId,
- pc.createdBy,
- pc.createdDate,
- pc.patientName,
- pc.patientPhone,
- pc.gender,
- pc.age,
- pc.KnowledgeLink,
- pc.questionType,
- pc.consultationQuestion,
- pc.pharmacistAnswer,
- pc.consultationTime,
- pc.disease,
- pc.genericName,
- pc.productName,
- pd.id AS prescriptionDrugId,
- pd.productName AS prescriptionProductName,
- pd.genericName AS prescriptionGenericName,
- pd.mdmCode AS prescriptionmdmCode,
- pd.prescriptionNumber
- FROM
- s_dtp_ysfw_patient_consultation pc
- LEFT JOIN
- s_dtp_cfdj_prescription_drug pd ON pc.patientId = pd.patientId
- WHERE
- pc.storeId = #{storeId}
- <if test="createdDate != null">
- AND pc.createdDate=#{createdDate}
- </if>
- <if test="query != null and query != ''">
- AND (pc.patientName LIKE CONCAT('%', #{query}, '%')
- OR pc.patientPhone = #{query})
- </if>
- <if test="questionType != null and questionType != ''">
- AND pc.questionType=#{questionType}
- </if>
- <if test="consultationQuestion != null and consultationQuestion != ''">
- AND pc.consultationQuestion=#{consultationQuestion}
- </if>
- <if test="pharmacistAnswer != null and pharmacistAnswer != ''">
- AND pc.pharmacistAnswer=#{pharmacistAnswer}
- </if>
- <if test="beginTime != null and beginTime!='' and endTime != null and endTime!=''">
- and pc.consultationTime between #{beginTime} and #{endTime}
- </if>
- <if test="disease != null and disease != ''">
- AND pc.disease=#{disease}
- </if>
- <if test="product != null and product != ''">
- AND pd.genericName =#{product} OR pd.productName = #{product} OR pd.mdmCode = #{product}
- </if>
- ORDER BY
- pc.id ASC
- </select>
- <!--患者咨询根据id-->
- <select id="findPatientCounselingById" parameterType="pd" resultType="pd">
- select * from s_dtp_ysfw_patient_consultation where 1=1 and id=#{id}
- </select>
- <!--患者咨询 查询所有-->
- <select id="selectPatientCounselingList" parameterType="pd" resultType="pd">
- select *,DATE_FORMAT(consultationTime, '%Y-%m-%d %H:%i:%s') AS updateTime2 from s_dtp_ysfw_patient_consultation where 1=1
- <if test="id != null and id != ''">
- and id=#{id}
- </if>
- <if test="createdBy != null and createdBy != ''">
- AND createdBy=#{createdBy}
- </if>
- <if test="createdDate != null">
- AND createdDate=#{createdDate}
- </if>
- <if test="patientName != null and patientName != ''">
- AND patientName=#{patientName}
- </if>
- <if test="patientPhone != null and patientPhone != ''">
- AND patientPhone=#{patientPhone}
- </if>
- <if test="questionType != null and questionType != ''">
- AND questionType=#{questionType}
- </if>
- <if test="consultationQuestion != null and consultationQuestion != ''">
- AND consultationQuestion=#{consultationQuestion}
- </if>
- <if test="pharmacistAnswer != null and pharmacistAnswer != ''">
- AND pharmacistAnswer=#{pharmacistAnswer}
- </if>
- <if test="consultationTime != null">
- AND consultationTime=#{consultationTime}
- </if>
- <if test="disease != null and disease != ''">
- AND disease=#{disease}
- </if>
- <if test="genericName != null and genericName != ''">
- AND genericName=#{genericName}
- </if>
- <if test="productName != null and productName != ''">
- AND productName=#{productName}
- </if>
- </select>
- <insert id="insertPatientConsultation" parameterType="pd">
- INSERT INTO s_dtp_ysfw_patient_consultation
- <trim prefix="(" suffix=")" prefixOverrides="," suffixOverrides=",">
- <if test="createdBy != null and createdBy !=''">createdBy,</if>
- <if test="createdDate != null and createdDate !=''">createdDate,</if>
- <if test="patientName != null and patientName != ''">patientName,</if>
- <if test="patientPhone != null and patientPhone != ''">patientPhone,</if>
- <if test="gender != null">gender,</if>
- <if test="age != null">age,</if>
- <if test="KnowledgeLink != null and KnowledgeLink != ''">KnowledgeLink,</if>
- <if test="questionType != null and questionType != ''">questionType,</if>
- <if test="consultationQuestion != null and consultationQuestion != ''">consultationQuestion,</if>
- <if test="pharmacistAnswer != null and pharmacistAnswer != ''">pharmacistAnswer,</if>
- <if test="consultationTime != null">consultationTime,</if>
- <if test="contactRelation != null and contactRelation != ''">contactRelation,</if>
- <if test="disease != null and disease != ''">disease,</if>
- <if test="genericName != null and genericName != ''">genericName,</if>
- <if test="productName != null and productName != ''">productName,</if>
- <if test="storeId != null">storeId,</if>
- <if test="storeName != null and storeName != ''">storeName,</if>
- <if test="patientId != null">patientId,</if>
- </trim>
- <trim prefix=" VALUES (" suffix=")" prefixOverrides="," suffixOverrides=",">
- <if test="createdBy != null and createdBy !=''">#{createdBy},</if>
- <if test="createdDate != null and createdDate !=''">#{createdDate},</if>
- <if test="patientName != null and patientName != ''">#{patientName},</if>
- <if test="patientPhone != null and patientPhone != ''">#{patientPhone},</if>
- <if test="gender != null">#{gender},</if>
- <if test="age != null">#{age},</if>
- <if test="KnowledgeLink != null and KnowledgeLink != ''">#{KnowledgeLink},</if>
- <if test="questionType != null and questionType != ''">#{questionType},</if>
- <if test="consultationQuestion != null and consultationQuestion != ''">#{consultationQuestion},</if>
- <if test="pharmacistAnswer != null and pharmacistAnswer != ''">#{pharmacistAnswer},</if>
- <if test="consultationTime != null and consultationTime != ''">#{consultationTime},</if>
- <if test="contactRelation != null and contactRelation != ''">#{contactRelation},</if>
- <if test="disease != null and disease != ''">#{disease},</if>
- <if test="genericName != null and genericName != ''">#{genericName},</if>
- <if test="productName != null and productName != ''">#{productName},</if>
- <if test="storeId != null">#{storeId},</if>
- <if test="storeName != null and storeName != ''">#{storeName},</if>
- <if test="patientId != null and patientId != ''">#{patientId},</if>
- </trim>
- </insert>
- <!--患者咨询 修改-->
- <update id="updatePatientCounseling" parameterType="pd" >
- <if test="up != null and up!=''">
- update s_dtp_ysfw_patient_consultation
- </if>
- <trim prefix=" SET " suffix="" prefixOverrides="," suffixOverrides=",">
- <if test="regenerator != null and regenerator != ''">
- regenerator=#{regenerator},
- </if>
- <if test="updateDate != null and updateDate !=''">
- updateDate=#{updateDate},
- </if>
- <if test="questionType != null and questionType != ''">
- questionType=#{questionType},
- </if>
- <if test="KnowledgeLink != null and KnowledgeLink != ''">
- KnowledgeLink=#{KnowledgeLink},
- </if>
- <if test="contactRelation != null and contactRelation != ''">
- contactRelation=#{contactRelation},
- </if>
- <if test="consultationQuestion != null and consultationQuestion != ''">
- consultationQuestion=#{consultationQuestion},
- </if>
- <if test="pharmacistAnswer != null and pharmacistAnswer != ''">
- pharmacistAnswer=#{pharmacistAnswer},
- </if>
- <if test="consultationTime != null">
- consultationTime=#{consultationTime},
- </if>
- </trim>
- <if test="up != null and up!=''">
- <if test="id!= null and id!=''">
- where id=#{id}
- </if>
- </if>
- </update>
- <!--患者咨询 删除-->
- <delete id="patientCounselingRemove" parameterType="pd">
- <if test="ids != null">
- delete from s_dtp_ysfw_patient_consultation where
- <if test="ids != null">
- id in(#{ids})
- </if>
- </if>
- </delete>
- <!--随访满意度评价 查询-->
- <select id="selectFindFollowUpEvaluationList" parameterType="pd" resultType="pd">
- select * from s_ysfw_follow_up_evaluation where 1=1
- <if test="id != null and id != ''">
- AND id = #{id}
- </if>
- <if test="businessId != null and businessId != ''">
- AND businessId = #{businessId}
- </if>
- <if test="businessName != null and businessName != ''">
- AND businessName = #{businessName}
- </if>
- <if test="createdBy != null and createdBy != ''">
- AND createdBy = #{createdBy}
- </if>
- <if test="createdDate != null">
- AND createdDate = #{createdDate}
- </if>
- <if test="patientName != null and patientName != ''">
- AND patientName = #{patientName}
- </if>
- <if test="followUpTask != null and followUpTask != ''">
- AND followUpTask = #{followUpTask}
- </if>
- <if test="taskFollower != null and taskFollower != ''">
- AND taskFollower = #{taskFollower}
- </if>
- <if test="evaluationDate != null and evaluationDate != ''" >
- AND evaluationDate = #{evaluationDate}
- </if>
- <if test="beginTime != null and beginTime!='' and endTime != null and endTime!=''">
- and evaluationDate between #{beginTime} and #{endTime}
- </if>
- <if test="chainStoreName != null and chainStoreName != ''">
- AND chainStoreName = #{chainStoreName}
- </if>
- <if test="storeName != null and storeName != ''">
- AND storeName = #{storeName}
- </if>
- <if test="taskId != null and taskId != ''">
- AND taskId = #{taskId}
- </if>
- </select>
- <!--随访满意度评价 修改-->
- <update id="updateFindFollowUpEvaluation" parameterType="pd" >
- <if test="up != null and up!=''">
- update s_ysfw_follow_up_evaluation
- </if>
- <trim prefix=" SET " suffix="" prefixOverrides="," suffixOverrides=",">
- <if test="businessName != null and businessName != ''">
- businessName = #{businessName},
- </if>
- <if test="createdBy != null and createdBy != ''">
- createdBy = #{createdBy},
- </if>
- <if test="createdDate != null">
- createdDate = #{createdDate},
- </if>
- <if test="patientName != null and patientName != ''">
- patientName = #{patientName},
- </if>
- <if test="followUpTask != null and followUpTask != ''">
- followUpTask = #{followUpTask},
- </if>
- <if test="taskFollower != null and taskFollower != ''">
- taskFollower = #{taskFollower},
- </if>
- <if test="evaluationDate != null">
- evaluationDate = #{evaluationDate},
- </if>
- <if test="chainStoreName != null and chainStoreName != ''">
- chainStoreName = #{chainStoreName},
- </if>
- <if test="storeName != null and storeName != ''">
- storeName = #{storeName},
- </if>
- <if test="taskId != null and taskId != ''">
- taskId = #{taskId},
- </if>
- </trim>
- <if test="up != null and up!=''">
- <if test="id!= null and id!=''">
- where id=#{id}
- </if>
- </if>
- </update>
- <!--随访满意度评价 删除-->
- <delete id="findFollowUpEvaluationRemove" parameterType="pd">
- <if test="ids != null">
- delete from s_ysfw_follow_up_evaluation where
- <if test="ids != null">
- id in(#{ids})
- </if>
- </if>
- </delete>
- <!--查询患者基础信息-->
- <select id="selectPatientBasicInfo" parameterType="pd" resultType="pd">
- SELECT * FROM s_dtp_ysfw_patientbasicinfor WHERE 1=1
- <if test="id != null and id != ''">
- AND id = #{id}
- </if>
- <if test="currentEconomicSituation != null and currentEconomicSituation != ''">
- AND currentEconomicSituation = #{currentEconomicSituation}
- </if>
- <if test="patientAwareness != null and patientAwareness != ''">
- AND patientAwareness = #{patientAwareness}
- </if>
- <if test="followUpFeedbackDoctor != null and followUpFeedbackDoctor != ''">
- AND followUpFeedbackDoctor = #{followUpFeedbackDoctor}
- </if>
- <if test="bloodPressureStatus != null and bloodPressureStatus != ''">
- AND bloodPressureStatus = #{bloodPressureStatus}
- </if>
- <if test="heartRate != null and heartRate != ''">
- AND heartRate = #{heartRate}
- </if>
- <if test="smokingHistory != null and smokingHistory != ''">
- AND smokingHistory = #{smokingHistory}
- </if>
- <if test="drinkingHistory != null and drinkingHistory != ''">
- AND drinkingHistory = #{drinkingHistory}
- </if>
- <if test="exerciseHabit != null and exerciseHabit != ''">
- AND exerciseHabit = #{exerciseHabit}
- </if>
- <if test="dietaryPreference != null and dietaryPreference != ''">
- AND dietaryPreference = #{dietaryPreference}
- </if>
- <if test="sleepCondition != null and sleepCondition != ''">
- AND sleepCondition = #{sleepCondition}
- </if>
- <if test="pathologicalStage != null and pathologicalStage != ''">
- AND pathologicalStage = #{pathologicalStage}
- </if>
- <if test="treatmentStage != null and treatmentStage != ''">
- AND treatmentStage = #{treatmentStage}
- </if>
- <if test="accompanyingSymptoms != null and accompanyingSymptoms != ''">
- AND accompanyingSymptoms = #{accompanyingSymptoms}
- </if>
- <if test="hasGeneticTesting != null and hasGeneticTesting != ''">
- AND hasGeneticTesting = #{hasGeneticTesting}
- </if>
- <if test="hasImmuneTesting != null and hasImmuneTesting != ''">
- AND hasImmuneTesting = #{hasImmuneTesting}
- </if>
- <if test="medicalHistory != null and medicalHistory != ''">
- AND medicalHistory = #{medicalHistory}
- </if>
- <if test="medicalHistoryDescription != null and medicalHistoryDescription != ''">
- AND medicalHistoryDescription = #{medicalHistoryDescription}
- </if>
- <if test="infectiousDiseaseHistory != null and infectiousDiseaseHistory != ''">
- AND infectiousDiseaseHistory = #{infectiousDiseaseHistory}
- </if>
- <if test="infectiousDiseaseHistoryDescription != null and infectiousDiseaseHistoryDescription != ''">
- AND infectiousDiseaseHistoryDescription = #{infectiousDiseaseHistoryDescription}
- </if>
- <if test="allergyHistory != null and allergyHistory != ''">
- AND allergyHistory = #{allergyHistory}
- </if>
- <if test="pastAdverseDrugReactionHistory != null and pastAdverseDrugReactionHistory != ''">
- AND pastAdverseDrugReactionHistory = #{pastAdverseDrugReactionHistory}
- </if>
- <if test="hasSurgicalTraumaHistory != null and hasSurgicalTraumaHistory != ''">
- AND hasSurgicalTraumaHistory = #{hasSurgicalTraumaHistory}
- </if>
- <if test="multipleTreatmentReasonsDescription != null and multipleTreatmentReasonsDescription != ''">
- AND multipleTreatmentReasonsDescription = #{multipleTreatmentReasonsDescription}
- </if>
- <if test="familyHistoryId != null and familyHistoryId != ''">
- AND familyHistoryId = #{familyHistoryId}
- </if>
- <if test="previousMedicationId != null and previousMedicationId != ''">
- AND previousMedicationId = #{previousMedicationId}
- </if>
- <if test="contactPersonId != null and contactPersonId != ''">
- AND contactPersonId = #{contactPersonId}
- </if>
- <if test="archiveId != null and archiveId != ''">
- AND archiveId = #{archiveId}
- </if>
- <if test="caregiver != null and caregiver != ''">
- AND caregiver = #{caregiver}
- </if>
- <if test="createdBy != null and createdBy != ''">
- AND createdBy = #{createdBy}
- </if>
- <if test="createdAt != null and createdAt != ''">
- AND createdAt = #{createdAt}
- </if>
- <if test="basicInfoCompleter != null and basicInfoCompleter != ''">
- AND basicInfoCompleter = #{basicInfoCompleter}
- </if>
- <if test="recordUpdateTimestamp != null and recordUpdateTimestamp != ''">
- AND recordUpdateTimestamp = #{recordUpdateTimestamp}
- </if>
- <if test="status != null and status != ''">
- AND status = #{status}
- </if>
- <if test="deleteMarker != null and deleteMarker != ''">
- AND deleteMarker = #{deleteMarker}
- </if>
- </select>
- <!--查询患者基础信息根据Id-->
- <select id="selectPatientBasicInfoById" parameterType="pd" resultType="pd">
- SELECT * FROM s_dtp_ysfw_patientbasicinfor WHERE 1=1
- <if test="id != null and id != ''">
- AND archiveId = #{id}
- </if>
- </select>
- <!--添加患者基础信息-->
- <insert id="insertPatientBasicInfo" parameterType="pd">
- INSERT INTO s_dtp_ysfw_patientbasicinfor
- <trim prefix="(" suffix=")" prefixOverrides="," suffixOverrides=",">
- <if test="id != null and id != ''">id,</if>
- <if test="currentEconomicSituation != null and currentEconomicSituation != ''">currentEconomicSituation,</if>
- <if test="patientAwareness != null and patientAwareness != ''">patientAwareness,</if>
- <if test="followUpFeedbackDoctor != null and followUpFeedbackDoctor != ''">followUpFeedbackDoctor,</if>
- <if test="bloodPressureStatus != null and bloodPressureStatus != ''">bloodPressureStatus,</if>
- <if test="heartRate != null and heartRate != ''">heartRate,</if>
- <if test="smokingHistory != null and smokingHistory != ''">smokingHistory,</if>
- <if test="drinkingHistory != null and drinkingHistory != ''">drinkingHistory,</if>
- <if test="exerciseHabit != null and exerciseHabit != ''">exerciseHabit,</if>
- <if test="dietaryPreference != null and dietaryPreference != ''">dietaryPreference,</if>
- <if test="sleepCondition != null and sleepCondition != ''">sleepCondition,</if>
- <if test="pathologicalStage != null and pathologicalStage != ''">pathologicalStage,</if>
- <if test="treatmentStage != null and treatmentStage != ''">treatmentStage,</if>
- <if test="accompanyingSymptoms != null and accompanyingSymptoms != ''">accompanyingSymptoms,</if>
- <if test="hasGeneticTesting != null and hasGeneticTesting != ''">hasGeneticTesting,</if>
- <if test="hasImmuneTesting != null and hasImmuneTesting != ''">hasImmuneTesting,</if>
- <if test="medicalHistory != null and medicalHistory != ''">medicalHistory,</if>
- <if test="medicalHistoryDescription != null and medicalHistoryDescription != ''">medicalHistoryDescription,</if>
- <if test="infectiousDiseaseHistory != null and infectiousDiseaseHistory != ''">infectiousDiseaseHistory,</if>
- <if test="infectiousDiseaseHistoryDescription != null and infectiousDiseaseHistoryDescription != ''">infectiousDiseaseHistoryDescription,</if>
- <if test="allergyHistory != null and allergyHistory != ''">allergyHistory,</if>
- <if test="pastAdverseDrugReactionHistory != null and pastAdverseDrugReactionHistory != ''">pastAdverseDrugReactionHistory,</if>
- <if test="hasSurgicalTraumaHistory != null and hasSurgicalTraumaHistory != ''">hasSurgicalTraumaHistory,</if>
- <if test="multipleTreatmentReasonsDescription != null and multipleTreatmentReasonsDescription != ''">multipleTreatmentReasonsDescription,</if>
- <if test="familyHistoryId != null and familyHistoryId != ''">familyHistoryId,</if>
- <if test="previousMedicationId != null and previousMedicationId != ''">previousMedicationId,</if>
- <if test="contactPersonId != null and contactPersonId != ''">contactPersonId,</if>
- <if test="archiveId != null and archiveId != ''">archiveId,</if>
- <if test="caregiver != null and caregiver != ''">caregiver,</if>
- <if test="createdBy != null and createdBy != ''">createdBy,</if>
- <if test="createdAt != null and createdAt != ''">createdAt,</if>
- <if test="basicInfoCompleter != null and basicInfoCompleter != ''">basicInfoCompleter,</if>
- <if test="recordUpdateTimestamp != null and recordUpdateTimestamp != ''">recordUpdateTimestamp,</if>
- <if test="status != null and status != ''">status,</if>
- <if test="deleteMarker != null and deleteMarker != ''">deleteMarker</if>
- </trim>
- <trim prefix="VALUES (" suffix=")" prefixOverrides="," suffixOverrides=",">
- <if test="id != null and id != ''">#{id},</if>
- <if test="currentEconomicSituation != null and currentEconomicSituation != ''">#{currentEconomicSituation},</if>
- <if test="patientAwareness != null and patientAwareness != ''">#{patientAwareness},</if>
- <if test="followUpFeedbackDoctor != null and followUpFeedbackDoctor != ''">#{followUpFeedbackDoctor},</if>
- <if test="bloodPressureStatus != null and bloodPressureStatus != ''">#{bloodPressureStatus},</if>
- <if test="heartRate != null and heartRate != ''">#{heartRate},</if>
- <if test="smokingHistory != null and smokingHistory != ''">#{smokingHistory},</if>
- <if test="drinkingHistory != null and drinkingHistory != ''">#{drinkingHistory},</if>
- <if test="exerciseHabit != null and exerciseHabit != ''">#{exerciseHabit},</if>
- <if test="dietaryPreference != null and dietaryPreference != ''">#{dietaryPreference},</if>
- <if test="sleepCondition != null and sleepCondition != ''">#{sleepCondition},</if>
- <if test="pathologicalStage != null and pathologicalStage != ''">#{pathologicalStage},</if>
- <if test="treatmentStage != null and treatmentStage != ''">#{treatmentStage},</if>
- <if test="accompanyingSymptoms != null and accompanyingSymptoms != ''">#{accompanyingSymptoms},</if>
- <if test="hasGeneticTesting != null and hasGeneticTesting != ''">#{hasGeneticTesting},</if>
- <if test="hasImmuneTesting != null and hasImmuneTesting != ''">#{hasImmuneTesting},</if>
- <if test="medicalHistory != null and medicalHistory != ''">#{medicalHistory},</if>
- <if test="medicalHistoryDescription != null and medicalHistoryDescription != ''">#{medicalHistoryDescription},</if>
- <if test="infectiousDiseaseHistory != null and infectiousDiseaseHistory != ''">#{infectiousDiseaseHistory},</if>
- <if test="infectiousDiseaseHistoryDescription != null and infectiousDiseaseHistoryDescription != ''">#{infectiousDiseaseHistoryDescription},</if>
- <if test="allergyHistory != null and allergyHistory != ''">#{allergyHistory},</if>
- <if test="pastAdverseDrugReactionHistory != null and pastAdverseDrugReactionHistory != ''">#{pastAdverseDrugReactionHistory},</if>
- <if test="hasSurgicalTraumaHistory != null and hasSurgicalTraumaHistory != ''">#{hasSurgicalTraumaHistory},</if>
- <if test="multipleTreatmentReasonsDescription != null and multipleTreatmentReasonsDescription != ''">#{multipleTreatmentReasonsDescription},</if>
- <if test="familyHistoryId != null and familyHistoryId != ''">#{familyHistoryId},</if>
- <if test="previousMedicationId != null and previousMedicationId != ''">#{previousMedicationId},</if>
- <if test="contactPersonId != null and contactPersonId != ''">#{contactPersonId},</if>
- <if test="archiveId != null and archiveId != ''">#{archiveId},</if>
- <if test="caregiver != null and caregiver != ''">#{caregiver},</if>
- <if test="createdBy != null and createdBy != ''">#{createdBy},</if>
- <if test="createdAt != null and createdAt != ''">#{createdAt},</if>
- <if test="basicInfoCompleter != null and basicInfoCompleter != ''">#{basicInfoCompleter},</if>
- <if test="recordUpdateTimestamp != null and recordUpdateTimestamp != ''">#{recordUpdateTimestamp},</if>
- <if test="status != null and status != ''">#{status},</if>
- <if test="deleteMarker != null and deleteMarker != ''">#{deleteMarker}</if>
- </trim>
- </insert>
- <!--修改患者基础信息-->
- <update id="updatePatientBasicInfo" parameterType="pd">
- UPDATE s_dtp_ysfw_patientbasicinfor SET
- <trim prefix="" suffixOverrides="," prefixOverrides=",">
- <if test="currentEconomicSituation != null and currentEconomicSituation != ''">
- currentEconomicSituation = #{currentEconomicSituation},
- </if>
- <if test="patientAwareness != null and patientAwareness != ''">
- patientAwareness = #{patientAwareness},
- </if>
- <if test="followUpFeedbackDoctor != null and followUpFeedbackDoctor != ''">
- followUpFeedbackDoctor = #{followUpFeedbackDoctor},
- </if>
- <if test="bloodPressureStatus != null and bloodPressureStatus != ''">
- bloodPressureStatus = #{bloodPressureStatus},
- </if>
- <if test="heartRate != null and heartRate != ''">
- heartRate = #{heartRate},
- </if>
- <if test="smokingHistory != null and smokingHistory != ''">
- smokingHistory = #{smokingHistory},
- </if>
- <if test="drinkingHistory != null and drinkingHistory != ''">
- drinkingHistory = #{drinkingHistory},
- </if>
- <if test="exerciseHabit != null and exerciseHabit != ''">
- exerciseHabit = #{exerciseHabit},
- </if>
- <if test="dietaryPreference != null and dietaryPreference != ''">
- dietaryPreference = #{dietaryPreference},
- </if>
- <if test="sleepCondition != null and sleepCondition != ''">
- sleepCondition = #{sleepCondition},
- </if>
- <if test="pathologicalStage != null and pathologicalStage != ''">
- pathologicalStage = #{pathologicalStage},
- </if>
- <if test="treatmentStage != null and treatmentStage != ''">
- treatmentStage = #{treatmentStage},
- </if>
- <if test="accompanyingSymptoms != null and accompanyingSymptoms != ''">
- accompanyingSymptoms = #{accompanyingSymptoms},
- </if>
- <if test="hasGeneticTesting != null and hasGeneticTesting != ''">
- hasGeneticTesting = #{hasGeneticTesting},
- </if>
- <if test="hasImmuneTesting != null and hasImmuneTesting != ''">
- hasImmuneTesting = #{hasImmuneTesting},
- </if>
- <if test="medicalHistory != null and medicalHistory != ''">
- medicalHistory = #{medicalHistory},
- </if>
- <if test="medicalHistoryDescription != null and medicalHistoryDescription != ''">
- medicalHistoryDescription = #{medicalHistoryDescription},
- </if>
- <if test="infectiousDiseaseHistory != null and infectiousDiseaseHistory != ''">
- infectiousDiseaseHistory = #{infectiousDiseaseHistory},
- </if>
- <if test="infectiousDiseaseHistoryDescription != null and infectiousDiseaseHistoryDescription != ''">
- infectiousDiseaseHistoryDescription = #{infectiousDiseaseHistoryDescription},
- </if>
- <if test="allergyHistory != null and allergyHistory != ''">
- allergyHistory = #{allergyHistory},
- </if>
- <if test="pastAdverseDrugReactionHistory != null and pastAdverseDrugReactionHistory != ''">
- pastAdverseDrugReactionHistory = #{pastAdverseDrugReactionHistory},
- </if>
- <if test="hasSurgicalTraumaHistory != null and hasSurgicalTraumaHistory != ''">
- hasSurgicalTraumaHistory = #{hasSurgicalTraumaHistory},
- </if>
- <if test="multipleTreatmentReasonsDescription != null and multipleTreatmentReasonsDescription != ''">
- multipleTreatmentReasonsDescription = #{multipleTreatmentReasonsDescription},
- </if>
- <if test="familyHistoryId != null and familyHistoryId != ''">
- familyHistoryId = #{familyHistoryId},
- </if>
- <if test="previousMedicationId != null and previousMedicationId != ''">
- previousMedicationId = #{previousMedicationId},
- </if>
- <if test="contactPersonId != null and contactPersonId != ''">
- contactPersonId = #{contactPersonId},
- </if>
- <if test="archiveId != null and archiveId != ''">
- archiveId = #{archiveId},
- </if>
- <if test="caregiver != null and caregiver != ''">
- caregiver = #{caregiver},
- </if>
- <if test="createdBy != null and createdBy != ''">
- createdBy = #{createdBy},
- </if>
- <if test="createdAt != null and createdAt != ''">
- createdAt = #{createdAt},
- </if>
- <if test="basicInfoCompleter != null and basicInfoCompleter != ''">
- basicInfoCompleter = #{basicInfoCompleter},
- </if>
- <if test="recordUpdateTimestamp != null and recordUpdateTimestamp != ''">
- recordUpdateTimestamp = #{recordUpdateTimestamp},
- </if>
- <if test="status != null and status != ''">
- status = #{status},
- </if>
- <if test="deleteMarker != null and deleteMarker != ''">
- deleteMarker = #{deleteMarker}
- </if>
- </trim>
- WHERE id = #{id}
- </update>
- <!--假删除患者基础信息表-->
- <update id="deletePatientBasicInfo" parameterType="pd">
- UPDATE s_dtp_ysfw_patientbasicinfor SET status = 0 ,deleteMarker =1 WHERE id = #{id}
- </update>
- <!--物理患者基础信息表-->
- <update id="delPatientBasicInfo" parameterType="pd">
- DELETE FROM s_dtp_ysfw_patientbasicinfor WHERE id = #{id}
- </update>
- <!--联系人信息查询-->
- <select id="selectContacts" parameterType="pd" resultType="pd">
- SELECT * FROM s_dtp_ysfw_contacts WHERE 1=1
- <if test="id != null and id != ''">
- AND id = #{id}
- </if>
- <if test="archiveId != null and archiveId != ''">
- AND archiveId = #{archiveId}
- </if>
- <if test="contactPhone != null and contactPhone != ''">
- AND contactPhone = #{contactPhone}
- </if>
- <if test="contactName != null and contactName != ''">
- AND contactName = #{contactName}
- </if>
- <if test="contactRelationship != null and contactRelationship != ''">
- AND contactRelationship = #{contactRelationship}
- </if>
- <if test="createdBy != null and createdBy != ''">
- AND createdBy = #{createdBy}
- </if>
- <if test="status != null and status != ''">
- AND status = #{status}
- </if>
- </select>
- <!--联系人信息添加-->
- <insert id="insertContact" parameterType="pd">
- INSERT INTO s_dtp_ysfw_contacts
- <trim prefix="(" suffix=")" prefixOverrides="," suffixOverrides=",">
- <if test="archiveId != null and archiveId != ''">archiveId,</if>
- <if test="contactPhone != null and contactPhone != ''">contactPhone,</if>
- <if test="contactName != null and contactNamecontactName != ''">contactName,</if>
- <if test="contactRelationship != null and contactRelationship != ''">contactRelationship,</if>
- <if test="createdBy != null and createdBy != ''">createdBy,</if>
- <if test="createdAt != null and createdAt != ''">createdAt,</if>
- <if test="updatedAt != null and updatedAt != ''">updatedAt,</if>
- <if test="status != null and status != ''">status</if>
- </trim>
- <trim prefix="VALUES (" suffix=")" prefixOverrides="," suffixOverrides=",">
- <if test="archiveId != null and archiveId != ''">#{archiveId},</if>
- <if test="contactPhone != null and contactPhone != ''">#{contactPhone},</if>
- <if test="contactName != null and contactName != ''">#{contactName},</if>
- <if test="contactRelationship != null and contactRelationship != ''">#{contactRelationship},</if>
- <if test="createdBy != null and createdBy != ''">#{createdBy},</if>
- <if test="createdAt != null and createdAt != ''">#{createdAt},</if>
- <if test="updatedAt != null and updatedAt != ''">#{updatedAt},</if>
- <if test="status != null and status != ''">#{status}</if>
- </trim>
- </insert>
- <!--联系人信息修改-->
- <update id="updateContact" parameterType="pd">
- UPDATE s_dtp_ysfw_contacts SET
- <trim prefix="" suffixOverrides="," prefixOverrides=",">
- <if test="archiveId != null and archiveId != ''">
- archiveId = #{archiveId},
- </if>
- <if test="contactPhone != null and contactPhone != ''">
- contactPhone = #{contactPhone},
- </if>
- <if test="contactName != null and contactName != ''">
- contactName = #{contactName},
- </if>
- <if test="contactRelationship != null and contactRelationship != ''">
- contactRelationship = #{contactRelationship},
- </if>
- <if test="createdBy != null and createdBy != ''">
- createdBy = #{createdBy},
- </if>
- <if test="status != null and status != ''">
- status = #{status}
- </if>
- </trim>
- WHERE id = #{id}
- </update>
- <select id="findhistoryByarchiveId" parameterType="pd" resultType="pd">
- SELECT * FROM s_dtp_ysfw_family_history WHERE 1=1 and archiveId = #{archiveId}
- </select>
- <select id="findrecordsByarchiveId" parameterType="pd" resultType="pd">
- SELECT * FROM s_dtp_ysfw_medication_records WHERE 1=1 and archiveId = #{archiveId}
- </select>
- <select id="findcontactsByarchiveId" parameterType="pd" resultType="pd">
- SELECT * FROM s_dtp_ysfw_contacts WHERE 1=1 and archiveId = #{archiveId}
- </select>
- <!--家族病史表信息查询-->
- <select id="selectFamilyHistories" parameterType="pd" resultType="pd">
- SELECT * FROM s_dtp_ysfw_family_history WHERE 1=1
- <if test="id != null and id != ''">
- AND id = #{id}
- </if>
- <if test="archiveId != null and archiveId != ''">
- AND archiveId = #{archiveId}
- </if>
- <if test="disease != null and disease != ''">
- AND disease = #{disease}
- </if>
- <if test="member != null and member != ''">
- AND member = #{member}
- </if>
- <if test="createdBy != null and createdBy != ''">
- AND createdBy = #{createdBy}
- </if>
- <if test="status != null and status != ''">
- AND status = #{status}
- </if>
- </select>
- <!--家族病史表信息添加-->
- <insert id="insertFamilyHistory" parameterType="pd">
- INSERT INTO s_dtp_ysfw_family_history
- <trim prefix="(" suffix=")" prefixOverrides="," suffixOverrides=",">
- <if test="archiveId != null and archiveId != ''">archiveId,</if>
- <if test="disease != null and disease != ''">disease,</if>
- <if test="member != null and member != ''">member,</if>
- <if test="createdBy != null and createdBy != ''">createdBy,</if>
- <if test="createdAt != null and createdAt != ''">createdAt,</if>
- <if test="updatedAt != null and updatedAt != ''">updatedAt,</if>
- <if test="status != null and status != ''">status</if>
- </trim>
- <trim prefix="VALUES (" suffix=")" prefixOverrides="," suffixOverrides=",">
- <if test="archiveId != null and archiveId != ''">#{archiveId},</if>
- <if test="disease != null and disease != ''">#{disease},</if>
- <if test="member != null and member != ''">#{member},</if>
- <if test="createdBy != null and createdBy != ''">#{createdBy},</if>
- <if test="createdAt != null and createdAt != ''">#{createdAt},</if>
- <if test="updatedAt != null and updatedAt != ''">#{updatedAt},</if>
- <if test="status != null and status != ''">#{status}</if>
- </trim>
- </insert>
- <!--家族病史表信息修改-->
- <update id="updateFamilyHistory" parameterType="pd">
- UPDATE s_dtp_ysfw_family_history SET
- <trim prefix="" suffixOverrides="," prefixOverrides=",">
- <if test="archiveId != null and archiveId != ''">
- archiveId = #{archiveId},
- </if>
- <if test="disease != null and disease != ''">
- disease = #{disease},
- </if>
- <if test="member != null and member != ''">
- member = #{member},
- </if>
- <if test="createdBy != null and createdBy != ''">
- createdBy = #{createdBy},
- </if>
- <if test="status != null and status != ''">
- status = #{status}
- </if>
- </trim>
- WHERE id = #{id}
- </update>
- <!--用药情况表表信息查询-->
- <select id="selectMedicationRecords" parameterType="pd" resultType="pd">
- SELECT * FROM s_dtp_ysfw_medication_records WHERE 1=1
- <if test="id != null and id != ''">
- AND id = #{id}
- </if>
- <if test="archiveId != null and archiveId != ''">
- AND archiveId = #{archiveId}
- </if>
- <if test="medicationDescription != null and medicationDescription != ''">
- AND medicationDescription = #{medicationDescription}
- </if>
- <if test="medicationType != null and medicationType != ''">
- AND medicationType = #{medicationType}
- </if>
- <if test="createdBy != null and createdBy != ''">
- AND createdBy = #{createdBy}
- </if>
- <if test="status != null and status != ''">
- AND status = #{status}
- </if>
- </select>
- <!--用药情况表表信息添加-->
- <insert id="insertMedicationRecord" parameterType="pd">
- INSERT INTO s_dtp_ysfw_medication_records
- <trim prefix="(" suffix=")" prefixOverrides="," suffixOverrides=",">
- <if test="archiveId != null and archiveId != ''">archiveId,</if>
- <if test="medicationDescription != null and medicationDescription != ''">medicationDescription,</if>
- <if test="medicationType != null and medicationType != ''">medicationType,</if>
- <if test="createdBy != null and createdBy != ''">createdBy,</if>
- <if test="createdAt != null and createdAt != ''">createdAt,</if>
- <if test="updatedAt != null and updatedAt != ''">updatedAt,</if>
- <if test="status != null and status != ''">status</if>
- </trim>
- <trim prefix="VALUES (" suffix=")" prefixOverrides="," suffixOverrides=",">
- <if test="archiveId != null and archiveId != ''">#{archiveId},</if>
- <if test="medicationDescription != null and medicationDescription != ''">#{medicationDescription},</if>
- <if test="medicationType != null and medicationType != ''">#{medicationType},</if>
- <if test="createdBy != null and createdBy != ''">#{createdBy},</if>
- <if test="createdAt != null and createdAt != ''">#{createdAt},</if>
- <if test="updatedAt != null and updatedAt != ''">#{updatedAt},</if>
- <if test="status != null and status != ''">#{status}</if>
- </trim>
- </insert>
- <!--用药情况表表信息修改-->
- <update id="updateMedicationRecord" parameterType="pd">
- UPDATE s_dtp_ysfw_medication_records SET
- <trim prefix="" suffixOverrides="," prefixOverrides=",">
- <if test="archiveId != null and archiveId != ''">
- archiveId = #{archiveId},
- </if>
- <if test="medicationDescription != null and medicationDescription != ''">
- medicationDescription = #{medicationDescription},
- </if>
- <if test="medicationType != null and medicationType != ''">
- medicationType = #{medicationType},
- </if>
- <if test="created_by != null and created_by != ''">
- createdBy = #{createdBy},
- </if>
- <if test="status != null and status != ''">
- status = #{status}
- </if>
- </trim>
- WHERE id = #{id}
- </update>
- <!--物理删除家 联系人表,族病史表,用药情况表-->
- <update id="physicalDeleteContact" parameterType="pd">
- DELETE FROM s_dtp_ysfw_contacts WHERE id = #{id}
- </update>
- <update id="physicalDeleteFamilyHistory" parameterType="pd">
- DELETE FROM s_dtp_ysfw_family_history WHERE id = #{id}
- </update>
- <update id="physicalDeleteMedicationRecord" parameterType="pd">
- DELETE FROM s_dtp_ysfw_medication_records WHERE id = #{id}
- </update>
- <!--物理删除家 联系人表,族病史表,用药情况表根据档案 archiveId 删除-->
- <update id="DeleteContact" parameterType="pd">
- DELETE FROM s_dtp_ysfw_contacts WHERE archiveId = #{archiveId}
- </update>
- <update id="DeleteFamilyHistory" parameterType="pd">
- DELETE FROM s_dtp_ysfw_family_history WHERE archiveId = #{archiveId}
- </update>
- <update id="DeleteMedicationRecord" parameterType="pd">
- DELETE FROM s_dtp_ysfw_medication_records WHERE archiveId = #{archiveId}
- </update>
- <!--查询对应患者的用药购药信息-->
- <select id="getDrugPurchaseList" parameterType="pd" resultType="pd">
- SELECT
- p.orderId AS orderId,
- p.prescriptionSource AS prescriptionSource,
- p.prescriptionDate AS prescriptionDate,
- p.hospital AS hospital,
- p.doctor AS doctor,
- p.department AS department,
- p.diseaseType AS diseaseType,
- p.clinicalDiagnosis AS clinicalDiagnosis,
- pd.genericName AS genericName,
- pd.productName AS productName,
- pd.specification AS specification,
- pd.quantity AS quantity,
- pd.manufacturer AS manufacturer,
- pd.mdmCode AS mdmCode,
- pd.usageMethod AS usageMethod,
- pd.frequency AS frequency,
- pd.wordUsage AS wordUsage,
- pd.medicationCycle AS medicationCycle,
- p.registrar AS registrar,
- p.orderTime AS orderTime,
- pd.drugSource AS drugSource
- FROM
- s_dtp_ysfw_archive_management am
- JOIN
- s_dtp_cfdj_prescription p ON am.phoneNumber = p.patientPhone and am.name = p.patientName
- JOIN
- s_dtp_cfdj_prescription_drug pd ON p.id = pd.prescriptionNumber
- WHERE
- 1 = 1
- <if test="patientPhone != null and patientPhone !=''">
- AND p.patientPhone = #{patientPhone}
- </if>
- <if test="patientName != null and patientName !=''">
- AND p.patientName = #{patientName}
- </if>
- <if test="prescriptionDate != null and prescriptionDate !=''">
- AND p.prescriptionDate = #{prescriptionDate}
- </if>
- <if test="genericName != null and genericName !=''">
- AND pd.genericName = #{genericName}
- </if>
- <if test="productName != null and productName !=''">
- AND pd.productName = #{productName}
- </if>
- <if test="mdmCode != null and mdmCode !=''">
- AND pd.mdmCode = #{mdmCode}
- </if>
- <if test="usageMethod != null and usageMethod !=''">
- AND pd.usageMethod = #{usageMethod}
- </if>
- <if test="orderTime != null and orderTime !=''">
- AND p.orderTime = #{orderTime}
- </if>
- GROUP BY
- 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
- </select>
- </mapper>
|