druguseTemplate.vue 116KB

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