血透系统PC前端

druguseTemplate.vue 86KB

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