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

AddGroupAdvice.vue 62KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705
  1. <template>
  2. <div id="user-edit-group-advice">
  3. <el-dialog
  4. title="新增医嘱"
  5. :visible.sync="groupAddFormVisible"
  6. width="700px"
  7. >
  8. <el-form
  9. ref="groupForm"
  10. :rules="groupRules"
  11. :model="groupForm"
  12. label-width="90px"
  13. >
  14. <el-row>
  15. <el-col :span="12">
  16. <el-form-item label="医嘱类型 :" required prop="advice_type">
  17. <el-input value="临时" disabled></el-input>
  18. </el-form-item>
  19. </el-col>
  20. <el-col :span="12">
  21. <el-form-item
  22. label="开始时间 :"
  23. required
  24. prop="start_time"
  25. style="width:100%;"
  26. >
  27. <el-date-picker
  28. type="datetime"
  29. format="yyyy-MM-dd HH:mm"
  30. value-format="yyyy-MM-dd HH:mm"
  31. placeholder="选择时间"
  32. v-model="groupForm.start_time"
  33. style="width:100%;"
  34. ></el-date-picker>
  35. </el-form-item>
  36. </el-col>
  37. </el-row>
  38. <el-form-item label="备注 :">
  39. <el-input type="textarea" v-model="groupForm.remark"></el-input>
  40. </el-form-item>
  41. <el-row>
  42. <el-col :span="12">
  43. <el-form-item label="开嘱医生 :">
  44. <span>{{ adminusername }} </span>
  45. </el-form-item>
  46. </el-col>
  47. <el-col :span="12">
  48. <el-form-item label="开嘱时间 :">
  49. <span>{{ groupForm.advice_date }} </span>
  50. </el-form-item>
  51. </el-col>
  52. </el-row>
  53. <el-row>
  54. <el-col :span="2">
  55. &nbsp;&nbsp;
  56. </el-col>
  57. <el-col :span="5">
  58. <el-button
  59. :disabled="
  60. $store.getters.xt_user.subscibe.state == 3 ? true : false
  61. "
  62. round
  63. @click="openAdviceTemplate()"
  64. >选择医嘱模板
  65. </el-button>
  66. </el-col>
  67. <el-col :span="5">
  68. <el-button
  69. :disabled="
  70. $store.getters.xt_user.subscibe.state == 3 ? true : false
  71. "
  72. round
  73. @click="openGroupAdvice(0)"
  74. >新增医嘱内容
  75. </el-button>
  76. </el-col>
  77. <el-col :span="5">
  78. <el-button
  79. :disabled="
  80. $store.getters.xt_user.subscibe.state == 3 ? true : false
  81. "
  82. round
  83. @click="openGroupAdvice(1)"
  84. >修改医嘱内容
  85. </el-button>
  86. </el-col>
  87. <el-col :span="5">
  88. <el-button
  89. :disabled="
  90. $store.getters.xt_user.subscibe.state == 3 ? true : false
  91. "
  92. round
  93. @click="openDeleteGroupAdvice()"
  94. >删除医嘱内容
  95. </el-button>
  96. </el-col>
  97. </el-row>
  98. <el-row>
  99. <el-col :span="24">
  100. <el-table
  101. id="user-edit-advice-name-table"
  102. :data="groupForm.adviceNames"
  103. border
  104. fit
  105. highlight-current-row
  106. :row-class-name="groupClassName"
  107. @current-change="selectGroupAdvice"
  108. style="width: 100%;margin-top: 10px;margin-bottom: 10px;"
  109. :row-key="getRowKey"
  110. ref="advicenametable"
  111. :header-cell-style="{ backgroundColor: 'rgb(245, 247, 250)' }"
  112. >
  113. <el-table-column
  114. label="医嘱名称"
  115. property="advice_name"
  116. style="word-break: keep-all;white-space:nowrap;"
  117. align="center"
  118. ></el-table-column>
  119. <el-table-column label="药品规格" align="center">
  120. <template slot-scope="scope">
  121. <span v-if="scope.row.advice_desc"
  122. >{{ scope.row.advice_desc
  123. }}{{ scope.row.drug_spec_unit }}</span
  124. >
  125. </template>
  126. </el-table-column>
  127. <!-- <el-table-column label="药品规格*数量" min-width="80" property="drug_spec" align="center">
  128. <template slot-scope="scope">
  129. <span
  130. v-if="scope.row.drug_spec!=0"
  131. >{{scope.row.drug_spec}}{{scope.row.drug_spec_unit}}</span>
  132. <span
  133. vf-i="scope.row.prescribing_number!=0"
  134. >*{{scope.row.prescribing_number}}{{scope.row.prescribing_number_unit}}</span>
  135. </template>
  136. </el-table-column> -->
  137. <el-table-column
  138. label="开药数量"
  139. min-width="80"
  140. property="prescribing_number"
  141. align="center"
  142. >
  143. <template slot-scope="scope">
  144. <span v-if="scope.row.prescribing_number != 0"
  145. >{{ scope.row.prescribing_number
  146. }}{{ scope.row.prescribing_number_unit }}</span
  147. >
  148. </template>
  149. </el-table-column>
  150. <el-table-column
  151. label="单次用量"
  152. min-width="80"
  153. property="single_dose"
  154. align="center"
  155. >
  156. <template slot-scope="scope">
  157. <span v-if="scope.row.single_dose != 0"
  158. >{{ scope.row.single_dose
  159. }}{{ scope.row.single_dose_unit }}</span
  160. >
  161. </template>
  162. </el-table-column>
  163. <el-table-column
  164. label="给药途径"
  165. min-width="80"
  166. property="delivery_way"
  167. align="center"
  168. >
  169. <template slot-scope="scope">
  170. <span v-if="scope.row.parent_row == 0">{{
  171. scope.row.delivery_way
  172. }}</span>
  173. </template>
  174. </el-table-column>
  175. <el-table-column
  176. label="执行频率"
  177. min-width="80"
  178. property="execution_frequency"
  179. align="center"
  180. >
  181. <template slot-scope="scope">
  182. <span v-if="scope.row.parent_row == 0">{{scope.row.execution_frequency}}</span>
  183. </template>
  184. </el-table-column>
  185. <!--<el-table-column label="医嘱嘱托" min-width="80" property="remark" align="center">-->
  186. <!--<template slot-scope="scope">-->
  187. <!--<span v-if="scope.row.parent_row==0">{{scope.row.remark}}</span>-->
  188. <!--</template>-->
  189. <!--</el-table-column>-->
  190. </el-table>
  191. </el-col>
  192. </el-row>
  193. </el-form>
  194. <div slot="footer" class="dialog-footer">
  195. <el-button
  196. :disabled="
  197. $store.getters.xt_user.subscibe.state == 3 ||
  198. groupForm.adviceNames.length == 0
  199. ? true
  200. : false
  201. "
  202. type="primary"
  203. @click="submitgroupAdvice('groupForm')"
  204. >保 存
  205. </el-button>
  206. </div>
  207. </el-dialog>
  208. <el-dialog
  209. title="选择医嘱模板"
  210. :close-on-click-modal="false"
  211. :visible.sync="templateFormVisible"
  212. width="72%"
  213. >
  214. <el-row :gutter="20">
  215. <el-col :span="8">
  216. <el-table
  217. :data="adviceTemplates"
  218. ref="templatetable"
  219. border
  220. :header-cell-style="{ backgroundColor: 'rgb(245, 247, 250)' }"
  221. highlight-current-row
  222. @current-change="templateTableChange"
  223. style="width: 100%"
  224. >
  225. <el-table-column prop="name" align="center" label="模板名称">
  226. </el-table-column>
  227. </el-table>
  228. </el-col>
  229. <el-col :span="16">
  230. <el-table
  231. id="dialysis-add-select-template-table"
  232. :data="selectedTemp.list"
  233. border
  234. :span-method="spanselecttable"
  235. @select="selectAdvice"
  236. @select-all="selectAllTemplateAdvice"
  237. @selection-change="changeAdvice"
  238. row-key="row_key"
  239. ref="selecttemplatetable"
  240. style="width: 100%"
  241. :header-cell-style="{ backgroundColor: 'rgb(245, 247, 250)' }"
  242. >
  243. <el-table-column type="selection" align="center" width="55">
  244. </el-table-column>
  245. <el-table-column
  246. label="医嘱内容"
  247. property="advice_name"
  248. style="word-break: keep-all;white-space:nowrap;"
  249. align="center"
  250. ></el-table-column>
  251. <el-table-column label="药品规格" align="center">
  252. <template slot-scope="scope">
  253. <span v-if="scope.row.advice_desc">{{ scope.row.advice_desc}}{{ scope.row.drug_spec_unit }}</span>
  254. </template>
  255. </el-table-column>
  256. <el-table-column
  257. label="开药数量"
  258. min-width="80"
  259. property="prescribing_number"
  260. align="center"
  261. >
  262. <template slot-scope="scope">
  263. <span v-if="scope.row.prescribing_number != 0">{{ scope.row.prescribing_number}}{{ scope.row.prescribing_number_unit }}</span>
  264. </template>
  265. </el-table-column>
  266. <el-table-column
  267. label="单次用量"
  268. min-width="80"
  269. property="single_dose"
  270. align="center"
  271. >
  272. <template slot-scope="scope">
  273. <span v-if="scope.row.single_dose != 0">{{ scope.row.single_dose}}{{ scope.row.single_dose_unit }}</span>
  274. </template>
  275. </el-table-column>
  276. <el-table-column
  277. label="给药途径"
  278. min-width="80"
  279. property="delivery_way"
  280. align="center"
  281. >
  282. <template slot-scope="scope">
  283. <span v-if="scope.row.parent_row == 0">{{scope.row.delivery_way}}</span>
  284. </template>
  285. </el-table-column>
  286. <el-table-column
  287. label="执行频率"
  288. min-width="80"
  289. property="execution_frequency"
  290. align="center"
  291. >
  292. <template slot-scope="scope">
  293. <span v-if="scope.row.parent_row == 0">{{
  294. scope.row.execution_frequency
  295. }}</span>
  296. </template>
  297. </el-table-column>
  298. </el-table>
  299. </el-col>
  300. </el-row>
  301. <div slot="footer" class="dialog-footer">
  302. <el-button @click="cancleDialog()">取消</el-button>
  303. <el-button
  304. :disabled="$store.getters.xt_user.subscibe.state == 3 ? true : false"
  305. type="primary"
  306. @click="newAddTempForm()"
  307. >保 存
  308. </el-button>
  309. </div>
  310. </el-dialog>
  311. <el-dialog
  312. title="选择医嘱模板"
  313. :visible.sync="oldTemplateFormVisible"
  314. width="700px"
  315. >
  316. <el-form ref="templateForm" :rules="templateRules" :model="templateForm">
  317. <el-row>
  318. <el-col :span="24">
  319. <el-form-item prop="id">
  320. <el-select
  321. v-model="templateForm.id"
  322. filterable
  323. clearable
  324. placeholder="请选择(输入可搜索)"
  325. style="width:100%"
  326. >
  327. <el-option
  328. v-for="item in adviceTemplates"
  329. :key="item.id"
  330. :label="item.name"
  331. :value="item.id"
  332. ></el-option>
  333. </el-select>
  334. </el-form-item>
  335. </el-col>
  336. </el-row>
  337. </el-form>
  338. <div slot="footer" class="dialog-footer">
  339. <el-button @click="templateFormVisible = false">取消</el-button>
  340. <el-button
  341. :disabled="$store.getters.xt_user.subscibe.state == 3 ? true : false"
  342. type="primary"
  343. @click="addTempForm('templateForm')"
  344. >保 存
  345. </el-button>
  346. </div>
  347. </el-dialog>
  348. <el-dialog
  349. :title="nameFormTitle"
  350. :visible.sync="nameFormVisible"
  351. width="854px"
  352. >
  353. <el-form
  354. ref="nameForm"
  355. :rules="nameRules"
  356. :model="nameForm"
  357. label-width="90px"
  358. >
  359. <el-row>
  360. <el-col :span="24">
  361. <el-form-item label="医嘱内容 :" required prop="advice_name">
  362. <el-autocomplete
  363. style="width:100%;"
  364. class="inline-input"
  365. v-model="nameForm.advice_name"
  366. :fetch-suggestions="querySearch"
  367. placeholder="请输入内容"
  368. @select="handleSelect"
  369. @input="changeDrugName"
  370. ></el-autocomplete>
  371. </el-form-item>
  372. <!-- <div style="margin-left:120px;margin-top:-20px;font-size:12px;color:red">
  373. 库存不足50
  374. </div> -->
  375. </el-col>
  376. </el-row>
  377. <el-row>
  378. <el-col :span="12">
  379. <el-form-item label="药品规格 :" prop="advice_desc">
  380. <el-col :span="8">
  381. <el-autocomplete
  382. style="width:100px;"
  383. class="inline-input"
  384. v-model="nameForm.advice_desc"
  385. :fetch-suggestions="querySearch1"
  386. placeholder="请输入内容"
  387. @select="handleSelect1"
  388. @input="changeDrugDesc"
  389. ></el-autocomplete>
  390. </el-col>
  391. <el-col class="line" :span="2">&nbsp;</el-col>
  392. <el-col :span="14">
  393. <el-select
  394. v-model="nameForm.drug_spec_unit"
  395. filterable
  396. clearable
  397. allow-create
  398. placeholder="选择"
  399. >
  400. <el-option
  401. v-for="item in unitsOption"
  402. :key="item.id"
  403. :label="item.name"
  404. :value="item.name"
  405. ></el-option>
  406. </el-select>
  407. </el-col>
  408. </el-form-item>
  409. </el-col>
  410. <el-col :span="12">
  411. <el-form-item label="开药数量 :" prop="prescribing_number">
  412. <el-col :span="8">
  413. <el-input v-model="nameForm.prescribing_number"></el-input>
  414. </el-col>
  415. <el-col class="line" :span="2">&nbsp;</el-col>
  416. <el-col :span="14">
  417. <el-select
  418. v-model="nameForm.prescribing_number_unit"
  419. filterable
  420. clearable
  421. allow-create
  422. placeholder="选择"
  423. >
  424. <el-option
  425. v-for="item in unitsOption"
  426. :key="item.id"
  427. :label="item.name"
  428. :value="item.name"
  429. ></el-option>
  430. </el-select>
  431. </el-col>
  432. </el-form-item>
  433. </el-col>
  434. <el-col :span="12">
  435. <el-form-item label="单次用量 :" prop="single_dose">
  436. <el-col :span="8">
  437. <el-input v-model="nameForm.single_dose"></el-input>
  438. </el-col>
  439. <el-col class="line" :span="2">&nbsp;</el-col>
  440. <el-col :span="14">
  441. <el-select
  442. v-model="nameForm.single_dose_unit"
  443. filterable
  444. clearable
  445. allow-create
  446. placeholder="选择"
  447. >
  448. <el-option
  449. v-for="item in unitsOption"
  450. :key="item.id"
  451. :label="item.name"
  452. :value="item.name"
  453. ></el-option>
  454. </el-select>
  455. </el-col>
  456. </el-form-item>
  457. </el-col>
  458. <el-col :span="12">
  459. <el-form-item label="给药途径 :" prop="delivery_way">
  460. <el-select
  461. v-model="nameForm.delivery_way"
  462. filterable
  463. clearable
  464. allow-create
  465. :disabled="isChild"
  466. placeholder="请选择(输入可搜索)"
  467. style="width:100%"
  468. >
  469. <el-option
  470. v-for="item in deliveryWayOptions"
  471. :key="item.id"
  472. :label="item.name"
  473. :value="item.name"
  474. ></el-option>
  475. </el-select>
  476. </el-form-item>
  477. </el-col>
  478. </el-row>
  479. <el-row>
  480. <el-col :span="12">
  481. <el-form-item label="执行频率 :" prop="execution_frequency">
  482. <el-select
  483. v-model="nameForm.execution_frequency"
  484. filterable
  485. clearable
  486. allow-create
  487. :disabled="isChild"
  488. placeholder="请选择(输入可搜索)"
  489. style="width:100%"
  490. >
  491. <el-option
  492. v-for="item in executionFrequencyOptions"
  493. :key="item.id"
  494. :label="item.name"
  495. :value="item.name"
  496. ></el-option>
  497. </el-select>
  498. </el-form-item>
  499. </el-col>
  500. </el-row>
  501. <!--<el-row>-->
  502. <!--<el-col :span="12">-->
  503. <!--<el-form-item label="医嘱嘱托 :" prop="delivery_way">-->
  504. <!--<el-input v-model="nameForm.remark"></el-input>-->
  505. <!--</el-form-item>-->
  506. <!--</el-col>-->
  507. <!--</el-row>-->
  508. </el-form>
  509. <div slot="footer" class="dialog-footer">
  510. <el-button @click="nameFormVisible = false">取消</el-button>
  511. <el-button
  512. :disabled="$store.getters.xt_user.subscibe.state == 3 ? true : false"
  513. type="primary"
  514. @click="submitNameForm('nameForm')"
  515. >保 存
  516. </el-button>
  517. </div>
  518. </el-dialog>
  519. </div>
  520. </template>
  521. <script>
  522. import {
  523. CreateDoctorAdvice,
  524. CreateGroupAdvice,
  525. DeleteDoctorAdvice,
  526. DeleteGroupAdvice,
  527. EditDoctorAdvice,
  528. getAdviceConfig,
  529. getDoctorAdviceList,
  530. StopDoctorAdvice
  531. } from "@/api/advice";
  532. import {getSelfMedicalList,getDrugDescByDrugName } from "@/api/drug/drug"
  533. import { duration } from 'moment';
  534. export default {
  535. name: "AddGroupAdvice",
  536. data() {
  537. return {
  538. editRowKey: 0,
  539. oldTemplateFormVisible: false,
  540. templateFormVisible: false,
  541. groupAddFormVisible: false,
  542. nameFormVisible: false,
  543. groupSelectRow: null,
  544. nameFormTitle: "",
  545. isChild: false,
  546. isEdit: false,
  547. adminusername: "",
  548. groupRules: {
  549. advice_type: [{ required: true, message: "请选择医嘱类型" }],
  550. advice_date: [{ required: true, message: "请选择医嘱时间" }],
  551. start_time: [{ required: true, message: "请选择开始时间" }],
  552. advice_name: [{ required: true, message: "请填写医嘱名称" }],
  553. advice_doctor: [{ required: true, message: "请选择开嘱医生" }]
  554. },
  555. nameRules: {
  556. advice_name: [{ required: true, message: "请填写医嘱内容" }]
  557. },
  558. templateRules: {
  559. id: [{ required: true, message: "请选择医嘱模板" }]
  560. },
  561. templateForm: { id: "" },
  562. nameForm: {
  563. advice_name: "",
  564. advice_desc: "",
  565. single_dose: "",
  566. single_dose_unit: "",
  567. drug_spec: "",
  568. drug_spec_unit: "",
  569. prescribing_number: "",
  570. prescribing_number_unit: "",
  571. delivery_way: "",
  572. execution_frequency: "",
  573. remark: "",
  574. isEdit: 0,
  575. index: 0,
  576. id: 0,
  577. children: [],
  578. drug_id:0,
  579. way:0,
  580. drug_name_id:0,
  581. },
  582. submitGroupForm: {
  583. advice_type: "",
  584. advice_date: "",
  585. start_time: "",
  586. adviceNames: [],
  587. advice_doctor: "",
  588. remark: "",
  589. parent_id: 0
  590. },
  591. groupForm: {
  592. advice_type: "",
  593. advice_date: "",
  594. start_time: "",
  595. adviceNames: [],
  596. advice_doctor: "",
  597. remark: "",
  598. parent_id: 0,
  599. drug_id:"",
  600. way:"",
  601. drug_name_id:0,
  602. },
  603. selectedTemp: { id: 0, name: "", org_id: 0, list: [], rows: [] },
  604. selectedTemplate: [],
  605. allSelectedTemplate: [],
  606. medicals:[],
  607. drugSpec:[],
  608. all_drug:[],
  609. current_drug_name:"",
  610. current_drug_spec: "",
  611. drug_id: 0,
  612. drug_name_id:"",
  613. src_type:"",
  614. private_drug_config:{},
  615. };
  616. },
  617. props: {
  618. patientID: 0,
  619. adviceType: 0,
  620. rowKey: 0,
  621. adviceTemplates: {
  622. type: Array,
  623. default: function() {
  624. return [];
  625. }
  626. },
  627. recordDate: "",
  628. adviceTypeOptions: {
  629. type: Array,
  630. default: function() {
  631. return [];
  632. }
  633. },
  634. deliveryWayOptions: {
  635. type: Array,
  636. default: () => []
  637. },
  638. unitsOption: {
  639. type: Array,
  640. default: function() {
  641. return [];
  642. }
  643. },
  644. executionFrequencyOptions: {
  645. type: Array,
  646. default: function() {
  647. return [];
  648. }
  649. },
  650. adviceTemplateMaps: {
  651. type: Object,
  652. default: function() {
  653. return {};
  654. }
  655. },
  656. adviceTableData: {
  657. type: Array,
  658. default: function() {
  659. return [];
  660. }
  661. },
  662. },
  663. methods: {
  664. submitgroupAdvice(formName) {
  665. this.$refs[formName].validate(valid => {
  666. if (valid) {
  667. var submitForm = {
  668. advice_type: this.groupForm.advice_type,
  669. advice_date: this.groupForm.advice_date,
  670. start_time: this.groupForm.start_time,
  671. adviceNames: [],
  672. advice_doctor: this.groupForm.advice_doctor,
  673. remark: this.groupForm.remark,
  674. parent_id: this.groupForm.parent_id
  675. };
  676. var adviceNames = [];
  677. for (const index in this.groupForm.adviceNames) {
  678. adviceNames.unshift(this.groupForm.adviceNames[index]);
  679. }
  680. submitForm.adviceNames = adviceNames;
  681. let mode = "1";
  682. console.log("88888888",submitForm)
  683. console.log("99999",this.medicals)
  684. if(this.private_drug_config != null&& this.private_drug_config.drug_start == 1){
  685. for(let index=0;index<submitForm.adviceNames.length;index++){
  686. for(let i=0;i<this.medicals.length;i++){
  687. if(submitForm.adviceNames[index].children.length >0){
  688. for(let y=0;y<submitForm.adviceNames[index].children.length;y++){
  689. if(submitForm.adviceNames[index].children[y].drug_id == this.medicals[i].drug_name_id){
  690. submitForm.adviceNames[index].children[y].drug_name_id = this.medicals[i].drug_name_id
  691. submitForm.adviceNames[index].children[y].way = 2
  692. }
  693. }
  694. }
  695. if(submitForm.adviceNames[index].drug_id == this.medicals[i].drug_name_id){
  696. submitForm.adviceNames[index].way = 2
  697. submitForm.adviceNames[index].drug_name_id = this.medicals[i].drug_name_id
  698. }
  699. }
  700. }
  701. }
  702. console.log("2222",submitForm)
  703. CreateGroupAdvice(this.patientID, 0, submitForm, mode).then(
  704. response => {
  705. if (response.data.state == 0) {
  706. this.$message.error(response.data.msg);
  707. return false;
  708. } else {
  709. this.$notify({
  710. title: "成功",
  711. message: "新增成功",
  712. type: "success",
  713. duration: 2000
  714. });
  715. var childMap = {};
  716. for (const index in response.data.data.advices) {
  717. if (response.data.data.advices[index].parent_id == 0) {
  718. continue;
  719. }
  720. if (
  721. response.data.data.advices[index].parent_id in childMap ===
  722. false
  723. ) {
  724. childMap[response.data.data.advices[index].parent_id] = [];
  725. }
  726. childMap[response.data.data.advices[index].parent_id].unshift(
  727. response.data.data.advices[index]
  728. );
  729. }
  730. var parentArr = [];
  731. for (const index in response.data.data.advices) {
  732. if (response.data.data.advices[index].parent_id > 0) {
  733. continue;
  734. }
  735. parentArr.push(response.data.data.advices[index]);
  736. }
  737. for (const index in parentArr) {
  738. if (parentArr[index].id in childMap) {
  739. for (const j in childMap[parentArr[index].id]) {
  740. this.adviceTableData.unshift(
  741. childMap[parentArr[index].id][j]
  742. );
  743. }
  744. }
  745. this.adviceTableData.unshift(parentArr[index]);
  746. }
  747. // var alen = response.data.data.advices.length
  748. // for (let index = alen-1; index >=0; index--) {
  749. // this.adviceTableData.unshift(response.data.data.advices[index]);
  750. // }
  751. this.resetForm(formName);
  752. this.groupAddFormVisible = false;
  753. this.$parent.getDialysisScheduleDetail()
  754. return false;
  755. }
  756. }
  757. );
  758. }
  759. });
  760. },
  761. openDeleteGroupAdvice() {
  762. if (this.groupSelectRow === null) {
  763. this.$message.error("未选择要删除的医嘱内容");
  764. return;
  765. }
  766. var content = "";
  767. if (this.groupSelectRow.children.length > 0) {
  768. content = "确认删除此医嘱内容,包括它的子药?";
  769. } else {
  770. content = "确认删除此医嘱内容?";
  771. }
  772. var isChild = !!this.groupSelectRow.parent_row;
  773. var title = isChild ? "删除子药内容" : "删除医嘱内容";
  774. var msg = isChild ? "确认删除此子药内容?" : content;
  775. this.$confirm(msg, title, {
  776. confirmButtonText: "确定",
  777. cancelButtonText: "取消",
  778. type: "warning"
  779. })
  780. .then(() => {
  781. if (isChild) {
  782. for (const index in this.groupForm.adviceNames) {
  783. if (
  784. this.groupForm.adviceNames[index].row_key ==
  785. this.groupSelectRow.parent_row
  786. ) {
  787. for (const j in this.groupForm.adviceNames[index].children) {
  788. if (
  789. this.groupForm.adviceNames[index].children[j].row_key ==
  790. this.groupSelectRow.row_key
  791. ) {
  792. this.groupForm.adviceNames[index].children.splice(j, 1);
  793. this.$set(
  794. this.groupForm.adviceNames,
  795. index,
  796. this.groupForm.adviceNames[index]
  797. );
  798. break;
  799. }
  800. }
  801. }
  802. }
  803. } else {
  804. for (const index in this.groupForm.adviceNames) {
  805. if (
  806. this.groupForm.adviceNames[index].row_key ==
  807. this.groupSelectRow.row_key
  808. ) {
  809. this.groupForm.adviceNames.splice(index, 1);
  810. break;
  811. }
  812. }
  813. }
  814. })
  815. .catch(() => {});
  816. },
  817. submitNameForm(formName) {
  818. if(this.src_type == ""){
  819. this.nameForm.way = 0
  820. this.nameForm.drug_id = 0
  821. this.nameForm.drug_name_id = 0
  822. }
  823. if(this.src_type == 2){ //自备药
  824. var arr = this.nameForm.advice_name.split("(自备药)")
  825. this.nameForm.advice_name = arr[0]
  826. }
  827. var _this = this;
  828. this.$refs[formName].validate(valid => {
  829. if (valid) {
  830. if (_this.nameForm.isEdit) {
  831. var ale = _this.groupForm.adviceNames.length;
  832. if (_this.isChild) {
  833. for (let index = 0; index < ale; index++) {
  834. if (_this.groupSelectRow.parent_row ==_this.groupForm.adviceNames[index].row_key) {
  835. var cle = _this.groupForm.adviceNames[index].children.length;
  836. var children = _this.groupForm.adviceNames[index].children;
  837. for (let j = 0; j < ale; j++) {
  838. if (_this.groupSelectRow.row_key == children[j].row_key) {
  839. _this.groupForm.adviceNames[index].children[j].advice_name = _this.nameForm.advice_name;
  840. _this.groupForm.adviceNames[index].children[j].advice_desc = _this.nameForm.advice_desc;
  841. _this.groupForm.adviceNames[index].children[j].single_dose = "" + _this.nameForm.single_dose;
  842. _this.groupForm.adviceNames[index].children[j].single_dose_unit = _this.nameForm.single_dose_unit;
  843. _this.groupForm.adviceNames[index].children[j].drug_spec = "" + _this.nameForm.drug_spec;
  844. _this.groupForm.adviceNames[index].children[j].drug_spec_unit = _this.nameForm.drug_spec_unit;
  845. _this.groupForm.adviceNames[index].children[j].prescribing_number ="" + _this.nameForm.prescribing_number;
  846. _this.groupForm.adviceNames[index].children[j].prescribing_number_unit = _this.nameForm.prescribing_number_unit;
  847. _this.groupForm.adviceNames[index].children[j].delivery_way = _this.nameForm.delivery_way;
  848. _this.groupForm.adviceNames[index].children[j].execution_frequency =_this.nameForm.execution_frequency;
  849. _this.groupForm.adviceNames[index].children[j].remark =_this.nameForm.remark;
  850. // _this.groupForm.adviceNames[index].children[j].drug_id = _this.nameForm.drug_id;
  851. // _this.groupForm.adviceNames[index].children[j].way = _this.nameForm.way;
  852. // _this.groupForm.adviceNames[index].children[j].drug_name_id = _this.nameForm.drug_name_id;
  853. _this.$set(_this.groupForm.adviceNames[index].children,j,_this.groupForm.adviceNames[index].children[j]
  854. );
  855. break;
  856. }
  857. }
  858. }
  859. }
  860. } else {
  861. for (let index = 0; index < ale; index++) {
  862. if ( _this.groupSelectRow.row_key ==_this.groupForm.adviceNames[index].row_key) {
  863. _this.groupForm.adviceNames[index].advice_name =_this.nameForm.advice_name;
  864. _this.groupForm.adviceNames[index].advice_desc =_this.nameForm.advice_desc;
  865. _this.groupForm.adviceNames[index].single_dose ="" + _this.nameForm.single_dose;
  866. _this.groupForm.adviceNames[index].single_dose_unit =_this.nameForm.single_dose_unit;
  867. _this.groupForm.adviceNames[index].drug_spec = "" + _this.nameForm.drug_spec;
  868. _this.groupForm.adviceNames[index].drug_spec_unit =_this.nameForm.drug_spec_unit;
  869. _this.groupForm.adviceNames[index].prescribing_number ="" + _this.nameForm.prescribing_number;
  870. _this.groupForm.adviceNames[index].prescribing_number_unit =_this.nameForm.prescribing_number_unit;
  871. _this.groupForm.adviceNames[index].delivery_way =_this.nameForm.delivery_way;
  872. _this.groupForm.adviceNames[index].execution_frequency =_this.nameForm.execution_frequency;
  873. _this.groupForm.adviceNames[index].remark =_this.nameForm.remark;
  874. // _this.groupForm.adviceNames[index].children[j].drug_id = _this.nameForm.drug_id;
  875. // _this.groupForm.adviceNames[index].children[j].way = _this.nameForm.way;
  876. // _this.groupForm.adviceNames[index].children[j].drug_name_id = _this.nameForm.drug_name_id;
  877. _this.$set(
  878. _this.groupForm.adviceNames,
  879. index,
  880. _this.groupForm.adviceNames[index]
  881. );
  882. break;
  883. }
  884. }
  885. }
  886. } else {
  887. if (_this.isChild) {
  888. _this.editRowKey++;
  889. _this.nameForm.row_key = _this.editRowKey;
  890. var ale = _this.groupForm.adviceNames.length;
  891. for (let index = 0; index < ale; index++) {
  892. if (_this.nameForm.parent_row ==_this.groupForm.adviceNames[index].row_key) {
  893. _this.groupForm.adviceNames[index].children.push(_this.nameForm);
  894. _this.$set(_this.groupForm.adviceNames,index,_this.groupForm.adviceNames[index]);
  895. break;
  896. }
  897. }
  898. } else {
  899. _this.editRowKey++;
  900. _this.nameForm.row_key = _this.editRowKey;
  901. _this.groupForm.adviceNames.push(_this.nameForm);
  902. }
  903. }
  904. _this.nameFormVisible = false;
  905. }
  906. });
  907. },
  908. openGroupChild() {
  909. if (this.groupSelectRow === null) {
  910. this.$message.error("未选择医嘱内容,无法添加子药");
  911. return;
  912. } else if (this.groupSelectRow.parent_row > 0) {
  913. this.$notify.error({
  914. title: "错误",
  915. message: "子药不能添加子药"
  916. });
  917. return;
  918. }
  919. this.nameForm = {
  920. advice_name:"",
  921. advice_desc: "",
  922. single_dose: "",
  923. single_dose_unit: "",
  924. drug_spec: "",
  925. drug_spec_unit: "",
  926. prescribing_number: "",
  927. prescribing_number_unit: "",
  928. delivery_way: this.groupSelectRow.delivery_way,
  929. execution_frequency: this.groupSelectRow.execution_frequency,
  930. remark: "",
  931. isEdit: 0,
  932. index: 0,
  933. children: [],
  934. parent_row: this.groupSelectRow.row_key,
  935. id: 0
  936. };
  937. this.isChild = true;
  938. this.nameFormVisible = true;
  939. this.nameFormTitle = "添加子药内容";
  940. },
  941. openGroupAdvice(isEdit) {
  942. this.isChild = false;
  943. if (isEdit) {
  944. if (this.groupSelectRow === null) {
  945. this.$message.error("未选择要修改的医嘱内容");
  946. return;
  947. }
  948. if (this.groupSelectRow.parent_row) {
  949. this.isChild = true;
  950. }
  951. this.nameForm = {
  952. advice_name: this.groupSelectRow.advice_name,
  953. advice_desc: this.groupSelectRow.advice_desc,
  954. single_dose:
  955. this.groupSelectRow.single_dose != 0
  956. ? this.groupSelectRow.single_dose
  957. : "",
  958. single_dose_unit: this.groupSelectRow.single_dose_unit,
  959. drug_spec:
  960. this.groupSelectRow.drug_spec != 0
  961. ? this.groupSelectRow.drug_spec
  962. : "",
  963. drug_spec_unit: this.groupSelectRow.drug_spec_unit,
  964. prescribing_number:
  965. this.groupSelectRow.prescribing_number != 0
  966. ? this.groupSelectRow.prescribing_number
  967. : "",
  968. prescribing_number_unit: this.groupSelectRow.prescribing_number_unit,
  969. delivery_way: this.isChild ? "" : this.groupSelectRow.delivery_way,
  970. execution_frequency: this.isChild
  971. ? ""
  972. : this.groupSelectRow.execution_frequency,
  973. isEdit: 1,
  974. index: this.groupSelectRow.index,
  975. id: this.groupSelectRow.id,
  976. children: [],
  977. parent_row: this.groupSelectRow.parent_row,
  978. remark: this.groupSelectRow.remark,
  979. drug_name_id:this.groupSelectRow.drug_name_id,
  980. drug_id:this.groupSelectRow.drug_id,
  981. way:this.groupSelectRow.way
  982. // row_key:this.groupSelectRow.row_key,
  983. };
  984. this.nameFormTitle = "修改医嘱内容";
  985. } else {
  986. this.nameForm = {
  987. advice_name: "",
  988. advice_desc: "",
  989. single_dose: "",
  990. single_dose_unit: "",
  991. drug_spec: "",
  992. drug_spec_unit: "",
  993. prescribing_number: "",
  994. prescribing_number_unit: "",
  995. delivery_way: "",
  996. execution_frequency: "",
  997. isEdit: 0,
  998. index: 0,
  999. id: 0,
  1000. remark: "",
  1001. children: [],
  1002. parent_row: 0
  1003. };
  1004. this.nameFormTitle = "新增医嘱内容";
  1005. }
  1006. this.nameFormVisible = true;
  1007. },
  1008. changeAdvice(selection) {
  1009. this.selectedTemplate = selection;
  1010. },
  1011. selectAdvice(selection, row) {
  1012. console.log("row",row)
  1013. var adviceArray = this.adviceTemplateMaps[this.selectedTemp.id]
  1014. .DoctorAdviceTemplate;
  1015. console.log(adviceArray);
  1016. for (let y = 0; y < adviceArray.length; y++) {
  1017. adviceArray[y].selection = false;
  1018. }
  1019. if (selection.length > 0) {
  1020. for (let y = 0; y < adviceArray.length; y++) {
  1021. for (let i = 0; i < selection.length; i++) {
  1022. if (adviceArray[y].id == selection[i].advice_id) {
  1023. adviceArray[y].selection = true;
  1024. }
  1025. }
  1026. }
  1027. }
  1028. // console.log(adviceArray);
  1029. if (row.children.length > 0) {
  1030. for (const index in row.children) {
  1031. this.$refs.selecttemplatetable.toggleRowSelection(
  1032. row.children[index]
  1033. );
  1034. }
  1035. }
  1036. // 下面两步的作用是为了上选中的数据的输出顺序不变
  1037. for (const index in this.selectedTemp.list) {
  1038. this.$refs.selecttemplatetable.toggleRowSelection(
  1039. this.selectedTemp.list[index]
  1040. );
  1041. if (this.selectedTemp.list[index].children.length > 0) {
  1042. for (const j in this.selectedTemp.list[index].children) {
  1043. this.$refs.selecttemplatetable.toggleRowSelection(
  1044. this.selectedTemp.list[index].children[j]
  1045. );
  1046. }
  1047. }
  1048. }
  1049. for (const index in this.selectedTemp.list) {
  1050. this.$refs.selecttemplatetable.toggleRowSelection(
  1051. this.selectedTemp.list[index]
  1052. );
  1053. if (this.selectedTemp.list[index].children.length > 0) {
  1054. for (const j in this.selectedTemp.list[index].children) {
  1055. this.$refs.selecttemplatetable.toggleRowSelection(
  1056. this.selectedTemp.list[index].children[j]
  1057. );
  1058. }
  1059. }
  1060. }
  1061. },
  1062. spanselecttable({ row, column, rowIndex, columnIndex }) {
  1063. if (columnIndex == 0) {
  1064. const _row = this.selectedTemp.rows[rowIndex];
  1065. const _col = _row > 0 ? 1 : 0;
  1066. return {
  1067. rowspan: _row,
  1068. colspan: _col
  1069. };
  1070. }
  1071. },
  1072. calcselectedTemp() {
  1073. var rowKeys = 0;
  1074. for (const index in this.selectedTemp.list) {
  1075. var pkey = rowKeys;
  1076. this.selectedTemp.rows[rowKeys] = 1;
  1077. if (this.selectedTemp.list[index].children.length > 0) {
  1078. for (const childindex in this.selectedTemp.list[index].children) {
  1079. rowKeys++;
  1080. this.selectedTemp.rows[pkey] += 1;
  1081. this.selectedTemp.rows[rowKeys] = 0;
  1082. }
  1083. }
  1084. rowKeys++;
  1085. this.$nextTick(function() {
  1086. if (this.selectedTemp.list[index].selection) {
  1087. this.$refs.selecttemplatetable.toggleRowSelection(
  1088. this.selectedTemp.list[index]
  1089. );
  1090. }
  1091. });
  1092. }
  1093. },
  1094. templateTableChange(currentRow, oldCurrentRow) {
  1095. console.log("params -----",currentRow)
  1096. this.selectedTemp = { id: 0, name: "", org_id: 0, list: [], rows: [] };
  1097. if (currentRow == null) {
  1098. return false;
  1099. }
  1100. this.selectedTemp.id = currentRow.id;
  1101. this.selectedTemp.name = currentRow.name;
  1102. this.selectedTemp.org_id = currentRow.org_id;
  1103. if (this.selectedTemp.id in this.adviceTemplateMaps) {
  1104. var mapid = this.selectedTemp.id;
  1105. var thisRowKey = 0;
  1106. for (const index in this.adviceTemplateMaps[mapid].DoctorAdviceTemplate) {
  1107. thisRowKey++;
  1108. var item = {
  1109. advice_name: this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].advice_name,
  1110. advice_desc: this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].advice_desc,
  1111. single_dose:"" +this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].single_dose,
  1112. single_dose_unit: this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].single_dose_unit,
  1113. drug_spec:"" +this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].drug_spec,
  1114. drug_spec_unit: this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].drug_spec_unit,
  1115. prescribing_number:"" +this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].prescribing_number,
  1116. prescribing_number_unit: this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].prescribing_number_unit,
  1117. delivery_way: this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].delivery_way,
  1118. execution_frequency: this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].execution_frequency,
  1119. selection: this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].selection,
  1120. advice_id: this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].id,
  1121. drug_id:this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].drug_id,
  1122. way:this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].way,
  1123. drug_name_id:this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].drug_name_id,
  1124. isEdit: 0,
  1125. id: 0,
  1126. children: [],
  1127. parent_row: 0,
  1128. row_key: thisRowKey
  1129. };
  1130. if (
  1131. "children" in
  1132. this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index] &&
  1133. this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].children
  1134. .length > 0
  1135. ) {
  1136. var parentRow = thisRowKey;
  1137. var children = this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[
  1138. index
  1139. ].children;
  1140. for (const key in children) {
  1141. thisRowKey++;
  1142. var child = {
  1143. advice_id: children[key].id,
  1144. advice_name: children[key].advice_name,
  1145. advice_desc: children[key].advice_desc,
  1146. single_dose: "" + children[key].single_dose,
  1147. single_dose_unit: children[key].single_dose_unit,
  1148. drug_spec: "" + children[key].drug_spec,
  1149. drug_spec_unit: children[key].drug_spec_unit,
  1150. prescribing_number: "" + children[key].prescribing_number,
  1151. prescribing_number_unit: children[key].prescribing_number_unit,
  1152. delivery_way: children[key].delivery_way,
  1153. execution_frequency: children[key].execution_frequency,
  1154. drug_id:children[key].drug_id,
  1155. way:children[key].way,
  1156. drug_name_id:children[key].drug_name_id,
  1157. isEdit: 0,
  1158. id: 0,
  1159. children: [],
  1160. parent_row: parentRow,
  1161. row_key: thisRowKey,
  1162. };
  1163. item.children.push(child);
  1164. }
  1165. this.$set(item, "children", item.children);
  1166. }
  1167. this.selectedTemp.list.unshift(item);
  1168. }
  1169. }
  1170. },
  1171. newAddTempForm() {
  1172. this.allSelectedTemplate = [];
  1173. var thisRowKey = 0;
  1174. for (const indexs in this.adviceTemplateMaps) {
  1175. const adviceTemplate = this.adviceTemplateMaps[indexs];
  1176. for (const index in adviceTemplate.DoctorAdviceTemplate) {
  1177. if (adviceTemplate.DoctorAdviceTemplate[index].selection) {
  1178. thisRowKey++;
  1179. var item = {
  1180. advice_name:adviceTemplate.DoctorAdviceTemplate[index].advice_name,
  1181. advice_desc:adviceTemplate.DoctorAdviceTemplate[index].advice_desc,
  1182. single_dose:"" + adviceTemplate.DoctorAdviceTemplate[index].single_dose,
  1183. single_dose_unit:adviceTemplate.DoctorAdviceTemplate[index].single_dose_unit,
  1184. drug_spec:"" + adviceTemplate.DoctorAdviceTemplate[index].drug_spec,
  1185. drug_spec_unit:adviceTemplate.DoctorAdviceTemplate[index].drug_spec_unit,
  1186. prescribing_number:"" +adviceTemplate.DoctorAdviceTemplate[index].prescribing_number,
  1187. prescribing_number_unit:adviceTemplate.DoctorAdviceTemplate[index].prescribing_number_unit,
  1188. delivery_way:adviceTemplate.DoctorAdviceTemplate[index].delivery_way,
  1189. execution_frequency:adviceTemplate.DoctorAdviceTemplate[index].execution_frequency,
  1190. advice_id: adviceTemplate.DoctorAdviceTemplate[index].id,
  1191. selection: adviceTemplate.DoctorAdviceTemplate[index].selection,
  1192. drug_id: adviceTemplate.DoctorAdviceTemplate[index].drug_id,
  1193. way:adviceTemplate.DoctorAdviceTemplate[index].way,
  1194. drug_name_id:adviceTemplate.DoctorAdviceTemplate[index].drug_name_id,
  1195. isEdit: 0,
  1196. id: 0,
  1197. children: [],
  1198. parent_row: 0,
  1199. row_key: thisRowKey
  1200. };
  1201. console.log("items========",item)
  1202. if (
  1203. "children" in adviceTemplate.DoctorAdviceTemplate[index] &&
  1204. adviceTemplate.DoctorAdviceTemplate[index].children.length > 0
  1205. ) {
  1206. var parentRow = thisRowKey;
  1207. var children =
  1208. adviceTemplate.DoctorAdviceTemplate[index].children;
  1209. for (const key in children) {
  1210. thisRowKey++;
  1211. var child = {
  1212. advice_id: children[key].id,
  1213. advice_name: children[key].advice_name,
  1214. advice_desc: children[key].advice_desc,
  1215. single_dose: "" + children[key].single_dose,
  1216. single_dose_unit: children[key].single_dose_unit,
  1217. drug_spec: "" + children[key].drug_spec,
  1218. drug_spec_unit: children[key].drug_spec_unit,
  1219. prescribing_number: "" + children[key].prescribing_number,
  1220. prescribing_number_unit:children[key].prescribing_number_unit,
  1221. delivery_way: children[key].delivery_way,
  1222. execution_frequency: children[key].execution_frequency,
  1223. drug_id:children[key].drug_id,
  1224. way:children[key].way,
  1225. drug_name_id:children[key].drug_name_id,
  1226. isEdit: 0,
  1227. id: 0,
  1228. children: [],
  1229. parent_row: parentRow,
  1230. row_key: thisRowKey
  1231. };
  1232. item.children.push(child);
  1233. this.allSelectedTemplate.unshift(child);
  1234. }
  1235. this.$set(item, "children", item.children);
  1236. }
  1237. this.allSelectedTemplate.unshift(item);
  1238. adviceTemplate.DoctorAdviceTemplate[index].selection = false;
  1239. }
  1240. }
  1241. }
  1242. var childMap = {};
  1243. for (const index in this.allSelectedTemplate) {
  1244. if (this.allSelectedTemplate[index].parent_row > 0) {
  1245. if (!(this.allSelectedTemplate[index].parent_row in childMap)) {
  1246. childMap[this.allSelectedTemplate[index].parent_row] = [];
  1247. }
  1248. childMap[this.allSelectedTemplate[index].parent_row].push(
  1249. this.allSelectedTemplate[index]
  1250. );
  1251. }
  1252. }
  1253. for (const index in this.allSelectedTemplate) {
  1254. if (this.allSelectedTemplate[index].parent_row > 0) {
  1255. continue;
  1256. }
  1257. this.editRowKey++;
  1258. var item = {
  1259. advice_name: this.allSelectedTemplate[index].advice_name,
  1260. advice_desc: this.allSelectedTemplate[index].advice_desc,
  1261. single_dose: "" + this.allSelectedTemplate[index].single_dose,
  1262. single_dose_unit: this.allSelectedTemplate[index].single_dose_unit,
  1263. drug_spec: "" + this.allSelectedTemplate[index].drug_spec,
  1264. drug_spec_unit: this.allSelectedTemplate[index].drug_spec_unit,
  1265. prescribing_number:"" + this.allSelectedTemplate[index].prescribing_number,
  1266. prescribing_number_unit: this.allSelectedTemplate[index].prescribing_number_unit,
  1267. delivery_way: this.allSelectedTemplate[index].delivery_way,
  1268. execution_frequency: this.allSelectedTemplate[index].execution_frequency,
  1269. drug_id:this.allSelectedTemplate[index].drug_id,
  1270. way:this.allSelectedTemplate[index].way,
  1271. drug_name_id:this.allSelectedTemplate[index].drug_name_id,
  1272. isEdit: 0,
  1273. id: 0,
  1274. children: [],
  1275. parent_row: 0,
  1276. row_key: this.editRowKey
  1277. };
  1278. if (this.allSelectedTemplate[index].children.length > 0) {
  1279. if (this.allSelectedTemplate[index].row_key in childMap) {
  1280. var parentRow = this.editRowKey;
  1281. var children = childMap[this.allSelectedTemplate[index].row_key];
  1282. for (const key in children) {
  1283. this.editRowKey++;
  1284. var child = {
  1285. advice_name: children[key].advice_name,
  1286. advice_desc: children[key].advice_desc,
  1287. single_dose: "" + children[key].single_dose,
  1288. single_dose_unit: children[key].single_dose_unit,
  1289. drug_spec: "" + children[key].drug_spec,
  1290. drug_spec_unit: children[key].drug_spec_unit,
  1291. prescribing_number: "" + children[key].prescribing_number,
  1292. prescribing_number_unit: children[key].prescribing_number_unit,
  1293. delivery_way: children[key].delivery_way,
  1294. execution_frequency: children[key].execution_frequency,
  1295. drug_id:children[key].drug_id,
  1296. way:children[key].way,
  1297. drug_name_id:children[key].drug_name_id,
  1298. isEdit: 0,
  1299. id: 0,
  1300. children: [],
  1301. parent_row: parentRow,
  1302. row_key: this.editRowKey
  1303. };
  1304. item.children.push(child);
  1305. }
  1306. this.$set(item, "children", item.children);
  1307. }
  1308. }
  1309. console.log(this.groupForm.adviceNames)
  1310. this.groupForm.adviceNames.push(item);
  1311. }
  1312. this.templateFormVisible = false;
  1313. },
  1314. addTempForm(formName) {
  1315. var _this = this;
  1316. this.$refs[formName].validate(valid => {
  1317. if (valid) {
  1318. if (_this.templateForm.id in _this.adviceTemplateMaps) {
  1319. var mapid = _this.templateForm.id;
  1320. for (const index in _this.adviceTemplateMaps[mapid]
  1321. .DoctorAdviceTemplate) {
  1322. this.editRowKey++;
  1323. var item = {advice_name:_this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].advice_name,
  1324. advice_desc:_this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].advice_desc,
  1325. single_dose:"" +_this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].single_dose,
  1326. single_dose_unit:_this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].single_dose_unit,
  1327. drug_spec:"" +_this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].drug_spec,
  1328. drug_spec_unit:_this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].drug_spec_unit,
  1329. prescribing_number:"" +_this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].prescribing_number,
  1330. prescribing_number_unit:_this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].prescribing_number_unit,
  1331. delivery_way:_this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].delivery_way,
  1332. execution_frequency:_this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].execution_frequency,
  1333. isEdit: 0,
  1334. id: 0,
  1335. children: [],
  1336. parent_row: 0,
  1337. row_key: this.editRowKey
  1338. };
  1339. if (
  1340. "children" in
  1341. _this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index] &&
  1342. _this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index]
  1343. .children
  1344. ) {
  1345. var parentRow = this.editRowKey;
  1346. var children =
  1347. _this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index]
  1348. .children;
  1349. for (const key in children) {
  1350. this.editRowKey++;
  1351. var child = {
  1352. advice_name: children[key].advice_name,
  1353. advice_desc: children[key].advice_desc,
  1354. single_dose: "" + children[key].single_dose,
  1355. single_dose_unit: children[key].single_dose_unit,
  1356. drug_spec: "" + children[key].drug_spec,
  1357. drug_spec_unit: children[key].drug_spec_unit,
  1358. prescribing_number: "" + children[key].prescribing_number,
  1359. prescribing_number_unit:
  1360. children[key].prescribing_number_unit,
  1361. delivery_way: children[key].delivery_way,
  1362. execution_frequency: children[key].execution_frequency,
  1363. isEdit: 0,
  1364. id: 0,
  1365. children: [],
  1366. parent_row: parentRow,
  1367. row_key: this.editRowKey
  1368. };
  1369. item.children.push(child);
  1370. }
  1371. _this.$set(item, "children", item.children);
  1372. }
  1373. _this.groupForm.adviceNames.unshift(item);
  1374. }
  1375. }
  1376. _this.templateFormVisible = false;
  1377. }
  1378. });
  1379. },
  1380. openAdviceTemplate() {
  1381. this.templateForm = { id: "" };
  1382. this.selectedTemp = { id: 0, name: "", org_id: 0, list: [], rows: [] };
  1383. this.selectedTemplate = [];
  1384. if (typeof this.$refs.templatetable !== "undefined") {
  1385. this.$refs.templatetable.setCurrentRow(null);
  1386. }
  1387. this.templateFormVisible = true;
  1388. },
  1389. selectGroupAdvice(row) {
  1390. this.groupSelectRow = row;
  1391. },
  1392. groupClassName({ row, rowIndex }) {
  1393. row.index = rowIndex;
  1394. },
  1395. getRowKey(row) {
  1396. return row.row_key;
  1397. },
  1398. resetForm(formName) {
  1399. this.$refs[formName].resetFields();
  1400. },
  1401. open() {
  1402. this.groupAddFormVisible = true;
  1403. this.groupSelectRow = null;
  1404. if (typeof this.$refs.advicenametable !== "undefined") {
  1405. this.$refs.advicenametable.setCurrentRow(null);
  1406. }
  1407. this.editRowKey = 0;
  1408. this.groupForm = {
  1409. advice_type: 2,
  1410. advice_date: this.recordDate,
  1411. start_time: "",
  1412. adviceNames: [],
  1413. advice_doctor: "",
  1414. remark: "",
  1415. parent_id: 0
  1416. };
  1417. var xtuser = this.$store.getters.xt_user;
  1418. // this.orgname = xtuser.org.org_name;
  1419. this.adminusername = xtuser.user.user_name;
  1420. },
  1421. selectAllTemplateAdvice(selection) {
  1422. console.log("params",selection)
  1423. var adviceArray = this.adviceTemplateMaps[this.selectedTemp.id].DoctorAdviceTemplate;
  1424. for (let y = 0; y < adviceArray.length; y++) {
  1425. adviceArray[y].selection = false;
  1426. }
  1427. if (selection.length > 0) {
  1428. for (let y = 0; y < adviceArray.length; y++) {
  1429. for (let i = 0; i < selection.length; i++) {
  1430. if (adviceArray[y].id == selection[i].advice_id) {
  1431. adviceArray[y].selection = true;
  1432. }
  1433. }
  1434. }
  1435. }
  1436. },
  1437. cancleDialog() {
  1438. this.templateFormVisible = false;
  1439. for (const indexs in this.adviceTemplateMaps) {
  1440. const adviceTemplate = this.adviceTemplateMaps[indexs];
  1441. for (const index in adviceTemplate.DoctorAdviceTemplate) {
  1442. adviceTemplate.DoctorAdviceTemplate[index].selection = false;
  1443. }
  1444. }
  1445. },
  1446. rand(min, max) {
  1447. return Math.floor(Math.random() * (max - min)) + min;
  1448. },
  1449. //
  1450. getSelfMedicalList(){
  1451. const params = {
  1452. patient_id:this.$route.query.patient_id
  1453. }
  1454. getSelfMedicalList(params).then(response=>{
  1455. if (response.data.state == 1) {
  1456. this.arr_drug = []
  1457. var medicalList = response.data.data.private_drug_list
  1458. var base_drug_list = response.data.data.base_drug_list
  1459. var base_drug_cofig = response.data.data.base_drug_config
  1460. var private_drug_cofig = response.data.data.private_drug_config
  1461. if(private_drug_cofig != null&&private_drug_cofig.drug_start == 1) {
  1462. for (let i = 0; i < medicalList.length; i++) {
  1463. if(medicalList[i].drug_specs != null) {
  1464. for (let a = 0; a < medicalList[i].drug_specs.length; a++) {
  1465. medicalList[i].drug_specs[a]['type'] = 2
  1466. }
  1467. }
  1468. let obj = {
  1469. drug_name: "",
  1470. drug_desc: "",
  1471. delivery_way: "",
  1472. execution_frequency: "",
  1473. single_dose: "",
  1474. single_dose_unit: "",
  1475. prescribing_number: "",
  1476. prescribing_number_unit: "",
  1477. type_id: "",
  1478. type: "",
  1479. custom_id: "",
  1480. drug_specs: [],
  1481. }
  1482. medicalList[i].drug_name = medicalList[i].drug_name + "(自备药)"
  1483. obj.drug_name = medicalList[i].drug_name
  1484. obj.delivery_way = medicalList[i].delivery_way
  1485. obj.execution_frequency = medicalList[i].execution_frequency
  1486. obj.single_dose = medicalList[i].single_dose
  1487. obj.prescribing_number = medicalList[i].prescribing_number
  1488. obj.type_id = medicalList[i].id
  1489. obj.type = 2
  1490. obj.custom_id = this.rand(10000000, 99999999)
  1491. obj.drug_specs = medicalList[i].drug_specs
  1492. this.all_drug.push(obj)
  1493. }
  1494. }
  1495. for (let i = 0; i < base_drug_list.length; i++) {
  1496. if(base_drug_list[i].drug_specs != null) {
  1497. for (let a = 0; a < base_drug_list[i].drug_specs.length; a++) {
  1498. base_drug_list[i].drug_specs[a]['type'] = 1
  1499. }
  1500. }
  1501. let obj = {
  1502. drug_name: "",
  1503. drug_desc: "",
  1504. delivery_way: "",
  1505. execution_frequency: "",
  1506. single_dose: "",
  1507. single_dose_unit: "",
  1508. prescribing_number: "",
  1509. prescribing_number_unit: "",
  1510. type_id: "",
  1511. type: "",
  1512. custom_id: "",
  1513. drug_specs: [],
  1514. }
  1515. obj.drug_name = base_drug_list[i].drug_name
  1516. obj.delivery_way = base_drug_list[i].delivery_way
  1517. obj.execution_frequency = base_drug_list[i].execution_frequency
  1518. obj.single_dose = base_drug_list[i].single_dose
  1519. obj.prescribing_number = base_drug_list[i].prescribing_number
  1520. obj.type_id = base_drug_list[i].id
  1521. obj.type = 1
  1522. obj.custom_id = this.rand(10000000, 99999999)
  1523. obj.drug_specs = base_drug_list[i].drug_specs
  1524. this.all_drug.push(obj)
  1525. }
  1526. this.private_drug_config = response.data.data.private_drug_config
  1527. this.medicals = medicalList
  1528. }
  1529. })
  1530. },
  1531. changeDrugName(name){
  1532. this.current_drug_name = name
  1533. this.nameForm.advice_desc = ''
  1534. this.drugSpec = []
  1535. for (let i = 0; i < this.all_drug.length; i++) {
  1536. if (this.all_drug[i].drug_name == name) {
  1537. this.drugSpec = this.all_drug[i].drug_specs
  1538. }
  1539. }
  1540. },
  1541. changeDrugDesc(name) {
  1542. this.current_drug_spec = name
  1543. for (let i = 0; i < this.drugSpec.length; i++) {
  1544. if (this.drugSpec[i].drug_spec == name) {
  1545. this.nameForm.advice_desc = this.drugSpec[i].drug_spec
  1546. this.nameForm.prescribing_number = this.drugSpec[i].prescribing_number.toString()
  1547. this.nameForm.single_dose = this.drugSpec[i].single_dose.toString()
  1548. this.nameForm.delivery_way = this.drugSpec[i].delivery_way.toString()
  1549. this.nameForm.execution_frequency = this.drugSpec[i].execution_frequency.toString()
  1550. this.drug_id = this.drugSpec[i].id
  1551. this.src_type = this.drugSpec[i].type
  1552. this.nameForm.drug_id = this.drugSpec[i].id
  1553. this.nameForm.way = this.drugSpec[i].type
  1554. this.nameForm.single_dose_unit = this.drugSpec[i].min_unit
  1555. this.nameForm.drug_spec_unit = this.drugSpec[i].min_unit
  1556. this.nameForm.prescribing_number_unit = this.drugSpec[i].min_unit
  1557. if(this.drugSpec[i].drug_name_id){
  1558. this.nameForm.drug_name_id = this.drugSpec[i].drug_name_id
  1559. }else{
  1560. this.nameForm.drug_name_id = 0
  1561. }
  1562. }
  1563. }
  1564. },
  1565. querySearch(queryString, cb) {
  1566. console.log('queryString',queryString)
  1567. var restaurants = this.all_drug;
  1568. restaurants.map(item => {
  1569. item.value = item.drug_name
  1570. })
  1571. var results = queryString ? restaurants.filter(this.createFilter(queryString)) : restaurants;
  1572. // 调用 callback 返回建议列表的数据
  1573. cb(results);
  1574. },
  1575. createFilter(queryString) {
  1576. return (restaurant) => {
  1577. return (restaurant.drug_name.toLowerCase().indexOf(queryString.toLowerCase()) === 0);
  1578. };
  1579. },
  1580. querySearch1(queryString, cb) {
  1581. var restaurants = this.drugSpec;
  1582. console.log(restaurants)
  1583. restaurants.map(item => {
  1584. item.value = item.drug_spec
  1585. })
  1586. var results = queryString ? restaurants.filter(this.createFilter(queryString)) : restaurants;
  1587. // 调用 callback 返回建议列表的数据
  1588. cb(results);
  1589. },
  1590. handleSelect(){
  1591. },
  1592. handleSelect1(){
  1593. }
  1594. },
  1595. watch: {
  1596. "selectedTemp.list": function() {
  1597. this.calcselectedTemp();
  1598. }
  1599. },
  1600. created(){
  1601. //获取自备药
  1602. this.getSelfMedicalList()
  1603. }
  1604. };
  1605. </script>
  1606. <style>
  1607. #user-edit-advice-name-table .el-table__row {
  1608. display: table-row !important;
  1609. }
  1610. #user-edit-advice-name-table .el-table__expand-icon {
  1611. -webkit-transform: rotate(90deg) !important;
  1612. transform: rotate(90deg) !important;
  1613. }
  1614. #dialysis-add-select-template-table .el-table__row {
  1615. display: table-row !important;
  1616. }
  1617. #dialysis-add-select-template-table .el-table__expand-icon {
  1618. -webkit-transform: rotate(90deg) !important;
  1619. transform: rotate(90deg) !important;
  1620. }
  1621. </style>