血透系统PC前端

druguseTemplate.vue 87KB

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