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

EditGroupAdvice.vue 94KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533
  1. <template>
  2. <div id="user-edit-group-advice">
  3. <el-dialog
  4. title="编辑医嘱"
  5. :visible.sync="groupEditFormVisible"
  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 label="开始时间 :" required prop="start_time">
  22. <el-date-picker
  23. type="datetime"
  24. format="yyyy-MM-dd HH:mm"
  25. value-format="yyyy-MM-dd HH:mm"
  26. placeholder="选择时间"
  27. v-model="groupForm.start_time"
  28. ></el-date-picker>
  29. </el-form-item>
  30. </el-col>
  31. </el-row>
  32. <el-row>
  33. <el-col :span="12">
  34. <el-form-item label="开嘱医生 :">
  35. <span>{{ adminusername }} </span>
  36. </el-form-item>
  37. </el-col>
  38. <el-col :span="12">
  39. <el-form-item label="开嘱时间 :">
  40. <span>{{ groupForm.advice_date }} </span>
  41. </el-form-item>
  42. </el-col>
  43. </el-row>
  44. <el-row>
  45. <el-col :span="2">&nbsp;&nbsp;</el-col>
  46. <el-col :span="5">
  47. <el-button
  48. :disabled="
  49. $store.getters.xt_user.subscibe.state == 3 ? true : false
  50. "
  51. round
  52. @click="openAdviceTemplate()"
  53. >选择医嘱模板
  54. </el-button>
  55. </el-col>
  56. <el-col :span="5">
  57. <el-button
  58. :disabled="
  59. $store.getters.xt_user.subscibe.state == 3 ? true : false
  60. "
  61. round
  62. @click="openGroupAdvice(0)"
  63. >新增医嘱内容
  64. </el-button>
  65. </el-col>
  66. <el-col :span="5">
  67. <el-button
  68. :disabled="
  69. $store.getters.xt_user.subscibe.state == 3 ? true : false
  70. "
  71. round
  72. @click="openGroupAdvice(1)"
  73. >修改医嘱内容
  74. </el-button>
  75. </el-col>
  76. <el-col :span="5">
  77. <el-button
  78. :disabled="
  79. $store.getters.xt_user.subscibe.state == 3 ? true : false
  80. "
  81. round
  82. @click="openDeleteGroupAdvice()"
  83. >删除医嘱内容
  84. </el-button>
  85. </el-col>
  86. </el-row>
  87. <el-row>
  88. <el-col :span="24">
  89. <el-table
  90. id="user-edit-advice-name-table"
  91. :data="groupForm.adviceNames"
  92. border
  93. fit
  94. :header-cell-style="{ backgroundColor: 'rgb(245, 247, 250)' }"
  95. highlight-current-row
  96. :row-class-name="groupClassName"
  97. @current-change="selectGroupAdvice"
  98. style="width: 100%;margin-top: 10px;margin-bottom: 10px;"
  99. :row-key="getRowKey"
  100. ref="advicenametable"
  101. >
  102. <el-table-column
  103. label="医嘱名称"
  104. property="advice_name"
  105. align="center"
  106. style="word-break: keep-all;white-space:nowrap;"
  107. ></el-table-column>
  108. <el-table-column
  109. label="药品规格"
  110. property="advice_desc"
  111. align="center"
  112. >
  113. <template slot-scope="scope">
  114. <span v-if="scope.row.advice_desc"
  115. >{{ scope.row.advice_desc
  116. }}{{ scope.row.drug_spec_unit }}</span
  117. >
  118. </template>
  119. </el-table-column>
  120. <!-- <el-table-column label="药品规格*数量" min-width="80" property="drug_spec" align="center">
  121. <template slot-scope="scope">
  122. <span
  123. v-if="scope.row.drug_spec!=0"
  124. >{{scope.row.drug_spec}}{{scope.row.drug_spec_unit}}</span>
  125. <span
  126. v-if="scope.row.prescribing_number!=0"
  127. >*{{scope.row.prescribing_number}}{{scope.row.prescribing_number_unit}}</span>
  128. </template>
  129. </el-table-column> -->
  130. <el-table-column
  131. label="开药数量"
  132. min-width="80"
  133. property="prescribing_number"
  134. align="center"
  135. >
  136. <template slot-scope="scope">
  137. <span v-if="scope.row.prescribing_number != 0"
  138. >{{ scope.row.prescribing_number
  139. }}{{ scope.row.prescribing_number_unit }}</span
  140. >
  141. </template>
  142. </el-table-column>
  143. <el-table-column
  144. label="单次用量"
  145. min-width="80"
  146. property="single_dose"
  147. align="center"
  148. >
  149. <template slot-scope="scope">
  150. <!-- <span v-if="scope.row.single_dose != 0"
  151. >{{ scope.row.single_dose
  152. }}{{ scope.row.single_dose_unit }}</span
  153. > -->
  154. {{ scope.row.single_dose}}
  155. <span v-if="scope.row.single_dose_unit >0"> {{getUnit(scope.row.single_dose_unit )}}</span>
  156. <span v-else>{{ scope.row.single_dose_unit }}</span>
  157. </template>
  158. </el-table-column>
  159. <el-table-column
  160. label="给药途径"
  161. min-width="80"
  162. property="delivery_way"
  163. align="center"
  164. >
  165. <template slot-scope="scope">
  166. <span v-if="scope.row.parent_row == 0">{{
  167. scope.row.delivery_way
  168. }}</span>
  169. </template>
  170. </el-table-column>
  171. <el-table-column
  172. label="执行频率"
  173. min-width="80"
  174. property="execution_frequency"
  175. align="center"
  176. >
  177. <template slot-scope="scope">
  178. <span v-if="scope.row.parent_row == 0">{{
  179. scope.row.execution_frequency
  180. }}</span>
  181. </template>
  182. </el-table-column>
  183. <el-table-column
  184. label="医嘱嘱托"
  185. min-width="80"
  186. property="remark"
  187. align="center"
  188. >
  189. <template slot-scope="scope">
  190. <span v-if="scope.row.parent_row == 0">{{
  191. scope.row.remark
  192. }}</span>
  193. </template>
  194. </el-table-column>
  195. </el-table>
  196. </el-col>
  197. </el-row>
  198. </el-form>
  199. <span slot="footer" class="dialog-footer">
  200. <el-button @click="groupEditFormVisible = false">取 消</el-button>
  201. <el-button type="primary" @click="SaveEditAdvices">保 存</el-button>
  202. </span>
  203. </el-dialog>
  204. <el-dialog
  205. title="选择医嘱模板"
  206. :visible.sync="templateFormVisible"
  207. width="72%"
  208. :close-on-click-modal="false"
  209. >
  210. <el-row :gutter="20">
  211. <el-col :span="8">
  212. <el-table
  213. :data="adviceTemplates"
  214. ref="templatetable"
  215. border
  216. highlight-current-row
  217. @current-change="templateTableChange"
  218. :header-cell-style="{ backgroundColor: 'rgb(245, 247, 250)' }"
  219. style="width: 100%"
  220. >
  221. <el-table-column prop="name" align="center" label="模板名称">
  222. </el-table-column>
  223. </el-table>
  224. </el-col>
  225. <el-col :span="16">
  226. <el-table
  227. id="dialysis-update-select-template-table"
  228. :data="selectedTemp.list"
  229. border
  230. :span-method="spanselecttable"
  231. @select="selectAdvice"
  232. @selection-change="changeAdvice"
  233. @select-all="selectAllTemplateAdvice"
  234. row-key="row_key"
  235. ref="selecttemplatetable"
  236. style="width: 100%"
  237. :header-cell-style="{ backgroundColor: 'rgb(245, 247, 250)' }"
  238. >
  239. <el-table-column type="selection" width="55"> </el-table-column>
  240. <el-table-column
  241. label="医嘱内容"
  242. property="advice_name"
  243. align="center"
  244. style="word-break: keep-all;white-space:nowrap;"
  245. ></el-table-column>
  246. <el-table-column label="规格" align="center">
  247. <template slot-scope="scope">
  248. <span v-if="scope.row.advice_desc"
  249. >{{ scope.row.advice_desc
  250. }}{{ scope.row.drug_spec_unit }}</span
  251. >
  252. </template>
  253. </el-table-column>
  254. <el-table-column
  255. label="开药数量"
  256. min-width="80"
  257. property="prescribing_number"
  258. align="center"
  259. >
  260. <template slot-scope="scope">
  261. <span v-if="scope.row.prescribing_number != 0"
  262. >{{ scope.row.prescribing_number
  263. }}{{ scope.row.prescribing_number_unit }}</span
  264. >
  265. </template>
  266. </el-table-column>
  267. <el-table-column
  268. label="单次用量"
  269. min-width="80"
  270. property="single_dose"
  271. align="center"
  272. >
  273. <template slot-scope="scope">
  274. <span v-if="scope.row.single_dose != 0"
  275. >{{ scope.row.single_dose
  276. }}{{ scope.row.single_dose_unit }}</span
  277. >
  278. </template>
  279. </el-table-column>
  280. <el-table-column
  281. label="给药途径"
  282. min-width="80"
  283. property="delivery_way"
  284. align="center"
  285. >
  286. <template slot-scope="scope">
  287. <span v-if="scope.row.parent_row == 0">{{
  288. scope.row.delivery_way
  289. }}</span>
  290. </template>
  291. </el-table-column>
  292. <el-table-column
  293. label="执行频率"
  294. min-width="80"
  295. property="execution_frequency"
  296. align="center"
  297. >
  298. <template slot-scope="scope">
  299. <span v-if="scope.row.parent_row == 0">{{
  300. scope.row.execution_frequency
  301. }}</span>
  302. </template>
  303. </el-table-column>
  304. </el-table>
  305. </el-col>
  306. </el-row>
  307. <div slot="footer" class="dialog-footer">
  308. <el-button @click="cancleDialog()">取消</el-button>
  309. <el-button
  310. :disabled="$store.getters.xt_user.subscibe.state == 3 ? true : false"
  311. type="primary"
  312. @click="newAddTempForm()"
  313. >保 存
  314. </el-button>
  315. </div>
  316. </el-dialog>
  317. <el-dialog
  318. title="选择医嘱模板"
  319. :visible.sync="oldTemplateFormVisible"
  320. width="700px"
  321. >
  322. <el-form ref="templateForm" :rules="templateRules" :model="templateForm">
  323. <el-row>
  324. <el-col :span="24">
  325. <el-form-item prop="id">
  326. <el-select
  327. v-model="templateForm.id"
  328. filterable
  329. clearable
  330. placeholder="请选择(输入可搜索)"
  331. style="width:100%"
  332. >
  333. <el-option
  334. v-for="item in adviceTemplates"
  335. :key="item.id"
  336. :label="item.name"
  337. :value="item.id"
  338. ></el-option>
  339. </el-select>
  340. </el-form-item>
  341. </el-col>
  342. </el-row>
  343. </el-form>
  344. <div slot="footer" class="dialog-footer">
  345. <el-button @click="templateFormVisible = false">取消</el-button>
  346. <el-button
  347. :disabled="$store.getters.xt_user.subscibe.state == 3 ? true : false"
  348. type="primary"
  349. @click="addTempForm('templateForm')"
  350. >保 存
  351. </el-button>
  352. </div>
  353. </el-dialog>
  354. <el-dialog
  355. :title="nameFormTitle"
  356. :visible.sync="nameFormVisible"
  357. width="800px"
  358. >
  359. <el-form
  360. ref="nameForm"
  361. :rules="nameRules"
  362. :model="nameForm"
  363. label-width="120px"
  364. >
  365. <el-row>
  366. <el-col :span="10">
  367. <el-form-item label="医嘱内容 :" required prop="advice_name">
  368. <!-- <el-input v-model="nameForm.advice_name"></el-input> -->
  369. <!-- <el-select
  370. v-model="nameForm.advice_name"
  371. filterable
  372. clearable
  373. allow-create
  374. :disabled="isChild"
  375. placeholder="请选择(输入可搜索)"
  376. style="width:200px"
  377. @change="changeDrugName"
  378. >
  379. <el-option
  380. v-for="(item,index) in all_drug"
  381. :key="index"
  382. :label="item.drug_name"
  383. :value="item.drug_name"
  384. ></el-option>
  385. </el-select> -->
  386. <el-autocomplete
  387. style="width:100%;"
  388. class="inline-input"
  389. v-model="nameForm.advice_name"
  390. :fetch-suggestions="querySearch"
  391. placeholder="请输入内容"
  392. @select="handleSelect"
  393. @input="changeDrugName"
  394. ></el-autocomplete>
  395. </el-form-item>
  396. </el-col>
  397. <el-col :span="14">
  398. <!--<el-form-item label="规格 :" prop="advice_desc">-->
  399. <!--<el-input v-model="nameForm.advice_desc"></el-input>-->
  400. <!--</el-form-item>-->
  401. <el-form-item label="药品规格 :" prop="advice_desc">
  402. <el-col :span="10">
  403. <!-- <el-input v-model="nameForm.advice_desc"></el-input> -->
  404. <!-- <el-select
  405. v-model="nameForm.advice_desc"
  406. filterable
  407. clearable
  408. allow-create
  409. :disabled="isChild"
  410. placeholder="请选择(输入可搜索)"
  411. style="width:150px"
  412. @change="changeDrugDesc"
  413. >
  414. <el-option
  415. v-for="item in drugSpec"
  416. :key="item.id"
  417. :label="item.drug_spec"
  418. :value="item.drug_spec"
  419. ></el-option>
  420. </el-select> -->
  421. <el-autocomplete
  422. style="width:100px;"
  423. class="inline-input"
  424. v-model="nameForm.advice_desc"
  425. :fetch-suggestions="querySearch1"
  426. placeholder="请输入内容"
  427. @input="changeDrugDesc"
  428. ></el-autocomplete>
  429. </el-col>
  430. <el-col class="line" :span="2">&nbsp;</el-col>
  431. <el-col :span="10">
  432. <el-select
  433. v-model="nameForm.drug_spec_unit"
  434. filterable
  435. clearable
  436. allow-create
  437. placeholder="选择"
  438. >
  439. <el-option
  440. v-for="item in unitsOption"
  441. :key="item.id"
  442. :label="item.name"
  443. :value="item.name"
  444. ></el-option>
  445. </el-select>
  446. </el-col>
  447. </el-form-item>
  448. </el-col>
  449. </el-row>
  450. <el-row>
  451. <el-col :span="12">
  452. <el-form-item label="开药数量 :" prop="prescribing_number">
  453. <el-col :span="8">
  454. <el-input v-model="nameForm.prescribing_number"></el-input>
  455. </el-col>
  456. <el-col class="line" :span="2">&nbsp;</el-col>
  457. <el-col :span="14">
  458. <el-select
  459. v-model="nameForm.prescribing_number_unit"
  460. filterable
  461. clearable
  462. allow-create
  463. placeholder="选择"
  464. >
  465. <el-option
  466. v-for="item in unitsOption"
  467. :key="item.id"
  468. :label="item.name"
  469. :value="item.name"
  470. ></el-option>
  471. </el-select>
  472. </el-col>
  473. </el-form-item>
  474. </el-col>
  475. <el-col :span="12">
  476. <el-form-item label="单次用量 :" prop="single_dose">
  477. <el-col :span="8">
  478. <el-input v-model="nameForm.single_dose"></el-input>
  479. </el-col>
  480. <el-col class="line" :span="2">&nbsp;</el-col>
  481. <el-col :span="14">
  482. <el-select
  483. v-model="nameForm.single_dose_unit"
  484. filterable
  485. clearable
  486. allow-create
  487. placeholder="选择"
  488. >
  489. <el-option
  490. v-for="item in unitsOption"
  491. :key="item.id"
  492. :label="item.name"
  493. :value="item.id"
  494. ></el-option>
  495. </el-select>
  496. </el-col>
  497. </el-form-item>
  498. </el-col>
  499. </el-row>
  500. <el-row>
  501. <el-col :span="12">
  502. <el-form-item label="给药途径 :" prop="delivery_way">
  503. <el-select
  504. v-model="nameForm.delivery_way"
  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 deliveryWayOptions"
  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-col :span="12">
  522. <el-form-item label="执行频率 :" prop="execution_frequency">
  523. <el-select
  524. v-model="nameForm.execution_frequency"
  525. filterable
  526. clearable
  527. allow-create
  528. :disabled="isChild"
  529. placeholder="请选择(输入可搜索)"
  530. style="width:100%"
  531. >
  532. <el-option
  533. v-for="item in executionFrequencyOptions"
  534. :key="item.id"
  535. :label="item.name"
  536. :value="item.name"
  537. ></el-option>
  538. </el-select>
  539. </el-form-item>
  540. </el-col>
  541. </el-row>
  542. </el-form>
  543. <div slot="footer" class="dialog-footer">
  544. <el-button @click="nameFormVisible = false">取消</el-button>
  545. <el-button
  546. :disabled="$store.getters.xt_user.subscibe.state == 3 ? true : false"
  547. type="primary"
  548. @click="submitNameForm('nameForm')"
  549. >保 存
  550. </el-button>
  551. </div>
  552. </el-dialog>
  553. </div>
  554. </template>
  555. <script>
  556. import {
  557. CreateDoctorAdvice,
  558. CreateGroupAdvice,
  559. DeleteDoctorAdvice,
  560. DeleteGroupAdvice,
  561. EditDoctorAdvice,
  562. getAdviceConfig,
  563. getDoctorAdviceList,
  564. StopDoctorAdvice,
  565. SaveEditAdvices
  566. } from "@/api/advice";
  567. import { getDataConfig } from '@/utils/data'
  568. import { jsGetAge, uParseTime } from "@/utils/tools";
  569. import { getSelfMedicalList,getDrugDescByDrugName } from "@/api/drug/drug"
  570. export default {
  571. name: "AddGroupAdvice",
  572. data() {
  573. return {
  574. editRowKey: 0,
  575. oldTemplateFormVisible: false,
  576. templateFormVisible: false,
  577. groupEditFormVisible: false,
  578. nameFormVisible: false,
  579. groupSelectRow: null,
  580. nameFormTitle: "",
  581. isChild: false,
  582. isEdit: false,
  583. groupRules: {
  584. advice_type: [{ required: true, message: "请选择医嘱类型" }],
  585. advice_date: [{ required: true, message: "请选择医嘱时间" }],
  586. start_time: [{ required: true, message: "请选择开始时间" }],
  587. advice_name: [{ required: true, message: "请填写医嘱名称" }],
  588. advice_doctor: [{ required: true, message: "请选择开嘱医生" }]
  589. },
  590. nameRules: {
  591. advice_name: [{ required: true, message: "请填写医嘱内容" }]
  592. },
  593. templateRules: {
  594. id: [{ required: true, message: "请选择医嘱模板" }]
  595. },
  596. templateForm: { id: "" },
  597. nameForm: {
  598. advice_name: "",
  599. advice_desc: "",
  600. single_dose: "",
  601. single_dose_unit: "",
  602. drug_spec: "",
  603. drug_spec_unit: "",
  604. prescribing_number: "",
  605. prescribing_number_unit: "",
  606. delivery_way: "",
  607. execution_frequency: "",
  608. isEdit: 0,
  609. index: 0,
  610. id: 0,
  611. children: [],
  612. drug_id:"",
  613. way:"",
  614. drug_name_id:"",
  615. },
  616. submitGroupForm: {
  617. advice_type: "",
  618. advice_date: "",
  619. start_time: "",
  620. adviceNames: [],
  621. advice_doctor: "",
  622. remark: "",
  623. parent_id: 0,
  624. drug_name_id:"",
  625. drug_id:"",
  626. way:""
  627. },
  628. groupForm: {
  629. advice_type: "",
  630. advice_date: "",
  631. start_time: "",
  632. adviceNames: [],
  633. advice_doctor: "",
  634. remark: "",
  635. parent_id: 0,
  636. way:"",
  637. drug_id:"",
  638. drug_name_id:"",
  639. },
  640. adminusername: "",
  641. selectedTemp: { id: 0, name: "", org_id: 0, list: [], rows: [] },
  642. selectedTemplate: [],
  643. allSelectedTemplate: [],
  644. medicals:[],
  645. drugSpec:[],
  646. all_drug:[],
  647. current_drug_name:"",
  648. current_drug_spec: "",
  649. drug_id: 0,
  650. src_type:"",
  651. drug_name_id:0,
  652. units:[],
  653. };
  654. },
  655. props: {
  656. patientID: 0,
  657. adviceType: 0,
  658. rowKey: 0,
  659. groupNo: 0,
  660. adviceTemplates: {
  661. type: Array,
  662. default: function() {
  663. return [];
  664. }
  665. },
  666. recordDate: "",
  667. adviceTypeOptions: {
  668. type: Array,
  669. default: function() {
  670. return [];
  671. }
  672. },
  673. deliveryWayOptions: {
  674. type: Array,
  675. default: () => []
  676. },
  677. unitsOption: {
  678. type: Array,
  679. default: function() {
  680. return [];
  681. }
  682. },
  683. executionFrequencyOptions: {
  684. type: Array,
  685. default: function() {
  686. return [];
  687. }
  688. },
  689. adviceTemplateMaps: {
  690. type: Object,
  691. default: function() {
  692. return {};
  693. }
  694. },
  695. adviceTableData: {
  696. type: Array,
  697. default: function() {
  698. return [];
  699. }
  700. },
  701. admin_users: {
  702. // 系统用户列表
  703. type: Array,
  704. default: () => {
  705. return [];
  706. }
  707. }
  708. },
  709. methods: {
  710. handleSelect(val){
  711. console.log("2222",val)
  712. var tmp = val.drug_specs[0]
  713. console.log("tmp",tmp)
  714. this.nameForm.advice_desc = tmp.dose+tmp.dose_unit+"*"+tmp.min_number+tmp.min_unit+"/"//药品规格
  715. this.nameForm.drug_spec_unit = tmp.max_unit
  716. this.nameForm.prescribing_number = tmp.prescribing_number//开药数量
  717. this.nameForm.prescribing_number_unit = tmp.prescribing_number_unit
  718. this.nameForm.single_dose = tmp.single_dose//单次用量
  719. this.nameForm.single_dose_unit = tmp.drug_dose_unit
  720. this.nameForm.delivery_way = tmp.delivery_way//给药途径
  721. this.nameForm.execution_frequency = tmp.execution_frequency//执行频率
  722. this.nameForm.drug_id = tmp.id
  723. },
  724. getXuserName(id) {
  725. if (id <= 0) {
  726. return "";
  727. }
  728. var name = "";
  729. if (
  730. this.admin_users == null ||
  731. typeof this.admin_users.length === "undefined"
  732. ) {
  733. return name;
  734. }
  735. var leng = this.admin_users.length;
  736. if (leng == 0) {
  737. return name;
  738. }
  739. for (let index = 0; index < leng; index++) {
  740. if (this.admin_users[index].id == id) {
  741. name = this.admin_users[index].name;
  742. break;
  743. }
  744. }
  745. return name;
  746. },
  747. openDeleteGroupAdvice() {
  748. if (this.groupSelectRow === null) {
  749. this.$message.error("未选择要删除的医嘱内容");
  750. return;
  751. }
  752. console.log(this.groupSelectRow);
  753. var content = "";
  754. if (this.groupSelectRow.children.length > 0) {
  755. content = "确认删除此医嘱内容,包括它的子药?";
  756. } else {
  757. content = "确认删除此医嘱内容?";
  758. }
  759. var isChild = !!this.groupSelectRow.parent_row;
  760. var title = isChild ? "删除子药内容" : "删除医嘱内容";
  761. var msg = isChild ? "确认删除此子药内容?" : content;
  762. this.$confirm(msg, title, {
  763. confirmButtonText: "确定",
  764. cancelButtonText: "取消",
  765. type: "warning"
  766. })
  767. .then(() => {
  768. let mode = "4";
  769. if (
  770. this.groupSelectRow.advice_doctor !=
  771. this.$store.getters.xt_user.user.id
  772. ) {
  773. mode = "5";
  774. }
  775. DeleteDoctorAdvice(this.groupSelectRow.id, mode).then(response => {
  776. if (response.data.state == 0) {
  777. this.$message.error(response.data.msg);
  778. return false;
  779. } else {
  780. this.$notify({
  781. title: "成功",
  782. message: "医嘱已经删除",
  783. type: "success",
  784. duration: 2000
  785. });
  786. var ale = this.groupForm.adviceNames.length;
  787. var atle = this.adviceTableData.length;
  788. for (let index = atle - 1; index >= 0; index--) {
  789. if (
  790. this.adviceTableData[index].parent_id ===
  791. this.groupSelectRow.id ||
  792. this.adviceTableData[index].id === this.groupSelectRow.id
  793. ) {
  794. this.adviceTableData.splice(index, 1);
  795. }
  796. }
  797. if (isChild) {
  798. for (const index in this.groupForm.adviceNames) {
  799. if (
  800. this.groupForm.adviceNames[index].row_key ==
  801. this.groupSelectRow.parent_row
  802. ) {
  803. for (const j in this.groupForm.adviceNames[index]
  804. .children) {
  805. if (
  806. this.groupForm.adviceNames[index].children[j].row_key ==
  807. this.groupSelectRow.row_key
  808. ) {
  809. this.groupForm.adviceNames[index].children.splice(j, 1);
  810. this.$set(
  811. this.groupForm.adviceNames,
  812. index,
  813. this.groupForm.adviceNames[index]
  814. );
  815. break;
  816. }
  817. }
  818. }
  819. }
  820. } else {
  821. for (const index in this.groupForm.adviceNames) {
  822. if (
  823. this.groupForm.adviceNames[index].row_key ==
  824. this.groupSelectRow.row_key
  825. ) {
  826. this.groupForm.adviceNames.splice(index, 1);
  827. break;
  828. }
  829. }
  830. }
  831. if (isChild) {
  832. for (const index in this.groupForm.adviceNames) {
  833. if (
  834. this.groupForm.adviceNames[index].row_key ==
  835. this.groupSelectRow.parent_row
  836. ) {
  837. for (const j in this.groupForm.adviceNames[index]
  838. .children) {
  839. if (
  840. this.groupForm.adviceNames[index].children[j].row_key ==
  841. this.groupSelectRow.row_key
  842. ) {
  843. this.groupForm.adviceNames[index].children.splice(j, 1);
  844. this.$set(
  845. this.groupForm.adviceNames,
  846. index,
  847. this.groupForm.adviceNames[index]
  848. );
  849. this.toggleRowExpansion();
  850. break;
  851. }
  852. }
  853. }
  854. }
  855. } else {
  856. for (const index in this.groupForm.adviceNames) {
  857. if (
  858. this.groupForm.adviceNames[index].row_key ==
  859. this.groupSelectRow.row_key
  860. ) {
  861. this.groupForm.adviceNames.splice(index, 1);
  862. this.toggleRowExpansion();
  863. break;
  864. }
  865. }
  866. }
  867. }
  868. });
  869. })
  870. .catch(() => {});
  871. },
  872. submitNameForm(formName) {
  873. if(this.src_type == ""){
  874. this.nameForm.way = 0
  875. this.nameForm.drug_id = 0
  876. this.nameForm.drug_name_id = 0
  877. }
  878. if(this.src_type == 2){ //自备药
  879. var arr = this.nameForm.advice_name.split("(自备药)")
  880. this.nameForm.advice_name = arr[0]
  881. }
  882. var _this = this;
  883. this.$refs[formName].validate(valid => {
  884. if (valid) {
  885. if (_this.nameForm.isEdit) {
  886. var single_dose_unit = ""
  887. if(_this.nameForm.single_dose_unit > 0){
  888. single_dose_unit = this.getUnit(_this.nameForm.single_dose_unit)
  889. }else{
  890. single_dose_unit = _this.nameForm.single_dose_unit
  891. }
  892. console.log("single_dose_unit332323223",single_dose_unit)
  893. var submitForm = {
  894. advice_type: _this.groupForm.advice_type,
  895. advice_date: _this.groupForm.advice_date,
  896. start_time: _this.groupForm.start_time,
  897. advice_name: _this.nameForm.advice_name,
  898. advice_desc: _this.nameForm.advice_desc,
  899. single_dose: "" + _this.nameForm.single_dose,
  900. single_dose_unit: single_dose_unit,
  901. drug_spec: "" + _this.nameForm.drug_spec,
  902. drug_spec_unit: _this.nameForm.drug_spec_unit,
  903. prescribing_number: "" + _this.nameForm.prescribing_number,
  904. prescribing_number_unit: _this.nameForm.prescribing_number_unit,
  905. delivery_way: _this.nameForm.delivery_way,
  906. execution_frequency: _this.nameForm.execution_frequency,
  907. isEdit: 0,
  908. id: 0,
  909. advice_doctor: "",
  910. remark: _this.groupForm.remark,
  911. parent_id: _this.groupSelectRow.parent_id,
  912. groupno: _this.groupForm.groupno,
  913. drug_name_id:_this.groupForm.drug_name_id,
  914. drug_id:_this.groupForm.drug_id,
  915. way:_this.groupForm.way,
  916. };
  917. let mode = "2";
  918. if (
  919. this.groupSelectRow.advice_doctor !=
  920. this.$store.getters.xt_user.user.id
  921. ) {
  922. mode = "3";
  923. }
  924. console.log("22222",submitForm)
  925. EditDoctorAdvice(
  926. this.patientID,
  927. this.groupSelectRow.id,
  928. submitForm,
  929. mode
  930. ).then(response => {
  931. if (response.data.state == 0) {
  932. this.$message.error(response.data.msg);
  933. return false;
  934. } else {
  935. this.$notify({
  936. title: "成功",
  937. message: "修改医嘱成功",
  938. type: "success",
  939. duration: 2000
  940. });
  941. var ale = _this.groupForm.adviceNames.length;
  942. var atle = _this.adviceTableData.length;
  943. for (let index = 0; index < atle; index++) {
  944. if (
  945. _this.groupSelectRow.id == _this.adviceTableData[index].id
  946. ) {
  947. var advice = response.data.data.advice;
  948. _this.adviceTableData[index].drug_spec = advice.drug_spec;
  949. _this.adviceTableData[index].drug_spec_unit =
  950. advice.drug_spec_unit;
  951. _this.adviceTableData[index].start_time = advice.start_time;
  952. _this.adviceTableData[index].advice_name =
  953. advice.advice_name;
  954. _this.adviceTableData[index].advice_desc =
  955. advice.advice_desc;
  956. _this.adviceTableData[index].single_dose =
  957. advice.single_dose;
  958. _this.adviceTableData[index].single_dose_unit =
  959. advice.single_dose_unit;
  960. _this.adviceTableData[index].delivery_way =
  961. advice.delivery_way;
  962. _this.adviceTableData[index].execution_frequency =
  963. advice.execution_frequency;
  964. _this.adviceTableData[index].prescribing_number =
  965. advice.prescribing_number;
  966. _this.adviceTableData[index].prescribing_number_unit =advice.prescribing_number_unit;
  967. _this.adviceTableData[index].drug_name_id = advice.drug_name_id;
  968. _this.adviceTableData[index].drug_id = advice.drug_id,
  969. _this.adviceTableData[index].way = advice.way
  970. break;
  971. }
  972. }
  973. if (_this.isChild) {
  974. for (let index = 0; index < ale; index++) {
  975. if (
  976. _this.groupSelectRow.parent_row ==
  977. _this.groupForm.adviceNames[index].row_key
  978. ) {
  979. var cle =
  980. _this.groupForm.adviceNames[index].children.length;
  981. var children =
  982. _this.groupForm.adviceNames[index].children;
  983. for (let j = 0; j < ale; j++) {
  984. if (
  985. _this.groupSelectRow.row_key == children[j].row_key
  986. ) {
  987. _this.groupForm.adviceNames[index].children[
  988. j
  989. ].advice_name = _this.nameForm.advice_name;
  990. _this.groupForm.adviceNames[index].children[
  991. j
  992. ].advice_desc = _this.nameForm.advice_desc;
  993. _this.groupForm.adviceNames[index].children[
  994. j
  995. ].single_dose = "" + _this.nameForm.single_dose;
  996. _this.groupForm.adviceNames[index].children[
  997. j
  998. ].single_dose_unit = _this.nameForm.single_dose_unit;
  999. _this.groupForm.adviceNames[index].children[
  1000. j
  1001. ].drug_spec = "" + _this.nameForm.drug_spec;
  1002. _this.groupForm.adviceNames[index].children[
  1003. j
  1004. ].drug_spec_unit = _this.nameForm.drug_spec_unit;
  1005. _this.groupForm.adviceNames[index].children[
  1006. j
  1007. ].prescribing_number =
  1008. "" + _this.nameForm.prescribing_number;
  1009. _this.groupForm.adviceNames[index].children[
  1010. j
  1011. ].prescribing_number_unit =
  1012. _this.nameForm.prescribing_number_unit;
  1013. _this.groupForm.adviceNames[index].children[j].delivery_way = _this.nameForm.delivery_way;
  1014. _this.groupForm.adviceNames[index].children[j].execution_frequency =_this.nameForm.execution_frequency;
  1015. _this.groupForm.adviceNames[index].children[j].drug_id =_this.nameForm.drug_id;
  1016. _this.groupForm.adviceNames[index].children[j].drug_name_id =_this.nameForm.drug_name_id;
  1017. _this.groupForm.adviceNames[index].children[j].way =_this.nameForm.way;
  1018. _this.$set(
  1019. _this.groupForm.adviceNames[index].children,
  1020. j,
  1021. _this.groupForm.adviceNames[index].children[j]
  1022. );
  1023. break;
  1024. }
  1025. }
  1026. }
  1027. }
  1028. } else {
  1029. for (let index = 0; index < ale; index++) {
  1030. if (
  1031. _this.groupSelectRow.row_key ==
  1032. _this.groupForm.adviceNames[index].row_key
  1033. ) {
  1034. _this.groupForm.adviceNames[index].advice_name =
  1035. _this.nameForm.advice_name;
  1036. _this.groupForm.adviceNames[index].advice_desc =
  1037. _this.nameForm.advice_desc;
  1038. _this.groupForm.adviceNames[index].single_dose =
  1039. "" + _this.nameForm.single_dose;
  1040. _this.groupForm.adviceNames[index].single_dose_unit =
  1041. _this.nameForm.single_dose_unit;
  1042. _this.groupForm.adviceNames[index].drug_spec =
  1043. "" + _this.nameForm.drug_spec;
  1044. _this.groupForm.adviceNames[index].drug_spec_unit =
  1045. _this.nameForm.drug_spec_unit;
  1046. _this.groupForm.adviceNames[index].prescribing_number =
  1047. "" + _this.nameForm.prescribing_number;
  1048. _this.groupForm.adviceNames[
  1049. index
  1050. ].prescribing_number_unit =
  1051. _this.nameForm.prescribing_number_unit;
  1052. _this.groupForm.adviceNames[index].delivery_way =
  1053. _this.nameForm.delivery_way;
  1054. _this.groupForm.adviceNames[index].execution_frequency =_this.nameForm.execution_frequency;
  1055. _this.groupForm.adviceNames[index].drug_name_id =_this.nameForm.drug_name_id;
  1056. _this.groupForm.adviceNames[index].drug_id =_this.nameForm.drug_id;
  1057. _this.groupForm.adviceNames[index].way =_this.nameForm.way;
  1058. _this.$set(
  1059. _this.groupForm.adviceNames,
  1060. index,
  1061. _this.groupForm.adviceNames[index]
  1062. );
  1063. break;
  1064. }
  1065. }
  1066. }
  1067. }
  1068. });
  1069. } else {
  1070. if (_this.isChild) {
  1071. var submitForm = {
  1072. advice_type: _this.groupForm.advice_type,
  1073. advice_date: _this.groupForm.advice_date,
  1074. start_time: _this.groupForm.start_time,
  1075. advice_name: _this.nameForm.advice_name,
  1076. advice_desc: _this.nameForm.advice_desc,
  1077. single_dose: "" + _this.nameForm.single_dose,
  1078. single_dose_unit: _this.nameForm.single_dose_unit,
  1079. drug_spec: "" + _this.nameForm.drug_spec,
  1080. drug_spec_unit: _this.nameForm.drug_spec_unit,
  1081. prescribing_number: "" + _this.nameForm.prescribing_number,
  1082. prescribing_number_unit: _this.nameForm.prescribing_number_unit,
  1083. delivery_way: _this.nameForm.delivery_way,
  1084. execution_frequency: _this.nameForm.execution_frequency,
  1085. drug_name_id:_this.nameForm.drug_name_id,
  1086. drug_id:_this.nameForm.drug_id,
  1087. way:_this.nameForm.way,
  1088. isEdit: 0,
  1089. id: 0,
  1090. advice_doctor: "",
  1091. remark: _this.groupForm.remark,
  1092. parent_id: _this.groupSelectRow.id,
  1093. groupno: _this.groupForm.groupno
  1094. };
  1095. let mode = "1";
  1096. CreateDoctorAdvice(this.patientID, submitForm, mode).then(
  1097. response => {
  1098. if (response.data.state == 0) {
  1099. this.$message.error(response.data.msg);
  1100. return false;
  1101. } else {
  1102. this.$notify({
  1103. title: "成功",
  1104. message: "新增子药成功",
  1105. type: "success",
  1106. duration: 2000
  1107. });
  1108. var spliceIndex = -1;
  1109. for (
  1110. let index = _this.adviceTableData.length - 1;
  1111. ;
  1112. index--
  1113. ) {
  1114. if (
  1115. _this.adviceTableData[index].parent_id ===
  1116. _this.groupSelectRow.id
  1117. ) {
  1118. spliceIndex = index;
  1119. break;
  1120. } else if (
  1121. _this.adviceTableData[index].id ===
  1122. _this.groupSelectRow.id
  1123. ) {
  1124. spliceIndex = index;
  1125. break;
  1126. }
  1127. }
  1128. if (spliceIndex > -1) {
  1129. spliceIndex += 1;
  1130. if (spliceIndex === _this.adviceTableData.length) {
  1131. _this.adviceTableData.push(response.data.data.advice);
  1132. } else {
  1133. _this.adviceTableData.splice(
  1134. spliceIndex,
  1135. 0,
  1136. response.data.data.advice
  1137. );
  1138. }
  1139. }
  1140. var ale = _this.groupForm.adviceNames.length;
  1141. for (let index = 0; index < ale; index++) {
  1142. if (
  1143. _this.nameForm.parent_row ==
  1144. _this.groupForm.adviceNames[index].row_key
  1145. ) {
  1146. _this.editRowKey++;
  1147. _this.nameForm.row_key = _this.editRowKey;
  1148. _this.groupForm.adviceNames[index].children.push(
  1149. _this.nameForm
  1150. );
  1151. _this.$set(
  1152. _this.groupForm.adviceNames,
  1153. index,
  1154. _this.groupForm.adviceNames[index]
  1155. );
  1156. break;
  1157. }
  1158. }
  1159. // _this.resetForm(formName);
  1160. return false;
  1161. }
  1162. }
  1163. );
  1164. } else {
  1165. _this.submitGroupForm = {
  1166. advice_type: _this.groupForm.advice_type,
  1167. advice_date: _this.groupForm.advice_date,
  1168. start_time: _this.groupForm.start_time,
  1169. adviceNames: [
  1170. {
  1171. advice_name: _this.nameForm.advice_name,
  1172. advice_desc: _this.nameForm.advice_desc,
  1173. single_dose: "" + _this.nameForm.single_dose,
  1174. single_dose_unit: _this.nameForm.single_dose_unit,
  1175. drug_spec: "" + _this.nameForm.drug_spec,
  1176. drug_spec_unit: _this.nameForm.drug_spec_unit,
  1177. prescribing_number: "" + _this.nameForm.prescribing_number,
  1178. prescribing_number_unit:
  1179. _this.nameForm.prescribing_number_unit,
  1180. delivery_way: _this.nameForm.delivery_way,
  1181. execution_frequency: _this.nameForm.execution_frequency,
  1182. drug_name_id:_this.nameForm.drug_name_id,
  1183. drug_id:_this.nameForm.drug_id,
  1184. way:_this.nameForm.way,
  1185. isEdit: 0,
  1186. id: 0,
  1187. children: [],
  1188. parent_row: 0
  1189. }
  1190. ],
  1191. advice_doctor: "",
  1192. remark: _this.groupForm.remark,
  1193. parent_id: 0
  1194. };
  1195. let mode = "1";
  1196. CreateGroupAdvice(
  1197. _this.patientID,
  1198. _this.groupForm.groupno,
  1199. _this.submitGroupForm,
  1200. mode
  1201. ).then(response => {
  1202. if (response.data.state == 0) {
  1203. _this.$message.error(response.data.msg);
  1204. return false;
  1205. } else {
  1206. _this.$notify({
  1207. title: "成功",
  1208. message: "新增成功",
  1209. type: "success",
  1210. duration: 2000
  1211. });
  1212. // var alen = response.data.data.advices.length
  1213. // for (let index = alen-1; index >=0; index--) {
  1214. // _this.adviceTableData.unshift(response.data.data.advices[index]);
  1215. // }
  1216. // for (const index in response.data.data.advices) {
  1217. // _this.adviceTableData.unshift(response.data.data.advices[index]);
  1218. // }
  1219. var groups = response.data.data.advices;
  1220. var childMap = {};
  1221. for (const index in groups) {
  1222. if (groups[index].parent_id == 0) {
  1223. continue;
  1224. }
  1225. if (groups[index].parent_id in childMap === false) {
  1226. childMap[groups[index].parent_id] = [];
  1227. }
  1228. childMap[groups[index].parent_id].push(groups[index]);
  1229. }
  1230. var parentArr = [];
  1231. for (const index in groups) {
  1232. if (groups[index].parent_id > 0) {
  1233. continue;
  1234. }
  1235. parentArr.push(groups[index]);
  1236. }
  1237. var groupNo = groups[0].groupno;
  1238. var newData = { groupNo: parentArr };
  1239. for (const index in _this.adviceTableData) {
  1240. if (_this.adviceTableData[index].groupno == groupNo) {
  1241. for (const i in parentArr) {
  1242. if (parentArr[i].id in childMap) {
  1243. for (const j in childMap[parentArr[i].id]) {
  1244. _this.adviceTableData.splice(
  1245. index,
  1246. 0,
  1247. childMap[parentArr[i].id][j]
  1248. );
  1249. }
  1250. }
  1251. _this.adviceTableData.splice(index, 0, parentArr[i]);
  1252. }
  1253. break;
  1254. }
  1255. }
  1256. for (const index in groups) {
  1257. if (groups[index].parent_id > 0) {
  1258. continue;
  1259. }
  1260. _this.editRowKey++;
  1261. var item = {
  1262. advice_name: groups[index].advice_name,
  1263. advice_desc: groups[index].advice_desc,
  1264. single_dose: "" + groups[index].single_dose,
  1265. single_dose_unit: groups[index].single_dose_unit,
  1266. drug_spec: "" + groups[index].drug_spec,
  1267. drug_spec_unit: groups[index].drug_spec_unit,
  1268. prescribing_number: "" + groups[index].prescribing_number,
  1269. prescribing_number_unit:
  1270. groups[index].prescribing_number_unit,
  1271. delivery_way: groups[index].delivery_way,
  1272. execution_frequency: groups[index].execution_frequency,
  1273. drug_name_id:groups[index].drug_name_id,
  1274. drug_id:groups[index].drug_id,
  1275. way:groups[index].way,
  1276. isEdit: 0,
  1277. index: 0,
  1278. id: groups[index].id,
  1279. children: [],
  1280. parent_row: 0,
  1281. row_key: _this.editRowKey
  1282. };
  1283. if (item.id in childMap) {
  1284. for (const key in childMap[item.id]) {
  1285. _this.editRowKey++;
  1286. var child = {
  1287. advice_name: childMap[item.id][key].advice_name,
  1288. advice_desc: childMap[item.id][key].advice_desc,
  1289. single_dose: "" + childMap[item.id][key].single_dose,
  1290. single_dose_unit:
  1291. childMap[item.id][key].single_dose_unit,
  1292. drug_spec: "" + childMap[item.id][key].drug_spec,
  1293. drug_spec_unit: childMap[item.id][key].drug_spec_unit,
  1294. prescribing_number:
  1295. "" + childMap[item.id][key].prescribing_number,
  1296. prescribing_number_unit:
  1297. childMap[item.id][key].prescribing_number_unit,
  1298. delivery_way: childMap[item.id][key].delivery_way,
  1299. execution_frequency:childMap[item.id][key].execution_frequency,
  1300. drug_name_id:childMap[item.id][key].drug_name_id,
  1301. drug_id:childMap[item.id][key].drug_id,
  1302. way:childMap[item.id][key].way,
  1303. isEdit: 0,
  1304. index: 0,
  1305. id: childMap[item.id][key].id,
  1306. children: [],
  1307. parent_row: item.row_key,
  1308. row_key: _this.editRowKey
  1309. };
  1310. item.children.push(child);
  1311. }
  1312. _this.$set(item, "children", item.children);
  1313. }
  1314. _this.groupForm.adviceNames.unshift(item);
  1315. }
  1316. _this.resetForm(formName);
  1317. return false;
  1318. }
  1319. });
  1320. }
  1321. }
  1322. _this.nameFormVisible = false;
  1323. }
  1324. });
  1325. },
  1326. openGroupChild() {
  1327. if (this.groupSelectRow === null) {
  1328. this.$message.error("未选择医嘱内容,无法添加子药");
  1329. return;
  1330. } else if (this.groupSelectRow.parent_row > 0) {
  1331. this.$notify.error({
  1332. title: "错误",
  1333. message: "子药不能添加子药"
  1334. });
  1335. return;
  1336. }
  1337. this.nameForm = {
  1338. advice_name: "",
  1339. advice_desc: "",
  1340. single_dose: "",
  1341. single_dose_unit: "",
  1342. drug_spec: "",
  1343. drug_spec_unit: "",
  1344. prescribing_number: "",
  1345. prescribing_number_unit: "",
  1346. delivery_way: this.groupSelectRow.delivery_way,
  1347. execution_frequency: this.groupSelectRow.execution_frequency,
  1348. isEdit: 0,
  1349. index: 0,
  1350. children: [],
  1351. parent_row: this.groupSelectRow.row_key,
  1352. id: 0,
  1353. drug_name_id:"",
  1354. way:"",
  1355. drug_id:"",
  1356. };
  1357. this.isChild = true;
  1358. this.nameFormVisible = true;
  1359. this.nameFormTitle = "添加子药内容";
  1360. },
  1361. openGroupAdvice(isEdit) {
  1362. this.isChild = false;
  1363. if (isEdit) {
  1364. if (this.groupSelectRow === null) {
  1365. this.$message.error("未选择要修改的医嘱内容");
  1366. return;
  1367. }
  1368. if (this.groupSelectRow.parent_row) {
  1369. this.isChild = true;
  1370. }
  1371. this.nameForm = {
  1372. advice_name: this.groupSelectRow.advice_name,
  1373. advice_desc: this.groupSelectRow.advice_desc,
  1374. single_dose:
  1375. this.groupSelectRow.single_dose != 0
  1376. ? this.groupSelectRow.single_dose
  1377. : "",
  1378. single_dose_unit: this.groupSelectRow.single_dose_unit,
  1379. drug_spec:
  1380. this.groupSelectRow.drug_spec != 0
  1381. ? this.groupSelectRow.drug_spec
  1382. : "",
  1383. drug_spec_unit: this.groupSelectRow.drug_spec_unit,
  1384. prescribing_number:
  1385. this.groupSelectRow.prescribing_number != 0
  1386. ? this.groupSelectRow.prescribing_number
  1387. : "",
  1388. prescribing_number_unit: this.groupSelectRow.prescribing_number_unit,
  1389. delivery_way: this.isChild ? "" : this.groupSelectRow.delivery_way,
  1390. execution_frequency: this.isChild? "": this.groupSelectRow.execution_frequency,
  1391. drug_name_id:this.isChild?"":this.groupSelectRow.drug_name_id,
  1392. drug_id:this.isChild?"":this.groupSelectRow.drug_id,
  1393. way:this.isChild?"":this.groupSelectRow.way,
  1394. isEdit: 1,
  1395. index: this.groupSelectRow.index,
  1396. id: this.groupSelectRow.id,
  1397. children: [],
  1398. parent_row: this.groupSelectRow.parent_row,
  1399. // row_key:this.groupSelectRow.row_key,
  1400. };
  1401. this.nameFormTitle = "修改医嘱内容";
  1402. this.nameFormVisible = true;
  1403. } else {
  1404. this.nameForm = {
  1405. advice_name: "",
  1406. advice_desc: "",
  1407. single_dose: "",
  1408. single_dose_unit: "",
  1409. drug_spec: "",
  1410. drug_spec_unit: "",
  1411. prescribing_number: "",
  1412. prescribing_number_unit: "",
  1413. delivery_way: "",
  1414. execution_frequency: "",
  1415. drug_name_id:"",
  1416. drug_id:"",
  1417. way:"",
  1418. isEdit: 0,
  1419. index: 0,
  1420. id: 0,
  1421. children: [],
  1422. parent_row: 0
  1423. };
  1424. this.nameFormTitle = "新增医嘱内容";
  1425. }
  1426. this.nameFormVisible = true;
  1427. },
  1428. changeAdvice(selection) {
  1429. this.selectedTemplate = selection;
  1430. },
  1431. selectAllTemplateAdvice(selection) {
  1432. var adviceArray = this.adviceTemplateMaps[this.selectedTemp.id]
  1433. .DoctorAdviceTemplate;
  1434. for (let y = 0; y < adviceArray.length; y++) {
  1435. adviceArray[y].selection = false;
  1436. }
  1437. if (selection.length > 0) {
  1438. for (let y = 0; y < adviceArray.length; y++) {
  1439. for (let i = 0; i < selection.length; i++) {
  1440. if (adviceArray[y].id == selection[i].advice_id) {
  1441. adviceArray[y].selection = true;
  1442. }
  1443. }
  1444. }
  1445. }
  1446. },
  1447. selectAdvice(selection, row) {
  1448. // this.selectedTemplate = [];
  1449. var adviceArray = this.adviceTemplateMaps[this.selectedTemp.id]
  1450. .DoctorAdviceTemplate;
  1451. for (let y = 0; y < adviceArray.length; y++) {
  1452. adviceArray[y].selection = false;
  1453. }
  1454. if (selection.length > 0) {
  1455. for (let y = 0; y < adviceArray.length; y++) {
  1456. for (let i = 0; i < selection.length; i++) {
  1457. if (adviceArray[y].id == selection[i].advice_id) {
  1458. adviceArray[y].selection = true;
  1459. }
  1460. }
  1461. }
  1462. }
  1463. // this.selectedTemplate = [];
  1464. if (row.children.length > 0) {
  1465. for (const index in row.children) {
  1466. this.$refs.selecttemplatetable.toggleRowSelection(
  1467. row.children[index]
  1468. );
  1469. }
  1470. }
  1471. // 下面两步的作用是为了上选中的数据的输出顺序不变
  1472. for (const index in this.selectedTemp.list) {
  1473. this.$refs.selecttemplatetable.toggleRowSelection(
  1474. this.selectedTemp.list[index]
  1475. );
  1476. if (this.selectedTemp.list[index].children.length > 0) {
  1477. for (const j in this.selectedTemp.list[index].children) {
  1478. this.$refs.selecttemplatetable.toggleRowSelection(
  1479. this.selectedTemp.list[index].children[j]
  1480. );
  1481. }
  1482. }
  1483. }
  1484. for (const index in this.selectedTemp.list) {
  1485. this.$refs.selecttemplatetable.toggleRowSelection(
  1486. this.selectedTemp.list[index]
  1487. );
  1488. if (this.selectedTemp.list[index].children.length > 0) {
  1489. for (const j in this.selectedTemp.list[index].children) {
  1490. this.$refs.selecttemplatetable.toggleRowSelection(
  1491. this.selectedTemp.list[index].children[j]
  1492. );
  1493. }
  1494. }
  1495. }
  1496. },
  1497. cancleDialog() {
  1498. this.templateFormVisible = false;
  1499. for (const indexs in this.adviceTemplateMaps) {
  1500. const adviceTemplate = this.adviceTemplateMaps[indexs];
  1501. for (const index in adviceTemplate.DoctorAdviceTemplate) {
  1502. adviceTemplate.DoctorAdviceTemplate[index].selection = false;
  1503. }
  1504. }
  1505. },
  1506. spanselecttable({ row, column, rowIndex, columnIndex }) {
  1507. if (columnIndex == 0) {
  1508. const _row = this.selectedTemp.rows[rowIndex];
  1509. const _col = _row > 0 ? 1 : 0;
  1510. return {
  1511. rowspan: _row,
  1512. colspan: _col
  1513. };
  1514. }
  1515. },
  1516. calcselectedTemp() {
  1517. var rowKeys = 0;
  1518. for (const index in this.selectedTemp.list) {
  1519. var pkey = rowKeys;
  1520. this.selectedTemp.rows[rowKeys] = 1;
  1521. if (this.selectedTemp.list[index].children.length > 0) {
  1522. for (const childindex in this.selectedTemp.list[index].children) {
  1523. rowKeys++;
  1524. this.selectedTemp.rows[pkey] += 1;
  1525. this.selectedTemp.rows[rowKeys] = 0;
  1526. }
  1527. }
  1528. rowKeys++;
  1529. this.$nextTick(function() {
  1530. if (this.selectedTemp.list[index].selection) {
  1531. this.$refs.selecttemplatetable.toggleRowSelection(
  1532. this.selectedTemp.list[index]
  1533. );
  1534. }
  1535. });
  1536. }
  1537. },
  1538. templateTableChange(currentRow, oldCurrentRow) {
  1539. this.selectedTemp = { id: 0, name: "", org_id: 0, list: [], rows: [] };
  1540. if (currentRow == null) {
  1541. return false;
  1542. }
  1543. this.selectedTemp.id = currentRow.id;
  1544. this.selectedTemp.name = currentRow.name;
  1545. this.selectedTemp.org_id = currentRow.org_id;
  1546. if (this.selectedTemp.id in this.adviceTemplateMaps) {
  1547. var mapid = this.selectedTemp.id;
  1548. var thisRowKey = 0;
  1549. for (const index in this.adviceTemplateMaps[mapid]
  1550. .DoctorAdviceTemplate) {
  1551. thisRowKey++;
  1552. var item = {
  1553. advice_name: this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[
  1554. index
  1555. ].advice_name,
  1556. advice_desc: this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[
  1557. index
  1558. ].advice_desc,
  1559. single_dose:
  1560. "" +
  1561. this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index]
  1562. .single_dose,
  1563. single_dose_unit: this.adviceTemplateMaps[mapid]
  1564. .DoctorAdviceTemplate[index].single_dose_unit,
  1565. drug_spec:
  1566. "" +
  1567. this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index]
  1568. .drug_spec,
  1569. drug_spec_unit: this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[
  1570. index
  1571. ].drug_spec_unit,
  1572. prescribing_number:
  1573. "" +
  1574. this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index]
  1575. .prescribing_number,
  1576. prescribing_number_unit: this.adviceTemplateMaps[mapid]
  1577. .DoctorAdviceTemplate[index].prescribing_number_unit,
  1578. delivery_way: this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[
  1579. index
  1580. ].delivery_way,
  1581. execution_frequency: this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].execution_frequency,
  1582. drug_name_id: this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].drug_name_id,
  1583. way: this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].way,
  1584. drug_id: this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].drug_id,
  1585. advice_id: this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[
  1586. index
  1587. ].id,
  1588. selection: this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[
  1589. index
  1590. ].selection,
  1591. isEdit: 0,
  1592. id: 0,
  1593. children: [],
  1594. parent_row: 0,
  1595. row_key: thisRowKey
  1596. };
  1597. if (
  1598. "children" in
  1599. this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index] &&
  1600. this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].children
  1601. .length > 0
  1602. ) {
  1603. var parentRow = thisRowKey;
  1604. var children = this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[
  1605. index
  1606. ].children;
  1607. for (const key in children) {
  1608. thisRowKey++;
  1609. var child = {
  1610. advice_id: children[key].id,
  1611. advice_name: children[key].advice_name,
  1612. advice_desc: children[key].advice_desc,
  1613. single_dose: "" + children[key].single_dose,
  1614. single_dose_unit: children[key].single_dose_unit,
  1615. drug_spec: "" + children[key].drug_spec,
  1616. drug_spec_unit: children[key].drug_spec_unit,
  1617. prescribing_number: "" + children[key].prescribing_number,
  1618. prescribing_number_unit: children[key].prescribing_number_unit,
  1619. delivery_way: children[key].delivery_way,
  1620. execution_frequency: children[key].execution_frequency,
  1621. drug_name_id:children[key].drug_name_id,
  1622. drug_id:children[key].drug_id,
  1623. way:children[key].way,
  1624. isEdit: 0,
  1625. id: 0,
  1626. children: [],
  1627. parent_row: parentRow,
  1628. row_key: thisRowKey
  1629. };
  1630. item.children.push(child);
  1631. }
  1632. this.$set(item, "children", item.children);
  1633. }
  1634. this.selectedTemp.list.unshift(item);
  1635. }
  1636. }
  1637. },
  1638. newAddTempForm() {
  1639. this.allSelectedTemplate = [];
  1640. var thisRowKey = 0;
  1641. for (const indexs in this.adviceTemplateMaps) {
  1642. const adviceTemplate = this.adviceTemplateMaps[indexs];
  1643. for (const index in adviceTemplate.DoctorAdviceTemplate) {
  1644. if (adviceTemplate.DoctorAdviceTemplate[index].selection) {
  1645. thisRowKey++;
  1646. var item = {
  1647. advice_name:
  1648. adviceTemplate.DoctorAdviceTemplate[index].advice_name,
  1649. advice_desc:
  1650. adviceTemplate.DoctorAdviceTemplate[index].advice_desc,
  1651. single_dose:
  1652. "" + adviceTemplate.DoctorAdviceTemplate[index].single_dose,
  1653. single_dose_unit:
  1654. adviceTemplate.DoctorAdviceTemplate[index].single_dose_unit,
  1655. drug_spec:
  1656. "" + adviceTemplate.DoctorAdviceTemplate[index].drug_spec,
  1657. drug_spec_unit:
  1658. adviceTemplate.DoctorAdviceTemplate[index].drug_spec_unit,
  1659. prescribing_number:
  1660. "" +
  1661. adviceTemplate.DoctorAdviceTemplate[index].prescribing_number,
  1662. prescribing_number_unit:
  1663. adviceTemplate.DoctorAdviceTemplate[index]
  1664. .prescribing_number_unit,
  1665. delivery_way:
  1666. adviceTemplate.DoctorAdviceTemplate[index].delivery_way,
  1667. execution_frequency:adviceTemplate.DoctorAdviceTemplate[index].execution_frequency,
  1668. drug_name_id:adviceTemplate.DoctorAdviceTemplate[index].drug_name_id,
  1669. drug_id:adviceTemplate.DoctorAdviceTemplate[index].drug_id,
  1670. way:adviceTemplate.DoctorAdviceTemplate[index].way,
  1671. advice_id: adviceTemplate.DoctorAdviceTemplate[index].id,
  1672. selection: adviceTemplate.DoctorAdviceTemplate[index].selection,
  1673. isEdit: 0,
  1674. id: 0,
  1675. children: [],
  1676. parent_row: 0,
  1677. row_key: thisRowKey
  1678. };
  1679. if (
  1680. "children" in adviceTemplate.DoctorAdviceTemplate[index] &&
  1681. adviceTemplate.DoctorAdviceTemplate[index].children.length > 0
  1682. ) {
  1683. var parentRow = thisRowKey;
  1684. var children =
  1685. adviceTemplate.DoctorAdviceTemplate[index].children;
  1686. for (const key in children) {
  1687. thisRowKey++;
  1688. var child = {
  1689. advice_id: children[key].id,
  1690. advice_name: children[key].advice_name,
  1691. advice_desc: children[key].advice_desc,
  1692. single_dose: "" + children[key].single_dose,
  1693. single_dose_unit: children[key].single_dose_unit,
  1694. drug_spec: "" + children[key].drug_spec,
  1695. drug_spec_unit: children[key].drug_spec_unit,
  1696. prescribing_number: "" + children[key].prescribing_number,
  1697. prescribing_number_unit:
  1698. children[key].prescribing_number_unit,
  1699. delivery_way: children[key].delivery_way,
  1700. execution_frequency: children[key].execution_frequency,
  1701. drug_name_id: children[key].drug_name_id,
  1702. drug_id:children[key].drug_id,
  1703. way:children[key].way,
  1704. isEdit: 0,
  1705. id: 0,
  1706. children: [],
  1707. parent_row: parentRow,
  1708. row_key: thisRowKey
  1709. };
  1710. item.children.push(child);
  1711. this.allSelectedTemplate.unshift(child);
  1712. }
  1713. this.$set(item, "children", item.children);
  1714. }
  1715. this.allSelectedTemplate.unshift(item);
  1716. adviceTemplate.DoctorAdviceTemplate[index].selection = false;
  1717. }
  1718. }
  1719. }
  1720. var childMap = {};
  1721. for (const index in this.allSelectedTemplate) {
  1722. if (this.allSelectedTemplate[index].parent_row > 0) {
  1723. if (!(this.allSelectedTemplate[index].parent_row in childMap)) {
  1724. childMap[this.allSelectedTemplate[index].parent_row] = [];
  1725. }
  1726. childMap[this.allSelectedTemplate[index].parent_row].push(
  1727. this.allSelectedTemplate[index]
  1728. );
  1729. }
  1730. }
  1731. this.submitGroupForm = {
  1732. advice_type: this.groupForm.advice_type,
  1733. advice_date: this.groupForm.advice_date,
  1734. start_time: this.groupForm.start_time,
  1735. adviceNames: [],
  1736. advice_doctor: "",
  1737. remark: this.groupForm.remark,
  1738. parent_id: 0
  1739. };
  1740. for (const index in this.allSelectedTemplate) {
  1741. if (this.allSelectedTemplate[index].parent_row > 0) {
  1742. continue;
  1743. }
  1744. this.editRowKey++;
  1745. var item = {
  1746. advice_name: this.allSelectedTemplate[index].advice_name,
  1747. advice_desc: this.allSelectedTemplate[index].advice_desc,
  1748. single_dose: "" + this.allSelectedTemplate[index].single_dose,
  1749. single_dose_unit: this.allSelectedTemplate[index].single_dose_unit,
  1750. drug_spec: "" + this.allSelectedTemplate[index].drug_spec,
  1751. drug_spec_unit: this.allSelectedTemplate[index].drug_spec_unit,
  1752. prescribing_number:
  1753. "" + this.allSelectedTemplate[index].prescribing_number,
  1754. prescribing_number_unit: this.allSelectedTemplate[index]
  1755. .prescribing_number_unit,
  1756. delivery_way: this.allSelectedTemplate[index].delivery_way,
  1757. execution_frequency: this.allSelectedTemplate[index].execution_frequency,
  1758. drug_name_id: this.allSelectedTemplate[index].drug_name_id,
  1759. way:this.allSelectedTemplate[index].way,
  1760. drug_id:this.allSelectedTemplate[index].drug_id,
  1761. isEdit: 0,
  1762. id: 0,
  1763. children: [],
  1764. parent_row: 0,
  1765. row_key: this.editRowKey
  1766. };
  1767. if (this.allSelectedTemplate[index].children.length > 0) {
  1768. if (this.allSelectedTemplate[index].row_key in childMap) {
  1769. var parentRow = this.editRowKey;
  1770. var children = childMap[this.allSelectedTemplate[index].row_key];
  1771. for (const key in children) {
  1772. this.editRowKey++;
  1773. var child = {
  1774. advice_name: children[key].advice_name,
  1775. advice_desc: children[key].advice_desc,
  1776. single_dose: "" + children[key].single_dose,
  1777. single_dose_unit: children[key].single_dose_unit,
  1778. drug_spec: "" + children[key].drug_spec,
  1779. drug_spec_unit: children[key].drug_spec_unit,
  1780. prescribing_number: "" + children[key].prescribing_number,
  1781. prescribing_number_unit: children[key].prescribing_number_unit,
  1782. delivery_way: children[key].delivery_way,
  1783. execution_frequency: children[key].execution_frequency,
  1784. drug_name_id: children[key].drug_name_id,
  1785. drug_id:children[key].drug_id,
  1786. way:children[key].way,
  1787. isEdit: 0,
  1788. id: 0,
  1789. children: [],
  1790. parent_row: parentRow,
  1791. row_key: this.editRowKey
  1792. };
  1793. item.children.push(child);
  1794. }
  1795. this.$set(item, "children", item.children);
  1796. }
  1797. }
  1798. this.submitGroupForm.adviceNames.unshift(item);
  1799. }
  1800. let mode = "1";
  1801. CreateGroupAdvice(
  1802. this.patientID,
  1803. this.groupForm.groupno,
  1804. this.submitGroupForm,
  1805. mode
  1806. ).then(response => {
  1807. if (response.data.state == 0) {
  1808. this.$message.error(response.data.msg);
  1809. return false;
  1810. } else {
  1811. this.$notify({
  1812. title: "成功",
  1813. message: "新增成功",
  1814. type: "success",
  1815. duration: 2000
  1816. });
  1817. var groups = response.data.data.advices;
  1818. var childMap = {};
  1819. for (const index in groups) {
  1820. if (groups[index].parent_id == 0) {
  1821. continue;
  1822. }
  1823. if (groups[index].parent_id in childMap === false) {
  1824. childMap[groups[index].parent_id] = [];
  1825. }
  1826. childMap[groups[index].parent_id].push(groups[index]);
  1827. }
  1828. var parentArr = [];
  1829. for (const index in groups) {
  1830. if (groups[index].parent_id > 0) {
  1831. continue;
  1832. }
  1833. parentArr.push(groups[index]);
  1834. }
  1835. var groupNo = groups[0].groupno;
  1836. var newData = { groupNo: parentArr };
  1837. for (const index in this.adviceTableData) {
  1838. if (this.adviceTableData[index].groupno == groupNo) {
  1839. for (const i in parentArr) {
  1840. if (parentArr[i].id in childMap) {
  1841. for (const j in childMap[parentArr[i].id]) {
  1842. this.adviceTableData.splice(
  1843. index,
  1844. 0,
  1845. childMap[parentArr[i].id][j]
  1846. );
  1847. }
  1848. }
  1849. this.adviceTableData.splice(index, 0, parentArr[i]);
  1850. }
  1851. break;
  1852. }
  1853. }
  1854. for (const index in groups) {
  1855. if (groups[index].parent_id > 0) {
  1856. continue;
  1857. }
  1858. this.editRowKey++;
  1859. var item = {
  1860. advice_name: groups[index].advice_name,
  1861. advice_desc: groups[index].advice_desc,
  1862. single_dose: "" + groups[index].single_dose,
  1863. single_dose_unit: groups[index].single_dose_unit,
  1864. drug_spec: "" + groups[index].drug_spec,
  1865. drug_spec_unit: groups[index].drug_spec_unit,
  1866. prescribing_number: "" + groups[index].prescribing_number,
  1867. prescribing_number_unit: groups[index].prescribing_number_unit,
  1868. delivery_way: groups[index].delivery_way,
  1869. execution_frequency: groups[index].execution_frequency,
  1870. drug_name_id: groups[index].drug_name_id,
  1871. drug_id:groups[index].drug_id,
  1872. way:groups[index].way,
  1873. isEdit: 0,
  1874. index: 0,
  1875. id: groups[index].id,
  1876. children: [],
  1877. parent_row: 0,
  1878. row_key: this.editRowKey
  1879. };
  1880. if (item.id in childMap) {
  1881. for (const key in childMap[item.id]) {
  1882. this.editRowKey++;
  1883. var child = {
  1884. advice_name: childMap[item.id][key].advice_name,
  1885. advice_desc: childMap[item.id][key].advice_desc,
  1886. single_dose: "" + childMap[item.id][key].single_dose,
  1887. single_dose_unit: childMap[item.id][key].single_dose_unit,
  1888. drug_spec: "" + childMap[item.id][key].drug_spec,
  1889. drug_spec_unit: childMap[item.id][key].drug_spec_unit,
  1890. prescribing_number:
  1891. "" + childMap[item.id][key].prescribing_number,
  1892. prescribing_number_unit:
  1893. childMap[item.id][key].prescribing_number_unit,
  1894. delivery_way: childMap[item.id][key].delivery_way,
  1895. execution_frequency:childMap[item.id][key].execution_frequency,
  1896. way:childMap[item.id][key].way,
  1897. drug_name_id:childMap[item.id][key].drug_name_id,
  1898. drug_id:childMap[item.id][key].drug_id,
  1899. isEdit: 0,
  1900. index: 0,
  1901. id: childMap[item.id][key].id,
  1902. children: [],
  1903. parent_row: item.row_key,
  1904. row_key: this.editRowKey
  1905. };
  1906. item.children.push(child);
  1907. }
  1908. this.$set(item, "children", item.children);
  1909. }
  1910. this.groupForm.adviceNames.unshift(item);
  1911. }
  1912. return false;
  1913. }
  1914. });
  1915. this.templateFormVisible = false;
  1916. },
  1917. addTempForm(formName) {
  1918. var _this = this;
  1919. this.$refs[formName].validate(valid => {
  1920. if (valid) {
  1921. if (_this.templateForm.id in _this.adviceTemplateMaps) {
  1922. _this.submitGroupForm = {
  1923. advice_type: _this.groupForm.advice_type,
  1924. advice_date: _this.groupForm.advice_date,
  1925. start_time: _this.groupForm.start_time,
  1926. adviceNames: [],
  1927. advice_doctor: "",
  1928. remark: _this.groupForm.remark,
  1929. parent_id: 0
  1930. };
  1931. var mapid = _this.templateForm.id;
  1932. for (const index in _this.adviceTemplateMaps[mapid]
  1933. .DoctorAdviceTemplate) {
  1934. _this.editRowKey++;
  1935. var item = {
  1936. advice_name:
  1937. _this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index]
  1938. .advice_name,
  1939. advice_desc:
  1940. _this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index]
  1941. .advice_desc,
  1942. single_dose:
  1943. "" +
  1944. _this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index]
  1945. .single_dose,
  1946. single_dose_unit:
  1947. _this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index]
  1948. .single_dose_unit,
  1949. drug_spec:
  1950. "" +
  1951. _this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index]
  1952. .drug_spec,
  1953. drug_spec_unit:
  1954. _this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index]
  1955. .drug_spec_unit,
  1956. prescribing_number:
  1957. "" +
  1958. _this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index]
  1959. .prescribing_number,
  1960. prescribing_number_unit:
  1961. _this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index]
  1962. .prescribing_number_unit,
  1963. delivery_way:
  1964. _this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index]
  1965. .delivery_way,
  1966. execution_frequency:_this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].execution_frequency,
  1967. drug_name_id: _this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].drug_name_id,
  1968. drug_id: _this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].drug_id,
  1969. way:_this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].way,
  1970. isEdit: 0,
  1971. id: 0,
  1972. children: [],
  1973. parent_row: 0,
  1974. row_key: _this.editRowKey
  1975. };
  1976. if (
  1977. "children" in
  1978. _this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index] &&
  1979. _this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index]
  1980. .children
  1981. ) {
  1982. var parentRow = _this.editRowKey;
  1983. var children =
  1984. _this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index]
  1985. .children;
  1986. for (const key in children) {
  1987. _this.editRowKey++;
  1988. var child = {
  1989. advice_name: children[key].advice_name,
  1990. advice_desc: children[key].advice_desc,
  1991. single_dose: "" + children[key].single_dose,
  1992. single_dose_unit: children[key].single_dose_unit,
  1993. drug_spec: "" + children[key].drug_spec,
  1994. drug_spec_unit: children[key].drug_spec_unit,
  1995. prescribing_number: "" + children[key].prescribing_number,
  1996. prescribing_number_unit:
  1997. children[key].prescribing_number_unit,
  1998. delivery_way: children[key].delivery_way,
  1999. execution_frequency: children[key].execution_frequency,
  2000. drug_name_id: children[key].drug_name_id,
  2001. drug_id: children[key].drug_id,
  2002. way:children[key].way,
  2003. isEdit: 0,
  2004. id: 0,
  2005. children: [],
  2006. parent_row: parentRow,
  2007. row_key: _this.editRowKey
  2008. };
  2009. item.children.push(child);
  2010. }
  2011. _this.$set(item, "children", item.children);
  2012. }
  2013. _this.submitGroupForm.adviceNames.push(item);
  2014. }
  2015. let mode = "1";
  2016. CreateGroupAdvice(
  2017. _this.patientID,
  2018. _this.groupForm.groupno,
  2019. _this.submitGroupForm,
  2020. mode
  2021. ).then(response => {
  2022. if (response.data.state == 0) {
  2023. _this.$message.error(response.data.msg);
  2024. return false;
  2025. } else {
  2026. _this.$notify({
  2027. title: "成功",
  2028. message: "新增成功",
  2029. type: "success",
  2030. duration: 2000
  2031. });
  2032. // var alen = response.data.data.advices.length
  2033. // for (let index = alen-1; index >=0; index--) {
  2034. // this.adviceTableData.unshift(response.data.data.advices[index]);
  2035. // }
  2036. var groups = response.data.data.advices;
  2037. var childMap = {};
  2038. for (const index in groups) {
  2039. if (groups[index].parent_id == 0) {
  2040. continue;
  2041. }
  2042. if (groups[index].parent_id in childMap === false) {
  2043. childMap[groups[index].parent_id] = [];
  2044. }
  2045. childMap[groups[index].parent_id].push(groups[index]);
  2046. }
  2047. var parentArr = [];
  2048. for (const index in groups) {
  2049. if (groups[index].parent_id > 0) {
  2050. continue;
  2051. }
  2052. parentArr.push(groups[index]);
  2053. }
  2054. var groupNo = groups[0].groupno;
  2055. var newData = { groupNo: parentArr };
  2056. for (const index in _this.adviceTableData) {
  2057. if (_this.adviceTableData[index].groupno == groupNo) {
  2058. for (const i in parentArr) {
  2059. if (parentArr[i].id in childMap) {
  2060. for (const j in childMap[parentArr[i].id]) {
  2061. _this.adviceTableData.splice(
  2062. index,
  2063. 0,
  2064. childMap[parentArr[i].id][j]
  2065. );
  2066. }
  2067. }
  2068. _this.adviceTableData.splice(index, 0, parentArr[i]);
  2069. }
  2070. break;
  2071. }
  2072. }
  2073. for (const index in groups) {
  2074. if (groups[index].parent_id > 0) {
  2075. continue;
  2076. }
  2077. _this.editRowKey++;
  2078. var item = {
  2079. advice_name: groups[index].advice_name,
  2080. advice_desc: groups[index].advice_desc,
  2081. single_dose: "" + groups[index].single_dose,
  2082. single_dose_unit: groups[index].single_dose_unit,
  2083. drug_spec: "" + groups[index].drug_spec,
  2084. drug_spec_unit: groups[index].drug_spec_unit,
  2085. prescribing_number: "" + groups[index].prescribing_number,
  2086. prescribing_number_unit:
  2087. groups[index].prescribing_number_unit,
  2088. delivery_way: groups[index].delivery_way,
  2089. execution_frequency: groups[index].execution_frequency,
  2090. drug_name_id:groups[index].drug_name_id,
  2091. drug_id:groups[index].drug_id,
  2092. way:groups[index].way,
  2093. isEdit: 0,
  2094. index: 0,
  2095. id: groups[index].id,
  2096. children: [],
  2097. parent_row: 0,
  2098. row_key: _this.editRowKey
  2099. };
  2100. if (item.id in childMap) {
  2101. for (const key in childMap[item.id]) {
  2102. _this.editRowKey++;
  2103. var child = {
  2104. advice_name: childMap[item.id][key].advice_name,
  2105. advice_desc: childMap[item.id][key].advice_desc,
  2106. single_dose: "" + childMap[item.id][key].single_dose,
  2107. single_dose_unit:
  2108. childMap[item.id][key].single_dose_unit,
  2109. drug_spec: "" + childMap[item.id][key].drug_spec,
  2110. drug_spec_unit: childMap[item.id][key].drug_spec_unit,
  2111. prescribing_number:
  2112. "" + childMap[item.id][key].prescribing_number,
  2113. prescribing_number_unit:
  2114. childMap[item.id][key].prescribing_number_unit,
  2115. delivery_way: childMap[item.id][key].delivery_way,
  2116. execution_frequency:childMap[item.id][key].execution_frequency,
  2117. drug_name_id:childMap[item.id][key].drug_name_id,
  2118. drug_id:childMap[item.id][key].drug_id,
  2119. way:childMap[item.id][key].way,
  2120. isEdit: 0,
  2121. index: 0,
  2122. id: childMap[item.id][key].id,
  2123. children: [],
  2124. parent_row: item.row_key,
  2125. row_key: _this.editRowKey
  2126. };
  2127. item.children.push(child);
  2128. }
  2129. _this.$set(item, "children", item.children);
  2130. }
  2131. _this.groupForm.adviceNames.unshift(item);
  2132. }
  2133. _this.resetForm(formName);
  2134. return false;
  2135. }
  2136. });
  2137. }
  2138. _this.templateFormVisible = false;
  2139. }
  2140. });
  2141. },
  2142. openAdviceTemplate() {
  2143. this.templateForm = { id: "" };
  2144. this.selectedTemp = { id: 0, name: "", org_id: 0, list: [], rows: [] };
  2145. this.selectedTemplate = [];
  2146. if (typeof this.$refs.templatetable !== "undefined") {
  2147. this.$refs.templatetable.setCurrentRow(null);
  2148. }
  2149. this.templateFormVisible = true;
  2150. },
  2151. selectGroupAdvice(row) {
  2152. console.log('row',row)
  2153. this.groupSelectRow = row;
  2154. },
  2155. groupClassName({ row, rowIndex }) {
  2156. row.index = rowIndex;
  2157. },
  2158. getRowKey(row) {
  2159. return row.row_key;
  2160. },
  2161. resetForm(formName) {
  2162. this.$refs[formName].resetFields();
  2163. },
  2164. open(groupNo) {
  2165. this.groupEditFormVisible = true;
  2166. this.groupSelectRow = null;
  2167. if (typeof this.$refs.advicenametable !== "undefined") {
  2168. this.$refs.advicenametable.setCurrentRow(null);
  2169. }
  2170. // groupNo
  2171. this.editRowKey = 0;
  2172. var groups = [];
  2173. for (const index in this.adviceTableData) {
  2174. if (groupNo == this.adviceTableData[index].groupno) {
  2175. groups.push(this.adviceTableData[index]);
  2176. }
  2177. }
  2178. if (groups.length == 0) {
  2179. return false;
  2180. }
  2181. console.log(groups[0].advice_doctor);
  2182. this.adminusername = this.getXuserName(groups[0].advice_doctor);
  2183. this.groupForm = {
  2184. advice_type: groups[0].advice_type,
  2185. advice_date: uParseTime(groups[0].advice_date, "{y}-{m}-{d}"),
  2186. start_time: uParseTime(groups[0].start_time, "{y}-{m}-{d} {h}:{i}"),
  2187. adviceNames: [],
  2188. advice_doctor: "",
  2189. remark: groups[0].remark,
  2190. groupno: groupNo
  2191. };
  2192. var childMap = {};
  2193. for (const index in groups) {
  2194. if (groups[index].parent_id == 0) {
  2195. continue;
  2196. }
  2197. if (groups[index].parent_id in childMap === false) {
  2198. childMap[groups[index].parent_id] = [];
  2199. }
  2200. childMap[groups[index].parent_id].push(groups[index]);
  2201. }
  2202. for (const index in groups) {
  2203. if (groups[index].parent_id > 0) {
  2204. continue;
  2205. }
  2206. this.editRowKey++;
  2207. var item = {
  2208. advice_doctor: groups[index].advice_doctor,
  2209. advice_name: groups[index].advice_name,
  2210. advice_desc: groups[index].advice_desc,
  2211. single_dose: "" + groups[index].single_dose,
  2212. single_dose_unit: groups[index].single_dose_unit,
  2213. drug_spec: "" + groups[index].drug_spec,
  2214. drug_spec_unit: groups[index].drug_spec_unit,
  2215. prescribing_number: "" + groups[index].prescribing_number,
  2216. prescribing_number_unit: groups[index].prescribing_number_unit,
  2217. delivery_way: groups[index].delivery_way,
  2218. execution_frequency: groups[index].execution_frequency,
  2219. drug_name_id:groups[index].drug_name_id,
  2220. drug_id:groups[index].drug_id,
  2221. way:groups[index].way,
  2222. isEdit: 0,
  2223. index: 0,
  2224. id: groups[index].id,
  2225. children: [],
  2226. parent_row: 0,
  2227. row_key: this.editRowKey
  2228. };
  2229. if (item.id in childMap) {
  2230. for (const key in childMap[item.id]) {
  2231. this.editRowKey++;
  2232. var child = {
  2233. advice_doctor: childMap[item.id][key].advice_doctor,
  2234. advice_name: childMap[item.id][key].advice_name,
  2235. advice_desc: childMap[item.id][key].advice_desc,
  2236. single_dose: "" + childMap[item.id][key].single_dose,
  2237. single_dose_unit: childMap[item.id][key].single_dose_unit,
  2238. drug_spec: "" + childMap[item.id][key].drug_spec,
  2239. drug_spec_unit: childMap[item.id][key].drug_spec_unit,
  2240. prescribing_number:
  2241. "" + childMap[item.id][key].prescribing_number,
  2242. prescribing_number_unit:
  2243. childMap[item.id][key].prescribing_number_unit,
  2244. delivery_way: childMap[item.id][key].delivery_way,
  2245. execution_frequency: childMap[item.id][key].execution_frequency,
  2246. drug_name_id: childMap[item.id][key].drug_name_id,
  2247. drug_id: childMap[item.id][key].drug_id,
  2248. way: childMap[item.id][key].way,
  2249. isEdit: 0,
  2250. index: 0,
  2251. id: childMap[item.id][key].id,
  2252. children: [],
  2253. parent_row: item.row_key,
  2254. row_key: this.editRowKey
  2255. };
  2256. item.children.push(child);
  2257. }
  2258. this.$set(item, "children", item.children);
  2259. }
  2260. this.groupForm.adviceNames.push(item);
  2261. }
  2262. },
  2263. SaveEditAdvices() {
  2264. console.log("aaa")
  2265. const params = {
  2266. start_time: this.groupForm.start_time,
  2267. groupno: this.groupForm.groupno,
  2268. date: this.$route.query.date,
  2269. patient_id: this.$route.query.patient_id
  2270. };
  2271. console.log("params", params);
  2272. SaveEditAdvices(params).then(response => {
  2273. if (response.data.state == 1) {
  2274. var advice = response.data.data.advice;
  2275. this.$message.success("保存成功!");
  2276. this.groupEditFormVisible = false;
  2277. this.$parent.getDialysisScheduleDetail()
  2278. }
  2279. });
  2280. },
  2281. getSelfMedicalList(){
  2282. const params = {
  2283. patient_id:this.$route.query.patient_id
  2284. }
  2285. getSelfMedicalList(params).then(response=>{
  2286. if (response.data.state == 1) {
  2287. this.arr_drug = []
  2288. var medicalList = response.data.data.private_drug_list
  2289. var base_drug_list = response.data.data.base_drug_list
  2290. var base_drug_cofig = response.data.data.base_drug_config
  2291. var private_drug_cofig = response.data.data.private_drug_config
  2292. if(private_drug_cofig != null&&private_drug_cofig.drug_start == 1) {
  2293. for (let i = 0; i < medicalList.length; i++) {
  2294. if(medicalList[i].drug_specs != null) {
  2295. for (let a = 0; a < medicalList[i].drug_specs.length; a++) {
  2296. medicalList[i].drug_specs[a]['type'] = 2
  2297. }
  2298. }
  2299. let obj = {
  2300. drug_name: "",
  2301. drug_desc: "",
  2302. delivery_way: "",
  2303. execution_frequency: "",
  2304. single_dose: "",
  2305. single_dose_unit: "",
  2306. prescribing_number: "",
  2307. prescribing_number_unit: "",
  2308. type_id: "",
  2309. type: "",
  2310. custom_id: "",
  2311. drug_specs: [],
  2312. }
  2313. medicalList[i].drug_name = medicalList[i].drug_name + "(自备药)"
  2314. obj.drug_name = medicalList[i].drug_name
  2315. obj.delivery_way = medicalList[i].delivery_way
  2316. obj.execution_frequency = medicalList[i].execution_frequency
  2317. obj.single_dose = medicalList[i].single_dose
  2318. obj.prescribing_number = medicalList[i].prescribing_number
  2319. obj.type_id = medicalList[i].id
  2320. obj.type = 2
  2321. obj.custom_id = this.rand(10000000, 99999999)
  2322. obj.drug_specs = medicalList[i].drug_specs
  2323. this.all_drug.push(obj)
  2324. }
  2325. }
  2326. for (let i = 0; i < base_drug_list.length; i++) {
  2327. if(base_drug_list[i].drug_specs != null) {
  2328. for (let a = 0; a < base_drug_list[i].drug_specs.length; a++) {
  2329. base_drug_list[i].drug_specs[a]['type'] = 1
  2330. }
  2331. }
  2332. let obj = {
  2333. drug_name: "",
  2334. drug_desc: "",
  2335. delivery_way: "",
  2336. execution_frequency: "",
  2337. single_dose: "",
  2338. single_dose_unit: "",
  2339. prescribing_number: "",
  2340. prescribing_number_unit: "",
  2341. type_id: "",
  2342. type: "",
  2343. custom_id: "",
  2344. drug_specs: [],
  2345. }
  2346. obj.drug_name = base_drug_list[i].drug_name
  2347. obj.delivery_way = base_drug_list[i].delivery_way
  2348. obj.execution_frequency = base_drug_list[i].execution_frequency
  2349. obj.single_dose = base_drug_list[i].single_dose
  2350. obj.prescribing_number = base_drug_list[i].prescribing_number
  2351. obj.type_id = base_drug_list[i].id
  2352. obj.type = 1
  2353. obj.custom_id = this.rand(10000000, 99999999)
  2354. obj.drug_specs = base_drug_list[i].drug_specs
  2355. this.all_drug.push(obj)
  2356. }
  2357. }
  2358. })
  2359. },
  2360. changeDrugName(name){
  2361. this.current_drug_name = name
  2362. this.nameForm.advice_desc = ''
  2363. this.drugSpec = []
  2364. for (let i = 0; i < this.all_drug.length; i++) {
  2365. if (this.all_drug[i].drug_name == name) {
  2366. this.drugSpec = this.all_drug[i].drug_specs
  2367. }
  2368. }
  2369. },
  2370. changeDrugDesc(name) {
  2371. this.current_drug_spec = name
  2372. for (let i = 0; i < this.drugSpec.length; i++) {
  2373. if (this.drugSpec[i].drug_spec == name) {
  2374. this.nameForm.advice_desc = this.drugSpec[i].drug_spec
  2375. this.nameForm.prescribing_number = this.drugSpec[i].prescribing_number.toString()
  2376. this.nameForm.single_dose = this.drugSpec[i].single_dose.toString()
  2377. this.nameForm.delivery_way = this.drugSpec[i].delivery_way.toString()
  2378. this.nameForm.execution_frequency = this.drugSpec[i].execution_frequency.toString()
  2379. this.drug_id = this.drugSpec[i].id
  2380. this.src_type = this.drugSpec[i].type
  2381. this.nameForm.drug_id = this.drugSpec[i].id
  2382. this.nameForm.way = this.drugSpec[i].type
  2383. this.drug_name_id = this.drugSpec[i].drug_name_id
  2384. this.nameForm.drug_name_id = this.drugSpec[i].drug_name_id
  2385. }
  2386. }
  2387. },
  2388. rand(min, max) {
  2389. return Math.floor(Math.random() * (max - min)) + min;
  2390. },
  2391. querySearch(queryString, cb) {
  2392. var restaurants = this.all_drug;
  2393. restaurants.map(item => {
  2394. item.value = item.drug_name
  2395. })
  2396. var results = queryString ? restaurants.filter(this.createFilter(queryString)) : restaurants;
  2397. // 调用 callback 返回建议列表的数据
  2398. cb(results);
  2399. },
  2400. createFilter(queryString) {
  2401. return (restaurant) => {
  2402. return (restaurant.drug_name.toLowerCase().indexOf(queryString.toLowerCase()) === 0);
  2403. };
  2404. },
  2405. querySearch1(queryString, cb) {
  2406. console.log('queryString',queryString)
  2407. var restaurants = this.drugSpec;
  2408. console.log(restaurants)
  2409. restaurants.map(item => {
  2410. item.value = item.drug_spec
  2411. })
  2412. var results = queryString ? restaurants.filter(this.createFilter(queryString)) : restaurants;
  2413. // 调用 callback 返回建议列表的数据
  2414. console.log('results',results)
  2415. cb(results);
  2416. },
  2417. getDataConfig(module, filed_name) {
  2418. return getDataConfig(module, filed_name)
  2419. },
  2420. getUnit(id){
  2421. var name = ""
  2422. for(let i=0;i<this.units.length;i++){
  2423. if(id == this.units[i].id){
  2424. name = this.units[i].name
  2425. }
  2426. }
  2427. return name
  2428. }
  2429. },
  2430. watch: {
  2431. "selectedTemp.list": function() {
  2432. this.calcselectedTemp();
  2433. }
  2434. },
  2435. created(){
  2436. this.units = this.getDataConfig('hemodialysis','units')
  2437. console.log("32322323232我的",this.units)
  2438. //获取自备药
  2439. this.getSelfMedicalList()
  2440. }
  2441. };
  2442. </script>
  2443. <style>
  2444. #user-edit-advice-name-table .el-table__row {
  2445. display: table-row !important;
  2446. }
  2447. #user-edit-advice-name-table .el-table__expand-icon {
  2448. -webkit-transform: rotate(90deg) !important;
  2449. transform: rotate(90deg) !important;
  2450. }
  2451. #dialysis-update-select-template-table .el-table__row {
  2452. display: table-row !important;
  2453. }
  2454. #dialysis-update-select-template-table .el-table__expand-icon {
  2455. -webkit-transform: rotate(90deg) !important;
  2456. transform: rotate(90deg) !important;
  2457. }
  2458. </style>