血透系统PC前端

druguseTemplate.vue 86KB

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