血透系统PC前端

druguseTemplate.vue 87KB

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