Elizabeth's proactive approach involves introducing urinal toilet attachment , an ingenious concept that optimizes space and functionality.

druguse.vue 34KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980
  1. <template>
  2. <div class="main-contain">
  3. <div class="position">
  4. <bread-crumb :crumbs='crumbs'></bread-crumb>
  5. </div>
  6. <div class="tab-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')}}</el-button>
  19. </div>
  20. <el-table
  21. :data="adviceTemplates"
  22. v-loading="listLoading"
  23. border
  24. fit
  25. :header-cell-style="{ backgroundColor: 'rgb(245, 247, 250)'}"
  26. highlight-current-row
  27. style="width: 100%;min-height:500px;"
  28. >
  29. <el-table-column align="center" label="医嘱名称">
  30. <template slot-scope="scope">
  31. <span>{{scope.row.advice_name}}</span>
  32. </template>
  33. </el-table-column>
  34. <!-- <el-table-column align="center" label="医嘱内容">
  35. <template slot-scope="scope">
  36. <span>{{scope.row.advice_desc}}</span>
  37. </template>
  38. </el-table-column> -->
  39. <el-table-column align="center" label="单次用量">
  40. <template slot-scope="scope">
  41. <span>{{scope.row.single_dose}} {{scope.row.single_dose_unit}}</span>
  42. </template>
  43. </el-table-column>
  44. <el-table-column align="center" label="开药数量">
  45. <template slot-scope="scope">
  46. <span>{{scope.row.prescribing_number}} {{scope.row.prescribing_number_unit}}</span>
  47. </template>
  48. </el-table-column>
  49. <el-table-column align="center" label="给药途径">
  50. <template slot-scope="scope">
  51. <span>{{scope.row.delivery_way}}</span>
  52. </template>
  53. </el-table-column>
  54. <el-table-column align="center" label="执行频率">
  55. <template slot-scope="scope">
  56. <span>{{scope.row.execution_frequency}}</span>
  57. </template>
  58. </el-table-column>
  59. <el-table-column
  60. align="center"
  61. :label="$t('table.actions')"
  62. width="230"
  63. class-name="small-padding fixed-width"
  64. >
  65. <template slot-scope="scope">
  66. <el-button
  67. type="primary"
  68. size="small"
  69. icon="el-icon-edit-outline"
  70. @click="handleUpdateAdviceTemplate(scope.row, scope.$index)"
  71. ></el-button>
  72. <el-button
  73. v-if="scope.row.status!='deleted'"
  74. size="small"
  75. type="danger"
  76. icon="el-icon-delete"
  77. @click="handleDeleteAdviceTemplate(scope.row, scope.$index)"
  78. ></el-button>
  79. </template>
  80. </el-table-column>
  81. </el-table>
  82. <el-dialog :title="dialogTitle" :visible.sync="templateFormVisible" width="700px">
  83. <el-form
  84. ref="templateForm"
  85. :rules="templateRules"
  86. :model="templateForm"
  87. label-width="90px"
  88. >
  89. <el-row>
  90. <el-col :span="12">
  91. <el-form-item label="医嘱名称 :" required prop="advice_name">
  92. <el-input v-model="templateForm.advice_name" style="width:50%"></el-input>
  93. </el-form-item>
  94. </el-col>
  95. <!-- <el-form-item label="医嘱内容 :" prop="advice_desc">
  96. <el-input v-model="templateForm.advice_desc" style="width:50%"></el-input>
  97. </el-form-item> -->
  98. <el-col :span="12">
  99. <el-form-item label="单次用量 :" prop="single_dose">
  100. <el-col :span="8">
  101. <el-input v-model="templateForm.single_dose"></el-input>
  102. </el-col>
  103. <el-col class="line" :span="2">&nbsp;</el-col>
  104. <el-col :span="14">
  105. <el-select
  106. v-model="templateForm.single_dose_unit"
  107. filterable
  108. clearable
  109. allow-create
  110. placeholder="选择"
  111. >
  112. <el-option
  113. v-for="item in unitsOption"
  114. :key="item.id"
  115. :label="item.name "
  116. :value="item.name"
  117. ></el-option>
  118. </el-select>
  119. </el-col>
  120. </el-form-item>
  121. </el-col>
  122. </el-row>
  123. <el-row>
  124. <el-col :span="12">
  125. <el-form-item label="开药数量 :" prop="prescribing_number">
  126. <el-col :span="8">
  127. <el-input v-model="templateForm.prescribing_number"></el-input>
  128. </el-col>
  129. <el-col class="line" :span="2">&nbsp;</el-col>
  130. <el-col :span="14">
  131. <el-select
  132. v-model="templateForm.prescribing_number_unit"
  133. filterable
  134. clearable
  135. allow-create
  136. placeholder="选择"
  137. >
  138. <el-option
  139. v-for="item in unitsOption"
  140. :key="item.id"
  141. :label="item.name "
  142. :value="item.name"
  143. ></el-option>
  144. </el-select>
  145. </el-col>
  146. </el-form-item>
  147. </el-col>
  148. <el-col :span="12">
  149. <el-form-item label="给药途径 :" prop="delivery_way">
  150. <el-select
  151. v-model="templateForm.delivery_way"
  152. filterable
  153. clearable
  154. allow-create
  155. placeholder="请选择(输入可搜索)"
  156. style="width:100%"
  157. >
  158. <el-option
  159. v-for="item in drugways"
  160. :key="item.id"
  161. :label="item.name "
  162. :value="item.name"
  163. ></el-option>
  164. </el-select>
  165. </el-form-item>
  166. </el-col>
  167. </el-row>
  168. <el-row>
  169. <el-col :span="12">
  170. <el-form-item label="执行频率 :" prop="execution_frequency">
  171. <el-select
  172. v-model="templateForm.execution_frequency"
  173. clearable
  174. allow-create
  175. filterable
  176. placeholder="请选择(输入可搜索)"
  177. style="width:100%"
  178. >
  179. <el-option
  180. v-for="item in executionFrequencyOptions"
  181. :key="item.id"
  182. :label="item.name"
  183. :value="item.name"
  184. ></el-option>
  185. </el-select>
  186. </el-form-item>
  187. </el-col>
  188. </el-row>
  189. </el-form>
  190. <div slot="footer" class="dialog-footer">
  191. <el-button @click="templateFormVisible = false">取消</el-button>
  192. <el-button type="primary" @click="submitTemplate('templateForm')">保 存</el-button>
  193. </div>
  194. </el-dialog>
  195. <el-dialog :title="dialogTitle" :visible.sync="drugdicFormVisible" width="700px">
  196. <el-form
  197. ref="drugdicForm"
  198. :rules="drugdicRules"
  199. :model="drugdicForm"
  200. label-width="90px"
  201. >
  202. <el-form-item label="医嘱名称 :" required prop="name">
  203. <el-input v-model="drugdicForm.name" style="width:50%" placeholder="如:阿莫西林"></el-input>
  204. </el-form-item>
  205. <el-form-item label="医嘱内容 :" prop="spec">
  206. <el-input v-model="drugdicForm.spec" style="width:50%" placeholder="如:10克x9袋"></el-input>
  207. </el-form-item>
  208. <el-form-item label="医嘱类型 :" prop="form">
  209. <el-select
  210. v-model="drugdicForm.form"
  211. clearable
  212. allow-create
  213. filterable
  214. placeholder="请选择(输入可搜索)"
  215. >
  216. <el-option
  217. :label="item.name"
  218. :key="item.label"
  219. :value="item.name"
  220. v-for="item in drugforms"
  221. ></el-option>
  222. </el-select>
  223. </el-form-item>
  224. <el-row>
  225. <el-col :span="12">
  226. <el-form-item label="单次单位 :" prop="spec_unit">
  227. <el-select
  228. v-model="drugdicForm.spec_unit"
  229. clearable
  230. allow-create
  231. filterable
  232. placeholder="选择(输入可搜索)"
  233. >
  234. <el-option
  235. v-for="item in unitsOption"
  236. :key="item.label"
  237. :label="item.name "
  238. :value="item.name"
  239. ></el-option>
  240. </el-select>
  241. </el-form-item>
  242. </el-col>
  243. <el-col :span="12">
  244. <el-form-item label="开药单位 :" prop="form_unit">
  245. <el-select
  246. v-model="drugdicForm.form_unit"
  247. clearable
  248. allow-create
  249. filterable
  250. placeholder="选择(输入可搜索)"
  251. >
  252. <el-option
  253. v-for="item in unitsOption"
  254. :key="item.label"
  255. :label="item.name "
  256. :value="item.name"
  257. ></el-option>
  258. </el-select>
  259. </el-form-item>
  260. </el-col>
  261. </el-row>
  262. </el-form>
  263. <div slot="footer" class="dialog-footer">
  264. <el-button @click="drugdicFormVisible = false">取消</el-button>
  265. <el-button type="primary" @click="submitDrugDic('drugdicForm')">保 存</el-button>
  266. </div>
  267. </el-dialog>
  268. </div>
  269. </el-tab-pane>
  270. <el-tab-pane label="给药途径">
  271. <div class="app-container">
  272. <div class="filter-container">
  273. <el-button
  274. class="filter-item"
  275. style="margin-left: 10px;"
  276. @click="handleCreateDrugWay"
  277. type="primary"
  278. size="small"
  279. icon="el-icon-circle-plus-outline"
  280. >{{$t('table.add')}}</el-button>
  281. </div>
  282. <el-table
  283. :data="drugways"
  284. v-loading="listLoading"
  285. border
  286. fit
  287. highlight-current-row
  288. style="width: 100%;min-height:500px;"
  289. >
  290. <el-table-column align="center" label="名称">
  291. <template slot-scope="scope">
  292. <span>{{scope.row.name}}</span>
  293. </template>
  294. </el-table-column>
  295. <el-table-column
  296. align="center"
  297. :label="$t('table.actions')"
  298. width="230"
  299. class-name="small-padding fixed-width"
  300. >
  301. <template slot-scope="scope">
  302. <el-button type="text" size="mini" v-show="scope.row.org_id==0" disabled>系统设定</el-button>
  303. <el-button
  304. v-show="scope.row.org_id!=0"
  305. type="primary"
  306. size="small"
  307. icon="el-icon-edit-outline"
  308. @click="handleUpdateDrugWay(scope.row, scope.$index)"
  309. ></el-button>
  310. <el-button
  311. v-show="scope.row.org_id!=0"
  312. size="small"
  313. type="danger"
  314. icon="el-icon-delete"
  315. @click="handleDeleteDrugWay(scope.row, scope.$index)"
  316. ></el-button>
  317. </template>
  318. </el-table-column>
  319. </el-table>
  320. <el-dialog :title="dialogTitle" :visible.sync="drugwayFormVisible" width="700px">
  321. <el-form
  322. ref="drugwayForm"
  323. :rules="drugwayRules"
  324. :model="drugwayForm"
  325. label-width="90px"
  326. >
  327. <el-form-item label="给药途径 :" required prop="name">
  328. <el-input v-model="drugwayForm.name" placeholder="给药途径"></el-input>
  329. </el-form-item>
  330. </el-form>
  331. <div slot="footer" class="dialog-footer">
  332. <el-button @click="drugwayFormVisible = false">取消</el-button>
  333. <el-button type="primary" @click="submitDrugWay('drugwayForm')">保 存</el-button>
  334. </div>
  335. </el-dialog>
  336. </div>
  337. </el-tab-pane>
  338. <el-tab-pane label="执行频率">
  339. <div class="">
  340. <div class="filter-container">
  341. <el-button
  342. class="filter-item"
  343. style="margin-left: 10px;"
  344. @click="handleCreateEF"
  345. type="primary"
  346. size="small"
  347. icon="el-icon-circle-plus-outline"
  348. >{{$t('table.add')}}</el-button>
  349. </div>
  350. <el-table
  351. :data="executionFrequencyOptions"
  352. v-loading="listLoading"
  353. border
  354. fit
  355. highlight-current-row
  356. style="width: 100%;min-height:500px;"
  357. :header-cell-style="{ backgroundColor: 'rgb(245, 247, 250)'}"
  358. >
  359. <el-table-column align="center" label="名称">
  360. <template slot-scope="scope">
  361. <span>{{scope.row.name}}</span>
  362. </template>
  363. </el-table-column>
  364. <el-table-column
  365. align="center"
  366. :label="$t('table.actions')"
  367. width="230"
  368. class-name="small-padding fixed-width"
  369. >
  370. <template slot-scope="scope">
  371. <el-button type="text" size="mini" v-show="scope.row.org_id==0" disabled>系统设定</el-button>
  372. <el-button
  373. v-show="scope.row.org_id!=0"
  374. type="primary"
  375. size="small"
  376. icon="el-icon-edit-outline"
  377. @click="handleUpdateEF(scope.row, scope.$index)"
  378. ></el-button>
  379. <el-button
  380. v-show="scope.row.org_id!=0"
  381. size="small"
  382. type="danger"
  383. icon="el-icon-delete"
  384. @click="handleDeleteEF(scope.row, scope.$index)"
  385. ></el-button>
  386. </template>
  387. </el-table-column>
  388. </el-table>
  389. <el-dialog :title="dialogTitle" :visible.sync="efFormVisible" width="700px">
  390. <el-form ref="efForm" :rules="efRules" :model="efForm" label-width="90px">
  391. <el-form-item label="执行频率 :" required prop="name">
  392. <el-input v-model="efForm.name" placeholder="执行频率"></el-input>
  393. <el-input v-model="efForm.code" placeholder="编码"></el-input>
  394. </el-form-item>
  395. </el-form>
  396. <div slot="footer" class="dialog-footer">
  397. <el-button @click="efFormVisible = false">取 消</el-button>
  398. <el-button type="primary" @click="submitEF('efForm')">保 存</el-button>
  399. </div>
  400. </el-dialog>
  401. </div>
  402. </el-tab-pane>
  403. </el-tabs>
  404. </div>
  405. </template>
  406. <script>
  407. import {
  408. getAdviceConfig,
  409. CreateDrugDic,
  410. UpdateDrugDic,
  411. DeleteDrugDic,
  412. CreateDrugWay,
  413. UpdateDrugWay,
  414. DeleteDrugWay,
  415. CreateExecutionFrequency,
  416. UpdateExecutionFrequency,
  417. DeleteExecutionFrequency,
  418. CreateAdviceTemplate,
  419. UpdateAdviceTemplate,
  420. DeleteAdviceTemplate
  421. } from "@/api/advice";
  422. import BreadCrumb from "@/xt_pages/components/bread-crumb";
  423. export default {
  424. name: "tab",
  425. components: {BreadCrumb},
  426. data() {
  427. return {
  428. crumbs: [
  429. { path: false, name: '数据字典' },
  430. { path: '/patients/patients', name: '字段配置' },
  431. ],
  432. currentIndex: -1,
  433. isEdit: false,
  434. dialogTitle: "",
  435. drugdicFormVisible: false,
  436. drugwayFormVisible: false,
  437. templateFormVisible: false,
  438. efFormVisible: false,
  439. listLoading: true,
  440. activeName: "drugdic",
  441. createdTimes: 0,
  442. drugdics: [],
  443. adviceTemplates:[],
  444. drugways: [],
  445. executionFrequencyOptions: [],
  446. drugdicRules: {
  447. name: [{ required: true, message: "请填写医嘱名称" }]
  448. },
  449. drugwayRules: {
  450. name: [{ required: true, message: "请填写给药途径" }]
  451. },
  452. efRules: {
  453. name: [{ required: true, message: "请填写执行频率" }]
  454. },
  455. templateRules: {
  456. advice_name: [{ required: true, message: "请填写医嘱名称" }]
  457. },
  458. templateForm: {
  459. advice_name: "",
  460. advice_desc: "",
  461. single_dose: "",
  462. single_dose_unit: "",
  463. prescribing_number: "",
  464. prescribing_number_unit: "",
  465. delivery_way: "",
  466. execution_frequency: "",
  467. id: 0
  468. },
  469. drugdicForm: {
  470. name: "",
  471. spec: "",
  472. spec_unit: "",
  473. form: "",
  474. form_unit: "",
  475. id: 0
  476. },
  477. drugwayForm: {
  478. name: "",
  479. id: 0,
  480. code:"",
  481. },
  482. efForm: {
  483. name: "",
  484. id: 0,
  485. code:"",
  486. },
  487. unitsOption: [
  488. { lable: 1, name: "盒" },
  489. { lable: 2, name: "支" },
  490. { lable: 3, name: "瓶" },
  491. { lable: 4, name: "片" },
  492. { lable: 5, name: "袋" },
  493. { lable: 6, name: "g" },
  494. { lable: 7, name: "mg" },
  495. { lable: 8, name: "u" },
  496. { lable: 9, name: "ml" },
  497. { lable: 10, name: "枚" },
  498. { lable: 11, name: "粒" },
  499. { lable: 12, name: "μg" },
  500. { lable: 13, name: "iu" },
  501. { lable: 14, name: "包" },
  502. { lable: 15, name: "丸" }
  503. ],
  504. drugforms: [
  505. { lable: 1, name: "胶囊" },
  506. { lable: 2, name: "注射剂" },
  507. { lable: 3, name: "片剂" },
  508. { lable: 4, name: "注射液" },
  509. { lable: 5, name: "栓剂" },
  510. { lable: 6, name: "膏" },
  511. { lable: 7, name: "颗粒剂" },
  512. { lable: 8, name: "粉剂" },
  513. { lable: 9, name: "口服液" },
  514. { lable: 10, name: "干混悬剂" },
  515. { lable: 11, name: "丸剂" },
  516. { lable: 12, name: "气雾剂" },
  517. { lable: 13, name: "内服溶液" },
  518. { lable: 14, name: "外用溶液" },
  519. { lable: 15, name: "软膏剂" },
  520. { lable: 16, name: "胶剂" }
  521. ]
  522. };
  523. },
  524. created() {
  525. this.getAdviceConfig();
  526. },
  527. methods: {
  528. showCreatedTimes() {
  529. this.createdTimes = this.createdTimes + 1;
  530. },
  531. handleUpdateDrugDic(row, index) {
  532. this.currentIndex = index;
  533. this.drugdicForm = {
  534. name: row.name,
  535. spec: row.spec,
  536. spec_unit: row.spec_unit,
  537. form: row.form,
  538. form_unit: row.form_unit,
  539. id: row.id
  540. };
  541. this.drugdicFormVisible = true;
  542. this.dialogTitle = "编辑医嘱模版";
  543. this.isEdit = true;
  544. },
  545. handleCreateDrugDic() {
  546. this.drugdicForm = {
  547. name: "",
  548. spec: "",
  549. spec_unit: "",
  550. form: "",
  551. form_unit: "",
  552. id: 0
  553. };
  554. this.drugdicFormVisible = true;
  555. this.dialogTitle = "新增医嘱模版";
  556. this.isEdit = false;
  557. },
  558. handleCreateTemplate() {
  559. this.templateForm = {
  560. advice_name: "",
  561. advice_desc: "",
  562. single_dose: "",
  563. single_dose_unit: "",
  564. prescribing_number: "",
  565. prescribing_number_unit: "",
  566. delivery_way: "",
  567. execution_frequency: "",
  568. id: 0
  569. };
  570. this.templateFormVisible = true;
  571. this.dialogTitle = "新增医嘱模版";
  572. this.isEdit = false;
  573. },
  574. handleUpdateAdviceTemplate(row, index){
  575. this.templateForm = {
  576. advice_name: row.advice_name,
  577. advice_desc: row.advice_desc,
  578. single_dose: row.single_dose,
  579. single_dose_unit: row.single_dose_unit,
  580. prescribing_number: row.prescribing_number,
  581. prescribing_number_unit: row.prescribing_number_unit,
  582. delivery_way: row.delivery_way,
  583. execution_frequency: row.execution_frequency,
  584. id: row.id,
  585. };
  586. this.templateFormVisible = true;
  587. this.dialogTitle = "编辑医嘱模版";
  588. this.isEdit = true;
  589. this.currentIndex = index;
  590. },
  591. resetForm(formName) {
  592. this.$refs[formName].resetFields();
  593. },
  594. handleDeleteDrugDic(row, index) {
  595. this.$confirm("确认删除此医嘱模板?", "删除", {
  596. confirmButtonText: "确 定",
  597. cancelButtonText: "取 消",
  598. type: "warning"
  599. })
  600. .then(() => {
  601. DeleteDrugDic(row.id).then(response => {
  602. if (response.data.state == 0) {
  603. this.$message.error(response.data.msg);
  604. return false;
  605. } else {
  606. this.$notify({
  607. title: "成功",
  608. message: "医嘱模板已经删除",
  609. type: "success",
  610. duration: 2000
  611. });
  612. this.drugdics.splice(index, 1);
  613. }
  614. });
  615. })
  616. .catch(() => {});
  617. },
  618. handleDeleteAdviceTemplate(row, index) {
  619. this.$confirm("确认删除此医嘱模板?", "删除", {
  620. confirmButtonText: "确 定",
  621. cancelButtonText: "取 消",
  622. type: "warning"
  623. })
  624. .then(() => {
  625. DeleteAdviceTemplate(row.id).then(response => {
  626. if (response.data.state == 0) {
  627. this.$message.error(response.data.msg);
  628. return false;
  629. } else {
  630. this.$notify({
  631. title: "成功",
  632. message: "医嘱模板已经删除",
  633. type: "success",
  634. duration: 2000
  635. });
  636. this.adviceTemplates.splice(index, 1);
  637. }
  638. });
  639. })
  640. .catch(() => {});
  641. },
  642. submitDrugDic(formName) {
  643. this.$refs[formName].validate(valid => {
  644. if (valid) {
  645. if (this.isEdit) {
  646. UpdateDrugDic(this.drugdicForm.id, this.drugdicForm).then(
  647. response => {
  648. if (response.data.state == 0) {
  649. this.$message.error(response.data.msg);
  650. return false;
  651. } else {
  652. this.$notify({
  653. title: "成功",
  654. message: "修改成功",
  655. type: "success",
  656. duration: 2000
  657. });
  658. this.drugdicFormVisible = false;
  659. this.resetForm(formName);
  660. var drugdic = response.data.data.drugdic;
  661. this.drugdics[this.currentIndex].name = drugdic.name;
  662. this.drugdics[this.currentIndex].spec = drugdic.spec;
  663. this.drugdics[this.currentIndex].spec_unit =
  664. drugdic.spec_unit;
  665. this.drugdics[this.currentIndex].form = drugdic.form;
  666. this.drugdics[this.currentIndex].form_unit =
  667. drugdic.form_unit;
  668. this.drugdics[this.currentIndex].updated_time =
  669. drugdic.updated_time;
  670. this.currentIndex = -1;
  671. return false;
  672. }
  673. }
  674. );
  675. } else {
  676. CreateDrugDic(this.drugdicForm).then(response => {
  677. if (response.data.state == 0) {
  678. this.$message.error(response.data.msg);
  679. return false;
  680. } else {
  681. this.$notify({
  682. title: "成功",
  683. message: "添加成功",
  684. type: "success",
  685. duration: 2000
  686. });
  687. this.drugdicFormVisible = false;
  688. this.resetForm(formName);
  689. this.drugdics.unshift(response.data.data.drugdic);
  690. return false;
  691. }
  692. });
  693. }
  694. }
  695. });
  696. },
  697. submitTemplate(formName){
  698. this.$refs[formName].validate(valid => {
  699. this.templateForm.single_dose = parseFloat(this.templateForm.single_dose);
  700. this.templateForm.prescribing_number = parseFloat(this.templateForm.prescribing_number);
  701. if(isNaN(this.templateForm.single_dose)) {
  702. this.templateForm.single_dose = 0;
  703. }
  704. if(isNaN(this.templateForm.prescribing_number)) {
  705. this.templateForm.prescribing_number = 0;
  706. }
  707. if (valid) {
  708. if (this.isEdit) {
  709. UpdateAdviceTemplate(this.templateForm.id, this.templateForm).then(
  710. response => {
  711. if (response.data.state == 0) {
  712. this.$message.error(response.data.msg);
  713. return false;
  714. } else {
  715. this.$notify({
  716. title: "成功",
  717. message: "修改成功",
  718. type: "success",
  719. duration: 2000
  720. });
  721. this.templateFormVisible = false;
  722. this.resetForm(formName);
  723. var template = response.data.data.template;
  724. this.adviceTemplates[this.currentIndex].advice_name = template.advice_name;
  725. this.adviceTemplates[this.currentIndex].advice_desc = template.advice_desc;
  726. this.adviceTemplates[this.currentIndex].single_dose = template.single_dose;
  727. this.adviceTemplates[this.currentIndex].single_dose_unit = template.single_dose_unit;
  728. this.adviceTemplates[this.currentIndex].delivery_way = template.delivery_way;
  729. this.adviceTemplates[this.currentIndex].execution_frequency = template.execution_frequency;
  730. this.adviceTemplates[this.currentIndex].prescribing_number = template.prescribing_number;
  731. this.adviceTemplates[this.currentIndex].prescribing_number_unit = template.prescribing_number_unit;
  732. this.currentIndex = -1;
  733. return false;
  734. }
  735. }
  736. );
  737. } else {
  738. CreateAdviceTemplate(this.templateForm).then(response => {
  739. if (response.data.state == 0) {
  740. this.$message.error(response.data.msg);
  741. return false;
  742. } else {
  743. this.$notify({
  744. title: "成功",
  745. message: "添加成功",
  746. type: "success",
  747. duration: 2000
  748. });
  749. this.templateFormVisible = false;
  750. this.resetForm(formName);
  751. this.adviceTemplates.unshift(response.data.data.template);
  752. return false;
  753. }
  754. });
  755. }
  756. }
  757. });
  758. },
  759. handleCreateDrugWay() {
  760. this.drugwayForm = {
  761. name: "",
  762. id: 0,
  763. code:"",
  764. };
  765. this.drugwayFormVisible = true;
  766. this.dialogTitle = "新增给药途径";
  767. this.isEdit = false;
  768. },
  769. handleUpdateDrugWay(row, index) {
  770. console.log(row)
  771. this.currentIndex = index;
  772. this.drugwayForm = {
  773. name: row.name,
  774. id: row.id,
  775. code:row.code,
  776. };
  777. this.drugwayFormVisible = true;
  778. this.dialogTitle = "编辑给药途径";
  779. this.isEdit = true;
  780. },
  781. submitDrugWay(formName) {
  782. this.$refs[formName].validate(valid => {
  783. if (valid) {
  784. if (this.isEdit) {
  785. UpdateDrugWay(this.drugwayForm.id, this.drugwayForm).then(
  786. response => {
  787. if (response.data.state == 0) {
  788. this.$message.error(response.data.msg);
  789. return false;
  790. } else {
  791. this.$notify({
  792. title: "成功",
  793. message: "修改成功",
  794. type: "success",
  795. duration: 2000
  796. });
  797. this.drugwayFormVisible = false;
  798. this.resetForm(formName);
  799. var drugway = response.data.data.drugway;
  800. this.drugways[this.currentIndex].name = drugway.name;
  801. this.drugways[this.currentIndex].code = drugway.code;
  802. this.drugways[this.currentIndex].updated_time = drugway.updated_time;
  803. this.currentIndex = -1;
  804. return false;
  805. }
  806. }
  807. );
  808. } else {
  809. CreateDrugWay(this.drugwayForm).then(response => {
  810. if (response.data.state == 0) {
  811. this.$message.error(response.data.msg);
  812. return false;
  813. } else {
  814. this.$notify({
  815. title: "成功",
  816. message: "添加成功",
  817. type: "success",
  818. duration: 2000
  819. });
  820. this.drugwayFormVisible = false;
  821. this.resetForm(formName);
  822. this.drugways.unshift(response.data.data.drugway);
  823. return false;
  824. }
  825. });
  826. }
  827. }
  828. });
  829. },
  830. handleDeleteDrugWay(row, index) {
  831. this.$confirm("确认删除此给药途径?", "删除", {
  832. confirmButtonText: "确 定",
  833. cancelButtonText: "取 消",
  834. type: "warning"
  835. })
  836. .then(() => {
  837. DeleteDrugWay(row.id).then(response => {
  838. if (response.data.state == 0) {
  839. this.$message.error(response.data.msg);
  840. return false;
  841. } else {
  842. this.$notify({
  843. title: "成功",
  844. message: "给药途径已经删除",
  845. type: "success",
  846. duration: 2000
  847. });
  848. this.drugways.splice(index, 1);
  849. }
  850. });
  851. })
  852. .catch(() => {});
  853. },
  854. handleCreateEF() {
  855. this.efForm = {
  856. name: "",
  857. id: 0
  858. };
  859. this.efFormVisible = true;
  860. this.dialogTitle = "新增执行频率";
  861. this.isEdit = false;
  862. },
  863. handleUpdateEF(row, index) {
  864. this.currentIndex = index;
  865. this.efForm = {
  866. name: row.name,
  867. id: row.id
  868. };
  869. this.efFormVisible = true;
  870. this.dialogTitle = "编辑执行频率";
  871. this.isEdit = true;
  872. },
  873. submitEF(formName) {
  874. this.$refs[formName].validate(valid => {
  875. if (valid) {
  876. if (this.isEdit) {
  877. UpdateExecutionFrequency(this.efForm.id, this.efForm).then(
  878. response => {
  879. if (response.data.state == 0) {
  880. this.$message.error(response.data.msg);
  881. return false;
  882. } else {
  883. this.$notify({
  884. title: "成功",
  885. message: "修改成功",
  886. type: "success",
  887. duration: 2000
  888. });
  889. this.efFormVisible = false;
  890. this.resetForm(formName);
  891. var ef = response.data.data.ef;
  892. this.executionFrequencyOptions[this.currentIndex].name =
  893. ef.name;
  894. this.executionFrequencyOptions[
  895. this.currentIndex
  896. ].updated_time = ef.updated_time;
  897. this.currentIndex = -1;
  898. return false;
  899. }
  900. }
  901. );
  902. } else {
  903. CreateExecutionFrequency(this.efForm).then(response => {
  904. if (response.data.state == 0) {
  905. this.$message.error(response.data.msg);
  906. return false;
  907. } else {
  908. this.$notify({
  909. title: "成功",
  910. message: "添加成功",
  911. type: "success",
  912. duration: 2000
  913. });
  914. this.efFormVisible = false;
  915. this.resetForm(formName);
  916. this.executionFrequencyOptions.unshift(response.data.data.ef);
  917. return false;
  918. }
  919. });
  920. }
  921. }
  922. });
  923. },
  924. handleDeleteEF(row, index) {
  925. this.$confirm("确认删除此执行频率?", "删除", {
  926. confirmButtonText: "确 定",
  927. cancelButtonText: "取 消",
  928. type: "warning"
  929. })
  930. .then(() => {
  931. DeleteExecutionFrequency(row.id).then(response => {
  932. if (response.data.state == 0) {
  933. this.$message.error(response.data.msg);
  934. return false;
  935. } else {
  936. this.$notify({
  937. title: "成功",
  938. message: "执行频率已经删除",
  939. type: "success",
  940. duration: 2000
  941. });
  942. this.executionFrequencyOptions.splice(index, 1);
  943. }
  944. });
  945. })
  946. .catch(() => {});
  947. },
  948. getAdviceConfig() {
  949. getAdviceConfig().then(response => {
  950. if (response.data.state == 1) {
  951. this.drugways = response.data.data.drugways;
  952. this.executionFrequencyOptions = response.data.data.efs;
  953. this.drugdics = response.data.data.drugs;
  954. this.adviceTemplates = response.data.data.advice_templates;
  955. this.listLoading = false;
  956. }
  957. });
  958. }
  959. }
  960. };
  961. </script>
  962. <style scoped>
  963. .tab-container {
  964. margin: 30px;
  965. }
  966. </style>