血透系统PC前端

druguseTemplate.vue 85KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191
  1. <template>
  2. <div class="main-contain">
  3. <div class="position">
  4. <bread-crumb :crumbs='crumbs'></bread-crumb>
  5. </div>
  6. <div class="app-container">
  7. <el-tabs >
  8. <el-tab-pane label="医嘱模板">
  9. <div >
  10. <div class="filter-container">
  11. <el-button
  12. class="filter-item"
  13. style="margin-left: 10px;"
  14. @click="handleCreateTemplate"
  15. type="primary"
  16. size="small"
  17. icon="el-icon-circle-plus-outline"
  18. >{{$t('table.add')}}
  19. </el-button>
  20. </div>
  21. <el-table
  22. :data="adviceTemplates"
  23. border
  24. fit
  25. :header-cell-style="{ backgroundColor: 'rgb(245, 247, 250)'}"
  26. @cell-mouse-leave="cellMouseLeave"
  27. @cell-mouse-enter="cellMouseEnter"
  28. :row-class-name="tableRowClassNames"
  29. :span-method="merge"
  30. style="width: 100%;min-height:500px;"
  31. :cell-class-name="adviceNameShow"
  32. >
  33. <el-table-column
  34. prop="id"
  35. label="模版名称"
  36. align="center"
  37. width="100">
  38. <template slot-scope="scope">
  39. <span v-if="isShow(scope.$index, scope.row)">{{scope.row.name}}</span>
  40. <span v-else></span>
  41. </template>
  42. </el-table-column>
  43. <el-table-column
  44. prop="amount1"
  45. align="center"
  46. label="医嘱内容">
  47. <template slot-scope="scope">
  48. <el-dropdown trigger="click" v-if="scope.row.parent_id == 0">
  49. <span class="el-dropdown-link" v-if="scope.row.parent_id == 0">
  50. {{scope.row.advice_name}}<i class="el-icon-arrow-down el-icon--right"></i>
  51. </span>
  52. <el-dropdown-menu slot="dropdown">
  53. <el-dropdown-item @click.native="openEdit(scope.$index, scope.row)">修改医嘱</el-dropdown-item>
  54. <el-dropdown-item @click.native="openDelete(scope.$index, scope.row)">删除医嘱</el-dropdown-item>
  55. <el-dropdown-item @click.native="openNewChild(scope.$index, scope.row)">新增子药</el-dropdown-item>
  56. </el-dropdown-menu>
  57. </el-dropdown>
  58. <el-dropdown trigger="click" v-if="scope.row.parent_id > 0">
  59. <span class="el-dropdown-link">
  60. &emsp;&emsp;{{ scope.row.advice_name }}<i class="el-icon-arrow-down el-icon--right"></i>
  61. </span>
  62. <el-dropdown-menu slot="dropdown">
  63. <el-dropdown-item
  64. @click.native="openEdit(scope.$index, scope.row)">修改子药
  65. </el-dropdown-item>
  66. <el-dropdown-item
  67. @click.native="openDeleteChild(scope.$index, scope.row)">删除子药
  68. </el-dropdown-item>
  69. </el-dropdown-menu>
  70. </el-dropdown>
  71. </template>
  72. </el-table-column>
  73. <el-table-column
  74. prop="amount1"
  75. align="center"
  76. label="规格">
  77. <template slot-scope="scope">
  78. <!-- {{drugDesc(scope.row)}} -->
  79. {{scope.row.advice_desc}}
  80. </template>
  81. </el-table-column>
  82. <el-table-column
  83. prop="amount2"
  84. width="90"
  85. align="center"
  86. label="开药数量">
  87. <template slot-scope="scope" v-if="scope.row.prescribing_number != ''">
  88. <span>{{scope.row.prescribing_number}}{{scope.row.prescribing_number_unit}}</span>
  89. </template>
  90. </el-table-column>
  91. <el-table-column
  92. prop="amount2"
  93. width="90"
  94. align="center"
  95. label="单次用量">
  96. <template slot-scope="scope" v-if="scope.row.single_dose != ''">
  97. <span>{{scope.row.single_dose}}{{scope.row.single_dose_unit}}</span>
  98. </template>
  99. </el-table-column>
  100. <el-table-column
  101. prop="amount3"
  102. align="center"
  103. label="使用频率">
  104. <template slot-scope="scope" v-if="scope.row.parent_id == 0">
  105. <span>{{scope.row.execution_frequency}}</span>
  106. </template>
  107. </el-table-column>
  108. <el-table-column
  109. prop="amount3"
  110. align="center"
  111. label="给药途径">
  112. <template slot-scope="scope" v-if="scope.row.parent_id == 0">
  113. <span>{{scope.row.delivery_way}}</span>
  114. </template>
  115. </el-table-column>
  116. <el-table-column
  117. align="center"
  118. label="操作"
  119. width="180"
  120. class-name="small-padding fixed-width"
  121. >
  122. <template slot-scope="scope">
  123. <el-tooltip class="item" effect="dark" content="编辑" placement="top">
  124. <el-button
  125. type="primary"
  126. size="small"
  127. icon="el-icon-edit-outline"
  128. v-if="isShow(scope.$index, scope.row)"
  129. @click="handleUpdateAdviceTemplate(scope.row, scope.$index)"
  130. >
  131. </el-button>
  132. </el-tooltip>
  133. <el-tooltip class="item" effect="dark" content="删除" placement="top">
  134. <el-button
  135. size="small"
  136. type="danger"
  137. icon="el-icon-delete"
  138. @click="handleDeleteAdviceTemplate(scope.row, scope.$index)"
  139. >
  140. </el-button>
  141. </el-tooltip>
  142. </template>
  143. </el-table-column>
  144. </el-table>
  145. <!--增删改查都是本地处理的dialog-->
  146. <el-dialog title="新增医嘱模版" :visible.sync="templateTableVisible" width="700px" :close-on-click-modal="false">
  147. <div>
  148. <el-form ref="form" :model="form" :rule="formRules" label-width="100px">
  149. <el-form-item label="模版名称" style="width: 300px" prop="name">
  150. <el-input v-model="form.name"></el-input>
  151. </el-form-item>
  152. </el-form>
  153. <div class="txsj" style="text-align: center;margin-bottom: 30px">
  154. <el-button round @click="newRecordAction">新增医嘱内容</el-button>
  155. <el-button round @click="deleteRecordAction">删除医嘱内容</el-button>
  156. <el-button round @click="modifyRecordAction">修改医嘱内容</el-button>
  157. </div>
  158. <el-table
  159. ref="table" :data="adviceTableData"
  160. border
  161. highlight-current-row
  162. max-height="300"
  163. :header-cell-style="{ backgroundColor: 'rgb(245, 247, 250)'}"
  164. :row-class-name="tableRow"
  165. @row-click="onRowClick"
  166. style="width: 100%">
  167. <el-table-column label="医嘱内容" align="center" width="144">
  168. <template slot-scope="scope">
  169. {{scope.row.advice_name}}
  170. </template>
  171. </el-table-column>
  172. <el-table-column align="center" label="规格">
  173. <template slot-scope="scope">
  174. <!-- {{drugDescTwo(scope.row)}} -->
  175. {{scope.row.advice_desc}}
  176. </template>
  177. </el-table-column>
  178. <el-table-column prop="prescribing_number" align="center" label="开药数量">
  179. <template slot-scope="scope" v-if="scope.row.prescribing_number != ''">
  180. {{scope.row.prescribing_number}}{{scope.row.prescribing_number_unit}}
  181. </template>
  182. </el-table-column>
  183. <el-table-column prop="single_dose" align="center" label="单次用量">
  184. <template slot-scope="scope" v-if="scope.row.single_dose != ''">
  185. {{scope.row.single_dose}}{{scope.row.single_dose_unit}}
  186. </template>
  187. </el-table-column>
  188. <el-table-column prop="breathing_rate" align="center" label="给药途径">
  189. <template slot-scope="scope">
  190. {{scope.row.delivery_way}}
  191. </template>
  192. </el-table-column>
  193. <el-table-column prop="blood_flow_volume" align="center" label="执行频率">
  194. <template slot-scope="scope">
  195. {{scope.row.execution_frequency}}
  196. </template>
  197. </el-table-column>
  198. </el-table>
  199. </div>
  200. <div slot="footer" class="dialog-footer">
  201. <el-button @click="cancelTableHandle">取消</el-button>
  202. <el-button type="primary" @click="submitTableTemplate('form')">保 存</el-button>
  203. </div>
  204. </el-dialog>
  205. <el-dialog :title="dialogTitle" :visible.sync="templateFormVisible" width="700px">
  206. <el-form
  207. ref="templateForm"
  208. :rules="templateRules"
  209. :model="templateForm"
  210. label-width="90px"
  211. >
  212. <el-row>
  213. <el-col :span="12">
  214. <el-form-item label="医嘱内容 :" required prop="advice_name">
  215. <el-input v-model="templateForm.advice_name"></el-input>
  216. </el-form-item>
  217. </el-col>
  218. <el-col :span="12">
  219. <el-form-item label="规格 :" required prop="advice_desc">
  220. <el-input v-model="templateForm.advice_desc"></el-input>
  221. </el-form-item>
  222. <!-- <el-form-item label="药品规格 :" prop="drug_spec">
  223. <el-col :span="8">
  224. <el-input v-model="templateForm.drug_spec" ></el-input>
  225. </el-col>
  226. <el-col class="line" :span="2">&nbsp;</el-col>
  227. <el-col :span="14">
  228. <el-select
  229. v-model="templateForm.drug_spec_unit"
  230. filterable
  231. clearable
  232. allow-create
  233. placeholder="选择"
  234. >
  235. <el-option
  236. v-for="item in unitsOption"
  237. :key="item.id"
  238. :label="item.name "
  239. :value="item.name"
  240. ></el-option>
  241. </el-select>
  242. </el-col>
  243. </el-form-item> -->
  244. </el-col>
  245. <el-col :span="12">
  246. <el-form-item label="单次用量 :" prop="single_dose">
  247. <el-col :span="9">
  248. <el-input v-model="templateForm.single_dose"></el-input>
  249. </el-col>
  250. <el-col class="line" :span="1">&nbsp;</el-col>
  251. <el-col :span="14">
  252. <el-select
  253. v-model="templateForm.single_dose_unit"
  254. filterable
  255. clearable
  256. allow-create
  257. placeholder="选择"
  258. >
  259. <el-option
  260. v-for="item in unitsOption"
  261. :key="item.id"
  262. :label="item.name "
  263. :value="item.name"
  264. ></el-option>
  265. </el-select>
  266. </el-col>
  267. </el-form-item>
  268. </el-col>
  269. <el-col :span="12">
  270. <el-form-item label="开药数量 :" prop="prescribing_number">
  271. <el-col :span="9">
  272. <el-input v-model="templateForm.prescribing_number"></el-input>
  273. </el-col>
  274. <el-col class="line" :span="1">&nbsp;</el-col>
  275. <el-col :span="14">
  276. <el-select
  277. v-model="templateForm.prescribing_number_unit"
  278. filterable
  279. clearable
  280. allow-create
  281. placeholder="选择"
  282. >
  283. <el-option
  284. v-for="item in unitsOption"
  285. :key="item.id"
  286. :label="item.name "
  287. :value="item.name"
  288. ></el-option>
  289. </el-select>
  290. </el-col>
  291. </el-form-item>
  292. </el-col>
  293. <el-col :span="12" v-if="!isAddChild">
  294. <el-form-item label="给药途径 :" prop="delivery_way">
  295. <el-select
  296. v-model="templateForm.delivery_way"
  297. filterable
  298. clearable
  299. allow-create
  300. placeholder="请选择(输入可搜索)"
  301. style="width:100%"
  302. >
  303. <el-option
  304. v-for="item in drugways"
  305. :key="item.id"
  306. :label="item.name "
  307. :value="item.name"
  308. ></el-option>
  309. </el-select>
  310. </el-form-item>
  311. </el-col>
  312. <el-col :span="12" v-if="!isAddChild">
  313. <el-form-item label="执行频率 :" prop="execution_frequency">
  314. <el-select
  315. v-model="templateForm.execution_frequency"
  316. clearable
  317. allow-create
  318. filterable
  319. placeholder="请选择(输入可搜索)"
  320. style="width:100%"
  321. >
  322. <el-option
  323. v-for="item in executionFrequencyOptions"
  324. :key="item.id"
  325. :label="item.name"
  326. :value="item.name"
  327. ></el-option>
  328. </el-select>
  329. </el-form-item>
  330. </el-col>
  331. </el-row>
  332. </el-form>
  333. <div slot="footer" class="dialog-footer">
  334. <el-button @click="cancelHandle('templateForm')">取消</el-button>
  335. <el-button type="primary" @click="submitTemplate('templateForm')">保 存</el-button>
  336. </div>
  337. </el-dialog>
  338. <el-dialog :title="editDialogTitle" :visible.sync="templateEditFormVisible" width="700px">
  339. <el-form
  340. ref="templateFormEdit"
  341. :rules="templateEditRules"
  342. :model="templateFormEdit"
  343. label-width="90px"
  344. >
  345. <el-row>
  346. <el-col :span="12">
  347. <el-form-item :label="edit_advice_name" required prop="advice_name">
  348. <el-input v-model="templateFormEdit.advice_name"></el-input>
  349. </el-form-item>
  350. </el-col>
  351. <el-col :span="12">
  352. <el-form-item label="规格" prop="advice_desc">
  353. <el-input v-model="templateFormEdit.advice_desc"></el-input>
  354. </el-form-item>
  355. <!-- <el-form-item label="药品规格 :" prop="drug_spec">
  356. <el-col :span="8">
  357. <el-input v-model="templateFormEdit.drug_spec"></el-input>
  358. </el-col>
  359. <el-col class="line" :span="1">&nbsp;</el-col>
  360. <el-col :span="14">
  361. <el-select
  362. v-model="templateFormEdit.drug_spec_unit"
  363. filterable
  364. clearable
  365. allow-create
  366. placeholder="选择"
  367. >
  368. <el-option
  369. v-for="item in unitsOption"
  370. :key="item.id"
  371. :label="item.name "
  372. :value="item.name"
  373. ></el-option>
  374. </el-select>
  375. </el-col>
  376. </el-form-item> -->
  377. </el-col>
  378. <el-col :span="12">
  379. <el-form-item label="单次用量 :" prop="single_dose">
  380. <el-col :span="9">
  381. <el-input v-model="templateFormEdit.single_dose"></el-input>
  382. </el-col>
  383. <el-col class="line" :span="1">&nbsp;</el-col>
  384. <el-col :span="14">
  385. <el-select
  386. v-model="templateFormEdit.single_dose_unit"
  387. filterable
  388. clearable
  389. allow-create
  390. placeholder="选择"
  391. >
  392. <el-option
  393. v-for="item in unitsOption"
  394. :key="item.id"
  395. :label="item.name "
  396. :value="item.name"
  397. ></el-option>
  398. </el-select>
  399. </el-col>
  400. </el-form-item>
  401. </el-col>
  402. <el-col :span="12">
  403. <el-form-item label="开药数量 :" prop="prescribing_number">
  404. <el-col :span="9">
  405. <el-input v-model="templateFormEdit.prescribing_number"></el-input>
  406. </el-col>
  407. <el-col class="line" :span="1">&nbsp;</el-col>
  408. <el-col :span="14">
  409. <el-select
  410. v-model="templateFormEdit.prescribing_number_unit"
  411. filterable
  412. clearable
  413. allow-create
  414. placeholder="选择"
  415. >
  416. <el-option
  417. v-for="item in unitsOption"
  418. :key="item.id"
  419. :label="item.name "
  420. :value="item.name"
  421. ></el-option>
  422. </el-select>
  423. </el-col>
  424. </el-form-item>
  425. </el-col>
  426. <el-col :span="12" v-if="templateFormEdit.parent_id == 0">
  427. <el-form-item label="给药途径 :" prop="delivery_way">
  428. <el-select
  429. v-model="templateFormEdit.delivery_way"
  430. filterable
  431. clearable
  432. allow-create
  433. placeholder="请选择(输入可搜索)"
  434. style="width:90%"
  435. >
  436. <el-option
  437. v-for="item in drugways"
  438. :key="item.id"
  439. :label="item.name "
  440. :value="item.name"
  441. ></el-option>
  442. </el-select>
  443. </el-form-item>
  444. </el-col>
  445. <el-col :span="12" v-if="templateFormEdit.parent_id == 0">
  446. <el-form-item label="执行频率 :" prop="execution_frequency">
  447. <el-select
  448. v-model="templateFormEdit.execution_frequency"
  449. clearable
  450. allow-create
  451. filterable
  452. placeholder="请选择(输入可搜索)"
  453. style="width:90%"
  454. >
  455. <el-option
  456. v-for="item in executionFrequencyOptions"
  457. :key="item.id"
  458. :label="item.name"
  459. :value="item.name"
  460. ></el-option>
  461. </el-select>
  462. </el-form-item>
  463. </el-col>
  464. </el-row>
  465. </el-form>
  466. <div slot="footer" class="dialog-footer">
  467. <el-button @click="cancelEditHandle">取消</el-button>
  468. <el-button type="primary" @click="submitEditTemplate('templateFormEdit')">保 存</el-button>
  469. </div>
  470. </el-dialog>
  471. <!--增删改查都请求网络类型的dialog-->
  472. <el-dialog title="编辑医嘱模版" :visible.sync="templateTableTwoVisible" width="800px">
  473. <div>
  474. <el-form ref="form" :model="form" :rule="formRules" label-width="100px">
  475. <el-form-item label="模版名称" style="width: 300px" prop="name">
  476. <el-input v-model="form.name" ></el-input>
  477. </el-form-item>
  478. </el-form>
  479. <div class="txsj" style="text-align: center;margin-bottom: 30px">
  480. <el-button round @click="newRecordActionTwo">新增医嘱内容</el-button>
  481. <!--<el-button round @click="deleteRecordActionTwo">删除医嘱内容</el-button>-->
  482. <!--<el-button round @click="modifyRecordActionTwo">修改医嘱内容</el-button>-->
  483. </div>
  484. <el-table :header-cell-style="{ backgroundColor: 'rgb(245, 247, 250)'}" ref="table" :data="adviceTableDataTwo" border highlight-current-row max-height="300">
  485. <el-table-column label="医嘱内容">
  486. <template slot-scope="scope">
  487. <span v-if="scope.row.parent_id == 0">{{scope.row.advice_name}}</span>
  488. <span v-if="scope.row.parent_id > 0"> &emsp;{{scope.row.advice_name}}</span>
  489. </template>
  490. </el-table-column>
  491. <el-table-column align="center" label="规格">
  492. <template slot-scope="scope">
  493. <!-- {{drugDesc(scope.row)}} -->
  494. {{scope.row.advice_desc}}
  495. </template>
  496. </el-table-column>
  497. <el-table-column prop="prescribing_number" align="center" label="开药数量">
  498. <template slot-scope="scope" v-if="scope.row.prescribing_number != ''">
  499. {{scope.row.prescribing_number}}{{scope.row.prescribing_number_unit}}
  500. </template>
  501. </el-table-column>
  502. <el-table-column prop="pulse_frequency" align="center" label="单次用量">
  503. <template slot-scope="scope" v-if="scope.row.single_dose != ''">
  504. {{scope.row.single_dose}}{{scope.row.single_dose_unit}}
  505. </template>
  506. </el-table-column>
  507. <el-table-column prop="breathing_rate" align="center" label="给药途径">
  508. <template slot-scope="scope">
  509. <span v-if="scope.row.parent_id == 0">{{scope.row.delivery_way}}</span>
  510. </template>
  511. </el-table-column>
  512. <el-table-column prop="blood_flow_volume" align="center" label="执行频率">
  513. <template slot-scope="scope">
  514. <span v-if="scope.row.parent_id == 0">{{scope.row.delivery_way}}</span>
  515. </template>
  516. </el-table-column>
  517. </el-table>
  518. </div>
  519. <div slot="footer" class="dialog-footer">
  520. <el-button @click="cancelTableHandleTwo">取消</el-button>
  521. <el-button type="primary" @click="modifyTemplateName">保 存</el-button>
  522. </div>
  523. </el-dialog>
  524. <el-dialog title="新增医嘱" :visible.sync="templateFormTwoVisible" width="700px">
  525. <el-form
  526. ref="templateForm"
  527. :rules="templateEditRules"
  528. :model="templateForm"
  529. label-width="90px"
  530. >
  531. <el-row>
  532. <el-col :span="12">
  533. <el-form-item label="医嘱内容 :" required prop="advice_name">
  534. <el-input v-model="templateForm.advice_name" ></el-input>
  535. </el-form-item>
  536. </el-col>
  537. <el-col :span="12">
  538. <el-form-item label="规格 :" required prop="advice_desc">
  539. <el-input v-model="templateForm.advice_desc"></el-input>
  540. </el-form-item>
  541. <!-- <el-form-item label="药品规格 :" prop="drug_spec">
  542. <el-col :span="9">
  543. <el-input v-model="templateForm.drug_spec"></el-input>
  544. </el-col>
  545. <el-col class="line" :span="1">&nbsp;</el-col>
  546. <el-col :span="14">
  547. <el-select
  548. v-model="templateForm.drug_spec_unit"
  549. filterable
  550. clearable
  551. allow-create
  552. placeholder="选择"
  553. >
  554. <el-option
  555. v-for="item in unitsOption"
  556. :key="item.id"
  557. :label="item.name "
  558. :value="item.name"
  559. ></el-option>
  560. </el-select>
  561. </el-col>
  562. </el-form-item> -->
  563. </el-col>
  564. <el-col :span="12">
  565. <el-form-item label="单次用量 :" prop="single_dose">
  566. <el-col :span="9">
  567. <el-input v-model="templateForm.single_dose"></el-input>
  568. </el-col>
  569. <el-col class="line" :span="1">&nbsp;</el-col>
  570. <el-col :span="14">
  571. <el-select
  572. v-model="templateForm.single_dose_unit"
  573. filterable
  574. clearable
  575. allow-create
  576. placeholder="选择"
  577. >
  578. <el-option
  579. v-for="item in unitsOption"
  580. :key="item.id"
  581. :label="item.name "
  582. :value="item.name"
  583. ></el-option>
  584. </el-select>
  585. </el-col>
  586. </el-form-item>
  587. </el-col>
  588. <el-col :span="12">
  589. <el-form-item label="开药数量 :" prop="prescribing_number">
  590. <el-col :span="9">
  591. <el-input v-model="templateForm.prescribing_number"></el-input>
  592. </el-col>
  593. <el-col class="line" :span="1">&nbsp;</el-col>
  594. <el-col :span="14">
  595. <el-select
  596. v-model="templateForm.prescribing_number_unit"
  597. filterable
  598. clearable
  599. allow-create
  600. placeholder="选择"
  601. >
  602. <el-option
  603. v-for="item in unitsOption"
  604. :key="item.id"
  605. :label="item.name "
  606. :value="item.name"
  607. ></el-option>
  608. </el-select>
  609. </el-col>
  610. </el-form-item>
  611. </el-col>
  612. <el-col :span="12">
  613. <el-form-item label="给药途径 :" prop="delivery_way">
  614. <el-select
  615. v-model="templateForm.delivery_way"
  616. filterable
  617. clearable
  618. allow-create
  619. placeholder="请选择(输入可搜索)"
  620. style="width:100%"
  621. >
  622. <el-option
  623. v-for="item in drugways"
  624. :key="item.id"
  625. :label="item.name "
  626. :value="item.name"
  627. ></el-option>
  628. </el-select>
  629. </el-form-item>
  630. </el-col>
  631. <el-col :span="12">
  632. <el-form-item label="执行频率 :" prop="execution_frequency">
  633. <el-select
  634. v-model="templateForm.execution_frequency"
  635. clearable
  636. allow-create
  637. filterable
  638. placeholder="请选择(输入可搜索)"
  639. style="width:100%"
  640. >
  641. <el-option
  642. v-for="item in executionFrequencyOptions"
  643. :key="item.id"
  644. :label="item.name"
  645. :value="item.name"
  646. ></el-option>
  647. </el-select>
  648. </el-form-item>
  649. </el-col>
  650. </el-row>
  651. </el-form>
  652. <div slot="footer" class="dialog-footer">
  653. <el-button @click="cancelHandleTwo">取消</el-button>
  654. <el-button type="primary" @click="submitTemplateTwo('templateForm')">保 存</el-button>
  655. </div>
  656. </el-dialog>
  657. <!--<el-dialog title="编辑医嘱" :visible.sync="templateEditFormTwoVisible" width="700px">-->
  658. <!--<el-form-->
  659. <!--ref="templateFormEdit"-->
  660. <!--:rules="templateEditRules"-->
  661. <!--:model="templateFormEdit"-->
  662. <!--label-width="90px"-->
  663. <!--&gt;-->
  664. <!--<el-form-item label="医嘱名称 :" required prop="advice_name">-->
  665. <!--<el-input v-model="templateFormEdit.advice_name" style="width:50%"></el-input>-->
  666. <!--</el-form-item>-->
  667. <!--<el-row>-->
  668. <!--<el-col :span="12">-->
  669. <!--<el-form-item label="药品规格 :" prop="drug_spec">-->
  670. <!--<el-col :span="8">-->
  671. <!--<el-input v-model="templateFormEdit.drug_spec"></el-input>-->
  672. <!--</el-col>-->
  673. <!--<el-col class="line" :span="2">&nbsp;</el-col>-->
  674. <!--<el-col :span="14">-->
  675. <!--<el-select-->
  676. <!--v-model="templateFormEdit.drug_spec_unit"-->
  677. <!--filterable-->
  678. <!--clearable-->
  679. <!--allow-create-->
  680. <!--placeholder="选择"-->
  681. <!--&gt;-->
  682. <!--<el-option-->
  683. <!--v-for="item in unitsOption"-->
  684. <!--:key="item.id"-->
  685. <!--:label="item.name "-->
  686. <!--:value="item.name"-->
  687. <!--&gt;</el-option>-->
  688. <!--</el-select>-->
  689. <!--</el-col>-->
  690. <!--</el-form-item>-->
  691. <!--</el-col>-->
  692. <!--<el-col :span="12">-->
  693. <!--<el-form-item label="单次用量 :" prop="single_dose">-->
  694. <!--<el-col :span="8">-->
  695. <!--<el-input v-model="templateFormEdit.single_dose"></el-input>-->
  696. <!--</el-col>-->
  697. <!--<el-col class="line" :span="2">&nbsp;</el-col>-->
  698. <!--<el-col :span="14">-->
  699. <!--<el-select-->
  700. <!--v-model="templateFormEdit.single_dose_unit"-->
  701. <!--filterable-->
  702. <!--clearable-->
  703. <!--allow-create-->
  704. <!--placeholder="选择"-->
  705. <!--&gt;-->
  706. <!--<el-option-->
  707. <!--v-for="item in unitsOption"-->
  708. <!--:key="item.id"-->
  709. <!--:label="item.name "-->
  710. <!--:value="item.name"-->
  711. <!--&gt;</el-option>-->
  712. <!--</el-select>-->
  713. <!--</el-col>-->
  714. <!--</el-form-item>-->
  715. <!--</el-col>-->
  716. <!--<el-col :span="12">-->
  717. <!--<el-form-item label="开药数量 :" prop="prescribing_number">-->
  718. <!--<el-col :span="8">-->
  719. <!--<el-input v-model="templateFormEdit.prescribing_number"></el-input>-->
  720. <!--</el-col>-->
  721. <!--<el-col class="line" :span="2">&nbsp;</el-col>-->
  722. <!--<el-col :span="14">-->
  723. <!--<el-select-->
  724. <!--v-model="templateFormEdit.prescribing_number_unit"-->
  725. <!--filterable-->
  726. <!--clearable-->
  727. <!--allow-create-->
  728. <!--placeholder="选择"-->
  729. <!--&gt;-->
  730. <!--<el-option-->
  731. <!--v-for="item in unitsOption"-->
  732. <!--:key="item.id"-->
  733. <!--:label="item.name "-->
  734. <!--:value="item.name"-->
  735. <!--&gt;</el-option>-->
  736. <!--</el-select>-->
  737. <!--</el-col>-->
  738. <!--</el-form-item>-->
  739. <!--</el-col>-->
  740. <!--<el-col :span="12">-->
  741. <!--<el-form-item label="给药途径 :" prop="delivery_way">-->
  742. <!--<el-select-->
  743. <!--v-model="templateFormEdit.delivery_way"-->
  744. <!--filterable-->
  745. <!--clearable-->
  746. <!--allow-create-->
  747. <!--placeholder="请选择(输入可搜索)"-->
  748. <!--style="width:90%"-->
  749. <!--&gt;-->
  750. <!--<el-option-->
  751. <!--v-for="item in drugways"-->
  752. <!--:key="item.id"-->
  753. <!--:label="item.name "-->
  754. <!--:value="item.name"-->
  755. <!--&gt;</el-option>-->
  756. <!--</el-select>-->
  757. <!--</el-form-item>-->
  758. <!--</el-col>-->
  759. <!--</el-row>-->
  760. <!--<el-row>-->
  761. <!--<el-col :span="12">-->
  762. <!--<el-form-item label="执行频率 :" prop="execution_frequency">-->
  763. <!--<el-select-->
  764. <!--v-model="templateFormEdit.execution_frequency"-->
  765. <!--clearable-->
  766. <!--allow-create-->
  767. <!--filterable-->
  768. <!--placeholder="请选择(输入可搜索)"-->
  769. <!--style="width:90%"-->
  770. <!--&gt;-->
  771. <!--<el-option-->
  772. <!--v-for="item in executionFrequencyOptions"-->
  773. <!--:key="item.id"-->
  774. <!--:label="item.name"-->
  775. <!--:value="item.name"-->
  776. <!--&gt;</el-option>-->
  777. <!--</el-select>-->
  778. <!--</el-form-item>-->
  779. <!--</el-col>-->
  780. <!--</el-row>-->
  781. <!--</el-form>-->
  782. <!--<div slot="footer" class="dialog-footer">-->
  783. <!--<el-button @click="cancelEditHandleTwo">取消</el-button>-->
  784. <!--<el-button type="primary" @click="submitEditTemplateTwo('templateFormEdit')">保 存</el-button>-->
  785. <!--</div>-->
  786. <!--</el-dialog>-->
  787. </div>
  788. </el-tab-pane>
  789. <el-tab-pane label="给药途径">
  790. <div class="">
  791. <div class="filter-container">
  792. <el-button
  793. class="filter-item"
  794. style="margin-left: 10px;"
  795. @click="handleCreateDrugWay"
  796. type="primary"
  797. icon="el-icon-circle-plus-outline"
  798. size="small"
  799. >{{$t('table.add')}}
  800. </el-button>
  801. </div>
  802. <el-table
  803. :data="drugways"
  804. border
  805. fit
  806. :header-cell-style="{ backgroundColor: 'rgb(245, 247, 250)'}"
  807. highlight-current-row
  808. style="width: 100%;min-height:500px;"
  809. >
  810. <el-table-column align="center" label="名称">
  811. <template slot-scope="scope">
  812. <span>{{scope.row.name}}</span>
  813. </template>
  814. </el-table-column>
  815. <el-table-column
  816. align="center"
  817. :label="$t('table.actions')"
  818. width="230"
  819. class-name="small-padding fixed-width"
  820. >
  821. <template slot-scope="scope">
  822. <el-button type="text" size="mini" v-show="scope.row.org_id==0" disabled>系统设定</el-button>
  823. <el-button
  824. v-show="scope.row.org_id!=0"
  825. type="primary"
  826. size="small"
  827. icon="el-icon-edit-outline"
  828. @click="handleUpdateDrugWay(scope.row, scope.$index)"
  829. >
  830. </el-button>
  831. <el-button
  832. v-show="scope.row.org_id!=0"
  833. size="small"
  834. type="danger"
  835. icon="el-icon-delete"
  836. @click="handleDeleteDrugWay(scope.row, scope.$index)"
  837. >
  838. </el-button>
  839. </template>
  840. </el-table-column>
  841. </el-table>
  842. <el-dialog :title="dialogTitle" :visible.sync="drugwayFormVisible" width="700px">
  843. <el-form
  844. ref="drugwayForm"
  845. :rules="drugwayRules"
  846. :model="drugwayForm"
  847. label-width="90px"
  848. >
  849. <el-form-item label="给药途径 :" required prop="name">
  850. <el-input v-model="drugwayForm.name" placeholder="给药途径"></el-input>
  851. </el-form-item>
  852. </el-form>
  853. <div slot="footer" class="dialog-footer">
  854. <el-button @click="drugwayFormVisible = false">取消</el-button>
  855. <el-button type="primary" @click="submitDrugWay('drugwayForm')">保 存</el-button>
  856. </div>
  857. </el-dialog>
  858. </div>
  859. </el-tab-pane>
  860. <el-tab-pane label="执行频率">
  861. <div class="">
  862. <div class="filter-container">
  863. <el-button
  864. class="filter-item"
  865. style="margin-left: 10px;"
  866. @click="handleCreateEF"
  867. type="primary"
  868. icon="el-icon-circle-plus-outline"
  869. size="small"
  870. >{{$t('table.add')}}
  871. </el-button>
  872. </div>
  873. <el-table
  874. :data="executionFrequencyOptions"
  875. border
  876. fit
  877. :header-cell-style="{ backgroundColor: 'rgb(245, 247, 250)'}"
  878. highlight-current-row
  879. style="width: 100%;min-height:500px;"
  880. >
  881. <el-table-column align="center" label="名称">
  882. <template slot-scope="scope">
  883. <span>{{scope.row.name}}</span>
  884. </template>
  885. </el-table-column>
  886. <el-table-column
  887. align="center"
  888. :label="$t('table.actions')"
  889. width="230"
  890. class-name="small-padding fixed-width"
  891. >
  892. <template slot-scope="scope">
  893. <el-button type="text" size="mini" v-show="scope.row.org_id==0" disabled>系统设定</el-button>
  894. <el-button
  895. v-show="scope.row.org_id!=0"
  896. type="primary"
  897. size="small"
  898. icon="el-icon-edit-outline"
  899. @click="handleUpdateEF(scope.row, scope.$index)"
  900. >
  901. </el-button>
  902. <el-button
  903. v-show="scope.row.org_id!=0"
  904. size="small"
  905. type="danger"
  906. icon="el-icon-delete"
  907. @click="handleDeleteEF(scope.row, scope.$index)"
  908. >
  909. </el-button>
  910. </template>
  911. </el-table-column>
  912. </el-table>
  913. <el-dialog :title="dialogTitle" :visible.sync="efFormVisible" width="700px">
  914. <el-form ref="efForm" :rules="efRules" :model="efForm" label-width="90px">
  915. <el-form-item label="执行频率 :" required prop="name">
  916. <el-input v-model="efForm.name" placeholder="执行频率"></el-input>
  917. </el-form-item>
  918. </el-form>
  919. <div slot="footer" class="dialog-footer">
  920. <el-button @click="efFormVisible = false">取消</el-button>
  921. <el-button type="primary" @click="submitEF('efForm')">保 存</el-button>
  922. </div>
  923. </el-dialog>
  924. </div>
  925. </el-tab-pane>
  926. </el-tabs>
  927. </div>
  928. </div>
  929. </template>
  930. <style>
  931. @import "../../../static/css/table_row.css";
  932. .filter-item{
  933. float: right;
  934. }
  935. </style>
  936. <script>
  937. import {
  938. CreateAdviceTemplate,
  939. CreateDrugDic,
  940. CreateDrugWay,
  941. CreateExecutionFrequency,
  942. CreateSingleAdviceTemplate,
  943. CreateSubAdvice,
  944. DeleteAdviceTemplate,
  945. DeleteDrugDic,
  946. DeleteDrugWay,
  947. DeleteExecutionFrequency,
  948. DeleteParentAdviceTemplate,
  949. getAdviceConfig,
  950. getAllAdviceTemplate,
  951. postAdviceTemplate,
  952. UpdateAdviceTemplate,
  953. UpdateDrugDic,
  954. UpdateDrugWay,
  955. UpdateExecutionFrequency,
  956. updateTemplateName
  957. } from '@/api/advice'
  958. import BreadCrumb from '@/xt_pages/components/bread-crumb'
  959. import { getDataConfig } from '@/utils/data'
  960. export default {
  961. name: 'tab',
  962. components: { BreadCrumb },
  963. data() {
  964. return {
  965. crumbs: [
  966. { path: false, name: '数据字典' },
  967. { path: 'data/druguse', name: '医嘱模版' }
  968. ],
  969. rowIndex: -1,
  970. current_template_id: 0,
  971. currentObject: {},
  972. tempArr: [],
  973. sameRowArr: [],
  974. advice_content_name: '',
  975. table_current_index: -1,
  976. adviceTableData: [],
  977. templateName: '',
  978. adviceTableDataTwo: [],
  979. table_current_index_two: -1,
  980. currentIndex: -1,
  981. isEdit: false,
  982. dialogTitle: '',
  983. isAddChild: false,
  984. parent_id: 0,
  985. editDialogTitle: '编辑医嘱',
  986. drugdicFormVisible: false,
  987. drugwayFormVisible: false,
  988. templateFormVisible: false,
  989. templateTableTwoVisible: false,
  990. templateEditFormVisible: false,
  991. edit_advice_name: '',
  992. templateTableVisible: false,
  993. templateFormTwoVisible: false,
  994. templateEditFormTwoVisible: false,
  995. efFormVisible: false,
  996. activeName: 'drugdic',
  997. hoverOrderArr: [],
  998. createdTimes: 0,
  999. drugdics: [],
  1000. adviceTemplates: [],
  1001. current_template_name: '',
  1002. editForm: {
  1003. name: ''
  1004. },
  1005. drugways: [],
  1006. executionFrequencyOptions: [],
  1007. drugdicRules: {
  1008. name: [{ required: true, message: '请填写医嘱内容' }]
  1009. },
  1010. formRules: {
  1011. name: [
  1012. { min: 3, max: 5, message: '长度在 3 到 5 个字符', trigger: 'blur' }
  1013. ]
  1014. },
  1015. drugwayRules: {
  1016. name: [{ required: true, message: '请填写给药途径' }]
  1017. },
  1018. efRules: {
  1019. name: [{ required: true, message: '请填写执行频率' }]
  1020. },
  1021. templateRules: {
  1022. advice_name: [{ required: true, message: '请填写医嘱内容' }],
  1023. advice_desc: [{ required: true, message: '请填写规格' }]
  1024. },
  1025. templateEditRules: {
  1026. advice_name: [{ required: true, message: '请填写医嘱内容' }]
  1027. },
  1028. templateForm: {
  1029. drug_spec: '',
  1030. drug_spec_unit: '',
  1031. advice_name: '',
  1032. advice_desc: '',
  1033. single_dose: '',
  1034. single_dose_unit: '',
  1035. prescribing_number: '',
  1036. prescribing_number_unit: '',
  1037. delivery_way: '',
  1038. execution_frequency: '',
  1039. id: 0
  1040. },
  1041. templateFormEdit: {
  1042. drug_spec: '',
  1043. drug_spec_unit: '',
  1044. advice_name: '',
  1045. advice_desc: '',
  1046. single_dose: '',
  1047. single_dose_unit: '',
  1048. prescribing_number: '',
  1049. prescribing_number_unit: '',
  1050. delivery_way: '',
  1051. execution_frequency: '',
  1052. id: 0
  1053. },
  1054. drugdicForm: {
  1055. name: '',
  1056. spec: '',
  1057. spec_unit: '',
  1058. form: '',
  1059. form_unit: '',
  1060. id: 0
  1061. },
  1062. form: {
  1063. name: ''
  1064. },
  1065. drugwayForm: {
  1066. name: '',
  1067. id: 0
  1068. },
  1069. efForm: {
  1070. name: '',
  1071. id: 0
  1072. },
  1073. drugforms: [
  1074. { lable: 1, name: '胶囊' },
  1075. { lable: 2, name: '注射剂' },
  1076. { lable: 3, name: '片剂' },
  1077. { lable: 4, name: '注射液' },
  1078. { lable: 5, name: '栓剂' },
  1079. { lable: 6, name: '膏' },
  1080. { lable: 7, name: '颗粒剂' },
  1081. { lable: 8, name: '粉剂' },
  1082. { lable: 9, name: '口服液' },
  1083. { lable: 10, name: '干混悬剂' },
  1084. { lable: 11, name: '丸剂' },
  1085. { lable: 12, name: '气雾剂' },
  1086. { lable: 13, name: '内服溶液' },
  1087. { lable: 14, name: '外用溶液' },
  1088. { lable: 15, name: '软膏剂' },
  1089. { lable: 16, name: '胶剂' }
  1090. ]
  1091. }
  1092. },
  1093. created() {
  1094. this.getAdviceConfig()
  1095. this.unitsOption = getDataConfig('hemodialysis', 'units')
  1096. },
  1097. methods: {
  1098. adviceNameShow({row, column, rowIndex, columnIndex}){
  1099. if(columnIndex==1) {
  1100. return 'templateadvicenamedisplay';
  1101. }else {
  1102. return '';
  1103. }
  1104. },
  1105. showCreatedTimes() {
  1106. this.createdTimes = this.createdTimes + 1
  1107. },
  1108. handleUpdateDrugDic(row, index) {
  1109. this.currentIndex = index
  1110. this.drugdicForm = {
  1111. name: row.name,
  1112. spec: row.spec,
  1113. spec_unit: row.spec_unit,
  1114. form: row.form,
  1115. form_unit: row.form_unit,
  1116. id: row.id
  1117. }
  1118. this.drugdicFormVisible = true
  1119. this.dialogTitle = '编辑医嘱模版'
  1120. this.isEdit = true
  1121. },
  1122. handleCreateDrugDic() {
  1123. this.drugdicForm = {
  1124. name: '',
  1125. spec: '',
  1126. spec_unit: '',
  1127. form: '',
  1128. form_unit: '',
  1129. id: 0
  1130. }
  1131. this.drugdicFormVisible = true
  1132. this.dialogTitle = '新增医嘱模版'
  1133. this.isEdit = false
  1134. },
  1135. cancelHandle(formName) {
  1136. this.table_current_index = -1
  1137. this.resetForm(formName)
  1138. if (this.isAddChild) {
  1139. this.templateFormVisible = false
  1140. } else {
  1141. this.templateFormVisible = false
  1142. this.templateTableVisible = true
  1143. }
  1144. },
  1145. handleCreateTemplate() {
  1146. this.templateTableVisible = true
  1147. },
  1148. newRecordAction() {
  1149. this.dialogTitle = '新增医嘱内容'
  1150. this.advice_content_name = '医嘱内容'
  1151. this.isEdit = false
  1152. this.parent_id = 0
  1153. this.isAddChild = false
  1154. this.templateTableVisible = false
  1155. this.templateFormVisible = true
  1156. }, deleteRecordAction: function() {
  1157. if (this.table_current_index == -1) {
  1158. this.$message.error('请选择一条医嘱记录')
  1159. return
  1160. }
  1161. this.$confirm('删除记录', '是否删除该医嘱记录', {
  1162. confirmButtonText: '确 定',
  1163. cancelButtonText: '取 消',
  1164. type: 'warning'
  1165. }).then(() => {
  1166. this.adviceTableData.splice(this.table_current_index, 1)
  1167. this.table_current_index = -1
  1168. }).catch(() => {
  1169. })
  1170. }, tableRow({ row, rowIndex }) {
  1171. // 把每一行的索引放进row
  1172. row.index = rowIndex
  1173. },
  1174. onRowClick(row, event, column) {
  1175. this.table_current_index = row.index
  1176. }, modifyRecordAction: function() {
  1177. if (this.table_current_index == -1) {
  1178. this.$message.error('请选择一条医嘱记录')
  1179. return
  1180. }
  1181. this.isEdit = true
  1182. const adviceTable = this.adviceTableData[this.table_current_index]
  1183. for (var index in adviceTable) {
  1184. this.templateForm[index] = adviceTable[index]
  1185. }
  1186. this.templateFormVisible = true
  1187. this.templateTableVisible = false
  1188. this.dialogTitle = '编辑医嘱内容'
  1189. this.advice_content_name = '医嘱内容'
  1190. }, cancelTableHandle: function() {
  1191. this.$confirm('放弃编辑', '是否放弃编辑,已编辑的数据将无法恢复', {
  1192. confirmButtonText: '确 定',
  1193. cancelButtonText: '取 消',
  1194. type: 'warning'
  1195. }).then(() => {
  1196. this.adviceTableData = []
  1197. this.form.name = ''
  1198. this.templateFormVisible = false
  1199. this.templateTableVisible = false
  1200. }).catch(() => {
  1201. })
  1202. }, submitTableTemplate(formName) {
  1203. if (this.adviceTableData.length <= 0) {
  1204. this.$message.error('至少添加一条医嘱信息')
  1205. return
  1206. }
  1207. const params = {
  1208. 'data': this.adviceTableData
  1209. }
  1210. postAdviceTemplate(params, this.form.name).then(response => {
  1211. if (response.data.state == 0) {
  1212. this.$message.error(response.data.msg)
  1213. return false
  1214. } else {
  1215. this.$message.success('添加模版成功')
  1216. var template = response.data.data.template
  1217. if (template.DoctorAdviceTemplate.length > 0) {
  1218. for (let i = 0; i < template.DoctorAdviceTemplate.length; i++) {
  1219. const object = {}
  1220. const DoctorAdviceTemplate = template.DoctorAdviceTemplate[i]
  1221. for (const key in DoctorAdviceTemplate) {
  1222. object[key] = DoctorAdviceTemplate[key]
  1223. }
  1224. object['name'] = template.name
  1225. object['isNoSub'] = 2
  1226. this.adviceTemplates.unshift(object)
  1227. }
  1228. }
  1229. this.handleSpanTempArr()
  1230. this.form.name = ''
  1231. this.adviceTableData = []
  1232. this.templateFormVisible = false
  1233. this.templateTableVisible = false
  1234. }
  1235. })
  1236. },
  1237. resetForm(formName) {
  1238. this.$refs[formName].resetFields()
  1239. },
  1240. handleDeleteDrugDic(row, index) {
  1241. this.$confirm('确认删除此医嘱模板?', '删除', {
  1242. confirmButtonText: '确 定',
  1243. cancelButtonText: '取 消',
  1244. type: 'warning'
  1245. })
  1246. .then(() => {
  1247. DeleteDrugDic(row.id).then(response => {
  1248. if (response.data.state == 0) {
  1249. this.$message.error(response.data.msg)
  1250. return false
  1251. } else {
  1252. this.$message.success('删除成功')
  1253. this.drugdics.splice(index, 1)
  1254. }
  1255. })
  1256. })
  1257. .catch(() => {
  1258. })
  1259. },
  1260. handleDeleteAdviceTemplate(row, index) {
  1261. this.$confirm('确认删除此医嘱模板?', '删除', {
  1262. confirmButtonText: '确 定',
  1263. cancelButtonText: '取 消',
  1264. type: 'warning'
  1265. })
  1266. .then(() => {
  1267. DeleteParentAdviceTemplate(row.template_id).then(response => {
  1268. if (response.data.state == 0) {
  1269. this.$message.error(response.data.msg)
  1270. return false
  1271. } else {
  1272. this.$message.success('删除成功')
  1273. // console.log(this.adviceTemplates.length)
  1274. // for(let i = 0;i < this.adviceTemplates.length; i++){
  1275. // if(this.adviceTemplates[i].template_id == row.template_id){
  1276. // this.adviceTemplates.splice(i,1);
  1277. // }
  1278. // }
  1279. this.getAdviceConfig()
  1280. }
  1281. })
  1282. })
  1283. .catch(() => {
  1284. })
  1285. },
  1286. submitDrugDic(formName) {
  1287. this.$refs[formName].validate(valid => {
  1288. if (valid) {
  1289. if (this.isEdit) {
  1290. UpdateDrugDic(this.drugdicForm.id, this.drugdicForm).then(
  1291. response => {
  1292. if (response.data.state == 0) {
  1293. this.$message.error(response.data.msg)
  1294. return false
  1295. } else {
  1296. this.$message.success('修改成功')
  1297. this.drugdicFormVisible = false
  1298. this.resetForm(formName)
  1299. var drugdic = response.data.data.drugdic
  1300. this.drugdics[this.currentIndex].name = drugdic.name
  1301. this.drugdics[this.currentIndex].spec = drugdic.spec
  1302. this.drugdics[this.currentIndex].spec_unit =
  1303. drugdic.spec_unit
  1304. this.drugdics[this.currentIndex].form = drugdic.form
  1305. this.drugdics[this.currentIndex].form_unit =
  1306. drugdic.form_unit
  1307. this.drugdics[this.currentIndex].updated_time =
  1308. drugdic.updated_time
  1309. this.currentIndex = -1
  1310. return false
  1311. }
  1312. }
  1313. )
  1314. } else {
  1315. CreateDrugDic(this.drugdicForm).then(response => {
  1316. if (response.data.state == 0) {
  1317. this.$message.error(response.data.msg)
  1318. return false
  1319. } else {
  1320. this.$message.success('添加成功')
  1321. this.drugdicFormVisible = false
  1322. this.resetForm(formName)
  1323. this.drugdics.unshift(response.data.data.drugdic)
  1324. return false
  1325. }
  1326. })
  1327. }
  1328. }
  1329. })
  1330. },
  1331. submitTemplate(formName) {
  1332. this.$refs[formName].validate(valid => {
  1333. this.templateForm.single_dose = parseFloat(this.templateForm.single_dose)
  1334. this.templateForm.prescribing_number = parseFloat(this.templateForm.prescribing_number)
  1335. if (isNaN(this.templateForm.single_dose)) {
  1336. this.templateForm.single_dose = 0
  1337. }
  1338. if (isNaN(this.templateForm.prescribing_number)) {
  1339. this.templateForm.prescribing_number = 0
  1340. }
  1341. if (valid) {
  1342. const templateFormTwo = {}
  1343. templateFormTwo.template_id = this.current_template_id
  1344. templateFormTwo.advice_name = this.templateForm.advice_name
  1345. templateFormTwo.advice_desc = this.templateForm.advice_desc
  1346. templateFormTwo.drug_spec = this.templateForm.drug_spec
  1347. templateFormTwo.drug_spec_unit = this.templateForm.drug_spec_unit
  1348. templateFormTwo.single_dose = this.templateForm.single_dose
  1349. templateFormTwo.single_dose_unit = this.templateForm.single_dose_unit
  1350. templateFormTwo.prescribing_number = this.templateForm.prescribing_number
  1351. templateFormTwo.prescribing_number_unit = this.templateForm.prescribing_number_unit
  1352. templateFormTwo.delivery_way = this.templateForm.delivery_way
  1353. templateFormTwo.execution_frequency = this.templateForm.execution_frequency
  1354. templateFormTwo.parent_id = this.parent_id
  1355. if (this.isAddChild) {
  1356. CreateSubAdvice(templateFormTwo).then(response => {
  1357. if (response.data.state == 0) {
  1358. this.$message.error(response.data.msg)
  1359. return false
  1360. } else {
  1361. this.$message.success('添加成功')
  1362. var spliceIndex = -1
  1363. for (let index = this.adviceTemplates.length - 1; ; index--) {
  1364. if (this.adviceTemplates[index].parent_id === templateFormTwo.parent_id) {
  1365. spliceIndex = index
  1366. break
  1367. } else if (this.adviceTemplates[index].id === templateFormTwo.parent_id) {
  1368. spliceIndex = index
  1369. break
  1370. }
  1371. }
  1372. if (spliceIndex > -1) {
  1373. spliceIndex += 1
  1374. if (spliceIndex === this.adviceTemplates.length) {
  1375. const template = response.data.data.template
  1376. template['isNoSub'] = 2
  1377. this.adviceTemplates.push(template)
  1378. } else {
  1379. const template = response.data.data.template
  1380. template['isNoSub'] = 2
  1381. var swapData = this.adviceTemplates.splice(spliceIndex)
  1382. this.adviceTemplates.push(template)
  1383. this.adviceTemplates = this.adviceTemplates.concat(swapData)
  1384. }
  1385. }
  1386. this.handleSpanTempArr()
  1387. this.templateFormVisible = false
  1388. this.resetForm(formName)
  1389. return false
  1390. }
  1391. })
  1392. } else {
  1393. const templateFormTwo = {}
  1394. templateFormTwo.advice_name = this.templateForm.advice_name
  1395. templateFormTwo.advice_desc = this.templateForm.advice_desc
  1396. templateFormTwo.drug_spec = this.templateForm.drug_spec
  1397. templateFormTwo.drug_spec_unit = this.templateForm.drug_spec_unit
  1398. templateFormTwo.single_dose = this.templateForm.single_dose
  1399. templateFormTwo.single_dose_unit = this.templateForm.single_dose_unit
  1400. templateFormTwo.prescribing_number = this.templateForm.prescribing_number
  1401. templateFormTwo.prescribing_number_unit = this.templateForm.prescribing_number_unit
  1402. templateFormTwo.delivery_way = this.templateForm.delivery_way
  1403. templateFormTwo.execution_frequency = this.templateForm.execution_frequency
  1404. templateFormTwo.parent_id = this.parent_id
  1405. if (this.isEdit) {
  1406. for (let i = 0; i < this.adviceTableData.length; i++) {
  1407. if (i == this.table_current_index) {
  1408. this.adviceTableData[i].advice_name = templateFormTwo.advice_name
  1409. this.adviceTableData[i].advice_desc = templateFormTwo.advice_desc
  1410. this.adviceTableData[i].drug_spec = templateFormTwo.drug_spec
  1411. this.adviceTableData[i].drug_spec_unit = templateFormTwo.drug_spec_unit
  1412. this.adviceTableData[i].single_dose = templateFormTwo.single_dose
  1413. this.adviceTableData[i].single_dose_unit = templateFormTwo.single_dose_unit
  1414. this.adviceTableData[i].prescribing_number = templateFormTwo.prescribing_number
  1415. this.adviceTableData[i].prescribing_number_unit = templateFormTwo.prescribing_number_unit
  1416. this.adviceTableData[i].delivery_way = templateFormTwo.delivery_way
  1417. this.adviceTableData[i].execution_frequency = templateFormTwo.execution_frequency
  1418. }
  1419. }
  1420. } else {
  1421. this.adviceTableData.unshift(templateFormTwo)
  1422. }
  1423. this.templateFormVisible = false
  1424. this.templateTableVisible = true
  1425. }
  1426. this.$refs[formName].resetFields()
  1427. }
  1428. })
  1429. },
  1430. handleCreateDrugWay() {
  1431. this.drugwayForm = {
  1432. name: '',
  1433. id: 0
  1434. }
  1435. this.drugwayFormVisible = true
  1436. this.dialogTitle = '新增给药途径'
  1437. this.isEdit = false
  1438. },
  1439. handleUpdateDrugWay(row, index) {
  1440. this.currentIndex = index
  1441. this.drugwayForm = {
  1442. name: row.name,
  1443. id: row.id
  1444. }
  1445. this.drugwayFormVisible = true
  1446. this.dialogTitle = '编辑给药途径'
  1447. this.isEdit = true
  1448. },
  1449. submitDrugWay(formName) {
  1450. this.$refs[formName].validate(valid => {
  1451. if (valid) {
  1452. if (this.isEdit) {
  1453. UpdateDrugWay(this.drugwayForm.id, this.drugwayForm).then(
  1454. response => {
  1455. if (response.data.state == 0) {
  1456. this.$message.error(response.data.msg)
  1457. return false
  1458. } else {
  1459. this.$message.success('修改成功')
  1460. this.drugwayFormVisible = false
  1461. this.resetForm(formName)
  1462. var drugway = response.data.data.drugway
  1463. this.drugways[this.currentIndex].name = drugway.name
  1464. this.drugways[this.currentIndex].updated_time =
  1465. drugway.updated_time
  1466. this.currentIndex = -1
  1467. return false
  1468. }
  1469. }
  1470. )
  1471. } else {
  1472. CreateDrugWay(this.drugwayForm).then(response => {
  1473. if (response.data.state == 0) {
  1474. this.$message.error(response.data.msg)
  1475. return false
  1476. } else {
  1477. this.$message.success('添加成功')
  1478. this.drugwayFormVisible = false
  1479. this.resetForm(formName)
  1480. this.drugways.unshift(response.data.data.drugway)
  1481. return false
  1482. }
  1483. })
  1484. }
  1485. }
  1486. })
  1487. },
  1488. handleDeleteDrugWay(row, index) {
  1489. this.$confirm('确认删除此给药途径?', '删除', {
  1490. confirmButtonText: '确 定',
  1491. cancelButtonText: '取 消',
  1492. type: 'warning'
  1493. })
  1494. .then(() => {
  1495. DeleteDrugWay(row.id).then(response => {
  1496. if (response.data.state == 0) {
  1497. this.$message.error(response.data.msg)
  1498. return false
  1499. } else {
  1500. this.$message.success('删除成功')
  1501. this.drugways.splice(index, 1)
  1502. }
  1503. })
  1504. })
  1505. .catch(() => {
  1506. })
  1507. },
  1508. handleCreateEF() {
  1509. this.efForm = {
  1510. name: '',
  1511. id: 0
  1512. }
  1513. this.efFormVisible = true
  1514. this.dialogTitle = '新增执行频率'
  1515. this.isEdit = false
  1516. },
  1517. handleUpdateEF(row, index) {
  1518. this.currentIndex = index
  1519. this.efForm = {
  1520. name: row.name,
  1521. id: row.id
  1522. }
  1523. this.efFormVisible = true
  1524. this.dialogTitle = '编辑执行频率'
  1525. this.isEdit = true
  1526. },
  1527. submitEF(formName) {
  1528. this.$refs[formName].validate(valid => {
  1529. if (valid) {
  1530. if (this.isEdit) {
  1531. UpdateExecutionFrequency(this.efForm.id, this.efForm).then(
  1532. response => {
  1533. if (response.data.state == 0) {
  1534. this.$message.error(response.data.msg)
  1535. return false
  1536. } else {
  1537. this.$message.success('修改成功')
  1538. this.efFormVisible = false
  1539. this.resetForm(formName)
  1540. var ef = response.data.data.ef
  1541. this.executionFrequencyOptions[this.currentIndex].name =
  1542. ef.name
  1543. this.executionFrequencyOptions[
  1544. this.currentIndex
  1545. ].updated_time = ef.updated_time
  1546. this.currentIndex = -1
  1547. return false
  1548. }
  1549. }
  1550. )
  1551. } else {
  1552. CreateExecutionFrequency(this.efForm).then(response => {
  1553. if (response.data.state == 0) {
  1554. this.$message.error(response.data.msg)
  1555. return false
  1556. } else {
  1557. this.$message.error('添加成功')
  1558. this.efFormVisible = false
  1559. this.resetForm(formName)
  1560. this.executionFrequencyOptions.unshift(response.data.data.ef)
  1561. return false
  1562. }
  1563. })
  1564. }
  1565. }
  1566. })
  1567. },
  1568. handleDeleteEF(row, index) {
  1569. this.$confirm('确认删除此执行频率?', '删除', {
  1570. confirmButtonText: '确 定',
  1571. cancelButtonText: '取 消',
  1572. type: 'warning'
  1573. })
  1574. .then(() => {
  1575. DeleteExecutionFrequency(row.id).then(response => {
  1576. if (response.data.state == 0) {
  1577. this.$message.error(response.data.msg)
  1578. return false
  1579. } else {
  1580. this.$message.error('删除成功')
  1581. this.executionFrequencyOptions.splice(index, 1)
  1582. }
  1583. })
  1584. })
  1585. .catch(() => {
  1586. })
  1587. },
  1588. getAdviceConfig() {
  1589. this.adviceTemplates = []
  1590. getAdviceConfig().then(response => {
  1591. if (response.data.state == 1) {
  1592. this.drugways = response.data.data.drugways
  1593. this.executionFrequencyOptions = response.data.data.efs
  1594. this.drugdics = response.data.data.drugs
  1595. const len = response.data.data.advice_templates.length
  1596. for (let i = 0; i < len; i++) {
  1597. // 对于空医嘱模版的处理
  1598. if (response.data.data.advice_templates[i] != null && response.data.data.advice_templates[i].DoctorAdviceTemplate.length == 0) {
  1599. const object = {}
  1600. object['name'] = response.data.data.advice_templates[i].name
  1601. object['isNoSub'] = 1
  1602. object['template_id'] = response.data.data.advice_templates[i].id
  1603. this.adviceTemplates.push(object)
  1604. }
  1605. // 非空模版的处理
  1606. for (let y = 0; y < response.data.data.advice_templates[i].DoctorAdviceTemplate.length; y++) {
  1607. if (response.data.data.advice_templates[i].id == response.data.data.advice_templates[i].DoctorAdviceTemplate[y].template_id) {
  1608. const object = {}
  1609. const DoctorAdviceTemplate = response.data.data.advice_templates[i].DoctorAdviceTemplate[y]
  1610. for (const key in DoctorAdviceTemplate) {
  1611. object[key] = DoctorAdviceTemplate[key]
  1612. }
  1613. object['isNoSub'] = 2
  1614. object['name'] = response.data.data.advice_templates[i].name
  1615. this.adviceTemplates.push(object)
  1616. }
  1617. }
  1618. }
  1619. // 处理单元格合并的数据
  1620. this.handleSpanTempArr()
  1621. }
  1622. })
  1623. }, isShow(index, row) {
  1624. if (index > 0 && row.name == this.adviceTemplates[index - 1].name) {
  1625. return false
  1626. }
  1627. return true
  1628. }, cancelEditHandle() {
  1629. this.templateTableVisible = true
  1630. this.templateEditFormVisible = false
  1631. }, submitEditTemplate(formName) {
  1632. this.$refs[formName].validate(valid => {
  1633. this.templateFormEdit.single_dose = parseFloat(this.templateFormEdit.single_dose)
  1634. this.templateFormEdit.prescribing_number = parseFloat(this.templateFormEdit.prescribing_number)
  1635. if (isNaN(this.templateFormEdit.single_dose)) {
  1636. this.templateFormEdit.single_dose = 0
  1637. }
  1638. if (isNaN(this.templateFormEdit.prescribing_number)) {
  1639. this.templateFormEdit.prescribing_number = 0
  1640. }
  1641. if (valid) {
  1642. UpdateAdviceTemplate(this.templateFormEdit.id, this.templateFormEdit).then(
  1643. response => {
  1644. if (response.data.state == 0) {
  1645. this.$message.error(response.data.msg)
  1646. return false
  1647. } else {
  1648. this.$message.success('修改成功')
  1649. this.templateEditFormVisible = false
  1650. this.resetForm(formName)
  1651. var template = response.data.data.template
  1652. this.adviceTemplates[this.currentIndex].advice_name = template.advice_name
  1653. this.adviceTemplates[this.currentIndex].advice_desc = template.advice_desc
  1654. this.adviceTemplates[this.currentIndex].drug_spec = template.drug_spec
  1655. this.adviceTemplates[this.currentIndex].drug_spec_unit = template.drug_spec_unit
  1656. this.adviceTemplates[this.currentIndex].single_dose = template.single_dose
  1657. this.adviceTemplates[this.currentIndex].single_dose_unit = template.single_dose_unit
  1658. this.adviceTemplates[this.currentIndex].delivery_way = template.delivery_way
  1659. this.adviceTemplates[this.currentIndex].execution_frequency = template.execution_frequency
  1660. this.adviceTemplates[this.currentIndex].prescribing_number = template.prescribing_number
  1661. this.adviceTemplates[this.currentIndex].prescribing_number_unit = template.prescribing_number_unit
  1662. this.currentIndex = -1
  1663. return false
  1664. }
  1665. }
  1666. )
  1667. }
  1668. })
  1669. }, drugDesc(row) {
  1670. if (row.isNoSub == 2) {
  1671. if (row.drug_spec.length <= 0) {
  1672. return ''
  1673. } else {
  1674. if (row.prescribing_number == 0) {
  1675. return row.drug_spec + '' + row.drug_spec_unit
  1676. } else {
  1677. return row.drug_spec + '' + row.drug_spec_unit + ' * ' + row.prescribing_number + row.prescribing_number_unit
  1678. }
  1679. }
  1680. }
  1681. }, drugDescTwo(row) {
  1682. if (row.drug_spec.length <= 0) {
  1683. return ''
  1684. } else {
  1685. if (row.prescribing_number == 0) {
  1686. return row.drug_spec + '' + row.drug_spec_unit
  1687. } else {
  1688. return row.drug_spec + '' + row.drug_spec_unit + ' * ' + row.prescribing_number + row.prescribing_number_unit
  1689. }
  1690. }
  1691. }, newRecordActionTwo() {
  1692. this.templateFormTwoVisible = true
  1693. }, deleteRecordActionTwo() {
  1694. if (this.table_current_index_two == -1) {
  1695. this.$message.error('请选择一条医嘱记录')
  1696. return
  1697. }
  1698. this.$confirm('删除记录', '是否删除该医嘱记录', {
  1699. confirmButtonText: '确 定',
  1700. cancelButtonText: '取 消',
  1701. type: 'warning'
  1702. }).then(() => {
  1703. const id = this.adviceTableDataTwo[this.table_current_index_two].id
  1704. const template_id = this.adviceTableDataTwo[this.table_current_index_two].template_id
  1705. DeleteAdviceTemplate(id, template_id).then(response => {
  1706. if (response.data.state == 0) {
  1707. this.$message.error(response.data.msg)
  1708. return false
  1709. } else {
  1710. this.$message.success('删除成功')
  1711. for (let i = 0; i < this.adviceTemplates.length; i++) {
  1712. console.log(this.adviceTemplates[i].id)
  1713. if (this.adviceTemplates[i].id == this.adviceTableDataTwo[this.table_current_index_two].id) {
  1714. this.adviceTemplates.splice(i, 1)
  1715. }
  1716. }
  1717. this.adviceTableDataTwo.splice(this.table_current_index_two, 1)
  1718. this.table_current_index_two = -1
  1719. }
  1720. })
  1721. }).catch(() => {
  1722. })
  1723. }, modifyRecordActionTwo() {
  1724. if (this.table_current_index_two == -1) {
  1725. this.$message.error('请选择一条医嘱记录')
  1726. return
  1727. }
  1728. this.templateFormEdit = {
  1729. drug_spec: this.adviceTableDataTwo[this.table_current_index_two].drug_spec,
  1730. drug_spec_unit: this.adviceTableDataTwo[this.table_current_index_two].drug_spec_unit,
  1731. advice_name: this.adviceTableDataTwo[this.table_current_index_two].advice_name,
  1732. advice_desc: this.adviceTableDataTwo[this.table_current_index_two].advice_desc,
  1733. single_dose: this.adviceTableDataTwo[this.table_current_index_two].single_dose,
  1734. single_dose_unit: this.adviceTableDataTwo[this.table_current_index_two].single_dose_unit,
  1735. prescribing_number: this.adviceTableDataTwo[this.table_current_index_two].prescribing_number,
  1736. prescribing_number_unit: this.adviceTableDataTwo[this.table_current_index_two].prescribing_number_unit,
  1737. delivery_way: this.adviceTableDataTwo[this.table_current_index_two].delivery_way,
  1738. execution_frequency: this.adviceTableDataTwo[this.table_current_index_two].execution_frequency,
  1739. id: this.adviceTableDataTwo[this.table_current_index_two].id
  1740. }
  1741. this.templateEditFormTwoVisible = true
  1742. }, tableRowClassNameTwo({ row, rowIndex }) {
  1743. // 把每一行的索引放进row
  1744. row.index = rowIndex
  1745. },
  1746. onRowClickTwo(row, event, column) {
  1747. this.table_current_index_two = row.index
  1748. }, cancelHandleTwo() {
  1749. this.templateFormTwoVisible = false
  1750. }, submitTemplateTwo(formName) {
  1751. this.templateForm['template_id'] = this.current_template_id
  1752. CreateSingleAdviceTemplate(this.templateForm).then(response => {
  1753. if (response.data.state == 0) {
  1754. this.$message.error(response.data.msg)
  1755. return false
  1756. } else {
  1757. const source = response.data.data.template
  1758. const objects = {}
  1759. for (const keys in source) {
  1760. objects[keys] = source[keys]
  1761. }
  1762. objects['name'] = this.current_template_name
  1763. objects['isNoSub'] = 2
  1764. this.adviceTableDataTwo.unshift(response.data.data.template)
  1765. // this.adviceTemplates.unshift(objects)
  1766. // this.handleSpanTempArr()
  1767. this.getAdviceConfig()
  1768. this.resetForm(formName)
  1769. this.templateFormTwoVisible = false
  1770. this.$message.success('添加成功')
  1771. return false
  1772. }
  1773. })
  1774. }, cancelTableHandleTwo() {
  1775. this.templateTableTwoVisible = false
  1776. this.adviceTableDataTwo = []
  1777. }, cancelEditHandleTwo() {
  1778. this.templateEditFormTwoVisible = false
  1779. }, submitEditTemplateTwo(formName) {
  1780. this.$refs[formName].validate(valid => {
  1781. this.templateFormEdit.single_dose = parseFloat(this.templateFormEdit.single_dose)
  1782. this.templateFormEdit.prescribing_number = parseFloat(this.templateFormEdit.prescribing_number)
  1783. if (isNaN(this.templateFormEdit.single_dose)) {
  1784. this.templateFormEdit.single_dose = 0
  1785. }
  1786. if (isNaN(this.templateFormEdit.prescribing_number)) {
  1787. this.templateFormEdit.prescribing_number = 0
  1788. }
  1789. if (valid) {
  1790. UpdateAdviceTemplate(this.templateFormEdit.id, this.templateFormEdit).then(
  1791. response => {
  1792. if (response.data.state == 0) {
  1793. this.$message.error(response.data.msg)
  1794. return false
  1795. } else {
  1796. this.$message.success('修改成功')
  1797. this.templateEditFormTwoVisible = false
  1798. this.resetForm(formName)
  1799. var template = response.data.data.template
  1800. this.adviceTableDataTwo[this.table_current_index_two].advice_name = template.advice_name
  1801. this.adviceTableDataTwo[this.table_current_index_two].advice_desc = template.advice_desc
  1802. this.adviceTableDataTwo[this.table_current_index_two].drug_spec = template.drug_spec
  1803. this.adviceTableDataTwo[this.table_current_index_two].drug_spec_unit = template.drug_spec_unit
  1804. this.adviceTableDataTwo[this.table_current_index_two].single_dose = template.single_dose
  1805. this.adviceTableDataTwo[this.table_current_index_two].single_dose_unit = template.single_dose_unit
  1806. this.adviceTableDataTwo[this.table_current_index_two].delivery_way = template.delivery_way
  1807. this.adviceTableDataTwo[this.table_current_index_two].execution_frequency = template.execution_frequency
  1808. this.adviceTableDataTwo[this.table_current_index_two].prescribing_number = template.prescribing_number
  1809. this.adviceTableDataTwo[this.table_current_index_two].prescribing_number_unit = template.prescribing_number_unit
  1810. for (let i = 0; i < this.adviceTemplates.length; i++) {
  1811. if (this.adviceTemplates[i].id == this.adviceTableDataTwo[this.table_current_index_two].id) {
  1812. this.adviceTemplates[i].advice_name = template.advice_name
  1813. this.adviceTemplates[i].advice_desc = template.advice_desc
  1814. this.adviceTemplates[i].drug_spec = template.drug_spec
  1815. this.adviceTemplates[i].drug_spec_unit = template.drug_spec_unit
  1816. this.adviceTemplates[i].single_dose = template.single_dose
  1817. this.adviceTemplates[i].single_dose_unit = template.single_dose_unit
  1818. this.adviceTemplates[i].delivery_way = template.delivery_way
  1819. this.adviceTemplates[i].execution_frequency = template.execution_frequency
  1820. this.adviceTemplates[i].prescribing_number = template.prescribing_number
  1821. this.adviceTemplates[i].prescribing_number_unit = template.prescribing_number_unit
  1822. }
  1823. }
  1824. return false
  1825. }
  1826. }
  1827. )
  1828. }
  1829. })
  1830. }, merge({ row, column, rowIndex, columnIndex }) {
  1831. if (columnIndex === 0 || columnIndex === 7) {
  1832. const _row = this.tempArr[rowIndex]
  1833. const _col = _row > 0 ? 1 : 0
  1834. return {
  1835. rowspan: _row,
  1836. colspan: _col
  1837. }
  1838. }
  1839. }, tableRowClassNames({ row, rowIndex }) {
  1840. const arr = this.hoverOrderArr
  1841. for (let i = 0; i < arr.length; i++) {
  1842. if (rowIndex == arr[i]) {
  1843. return 'success-row'
  1844. }
  1845. }
  1846. }, cellMouseEnter: function(row, column, cell, event) {
  1847. if (column.label == '模版名称') {
  1848. this.sameRowArr.forEach((arr, i) => {
  1849. if (arr.indexOf(row.index) != -1) {
  1850. this.hoverOrderArr = arr
  1851. }
  1852. })
  1853. } else if (column.label == '操作') {
  1854. this.sameRowArr.forEach((arr, i) => {
  1855. if (arr.indexOf(row.index) != -1) {
  1856. this.hoverOrderArr = arr
  1857. }
  1858. })
  1859. } else {
  1860. this.hoverOrderArr = []
  1861. }
  1862. }, cellMouseLeave: function(row, column, cell, event) {
  1863. this.hoverOrderArr = []
  1864. }, openEdit(index, row) {
  1865. this.hoverOrderArr = []
  1866. this.currentIndex = index
  1867. this.templateFormEdit.drug_spec_unit = row.drug_spec_unit
  1868. this.templateFormEdit.drug_spec = row.drug_spec
  1869. this.templateFormEdit.advice_desc = row.advice_desc
  1870. this.templateFormEdit.advice_name = row.advice_name
  1871. this.templateFormEdit.delivery_way = row.delivery_way
  1872. this.templateFormEdit.execution_frequency = row.execution_frequency
  1873. this.templateFormEdit.prescribing_number = row.prescribing_number
  1874. this.templateFormEdit.prescribing_number_unit = row.prescribing_number_unit
  1875. this.templateFormEdit.single_dose = row.single_dose
  1876. this.templateFormEdit.single_dose_unit = row.single_dose_unit
  1877. this.templateFormEdit.id = row.id
  1878. this.templateFormEdit.parent_id = row.parent_id
  1879. this.templateEditFormVisible = true
  1880. if (row.parent_id > 0) {
  1881. this.editDialogTitle = '编辑子药'
  1882. this.edit_advice_name = '子药名称'
  1883. } else {
  1884. this.editDialogTitle = '编辑医嘱'
  1885. this.edit_advice_name = '医嘱内容'
  1886. }
  1887. }, openDelete(index, row) {
  1888. this.hoverOrderArr = []
  1889. this.$confirm('删除记录', '是否删除该医嘱', {
  1890. confirmButtonText: '确 定',
  1891. cancelButtonText: '取 消',
  1892. type: 'warning'
  1893. }).then(() => {
  1894. const id = row.id
  1895. const template_id = row.template_id
  1896. const parent_id = row.parent_id
  1897. DeleteAdviceTemplate(id, template_id, parent_id).then(response => {
  1898. if (response.data.state == 0) {
  1899. this.$message.error(response.data.msg)
  1900. return false
  1901. } else {
  1902. this.$message.success('删除成功')
  1903. if (row.parent_id > 0) { // 删除子医嘱
  1904. this.adviceTemplates.splice(index, 1)
  1905. } else { // 如果医嘱下面包含子医嘱,删除医嘱和子医嘱
  1906. // 删除子医嘱
  1907. for (let i = 0; i < this.adviceTemplates.length; i++) {
  1908. if (this.adviceTemplates[i].parent_id == row.id) {
  1909. this.adviceTemplates.splice(i--, 1)
  1910. }
  1911. }
  1912. // 删除医嘱
  1913. this.adviceTemplates.splice(index, 1)
  1914. // 当该模版下没有医嘱的时候,创建一个空模版
  1915. let count = 0 // 用于计数
  1916. for (let i = 0; i < this.adviceTemplates.length; i++) {
  1917. if (this.adviceTemplates[i].template_id == row.template_id) {
  1918. count = count + 1
  1919. }
  1920. }
  1921. if (count == 0) {
  1922. const object = {}
  1923. object['name'] = row.name
  1924. object['isNoSub'] = 1
  1925. object['template_id'] = row.template_id
  1926. this.adviceTemplates.splice(index, 0, object)
  1927. }
  1928. }
  1929. // 处理单元格合并的数据
  1930. this.handleSpanTempArr()
  1931. }
  1932. })
  1933. }).catch(() => {
  1934. })
  1935. }, openDeleteChild(index, row) {
  1936. this.hoverOrderArr = []
  1937. this.$confirm('删除子药', '是否删除该子药', {
  1938. confirmButtonText: '确 定',
  1939. cancelButtonText: '取 消',
  1940. type: 'warning'
  1941. }).then(() => {
  1942. const id = row.id
  1943. const template_id = row.template_id
  1944. const parent_id = row.parent_id
  1945. DeleteAdviceTemplate(id, template_id, parent_id).then(response => {
  1946. if (response.data.state == 0) {
  1947. this.$message.error(response.data.msg)
  1948. return false
  1949. } else {
  1950. this.$message.success('删除成功')
  1951. if (row.parent_id > 0) { // 删除子医嘱
  1952. this.adviceTemplates.splice(index, 1)
  1953. } else { // 如果医嘱下面包含子医嘱,删除医嘱和子医嘱
  1954. // 删除子医嘱
  1955. for (let i = 0; i < this.adviceTemplates.length; i++) {
  1956. if (this.adviceTemplates[i].parent_id == row.id) {
  1957. this.adviceTemplates.splice(i--, 1)
  1958. }
  1959. }
  1960. // 删除医嘱
  1961. this.adviceTemplates.splice(index, 1)
  1962. // 当该模版下没有医嘱的时候,创建一个空模版
  1963. let count = 0 // 用于计数
  1964. for (let i = 0; i < this.adviceTemplates.length; i++) {
  1965. if (this.adviceTemplates[i].template_id == row.template_id) {
  1966. count = count + 1
  1967. }
  1968. }
  1969. if (count == 0) {
  1970. const object = {}
  1971. object['name'] = row.name
  1972. object['isNoSub'] = 1
  1973. object['template_id'] = row.template_id
  1974. this.adviceTemplates.splice(index, 0, object)
  1975. }
  1976. }
  1977. // 处理单元格合并的数据
  1978. this.handleSpanTempArr()
  1979. }
  1980. })
  1981. }).catch(() => {
  1982. })
  1983. },
  1984. openNewChild(index, row) {
  1985. this.hoverOrderArr = []
  1986. this.current_template_id = row.template_id
  1987. this.parent_id = row.id
  1988. this.isAddChild = true
  1989. this.isEdit = false
  1990. this.templateFormVisible = true
  1991. this.dialogTitle = '新增子药'
  1992. this.advice_content_name = '子药名称'
  1993. }, deleteRecordAction: function() {
  1994. if (this.table_current_index == -1) {
  1995. this.$message.error('请选择一条医嘱记录')
  1996. return
  1997. }
  1998. this.$confirm('删除记录', '是否删除该医嘱记录', {
  1999. confirmButtonText: '确 定',
  2000. cancelButtonText: '取 消',
  2001. type: 'warning'
  2002. }).then(() => {
  2003. this.adviceTableData.splice(this.table_current_index, 1)
  2004. this.table_current_index = -1
  2005. }).catch(() => {
  2006. })
  2007. }, handleSpanTempArr() {
  2008. this.tempArr = []
  2009. for (let i = 0; i < this.adviceTemplates.length; i++) {
  2010. if (i === 0) {
  2011. this.tempArr.push(1)
  2012. this.pos = 0
  2013. } else {
  2014. // 判断当前元素与上一个元素是否相同
  2015. if (this.adviceTemplates[i].template_id === this.adviceTemplates[i - 1].template_id) {
  2016. this.tempArr[this.pos] += 1
  2017. this.tempArr.push(0)
  2018. } else {
  2019. this.tempArr.push(1)
  2020. this.pos = i
  2021. }
  2022. }
  2023. }
  2024. let sameRowArr = [], sIdx = 0
  2025. this.adviceTemplates.forEach((item, index) => {
  2026. item.index = index
  2027. if (index === 0) {
  2028. sameRowArr.push([index])
  2029. } else {
  2030. if (item.template_id === this.adviceTemplates[index - 1].template_id) {
  2031. sameRowArr[sIdx].push(index)
  2032. } else {
  2033. sIdx = sIdx + 1
  2034. sameRowArr.push([index])
  2035. }
  2036. }
  2037. })
  2038. this.sameRowArr = sameRowArr
  2039. }, handleUpdateAdviceTemplate(row, index) {
  2040. this.current_template_id = row.template_id
  2041. this.current_template_name = row.name
  2042. this.form.name = row.name
  2043. this.templateTableTwoVisible = true
  2044. this.adviceTableDataTwo = []
  2045. for (let i = 0; i < this.adviceTemplates.length; i++) {
  2046. if (this.adviceTemplates[i].template_id == row.template_id) {
  2047. this.adviceTableDataTwo.push(this.adviceTemplates[i])
  2048. }
  2049. }
  2050. }, modifyTemplateName() {
  2051. const params = {
  2052. template_name: this.form.name,
  2053. template_id: this.current_template_id
  2054. }
  2055. updateTemplateName(params).then(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.templateTableTwoVisible = false
  2062. for (let i = 0; i < this.adviceTemplates.length; i++) {
  2063. if (this.adviceTemplates[i].template_id == this.current_template_id) {
  2064. this.adviceTemplates[i].name = response.data.data.template_name
  2065. }
  2066. }
  2067. }
  2068. })
  2069. }
  2070. }
  2071. }
  2072. </script>
  2073. <style>
  2074. .templateadvicenamedisplay .cell {
  2075. float: left;
  2076. text-align: left;
  2077. }
  2078. </style>