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

AddGroupAdvice.vue 58KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645
  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-input v-model="nameForm.advice_name"></el-input> -->
  363. <el-select
  364. v-model="nameForm.advice_name"
  365. filterable
  366. clearable
  367. allow-create
  368. :disabled="isChild"
  369. placeholder="请选择(输入可搜索)"
  370. style="width:200px"
  371. @change="changeDrugName"
  372. >
  373. <el-option
  374. v-for="item in medicals"
  375. :key="item.id"
  376. :label="item.drug_name"
  377. :value="item.id"
  378. ></el-option>
  379. </el-select>
  380. </el-form-item>
  381. <!-- <div style="margin-left:120px;margin-top:-20px;font-size:12px;color:red">
  382. 库存不足50
  383. </div> -->
  384. </el-col>
  385. </el-row>
  386. <el-row>
  387. <el-col :span="13">
  388. <!--<el-form-item label="规格 :" prop="advice_desc">-->
  389. <!--<el-input v-model="nameForm.advice_desc"></el-input>-->
  390. <!--</el-form-item>-->
  391. <el-form-item label="药品规格 :" prop="advice_desc">
  392. <el-col :span="10">
  393. <!-- <el-input v-model="nameForm.advice_desc"></el-input> -->
  394. <el-select
  395. v-model="nameForm.advice_desc"
  396. filterable
  397. clearable
  398. allow-create
  399. :disabled="isChild"
  400. placeholder="请选择(输入可搜索)"
  401. style="width:150px"
  402. >
  403. <el-option
  404. v-for="item in drugSpec"
  405. :key="item.id"
  406. :label="item.drug_spec"
  407. :value="item.drug_spec"
  408. ></el-option>
  409. </el-select>
  410. </el-col>
  411. <el-col class="line" :span="2">&nbsp;</el-col>
  412. <el-col :span="10">
  413. <el-select
  414. v-model="nameForm.drug_spec_unit"
  415. filterable
  416. clearable
  417. allow-create
  418. placeholder="选择"
  419. style="width:120px"
  420. >
  421. <el-option
  422. v-for="item in unitsOption"
  423. :key="item.id"
  424. :label="item.name"
  425. :value="item.name"
  426. ></el-option>
  427. </el-select>
  428. </el-col>
  429. </el-form-item>
  430. </el-col>
  431. <el-col :span="9">
  432. <el-form-item label="开药数量 :" prop="prescribing_number">
  433. <el-col :span="8">
  434. <el-input v-model="nameForm.prescribing_number"></el-input>
  435. </el-col>
  436. <el-col class="line" :span="2">&nbsp;</el-col>
  437. <el-col :span="14">
  438. <el-select
  439. v-model="nameForm.prescribing_number_unit"
  440. filterable
  441. clearable
  442. allow-create
  443. placeholder="选择"
  444. >
  445. <el-option
  446. v-for="item in unitsOption"
  447. :key="item.id"
  448. :label="item.name"
  449. :value="item.name"
  450. ></el-option>
  451. </el-select>
  452. </el-col>
  453. </el-form-item>
  454. </el-col>
  455. <el-col :span="12">
  456. <el-form-item label="单次用量 :" prop="single_dose">
  457. <el-col :span="8">
  458. <el-input v-model="nameForm.single_dose"></el-input>
  459. </el-col>
  460. <el-col class="line" :span="2">&nbsp;</el-col>
  461. <el-col :span="14">
  462. <el-select
  463. v-model="nameForm.single_dose_unit"
  464. filterable
  465. clearable
  466. allow-create
  467. placeholder="选择"
  468. >
  469. <el-option
  470. v-for="item in unitsOption"
  471. :key="item.id"
  472. :label="item.name"
  473. :value="item.name"
  474. ></el-option>
  475. </el-select>
  476. </el-col>
  477. </el-form-item>
  478. </el-col>
  479. <el-col :span="12">
  480. <el-form-item label="给药途径 :" prop="delivery_way">
  481. <el-select
  482. v-model="nameForm.delivery_way"
  483. filterable
  484. clearable
  485. allow-create
  486. :disabled="isChild"
  487. placeholder="请选择(输入可搜索)"
  488. style="width:100%"
  489. >
  490. <el-option
  491. v-for="item in deliveryWayOptions"
  492. :key="item.id"
  493. :label="item.name"
  494. :value="item.name"
  495. ></el-option>
  496. </el-select>
  497. </el-form-item>
  498. </el-col>
  499. </el-row>
  500. <el-row>
  501. <el-col :span="12">
  502. <el-form-item label="执行频率 :" prop="execution_frequency">
  503. <el-select
  504. v-model="nameForm.execution_frequency"
  505. filterable
  506. clearable
  507. allow-create
  508. :disabled="isChild"
  509. placeholder="请选择(输入可搜索)"
  510. style="width:100%"
  511. >
  512. <el-option
  513. v-for="item in executionFrequencyOptions"
  514. :key="item.id"
  515. :label="item.name"
  516. :value="item.name"
  517. ></el-option>
  518. </el-select>
  519. </el-form-item>
  520. </el-col>
  521. </el-row>
  522. <!--<el-row>-->
  523. <!--<el-col :span="12">-->
  524. <!--<el-form-item label="医嘱嘱托 :" prop="delivery_way">-->
  525. <!--<el-input v-model="nameForm.remark"></el-input>-->
  526. <!--</el-form-item>-->
  527. <!--</el-col>-->
  528. <!--</el-row>-->
  529. </el-form>
  530. <div slot="footer" class="dialog-footer">
  531. <el-button @click="nameFormVisible = false">取消</el-button>
  532. <el-button
  533. :disabled="$store.getters.xt_user.subscibe.state == 3 ? true : false"
  534. type="primary"
  535. @click="submitNameForm('nameForm')"
  536. >保 存
  537. </el-button>
  538. </div>
  539. </el-dialog>
  540. </div>
  541. </template>
  542. <script>
  543. import {
  544. CreateDoctorAdvice,
  545. CreateGroupAdvice,
  546. DeleteDoctorAdvice,
  547. DeleteGroupAdvice,
  548. EditDoctorAdvice,
  549. getAdviceConfig,
  550. getDoctorAdviceList,
  551. StopDoctorAdvice
  552. } from "@/api/advice";
  553. import {getSelfMedicalList,getDrugDescByDrugName } from "@/api/drug/drug"
  554. import { duration } from 'moment';
  555. export default {
  556. name: "AddGroupAdvice",
  557. data() {
  558. return {
  559. editRowKey: 0,
  560. oldTemplateFormVisible: false,
  561. templateFormVisible: false,
  562. groupAddFormVisible: false,
  563. nameFormVisible: false,
  564. groupSelectRow: null,
  565. nameFormTitle: "",
  566. isChild: false,
  567. isEdit: false,
  568. adminusername: "",
  569. groupRules: {
  570. advice_type: [{ required: true, message: "请选择医嘱类型" }],
  571. advice_date: [{ required: true, message: "请选择医嘱时间" }],
  572. start_time: [{ required: true, message: "请选择开始时间" }],
  573. advice_name: [{ required: true, message: "请填写医嘱名称" }],
  574. advice_doctor: [{ required: true, message: "请选择开嘱医生" }]
  575. },
  576. nameRules: {
  577. advice_name: [{ required: true, message: "请填写医嘱内容" }]
  578. },
  579. templateRules: {
  580. id: [{ required: true, message: "请选择医嘱模板" }]
  581. },
  582. templateForm: { id: "" },
  583. nameForm: {
  584. advice_name: "",
  585. advice_desc: "",
  586. single_dose: "",
  587. single_dose_unit: "",
  588. drug_spec: "",
  589. drug_spec_unit: "",
  590. prescribing_number: "",
  591. prescribing_number_unit: "",
  592. delivery_way: "",
  593. execution_frequency: "",
  594. remark: "",
  595. isEdit: 0,
  596. index: 0,
  597. id: 0,
  598. children: [],
  599. drug_id:"",
  600. way:"",
  601. },
  602. submitGroupForm: {
  603. advice_type: "",
  604. advice_date: "",
  605. start_time: "",
  606. adviceNames: [],
  607. advice_doctor: "",
  608. remark: "",
  609. parent_id: 0
  610. },
  611. groupForm: {
  612. advice_type: "",
  613. advice_date: "",
  614. start_time: "",
  615. adviceNames: [],
  616. advice_doctor: "",
  617. remark: "",
  618. parent_id: 0,
  619. drug_id:"",
  620. way:"",
  621. },
  622. selectedTemp: { id: 0, name: "", org_id: 0, list: [], rows: [] },
  623. selectedTemplate: [],
  624. allSelectedTemplate: [],
  625. medicals:[],
  626. drugSpec:[]
  627. };
  628. },
  629. props: {
  630. patientID: 0,
  631. adviceType: 0,
  632. rowKey: 0,
  633. adviceTemplates: {
  634. type: Array,
  635. default: function() {
  636. return [];
  637. }
  638. },
  639. recordDate: "",
  640. adviceTypeOptions: {
  641. type: Array,
  642. default: function() {
  643. return [];
  644. }
  645. },
  646. deliveryWayOptions: {
  647. type: Array,
  648. default: () => []
  649. },
  650. unitsOption: {
  651. type: Array,
  652. default: function() {
  653. return [];
  654. }
  655. },
  656. executionFrequencyOptions: {
  657. type: Array,
  658. default: function() {
  659. return [];
  660. }
  661. },
  662. adviceTemplateMaps: {
  663. type: Object,
  664. default: function() {
  665. return {};
  666. }
  667. },
  668. adviceTableData: {
  669. type: Array,
  670. default: function() {
  671. return [];
  672. }
  673. }
  674. },
  675. methods: {
  676. submitgroupAdvice(formName) {
  677. this.$refs[formName].validate(valid => {
  678. if (valid) {
  679. var submitForm = {
  680. advice_type: this.groupForm.advice_type,
  681. advice_date: this.groupForm.advice_date,
  682. start_time: this.groupForm.start_time,
  683. adviceNames: [],
  684. advice_doctor: this.groupForm.advice_doctor,
  685. remark: this.groupForm.remark,
  686. parent_id: this.groupForm.parent_id
  687. };
  688. console.log("888888",this.groupForm.adviceNames)
  689. var adviceNames = [];
  690. for (const index in this.groupForm.adviceNames) {
  691. adviceNames.unshift(this.groupForm.adviceNames[index]);
  692. }
  693. submitForm.adviceNames = adviceNames;
  694. let mode = "1";
  695. console.log("88888888",submitForm)
  696. CreateGroupAdvice(this.patientID, 0, submitForm, mode).then(
  697. response => {
  698. if (response.data.state == 0) {
  699. this.$message.error(response.data.msg);
  700. return false;
  701. } else {
  702. this.$notify({
  703. title: "成功",
  704. message: "新增成功",
  705. type: "success",
  706. duration: 2000
  707. });
  708. var childMap = {};
  709. for (const index in response.data.data.advices) {
  710. if (response.data.data.advices[index].parent_id == 0) {
  711. continue;
  712. }
  713. if (
  714. response.data.data.advices[index].parent_id in childMap ===
  715. false
  716. ) {
  717. childMap[response.data.data.advices[index].parent_id] = [];
  718. }
  719. childMap[response.data.data.advices[index].parent_id].unshift(
  720. response.data.data.advices[index]
  721. );
  722. }
  723. var parentArr = [];
  724. for (const index in response.data.data.advices) {
  725. if (response.data.data.advices[index].parent_id > 0) {
  726. continue;
  727. }
  728. parentArr.push(response.data.data.advices[index]);
  729. }
  730. for (const index in parentArr) {
  731. if (parentArr[index].id in childMap) {
  732. for (const j in childMap[parentArr[index].id]) {
  733. this.adviceTableData.unshift(
  734. childMap[parentArr[index].id][j]
  735. );
  736. }
  737. }
  738. this.adviceTableData.unshift(parentArr[index]);
  739. }
  740. // var alen = response.data.data.advices.length
  741. // for (let index = alen-1; index >=0; index--) {
  742. // this.adviceTableData.unshift(response.data.data.advices[index]);
  743. // }
  744. this.resetForm(formName);
  745. this.groupAddFormVisible = false;
  746. this.$parent.getDialysisScheduleDetail()
  747. return false;
  748. }
  749. }
  750. );
  751. }
  752. });
  753. },
  754. openDeleteGroupAdvice() {
  755. if (this.groupSelectRow === null) {
  756. this.$message.error("未选择要删除的医嘱内容");
  757. return;
  758. }
  759. var content = "";
  760. if (this.groupSelectRow.children.length > 0) {
  761. content = "确认删除此医嘱内容,包括它的子药?";
  762. } else {
  763. content = "确认删除此医嘱内容?";
  764. }
  765. var isChild = !!this.groupSelectRow.parent_row;
  766. var title = isChild ? "删除子药内容" : "删除医嘱内容";
  767. var msg = isChild ? "确认删除此子药内容?" : content;
  768. this.$confirm(msg, title, {
  769. confirmButtonText: "确定",
  770. cancelButtonText: "取消",
  771. type: "warning"
  772. })
  773. .then(() => {
  774. if (isChild) {
  775. for (const index in this.groupForm.adviceNames) {
  776. if (
  777. this.groupForm.adviceNames[index].row_key ==
  778. this.groupSelectRow.parent_row
  779. ) {
  780. for (const j in this.groupForm.adviceNames[index].children) {
  781. if (
  782. this.groupForm.adviceNames[index].children[j].row_key ==
  783. this.groupSelectRow.row_key
  784. ) {
  785. this.groupForm.adviceNames[index].children.splice(j, 1);
  786. this.$set(
  787. this.groupForm.adviceNames,
  788. index,
  789. this.groupForm.adviceNames[index]
  790. );
  791. break;
  792. }
  793. }
  794. }
  795. }
  796. } else {
  797. for (const index in this.groupForm.adviceNames) {
  798. if (
  799. this.groupForm.adviceNames[index].row_key ==
  800. this.groupSelectRow.row_key
  801. ) {
  802. this.groupForm.adviceNames.splice(index, 1);
  803. break;
  804. }
  805. }
  806. }
  807. })
  808. .catch(() => {});
  809. },
  810. submitNameForm(formName) {
  811. if(typeof(this.nameForm.advice_name) == "string"){
  812. this.nameForm.advice_name == this.nameForm.advice_name
  813. }
  814. if(typeof(this.nameForm.advice_name) == "number"){
  815. var drug_name = ""
  816. var name = ""
  817. var way = 0
  818. this.nameForm.drug_id = this.nameForm.advice_name
  819. for(let i=0;i<this.medicals.length;i++){
  820. if(this.nameForm.advice_name == this.medicals[i].id){
  821. name = this.medicals[i].drug_name
  822. way = this.medicals[i].way
  823. }
  824. }
  825. if(way == 1){
  826. drug_name = name
  827. }
  828. if(way == 2){
  829. var arr = name.split("(自备药)")
  830. drug_name = arr[0]
  831. }
  832. this.nameForm.advice_name = drug_name
  833. this.nameForm.way = way
  834. }
  835. var _this = this;
  836. this.$refs[formName].validate(valid => {
  837. if (valid) {
  838. if (_this.nameForm.isEdit) {
  839. var ale = _this.groupForm.adviceNames.length;
  840. if (_this.isChild) {
  841. for (let index = 0; index < ale; index++) {
  842. if (_this.groupSelectRow.parent_row ==_this.groupForm.adviceNames[index].row_key) {
  843. var cle = _this.groupForm.adviceNames[index].children.length;
  844. var children = _this.groupForm.adviceNames[index].children;
  845. for (let j = 0; j < ale; j++) {
  846. if (_this.groupSelectRow.row_key == children[j].row_key) {
  847. _this.groupForm.adviceNames[index].children[j].advice_name = _this.nameForm.advice_name;
  848. _this.groupForm.adviceNames[index].children[j].advice_desc = _this.nameForm.advice_desc;
  849. _this.groupForm.adviceNames[index].children[j].single_dose = "" + _this.nameForm.single_dose;
  850. _this.groupForm.adviceNames[index].children[j].single_dose_unit = _this.nameForm.single_dose_unit;
  851. _this.groupForm.adviceNames[index].children[j].drug_spec = "" + _this.nameForm.drug_spec;
  852. _this.groupForm.adviceNames[index].children[j].drug_spec_unit = _this.nameForm.drug_spec_unit;
  853. _this.groupForm.adviceNames[index].children[j].prescribing_number ="" + _this.nameForm.prescribing_number;
  854. _this.groupForm.adviceNames[index].children[j].prescribing_number_unit = _this.nameForm.prescribing_number_unit;
  855. _this.groupForm.adviceNames[index].children[j].delivery_way = _this.nameForm.delivery_way;
  856. _this.groupForm.adviceNames[index].children[j].execution_frequency =_this.nameForm.execution_frequency;
  857. _this.groupForm.adviceNames[index].children[j].remark =_this.nameForm.remark;
  858. _this.groupForm.adviceNames[index].children[j].drug_id = _this.nameForm.drug_id;
  859. _this.groupForm.adviceNames[index].children[j].way = this.nameForm.way;
  860. _this.$set(_this.groupForm.adviceNames[index].children,j,_this.groupForm.adviceNames[index].children[j]
  861. );
  862. break;
  863. }
  864. }
  865. }
  866. }
  867. } else {
  868. for (let index = 0; index < ale; index++) {
  869. if ( _this.groupSelectRow.row_key ==_this.groupForm.adviceNames[index].row_key) {
  870. _this.groupForm.adviceNames[index].advice_name =_this.nameForm.advice_name;
  871. _this.groupForm.adviceNames[index].advice_desc =_this.nameForm.advice_desc;
  872. _this.groupForm.adviceNames[index].single_dose ="" + _this.nameForm.single_dose;
  873. _this.groupForm.adviceNames[index].single_dose_unit =_this.nameForm.single_dose_unit;
  874. _this.groupForm.adviceNames[index].drug_spec = "" + _this.nameForm.drug_spec;
  875. _this.groupForm.adviceNames[index].drug_spec_unit =_this.nameForm.drug_spec_unit;
  876. _this.groupForm.adviceNames[index].prescribing_number ="" + _this.nameForm.prescribing_number;
  877. _this.groupForm.adviceNames[index].prescribing_number_unit =_this.nameForm.prescribing_number_unit;
  878. _this.groupForm.adviceNames[index].delivery_way =_this.nameForm.delivery_way;
  879. _this.groupForm.adviceNames[index].execution_frequency =_this.nameForm.execution_frequency;
  880. _this.groupForm.adviceNames[index].remark =_this.nameForm.remark;
  881. _this.groupForm.adviceNames[index].children[j].drug_id = _this.nameForm.drug_id;
  882. _this.groupForm.adviceNames[index].children[j].way = this.nameForm.way;
  883. _this.$set(
  884. _this.groupForm.adviceNames,
  885. index,
  886. _this.groupForm.adviceNames[index]
  887. );
  888. break;
  889. }
  890. }
  891. }
  892. } else {
  893. if (_this.isChild) {
  894. _this.editRowKey++;
  895. _this.nameForm.row_key = _this.editRowKey;
  896. var ale = _this.groupForm.adviceNames.length;
  897. for (let index = 0; index < ale; index++) {
  898. if (_this.nameForm.parent_row ==_this.groupForm.adviceNames[index].row_key) {
  899. _this.groupForm.adviceNames[index].children.push(_this.nameForm);
  900. _this.$set(_this.groupForm.adviceNames,index,_this.groupForm.adviceNames[index]);
  901. break;
  902. }
  903. }
  904. } else {
  905. _this.editRowKey++;
  906. _this.nameForm.row_key = _this.editRowKey;
  907. _this.groupForm.adviceNames.push(_this.nameForm);
  908. }
  909. }
  910. _this.nameFormVisible = false;
  911. }
  912. });
  913. },
  914. openGroupChild() {
  915. if (this.groupSelectRow === null) {
  916. this.$message.error("未选择医嘱内容,无法添加子药");
  917. return;
  918. } else if (this.groupSelectRow.parent_row > 0) {
  919. this.$notify.error({
  920. title: "错误",
  921. message: "子药不能添加子药"
  922. });
  923. return;
  924. }
  925. this.nameForm = {
  926. advice_name:"",
  927. advice_desc: "",
  928. single_dose: "",
  929. single_dose_unit: "",
  930. drug_spec: "",
  931. drug_spec_unit: "",
  932. prescribing_number: "",
  933. prescribing_number_unit: "",
  934. delivery_way: this.groupSelectRow.delivery_way,
  935. execution_frequency: this.groupSelectRow.execution_frequency,
  936. remark: "",
  937. isEdit: 0,
  938. index: 0,
  939. children: [],
  940. parent_row: this.groupSelectRow.row_key,
  941. id: 0
  942. };
  943. this.isChild = true;
  944. this.nameFormVisible = true;
  945. this.nameFormTitle = "添加子药内容";
  946. },
  947. openGroupAdvice(isEdit) {
  948. this.isChild = false;
  949. if (isEdit) {
  950. if (this.groupSelectRow === null) {
  951. this.$message.error("未选择要修改的医嘱内容");
  952. return;
  953. }
  954. if (this.groupSelectRow.parent_row) {
  955. this.isChild = true;
  956. }
  957. this.nameForm = {
  958. advice_name: this.groupSelectRow.advice_name,
  959. advice_desc: this.groupSelectRow.advice_desc,
  960. single_dose:
  961. this.groupSelectRow.single_dose != 0
  962. ? this.groupSelectRow.single_dose
  963. : "",
  964. single_dose_unit: this.groupSelectRow.single_dose_unit,
  965. drug_spec:
  966. this.groupSelectRow.drug_spec != 0
  967. ? this.groupSelectRow.drug_spec
  968. : "",
  969. drug_spec_unit: this.groupSelectRow.drug_spec_unit,
  970. prescribing_number:
  971. this.groupSelectRow.prescribing_number != 0
  972. ? this.groupSelectRow.prescribing_number
  973. : "",
  974. prescribing_number_unit: this.groupSelectRow.prescribing_number_unit,
  975. delivery_way: this.isChild ? "" : this.groupSelectRow.delivery_way,
  976. execution_frequency: this.isChild
  977. ? ""
  978. : this.groupSelectRow.execution_frequency,
  979. isEdit: 1,
  980. index: this.groupSelectRow.index,
  981. id: this.groupSelectRow.id,
  982. children: [],
  983. parent_row: this.groupSelectRow.parent_row,
  984. remark: this.groupSelectRow.remark
  985. // row_key:this.groupSelectRow.row_key,
  986. };
  987. this.nameFormTitle = "修改医嘱内容";
  988. } else {
  989. this.nameForm = {
  990. advice_name: "",
  991. advice_desc: "",
  992. single_dose: "",
  993. single_dose_unit: "",
  994. drug_spec: "",
  995. drug_spec_unit: "",
  996. prescribing_number: "",
  997. prescribing_number_unit: "",
  998. delivery_way: "",
  999. execution_frequency: "",
  1000. isEdit: 0,
  1001. index: 0,
  1002. id: 0,
  1003. remark: "",
  1004. children: [],
  1005. parent_row: 0
  1006. };
  1007. this.nameFormTitle = "新增医嘱内容";
  1008. }
  1009. this.nameFormVisible = true;
  1010. },
  1011. changeAdvice(selection) {
  1012. this.selectedTemplate = selection;
  1013. },
  1014. selectAdvice(selection, row) {
  1015. // this.selectedTemplate = [];
  1016. // console.log(selection);
  1017. var adviceArray = this.adviceTemplateMaps[this.selectedTemp.id]
  1018. .DoctorAdviceTemplate;
  1019. console.log(adviceArray);
  1020. for (let y = 0; y < adviceArray.length; y++) {
  1021. adviceArray[y].selection = false;
  1022. }
  1023. if (selection.length > 0) {
  1024. for (let y = 0; y < adviceArray.length; y++) {
  1025. for (let i = 0; i < selection.length; i++) {
  1026. if (adviceArray[y].id == selection[i].advice_id) {
  1027. adviceArray[y].selection = true;
  1028. }
  1029. }
  1030. }
  1031. }
  1032. // console.log(adviceArray);
  1033. if (row.children.length > 0) {
  1034. for (const index in row.children) {
  1035. this.$refs.selecttemplatetable.toggleRowSelection(
  1036. row.children[index]
  1037. );
  1038. }
  1039. }
  1040. // 下面两步的作用是为了上选中的数据的输出顺序不变
  1041. for (const index in this.selectedTemp.list) {
  1042. this.$refs.selecttemplatetable.toggleRowSelection(
  1043. this.selectedTemp.list[index]
  1044. );
  1045. if (this.selectedTemp.list[index].children.length > 0) {
  1046. for (const j in this.selectedTemp.list[index].children) {
  1047. this.$refs.selecttemplatetable.toggleRowSelection(
  1048. this.selectedTemp.list[index].children[j]
  1049. );
  1050. }
  1051. }
  1052. }
  1053. for (const index in this.selectedTemp.list) {
  1054. this.$refs.selecttemplatetable.toggleRowSelection(
  1055. this.selectedTemp.list[index]
  1056. );
  1057. if (this.selectedTemp.list[index].children.length > 0) {
  1058. for (const j in this.selectedTemp.list[index].children) {
  1059. this.$refs.selecttemplatetable.toggleRowSelection(
  1060. this.selectedTemp.list[index].children[j]
  1061. );
  1062. }
  1063. }
  1064. }
  1065. },
  1066. spanselecttable({ row, column, rowIndex, columnIndex }) {
  1067. if (columnIndex == 0) {
  1068. const _row = this.selectedTemp.rows[rowIndex];
  1069. const _col = _row > 0 ? 1 : 0;
  1070. return {
  1071. rowspan: _row,
  1072. colspan: _col
  1073. };
  1074. }
  1075. },
  1076. calcselectedTemp() {
  1077. var rowKeys = 0;
  1078. for (const index in this.selectedTemp.list) {
  1079. var pkey = rowKeys;
  1080. this.selectedTemp.rows[rowKeys] = 1;
  1081. if (this.selectedTemp.list[index].children.length > 0) {
  1082. for (const childindex in this.selectedTemp.list[index].children) {
  1083. rowKeys++;
  1084. this.selectedTemp.rows[pkey] += 1;
  1085. this.selectedTemp.rows[rowKeys] = 0;
  1086. }
  1087. }
  1088. rowKeys++;
  1089. this.$nextTick(function() {
  1090. if (this.selectedTemp.list[index].selection) {
  1091. this.$refs.selecttemplatetable.toggleRowSelection(
  1092. this.selectedTemp.list[index]
  1093. );
  1094. }
  1095. });
  1096. }
  1097. },
  1098. templateTableChange(currentRow, oldCurrentRow) {
  1099. this.selectedTemp = { id: 0, name: "", org_id: 0, list: [], rows: [] };
  1100. if (currentRow == null) {
  1101. return false;
  1102. }
  1103. this.selectedTemp.id = currentRow.id;
  1104. this.selectedTemp.name = currentRow.name;
  1105. this.selectedTemp.org_id = currentRow.org_id;
  1106. if (this.selectedTemp.id in this.adviceTemplateMaps) {
  1107. var mapid = this.selectedTemp.id;
  1108. var thisRowKey = 0;
  1109. for (const index in this.adviceTemplateMaps[mapid]
  1110. .DoctorAdviceTemplate) {
  1111. thisRowKey++;
  1112. var item = {
  1113. advice_name: this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[
  1114. index
  1115. ].advice_name,
  1116. advice_desc: this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[
  1117. index
  1118. ].advice_desc,
  1119. single_dose:
  1120. "" +
  1121. this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index]
  1122. .single_dose,
  1123. single_dose_unit: this.adviceTemplateMaps[mapid]
  1124. .DoctorAdviceTemplate[index].single_dose_unit,
  1125. drug_spec:
  1126. "" +
  1127. this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].drug_spec,
  1128. drug_spec_unit: this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].drug_spec_unit,
  1129. prescribing_number:
  1130. "" +
  1131. this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index]
  1132. .prescribing_number,
  1133. prescribing_number_unit: this.adviceTemplateMaps[mapid]
  1134. .DoctorAdviceTemplate[index].prescribing_number_unit,
  1135. delivery_way: this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[
  1136. index
  1137. ].delivery_way,
  1138. execution_frequency: this.adviceTemplateMaps[mapid]
  1139. .DoctorAdviceTemplate[index].execution_frequency,
  1140. selection: this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[
  1141. index
  1142. ].selection,
  1143. advice_id: this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[
  1144. index
  1145. ].id,
  1146. isEdit: 0,
  1147. id: 0,
  1148. children: [],
  1149. parent_row: 0,
  1150. row_key: thisRowKey
  1151. };
  1152. if (
  1153. "children" in
  1154. this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index] &&
  1155. this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].children
  1156. .length > 0
  1157. ) {
  1158. var parentRow = thisRowKey;
  1159. var children = this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[
  1160. index
  1161. ].children;
  1162. for (const key in children) {
  1163. thisRowKey++;
  1164. var child = {
  1165. advice_id: children[key].id,
  1166. advice_name: children[key].advice_name,
  1167. advice_desc: children[key].advice_desc,
  1168. single_dose: "" + children[key].single_dose,
  1169. single_dose_unit: children[key].single_dose_unit,
  1170. drug_spec: "" + children[key].drug_spec,
  1171. drug_spec_unit: children[key].drug_spec_unit,
  1172. prescribing_number: "" + children[key].prescribing_number,
  1173. prescribing_number_unit: children[key].prescribing_number_unit,
  1174. delivery_way: children[key].delivery_way,
  1175. execution_frequency: children[key].execution_frequency,
  1176. isEdit: 0,
  1177. id: 0,
  1178. children: [],
  1179. parent_row: parentRow,
  1180. row_key: thisRowKey
  1181. };
  1182. item.children.push(child);
  1183. }
  1184. this.$set(item, "children", item.children);
  1185. }
  1186. this.selectedTemp.list.unshift(item);
  1187. }
  1188. }
  1189. },
  1190. newAddTempForm() {
  1191. this.allSelectedTemplate = [];
  1192. var thisRowKey = 0;
  1193. for (const indexs in this.adviceTemplateMaps) {
  1194. const adviceTemplate = this.adviceTemplateMaps[indexs];
  1195. for (const index in adviceTemplate.DoctorAdviceTemplate) {
  1196. if (adviceTemplate.DoctorAdviceTemplate[index].selection) {
  1197. thisRowKey++;
  1198. var item = {
  1199. advice_name:
  1200. adviceTemplate.DoctorAdviceTemplate[index].advice_name,
  1201. advice_desc:
  1202. adviceTemplate.DoctorAdviceTemplate[index].advice_desc,
  1203. single_dose:
  1204. "" + adviceTemplate.DoctorAdviceTemplate[index].single_dose,
  1205. single_dose_unit:
  1206. adviceTemplate.DoctorAdviceTemplate[index].single_dose_unit,
  1207. drug_spec:
  1208. "" + adviceTemplate.DoctorAdviceTemplate[index].drug_spec,
  1209. drug_spec_unit:
  1210. adviceTemplate.DoctorAdviceTemplate[index].drug_spec_unit,
  1211. prescribing_number:
  1212. "" +
  1213. adviceTemplate.DoctorAdviceTemplate[index].prescribing_number,
  1214. prescribing_number_unit:
  1215. adviceTemplate.DoctorAdviceTemplate[index]
  1216. .prescribing_number_unit,
  1217. delivery_way:
  1218. adviceTemplate.DoctorAdviceTemplate[index].delivery_way,
  1219. execution_frequency:
  1220. adviceTemplate.DoctorAdviceTemplate[index].execution_frequency,
  1221. advice_id: adviceTemplate.DoctorAdviceTemplate[index].id,
  1222. selection: adviceTemplate.DoctorAdviceTemplate[index].selection,
  1223. isEdit: 0,
  1224. id: 0,
  1225. children: [],
  1226. parent_row: 0,
  1227. row_key: thisRowKey
  1228. };
  1229. if (
  1230. "children" in adviceTemplate.DoctorAdviceTemplate[index] &&
  1231. adviceTemplate.DoctorAdviceTemplate[index].children.length > 0
  1232. ) {
  1233. var parentRow = thisRowKey;
  1234. var children =
  1235. adviceTemplate.DoctorAdviceTemplate[index].children;
  1236. for (const key in children) {
  1237. thisRowKey++;
  1238. var child = {
  1239. advice_id: children[key].id,
  1240. advice_name: children[key].advice_name,
  1241. advice_desc: children[key].advice_desc,
  1242. single_dose: "" + children[key].single_dose,
  1243. single_dose_unit: children[key].single_dose_unit,
  1244. drug_spec: "" + children[key].drug_spec,
  1245. drug_spec_unit: children[key].drug_spec_unit,
  1246. prescribing_number: "" + children[key].prescribing_number,
  1247. prescribing_number_unit:
  1248. children[key].prescribing_number_unit,
  1249. delivery_way: children[key].delivery_way,
  1250. execution_frequency: children[key].execution_frequency,
  1251. isEdit: 0,
  1252. id: 0,
  1253. children: [],
  1254. parent_row: parentRow,
  1255. row_key: thisRowKey
  1256. };
  1257. item.children.push(child);
  1258. this.allSelectedTemplate.unshift(child);
  1259. }
  1260. this.$set(item, "children", item.children);
  1261. }
  1262. this.allSelectedTemplate.unshift(item);
  1263. adviceTemplate.DoctorAdviceTemplate[index].selection = false;
  1264. }
  1265. }
  1266. }
  1267. var childMap = {};
  1268. for (const index in this.allSelectedTemplate) {
  1269. if (this.allSelectedTemplate[index].parent_row > 0) {
  1270. if (!(this.allSelectedTemplate[index].parent_row in childMap)) {
  1271. childMap[this.allSelectedTemplate[index].parent_row] = [];
  1272. }
  1273. childMap[this.allSelectedTemplate[index].parent_row].push(
  1274. this.allSelectedTemplate[index]
  1275. );
  1276. }
  1277. }
  1278. for (const index in this.allSelectedTemplate) {
  1279. if (this.allSelectedTemplate[index].parent_row > 0) {
  1280. continue;
  1281. }
  1282. this.editRowKey++;
  1283. var item = {
  1284. advice_name: this.allSelectedTemplate[index].advice_name,
  1285. advice_desc: this.allSelectedTemplate[index].advice_desc,
  1286. single_dose: "" + this.allSelectedTemplate[index].single_dose,
  1287. single_dose_unit: this.allSelectedTemplate[index].single_dose_unit,
  1288. drug_spec: "" + this.allSelectedTemplate[index].drug_spec,
  1289. drug_spec_unit: this.allSelectedTemplate[index].drug_spec_unit,
  1290. prescribing_number:
  1291. "" + this.allSelectedTemplate[index].prescribing_number,
  1292. prescribing_number_unit: this.allSelectedTemplate[index]
  1293. .prescribing_number_unit,
  1294. delivery_way: this.allSelectedTemplate[index].delivery_way,
  1295. execution_frequency: this.allSelectedTemplate[index]
  1296. .execution_frequency,
  1297. isEdit: 0,
  1298. id: 0,
  1299. children: [],
  1300. parent_row: 0,
  1301. row_key: this.editRowKey
  1302. };
  1303. if (this.allSelectedTemplate[index].children.length > 0) {
  1304. if (this.allSelectedTemplate[index].row_key in childMap) {
  1305. var parentRow = this.editRowKey;
  1306. var children = childMap[this.allSelectedTemplate[index].row_key];
  1307. for (const key in children) {
  1308. this.editRowKey++;
  1309. var child = {
  1310. advice_name: children[key].advice_name,
  1311. advice_desc: children[key].advice_desc,
  1312. single_dose: "" + children[key].single_dose,
  1313. single_dose_unit: children[key].single_dose_unit,
  1314. drug_spec: "" + children[key].drug_spec,
  1315. drug_spec_unit: children[key].drug_spec_unit,
  1316. prescribing_number: "" + children[key].prescribing_number,
  1317. prescribing_number_unit: children[key].prescribing_number_unit,
  1318. delivery_way: children[key].delivery_way,
  1319. execution_frequency: children[key].execution_frequency,
  1320. isEdit: 0,
  1321. id: 0,
  1322. children: [],
  1323. parent_row: parentRow,
  1324. row_key: this.editRowKey
  1325. };
  1326. item.children.push(child);
  1327. }
  1328. this.$set(item, "children", item.children);
  1329. }
  1330. }
  1331. console.log(this.groupForm.adviceNames)
  1332. this.groupForm.adviceNames.push(item);
  1333. }
  1334. this.templateFormVisible = false;
  1335. },
  1336. addTempForm(formName) {
  1337. var _this = this;
  1338. this.$refs[formName].validate(valid => {
  1339. if (valid) {
  1340. if (_this.templateForm.id in _this.adviceTemplateMaps) {
  1341. var mapid = _this.templateForm.id;
  1342. for (const index in _this.adviceTemplateMaps[mapid]
  1343. .DoctorAdviceTemplate) {
  1344. this.editRowKey++;
  1345. var item = {advice_name:_this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].advice_name,
  1346. advice_desc:_this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].advice_desc,
  1347. single_dose:"" +_this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].single_dose,
  1348. single_dose_unit:_this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].single_dose_unit,
  1349. drug_spec:"" +_this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].drug_spec,
  1350. drug_spec_unit:_this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].drug_spec_unit,
  1351. prescribing_number:"" +_this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].prescribing_number,
  1352. prescribing_number_unit:_this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].prescribing_number_unit,
  1353. delivery_way:_this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].delivery_way,
  1354. execution_frequency:_this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].execution_frequency,
  1355. isEdit: 0,
  1356. id: 0,
  1357. children: [],
  1358. parent_row: 0,
  1359. row_key: this.editRowKey
  1360. };
  1361. if (
  1362. "children" in
  1363. _this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index] &&
  1364. _this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index]
  1365. .children
  1366. ) {
  1367. var parentRow = this.editRowKey;
  1368. var children =
  1369. _this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index]
  1370. .children;
  1371. for (const key in children) {
  1372. this.editRowKey++;
  1373. var child = {
  1374. advice_name: children[key].advice_name,
  1375. advice_desc: children[key].advice_desc,
  1376. single_dose: "" + children[key].single_dose,
  1377. single_dose_unit: children[key].single_dose_unit,
  1378. drug_spec: "" + children[key].drug_spec,
  1379. drug_spec_unit: children[key].drug_spec_unit,
  1380. prescribing_number: "" + children[key].prescribing_number,
  1381. prescribing_number_unit:
  1382. children[key].prescribing_number_unit,
  1383. delivery_way: children[key].delivery_way,
  1384. execution_frequency: children[key].execution_frequency,
  1385. isEdit: 0,
  1386. id: 0,
  1387. children: [],
  1388. parent_row: parentRow,
  1389. row_key: this.editRowKey
  1390. };
  1391. item.children.push(child);
  1392. }
  1393. _this.$set(item, "children", item.children);
  1394. }
  1395. _this.groupForm.adviceNames.unshift(item);
  1396. }
  1397. }
  1398. _this.templateFormVisible = false;
  1399. }
  1400. });
  1401. },
  1402. openAdviceTemplate() {
  1403. this.templateForm = { id: "" };
  1404. this.selectedTemp = { id: 0, name: "", org_id: 0, list: [], rows: [] };
  1405. this.selectedTemplate = [];
  1406. if (typeof this.$refs.templatetable !== "undefined") {
  1407. this.$refs.templatetable.setCurrentRow(null);
  1408. }
  1409. this.templateFormVisible = true;
  1410. },
  1411. selectGroupAdvice(row) {
  1412. this.groupSelectRow = row;
  1413. },
  1414. groupClassName({ row, rowIndex }) {
  1415. row.index = rowIndex;
  1416. },
  1417. getRowKey(row) {
  1418. return row.row_key;
  1419. },
  1420. resetForm(formName) {
  1421. this.$refs[formName].resetFields();
  1422. },
  1423. open() {
  1424. this.groupAddFormVisible = true;
  1425. this.groupSelectRow = null;
  1426. if (typeof this.$refs.advicenametable !== "undefined") {
  1427. this.$refs.advicenametable.setCurrentRow(null);
  1428. }
  1429. this.editRowKey = 0;
  1430. this.groupForm = {
  1431. advice_type: 2,
  1432. advice_date: this.recordDate,
  1433. start_time: "",
  1434. adviceNames: [],
  1435. advice_doctor: "",
  1436. remark: "",
  1437. parent_id: 0
  1438. };
  1439. var xtuser = this.$store.getters.xt_user;
  1440. // this.orgname = xtuser.org.org_name;
  1441. this.adminusername = xtuser.user.user_name;
  1442. },
  1443. selectAllTemplateAdvice(selection) {
  1444. var adviceArray = this.adviceTemplateMaps[this.selectedTemp.id]
  1445. .DoctorAdviceTemplate;
  1446. for (let y = 0; y < adviceArray.length; y++) {
  1447. adviceArray[y].selection = false;
  1448. }
  1449. if (selection.length > 0) {
  1450. for (let y = 0; y < adviceArray.length; y++) {
  1451. for (let i = 0; i < selection.length; i++) {
  1452. if (adviceArray[y].id == selection[i].advice_id) {
  1453. adviceArray[y].selection = true;
  1454. }
  1455. }
  1456. }
  1457. }
  1458. },
  1459. cancleDialog() {
  1460. this.templateFormVisible = false;
  1461. for (const indexs in this.adviceTemplateMaps) {
  1462. const adviceTemplate = this.adviceTemplateMaps[indexs];
  1463. for (const index in adviceTemplate.DoctorAdviceTemplate) {
  1464. adviceTemplate.DoctorAdviceTemplate[index].selection = false;
  1465. }
  1466. }
  1467. },
  1468. //
  1469. getSelfMedicalList(){
  1470. const params = {
  1471. patient_id:this.$route.query.patient_id
  1472. }
  1473. getSelfMedicalList(params).then(response=>{
  1474. if(response.data.state == 1){
  1475. var medicalList = response.data.data.medicalList
  1476. //way字段区分数据源:1代表来自基础库 2代表来自药品库
  1477. for(let i=0;i<medicalList.length;i++){
  1478. medicalList[i].way = 2
  1479. }
  1480. for(let i=0;i<medicalList.length;i++){
  1481. medicalList[i].drug_name = medicalList[i].drug_name+"(自备药)"
  1482. }
  1483. var drugname = response.data.data.drugName
  1484. for(let i=0;i<drugname.length;i++){
  1485. drugname[i].way = 1
  1486. }
  1487. drugname.push(...medicalList)
  1488. this.medicals = drugname
  1489. }
  1490. })
  1491. },
  1492. changeDrugName(id){
  1493. var drug_name = ""
  1494. var name = ""
  1495. var way = 0
  1496. for(let i=0;i<this.medicals.length;i++){
  1497. if(id == this.medicals[i].id){
  1498. name = this.medicals[i].drug_name
  1499. way = this.medicals[i].way
  1500. }
  1501. }
  1502. if(way == 1){
  1503. drug_name = name
  1504. }
  1505. if(way == 2){
  1506. var arr = name.split("(自备药)")
  1507. drug_name = arr[0]
  1508. }
  1509. const params = {
  1510. drug_name:drug_name,
  1511. patient_id:this.$route.query.patient_id,
  1512. way:way,
  1513. id:id,
  1514. }
  1515. getDrugDescByDrugName(params).then(response=>{
  1516. if(response.data.state == 1){
  1517. var drugspec = response.data.data.drugspec
  1518. if(drugspec[0].drug_spec !=0){
  1519. this.nameForm.advice_desc = drugspec[0].drug_spec
  1520. }
  1521. if(drugspec[0].min_unit!=0){
  1522. this.nameForm.drug_spec_unit = drugspec[0].min_unit
  1523. }
  1524. if(drugspec[0].delivery_way!=0){
  1525. this.nameForm.delivery_way = drugspec[0].delivery_way
  1526. }
  1527. if(drugspec[0].execution_frequency!=0){
  1528. this.nameForm.execution_frequency = drugspec[0].execution_frequency
  1529. }
  1530. if(drugspec[0].single_dose !=0){
  1531. this.nameForm.single_dose = drugspec[0].single_dose.toString()
  1532. if(drugspec[0].min_unit !=0){
  1533. this.nameForm.single_dose_unit = drugspec[0].min_unit
  1534. }
  1535. if(drugspec[0].min_unit!=0){
  1536. this.nameForm.prescribing_number_unit = drugspec[0].min_unit
  1537. }
  1538. if( drugspec[0].prescribing_number!=0){
  1539. this.nameForm.prescribing_number = drugspec[0].prescribing_number.toString()
  1540. }
  1541. var countInfo = response.data.data.countInfo
  1542. console.log("countInfo",countInfo)
  1543. var countOut = response.data.data.countout
  1544. console.log("countout",countOut)
  1545. var arr = countInfo[0].Count - countOut[0].Count
  1546. console.log("arr222",arr)
  1547. this.drugSpec = drugspec
  1548. }
  1549. })
  1550. }
  1551. },
  1552. watch: {
  1553. "selectedTemp.list": function() {
  1554. this.calcselectedTemp();
  1555. }
  1556. },
  1557. created(){
  1558. //获取自备药
  1559. this.getSelfMedicalList()
  1560. }
  1561. };
  1562. </script>
  1563. <style>
  1564. #user-edit-advice-name-table .el-table__row {
  1565. display: table-row !important;
  1566. }
  1567. #user-edit-advice-name-table .el-table__expand-icon {
  1568. -webkit-transform: rotate(90deg) !important;
  1569. transform: rotate(90deg) !important;
  1570. }
  1571. #dialysis-add-select-template-table .el-table__row {
  1572. display: table-row !important;
  1573. }
  1574. #dialysis-add-select-template-table .el-table__expand-icon {
  1575. -webkit-transform: rotate(90deg) !important;
  1576. transform: rotate(90deg) !important;
  1577. }
  1578. </style>