druguseTemplate.vue 119KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025
  1. <template>
  2. <div class="main-contain">
  3. <div class="position">
  4. <bread-crumb :crumbs='crumbs'></bread-crumb>
  5. </div>
  6. <el-dialog title="透析处方长期医嘱医生确认推送提醒" :visible.sync="dialogConfigVisible">
  7. <el-form>
  8. <el-form-item label="是否开启推送:">
  9. <el-radio-group v-model="is_open_remind" @change="changeRemind">
  10. <el-radio :label="1">开启</el-radio>
  11. <el-radio :label="2">不开启</el-radio>
  12. </el-radio-group>
  13. </el-form-item>
  14. </el-form>
  15. </el-dialog>
  16. <div class="app-container">
  17. <el-tabs>
  18. <el-tab-pane label="医嘱模板 ">
  19. <div>
  20. <div class="filter-container">
  21. <el-button size="small"
  22. :loading="loading"
  23. style="float: right;"
  24. :disabled="is_init?true:false"
  25. @click="initAdvice()"
  26. type="primary">医嘱初始化
  27. </el-button>
  28. <el-button size="small"
  29. style="float: right;margin-left: 10px;margin-right: 10px"
  30. @click="dialogConfigVisible = true"
  31. type="primary">长期医嘱提醒配置
  32. </el-button>
  33. <el-button
  34. class="filter-item"
  35. style="margin-left: 10px;margin-right: 10px"
  36. @click="handleCreateTemplate"
  37. type="primary"
  38. size="small"
  39. icon="el-icon-circle-plus-outline"
  40. >{{$t('table.add')}}
  41. </el-button>
  42. </div>
  43. <el-table
  44. :data="adviceTemplates"
  45. border
  46. fit
  47. :row-style="{ color: '#303133' }"
  48. :header-cell-style="{
  49. backgroundColor: 'rgb(245, 247, 250)',
  50. color: '#606266'
  51. }"
  52. @cell-mouse-leave="cellMouseLeave"
  53. @cell-mouse-enter="cellMouseEnter"
  54. :row-class-name="tableRowClassNames"
  55. :span-method="merge"
  56. style="width: 100%;min-height:500px;"
  57. >
  58. <el-table-column
  59. prop="id"
  60. label="模版名称"
  61. align="center"
  62. width="100">
  63. <template slot-scope="scope">
  64. <span v-if="isShow(scope.$index, scope.row)">{{scope.row.name}}</span>
  65. <span v-else></span>
  66. </template>
  67. </el-table-column>
  68. <el-table-column
  69. label="模版类型"
  70. align="center"
  71. width="100"
  72. >
  73. <template slot-scope="scope">
  74. <div>{{scope.row.advice_type == 1 ? '长期' : '临时'}}</div>
  75. </template>
  76. </el-table-column>
  77. <el-table-column
  78. prop="amount1"
  79. align="center"
  80. label="医嘱内容">
  81. <template slot-scope="scope">
  82. <el-dropdown trigger="click" v-if="scope.row.parent_id == 0">
  83. <span class="el-dropdown-link" v-if="scope.row.parent_id == 0">
  84. {{scope.row.advice_name}}<i class="el-icon-arrow-down el-icon--right"></i>
  85. </span>
  86. <el-dropdown-menu slot="dropdown">
  87. <el-dropdown-item @click.native="openEdit(scope.$index, scope.row)">修改医嘱</el-dropdown-item>
  88. <el-dropdown-item @click.native="openDelete(scope.$index, scope.row)">删除医嘱</el-dropdown-item>
  89. <el-dropdown-item @click.native="openNewChild(scope.$index, scope.row)">新增子药</el-dropdown-item>
  90. </el-dropdown-menu>
  91. </el-dropdown>
  92. <el-dropdown trigger="click" v-if="scope.row.parent_id > 0">
  93. <span class="el-dropdown-link">
  94. &emsp;&emsp;{{ scope.row.advice_name }}<i class="el-icon-arrow-down el-icon--right"></i>
  95. </span>
  96. <el-dropdown-menu slot="dropdown">
  97. <el-dropdown-item
  98. @click.native="openEdit(scope.$index, scope.row)">修改子药
  99. </el-dropdown-item>
  100. <el-dropdown-item
  101. @click.native="openDeleteChild(scope.$index, scope.row)">删除子药
  102. </el-dropdown-item>
  103. </el-dropdown-menu>
  104. </el-dropdown>
  105. </template>
  106. </el-table-column>
  107. <el-table-column
  108. prop="amount1"
  109. align="center"
  110. label="药品规格">
  111. <template slot-scope="scope">
  112. <span v-if="scope.row.advice_desc">{{scope.row.advice_desc}}{{scope.row.drug_spec_unit}}</span>
  113. </template>
  114. </el-table-column>
  115. <el-table-column
  116. prop="amount2"
  117. width="90"
  118. align="center"
  119. label="开药数量">
  120. <template slot-scope="scope" v-if="scope.row.prescribing_number != ''">
  121. <span>{{scope.row.prescribing_number}}{{scope.row.prescribing_number_unit}}</span>
  122. </template>
  123. </el-table-column>
  124. <el-table-column
  125. prop="amount2"
  126. width="90"
  127. align="center"
  128. label="单次用量">
  129. <template slot-scope="scope" v-if="scope.row.single_dose != ''">
  130. <span>{{scope.row.single_dose}}{{scope.row.single_dose_unit}}</span>
  131. </template>
  132. </el-table-column>
  133. <el-table-column
  134. prop="amount3"
  135. align="center"
  136. label="给药途径">
  137. <template slot-scope="scope" v-if="scope.row.parent_id == 0">
  138. <span>{{scope.row.delivery_way}}</span>
  139. </template>
  140. </el-table-column>
  141. <el-table-column
  142. prop="amount3"
  143. align="center"
  144. label="执行频率">
  145. <template slot-scope="scope" v-if="scope.row.parent_id == 0">
  146. <span>{{scope.row.execution_frequency}}</span>
  147. </template>
  148. </el-table-column>
  149. <el-table-column prop="blood_flow_volume" align="center" label="提醒频率">
  150. <template slot-scope="scope">
  151. <span v-if="scope.row.advice_type == 1 &&scope.row.frequency_type == 1">每次必推</span>
  152. <span v-if="scope.row.advice_type == 1&&scope.row.frequency_type == 2">{{scope.row.day_count}}天/1次</span>
  153. <span v-if="scope.row.advice_type == 1&&scope.row.frequency_type == 3">每周{{scope.row.week_days}}</span>
  154. </template>
  155. </el-table-column>
  156. <el-table-column prop="blood_flow_volume" align="center" label="排序">
  157. <template slot-scope="scope">
  158. <span v-if="scope.row.sort == 0"></span>
  159. <span v-if="scope.row.sort!=0">{{scope.row.sort}}</span>
  160. </template>
  161. </el-table-column>
  162. <el-table-column
  163. align="center"
  164. label="操作"
  165. width="180"
  166. class-name="small-padding fixed-width"
  167. >
  168. <template slot-scope="scope">
  169. <el-tooltip class="item" effect="dark" content="编辑" placement="top">
  170. <el-button
  171. type="primary"
  172. size="small"
  173. icon="el-icon-edit-outline"
  174. v-if="isShow(scope.$index, scope.row)"
  175. @click="handleUpdateAdviceTemplate(scope.row, scope.$index)"
  176. >
  177. </el-button>
  178. </el-tooltip>
  179. <el-tooltip class="item" effect="dark" content="删除" placement="top">
  180. <el-button
  181. size="small"
  182. type="danger"
  183. icon="el-icon-delete"
  184. @click="handleDeleteAdviceTemplate(scope.row, scope.$index)"
  185. >
  186. </el-button>
  187. </el-tooltip>
  188. </template>
  189. </el-table-column>
  190. </el-table>
  191. <!--增删改查都是本地处理的dialog-->
  192. <el-dialog title="新增医嘱模版" :visible.sync="templateTableVisible" width="700px" :close-on-click-modal="false">
  193. <div>
  194. <el-form ref="form" :model="form" :rule="formRules" label-width="100px">
  195. <el-form-item label="模版名称" style="width: 300px" prop="name">
  196. <el-input v-model="form.name"></el-input>
  197. </el-form-item>
  198. <el-form-item label="排序" style="width: 300px" prop="name">
  199. <el-input v-model="form.sort" v-type="number"></el-input>
  200. </el-form-item>
  201. <el-form-item label="模版类型" prop="advice_type">
  202. <el-radio-group v-model="form.advice_type">
  203. <el-radio :label="0">临时</el-radio>
  204. <el-radio :label="1">长期</el-radio>
  205. </el-radio-group>
  206. </el-form-item>
  207. </el-form>
  208. <div class="txsj" style="text-align: center;margin-bottom: 30px">
  209. <el-button round @click="newRecordAction">新增医嘱内容</el-button>
  210. <el-button round @click="modifyRecordAction">修改医嘱内容</el-button>
  211. <el-button round @click="deleteRecordAction">删除医嘱内容</el-button>
  212. </div>
  213. <el-table
  214. ref="table" :data="adviceTableData"
  215. border
  216. highlight-current-row
  217. max-height="300"
  218. :header-cell-style="{ backgroundColor: 'rgb(245, 247, 250)'}"
  219. :row-class-name="tableRow"
  220. @row-click="onRowClick"
  221. style="width: 100%">
  222. <el-table-column label="医嘱内容" align="center" width="144">
  223. <template slot-scope="scope">
  224. {{scope.row.advice_name}}
  225. </template>
  226. </el-table-column>
  227. <el-table-column align="center" label="药品规格">
  228. <template slot-scope="scope">
  229. <span v-if="scope.row.advice_desc">{{scope.row.advice_desc}}{{scope.row.drug_spec_unit}}</span>
  230. </template>
  231. </el-table-column>
  232. <el-table-column prop="prescribing_number" align="center" label="开药数量">
  233. <template slot-scope="scope" v-if="scope.row.prescribing_number != ''">
  234. {{scope.row.prescribing_number}}{{scope.row.prescribing_number_unit}}
  235. </template>
  236. </el-table-column>
  237. <el-table-column prop="single_dose" align="center" label="单次用量">
  238. <template slot-scope="scope" v-if="scope.row.single_dose != ''">
  239. {{scope.row.single_dose}}{{scope.row.single_dose_unit}}
  240. </template>
  241. </el-table-column>
  242. <el-table-column prop="breathing_rate" align="center" label="给药途径">
  243. <template slot-scope="scope">
  244. {{scope.row.delivery_way}}
  245. </template>
  246. </el-table-column>
  247. <el-table-column prop="blood_flow_volume" align="center" label="执行频率">
  248. <template slot-scope="scope">
  249. {{scope.row.execution_frequency}}
  250. </template>
  251. </el-table-column>
  252. <el-table-column prop="blood_flow_volume" align="center" label="提醒频率" v-if="form.advice_type == 1">
  253. <template slot-scope="scope">
  254. <span v-if="scope.row.advice_type == 1 &&scope.row.frequency_type == 1">每次必推</span>
  255. <span v-if="scope.row.advice_type == 1 &&scope.row.frequency_type == 2">{{scope.row.day_count}}天/1次</span>
  256. <span v-if="scope.row.advice_type == 1 &&scope.row.frequency_type == 3">每周{{scope.row.weekdays}}</span>
  257. </template>
  258. </el-table-column>
  259. </el-table>
  260. </div>
  261. <div slot="footer" class="dialog-footer">
  262. <el-button @click="cancelTableHandle">取消</el-button>
  263. <el-button type="primary" @click="submitTableTemplate('form')">保 存</el-button>
  264. </div>
  265. </el-dialog>
  266. <!-- 新增子药 -->
  267. <el-dialog :title="dialogTitle" :before-close="closeform" :visible.sync="templateFormVisible" width="854px" >
  268. <el-form
  269. ref="templateForm"
  270. :rules="templateRules"
  271. :model="templateForm"
  272. label-width="90px"
  273. >
  274. <el-row >
  275. <el-col :span="24">
  276. <el-form-item label="医嘱内容:" required prop="advice_name">
  277. <el-autocomplete
  278. style="width:100%;"
  279. class="inline-input"
  280. v-model="templateForm.advice_name"
  281. :fetch-suggestions="querySearch"
  282. placeholder="请输入内容"
  283. @input="changeDrugName"
  284. @select="hangleSelectChange"
  285. ></el-autocomplete>
  286. </el-form-item>
  287. </el-col>
  288. <el-col :span="15">
  289. <el-form-item label="药品规格 :" prop="advice_desc">
  290. <el-col :span="8">
  291. <el-autocomplete
  292. style="width:100px;"
  293. class="inline-input"
  294. v-model="templateForm.advice_desc"
  295. :fetch-suggestions="querySearch1"
  296. placeholder="请输入内容"
  297. @input="changeDrugDesc"
  298. ></el-autocomplete>
  299. </el-col>
  300. <el-col class="line" :span="2">&nbsp;</el-col>
  301. <el-col :span="14">
  302. <el-select
  303. v-model="templateForm.drug_spec_unit"
  304. filterable
  305. clearable
  306. allow-create
  307. placeholder="选择"
  308. >
  309. <el-option
  310. v-for="item in unitsOption"
  311. :key="item.id"
  312. :label="item.name "
  313. :value="item.name"
  314. ></el-option>
  315. </el-select>
  316. </el-col>
  317. </el-form-item>
  318. </el-col>
  319. <el-col :span="12">
  320. <el-form-item label="开药数量 :" prop="prescribing_number">
  321. <el-col :span="9">
  322. <el-input v-model="templateForm.prescribing_number"></el-input>
  323. </el-col>
  324. <el-col class="line" :span="1">&nbsp;</el-col>
  325. <el-col :span="14">
  326. <el-select
  327. v-model="templateForm.prescribing_number_unit"
  328. filterable
  329. clearable
  330. allow-create
  331. placeholder="选择"
  332. >
  333. <el-option
  334. v-for="item in unitsOption"
  335. :key="item.id"
  336. :label="item.name "
  337. :value="item.name"
  338. ></el-option>
  339. </el-select>
  340. </el-col>
  341. </el-form-item>
  342. </el-col>
  343. <el-col :span="12">
  344. <el-form-item label="单次用量 :" prop="single_dose">
  345. <el-col :span="9">
  346. <el-input v-model="templateForm.single_dose"></el-input>
  347. </el-col>
  348. <el-col class="line" :span="1">&nbsp;</el-col>
  349. <el-col :span="14">
  350. <el-select
  351. v-model="templateForm.single_dose_unit"
  352. filterable
  353. clearable
  354. allow-create
  355. placeholder="选择"
  356. >
  357. <el-option
  358. v-for="item in unitsOption"
  359. :key="item.id"
  360. :label="item.name "
  361. :value="item.name"
  362. ></el-option>
  363. </el-select>
  364. </el-col>
  365. </el-form-item>
  366. </el-col>
  367. <el-col :span="12" v-if="!isAddChild">
  368. <el-form-item label="给药途径 :" prop="delivery_way">
  369. <el-select
  370. v-model="templateForm.delivery_way"
  371. filterable
  372. clearable
  373. allow-create
  374. placeholder="请选择(输入可搜索)"
  375. style="width:100%"
  376. >
  377. <el-option
  378. v-for="item in drugways"
  379. :key="item.id"
  380. :label="item.name "
  381. :value="item.name"
  382. ></el-option>
  383. </el-select>
  384. </el-form-item>
  385. </el-col>
  386. <el-col :span="12" v-if="!isAddChild">
  387. <el-form-item label="执行频率 :" prop="execution_frequency">
  388. <el-select
  389. v-model="templateForm.execution_frequency"
  390. clearable
  391. allow-create
  392. filterable
  393. placeholder="请选择(输入可搜索)"
  394. style="width:100%"
  395. >
  396. <el-option
  397. v-for="item in executionFrequencyOptions"
  398. :key="item.id"
  399. :label="item.name"
  400. :value="item.name"
  401. ></el-option>
  402. </el-select>
  403. </el-form-item>
  404. </el-col>
  405. <el-col :span="24" v-if="form.advice_type&&!isAddChild">
  406. <el-form-item label="周期提醒 :">
  407. <el-radio-group v-model="templateForm.frequency_type">
  408. <el-radio :label="1">每次必推</el-radio>
  409. <el-radio :label="2">天数频率</el-radio>
  410. <el-radio :label="3">星期频率</el-radio>
  411. </el-radio-group>
  412. </el-form-item>
  413. </el-col>
  414. <el-col :span="12" v-if="templateForm.frequency_type == 2">
  415. <el-form-item prop="day_count">
  416. <el-input style="width: 50px" v-model="templateForm.day_count"></el-input>&nbsp;
  417. 天/一次
  418. </el-form-item>
  419. </el-col>
  420. <el-col :span="24" v-if="templateForm.frequency_type == 3">
  421. <el-form-item prop="weekday">
  422. <el-checkbox-group v-model="templateForm.weekday">
  423. <el-checkbox label="周一" name="type"></el-checkbox>
  424. <el-checkbox label="周二" name="type"></el-checkbox>
  425. <el-checkbox label="周三" name="type"></el-checkbox>
  426. <el-checkbox label="周四" name="type"></el-checkbox>
  427. <el-checkbox label="周五" name="type"></el-checkbox>
  428. <el-checkbox label="周六" name="type"></el-checkbox>
  429. <el-checkbox label="周日" name="type"></el-checkbox>
  430. </el-checkbox-group>
  431. </el-form-item>
  432. </el-col>
  433. </el-row>
  434. </el-form>
  435. <div slot="footer" class="dialog-footer">
  436. <el-button @click="cancelHandle('templateForm'),closeform()">取消</el-button>
  437. <el-button type="primary" @click="submitTemplate('templateForm')">保 存</el-button>
  438. </div>
  439. </el-dialog>
  440. <!--TODO-->
  441. <el-dialog :title="editDialogTitle" :visible.sync="templateEditFormVisible" width="854px">
  442. <el-form
  443. ref="templateFormEdit"
  444. :rules="templateEditRules"
  445. :model="templateFormEdit"
  446. label-width="90px"
  447. >
  448. <el-row>
  449. <el-col :span="24">
  450. <el-form-item :label="edit_advice_name" required prop="advice_name">
  451. <el-autocomplete
  452. style="width:100%;"
  453. class="inline-input"
  454. v-model="templateFormEdit.advice_name"
  455. :fetch-suggestions="querySearch"
  456. placeholder="请输入内容"
  457. @input="changeDrugNameTwo"
  458. @select="hangdleSelectTwo"
  459. ></el-autocomplete>
  460. </el-form-item>
  461. </el-col>
  462. <el-col :span="15">
  463. <el-form-item label="药品规格 :" prop="advice_desc">
  464. <el-col :span="8">
  465. <el-autocomplete
  466. style="width:100px;"
  467. class="inline-input"
  468. v-model="templateFormEdit.advice_desc"
  469. :fetch-suggestions="querySearch1"
  470. placeholder="请输入内容"
  471. @input="changeDrugDescTwo"
  472. ></el-autocomplete>
  473. </el-col>
  474. <el-col class="line" :span="1">&nbsp;</el-col>
  475. <el-col :span="14">
  476. <el-select
  477. v-model="templateFormEdit.drug_spec_unit"
  478. filterable
  479. clearable
  480. allow-create
  481. placeholder="选择"
  482. >
  483. <el-option
  484. v-for="item in unitsOption"
  485. :key="item.id"
  486. :label="item.name "
  487. :value="item.name"
  488. ></el-option>
  489. </el-select>
  490. </el-col>
  491. </el-form-item>
  492. </el-col>
  493. <el-col :span="12">
  494. <el-form-item label="开药数量 :" prop="prescribing_number">
  495. <el-col :span="9">
  496. <el-input v-model="templateFormEdit.prescribing_number"></el-input>
  497. </el-col>
  498. <el-col class="line" :span="1">&nbsp;</el-col>
  499. <el-col :span="14">
  500. <el-select
  501. v-model="templateFormEdit.prescribing_number_unit"
  502. filterable
  503. clearable
  504. allow-create
  505. placeholder="选择"
  506. >
  507. <el-option
  508. v-for="item in unitsOption"
  509. :key="item.id"
  510. :label="item.name "
  511. :value="item.name"
  512. ></el-option>
  513. </el-select>
  514. </el-col>
  515. </el-form-item>
  516. </el-col>
  517. <el-col :span="12">
  518. <el-form-item label="单次用量 :" prop="single_dose">
  519. <el-col :span="9">
  520. <el-input v-model="templateFormEdit.single_dose"></el-input>
  521. </el-col>
  522. <el-col class="line" :span="1">&nbsp;</el-col>
  523. <el-col :span="14">
  524. <el-select
  525. v-model="templateFormEdit.single_dose_unit"
  526. filterable
  527. clearable
  528. allow-create
  529. placeholder="选择"
  530. >
  531. <el-option
  532. v-for="item in unitsOption"
  533. :key="item.id"
  534. :label="item.name "
  535. :value="item.name"
  536. ></el-option>
  537. </el-select>
  538. </el-col>
  539. </el-form-item>
  540. </el-col>
  541. <el-col :span="12" v-if="templateFormEdit.parent_id == 0">
  542. <el-form-item label="给药途径 :" prop="delivery_way">
  543. <el-select
  544. v-model="templateFormEdit.delivery_way"
  545. filterable
  546. clearable
  547. allow-create
  548. placeholder="请选择(输入可搜索)"
  549. style="width:100%"
  550. >
  551. <el-option
  552. v-for="item in drugways"
  553. :key="item.id"
  554. :label="item.name "
  555. :value="item.name"
  556. ></el-option>
  557. </el-select>
  558. </el-form-item>
  559. </el-col>
  560. <el-col :span="12" v-if="templateFormEdit.parent_id == 0">
  561. <el-form-item label="执行频率 :" prop="execution_frequency">
  562. <el-select
  563. v-model="templateFormEdit.execution_frequency"
  564. clearable
  565. allow-create
  566. filterable
  567. placeholder="请选择(输入可搜索)"
  568. style="width:100%"
  569. >
  570. <el-option
  571. v-for="item in executionFrequencyOptions"
  572. :key="item.id"
  573. :label="item.name"
  574. :value="item.name"
  575. ></el-option>
  576. </el-select>
  577. </el-form-item>
  578. </el-col>
  579. <el-col :span="24">
  580. <el-form-item label="周期提醒 :">
  581. <el-radio-group v-model="templateFormEdit.frequency_type">
  582. <el-radio :label="1">每次必推</el-radio>
  583. <el-radio :label="2">天数频率</el-radio>
  584. <el-radio :label="3">星期频率</el-radio>
  585. </el-radio-group>
  586. </el-form-item>
  587. </el-col>
  588. <el-col :span="12" v-if="templateFormEdit.frequency_type == 2">
  589. <el-form-item prop="day_count">
  590. <el-input style="width: 50px" v-model="templateFormEdit.day_count"></el-input>&nbsp;
  591. 天/一次
  592. </el-form-item>
  593. </el-col>
  594. <el-col :span="24" v-if="templateFormEdit.frequency_type == 3">
  595. <el-form-item>
  596. <el-checkbox-group v-model="templateFormEdit.weekday">
  597. <el-checkbox label="周一" name="type"></el-checkbox>
  598. <el-checkbox label="周二" name="type"></el-checkbox>
  599. <el-checkbox label="周三" name="type"></el-checkbox>
  600. <el-checkbox label="周四" name="type"></el-checkbox>
  601. <el-checkbox label="周五" name="type"></el-checkbox>
  602. <el-checkbox label="周六" name="type"></el-checkbox>
  603. <el-checkbox label="周日" name="type"></el-checkbox>
  604. </el-checkbox-group>
  605. </el-form-item>
  606. </el-col>
  607. </el-row>
  608. </el-form>
  609. <div slot="footer" class="dialog-footer">
  610. <el-button @click="cancelEditHandle">取消</el-button>
  611. <el-button type="primary" @click="submitEditTemplate('templateFormEdit')">保 存</el-button>
  612. </div>
  613. </el-dialog>
  614. <!--增删改查都请求网络类型的dialog-->
  615. <el-dialog title="编辑医嘱模版" :visible.sync="templateTableTwoVisible" width="800px">
  616. <div>
  617. <el-form ref="form" :model="form" :rule="formRules" label-width="100px">
  618. <el-form-item label="模版名称" style="width: 300px" prop="name">
  619. <el-input v-model="form.name" ></el-input>
  620. </el-form-item>
  621. <el-form-item label="排序" style="width: 300px" prop="name">
  622. <el-input v-model="form.sort" ></el-input>
  623. </el-form-item>
  624. </el-form>
  625. <div class="txsj" style="text-align: center;margin-bottom: 30px">
  626. <el-button round @click="newRecordActionTwo">新增医嘱内容</el-button>
  627. <!--<el-button round @click="deleteRecordActionTwo">删除医嘱内容</el-button>-->
  628. <!--<el-button round @click="modifyRecordActionTwo">修改医嘱内容</el-button>-->
  629. </div>
  630. <el-table :header-cell-style="{ backgroundColor: 'rgb(245, 247, 250)'}" ref="table"
  631. :data="adviceTableDataTwo" border highlight-current-row max-height="300">
  632. <el-table-column label="医嘱内容">
  633. <template slot-scope="scope">
  634. <span v-if="scope.row.parent_id == 0">{{scope.row.advice_name}}</span>
  635. <span v-if="scope.row.parent_id > 0"> &emsp;{{scope.row.advice_name}}</span>
  636. </template>
  637. </el-table-column>
  638. <el-table-column align="center" label="药品规格">
  639. <!-- {{drugDesc(scope.row)}} -->
  640. <template slot-scope="scope">
  641. <span v-if="scope.row.advice_desc">{{scope.row.advice_desc}}{{scope.row.drug_spec_unit}}</span>
  642. </template>
  643. </el-table-column>
  644. <el-table-column prop="prescribing_number" align="center" label="开药数量">
  645. <template slot-scope="scope" v-if="scope.row.prescribing_number != ''">
  646. {{scope.row.prescribing_number}}{{scope.row.prescribing_number_unit}}
  647. </template>
  648. </el-table-column>
  649. <el-table-column align="center" label="单次用量">
  650. <template slot-scope="scope" v-if="scope.row.single_dose != ''">
  651. {{scope.row.single_dose}}{{scope.row.single_dose_unit}}
  652. </template>
  653. </el-table-column>
  654. <el-table-column align="center" label="给药途径">
  655. <template slot-scope="scope">
  656. <span v-if="scope.row.parent_id == 0">{{scope.row.delivery_way}}</span>
  657. </template>
  658. </el-table-column>
  659. <el-table-column align="center" label="执行频率">
  660. <template slot-scope="scope">
  661. <span v-if="scope.row.parent_id == 0">{{scope.row.execution_frequency}}</span>
  662. </template>
  663. </el-table-column>
  664. <el-table-column align="center" label="提醒频率" v-if="form.advice_type == 1">
  665. <template slot-scope="scope">
  666. <span v-if="scope.row.frequency_type == 1">每次必推</span>
  667. <span v-if="scope.row.frequency_type == 2">{{scope.row.day_count}}天/1次</span>
  668. <span v-if="scope.row.frequency_type == 3">每周{{scope.row.week_days}}</span>
  669. </template>
  670. </el-table-column>
  671. </el-table>
  672. </div>
  673. <div slot="footer" class="dialog-footer">
  674. <el-button @click="cancelTableHandleTwo">取消</el-button>
  675. <el-button type="primary" @click="modifyTemplateName">保 存</el-button>
  676. </div>
  677. </el-dialog>
  678. <el-dialog title="新增医嘱" :visible.sync="templateFormTwoVisible" width="854px">
  679. <el-form
  680. ref="templateForm"
  681. :rules="templateEditRules"
  682. :model="templateForm"
  683. label-width="90px"
  684. >
  685. <el-row>
  686. <el-col :span="24">
  687. <el-form-item label="医嘱内容 :" required prop="advice_name">
  688. <!-- <el-input v-model="templateForm.advice_name"></el-input> -->
  689. <!-- <el-select
  690. v-model="templateForm.advice_name"
  691. filterable
  692. clearable
  693. allow-create
  694. placeholder="请选择(输入可搜索)"
  695. style="width:100%;"
  696. @change="changeDrugName"
  697. >
  698. <el-option
  699. v-for="(item,index) in all_drug"
  700. :key="index"
  701. :label="item.drug_name"
  702. :value="item.drug_name"
  703. ></el-option>
  704. </el-select> -->
  705. <el-autocomplete
  706. style="width:100%;"
  707. class="inline-input"
  708. v-model="templateForm.advice_name"
  709. :fetch-suggestions="querySearch"
  710. placeholder="请输入内容"
  711. @select="handleSelect"
  712. @input="changeDrugName"
  713. ></el-autocomplete>
  714. </el-form-item>
  715. </el-col>
  716. <el-col :span="12">
  717. <el-form-item label="药品规格 :" prop="advice_desc">
  718. <el-col :span="9">
  719. <!-- <el-input v-model="templateForm.advice_desc"></el-input> -->
  720. <!-- <el-select
  721. v-model="templateForm.advice_desc"
  722. filterable
  723. clearable
  724. allow-create
  725. placeholder="请选择(输入可搜索)"
  726. @change="changeDrugDesc"
  727. >
  728. <el-option
  729. v-for="item in drugSpec"
  730. :key="item.id"
  731. :label="item.drug_spec"
  732. :value="item.drug_spec"
  733. ></el-option>
  734. </el-select> -->
  735. <el-autocomplete
  736. style="width:100px;"
  737. class="inline-input"
  738. v-model="templateForm.advice_desc"
  739. :fetch-suggestions="querySearch1"
  740. placeholder="请输入内容"
  741. @select="handleSelect1"
  742. @input="changeDrugDesc"
  743. ></el-autocomplete>
  744. </el-col>
  745. <el-col class="line" :span="1">&nbsp;</el-col>
  746. <el-col :span="14">
  747. <el-select
  748. v-model="templateForm.drug_spec_unit"
  749. filterable
  750. clearable
  751. allow-create
  752. placeholder="选择"
  753. >
  754. <el-option
  755. v-for="item in unitsOption"
  756. :key="item.id"
  757. :label="item.name "
  758. :value="item.name"
  759. ></el-option>
  760. </el-select>
  761. </el-col>
  762. </el-form-item>
  763. </el-col>
  764. <el-col :span="12">
  765. <el-form-item label="开药数量 :" prop="prescribing_number">
  766. <el-col :span="9">
  767. <el-input v-model="templateForm.prescribing_number"></el-input>
  768. </el-col>
  769. <el-col class="line" :span="1">&nbsp;</el-col>
  770. <el-col :span="14">
  771. <el-select
  772. v-model="templateForm.prescribing_number_unit"
  773. filterable
  774. clearable
  775. allow-create
  776. placeholder="选择"
  777. >
  778. <el-option
  779. v-for="item in unitsOption"
  780. :key="item.id"
  781. :label="item.name "
  782. :value="item.name"
  783. ></el-option>
  784. </el-select>
  785. </el-col>
  786. </el-form-item>
  787. </el-col>
  788. <el-col :span="12">
  789. <el-form-item label="单次用量 :" prop="single_dose">
  790. <el-col :span="9">
  791. <el-input v-model="templateForm.single_dose"></el-input>
  792. </el-col>
  793. <el-col class="line" :span="1">&nbsp;</el-col>
  794. <el-col :span="14">
  795. <el-select
  796. v-model="templateForm.single_dose_unit"
  797. filterable
  798. clearable
  799. allow-create
  800. placeholder="选择"
  801. >
  802. <el-option
  803. v-for="item in unitsOption"
  804. :key="item.id"
  805. :label="item.name "
  806. :value="item.name"
  807. ></el-option>
  808. </el-select>
  809. </el-col>
  810. </el-form-item>
  811. </el-col>
  812. <el-col :span="12">
  813. <!--bug619-->
  814. <!-- <el-button @click="lili">调试</el-button>-->
  815. <el-form-item label="给药途径 :" prop="delivery_way">
  816. <el-select
  817. v-model="templateForm.delivery_way"
  818. filterable
  819. clearable
  820. allow-create
  821. placeholder="请选择(输入可搜索)"
  822. style="width:100%"
  823. >
  824. <el-option
  825. v-for="item in drugways"
  826. :key="item.id"
  827. :label="item.name "
  828. :value="item.name"
  829. ></el-option>
  830. </el-select>
  831. </el-form-item>
  832. </el-col>
  833. <el-col :span="12">
  834. <el-form-item label="执行频率 :" prop="execution_frequency">
  835. <el-select
  836. v-model="templateForm.execution_frequency"
  837. clearable
  838. allow-create
  839. filterable
  840. placeholder="请选择(输入可搜索)"
  841. style="width:100%"
  842. >
  843. <el-option
  844. v-for="item in executionFrequencyOptions"
  845. :key="item.id"
  846. :label="item.name"
  847. :value="item.name"
  848. ></el-option>
  849. </el-select>
  850. </el-form-item>
  851. </el-col>
  852. <el-col :span="24" v-if="form.advice_type == 1">
  853. <el-form-item label="周期提醒 :">
  854. <el-radio-group v-model="templateForm.frequency_type">
  855. <el-radio :label="1">每次必推</el-radio>
  856. <el-radio :label="2">天数频率</el-radio>
  857. <el-radio :label="3">星期频率</el-radio>
  858. </el-radio-group>
  859. </el-form-item>
  860. </el-col>
  861. <el-col :span="12" v-if="templateForm.frequency_type == 2">
  862. <el-form-item prop="day_count">
  863. <el-input style="width: 50px" v-model="templateForm.day_count"></el-input>&nbsp;
  864. 天/一次
  865. </el-form-item>
  866. </el-col>
  867. <el-col :span="24" v-if="templateForm.frequency_type == 3">
  868. <el-form-item>
  869. <el-checkbox-group v-model="templateForm.weekday">
  870. <el-checkbox label="周一" name="type"></el-checkbox>
  871. <el-checkbox label="周二" name="type"></el-checkbox>
  872. <el-checkbox label="周三" name="type"></el-checkbox>
  873. <el-checkbox label="周四" name="type"></el-checkbox>
  874. <el-checkbox label="周五" name="type"></el-checkbox>
  875. <el-checkbox label="周六" name="type"></el-checkbox>
  876. <el-checkbox label="周日" name="type"></el-checkbox>
  877. </el-checkbox-group>
  878. </el-form-item>
  879. </el-col>
  880. </el-row>
  881. </el-form>
  882. <div slot="footer" class="dialog-footer">
  883. <el-button @click="cancelHandleTwo">取消</el-button>
  884. <el-button type="primary" @click="submitTemplateTwo('templateForm')">保 存</el-button>
  885. </div>
  886. </el-dialog>
  887. <!--<el-dialog title="编辑医嘱" :visible.sync="templateEditFormTwoVisible" width="700px">-->
  888. <!--<el-form-->
  889. <!--ref="templateFormEdit"-->
  890. <!--:rules="templateEditRules"-->
  891. <!--:model="templateFormEdit"-->
  892. <!--label-width="90px"-->
  893. <!--&gt;-->
  894. <!--<el-form-item label="医嘱名称 :" required prop="advice_name">-->
  895. <!--<el-input v-model="templateFormEdit.advice_name" style="width:50%"></el-input>-->
  896. <!--</el-form-item>-->
  897. <!--<el-row>-->
  898. <!--<el-col :span="12">-->
  899. <!--<el-form-item label="药品规格 :" prop="drug_spec">-->
  900. <!--<el-col :span="8">-->
  901. <!--<el-input v-model="templateFormEdit.drug_spec"></el-input>-->
  902. <!--</el-col>-->
  903. <!--<el-col class="line" :span="2">&nbsp;</el-col>-->
  904. <!--<el-col :span="14">-->
  905. <!--<el-select-->
  906. <!--v-model="templateFormEdit.drug_spec_unit"-->
  907. <!--filterable-->
  908. <!--clearable-->
  909. <!--allow-create-->
  910. <!--placeholder="选择"-->
  911. <!--&gt;-->
  912. <!--<el-option-->
  913. <!--v-for="item in unitsOption"-->
  914. <!--:key="item.id"-->
  915. <!--:label="item.name "-->
  916. <!--:value="item.name"-->
  917. <!--&gt;</el-option>-->
  918. <!--</el-select>-->
  919. <!--</el-col>-->
  920. <!--</el-form-item>-->
  921. <!--</el-col>-->
  922. <!--<el-col :span="12">-->
  923. <!--<el-form-item label="单次用量 :" prop="single_dose">-->
  924. <!--<el-col :span="8">-->
  925. <!--<el-input v-model="templateFormEdit.single_dose"></el-input>-->
  926. <!--</el-col>-->
  927. <!--<el-col class="line" :span="2">&nbsp;</el-col>-->
  928. <!--<el-col :span="14">-->
  929. <!--<el-select-->
  930. <!--v-model="templateFormEdit.single_dose_unit"-->
  931. <!--filterable-->
  932. <!--clearable-->
  933. <!--allow-create-->
  934. <!--placeholder="选择"-->
  935. <!--&gt;-->
  936. <!--<el-option-->
  937. <!--v-for="item in unitsOption"-->
  938. <!--:key="item.id"-->
  939. <!--:label="item.name "-->
  940. <!--:value="item.name"-->
  941. <!--&gt;</el-option>-->
  942. <!--</el-select>-->
  943. <!--</el-col>-->
  944. <!--</el-form-item>-->
  945. <!--</el-col>-->
  946. <!--<el-col :span="12">-->
  947. <!--<el-form-item label="开药数量 :" prop="prescribing_number">-->
  948. <!--<el-col :span="8">-->
  949. <!--<el-input v-model="templateFormEdit.prescribing_number"></el-input>-->
  950. <!--</el-col>-->
  951. <!--<el-col class="line" :span="2">&nbsp;</el-col>-->
  952. <!--<el-col :span="14">-->
  953. <!--<el-select-->
  954. <!--v-model="templateFormEdit.prescribing_number_unit"-->
  955. <!--filterable-->
  956. <!--clearable-->
  957. <!--allow-create-->
  958. <!--placeholder="选择"-->
  959. <!--&gt;-->
  960. <!--<el-option-->
  961. <!--v-for="item in unitsOption"-->
  962. <!--:key="item.id"-->
  963. <!--:label="item.name "-->
  964. <!--:value="item.name"-->
  965. <!--&gt;</el-option>-->
  966. <!--</el-select>-->
  967. <!--</el-col>-->
  968. <!--</el-form-item>-->
  969. <!--</el-col>-->
  970. <!--<el-col :span="12">-->
  971. <!--<el-form-item label="给药途径 :" prop="delivery_way">-->
  972. <!--<el-select-->
  973. <!--v-model="templateFormEdit.delivery_way"-->
  974. <!--filterable-->
  975. <!--clearable-->
  976. <!--allow-create-->
  977. <!--placeholder="请选择(输入可搜索)"-->
  978. <!--style="width:90%"-->
  979. <!--&gt;-->
  980. <!--<el-option-->
  981. <!--v-for="item in drugways"-->
  982. <!--:key="item.id"-->
  983. <!--:label="item.name "-->
  984. <!--:value="item.name"-->
  985. <!--&gt;</el-option>-->
  986. <!--</el-select>-->
  987. <!--</el-form-item>-->
  988. <!--</el-col>-->
  989. <!--</el-row>-->
  990. <!--<el-row>-->
  991. <!--<el-col :span="12">-->
  992. <!--<el-form-item label="执行频率 :" prop="execution_frequency">-->
  993. <!--<el-select-->
  994. <!--v-model="templateFormEdit.execution_frequency"-->
  995. <!--clearable-->
  996. <!--allow-create-->
  997. <!--filterable-->
  998. <!--placeholder="请选择(输入可搜索)"-->
  999. <!--style="width:90%"-->
  1000. <!--&gt;-->
  1001. <!--<el-option-->
  1002. <!--v-for="item in executionFrequencyOptions"-->
  1003. <!--:key="item.id"-->
  1004. <!--:label="item.name"-->
  1005. <!--:value="item.name"-->
  1006. <!--&gt;</el-option>-->
  1007. <!--</el-select>-->
  1008. <!--</el-form-item>-->
  1009. <!--</el-col>-->
  1010. <!--</el-row>-->
  1011. <!--</el-form>-->
  1012. <!--<div slot="footer" class="dialog-footer">-->
  1013. <!--<el-button @click="cancelEditHandleTwo">取消</el-button>-->
  1014. <!--<el-button type="primary" @click="submitEditTemplateTwo('templateFormEdit')">保 存</el-button>-->
  1015. <!--</div>-->
  1016. <!--</el-dialog>-->
  1017. </div>
  1018. </el-tab-pane>
  1019. <el-tab-pane label="给药途径">
  1020. <div class="">
  1021. <div class="filter-container">
  1022. <el-button
  1023. class="filter-item"
  1024. style="margin-left: 10px;"
  1025. @click="handleCreateDrugWay"
  1026. type="primary"
  1027. icon="el-icon-circle-plus-outline"
  1028. size="small"
  1029. >{{$t('table.add')}}
  1030. </el-button>
  1031. </div>
  1032. <el-table
  1033. :data="drugways"
  1034. border
  1035. fit
  1036. :row-style="{ color: '#303133' }"
  1037. :header-cell-style="{
  1038. backgroundColor: 'rgb(245, 247, 250)',
  1039. color: '#606266'
  1040. }"
  1041. highlight-current-row
  1042. style="width: 100%;min-height:500px;"
  1043. >
  1044. <el-table-column align="center" label="名称">
  1045. <template slot-scope="scope">
  1046. <span>{{scope.row.name}}</span>
  1047. </template>
  1048. </el-table-column>
  1049. <el-table-column
  1050. align="center"
  1051. :label="$t('table.actions')"
  1052. width="230"
  1053. class-name="small-padding fixed-width"
  1054. >
  1055. <template slot-scope="scope">
  1056. <el-button type="text" size="mini" v-show="scope.row.org_id==0" disabled>系统设定</el-button>
  1057. <el-button
  1058. v-show="scope.row.org_id!=0"
  1059. type="primary"
  1060. size="small"
  1061. icon="el-icon-edit-outline"
  1062. @click="handleUpdateDrugWay(scope.row, scope.$index)"
  1063. >
  1064. </el-button>
  1065. <el-button
  1066. v-show="scope.row.org_id!=0"
  1067. size="small"
  1068. type="danger"
  1069. icon="el-icon-delete"
  1070. @click="handleDeleteDrugWay(scope.row, scope.$index)"
  1071. >
  1072. </el-button>
  1073. </template>
  1074. </el-table-column>
  1075. </el-table>
  1076. <el-dialog :title="dialogTitle" :visible.sync="drugwayFormVisible" width="700px">
  1077. <el-form
  1078. ref="drugwayForm"
  1079. :rules="drugwayRules"
  1080. :model="drugwayForm"
  1081. label-width="90px"
  1082. >
  1083. <el-form-item label="给药途径 :" required prop="name">
  1084. <el-input v-model="drugwayForm.name" placeholder="给药途径"></el-input>
  1085. </el-form-item>
  1086. <el-form-item label="bbx01 :" required prop="name" v-if="$store.getters.xt_user.org_id == 10206 || $store.getters.xt_user.org_id == 0">
  1087. <el-input v-model="drugwayForm.code" placeholder="bbx01"></el-input>
  1088. </el-form-item>
  1089. <el-form-item label="编码 :" required prop="name" v-if="$store.getters.xt_user.org_id != 10206 && $store.getters.xt_user.org_id !=0">
  1090. <el-input v-model="drugwayForm.code" placeholder="给药途径编码"></el-input>
  1091. </el-form-item>
  1092. <el-form-item label="bby01 :" required prop="name">
  1093. <el-input v-model="drugwayForm.bby01" placeholder="bby01"></el-input>
  1094. </el-form-item>
  1095. </el-form>
  1096. <div slot="footer" class="dialog-footer">
  1097. <el-button @click="drugwayFormVisible = false">取消</el-button>
  1098. <el-button type="primary" @click="submitDrugWay('drugwayForm')">保 存</el-button>
  1099. </div>
  1100. </el-dialog>
  1101. </div>
  1102. </el-tab-pane>
  1103. <el-tab-pane label="执行频率">
  1104. <div class="">
  1105. <div class="filter-container">
  1106. <el-button
  1107. class="filter-item"
  1108. style="margin-left: 10px;"
  1109. @click="handleCreateEF"
  1110. type="primary"
  1111. icon="el-icon-circle-plus-outline"
  1112. size="small"
  1113. >{{$t('table.add')}}
  1114. </el-button>
  1115. </div>
  1116. <el-table
  1117. :data="executionFrequencyOptions"
  1118. border
  1119. fit
  1120. :row-style="{ color: '#303133' }"
  1121. :header-cell-style="{
  1122. backgroundColor: 'rgb(245, 247, 250)',
  1123. color: '#606266'
  1124. }"
  1125. highlight-current-row
  1126. style="width: 100%;min-height:500px;"
  1127. >
  1128. <el-table-column align="center" label="名称">
  1129. <template slot-scope="scope">
  1130. <span>{{scope.row.name}}</span>
  1131. </template>
  1132. </el-table-column>
  1133. <el-table-column
  1134. align="center"
  1135. :label="$t('table.actions')"
  1136. width="230"
  1137. class-name="small-padding fixed-width"
  1138. >
  1139. <template slot-scope="scope">
  1140. <el-button type="text" size="mini" v-show="scope.row.org_id==0" disabled>系统设定</el-button>
  1141. <el-button
  1142. v-show="scope.row.org_id!=0"
  1143. type="primary"
  1144. size="small"
  1145. icon="el-icon-edit-outline"
  1146. @click="handleUpdateEF(scope.row, scope.$index)"
  1147. >
  1148. </el-button>
  1149. <el-button
  1150. v-show="scope.row.org_id!=0"
  1151. size="small"
  1152. type="danger"
  1153. icon="el-icon-delete"
  1154. @click="handleDeleteEF(scope.row, scope.$index)"
  1155. >
  1156. </el-button>
  1157. </template>
  1158. </el-table-column>
  1159. </el-table>
  1160. <el-dialog :title="dialogTitle" :visible.sync="efFormVisible" width="700px">
  1161. <el-form ref="efForm" :rules="efRules" :model="efForm" label-width="90px">
  1162. <el-form-item label="执行频率 :" required prop="name">
  1163. <el-input v-model="efForm.name" placeholder="执行频率"></el-input>
  1164. </el-form-item>
  1165. <el-form-item label="执行频率 :" >
  1166. <el-input v-model="efForm.code" placeholder="编码"></el-input>
  1167. </el-form-item>
  1168. </el-form>
  1169. <div slot="footer" class="dialog-footer">
  1170. <el-button @click="efFormVisible = false">取消</el-button>
  1171. <el-button type="primary" @click="submitEF('efForm')">保 存</el-button>
  1172. </div>
  1173. </el-dialog>
  1174. </div>
  1175. </el-tab-pane>
  1176. </el-tabs>
  1177. </div>
  1178. </div>
  1179. </template>
  1180. <style>
  1181. @import "../../../static/css/table_row.css";
  1182. .filter-item {
  1183. float: right;
  1184. }
  1185. </style>
  1186. <script>
  1187. import {
  1188. CreateAdviceTemplate,
  1189. CreateDrugDic,
  1190. CreateDrugWay,
  1191. CreateExecutionFrequency,
  1192. CreateSingleAdviceTemplate,
  1193. CreateSubAdvice,
  1194. DeleteAdviceTemplate,
  1195. DeleteDrugDic,
  1196. DeleteDrugWay,
  1197. DeleteExecutionFrequency,
  1198. DeleteParentAdviceTemplate,
  1199. getAllAdviceConfig,
  1200. getAllAdviceTemplate,
  1201. postAdviceTemplate,
  1202. UpdateAdviceTemplate,
  1203. UpdateDrugDic,
  1204. UpdateDrugWay,
  1205. UpdateExecutionFrequency,
  1206. updateTemplateName,
  1207. getDoctorAdviceConfig,
  1208. postDoctorAdviceConfig,
  1209. PostInitAdviceTemplate,
  1210. getDoctorInitConfig,
  1211. } from '@/api/advice'
  1212. import BreadCrumb from '@/xt_pages/components/bread-crumb'
  1213. import { getDataConfig } from '@/utils/data'
  1214. import { getSelfMedicalList } from "@/api/drug/drug"
  1215. export default {
  1216. name: 'tab',
  1217. components: { BreadCrumb },
  1218. data() {
  1219. return {
  1220. day_count: '',
  1221. crumbs: [
  1222. { path: false, name: '管理中心' },
  1223. { path: 'data/druguse', name: '医嘱模版' }
  1224. ],
  1225. rowIndex: -1,
  1226. current_template_id: 0,
  1227. currentObject: {},
  1228. tempArr: [],
  1229. sameRowArr: [],
  1230. advice_content_name: '',
  1231. table_current_index: -1,
  1232. adviceTableData: [],
  1233. templateName: '',
  1234. adviceTableDataTwo: [],
  1235. table_current_index_two: -1,
  1236. currentIndex: -1,
  1237. isEdit: false,
  1238. dialogTitle: '',
  1239. is_open_remind:0,
  1240. is_init:0,
  1241. isAddChild: false,
  1242. parent_id: 0,
  1243. editDialogTitle: '编辑医嘱',
  1244. drugdicFormVisible: false,
  1245. drugwayFormVisible: false,
  1246. templateFormVisible: false,
  1247. templateTableTwoVisible: false,
  1248. templateEditFormVisible: false,
  1249. edit_advice_name: '',
  1250. templateTableVisible: false,
  1251. templateFormTwoVisible: false,
  1252. templateEditFormTwoVisible: false,
  1253. efFormVisible: false,
  1254. activeName: 'drugdic',
  1255. hoverOrderArr: [],
  1256. createdTimes: 0,
  1257. drugdics: [],
  1258. adviceTemplates: [],
  1259. current_template_name: '',
  1260. editForm: {
  1261. name: ''
  1262. },
  1263. loading:false,
  1264. drugways: [],
  1265. executionFrequencyOptions: [],
  1266. drugdicRules: {
  1267. name: [{ required: true, message: '请填写医嘱内容' }]
  1268. },
  1269. formRules: {
  1270. name: [
  1271. { required: true, message: '请输入模版名称', trigger: 'blur' }
  1272. ],
  1273. advice_type: [
  1274. { required: true, message: '请选择模版类型', trigger: 'change' }
  1275. ]
  1276. },
  1277. drugwayRules: {
  1278. name: [{ required: true, message: '请填写给药途径' }]
  1279. },
  1280. efRules: {
  1281. name: [{ required: true, message: '请填写执行频率' }]
  1282. },
  1283. templateRules: {
  1284. advice_name: [{ required: true, message: '请填写医嘱内容' }]
  1285. },
  1286. templateEditRules: {
  1287. advice_name: [{ required: true, message: '请填写医嘱内容' }]
  1288. },
  1289. templateForm: {
  1290. frequency_type: 1,
  1291. day_count: '',
  1292. weekday: [],
  1293. drug_spec: '',
  1294. drug_spec_unit: '',
  1295. advice_name: '',
  1296. advice_desc: '',
  1297. single_dose: '',
  1298. single_dose_unit: '',
  1299. prescribing_number: '',
  1300. prescribing_number_unit: '',
  1301. delivery_way: '',
  1302. execution_frequency: '',
  1303. id: 0,
  1304. drug_id:0,
  1305. way:0
  1306. },
  1307. dialogConfigVisible:false,
  1308. templateFormEdit: {
  1309. frequency_type: 0,
  1310. day_count: '',
  1311. weekday: [],
  1312. week_days: '',
  1313. drug_spec: '',
  1314. drug_spec_unit: '',
  1315. advice_name: '',
  1316. advice_desc: '',
  1317. single_dose: '',
  1318. single_dose_unit: '',
  1319. prescribing_number: '',
  1320. prescribing_number_unit: '',
  1321. delivery_way: '',
  1322. execution_frequency: '',
  1323. id: 0
  1324. },
  1325. drugdicForm: {
  1326. name: '',
  1327. spec: '',
  1328. spec_unit: '',
  1329. form: '',
  1330. form_unit: '',
  1331. id: 0
  1332. },
  1333. form: {
  1334. name: '',
  1335. advice_type: 0,
  1336. sort:"",
  1337. },
  1338. drugwayForm: {
  1339. name: '',
  1340. id: 0,
  1341. code:"",
  1342. bby01:"",
  1343. },
  1344. efForm: {
  1345. name: '',
  1346. id: 0,
  1347. code: "",
  1348. },
  1349. drugforms: [
  1350. { lable: 1, name: '胶囊' },
  1351. { lable: 2, name: '注射剂' },
  1352. { lable: 3, name: '片剂' },
  1353. { lable: 4, name: '注射液' },
  1354. { lable: 5, name: '栓剂' },
  1355. { lable: 6, name: '膏' },
  1356. { lable: 7, name: '颗粒剂' },
  1357. { lable: 8, name: '粉剂' },
  1358. { lable: 9, name: '口服液' },
  1359. { lable: 10, name: '干混悬剂' },
  1360. { lable: 11, name: '丸剂' },
  1361. { lable: 12, name: '气雾剂' },
  1362. { lable: 13, name: '内服溶液' },
  1363. { lable: 14, name: '外用溶液' },
  1364. { lable: 15, name: '软膏剂' },
  1365. { lable: 16, name: '胶剂' }
  1366. ],
  1367. medicals:[],
  1368. drugSpec:[],
  1369. all_drug:[],
  1370. current_drug_name:"",
  1371. current_drug_spec: "",
  1372. drug_id: 0,
  1373. src_type:"",
  1374. way:0
  1375. }
  1376. },
  1377. created() {
  1378. this.getAdviceConfig()
  1379. this.unitsOption = getDataConfig('hemodialysis', 'units')
  1380. this.getDoctorAdviceConfig()
  1381. this.getDoctorInitConfig()
  1382. //获取自备药
  1383. this.getSelfMedicalList()
  1384. },
  1385. methods: {
  1386. lili(){
  1387. console.log()
  1388. },
  1389. initAdvice(){
  1390. this.$confirm('是否进行医嘱初始化操作?', '提示', {
  1391. confirmButtonText: '确定',
  1392. cancelButtonText: '取消',
  1393. type: 'warning'
  1394. }).then(() => {
  1395. let params = {
  1396. is_init:1
  1397. }
  1398. this.loading = true
  1399. PostInitAdviceTemplate(params).then(response => {
  1400. if (response.data.state == 1) {
  1401. this.is_init = response.data.data.init_config.is_init
  1402. this.getAdviceConfig()
  1403. this.loading = false
  1404. } else {
  1405. this.loading = false
  1406. this.$message.error(response.data.msg)
  1407. }
  1408. })
  1409. }).catch(() => {
  1410. this.loading = false
  1411. });
  1412. },
  1413. getDoctorAdviceConfig(){
  1414. getDoctorAdviceConfig().then(response => {
  1415. if (response.data.state == 1) {
  1416. this.is_open_remind = response.data.data.config.is_open_remind
  1417. } else {
  1418. this.$message.error(response.data.msg)
  1419. }
  1420. })
  1421. },
  1422. getDoctorInitConfig(){
  1423. getDoctorInitConfig().then(response => {
  1424. if (response.data.state == 1) {
  1425. if(response.data.data.advice_init == null){
  1426. this.is_init = 0
  1427. }else{
  1428. this.is_init = response.data.data.advice_init.is_init
  1429. }
  1430. } else {
  1431. this.$message.error(response.data.msg)
  1432. }
  1433. })
  1434. },
  1435. adviceNameShow({ row, column, rowIndex, columnIndex }) {
  1436. if (columnIndex == 1) {
  1437. return 'templateadvicenamedisplay'
  1438. } else {
  1439. return ''
  1440. }
  1441. },
  1442. showCreatedTimes() {
  1443. this.createdTimes = this.createdTimes + 1
  1444. },
  1445. handleUpdateDrugDic(row, index) {
  1446. this.currentIndex = index
  1447. this.drugdicForm = {
  1448. name: row.name,
  1449. spec: row.spec,
  1450. spec_unit: row.spec_unit,
  1451. form: row.form,
  1452. form_unit: row.form_unit,
  1453. id: row.id
  1454. }
  1455. this.drugdicFormVisible = true
  1456. this.dialogTitle = '编辑医嘱模版'
  1457. this.isEdit = true
  1458. },
  1459. handleCreateDrugDic() {
  1460. this.drugdicForm = {
  1461. name: '',
  1462. spec: '',
  1463. spec_unit: '',
  1464. form: '',
  1465. form_unit: '',
  1466. id: 0
  1467. }
  1468. this.drugdicFormVisible = true
  1469. this.dialogTitle = '新增医嘱模版'
  1470. this.isEdit = false
  1471. },
  1472. cancelHandle(formName) {
  1473. this.table_current_index = -1
  1474. this.resetForm(formName)
  1475. if (this.isAddChild) {
  1476. this.templateFormVisible = false
  1477. } else {
  1478. this.templateFormVisible = false
  1479. this.templateTableVisible = true
  1480. }
  1481. },
  1482. handleCreateTemplate() {
  1483. this.form.advice_type = 0
  1484. this.templateTableVisible = true
  1485. },
  1486. newRecordAction() {
  1487. console.log("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA")
  1488. this.dialogTitle = '新增医嘱内容'
  1489. this.advice_content_name = '医嘱内容'
  1490. this.isEdit = false
  1491. this.parent_id = 0
  1492. this.isAddChild = false
  1493. this.templateTableVisible = false
  1494. this.templateFormVisible = true
  1495. },
  1496. deleteRecordAction: function() {
  1497. if (this.table_current_index == -1) {
  1498. this.$message.error('请选择一条医嘱记录')
  1499. return
  1500. }
  1501. this.$confirm('删除记录', '是否删除该医嘱记录', {
  1502. confirmButtonText: '确 定',
  1503. cancelButtonText: '取 消',
  1504. type: 'warning'
  1505. }).then(() => {
  1506. this.adviceTableData.splice(this.table_current_index, 1)
  1507. this.table_current_index = -1
  1508. }).catch(() => {
  1509. })
  1510. },
  1511. tableRow({ row, rowIndex }) {
  1512. // 把每一行的索引放进row
  1513. row.index = rowIndex
  1514. },
  1515. onRowClick(row, event, column) {
  1516. this.table_current_index = row.index
  1517. },
  1518. modifyRecordAction: function() {
  1519. if (this.table_current_index == -1) {
  1520. this.$message.error('请选择一条医嘱记录')
  1521. return
  1522. }
  1523. this.isEdit = true
  1524. const adviceTable = this.adviceTableData[this.table_current_index]
  1525. for (var index in adviceTable) {
  1526. this.templateForm[index] = adviceTable[index]
  1527. }
  1528. this.templateForm.weekday = adviceTable.weekdays.split(',')
  1529. this.templateFormVisible = true
  1530. this.templateTableVisible = false
  1531. this.dialogTitle = '编辑医嘱内容'
  1532. this.advice_content_name = '医嘱内容'
  1533. }, cancelTableHandle: function() {
  1534. this.$confirm('放弃编辑', '是否放弃编辑,已编辑的数据将无法恢复', {
  1535. confirmButtonText: '确 定',
  1536. cancelButtonText: '取 消',
  1537. type: 'warning'
  1538. }).then(() => {
  1539. this.adviceTableData = []
  1540. this.form.name = ''
  1541. this.templateFormVisible = false
  1542. this.templateTableVisible = false
  1543. }).catch(() => {
  1544. })
  1545. },
  1546. //添加医嘱模版
  1547. submitTableTemplate(formName) {
  1548. if (this.adviceTableData.length <= 0) {
  1549. this.$message.error('至少添加一条医嘱信息')
  1550. return
  1551. }
  1552. const params = {
  1553. 'data': this.adviceTableData
  1554. }
  1555. let name = encodeURIComponent(this.form.name)
  1556. console.log("params",params)
  1557. let sort = this.form.sort
  1558. postAdviceTemplate(params, name,sort, this.form.advice_type).then(response => {
  1559. if (response.data.state == 0) {
  1560. this.$message.error(response.data.msg)
  1561. return false
  1562. } else {
  1563. this.$message.success('添加模版成功')
  1564. var template = response.data.data.template
  1565. if (template.DoctorAdviceTemplate.length > 0) {
  1566. for (let i = 0; i < template.DoctorAdviceTemplate.length; i++) {
  1567. const object = {}
  1568. const DoctorAdviceTemplate = template.DoctorAdviceTemplate[i]
  1569. for (const key in DoctorAdviceTemplate) {
  1570. object[key] = DoctorAdviceTemplate[key]
  1571. }
  1572. object['name'] = template.name
  1573. object['isNoSub'] = 2
  1574. object['sort'] = template.sort
  1575. this.adviceTemplates.unshift(object)
  1576. }
  1577. }
  1578. this.handleSpanTempArr()
  1579. this.form.name = ''
  1580. this.adviceTableData = []
  1581. this.templateFormVisible = false
  1582. this.templateTableVisible = false
  1583. }
  1584. })
  1585. },
  1586. resetForm(formName) {
  1587. this.$refs[formName].resetFields()
  1588. },
  1589. handleDeleteDrugDic(row, index) {
  1590. this.$confirm('确认删除此医嘱模板?', '删除', {
  1591. confirmButtonText: '确 定',
  1592. cancelButtonText: '取 消',
  1593. type: 'warning'
  1594. })
  1595. .then(() => {
  1596. DeleteDrugDic(row.id).then(response => {
  1597. if (response.data.state == 0) {
  1598. this.$message.error(response.data.msg)
  1599. return false
  1600. } else {
  1601. this.$message.success('删除成功')
  1602. this.drugdics.splice(index, 1)
  1603. }
  1604. })
  1605. })
  1606. .catch(() => {
  1607. })
  1608. },
  1609. handleDeleteAdviceTemplate(row, index) {
  1610. this.$confirm('确认删除此医嘱模板?', '删除', {
  1611. confirmButtonText: '确 定',
  1612. cancelButtonText: '取 消',
  1613. type: 'warning'
  1614. })
  1615. .then(() => {
  1616. DeleteParentAdviceTemplate(row.template_id).then(response => {
  1617. if (response.data.state == 0) {
  1618. this.$message.error(response.data.msg)
  1619. return false
  1620. } else {
  1621. this.$message.success('删除成功')
  1622. // console.log(this.adviceTemplates.length)
  1623. // for(let i = 0;i < this.adviceTemplates.length; i++){
  1624. // if(this.adviceTemplates[i].template_id == row.template_id){
  1625. // this.adviceTemplates.splice(i,1);
  1626. // }
  1627. // }
  1628. this.getAdviceConfig()
  1629. }
  1630. })
  1631. })
  1632. .catch(() => {
  1633. })
  1634. },
  1635. submitDrugDic(formName) {
  1636. this.$refs[formName].validate(valid => {
  1637. if (valid) {
  1638. if (this.isEdit) {
  1639. UpdateDrugDic(this.drugdicForm.id, this.drugdicForm).then(
  1640. response => {
  1641. if (response.data.state == 0) {
  1642. this.$message.error(response.data.msg)
  1643. return false
  1644. } else {
  1645. this.$message.success('修改成功')
  1646. this.drugdicFormVisible = false
  1647. this.resetForm(formName)
  1648. var drugdic = response.data.data.drugdic
  1649. this.drugdics[this.currentIndex].name = drugdic.name
  1650. this.drugdics[this.currentIndex].spec = drugdic.spec
  1651. this.drugdics[this.currentIndex].spec_unit =
  1652. drugdic.spec_unit
  1653. this.drugdics[this.currentIndex].form = drugdic.form
  1654. this.drugdics[this.currentIndex].form_unit =
  1655. drugdic.form_unit
  1656. this.drugdics[this.currentIndex].updated_time =
  1657. drugdic.updated_time
  1658. this.currentIndex = -1
  1659. return false
  1660. }
  1661. }
  1662. )
  1663. } else {
  1664. CreateDrugDic(this.drugdicForm).then(response => {
  1665. if (response.data.state == 0) {
  1666. this.$message.error(response.data.msg)
  1667. return false
  1668. } else {
  1669. this.$message.success('添加成功')
  1670. this.drugdicFormVisible = false
  1671. this.resetForm(formName)
  1672. this.drugdics.unshift(response.data.data.drugdic)
  1673. return false
  1674. }
  1675. })
  1676. }
  1677. }
  1678. })
  1679. },
  1680. handleSelect1(){
  1681. this.templateForm.drug_id = val.id
  1682. this.templateForm.way = 1
  1683. },
  1684. handleSelect(val){
  1685. console.log("val23232li",val)
  1686. this.templateForm.drug_id = val.id
  1687. this.templateForm.way = 1
  1688. var tmp = val.drug_specs[0]
  1689. console.log("tmp",tmp)
  1690. console.log("unitsOption",this.unitsOption)
  1691. this.templateForm.advice_desc = tmp.dose+tmp.dose_unit+"*"+tmp.min_number+tmp.min_unit+"/"//药品规格
  1692. this.templateForm.drug_spec_unit = tmp.max_unit
  1693. this.templateForm.prescribing_number = tmp.prescribing_number//开药数量
  1694. this.templateForm.prescribing_number_unit = tmp.prescribing_number_unit
  1695. this.templateForm.single_dose = tmp.single_dose//单次用量
  1696. this.templateForm.single_dose_unit = tmp.drug_dose_unit
  1697. this.templateForm.delivery_way = tmp.delivery_way//给药途径
  1698. this.templateForm.execution_frequency = tmp.execution_frequency//执行频率
  1699. this.templateForm.drug_id = tmp.id
  1700. },
  1701. submitTemplate(formName) {
  1702. // if(this.src_type == ""){
  1703. // this.templateForm.way = 0
  1704. // this.templateForm.drug_id = 0
  1705. // }
  1706. if(this.src_type == 2){ //自备药
  1707. var arr = this.templateForm.advice_name.split("(自备药)")
  1708. this.templateForm.advice_name = arr[0]
  1709. }
  1710. // console.log("2222",this.templateForm)
  1711. this.$refs[formName].validate(valid => {
  1712. this.templateForm.single_dose = parseFloat(this.templateForm.single_dose)
  1713. this.templateForm.prescribing_number = parseFloat(this.templateForm.prescribing_number)
  1714. if (isNaN(this.templateForm.single_dose)) {
  1715. this.templateForm.single_dose = 0
  1716. }
  1717. if (isNaN(this.templateForm.prescribing_number)) {
  1718. this.templateForm.prescribing_number = 0
  1719. }
  1720. if (valid) {
  1721. const templateFormTwo = {}
  1722. templateFormTwo.template_id = this.current_template_id
  1723. templateFormTwo.advice_name = this.templateForm.advice_name
  1724. templateFormTwo.advice_desc = this.templateForm.advice_desc
  1725. templateFormTwo.drug_spec = this.templateForm.drug_spec
  1726. templateFormTwo.drug_spec_unit = this.templateForm.drug_spec_unit
  1727. templateFormTwo.single_dose = this.templateForm.single_dose
  1728. templateFormTwo.single_dose_unit = this.templateForm.single_dose_unit
  1729. templateFormTwo.prescribing_number = this.templateForm.prescribing_number
  1730. templateFormTwo.prescribing_number_unit = this.templateForm.prescribing_number_unit
  1731. templateFormTwo.delivery_way = this.templateForm.delivery_way
  1732. templateFormTwo.execution_frequency = this.templateForm.execution_frequency
  1733. templateFormTwo.parent_id = this.parent_id
  1734. templateFormTwo.drug_id = this.templateForm.drug_id
  1735. templateFormTwo.way = this.templateForm.way
  1736. if (this.isAddChild) {
  1737. CreateSubAdvice(templateFormTwo).then(response => {
  1738. if (response.data.state == 0) {
  1739. this.$message.error(response.data.msg)
  1740. this.closeform()
  1741. return false
  1742. } else {
  1743. this.$message.success('添加成功')
  1744. var spliceIndex = -1
  1745. for (let index = this.adviceTemplates.length - 1; ; index--) {
  1746. if (this.adviceTemplates[index].parent_id === templateFormTwo.parent_id) {
  1747. spliceIndex = index
  1748. break
  1749. } else if (this.adviceTemplates[index].id === templateFormTwo.parent_id) {
  1750. spliceIndex = index
  1751. break
  1752. }
  1753. }
  1754. if (spliceIndex > -1) {
  1755. spliceIndex += 1
  1756. if (spliceIndex === this.adviceTemplates.length) {
  1757. const template = response.data.data.template
  1758. template['isNoSub'] = 2
  1759. this.adviceTemplates.push(template)
  1760. } else {
  1761. const template = response.data.data.template
  1762. template['isNoSub'] = 2
  1763. var swapData = this.adviceTemplates.splice(spliceIndex)
  1764. this.adviceTemplates.push(template)
  1765. this.adviceTemplates = this.adviceTemplates.concat(swapData)
  1766. }
  1767. }
  1768. this.handleSpanTempArr()
  1769. this.templateFormVisible = false
  1770. this.resetForm(formName)
  1771. this.closeform()
  1772. return false
  1773. }
  1774. })
  1775. } else {
  1776. const templateFormTwo = {}
  1777. templateFormTwo.advice_name = this.templateForm.advice_name
  1778. templateFormTwo.advice_desc = this.templateForm.advice_desc
  1779. templateFormTwo.drug_spec = this.templateForm.drug_spec
  1780. templateFormTwo.drug_spec_unit = this.templateForm.drug_spec_unit
  1781. templateFormTwo.single_dose = this.templateForm.single_dose
  1782. templateFormTwo.single_dose_unit = this.templateForm.single_dose_unit
  1783. templateFormTwo.prescribing_number = this.templateForm.prescribing_number
  1784. templateFormTwo.prescribing_number_unit = this.templateForm.prescribing_number_unit
  1785. templateFormTwo.delivery_way = this.templateForm.delivery_way
  1786. templateFormTwo.execution_frequency = this.templateForm.execution_frequency
  1787. templateFormTwo.parent_id = this.parent_id
  1788. templateFormTwo.drug_id = this.templateForm.drug_id
  1789. templateFormTwo.way = this.templateForm.way
  1790. if (this.templateForm.frequency_type == 1) {
  1791. templateFormTwo.frequency_type = this.templateForm.frequency_type
  1792. templateFormTwo.day_count = '0'
  1793. templateFormTwo.weekdays = ''
  1794. } else if (this.templateForm.frequency_type == 2) {
  1795. templateFormTwo.frequency_type = this.templateForm.frequency_type
  1796. templateFormTwo.day_count = this.templateForm.day_count
  1797. templateFormTwo.weekdays = ''
  1798. } else if (this.templateForm.frequency_type == 3) {
  1799. templateFormTwo.frequency_type = this.templateForm.frequency_type
  1800. templateFormTwo.day_count = '0'
  1801. templateFormTwo.weekdays = this.templateForm.weekday.filter(function(s) {
  1802. return s && s.trim()
  1803. }).join(',')
  1804. }
  1805. this.templateForm.advice_name = ''
  1806. this.templateForm.advice_desc = ''
  1807. this.templateForm.frequency_type = 1
  1808. this.templateForm.day_count = ''
  1809. this.templateForm.weekday = []
  1810. console.log(templateFormTwo)
  1811. if (this.isEdit) {
  1812. for (let i = 0; i < this.adviceTableData.length; i++) {
  1813. if (i == this.table_current_index) {
  1814. this.adviceTableData[i].advice_name = templateFormTwo.advice_name
  1815. this.adviceTableData[i].advice_desc = templateFormTwo.advice_desc
  1816. this.adviceTableData[i].drug_spec = templateFormTwo.drug_spec
  1817. this.adviceTableData[i].drug_spec_unit = templateFormTwo.drug_spec_unit
  1818. this.adviceTableData[i].single_dose = templateFormTwo.single_dose
  1819. this.adviceTableData[i].single_dose_unit = templateFormTwo.single_dose_unit
  1820. this.adviceTableData[i].prescribing_number = templateFormTwo.prescribing_number
  1821. this.adviceTableData[i].prescribing_number_unit = templateFormTwo.prescribing_number_unit
  1822. this.adviceTableData[i].delivery_way = templateFormTwo.delivery_way
  1823. this.adviceTableData[i].execution_frequency = templateFormTwo.execution_frequency
  1824. this.adviceTableData[i].frequency_type = templateFormTwo.frequency_type
  1825. this.adviceTableData[i].day_count = templateFormTwo.day_count
  1826. this.adviceTableData[i].weekdays = templateFormTwo.weekdays
  1827. this.adviceTableData[i].drug_id = templateFormTwo.drug_id
  1828. this.adviceTableData[i].way = templateFormTwo.way
  1829. }
  1830. }
  1831. } else {
  1832. this.adviceTableData.unshift(templateFormTwo)
  1833. console.log(this.adviceTableData)
  1834. }
  1835. this.templateFormVisible = false
  1836. this.templateTableVisible = true
  1837. }
  1838. this.$refs[formName].resetFields()
  1839. }
  1840. })
  1841. },
  1842. handleCreateDrugWay() {
  1843. this.drugwayForm = {
  1844. name: '',
  1845. code:'',
  1846. id: 0,
  1847. bby01:"",
  1848. }
  1849. this.drugwayFormVisible = true
  1850. this.dialogTitle = '新增给药途径'
  1851. this.isEdit = false
  1852. },
  1853. handleUpdateDrugWay(row, index) {
  1854. console.log(row.code)
  1855. this.currentIndex = index
  1856. this.drugwayForm = {
  1857. name: row.name,
  1858. id: row.id,
  1859. code:row.code,
  1860. bby01:row.bby01
  1861. }
  1862. this.drugwayFormVisible = true
  1863. this.dialogTitle = '编辑给药途径'
  1864. this.isEdit = true
  1865. },
  1866. submitDrugWay(formName) {
  1867. this.$refs[formName].validate(valid => {
  1868. if (valid) {
  1869. if (this.isEdit) {
  1870. UpdateDrugWay(this.drugwayForm.id, this.drugwayForm).then(
  1871. response => {
  1872. if (response.data.state == 0) {
  1873. this.$message.error(response.data.msg)
  1874. return false
  1875. } else {
  1876. this.$message.success('修改成功')
  1877. this.drugwayFormVisible = false
  1878. this.resetForm(formName)
  1879. var drugway = response.data.data.drugway
  1880. this.drugways[this.currentIndex].name = drugway.name
  1881. this.drugways[this.currentIndex].code = drugway.code
  1882. this.drugways[this.currentIndex].bby01 = drugway.bby01
  1883. this.drugways[this.currentIndex].updated_time =
  1884. drugway.updated_time
  1885. this.currentIndex = -1
  1886. return false
  1887. }
  1888. }
  1889. )
  1890. } else {
  1891. CreateDrugWay(this.drugwayForm).then(response => {
  1892. if (response.data.state == 0) {
  1893. this.$message.error(response.data.msg)
  1894. return false
  1895. } else {
  1896. this.$message.success('添加成功')
  1897. this.drugwayFormVisible = false
  1898. this.resetForm(formName)
  1899. this.drugways.unshift(response.data.data.drugway)
  1900. return false
  1901. }
  1902. })
  1903. }
  1904. }
  1905. })
  1906. },
  1907. handleDeleteDrugWay(row, index) {
  1908. this.$confirm('确认删除此给药途径?', '删除', {
  1909. confirmButtonText: '确 定',
  1910. cancelButtonText: '取 消',
  1911. type: 'warning'
  1912. })
  1913. .then(() => {
  1914. DeleteDrugWay(row.id).then(response => {
  1915. if (response.data.state == 0) {
  1916. this.$message.error(response.data.msg)
  1917. return false
  1918. } else {
  1919. this.$message.success('删除成功')
  1920. this.drugways.splice(index, 1)
  1921. }
  1922. })
  1923. })
  1924. .catch(() => {
  1925. })
  1926. },
  1927. handleCreateEF() {
  1928. this.efForm = {
  1929. name: '',
  1930. id: 0
  1931. }
  1932. this.efFormVisible = true
  1933. this.dialogTitle = '新增执行频率'
  1934. this.isEdit = false
  1935. },
  1936. handleUpdateEF(row, index) {
  1937. this.currentIndex = index
  1938. this.efForm = {
  1939. name: row.name,
  1940. id: row.id,
  1941. code: row.code
  1942. }
  1943. this.efFormVisible = true
  1944. this.dialogTitle = '编辑执行频率'
  1945. this.isEdit = true
  1946. },
  1947. submitEF(formName) {
  1948. this.$refs[formName].validate(valid => {
  1949. if (valid) {
  1950. if (this.isEdit) {
  1951. UpdateExecutionFrequency(this.efForm.id, this.efForm).then(
  1952. response => {
  1953. if (response.data.state == 0) {
  1954. this.$message.error(response.data.msg)
  1955. return false
  1956. } else {
  1957. this.$message.success('修改成功')
  1958. this.efFormVisible = false
  1959. this.resetForm(formName)
  1960. var ef = response.data.data.ef
  1961. this.executionFrequencyOptions[this.currentIndex].name =
  1962. ef.name
  1963. this.executionFrequencyOptions[
  1964. this.currentIndex
  1965. ].updated_time = ef.updated_time
  1966. this.currentIndex = -1
  1967. return false
  1968. }
  1969. }
  1970. )
  1971. } else {
  1972. CreateExecutionFrequency(this.efForm).then(response => {
  1973. if (response.data.state == 0) {
  1974. this.$message.error(response.data.msg)
  1975. return false
  1976. } else {
  1977. this.$message.success('添加成功')
  1978. this.efFormVisible = false
  1979. this.resetForm(formName)
  1980. this.executionFrequencyOptions.unshift(response.data.data.ef)
  1981. return false
  1982. }
  1983. })
  1984. }
  1985. }
  1986. })
  1987. },
  1988. handleDeleteEF(row, index) {
  1989. this.$confirm('确认删除此执行频率?', '删除', {
  1990. confirmButtonText: '确 定',
  1991. cancelButtonText: '取 消',
  1992. type: 'warning'
  1993. })
  1994. .then(() => {
  1995. DeleteExecutionFrequency(row.id).then(response => {
  1996. if (response.data.state == 0) {
  1997. this.$message.error(response.data.msg)
  1998. return false
  1999. } else {
  2000. this.$message.error('删除成功')
  2001. this.executionFrequencyOptions.splice(index, 1)
  2002. }
  2003. })
  2004. })
  2005. .catch(() => {
  2006. })
  2007. },
  2008. getAdviceConfig() {
  2009. this.adviceTemplates = []
  2010. getAllAdviceConfig().then(response => {
  2011. if (response.data.state == 1) {
  2012. this.drugways = response.data.data.drugways
  2013. this.executionFrequencyOptions = response.data.data.efs
  2014. this.drugdics = response.data.data.drugs
  2015. const len = response.data.data.advice_templates.length
  2016. for (let i = 0; i < len; i++) {
  2017. // 对于空医嘱模版的处理
  2018. if (response.data.data.advice_templates[i] != null && response.data.data.advice_templates[i].DoctorAdviceTemplate.length == 0) {
  2019. const object = {}
  2020. object['name'] = response.data.data.advice_templates[i].name
  2021. object['isNoSub'] = 1
  2022. object['template_id'] = response.data.data.advice_templates[i].id
  2023. object['sort'] = response.data.data.advice_templates[i].sort
  2024. this.adviceTemplates.push(object)
  2025. }
  2026. // 非空模版的处理
  2027. for (let y = 0; y < response.data.data.advice_templates[i].DoctorAdviceTemplate.length; y++) {
  2028. if (response.data.data.advice_templates[i].id == response.data.data.advice_templates[i].DoctorAdviceTemplate[y].template_id) {
  2029. const object = {}
  2030. const DoctorAdviceTemplate = response.data.data.advice_templates[i].DoctorAdviceTemplate[y]
  2031. for (const key in DoctorAdviceTemplate) {
  2032. object[key] = DoctorAdviceTemplate[key]
  2033. }
  2034. object['isNoSub'] = 2
  2035. object['name'] = response.data.data.advice_templates[i].name
  2036. object['sort'] = response.data.data.advice_templates[i].sort
  2037. this.adviceTemplates.push(object)
  2038. }
  2039. }
  2040. }
  2041. this.adviceTemplates.sort(this.sortData)
  2042. console.log("列表",this.adviceTemplates)
  2043. // 处理单元格合并的数据
  2044. this.handleSpanTempArr()
  2045. }
  2046. })
  2047. }, isShow(index, row) {
  2048. if (index > 0 && row.name == this.adviceTemplates[index - 1].name) {
  2049. return false
  2050. }
  2051. return true
  2052. }, cancelEditHandle() {
  2053. // this.templateTableVisible = true
  2054. this.templateEditFormVisible = false
  2055. },
  2056. //编辑医嘱
  2057. submitEditTemplate(formName) {
  2058. // var drug_id = 0
  2059. // for(let i=0;i<this.all_drug.length;i++){
  2060. // if(this.templateFormEdit.advice_name == this.all_drug[i].drug_name){
  2061. // drug_id = this.all_drug[i].id
  2062. // }
  2063. // }
  2064. // this.templateFormEdit.drug_id = drug_id
  2065. console.log("编辑子药",this.templateFormEdit)
  2066. this.$refs[formName].validate(valid => {
  2067. this.templateFormEdit.single_dose = parseFloat(this.templateFormEdit.single_dose)
  2068. this.templateFormEdit.prescribing_number = parseFloat(this.templateFormEdit.prescribing_number)
  2069. if (isNaN(this.templateFormEdit.single_dose)) {
  2070. this.templateFormEdit.single_dose = 0
  2071. }
  2072. if (isNaN(this.templateFormEdit.prescribing_number)) {
  2073. this.templateFormEdit.prescribing_number = 0
  2074. }
  2075. if (valid) {
  2076. console.log(this.templateFormEdit)
  2077. if (this.templateFormEdit.frequency_type == 1) {
  2078. this.templateFormEdit.day_count = 0
  2079. this.templateFormEdit.week_days = ''
  2080. } else if (this.templateFormEdit.frequency_type == 2) {
  2081. this.templateFormEdit.day_count = parseInt(this.templateFormEdit.day_count)
  2082. this.templateFormEdit.week_days = ''
  2083. } else if (this.templateFormEdit.frequency_type == 3) {
  2084. this.templateFormEdit.day_count = 0
  2085. this.templateFormEdit.week_days = this.templateFormEdit.weekday.filter(function(s) {
  2086. return s && s.trim()
  2087. }).join(',')
  2088. }
  2089. UpdateAdviceTemplate(this.templateFormEdit.id, this.templateFormEdit,this.templateFormEdit.drug_id).then(
  2090. response => {
  2091. if (response.data.state == 0) {
  2092. this.$message.error(response.data.msg)
  2093. return false
  2094. } else {
  2095. this.$message.success('修改成功')
  2096. this.templateEditFormVisible = false
  2097. this.resetForm(formName)
  2098. var template = response.data.data.template
  2099. this.adviceTemplates[this.currentIndex].advice_name = template.advice_name
  2100. this.adviceTemplates[this.currentIndex].advice_desc = template.advice_desc
  2101. this.adviceTemplates[this.currentIndex].drug_spec = template.drug_spec
  2102. this.adviceTemplates[this.currentIndex].drug_spec_unit = template.drug_spec_unit
  2103. this.adviceTemplates[this.currentIndex].single_dose = template.single_dose
  2104. this.adviceTemplates[this.currentIndex].single_dose_unit = template.single_dose_unit
  2105. this.adviceTemplates[this.currentIndex].delivery_way = template.delivery_way
  2106. this.adviceTemplates[this.currentIndex].execution_frequency = template.execution_frequency
  2107. this.adviceTemplates[this.currentIndex].prescribing_number = template.prescribing_number
  2108. this.adviceTemplates[this.currentIndex].prescribing_number_unit = template.prescribing_number_unit
  2109. this.adviceTemplates[this.currentIndex].day_count = template.day_count
  2110. this.adviceTemplates[this.currentIndex].week_days = template.week_days
  2111. this.adviceTemplates[this.currentIndex].frequency_type = template.frequency_type
  2112. // this.adviceTemplates[this.currentIndex].drug_id = template.drug_id
  2113. this.currentIndex = -1
  2114. return false
  2115. }
  2116. }
  2117. )
  2118. }
  2119. })
  2120. },
  2121. drugDesc(row) {
  2122. if (row.isNoSub == 2) {
  2123. if (row.drug_spec.length <= 0) {
  2124. return ''
  2125. } else {
  2126. if (row.prescribing_number == 0) {
  2127. return row.drug_spec + '' + row.drug_spec_unit
  2128. } else {
  2129. return row.drug_spec + '' + row.drug_spec_unit + ' * ' + row.prescribing_number + row.prescribing_number_unit
  2130. }
  2131. }
  2132. }
  2133. }, drugDescTwo(row) {
  2134. if (row.drug_spec.length <= 0) {
  2135. return ''
  2136. } else {
  2137. if (row.prescribing_number == 0) {
  2138. return row.drug_spec + '' + row.drug_spec_unit
  2139. } else {
  2140. return row.drug_spec + '' + row.drug_spec_unit + ' * ' + row.prescribing_number + row.prescribing_number_unit
  2141. }
  2142. }
  2143. },
  2144. newRecordActionTwo() {
  2145. this.templateFormTwoVisible = true
  2146. }, deleteRecordActionTwo() {
  2147. if (this.table_current_index_two == -1) {
  2148. this.$message.error('请选择一条医嘱记录')
  2149. return
  2150. }
  2151. this.$confirm('删除记录', '是否删除该医嘱记录', {
  2152. confirmButtonText: '确 定',
  2153. cancelButtonText: '取 消',
  2154. type: 'warning'
  2155. }).then(() => {
  2156. const id = this.adviceTableDataTwo[this.table_current_index_two].id
  2157. const template_id = this.adviceTableDataTwo[this.table_current_index_two].template_id
  2158. DeleteAdviceTemplate(id, template_id).then(response => {
  2159. if (response.data.state == 0) {
  2160. this.$message.error(response.data.msg)
  2161. return false
  2162. } else {
  2163. this.$message.success('删除成功')
  2164. for (let i = 0; i < this.adviceTemplates.length; i++) {
  2165. console.log(this.adviceTemplates[i].id)
  2166. if (this.adviceTemplates[i].id == this.adviceTableDataTwo[this.table_current_index_two].id) {
  2167. this.adviceTemplates.splice(i, 1)
  2168. }
  2169. }
  2170. this.adviceTableDataTwo.splice(this.table_current_index_two, 1)
  2171. this.table_current_index_two = -1
  2172. }
  2173. })
  2174. }).catch(() => {
  2175. })
  2176. }, modifyRecordActionTwo() {
  2177. if (this.table_current_index_two == -1) {
  2178. this.$message.error('请选择一条医嘱记录')
  2179. return
  2180. }
  2181. this.templateFormEdit = {
  2182. drug_spec: this.adviceTableDataTwo[this.table_current_index_two].drug_spec,
  2183. drug_spec_unit: this.adviceTableDataTwo[this.table_current_index_two].drug_spec_unit,
  2184. advice_name: this.adviceTableDataTwo[this.table_current_index_two].advice_name,
  2185. advice_desc: this.adviceTableDataTwo[this.table_current_index_two].advice_desc,
  2186. single_dose: this.adviceTableDataTwo[this.table_current_index_two].single_dose,
  2187. single_dose_unit: this.adviceTableDataTwo[this.table_current_index_two].single_dose_unit,
  2188. prescribing_number: this.adviceTableDataTwo[this.table_current_index_two].prescribing_number,
  2189. prescribing_number_unit: this.adviceTableDataTwo[this.table_current_index_two].prescribing_number_unit,
  2190. delivery_way: this.adviceTableDataTwo[this.table_current_index_two].delivery_way,
  2191. execution_frequency: this.adviceTableDataTwo[this.table_current_index_two].execution_frequency,
  2192. id: this.adviceTableDataTwo[this.table_current_index_two].id
  2193. }
  2194. this.templateEditFormTwoVisible = true
  2195. }, tableRowClassNameTwo({ row, rowIndex }) {
  2196. // 把每一行的索引放进row
  2197. row.index = rowIndex
  2198. },
  2199. onRowClickTwo(row, event, column) {
  2200. this.table_current_index_two = row.index
  2201. }, cancelHandleTwo() {
  2202. this.templateFormTwoVisible = false
  2203. },
  2204. submitTemplateTwo(formName) {
  2205. this.templateForm['template_id'] = this.current_template_id
  2206. this.templateForm['advice_type'] = this.form.advice_type
  2207. if (this.templateForm.frequency_type == 1) {
  2208. this.templateForm.day_count = 0
  2209. this.templateForm.week_days = ''
  2210. } else if (this.templateForm.frequency_type == 2) {
  2211. this.templateForm.day_count = parseInt(this.templateForm.day_count)
  2212. this.templateForm.week_days = ''
  2213. } else if (this.templateForm.frequency_type == 3) {
  2214. this.templateForm.day_count = 0
  2215. this.templateForm.week_days = this.templateForm.weekday.filter(function(s) {
  2216. return s && s.trim()
  2217. }).join(',')
  2218. this.templateForm.way = 1
  2219. }
  2220. this.templateForm.way = 1
  2221. console.log("编辑模板",this.templateForm)
  2222. // 编辑创建医嘱模版
  2223. CreateSingleAdviceTemplate(this.templateForm).then(response => {
  2224. if (response.data.state == 0) {
  2225. this.$message.error(response.data.msg)
  2226. return false
  2227. } else {
  2228. const source = response.data.data.template
  2229. const objects = {}
  2230. for (const keys in source) {
  2231. objects[keys] = source[keys]
  2232. }
  2233. objects['name'] = this.current_template_name
  2234. objects['isNoSub'] = 2
  2235. this.adviceTableDataTwo.unshift(response.data.data.template)
  2236. this.getAdviceConfig()
  2237. this.resetForm(formName)
  2238. this.templateFormTwoVisible = false
  2239. this.$message.success('添加成功')
  2240. this.templateForm.day_count = ''
  2241. this.templateForm.weekday = []
  2242. this.templateForm.frequency_type = 1
  2243. return false
  2244. }
  2245. })
  2246. }, cancelTableHandleTwo() {
  2247. this.templateTableTwoVisible = false
  2248. this.adviceTableDataTwo = []
  2249. }, cancelEditHandleTwo() {
  2250. this.templateEditFormTwoVisible = false
  2251. },
  2252. submitEditTemplateTwo(formName) {
  2253. this.$refs[formName].validate(valid => {
  2254. this.templateFormEdit.single_dose = parseFloat(this.templateFormEdit.single_dose)
  2255. this.templateFormEdit.prescribing_number = parseFloat(this.templateFormEdit.prescribing_number)
  2256. if (isNaN(this.templateFormEdit.single_dose)) {
  2257. this.templateFormEdit.single_dose = 0
  2258. }
  2259. if (isNaN(this.templateFormEdit.prescribing_number)) {
  2260. this.templateFormEdit.prescribing_number = 0
  2261. }
  2262. if (valid) {
  2263. UpdateAdviceTemplate(this.templateFormEdit.id, this.templateFormEdit).then(
  2264. response => {
  2265. if (response.data.state == 0) {
  2266. this.$message.error(response.data.msg)
  2267. return false
  2268. } else {
  2269. this.$message.success('修改成功')
  2270. this.templateEditFormTwoVisible = false
  2271. this.resetForm(formName)
  2272. var template = response.data.data.template
  2273. this.adviceTableDataTwo[this.table_current_index_two].advice_name = template.advice_name
  2274. this.adviceTableDataTwo[this.table_current_index_two].advice_desc = template.advice_desc
  2275. this.adviceTableDataTwo[this.table_current_index_two].drug_spec = template.drug_spec
  2276. this.adviceTableDataTwo[this.table_current_index_two].drug_spec_unit = template.drug_spec_unit
  2277. this.adviceTableDataTwo[this.table_current_index_two].single_dose = template.single_dose
  2278. this.adviceTableDataTwo[this.table_current_index_two].single_dose_unit = template.single_dose_unit
  2279. this.adviceTableDataTwo[this.table_current_index_two].delivery_way = template.delivery_way
  2280. this.adviceTableDataTwo[this.table_current_index_two].execution_frequency = template.execution_frequency
  2281. this.adviceTableDataTwo[this.table_current_index_two].prescribing_number = template.prescribing_number
  2282. this.adviceTableDataTwo[this.table_current_index_two].prescribing_number_unit = template.prescribing_number_unit
  2283. for (let i = 0; i < this.adviceTemplates.length; i++) {
  2284. if (this.adviceTemplates[i].id == this.adviceTableDataTwo[this.table_current_index_two].id) {
  2285. this.adviceTemplates[i].advice_name = template.advice_name
  2286. this.adviceTemplates[i].advice_desc = template.advice_desc
  2287. this.adviceTemplates[i].drug_spec = template.drug_spec
  2288. this.adviceTemplates[i].drug_spec_unit = template.drug_spec_unit
  2289. this.adviceTemplates[i].single_dose = template.single_dose
  2290. this.adviceTemplates[i].single_dose_unit = template.single_dose_unit
  2291. this.adviceTemplates[i].delivery_way = template.delivery_way
  2292. this.adviceTemplates[i].execution_frequency = template.execution_frequency
  2293. this.adviceTemplates[i].prescribing_number = template.prescribing_number
  2294. this.adviceTemplates[i].prescribing_number_unit = template.prescribing_number_unit
  2295. }
  2296. }
  2297. return false
  2298. }
  2299. }
  2300. )
  2301. }
  2302. })
  2303. }, merge({ row, column, rowIndex, columnIndex }) {
  2304. if (columnIndex === 0 || columnIndex === 1 || columnIndex === 9) {
  2305. const _row = this.tempArr[rowIndex]
  2306. const _col = _row > 0 ? 1 : 0
  2307. return {
  2308. rowspan: _row,
  2309. colspan: _col
  2310. }
  2311. }
  2312. }, tableRowClassNames({ row, rowIndex }) {
  2313. const arr = this.hoverOrderArr
  2314. for (let i = 0; i < arr.length; i++) {
  2315. if (rowIndex == arr[i]) {
  2316. return 'success-row'
  2317. }
  2318. }
  2319. },
  2320. cellMouseEnter: function(row, column, cell, event) {
  2321. if (column.label == '模版名称') {
  2322. this.sameRowArr.forEach((arr, i) => {
  2323. if (arr.indexOf(row.index) != -1) {
  2324. this.hoverOrderArr = arr
  2325. }
  2326. })
  2327. } else if (column.label == '操作') {
  2328. this.sameRowArr.forEach((arr, i) => {
  2329. if (arr.indexOf(row.index) != -1) {
  2330. this.hoverOrderArr = arr
  2331. }
  2332. })
  2333. } else {
  2334. this.hoverOrderArr = []
  2335. }
  2336. }, cellMouseLeave: function(row, column, cell, event) {
  2337. this.hoverOrderArr = []
  2338. },
  2339. // 修改医嘱模版
  2340. openEdit(index, row) {
  2341. console.log("row22222",row)
  2342. this.hoverOrderArr = []
  2343. this.currentIndex = index
  2344. this.templateFormEdit.drug_spec_unit = row.drug_spec_unit
  2345. this.templateFormEdit.drug_spec = row.drug_spec
  2346. this.templateFormEdit.advice_desc = row.advice_desc
  2347. this.templateFormEdit.advice_name = row.advice_name
  2348. this.templateFormEdit.delivery_way = row.delivery_way
  2349. this.templateFormEdit.execution_frequency = row.execution_frequency
  2350. this.templateFormEdit.prescribing_number = row.prescribing_number
  2351. this.templateFormEdit.prescribing_number_unit = row.prescribing_number_unit
  2352. this.templateFormEdit.single_dose = row.single_dose
  2353. this.templateFormEdit.single_dose_unit = row.single_dose_unit
  2354. this.templateFormEdit.id = row.id
  2355. this.templateFormEdit.parent_id = row.parent_id
  2356. this.templateFormEdit.day_count = row.day_count
  2357. this.templateFormEdit.frequency_type = row.frequency_type
  2358. this.templateFormEdit.weekday = row.week_days.split(',')
  2359. this.templateFormEdit.drug_id = row.drug_id
  2360. this.templateFormEdit.way = row.way
  2361. this.templateEditFormVisible = true
  2362. if (row.parent_id > 0) {
  2363. this.editDialogTitle = '编辑子药'
  2364. this.edit_advice_name = '子药名称'
  2365. } else {
  2366. this.editDialogTitle = '编辑医嘱'
  2367. this.edit_advice_name = '医嘱内容'
  2368. }
  2369. },
  2370. openDelete(index, row) {
  2371. this.hoverOrderArr = []
  2372. this.$confirm('删除记录', '是否删除该医嘱', {
  2373. confirmButtonText: '确 定',
  2374. cancelButtonText: '取 消',
  2375. type: 'warning'
  2376. }).then(() => {
  2377. const id = row.id
  2378. const template_id = row.template_id
  2379. const parent_id = row.parent_id
  2380. DeleteAdviceTemplate(id, template_id, parent_id).then(response => {
  2381. if (response.data.state == 0) {
  2382. this.$message.error(response.data.msg)
  2383. return false
  2384. } else {
  2385. this.$message.success('删除成功')
  2386. if (row.parent_id > 0) { // 删除子医嘱
  2387. this.adviceTemplates.splice(index, 1)
  2388. } else { // 如果医嘱下面包含子医嘱,删除医嘱和子医嘱
  2389. // 删除子医嘱
  2390. for (let i = 0; i < this.adviceTemplates.length; i++) {
  2391. if (this.adviceTemplates[i].parent_id == row.id) {
  2392. this.adviceTemplates.splice(i--, 1)
  2393. }
  2394. }
  2395. // 删除医嘱
  2396. this.adviceTemplates.splice(index, 1)
  2397. // 当该模版下没有医嘱的时候,创建一个空模版
  2398. let count = 0 // 用于计数
  2399. for (let i = 0; i < this.adviceTemplates.length; i++) {
  2400. if (this.adviceTemplates[i].template_id == row.template_id) {
  2401. count = count + 1
  2402. }
  2403. }
  2404. if (count == 0) {
  2405. const object = {}
  2406. object['name'] = row.name
  2407. object['isNoSub'] = 1
  2408. object['template_id'] = row.template_id
  2409. this.adviceTemplates.splice(index, 0, object)
  2410. }
  2411. }
  2412. // 处理单元格合并的数据
  2413. this.handleSpanTempArr()
  2414. }
  2415. })
  2416. }).catch(() => {
  2417. })
  2418. }, openDeleteChild(index, row) {
  2419. this.hoverOrderArr = []
  2420. this.$confirm('删除子药', '是否删除该子药', {
  2421. confirmButtonText: '确 定',
  2422. cancelButtonText: '取 消',
  2423. type: 'warning'
  2424. }).then(() => {
  2425. const id = row.id
  2426. const template_id = row.template_id
  2427. const parent_id = row.parent_id
  2428. DeleteAdviceTemplate(id, template_id, parent_id).then(response => {
  2429. if (response.data.state == 0) {
  2430. this.$message.error(response.data.msg)
  2431. return false
  2432. } else {
  2433. this.$message.success('删除成功')
  2434. if (row.parent_id > 0) { // 删除子医嘱
  2435. this.adviceTemplates.splice(index, 1)
  2436. } else { // 如果医嘱下面包含子医嘱,删除医嘱和子医嘱
  2437. // 删除子医嘱
  2438. for (let i = 0; i < this.adviceTemplates.length; i++) {
  2439. if (this.adviceTemplates[i].parent_id == row.id) {
  2440. this.adviceTemplates.splice(i--, 1)
  2441. }
  2442. }
  2443. // 删除医嘱
  2444. this.adviceTemplates.splice(index, 1)
  2445. // 当该模版下没有医嘱的时候,创建一个空模版
  2446. let count = 0 // 用于计数
  2447. for (let i = 0; i < this.adviceTemplates.length; i++) {
  2448. if (this.adviceTemplates[i].template_id == row.template_id) {
  2449. count = count + 1
  2450. }
  2451. }
  2452. if (count == 0) {
  2453. const object = {}
  2454. object['name'] = row.name
  2455. object['isNoSub'] = 1
  2456. object['template_id'] = row.template_id
  2457. this.adviceTemplates.splice(index, 0, object)
  2458. }
  2459. }
  2460. // 处理单元格合并的数据
  2461. this.handleSpanTempArr()
  2462. }
  2463. })
  2464. }).catch(() => {
  2465. })
  2466. },
  2467. openNewChild(index, row) {
  2468. this.hoverOrderArr = []
  2469. this.current_template_id = row.template_id
  2470. this.parent_id = row.id
  2471. this.isAddChild = true
  2472. this.isEdit = false
  2473. this.templateFormVisible = true
  2474. this.dialogTitle = '新增子药'
  2475. this.advice_content_name = '子药名称'
  2476. },
  2477. handleSpanTempArr() {
  2478. this.tempArr = []
  2479. for (let i = 0; i < this.adviceTemplates.length; i++) {
  2480. if (i === 0) {
  2481. this.tempArr.push(1)
  2482. this.pos = 0
  2483. } else {
  2484. // 判断当前元素与上一个元素是否相同
  2485. if (this.adviceTemplates[i].template_id === this.adviceTemplates[i - 1].template_id) {
  2486. this.tempArr[this.pos] += 1
  2487. this.tempArr.push(0)
  2488. } else {
  2489. this.tempArr.push(1)
  2490. this.pos = i
  2491. }
  2492. }
  2493. }
  2494. let sameRowArr = [], sIdx = 0
  2495. this.adviceTemplates.forEach((item, index) => {
  2496. item.index = index
  2497. if (index === 0) {
  2498. sameRowArr.push([index])
  2499. } else {
  2500. if (item.template_id === this.adviceTemplates[index - 1].template_id) {
  2501. sameRowArr[sIdx].push(index)
  2502. } else {
  2503. sIdx = sIdx + 1
  2504. sameRowArr.push([index])
  2505. }
  2506. }
  2507. })
  2508. this.sameRowArr = sameRowArr
  2509. },
  2510. handleUpdateAdviceTemplate(row, index) {
  2511. this.current_template_id = row.template_id
  2512. this.current_template_name = row.name
  2513. this.form.name = row.name
  2514. this.form.advice_type = row.advice_type
  2515. if(row.sort == 0){
  2516. row.sort = ""
  2517. }else{
  2518. this.form.sort = row.sort
  2519. }
  2520. this.templateTableTwoVisible = true
  2521. this.adviceTableDataTwo = []
  2522. for (let i = 0; i < this.adviceTemplates.length; i++) {
  2523. if (this.adviceTemplates[i].template_id == row.template_id) {
  2524. this.adviceTableDataTwo.push(this.adviceTemplates[i])
  2525. }
  2526. }
  2527. this.getAdviceConfig()
  2528. },
  2529. modifyTemplateName() {
  2530. const params = {
  2531. template_name: this.form.name,
  2532. template_id: this.current_template_id,
  2533. sort:this.form.sort,
  2534. }
  2535. updateTemplateName(params).then(response => {
  2536. if (response.data.state == 0) {
  2537. this.$message.error(response.data.msg)
  2538. return false
  2539. } else {
  2540. this.$message.success('修改成功')
  2541. this.templateTableTwoVisible = false
  2542. for (let i = 0; i < this.adviceTemplates.length; i++) {
  2543. if (this.adviceTemplates[i].template_id == this.current_template_id) {
  2544. this.adviceTemplates[i].name = response.data.data.template_name
  2545. }
  2546. }
  2547. }
  2548. })
  2549. }, changeRemind(val) {
  2550. let params = {
  2551. 'is_open_remind': val,
  2552. }
  2553. postDoctorAdviceConfig(params).then(response => {
  2554. if (response.data.state == 1) {
  2555. this.is_open_remind = response.data.data.is_open_remind
  2556. if (response.data.data.is_open_remind == 1) {
  2557. this.$message.success('开启成功')
  2558. } else {
  2559. this.$message.success('关闭成功')
  2560. }
  2561. } else {
  2562. this.$message.error(response.data.msg)
  2563. }
  2564. })
  2565. },
  2566. rand(min, max) {
  2567. return Math.floor(Math.random() * (max - min)) + min;
  2568. },
  2569. //
  2570. getSelfMedicalList(){
  2571. const params = {
  2572. patient_id:this.$route.query.patient_id
  2573. }
  2574. getSelfMedicalList(params).then(response=>{
  2575. if (response.data.state == 1) {
  2576. this.arr_drug = []
  2577. var medicalList = response.data.data.private_drug_list
  2578. var base_drug_list = response.data.data.base_drug_list
  2579. var base_drug_cofig = response.data.data.base_drug_config
  2580. var private_drug_cofig = response.data.data.private_drug_config
  2581. if(private_drug_cofig != null&&private_drug_cofig.drug_start == 1) {
  2582. for (let i = 0; i < medicalList.length; i++) {
  2583. if(medicalList[i].drug_specs != null) {
  2584. for (let a = 0; a < medicalList[i].drug_specs.length; a++) {
  2585. medicalList[i].drug_specs[a]['type'] = 2
  2586. }
  2587. }
  2588. let obj = {
  2589. drug_name: "",
  2590. drug_desc: "",
  2591. delivery_way: "",
  2592. execution_frequency: "",
  2593. single_dose: "",
  2594. single_dose_unit: "",
  2595. prescribing_number: "",
  2596. prescribing_number_unit: "",
  2597. type_id: "",
  2598. type: "",
  2599. custom_id: "",
  2600. drug_specs: [],
  2601. id:"",
  2602. }
  2603. medicalList[i].drug_name = medicalList[i].drug_name + "(自备药)"
  2604. obj.drug_name = medicalList[i].drug_name
  2605. obj.delivery_way = medicalList[i].delivery_way
  2606. obj.execution_frequency = medicalList[i].execution_frequency
  2607. obj.single_dose = medicalList[i].single_dose
  2608. obj.prescribing_number = medicalList[i].prescribing_number
  2609. obj.type_id = medicalList[i].id
  2610. obj.type = 2
  2611. obj.custom_id = this.rand(10000000, 99999999)
  2612. obj.drug_specs = medicalList[i].drug_specs
  2613. obj.id = medicalList[i].id
  2614. this.all_drug.push(obj)
  2615. }
  2616. }
  2617. for (let i = 0; i < base_drug_list.length; i++) {
  2618. if(base_drug_list[i].drug_specs != null) {
  2619. for (let a = 0; a < base_drug_list[i].drug_specs.length; a++) {
  2620. base_drug_list[i].drug_specs[a]['type'] = 1
  2621. }
  2622. }
  2623. let obj = {
  2624. drug_name: "",
  2625. drug_desc: "",
  2626. delivery_way: "",
  2627. execution_frequency: "",
  2628. single_dose: "",
  2629. single_dose_unit: "",
  2630. prescribing_number: "",
  2631. prescribing_number_unit: "",
  2632. type_id: "",
  2633. type: "",
  2634. custom_id: "",
  2635. drug_specs: [],
  2636. id:""
  2637. }
  2638. obj.drug_name = base_drug_list[i].drug_name
  2639. obj.delivery_way = base_drug_list[i].delivery_way
  2640. obj.execution_frequency = base_drug_list[i].execution_frequency
  2641. obj.single_dose = base_drug_list[i].single_dose
  2642. obj.prescribing_number = base_drug_list[i].prescribing_number
  2643. obj.type_id = base_drug_list[i].id
  2644. obj.type = 1
  2645. obj.custom_id = this.rand(10000000, 99999999)
  2646. obj.drug_specs = base_drug_list[i].drug_specs
  2647. obj.id = base_drug_list[i].id
  2648. this.all_drug.push(obj)
  2649. }
  2650. }
  2651. })
  2652. },
  2653. changeDrugName(name){
  2654. this.current_drug_name = name
  2655. this.templateForm.advice_desc = ''
  2656. this.drugSpec = []
  2657. for (let i = 0; i < this.all_drug.length; i++) {
  2658. if (this.all_drug[i].drug_name == name) {
  2659. this.drugSpec = this.all_drug[i].drug_specs
  2660. }
  2661. }
  2662. },
  2663. changeDrugDesc(name) {
  2664. this.current_drug_spec = name
  2665. for (let i = 0; i < this.drugSpec.length; i++) {
  2666. if (this.drugSpec[i].drug_spec == name) {
  2667. this.templateForm.advice_desc = this.drugSpec[i].drug_spec
  2668. this.templateForm.prescribing_number = this.drugSpec[i].prescribing_number.toString()
  2669. this.templateForm.single_dose = this.drugSpec[i].single_dose.toString()
  2670. this.templateForm.delivery_way = this.drugSpec[i].delivery_way.toString()
  2671. this.templateForm.execution_frequency = this.drugSpec[i].execution_frequency.toString()
  2672. this.drug_id = this.drugSpec[i].id
  2673. this.src_type = this.drugSpec[i].type
  2674. this.templateForm.drug_id = this.drugSpec[i].id
  2675. this.templateForm.single_dose_unit = this.drugSpec[i].min_unit
  2676. this.templateForm.prescribing_number_unit = this.drugSpec[i].min_unit
  2677. this.templateForm.drug_spec_unit = this.drugSpec[i].min_unit
  2678. this.templateForm.way = this.drugSpec[i].type
  2679. }
  2680. }
  2681. },
  2682. changeDrugNameTwo(name){
  2683. this.current_drug_name = name
  2684. this.templateFormEdit.advice_desc = ''
  2685. this.drugSpec = []
  2686. for (let i = 0; i < this.all_drug.length; i++) {
  2687. if (this.all_drug[i].drug_name == name) {
  2688. this.drugSpec = this.all_drug[i].drug_specs
  2689. }
  2690. }
  2691. },
  2692. hangdleSelectTwo(val){
  2693. console.log("我的223232",val)
  2694. this.templateFormEdit.drug_id = val.id
  2695. },
  2696. changeDrugDescTwo(name) {
  2697. this.current_drug_spec = name
  2698. for (let i = 0; i < this.drugSpec.length; i++) {
  2699. if (this.drugSpec[i].drug_spec == name) {
  2700. this.templateFormEdit.advice_desc = this.drugSpec[i].drug_spec
  2701. this.templateFormEdit.prescribing_number = this.drugSpec[i].prescribing_number.toString()
  2702. this.templateFormEdit.single_dose = this.drugSpec[i].single_dose.toString()
  2703. this.templateFormEdit.delivery_way = this.drugSpec[i].delivery_way.toString()
  2704. this.templateFormEdit.execution_frequency = this.drugSpec[i].execution_frequency.toString()
  2705. this.templateFormEdit.single_dose_unit = this.drugSpec[i].min_unit
  2706. this.templateFormEdit.drug_spec_unit = this.drugSpec[i].drug_spec_unit
  2707. this.templateFormEdit.prescribing_number_unit = this.drugSpec[i].prescribing_number_unit
  2708. }
  2709. }
  2710. },
  2711. querySearch(queryString, cb) {
  2712. console.log('queryString',queryString)
  2713. var restaurants = this.all_drug;
  2714. restaurants.map(item => {
  2715. item.value = item.drug_name
  2716. })
  2717. var results = queryString ? restaurants.filter(this.createFilter(queryString)) : restaurants;
  2718. // 调用 callback 返回建议列表的数据
  2719. console.log('results',results)
  2720. cb(results);
  2721. },
  2722. createFilter(queryString) {
  2723. return (restaurant) => {
  2724. return (restaurant.drug_name.toLowerCase().indexOf(queryString.toLowerCase()) === 0);
  2725. };
  2726. },
  2727. querySearch1(queryString, cb) {
  2728. console.log('queryString',queryString)
  2729. var restaurants = this.drugSpec;
  2730. console.log(restaurants)
  2731. restaurants.map(item => {
  2732. item.value = item.drug_spec
  2733. })
  2734. var results = queryString ? restaurants.filter(this.createFilter(queryString)) : restaurants;
  2735. // 调用 callback 返回建议列表的数据
  2736. console.log('results',results)
  2737. cb(results);
  2738. },
  2739. sortData(a, b) {
  2740. return a.sort - b.sort
  2741. },
  2742. hangleSelectChange(val){
  2743. console.log("==val==",val)
  2744. var tmp = val.drug_specs[0]
  2745. console.log("tmp",tmp)
  2746. this.templateForm.advice_desc=this.drugSpec[0].drug_spec
  2747. this.templateForm.drug_spec_unit=this.drugSpec[0].min_unit
  2748. this.templateForm.prescribing_number=this.drugSpec[0].prescribing_number
  2749. this.templateForm.prescribing_number_unit=this.drugSpec[0].prescribing_number_unit
  2750. this.templateForm.single_dose=this.drugSpec[0].single_dose
  2751. this.templateForm.single_dose_unit=this.drugSpec[0].min_unit
  2752. this.templateForm.delivery_way=this.drugSpec[0].delivery_way
  2753. this.templateForm.execution_frequency=this.drugSpec[0].execution_frequency
  2754. this.templateForm.advice_desc=tmp.dose+tmp.dose_unit+"*"+tmp.min_number+tmp.min_unit+"/"//药品规格
  2755. // console.log("templateForm2222222222",this.templateForm)
  2756. // console.log("all_drug",this.all_drug)
  2757. // console.log("drugSpec2222222",this.drugSpec)
  2758. this.templateForm.way = 1
  2759. this.templateForm.drug_id = val.id
  2760. },
  2761. closeform(){//清除表单数据
  2762. this.templateForm.advice_name=""
  2763. this.templateForm.advice_desc=""
  2764. this.templateForm.drug_spec_unit=""
  2765. this.templateForm.prescribing_number=""
  2766. this.templateForm.prescribing_number_unit=""
  2767. this.templateForm.single_dose=""
  2768. this.templateForm.single_dose_unit=""
  2769. this.templateForm.delivery_way=""
  2770. this.templateForm.execution_frequency=""
  2771. }
  2772. }
  2773. }
  2774. </script>
  2775. <style>
  2776. .center th .cell {
  2777. text-align: center !important;
  2778. }
  2779. .templateadvicenamedisplay .cell {
  2780. float: left;
  2781. text-align: left;
  2782. }
  2783. .el-table td,
  2784. .el-table th.is-leaf,
  2785. .el-table--border,
  2786. .el-table--group {
  2787. border-color: #d0d3da;
  2788. }
  2789. .el-table--border::after,
  2790. .el-table--group::after,
  2791. .el-table::before {
  2792. background-color: #d0d3da;
  2793. }
  2794. </style>