AddGroupAdvice.vue 75KB

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