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

EditGroupAdvice.vue 96KB

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