AddGroupAdvice.vue 69KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856
  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. </div>
  543. </template>
  544. <script>
  545. import {
  546. CreateDoctorAdvice,
  547. CreateGroupAdvice,
  548. DeleteDoctorAdvice,
  549. DeleteGroupAdvice,
  550. EditDoctorAdvice,
  551. getAdviceConfig,
  552. getDoctorAdviceList,
  553. StopDoctorAdvice
  554. } from "@/api/advice";
  555. import { getDataConfig } from '@/utils/data'
  556. import {getSelfMedicalList,getDrugDescByDrugName } from "@/api/drug/drug"
  557. import { duration } from 'moment';
  558. export default {
  559. name: "AddGroupAdvice",
  560. data() {
  561. return {
  562. editRowKey: 0,
  563. oldTemplateFormVisible: false,
  564. templateFormVisible: false,
  565. groupAddFormVisible: false,
  566. nameFormVisible: false,
  567. groupSelectRow: null,
  568. nameFormTitle: "",
  569. isChild: false,
  570. isEdit: false,
  571. adminusername: "",
  572. groupRules: {
  573. advice_type: [{ required: true, message: "请选择医嘱类型" }],
  574. advice_date: [{ required: true, message: "请选择医嘱时间" }],
  575. start_time: [{ required: true, message: "请选择开始时间" }],
  576. advice_name: [{ required: true, message: "请填写医嘱名称" }],
  577. advice_doctor: [{ required: true, message: "请选择开嘱医生" }]
  578. },
  579. nameRules: {
  580. advice_name: [{ required: true, message: "请填写医嘱内容" }]
  581. },
  582. templateRules: {
  583. id: [{ required: true, message: "请选择医嘱模板" }]
  584. },
  585. templateForm: { id: "" },
  586. nameForm: {
  587. advice_name: "",
  588. advice_desc: "",
  589. single_dose: "",
  590. single_dose_unit: "",
  591. drug_spec: "",
  592. drug_spec_unit: "",
  593. prescribing_number: "",
  594. prescribing_number_unit: "",
  595. delivery_way: "",
  596. execution_frequency: "",
  597. remark: "",
  598. isEdit: 0,
  599. index: 0,
  600. id: 0,
  601. children: [],
  602. drug_id:0,
  603. way:0,
  604. drug_name_id:0,
  605. },
  606. submitGroupForm: {
  607. advice_type: "",
  608. advice_date: "",
  609. start_time: "",
  610. adviceNames: [],
  611. advice_doctor: "",
  612. remark: "",
  613. parent_id: 0
  614. },
  615. groupForm: {
  616. advice_type: "",
  617. advice_date: "",
  618. start_time: "",
  619. adviceNames: [],
  620. advice_doctor: "",
  621. remark: "",
  622. parent_id: 0,
  623. drug_id:"",
  624. way:"",
  625. drug_name_id:0,
  626. },
  627. selectedTemp: { id: 0, name: "", org_id: 0, list: [], rows: [] },
  628. selectedTemplate: [],
  629. allSelectedTemplate: [],
  630. medicals:[],
  631. drugSpec:[],
  632. all_drug:[],
  633. current_drug_name:"",
  634. current_drug_spec: "",
  635. drug_id: 0,
  636. drug_name_id:"",
  637. src_type:"",
  638. private_drug_config:{},
  639. units:[],
  640. };
  641. },
  642. props: {
  643. patientID: 0,
  644. adviceType: 0,
  645. rowKey: 0,
  646. adviceTemplates: {
  647. type: Array,
  648. default: function() {
  649. return [];
  650. }
  651. },
  652. recordDate: "",
  653. adviceTypeOptions: {
  654. type: Array,
  655. default: function() {
  656. return [];
  657. }
  658. },
  659. deliveryWayOptions: {
  660. type: Array,
  661. default: () => []
  662. },
  663. unitsOption: {
  664. type: Array,
  665. default: function() {
  666. return [];
  667. }
  668. },
  669. executionFrequencyOptions: {
  670. type: Array,
  671. default: function() {
  672. return [];
  673. }
  674. },
  675. adviceTemplateMaps: {
  676. type: Object,
  677. default: function() {
  678. return {};
  679. }
  680. },
  681. adviceTableData: {
  682. type: Array,
  683. default: function() {
  684. return [];
  685. }
  686. },
  687. predialysis: {
  688. type: Object,
  689. default: () => {
  690. return { id: 0 }
  691. }
  692. },
  693. schedulePatient:{
  694. type: Object,
  695. default: () => {
  696. return { id: 0 }
  697. }
  698. }
  699. },
  700. methods: {
  701. lili(val){
  702. console.log("=3=val=3=",val)
  703. },
  704. submitgroupAdvice(formName) {
  705. this.$refs[formName].validate(valid => {
  706. if (valid) {
  707. var submitForm = {
  708. advice_type: this.groupForm.advice_type,
  709. advice_date: this.groupForm.advice_date,
  710. start_time: this.groupForm.start_time,
  711. adviceNames: [],
  712. advice_doctor: this.groupForm.advice_doctor,
  713. remark: this.groupForm.remark,
  714. parent_id: this.groupForm.parent_id,
  715. id:this.groupForm.id,
  716. };
  717. var adviceNames = [];
  718. for (const index in this.groupForm.adviceNames) {
  719. adviceNames.unshift(this.groupForm.adviceNames[index]);
  720. }
  721. for(let i=0;i<adviceNames.length;i++){
  722. adviceNames[i].template_id = "888888888"
  723. }
  724. submitForm.adviceNames = adviceNames;
  725. let mode = "1";
  726. if(this.private_drug_config != null&& this.private_drug_config.drug_start == 1){
  727. for(let index=0;index<submitForm.adviceNames.length;index++){
  728. for(let i=0;i<this.medicals.length;i++){
  729. if(submitForm.adviceNames[index].children.length >0){
  730. for(let y=0;y<submitForm.adviceNames[index].children.length;y++){
  731. if(submitForm.adviceNames[index].children[y].drug_id == this.medicals[i].drug_name_id){
  732. submitForm.adviceNames[index].children[y].drug_name_id = this.medicals[i].drug_name_id
  733. submitForm.adviceNames[index].children[y].way = 2
  734. }
  735. }
  736. }
  737. if(submitForm.adviceNames[index].children.length == 0){
  738. if(submitForm.adviceNames[index].drug_id == this.medicals[i].drug_name_id){
  739. submitForm.adviceNames[index].way = 2
  740. submitForm.adviceNames[index].drug_name_id = this.medicals[i].drug_name_id
  741. }
  742. }
  743. }
  744. }
  745. }
  746. CreateGroupAdvice(this.patientID, 0, submitForm, mode).then(
  747. response => {
  748. if (response.data.state == 0) {
  749. this.$message.error(response.data.msg);
  750. return false;
  751. } else {
  752. this.$notify({
  753. title: "成功",
  754. message: "新增成功",
  755. type: "success",
  756. duration: 2000
  757. });
  758. var childMap = {};
  759. for (const index in response.data.data.advices) {
  760. if (response.data.data.advices[index].parent_id == 0) {
  761. continue;
  762. }
  763. if (
  764. response.data.data.advices[index].parent_id in childMap ===
  765. false
  766. ) {
  767. childMap[response.data.data.advices[index].parent_id] = [];
  768. }
  769. childMap[response.data.data.advices[index].parent_id].unshift(
  770. response.data.data.advices[index]
  771. );
  772. }
  773. var parentArr = [];
  774. for (const index in response.data.data.advices) {
  775. if (response.data.data.advices[index].parent_id > 0) {
  776. continue;
  777. }
  778. parentArr.push(response.data.data.advices[index]);
  779. }
  780. for (const index in parentArr) {
  781. if (parentArr[index].id in childMap) {
  782. for (const j in childMap[parentArr[index].id]) {
  783. this.adviceTableData.unshift(
  784. childMap[parentArr[index].id][j]
  785. );
  786. }
  787. }
  788. this.adviceTableData.unshift(parentArr[index]);
  789. }
  790. // var alen = response.data.data.advices.length
  791. // for (let index = alen-1; index >=0; index--) {
  792. // this.adviceTableData.unshift(response.data.data.advices[index]);
  793. // }
  794. this.resetForm(formName);
  795. this.groupAddFormVisible = false;
  796. this.$parent.getDialysisScheduleDetail()
  797. return false;
  798. }
  799. }
  800. );
  801. }
  802. });
  803. },
  804. openDeleteGroupAdvice() {
  805. if (this.groupSelectRow === null) {
  806. this.$message.error("未选择要删除的医嘱内容");
  807. return;
  808. }
  809. var content = "";
  810. if (this.groupSelectRow.children.length > 0) {
  811. content = "确认删除此医嘱内容,包括它的子药?";
  812. } else {
  813. content = "确认删除此医嘱内容?";
  814. }
  815. var isChild = !!this.groupSelectRow.parent_row;
  816. var title = isChild ? "删除子药内容" : "删除医嘱内容";
  817. var msg = isChild ? "确认删除此子药内容?" : content;
  818. this.$confirm(msg, title, {
  819. confirmButtonText: "确定",
  820. cancelButtonText: "取消",
  821. type: "warning"
  822. })
  823. .then(() => {
  824. if (isChild) {
  825. for (const index in this.groupForm.adviceNames) {
  826. if (
  827. this.groupForm.adviceNames[index].row_key ==
  828. this.groupSelectRow.parent_row
  829. ) {
  830. for (const j in this.groupForm.adviceNames[index].children) {
  831. if (
  832. this.groupForm.adviceNames[index].children[j].row_key ==
  833. this.groupSelectRow.row_key
  834. ) {
  835. this.groupForm.adviceNames[index].children.splice(j, 1);
  836. this.$set(
  837. this.groupForm.adviceNames,
  838. index,
  839. this.groupForm.adviceNames[index]
  840. );
  841. break;
  842. }
  843. }
  844. }
  845. }
  846. } else {
  847. for (const index in this.groupForm.adviceNames) {
  848. if (
  849. this.groupForm.adviceNames[index].row_key ==
  850. this.groupSelectRow.row_key
  851. ) {
  852. this.groupForm.adviceNames.splice(index, 1);
  853. break;
  854. }
  855. }
  856. }
  857. })
  858. .catch(() => {});
  859. },
  860. submitNameForm(formName) {
  861. console.log("forname",this.nameForm)
  862. if(this.src_type == ""){
  863. this.nameForm.way = 1
  864. this.nameForm.drug_id = this.drug_id
  865. this.nameForm.drug_name_id = 0
  866. }
  867. if(this.src_type == 2){ //自备药
  868. var arr = this.nameForm.advice_name.split("(自备药)")
  869. this.nameForm.advice_name = arr[0]
  870. }
  871. var _this = this;
  872. this.$refs[formName].validate(valid => {
  873. if (valid) {
  874. if (_this.nameForm.isEdit) {
  875. var ale = _this.groupForm.adviceNames.length;
  876. if (_this.isChild) {
  877. for (let index = 0; index < ale; index++) {
  878. if (_this.groupSelectRow.parent_row ==_this.groupForm.adviceNames[index].row_key) {
  879. var cle = _this.groupForm.adviceNames[index].children.length;
  880. var children = _this.groupForm.adviceNames[index].children;
  881. for (let j = 0; j < ale; j++) {
  882. if (_this.groupSelectRow.row_key == children[j].row_key) {
  883. _this.groupForm.adviceNames[index].children[j].advice_name = _this.nameForm.advice_name;
  884. _this.groupForm.adviceNames[index].children[j].advice_desc = _this.nameForm.advice_desc;
  885. _this.groupForm.adviceNames[index].children[j].single_dose = "" + _this.nameForm.single_dose;
  886. _this.groupForm.adviceNames[index].children[j].single_dose_unit = _this.nameForm.single_dose_unit;
  887. _this.groupForm.adviceNames[index].children[j].drug_spec = "" + _this.nameForm.drug_spec;
  888. _this.groupForm.adviceNames[index].children[j].drug_spec_unit = _this.nameForm.drug_spec_unit;
  889. _this.groupForm.adviceNames[index].children[j].prescribing_number ="" + _this.nameForm.prescribing_number;
  890. _this.groupForm.adviceNames[index].children[j].prescribing_number_unit = _this.nameForm.prescribing_number_unit;
  891. _this.groupForm.adviceNames[index].children[j].delivery_way = _this.nameForm.delivery_way;
  892. _this.groupForm.adviceNames[index].children[j].execution_frequency =_this.nameForm.execution_frequency;
  893. _this.groupForm.adviceNames[index].children[j].remark =_this.nameForm.remark;
  894. // _this.groupForm.adviceNames[index].children[j].drug_id = _this.nameForm.drug_id;
  895. // _this.groupForm.adviceNames[index].children[j].way = _this.nameForm.way;
  896. // _this.groupForm.adviceNames[index].children[j].drug_name_id = _this.nameForm.drug_name_id;
  897. _this.$set(_this.groupForm.adviceNames[index].children,j,_this.groupForm.adviceNames[index].children[j]
  898. );
  899. break;
  900. }
  901. }
  902. }
  903. }
  904. } else {
  905. for (let index = 0; index < ale; index++) {
  906. if ( _this.groupSelectRow.row_key ==_this.groupForm.adviceNames[index].row_key) {
  907. _this.groupForm.adviceNames[index].advice_name =_this.nameForm.advice_name;
  908. _this.groupForm.adviceNames[index].advice_desc =_this.nameForm.advice_desc;
  909. _this.groupForm.adviceNames[index].single_dose ="" + _this.nameForm.single_dose;
  910. _this.groupForm.adviceNames[index].single_dose_unit =_this.nameForm.single_dose_unit;
  911. _this.groupForm.adviceNames[index].drug_spec = "" + _this.nameForm.drug_spec;
  912. _this.groupForm.adviceNames[index].drug_spec_unit =_this.nameForm.drug_spec_unit;
  913. _this.groupForm.adviceNames[index].prescribing_number ="" + _this.nameForm.prescribing_number;
  914. _this.groupForm.adviceNames[index].prescribing_number_unit =_this.nameForm.prescribing_number_unit;
  915. _this.groupForm.adviceNames[index].delivery_way =_this.nameForm.delivery_way;
  916. _this.groupForm.adviceNames[index].execution_frequency =_this.nameForm.execution_frequency;
  917. _this.groupForm.adviceNames[index].remark =_this.nameForm.remark;
  918. // _this.groupForm.adviceNames[index].children[j].drug_id = _this.nameForm.drug_id;
  919. // _this.groupForm.adviceNames[index].children[j].way = _this.nameForm.way;
  920. // _this.groupForm.adviceNames[index].children[j].drug_name_id = _this.nameForm.drug_name_id;
  921. _this.$set(
  922. _this.groupForm.adviceNames,
  923. index,
  924. _this.groupForm.adviceNames[index]
  925. );
  926. break;
  927. }
  928. }
  929. }
  930. } else {
  931. if (_this.isChild) {
  932. _this.editRowKey++;
  933. _this.nameForm.row_key = _this.editRowKey;
  934. var ale = _this.groupForm.adviceNames.length;
  935. for (let index = 0; index < ale; index++) {
  936. if (_this.nameForm.parent_row ==_this.groupForm.adviceNames[index].row_key) {
  937. _this.groupForm.adviceNames[index].children.push(_this.nameForm);
  938. _this.$set(_this.groupForm.adviceNames,index,_this.groupForm.adviceNames[index]);
  939. break;
  940. }
  941. }
  942. } else {
  943. _this.editRowKey++;
  944. _this.nameForm.row_key = _this.editRowKey;
  945. _this.groupForm.adviceNames.push(_this.nameForm);
  946. }
  947. }
  948. _this.nameFormVisible = false;
  949. }
  950. });
  951. },
  952. openGroupChild() {
  953. if (this.groupSelectRow === null) {
  954. this.$message.error("未选择医嘱内容,无法添加子药");
  955. return;
  956. } else if (this.groupSelectRow.parent_row > 0) {
  957. this.$notify.error({
  958. title: "错误",
  959. message: "子药不能添加子药"
  960. });
  961. return;
  962. }
  963. this.nameForm = {
  964. advice_name:"",
  965. advice_desc: "",
  966. single_dose: "",
  967. single_dose_unit: "",
  968. drug_spec: "",
  969. drug_spec_unit: "",
  970. prescribing_number: "",
  971. prescribing_number_unit: "",
  972. delivery_way: this.groupSelectRow.delivery_way,
  973. execution_frequency: this.groupSelectRow.execution_frequency,
  974. remark: "",
  975. isEdit: 0,
  976. index: 0,
  977. children: [],
  978. parent_row: this.groupSelectRow.row_key,
  979. id: 0
  980. };
  981. this.isChild = true;
  982. this.nameFormVisible = true;
  983. this.nameFormTitle = "添加子药内容";
  984. },
  985. openGroupAdvice(isEdit) {
  986. console.log("hhhahhdhahdhahddhhdhdhh",this.groupSelectRow)
  987. this.isChild = false;
  988. if (isEdit) {
  989. if (this.groupSelectRow === null) {
  990. this.$message.error("未选择要修改的医嘱内容");
  991. return;
  992. }
  993. if (this.groupSelectRow.parent_row) {
  994. this.isChild = true;
  995. }
  996. this.nameForm = {
  997. advice_name: this.groupSelectRow.advice_name,
  998. advice_desc: this.groupSelectRow.advice_desc,
  999. single_dose:
  1000. this.groupSelectRow.single_dose != 0
  1001. ? this.groupSelectRow.single_dose
  1002. : "",
  1003. single_dose_unit: this.groupSelectRow.single_dose_unit,
  1004. drug_spec:
  1005. this.groupSelectRow.drug_spec != 0
  1006. ? this.groupSelectRow.drug_spec
  1007. : "",
  1008. drug_spec_unit: this.groupSelectRow.drug_spec_unit,
  1009. prescribing_number:
  1010. this.groupSelectRow.prescribing_number != 0
  1011. ? this.groupSelectRow.prescribing_number
  1012. : "",
  1013. prescribing_number_unit: this.groupSelectRow.prescribing_number_unit,
  1014. delivery_way: this.isChild ? "" : this.groupSelectRow.delivery_way,
  1015. execution_frequency: this.isChild
  1016. ? ""
  1017. : this.groupSelectRow.execution_frequency,
  1018. isEdit: 1,
  1019. index: this.groupSelectRow.index,
  1020. id: this.groupSelectRow.id,
  1021. children: [],
  1022. parent_row: this.groupSelectRow.parent_row,
  1023. remark: this.groupSelectRow.remark,
  1024. drug_name_id:this.groupSelectRow.drug_name_id,
  1025. drug_id:this.groupSelectRow.drug_id,
  1026. way:this.groupSelectRow.way
  1027. // row_key:this.groupSelectRow.row_key,
  1028. };
  1029. this.nameFormTitle = "修改医嘱内容";
  1030. } else {
  1031. this.nameForm = {
  1032. advice_name: "",
  1033. advice_desc: "",
  1034. single_dose: "",
  1035. single_dose_unit: "",
  1036. drug_spec: "",
  1037. drug_spec_unit: "",
  1038. prescribing_number: "",
  1039. prescribing_number_unit: "",
  1040. delivery_way: "",
  1041. execution_frequency: "",
  1042. isEdit: 0,
  1043. index: 0,
  1044. id: 0,
  1045. remark: "",
  1046. children: [],
  1047. parent_row: 0
  1048. };
  1049. this.nameFormTitle = "新增医嘱内容";
  1050. }
  1051. this.nameFormVisible = true;
  1052. },
  1053. changeAdvice(selection) {
  1054. this.selectedTemplate = selection;
  1055. },
  1056. selectAdvice(selection, row) {
  1057. var adviceArray = this.adviceTemplateMaps[this.selectedTemp.id].DoctorAdviceTemplate;
  1058. for (let y = 0; y < adviceArray.length; y++) {
  1059. adviceArray[y].selection = false;
  1060. }
  1061. if (selection.length > 0) {
  1062. for (let y = 0; y < adviceArray.length; y++) {
  1063. for (let i = 0; i < selection.length; i++) {
  1064. if (adviceArray[y].id == selection[i].advice_id) {
  1065. adviceArray[y].selection = true;
  1066. }
  1067. }
  1068. }
  1069. }
  1070. if (row.children.length > 0) {
  1071. for (const index in row.children) {
  1072. this.$refs.selecttemplatetable.toggleRowSelection(
  1073. row.children[index]
  1074. );
  1075. }
  1076. }
  1077. // 下面两步的作用是为了上选中的数据的输出顺序不变
  1078. for (const index in this.selectedTemp.list) {
  1079. this.$refs.selecttemplatetable.toggleRowSelection(
  1080. this.selectedTemp.list[index]
  1081. );
  1082. if (this.selectedTemp.list[index].children.length > 0) {
  1083. for (const j in this.selectedTemp.list[index].children) {
  1084. this.$refs.selecttemplatetable.toggleRowSelection(
  1085. this.selectedTemp.list[index].children[j]
  1086. );
  1087. }
  1088. }
  1089. }
  1090. for (const index in this.selectedTemp.list) {
  1091. this.$refs.selecttemplatetable.toggleRowSelection(
  1092. this.selectedTemp.list[index]
  1093. );
  1094. if (this.selectedTemp.list[index].children.length > 0) {
  1095. for (const j in this.selectedTemp.list[index].children) {
  1096. this.$refs.selecttemplatetable.toggleRowSelection(
  1097. this.selectedTemp.list[index].children[j]
  1098. );
  1099. }
  1100. }
  1101. }
  1102. },
  1103. spanselecttable({ row, column, rowIndex, columnIndex }) {
  1104. if (columnIndex == 0) {
  1105. const _row = this.selectedTemp.rows[rowIndex];
  1106. const _col = _row > 0 ? 1 : 0;
  1107. return {
  1108. rowspan: _row,
  1109. colspan: _col
  1110. };
  1111. }
  1112. },
  1113. calcselectedTemp() {
  1114. var rowKeys = 0;
  1115. for (const index in this.selectedTemp.list) {
  1116. var pkey = rowKeys;
  1117. this.selectedTemp.rows[rowKeys] = 1;
  1118. if (this.selectedTemp.list[index].children.length > 0) {
  1119. for (const childindex in this.selectedTemp.list[index].children) {
  1120. rowKeys++;
  1121. this.selectedTemp.rows[pkey] += 1;
  1122. this.selectedTemp.rows[rowKeys] = 0;
  1123. }
  1124. }
  1125. rowKeys++;
  1126. this.$nextTick(function() {
  1127. if (this.selectedTemp.list[index].selection) {
  1128. this.$refs.selecttemplatetable.toggleRowSelection(
  1129. this.selectedTemp.list[index]
  1130. );
  1131. }
  1132. });
  1133. }
  1134. },
  1135. templateTableChange(currentRow, oldCurrentRow) {
  1136. this.selectedTemp = { id: 0, name: "", org_id: 0, list: [], rows: [] };
  1137. if (currentRow == null) {
  1138. return false;
  1139. }
  1140. this.selectedTemp.id = currentRow.id;
  1141. this.selectedTemp.name = currentRow.name;
  1142. this.selectedTemp.org_id = currentRow.org_id;
  1143. if (this.selectedTemp.id in this.adviceTemplateMaps) {
  1144. var mapid = this.selectedTemp.id;
  1145. var thisRowKey = 0;
  1146. for (const index in this.adviceTemplateMaps[mapid].DoctorAdviceTemplate) {
  1147. thisRowKey++;
  1148. var item = {
  1149. advice_name: this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].advice_name,
  1150. advice_desc: this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].advice_desc,
  1151. single_dose:"" +this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].single_dose,
  1152. single_dose_unit: this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].single_dose_unit,
  1153. drug_spec:"" +this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].drug_spec,
  1154. drug_spec_unit: this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].drug_spec_unit,
  1155. prescribing_number:"" +this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].prescribing_number,
  1156. prescribing_number_unit: this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].prescribing_number_unit,
  1157. delivery_way: this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].delivery_way,
  1158. execution_frequency: this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].execution_frequency,
  1159. selection: this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].selection,
  1160. advice_id: this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].id,
  1161. drug_id:this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].drug_id,
  1162. way:this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].way,
  1163. drug_name_id:this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].drug_name_id,
  1164. isEdit: 0,
  1165. id: 0,
  1166. children: [],
  1167. parent_row: 0,
  1168. row_key: thisRowKey
  1169. };
  1170. if (
  1171. "children" in
  1172. this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index] &&
  1173. this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].children
  1174. .length > 0
  1175. ) {
  1176. var parentRow = thisRowKey;
  1177. var children = this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[
  1178. index
  1179. ].children;
  1180. for (const key in children) {
  1181. thisRowKey++;
  1182. var child = {
  1183. advice_id: children[key].id,
  1184. advice_name: children[key].advice_name,
  1185. advice_desc: children[key].advice_desc,
  1186. single_dose: "" + children[key].single_dose,
  1187. single_dose_unit: children[key].single_dose_unit,
  1188. drug_spec: "" + children[key].drug_spec,
  1189. drug_spec_unit: children[key].drug_spec_unit,
  1190. prescribing_number: "" + children[key].prescribing_number,
  1191. prescribing_number_unit: children[key].prescribing_number_unit,
  1192. delivery_way: children[key].delivery_way,
  1193. execution_frequency: children[key].execution_frequency,
  1194. drug_id:children[key].drug_id,
  1195. way:children[key].way,
  1196. drug_name_id:children[key].drug_name_id,
  1197. isEdit: 0,
  1198. id: 0,
  1199. children: [],
  1200. parent_row: parentRow,
  1201. row_key: thisRowKey,
  1202. };
  1203. item.children.push(child);
  1204. }
  1205. this.$set(item, "children", item.children);
  1206. }
  1207. this.selectedTemp.list.unshift(item);
  1208. }
  1209. }
  1210. },
  1211. newAddTempForm() {
  1212. this.allSelectedTemplate = [];
  1213. var thisRowKey = 0;
  1214. for (const indexs in this.adviceTemplateMaps) {
  1215. const adviceTemplate = this.adviceTemplateMaps[indexs];
  1216. for (const index in adviceTemplate.DoctorAdviceTemplate) {
  1217. if (adviceTemplate.DoctorAdviceTemplate[index].selection) {
  1218. thisRowKey++;
  1219. var item = {
  1220. advice_name:adviceTemplate.DoctorAdviceTemplate[index].advice_name,
  1221. advice_desc:adviceTemplate.DoctorAdviceTemplate[index].advice_desc,
  1222. single_dose:"" + adviceTemplate.DoctorAdviceTemplate[index].single_dose,
  1223. single_dose_unit:adviceTemplate.DoctorAdviceTemplate[index].single_dose_unit,
  1224. drug_spec:"" + adviceTemplate.DoctorAdviceTemplate[index].drug_spec,
  1225. drug_spec_unit:adviceTemplate.DoctorAdviceTemplate[index].drug_spec_unit,
  1226. prescribing_number:"" +adviceTemplate.DoctorAdviceTemplate[index].prescribing_number,
  1227. prescribing_number_unit:adviceTemplate.DoctorAdviceTemplate[index].prescribing_number_unit,
  1228. delivery_way:adviceTemplate.DoctorAdviceTemplate[index].delivery_way,
  1229. execution_frequency:adviceTemplate.DoctorAdviceTemplate[index].execution_frequency,
  1230. advice_id: adviceTemplate.DoctorAdviceTemplate[index].id,
  1231. selection: adviceTemplate.DoctorAdviceTemplate[index].selection,
  1232. drug_id: adviceTemplate.DoctorAdviceTemplate[index].drug_id,
  1233. way:adviceTemplate.DoctorAdviceTemplate[index].way,
  1234. drug_name_id:adviceTemplate.DoctorAdviceTemplate[index].drug_name_id,
  1235. isEdit: 0,
  1236. id: 0,
  1237. children: [],
  1238. parent_row: 0,
  1239. row_key: thisRowKey
  1240. };
  1241. console.log("items========",item)
  1242. if (
  1243. "children" in adviceTemplate.DoctorAdviceTemplate[index] &&
  1244. adviceTemplate.DoctorAdviceTemplate[index].children.length > 0
  1245. ) {
  1246. var parentRow = thisRowKey;
  1247. var children =
  1248. adviceTemplate.DoctorAdviceTemplate[index].children;
  1249. for (const key in children) {
  1250. thisRowKey++;
  1251. var child = {
  1252. advice_id: children[key].id,
  1253. advice_name: children[key].advice_name,
  1254. advice_desc: children[key].advice_desc,
  1255. single_dose: "" + children[key].single_dose,
  1256. single_dose_unit: children[key].single_dose_unit,
  1257. drug_spec: "" + children[key].drug_spec,
  1258. drug_spec_unit: children[key].drug_spec_unit,
  1259. prescribing_number: "" + children[key].prescribing_number,
  1260. prescribing_number_unit:children[key].prescribing_number_unit,
  1261. delivery_way: children[key].delivery_way,
  1262. execution_frequency: children[key].execution_frequency,
  1263. drug_id:children[key].drug_id,
  1264. way:children[key].way,
  1265. drug_name_id:children[key].drug_name_id,
  1266. isEdit: 0,
  1267. id: 0,
  1268. children: [],
  1269. parent_row: parentRow,
  1270. row_key: thisRowKey
  1271. };
  1272. console.log("child",child)
  1273. item.children.push(child);
  1274. this.allSelectedTemplate.unshift(child);
  1275. }
  1276. this.$set(item, "children", item.children);
  1277. }
  1278. this.allSelectedTemplate.unshift(item);
  1279. adviceTemplate.DoctorAdviceTemplate[index].selection = false;
  1280. }
  1281. }
  1282. }
  1283. var childMap = {};
  1284. for (const index in this.allSelectedTemplate) {
  1285. if (this.allSelectedTemplate[index].parent_row > 0) {
  1286. if (!(this.allSelectedTemplate[index].parent_row in childMap)) {
  1287. childMap[this.allSelectedTemplate[index].parent_row] = [];
  1288. }
  1289. childMap[this.allSelectedTemplate[index].parent_row].push(
  1290. this.allSelectedTemplate[index]
  1291. );
  1292. }
  1293. }
  1294. for (const index in this.allSelectedTemplate) {
  1295. if (this.allSelectedTemplate[index].parent_row > 0) {
  1296. continue;
  1297. }
  1298. this.editRowKey++;
  1299. var item = {
  1300. advice_name: this.allSelectedTemplate[index].advice_name,
  1301. advice_desc: this.allSelectedTemplate[index].advice_desc,
  1302. single_dose: "" + this.allSelectedTemplate[index].single_dose,
  1303. single_dose_unit: this.allSelectedTemplate[index].single_dose_unit,
  1304. drug_spec: "" + this.allSelectedTemplate[index].drug_spec,
  1305. drug_spec_unit: this.allSelectedTemplate[index].drug_spec_unit,
  1306. prescribing_number:"" + this.allSelectedTemplate[index].prescribing_number,
  1307. prescribing_number_unit: this.allSelectedTemplate[index].prescribing_number_unit,
  1308. delivery_way: this.allSelectedTemplate[index].delivery_way,
  1309. execution_frequency: this.allSelectedTemplate[index].execution_frequency,
  1310. drug_id:this.allSelectedTemplate[index].drug_id,
  1311. way:this.allSelectedTemplate[index].way,
  1312. drug_name_id:this.allSelectedTemplate[index].drug_name_id,
  1313. isEdit: 0,
  1314. id: 0,
  1315. children: [],
  1316. parent_row: 0,
  1317. row_key: this.editRowKey
  1318. };
  1319. if (this.allSelectedTemplate[index].children.length > 0) {
  1320. if (this.allSelectedTemplate[index].row_key in childMap) {
  1321. var parentRow = this.editRowKey;
  1322. var children = childMap[this.allSelectedTemplate[index].row_key];
  1323. for (const key in children) {
  1324. this.editRowKey++;
  1325. var child = {
  1326. advice_name: children[key].advice_name,
  1327. advice_desc: children[key].advice_desc,
  1328. single_dose: "" + children[key].single_dose,
  1329. single_dose_unit: children[key].single_dose_unit,
  1330. drug_spec: "" + children[key].drug_spec,
  1331. drug_spec_unit: children[key].drug_spec_unit,
  1332. prescribing_number: "" + children[key].prescribing_number,
  1333. prescribing_number_unit: children[key].prescribing_number_unit,
  1334. delivery_way: children[key].delivery_way,
  1335. execution_frequency: children[key].execution_frequency,
  1336. drug_id:children[key].drug_id,
  1337. way:children[key].way,
  1338. drug_name_id:children[key].drug_name_id,
  1339. isEdit: 0,
  1340. id: 0,
  1341. children: [],
  1342. parent_row: parentRow,
  1343. row_key: this.editRowKey
  1344. };
  1345. item.children.push(child);
  1346. }
  1347. this.$set(item, "children", item.children);
  1348. }
  1349. }
  1350. console.log(this.groupForm.adviceNames)
  1351. this.groupForm.adviceNames.push(item);
  1352. }
  1353. this.templateFormVisible = false;
  1354. },
  1355. addTempForm(formName) {
  1356. var _this = this;
  1357. this.$refs[formName].validate(valid => {
  1358. if (valid) {
  1359. if (_this.templateForm.id in _this.adviceTemplateMaps) {
  1360. var mapid = _this.templateForm.id;
  1361. for (const index in _this.adviceTemplateMaps[mapid]
  1362. .DoctorAdviceTemplate) {
  1363. this.editRowKey++;
  1364. var item = {advice_name:_this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].advice_name,
  1365. advice_desc:_this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].advice_desc,
  1366. single_dose:"" +_this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].single_dose,
  1367. single_dose_unit:_this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].single_dose_unit,
  1368. drug_spec:"" +_this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].drug_spec,
  1369. drug_spec_unit:_this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].drug_spec_unit,
  1370. prescribing_number:"" +_this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].prescribing_number,
  1371. prescribing_number_unit:_this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].prescribing_number_unit,
  1372. delivery_way:_this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].delivery_way,
  1373. execution_frequency:_this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].execution_frequency,
  1374. isEdit: 0,
  1375. id: 0,
  1376. children: [],
  1377. parent_row: 0,
  1378. row_key: this.editRowKey
  1379. };
  1380. if (
  1381. "children" in
  1382. _this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index] &&
  1383. _this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index]
  1384. .children
  1385. ) {
  1386. var parentRow = this.editRowKey;
  1387. var children =
  1388. _this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index]
  1389. .children;
  1390. for (const key in children) {
  1391. this.editRowKey++;
  1392. var child = {
  1393. advice_name: children[key].advice_name,
  1394. advice_desc: children[key].advice_desc,
  1395. single_dose: "" + children[key].single_dose,
  1396. single_dose_unit: children[key].single_dose_unit,
  1397. drug_spec: "" + children[key].drug_spec,
  1398. drug_spec_unit: children[key].drug_spec_unit,
  1399. prescribing_number: "" + children[key].prescribing_number,
  1400. prescribing_number_unit:
  1401. children[key].prescribing_number_unit,
  1402. delivery_way: children[key].delivery_way,
  1403. execution_frequency: children[key].execution_frequency,
  1404. isEdit: 0,
  1405. id: 0,
  1406. children: [],
  1407. parent_row: parentRow,
  1408. row_key: this.editRowKey
  1409. };
  1410. item.children.push(child);
  1411. }
  1412. _this.$set(item, "children", item.children);
  1413. }
  1414. _this.groupForm.adviceNames.unshift(item);
  1415. }
  1416. }
  1417. _this.templateFormVisible = false;
  1418. }
  1419. });
  1420. },
  1421. openAdviceTemplate() {
  1422. this.templateForm = { id: "" };
  1423. this.selectedTemp = { id: 0, name: "", org_id: 0, list: [], rows: [] };
  1424. this.selectedTemplate = [];
  1425. if (typeof this.$refs.templatetable !== "undefined") {
  1426. this.$refs.templatetable.setCurrentRow(null);
  1427. }
  1428. this.templateFormVisible = true;
  1429. },
  1430. selectGroupAdvice(row) {
  1431. this.groupSelectRow = row;
  1432. },
  1433. groupClassName({ row, rowIndex }) {
  1434. row.index = rowIndex;
  1435. },
  1436. getRowKey(row) {
  1437. return row.row_key;
  1438. },
  1439. resetForm(formName) {
  1440. this.$refs[formName].resetFields();
  1441. },
  1442. open() {
  1443. this.groupAddFormVisible = true;
  1444. this.groupSelectRow = null;
  1445. if (typeof this.$refs.advicenametable !== "undefined") {
  1446. this.$refs.advicenametable.setCurrentRow(null);
  1447. }
  1448. this.editRowKey = 0;
  1449. this.groupForm = {
  1450. advice_type: 2,
  1451. advice_date: this.recordDate,
  1452. start_time: "",
  1453. adviceNames: [],
  1454. advice_doctor: "",
  1455. remark: "",
  1456. parent_id: 0
  1457. };
  1458. var xtuser = this.$store.getters.xt_user;
  1459. // this.orgname = xtuser.org.org_name;
  1460. this.adminusername = xtuser.user.user_name;
  1461. if(this.$store.getters.xt_user.org.id == 10101){
  1462. if (this.predialysis.id > 0 && this.predialysis.created_time > 0) {
  1463. var date = new Date(this.predialysis.created_time * 1000)
  1464. var year = date.getFullYear()
  1465. var month = date.getMonth() + 1
  1466. var day = date.getDate()
  1467. var hours = date.getHours()
  1468. var minites = date.getMinutes()
  1469. if (month < 10) {
  1470. month = '0' + month
  1471. }
  1472. if (day < 10) {
  1473. day = '0' + day
  1474. }
  1475. if (hours < 10) {
  1476. hours = '0' + hours
  1477. }
  1478. if (minites < 10) {
  1479. minites = '0' + minites
  1480. }
  1481. this.groupForm.start_time = year + '-' + month + '-' + day + ' ' + hours + ':' + minites
  1482. } else {
  1483. var date = new Date()
  1484. var year = date.getFullYear()
  1485. var month = date.getMonth() + 1
  1486. var day = date.getDate()
  1487. var hours = date.getHours()
  1488. var minites = date.getMinutes()
  1489. if (month < 10) {
  1490. month = '0' + month
  1491. }
  1492. if (day < 10) {
  1493. day = '0' + day
  1494. }
  1495. if (hours < 10) {
  1496. hours = '0' + hours
  1497. }
  1498. if (minites < 10) {
  1499. minites = '0' + minites
  1500. }
  1501. this.groupForm.start_time = year + '-' + month + '-' + day + ' ' + hours + ':' + minites
  1502. }
  1503. }
  1504. if( this.$store.getters.xt_user.org.id == 0 || 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 == 10447){
  1505. var date = new Date()
  1506. var year = date.getFullYear()
  1507. var month = date.getMonth() + 1
  1508. var day = date.getDate()
  1509. var hours = date.getHours()
  1510. var minites = date.getMinutes()
  1511. if (month < 10) {
  1512. month = '0' + month
  1513. }
  1514. if (day < 10) {
  1515. day = '0' + day
  1516. }
  1517. if (hours < 10) {
  1518. hours = '0' + hours
  1519. }
  1520. if (minites < 10) {
  1521. minites = '0' + minites
  1522. }
  1523. if (this.schedulePatient.schedule_type == 1) {
  1524. this.groupForm.start_time = year + '-' + month + '-' + day + ' ' + '07:00'
  1525. } else if (this.schedulePatient.schedule_type == 2) {
  1526. this.groupForm.start_time= year + '-' + month + '-' + day + ' ' + '11:00'
  1527. } else if (this.schedulePatient.schedule_type == 3) {
  1528. this.groupForm.start_time = year + '-' + month + '-' + day + ' ' + '18:00'
  1529. }
  1530. }
  1531. },
  1532. selectAllTemplateAdvice(selection) {
  1533. console.log("params",selection)
  1534. var adviceArray = this.adviceTemplateMaps[this.selectedTemp.id].DoctorAdviceTemplate;
  1535. for (let y = 0; y < adviceArray.length; y++) {
  1536. adviceArray[y].selection = false;
  1537. }
  1538. if (selection.length > 0) {
  1539. for (let y = 0; y < adviceArray.length; y++) {
  1540. for (let i = 0; i < selection.length; i++) {
  1541. if (adviceArray[y].id == selection[i].advice_id) {
  1542. adviceArray[y].selection = true;
  1543. }
  1544. }
  1545. }
  1546. }
  1547. },
  1548. cancleDialog() {
  1549. this.templateFormVisible = false;
  1550. for (const indexs in this.adviceTemplateMaps) {
  1551. const adviceTemplate = this.adviceTemplateMaps[indexs];
  1552. for (const index in adviceTemplate.DoctorAdviceTemplate) {
  1553. adviceTemplate.DoctorAdviceTemplate[index].selection = false;
  1554. }
  1555. }
  1556. },
  1557. rand(min, max) {
  1558. return Math.floor(Math.random() * (max - min)) + min;
  1559. },
  1560. //
  1561. getSelfMedicalList(){
  1562. const params = {
  1563. patient_id:this.$route.query.patient_id
  1564. }
  1565. getSelfMedicalList(params).then(response=>{
  1566. if (response.data.state == 1) {
  1567. this.arr_drug = []
  1568. var medicalList = response.data.data.private_drug_list
  1569. console.log("medicallist",medicalList)
  1570. var base_drug_list = response.data.data.base_drug_list
  1571. console.log("base_drug_list23233232322323",base_drug_list)
  1572. var base_drug_cofig = response.data.data.base_drug_config
  1573. var private_drug_cofig = response.data.data.private_drug_config
  1574. if(private_drug_cofig != null&&private_drug_cofig.drug_start == 1) {
  1575. for (let i = 0; i < medicalList.length; i++) {
  1576. if(medicalList[i].drug_specs != null) {
  1577. for (let a = 0; a < medicalList[i].drug_specs.length; a++) {
  1578. medicalList[i].drug_specs[a]['type'] = 2
  1579. }
  1580. }
  1581. let obj = {
  1582. drug_name: "",
  1583. drug_desc: "",
  1584. delivery_way: "",
  1585. execution_frequency: "",
  1586. single_dose: "",
  1587. single_dose_unit: "",
  1588. prescribing_number: "",
  1589. prescribing_number_unit: "",
  1590. type_id: "",
  1591. type: "",
  1592. custom_id: "",
  1593. drug_specs: [],
  1594. }
  1595. medicalList[i].drug_name = medicalList[i].drug_name + "(自备药)"
  1596. obj.drug_name = medicalList[i].drug_name
  1597. obj.delivery_way = medicalList[i].delivery_way
  1598. obj.execution_frequency = medicalList[i].execution_frequency
  1599. obj.single_dose = medicalList[i].single_dose
  1600. obj.prescribing_number = medicalList[i].prescribing_number
  1601. obj.type_id = medicalList[i].id
  1602. obj.type = 2
  1603. obj.custom_id = this.rand(10000000, 99999999)
  1604. obj.drug_specs = medicalList[i].drug_specs
  1605. obj.id = medicalList[i].id
  1606. this.all_drug.push(obj)
  1607. }
  1608. }
  1609. for (let i = 0; i < base_drug_list.length; i++) {
  1610. if(base_drug_list[i].drug_specs != null) {
  1611. for (let a = 0; a < base_drug_list[i].drug_specs.length; a++) {
  1612. base_drug_list[i].drug_specs[a]['type'] = 1
  1613. }
  1614. }
  1615. let obj = {
  1616. drug_name: "",
  1617. drug_desc: "",
  1618. delivery_way: "",
  1619. execution_frequency: "",
  1620. single_dose: "",
  1621. single_dose_unit: "",
  1622. prescribing_number: "",
  1623. prescribing_number_unit: "",
  1624. type_id: "",
  1625. type: "",
  1626. custom_id: "",
  1627. drug_specs: [],
  1628. }
  1629. obj.drug_name = base_drug_list[i].drug_name
  1630. obj.delivery_way = base_drug_list[i].delivery_way
  1631. obj.execution_frequency = base_drug_list[i].execution_frequency
  1632. obj.single_dose = base_drug_list[i].single_dose
  1633. obj.prescribing_number = base_drug_list[i].prescribing_number
  1634. obj.type_id = base_drug_list[i].id
  1635. obj.type = 1
  1636. obj.custom_id = this.rand(10000000, 99999999)
  1637. obj.drug_specs = base_drug_list[i].drug_specs
  1638. obj.id = base_drug_list[i].id
  1639. this.all_drug.push(obj)
  1640. }
  1641. this.private_drug_config = response.data.data.private_drug_config
  1642. this.medicals = medicalList
  1643. }
  1644. })
  1645. },
  1646. changeDrugName(name){
  1647. this.current_drug_name = name
  1648. this.nameForm.advice_desc = ''
  1649. this.drugSpec = []
  1650. for (let i = 0; i < this.all_drug.length; i++) {
  1651. if (this.all_drug[i].drug_name == name) {
  1652. this.drugSpec = this.all_drug[i].drug_specs
  1653. }
  1654. }
  1655. },
  1656. changeDrugDesc(name) {
  1657. this.current_drug_spec = name
  1658. for (let i = 0; i < this.drugSpec.length; i++) {
  1659. if (this.drugSpec[i].drug_spec == name) {
  1660. this.nameForm.advice_desc = this.drugSpec[i].drug_spec
  1661. this.nameForm.prescribing_number = this.drugSpec[i].prescribing_number.toString()
  1662. this.nameForm.single_dose = this.drugSpec[i].single_dose.toString()
  1663. this.nameForm.delivery_way = this.drugSpec[i].delivery_way.toString()
  1664. this.nameForm.execution_frequency = this.drugSpec[i].execution_frequency.toString()
  1665. this.drug_id = this.drugSpec[i].id
  1666. this.src_type = this.drugSpec[i].type
  1667. this.nameForm.drug_id = this.drugSpec[i].id
  1668. this.nameForm.way = this.drugSpec[i].type
  1669. this.nameForm.single_dose_unit = this.drugSpec[i].min_unit
  1670. this.nameForm.drug_spec_unit = this.drugSpec[i].min_unit
  1671. this.nameForm.prescribing_number_unit = this.drugSpec[i].min_unit
  1672. if(this.drugSpec[i].drug_name_id){
  1673. this.nameForm.drug_name_id = this.drugSpec[i].drug_name_id
  1674. }else{
  1675. this.nameForm.drug_name_id = 0
  1676. }
  1677. }
  1678. }
  1679. },
  1680. querySearch(queryString, cb) {
  1681. console.log("aaaaa")
  1682. var restaurants = this.all_drug;
  1683. restaurants.map(item => {
  1684. item.value = item.drug_name
  1685. })
  1686. var results = queryString ? restaurants.filter(this.createFilter(queryString)) : restaurants;
  1687. // 调用 callback 返回建议列表的数据
  1688. cb(results);
  1689. },
  1690. createFilter(queryString) {
  1691. return (restaurant) => {
  1692. return (restaurant.drug_name.toLowerCase().indexOf(queryString.toLowerCase()) === 0);
  1693. };
  1694. },
  1695. querySearch1(queryString, cb) {
  1696. var restaurants = this.drugSpec;
  1697. console.log(restaurants)
  1698. restaurants.map(item => {
  1699. item.value = item.drug_spec
  1700. })
  1701. var results = queryString ? restaurants.filter(this.createFilter(queryString)) : restaurants;
  1702. // 调用 callback 返回建议列表的数据
  1703. cb(results);
  1704. },
  1705. handleSelect(val){
  1706. console.log("22222",val)
  1707. this.drug_id = val.id
  1708. this.nameForm.way = 1
  1709. var tmp = val.drug_specs[0]
  1710. console.log("tmp",tmp)
  1711. console.log("unitsOption",this.unitsOption)
  1712. this.nameForm.advice_desc = tmp.dose+tmp.dose_unit+"*"+tmp.min_number+tmp.min_unit+"/"//药品规格
  1713. this.nameForm.drug_spec_unit = tmp.max_unit
  1714. this.nameForm.prescribing_number = tmp.prescribing_number//开药数量
  1715. this.nameForm.prescribing_number_unit = tmp.prescribing_number_unit
  1716. this.nameForm.single_dose = tmp.single_dose//单次用量
  1717. this.nameForm.single_dose_unit = tmp.drug_dose_unit
  1718. this.nameForm.delivery_way = tmp.delivery_way//给药途径
  1719. this.nameForm.execution_frequency = tmp.execution_frequency//执行频率
  1720. this.nameForm.drug_id = tmp.id
  1721. },
  1722. handleSelect1(){
  1723. },
  1724. getDataConfig(module, filed_name) {
  1725. return getDataConfig(module, filed_name)
  1726. },
  1727. getUnit(id){
  1728. var name = ""
  1729. for(let i=0;i<this.units.length;i++){
  1730. if(id == this.units[i].id){
  1731. name = this.units[i].name
  1732. }
  1733. }
  1734. return name
  1735. }
  1736. },
  1737. watch: {
  1738. "selectedTemp.list": function() {
  1739. this.calcselectedTemp();
  1740. }
  1741. },
  1742. created(){
  1743. this.units = this.getDataConfig('hemodialysis','units')
  1744. console.log("单位32322323232我的",this.units)
  1745. //获取自备药
  1746. this.getSelfMedicalList()
  1747. }
  1748. };
  1749. </script>
  1750. <style>
  1751. #user-edit-advice-name-table .el-table__row {
  1752. display: table-row !important;
  1753. }
  1754. #user-edit-advice-name-table .el-table__expand-icon {
  1755. -webkit-transform: rotate(90deg) !important;
  1756. transform: rotate(90deg) !important;
  1757. }
  1758. #dialysis-add-select-template-table .el-table__row {
  1759. display: table-row !important;
  1760. }
  1761. #dialysis-add-select-template-table .el-table__expand-icon {
  1762. -webkit-transform: rotate(90deg) !important;
  1763. transform: rotate(90deg) !important;
  1764. }
  1765. </style>