血透系统PC前端

druguseTemplate.vue 101KB

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