血透系统pad前端

AdviceTable.vue 56KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702
  1. <template>
  2. <div class="fixedTop">
  3. <div class="choice">
  4. <ul>
  5. <li>
  6. 日期查询:
  7. <div class @click="selectStartSearchTime">
  8. {{startSearchTimeShow}}
  9. <span class="iconfont">&#xe74a;</span>
  10. </div>
  11. <span class="line"></span>
  12. <div class @click="selectEndSearchTime">
  13. {{endSearchTimeShow}}
  14. <span class="iconfont">&#xe74a;</span>
  15. </div>
  16. </li>
  17. <el-popover placement="bottom" trigger="click">
  18. <li slot="reference">
  19. {{adviceNameShow}}
  20. <span class="iconfont">&#xe74a;</span>
  21. </li>
  22. <div class="popover-demo-content">
  23. <ul>
  24. <li
  25. v-for="onet in adviceTypes"
  26. :class="onet.id == queryParams.advice_type?'tick':''"
  27. :key="onet.id"
  28. @click="selectType(onet.id,onet.show)"
  29. >{{onet.name}}</li>
  30. </ul>
  31. </div>
  32. </el-popover>
  33. <el-popover placement="bottom" trigger="click">
  34. <li slot="reference">
  35. {{stopNameShow}}
  36. <span class="iconfont">&#xe74a;</span>
  37. </li>
  38. <div class="popover-demo-content">
  39. <ul>
  40. <li
  41. v-for="onet in stopTypes"
  42. :class="onet.id == queryParams.stop_state?'tick':''"
  43. :key="onet.id"
  44. @click="selectStopType(onet.id, onet.show)"
  45. >{{onet.name}}</li>
  46. </ul>
  47. </div>
  48. </el-popover>
  49. </ul>
  50. </div>
  51. <div class="tableSearch">
  52. <ul>
  53. <li>
  54. <span class="iconfont">&#xe741;</span>
  55. <input
  56. type="search"
  57. class="search"
  58. v-model="queryParams.keywords"
  59. @change="searchKey()"
  60. placeholder="搜索"
  61. />
  62. </li>
  63. </ul>
  64. </div>
  65. <!-- <div style="width:100%;overflow:hildden;overflow-x:auto;" class="AdviceTable">
  66. <table class="table" style>
  67. <tr>
  68. <th width="177px">期效</th>
  69. <th width="334px">开始时间</th>
  70. <th width="415px">医嘱内容</th>
  71. <th width="220px">规格</th>
  72. <th width="164px">开药数量</th>
  73. <th width="164px">单次用量</th>
  74. <th width="286px">给药途径</th>
  75. <th width="177px">执行频率</th>
  76. <th width="177px">执行时间</th>
  77. <th width="177px">执行护士</th>
  78. <th width="177px">开嘱医生</th>
  79. <th width="177px">开嘱时间</th>
  80. <th width="177px">校对护士</th>
  81. <th width="177px">校对时间</th>
  82. <th width="177px">停止时间</th>
  83. <th width="177px">停止原因</th>
  84. <th width="177px">停嘱医生</th>
  85. <th width="700px">操作</th>
  86. </tr>
  87. <template v-for="(group, group_index) in advice_groups">
  88. <tr v-for="(advice, advice_index) in group.advices" :key="advice.id">
  89. <td v-if="advice_index == 0" :rowspan="group.advices.length">
  90. <span v-if="advice.advice_type == 1">长嘱</span>
  91. <span v-if="advice.advice_type == 2">临嘱</span>
  92. <span v-if="advice.advice_type == 3">临嘱</span>
  93. </td>
  94. <td
  95. v-if="advice_index == 0"
  96. :rowspan="group.advices.length"
  97. >{{ parseTime(advice.start_time, "{m}-{d}{h}:{i}") }}</td>
  98. <td
  99. :class="{ 'advice_name': advice.parent_id == 0, 'subdrug_name': advice.parent_id > 0 }"
  100. >
  101. {{
  102. advice.advice_name }}
  103. </td>
  104. <td>{{ advice.advice_desc }}{{advice.drug_spec_unit}}</td>
  105. <td>
  106. <span
  107. v-if="advice.prescribing_number"
  108. >{{ advice.prescribing_number }}{{ advice.prescribing_number_unit }}</span>
  109. </td>
  110. <td>
  111. <span v-if="advice.single_dose">{{ advice.single_dose }} {{ advice.single_dose_unit }}</span>
  112. </td>
  113. <td>{{ advice.parent_id == 0 ? advice.delivery_way : '' }}</td>
  114. <td>{{ advice.parent_id == 0 ? advice.execution_frequency : '' }}</td>
  115. <td
  116. v-if="advice_index == 0"
  117. :rowspan="group.advices.length"
  118. >{{ parseTime(advice.execution_time, "{m}-{d}{h}:{i}") }}</td>
  119. <td v-if="advice_index == 0" :rowspan="group.advices.length">
  120. <span
  121. v-if="advice.stop_state == 1 && advice.parent_id == 0"
  122. >{{ tranDoctor(advice.execution_staff) }}</span>
  123. </td>
  124. <td v-if="advice_index == 0" :rowspan="group.advices.length">
  125. <span
  126. v-if="advice.stop_state == 1 && advice.parent_id == 0"
  127. >{{ tranDoctor(advice.advice_doctor) }}</span>
  128. </td>
  129. <td
  130. v-if="advice_index == 0"
  131. :rowspan="group.advices.length"
  132. >{{ parseTime(advice.created_time, "{m}-{d}{h}:{i}") }}</td>
  133. <td v-if="advice_index == 0" :rowspan="group.advices.length">
  134. <span
  135. v-if="advice.stop_state == 1 && advice.parent_id == 0"
  136. >{{ tranDoctor(advice.checker) }}</span>
  137. </td>
  138. <td
  139. v-if="advice_index == 0"
  140. :rowspan="group.advices.length"
  141. >{{ parseTime(advice.check_time, "{m}-{d}{h}:{i}") }}</td>
  142. <td v-if="advice_index == 0" :rowspan="group.advices.length">
  143. {{ advice.stop_state == 1 && advice.parent_id
  144. == 0 ? parseTime(advice.stop_time, '{y}-{m}-{d} {h}:{i}') : '' }}
  145. </td>
  146. <td v-if="advice_index == 0" :rowspan="group.advices.length">
  147. <span v-if="advice.stop_state == 1 && advice.parent_id == 0">{{ advice.stop_reason }}</span>
  148. </td>
  149. <td v-if="advice_index == 0" :rowspan="group.advices.length">
  150. <span
  151. v-if="advice.stop_state == 1 && advice.parent_id == 0"
  152. >{{ tranDoctor(advice.stop_doctor) }}</span>
  153. </td>
  154. <td class="advice_name">
  155. <span class="xg" @click="modifyAdviceAction(group_index, advice_index)">
  156. <span class="iconfont">&#xe6f7;</span>修改医嘱
  157. </span>
  158. <span
  159. class="xg"
  160. v-if="advice.parent_id == 0 && advice.stop_state != 1"
  161. @click="stopAdviceAction(group_index, advice_index)"
  162. >
  163. <span class="iconfont">&#xe64c;</span>停止医嘱
  164. </span>
  165. <span class="sc" @click="deleteAdviceAction(group_index, advice_index)">
  166. <span class="iconfont">&#xe6f8;</span>删除医嘱
  167. </span>
  168. <span
  169. class="xg"
  170. v-if="advice.parent_id == 0 && advice.stop_state != 1"
  171. @click="addSubdrugAction(group_index, advice_index)"
  172. >
  173. <span class="iconfont">&#xe604;</span>添加子药
  174. </span>
  175. </td>
  176. </tr>
  177. </template>
  178. </table>
  179. <div class="NoData" v-show="advice_groups.length == 0">
  180. <img style="margin-top: 50px; margin-bottom: 50px" src="@/assets/login/data.jpg" alt />
  181. </div>
  182. </div> -->
  183. <el-table :data="tableData" border style="width: 100%">
  184. <el-table-column fixed prop="date" label="期效" width="100" align="center">
  185. <template slot-scope="scope">
  186. <span v-if="scope.row.advice_type == 1">长嘱</span>
  187. <span v-if="scope.row.advice_type == 2">临嘱</span>
  188. <span v-if="scope.row.advice_type == 3">临嘱</span>
  189. </template>
  190. </el-table-column>
  191. <el-table-column prop="name" label="开始时间" width="100" align="center">
  192. <template slot-scope="scope">
  193. {{ parseTime(scope.row.start_time, "{m}-{d} {h}:{i}") }}
  194. </template>
  195. </el-table-column>
  196. <el-table-column prop="province" label="医嘱内容" width="120" align="center">
  197. <template slot-scope="scope">
  198. {{ scope.row.advice_name }}
  199. </template>
  200. </el-table-column>
  201. <el-table-column prop="city" label="规格" width="120" align="center">
  202. <template slot-scope="scope">
  203. {{ scope.row.advice_desc }}{{scope.row.drug_spec_unit}}
  204. </template>
  205. </el-table-column>
  206. <el-table-column prop="address" label="开药数量" width="100" align="center">
  207. <template slot-scope="scope">
  208. <span
  209. v-if="scope.row.prescribing_number"
  210. >{{ scope.row.prescribing_number }}{{ scope.row.prescribing_number_unit }}</span>
  211. </template>
  212. </el-table-column>
  213. <el-table-column prop="date" label="单次用量" width="100" align="center">
  214. <template slot-scope="scope">
  215. <span v-if="scope.row.single_dose">{{ scope.row.single_dose }} {{ scope.row.single_dose_unit }}</span>
  216. </template>
  217. </el-table-column>
  218. <el-table-column prop="name" label="给药途径" width="100" align="center">
  219. <template slot-scope="scope">
  220. {{ scope.row.parent_id == 0 ? scope.row.delivery_way : '' }}
  221. </template>
  222. </el-table-column>
  223. <el-table-column prop="province" label="执行频率" width="120" align="center">
  224. <template slot-scope="scope">
  225. {{ scope.row.parent_id == 0 ? scope.row.execution_frequency : '' }}
  226. </template>
  227. </el-table-column>
  228. <el-table-column prop="city" label="执行时间" width="120" align="center">
  229. <template slot-scope="scope">
  230. {{ parseTime(scope.row.execution_time, "{m}-{d}{h}:{i}") }}
  231. </template>
  232. </el-table-column>
  233. <el-table-column prop="address" label="执行护士" width="100" align="center">
  234. <template slot-scope="scope">
  235. <span
  236. v-if="scope.row.stop_state == 1 && scope.row.parent_id == 0"
  237. >{{ tranDoctor(scope.row.execution_staff) }}</span>
  238. </template>
  239. </el-table-column>
  240. <el-table-column prop="date" label="开嘱医生" width="100" align="center">
  241. <template slot-scope="scope">
  242. <span
  243. v-if="scope.row.stop_state == 1 && scope.row.parent_id == 0"
  244. >{{ tranDoctor(scope.row.advice_doctor) }}</span>
  245. </template>
  246. </el-table-column>
  247. <el-table-column prop="name" label="开嘱时间" width="100" align="center">
  248. <template slot-scope="scope">
  249. {{ parseTime(scope.row.created_time, "{m}-{d}{h}:{i}") }}
  250. </template>
  251. </el-table-column>
  252. <el-table-column prop="province" label="校对护士" width="120" align="center">
  253. <template slot-scope="scope">
  254. <span
  255. v-if="scope.row.stop_state == 1 && scope.row.parent_id == 0"
  256. >{{ tranDoctor(scope.row.checker) }}</span>
  257. </template>
  258. </el-table-column>
  259. <el-table-column prop="city" label="校对时间" width="120" align="center">
  260. <template slot-scope="scope">
  261. {{ parseTime(scope.row.check_time, "{m}-{d}{h}:{i}") }}
  262. </template>
  263. </el-table-column>
  264. <el-table-column prop="date" label="停止时间" width="100" align="center">
  265. <template slot-scope="scope">
  266. {{ scope.row.stop_state == 1 && scope.row.parent_id
  267. == 0 ? parseTime(scope.row.stop_time, '{y}-{m}-{d} {h}:{i}') : '' }}
  268. </template>
  269. </el-table-column>
  270. <el-table-column prop="name" label="停止原因" width="100" align="center">
  271. <template slot-scope="scope">
  272. <span v-if="scope.row.stop_state == 1 && scope.row.parent_id == 0">{{ scope.row.stop_reason }}</span>
  273. </template>
  274. </el-table-column>
  275. <el-table-column prop="province" label="停嘱医生" width="120" align="center">
  276. <template slot-scope="scope">
  277. <span
  278. v-if="scope.row.stop_state == 1 && scope.row.parent_id == 0"
  279. >{{ tranDoctor(scope.row.stop_doctor) }}</span>
  280. </template>
  281. </el-table-column>
  282. <el-table-column label="操作" width="500">
  283. <template slot-scope="scope">
  284. <span class="xg" @click="modifyAdviceAction( scope.$index,0)">
  285. <span class="iconfont">&#xe6f7;</span>修改医嘱
  286. </span>
  287. <span class="xg" @click="stopAdviceAction(scope.$index, 0)">
  288. <span class="iconfont">&#xe64c;</span>停止医嘱
  289. </span>
  290. <span class="sc" @click="deleteAdviceAction(scope.$index, 0)">
  291. <span class="iconfont">&#xe6f8;</span>删除医嘱
  292. </span>
  293. <span class="xg" @click="addSubdrugAction(scope.$index, 0)">
  294. <span class="iconfont">&#xe604;</span>添加子药
  295. </span>
  296. </template>
  297. </el-table-column>
  298. </el-table>
  299. <mt-datetime-picker
  300. ref="start_date_picker"
  301. type="date"
  302. @confirm="handleStartDateConfirm"
  303. v-model="start_time"
  304. ></mt-datetime-picker>
  305. <mt-datetime-picker
  306. ref="end_date_picker"
  307. type="date"
  308. @confirm="handleEndDateConfirm"
  309. v-model="end_time"
  310. ></mt-datetime-picker>
  311. <van-popup title="医嘱" v-model="showPopup" :overlay="true" :close-on-click-overlay="false">
  312. <advice-form
  313. ref="subdrug_form"
  314. @back="showPopup = false"
  315. @did-create-subdrug="didAddSubdrug"
  316. :single_dose_unit_options="unitsOption"
  317. :prescribing_number_unit_options="unitsOption"
  318. ></advice-form>
  319. <modify-advice-form
  320. ref="modify_advice_form"
  321. @back="showPopup = false"
  322. @did-modify="didModifyAdvice"
  323. :delivery_way_options="deliveryWayOptions"
  324. :execution_frequency_options="executionFrequencyOptions"
  325. :single_dose_unit_options="unitsOption"
  326. :prescribing_number_unit_options="unitsOption"
  327. ></modify-advice-form>
  328. <!-- <div class="Dialog" v-show="showForm">
  329. <div class="DialogTit">
  330. <div class="back" @click="popupDidHide()">
  331. <span class="iconfont">&#xe720;</span>返回
  332. </div>
  333. <h1 class="name">{{formTitle}}</h1>
  334. <span class="success" v-if="adviceForm.id>0" @click="submitEditAdvice">完成</span>
  335. <span class="success" v-else @click="submitNewAdvice">完成</span>
  336. </div>
  337. <div class="DialogContent choose advice-top" id="advice-top">
  338. <div class="content clearfix">
  339. <div>
  340. <div class="cell">
  341. <label>医嘱类型</label>
  342. <el-input ref="advice_type" :value="adviceForm.advice_type==1?'长期':'临时'" disabled></el-input>
  343. </div>
  344. <div class="cell">
  345. <label>医嘱时间</label>
  346. <el-input v-model="adviceForm.advice_date" readonly></el-input>
  347. </div>
  348. <div class="cell">
  349. <label>开始时间</label>
  350. <el-input v-model="adviceForm.start_time" readonly @focus="chooseTime"></el-input>
  351. </div>
  352. <div class="cell">
  353. <label>医嘱名称</label>
  354. <el-input
  355. v-model="adviceForm.advice_name"
  356. readonly
  357. @focus="showSubMenu('advice_name')"
  358. ></el-input>
  359. </div>
  360. <div class="cell">
  361. <label>给药途径</label>
  362. <el-input
  363. v-model="adviceForm.delivery_way"
  364. readonly
  365. @focus="showSubMenu('delivery_way')"
  366. :disabled="adviceForm.parent_id==0?false:true"
  367. ></el-input>
  368. </div>
  369. <div class="cell">
  370. <label>执行频率</label>
  371. <el-input
  372. v-model="adviceForm.execution_frequency"
  373. readonly
  374. @focus="showSubMenu('execution_frequency')"
  375. :disabled="adviceForm.parent_id==0?false:true"
  376. ></el-input>
  377. </div>
  378. <div class="cell">
  379. <label>医嘱描述</label>
  380. <el-input v-model="adviceForm.advice_desc"></el-input>
  381. </div>
  382. <div class="cell">
  383. <label>单次用量</label>
  384. <input
  385. type="number"
  386. class="inputBox"
  387. style="width:60%"
  388. v-model="adviceForm.single_dose"
  389. >
  390. <input
  391. type="text"
  392. readonly
  393. class="inputBox"
  394. style="width:35%"
  395. v-model="adviceForm.single_dose_unit"
  396. @focus="showSubMenu('single_dose_unit')"
  397. >
  398. </div>
  399. <div class="cell">
  400. <label>开药数量</label>
  401. <input
  402. type="number"
  403. class="inputBox"
  404. style="width:60%"
  405. v-model="adviceForm.prescribing_number"
  406. >
  407. <input
  408. type="text"
  409. readonly
  410. class="inputBox"
  411. style="width:35%"
  412. v-model="adviceForm.prescribing_number_unit"
  413. @focus="showSubMenu('prescribing_number_unit')"
  414. >
  415. </div>
  416. <div class="cell width">
  417. <label>开嘱医生:</label>
  418. <span>{{doctor}}</span>
  419. </div>
  420. </div>
  421. </div>
  422. </div>
  423. </div>
  424. <mt-datetime-picker ref="picker" type="datetime" @confirm="handleConfirm" v-model="nowTime"></mt-datetime-picker>
  425. <check-box-sub-menu
  426. :visibility="visibility"
  427. v-on:menu-cancle="menuCancle"
  428. v-on:menu-comfirm="menuComfirm"
  429. :propsForm="propForm"
  430. ></check-box-sub-menu>-->
  431. </van-popup>
  432. <van-popup title="停止医嘱" v-model="stopPopup" :overlay="true" :close-on-click-overlay="false">
  433. <div class="Dialog" v-show="showForm">
  434. <div class="DialogTit">
  435. <div class="back" @click="popupDidHide()">
  436. <span class="iconfont">&#xe720;</span>返回
  437. </div>
  438. <h1 class="name">停止医嘱</h1>
  439. <span class="success" @click="submitStopAdvice">完成</span>
  440. </div>
  441. <div class="DialogContent choose advice-top" id="advice-stop">
  442. <div class="content clearfix">
  443. <div>
  444. <div class="cell width">
  445. <label>停止时间</label>
  446. <el-input v-model="stopForm.stop_time" readonly @focus="chooseStopTime"></el-input>
  447. </div>
  448. <div class="cell width">
  449. <label>停止原因</label>
  450. <el-input v-model="stopForm.stop_reason" type="textarea"></el-input>
  451. </div>
  452. <div class="cell width">
  453. <label>当前医生:</label>
  454. <span>{{doctor}}</span>
  455. </div>
  456. </div>
  457. </div>
  458. </div>
  459. </div>
  460. <mt-datetime-picker
  461. ref="stoptime"
  462. type="datetime"
  463. @confirm="handleStopConfirm"
  464. v-model="nowTime"
  465. ></mt-datetime-picker>
  466. </van-popup>
  467. </div>
  468. </template>
  469. <script>
  470. import { Dialog, Toast } from 'vant'
  471. import { GetDoctorAdvices } from '@/api/patient'
  472. import { parseTime } from '@/utils'
  473. import { fetchAllAdminUsers } from '@/api/doctor'
  474. import CheckBoxSubMenu from '../dialog/subMenu/checkBoxSubMenu'
  475. import {
  476. CheckDoctorAdvice,
  477. CreateDoctorAdvice,
  478. DeleteDoctorAdviceNew,
  479. EditDoctorAdvice,
  480. ExecDoctorAdvice,
  481. getAdviceConfig,
  482. StopDoctorAdvice
  483. } from '@/api/advice'
  484. import { getDataConfig } from '@/utils/data'
  485. import AdviceForm from '@/pages/main/dialog/new_order/order_form'
  486. import ModifyAdviceForm from '@/pages/main/dialog/modify_order/modify_order_form'
  487. let allno = 1
  488. let adviceno = 1
  489. export default {
  490. name: 'AdviceTable',
  491. components: {
  492. CheckBoxSubMenu,
  493. AdviceForm,
  494. ModifyAdviceForm
  495. },
  496. data () {
  497. return {
  498. doctor_id: 0,
  499. formTitle: '修改医嘱',
  500. startSearchTimeShow: '选择日期',
  501. endSearchTimeShow: '选择日期',
  502. start_time: new Date(),
  503. end_time: new Date(),
  504. nowTime: new Date(),
  505. adviceNameShow: '医嘱类型',
  506. stopNameShow: '显示范围',
  507. adviceTypes: [
  508. { id: 0, name: '全部', show: '医嘱类型' },
  509. { id: 1, name: '长期', show: '长期' },
  510. { id: 3, name: '临时', show: '临时' }
  511. ],
  512. stopTypes: [
  513. { id: 0, name: '全部', show: '未停止' },
  514. { id: 2, name: '未停止', show: '未停止' },
  515. { id: 1, name: '已停止', show: '已停止' }
  516. ],
  517. tableDate: [],
  518. advice_groups: [],
  519. queryParams: {
  520. id: 0,
  521. advice_type: 0,
  522. stop_state: 0,
  523. start_time: '',
  524. end_time: '',
  525. keywords: '',
  526. need_doctor: 1
  527. },
  528. adminUserOptions: {},
  529. showPopup: false,
  530. showForm: true,
  531. adviceForm: {
  532. id: 0,
  533. advice_type: 3,
  534. advice_date: '',
  535. start_time: '',
  536. advice_name: '',
  537. advice_desc: '',
  538. single_dose: '',
  539. single_dose_unit: '',
  540. prescribing_number: '',
  541. prescribing_number_unit: '',
  542. delivery_way: '',
  543. execution_frequency: '',
  544. advice_doctor: '',
  545. remark: '',
  546. parent_id: 0
  547. },
  548. currentIndex: -1,
  549. doctor: '',
  550. visibility: false,
  551. propForm: {
  552. title: '',
  553. list: [],
  554. optionList: [],
  555. isMultiple: 2,
  556. result: [], // 选中的值
  557. type: 1, // 用来区分不同子菜单,方便对返回值进行赋值
  558. selectId: 0
  559. },
  560. deliveryWayOptions: [],
  561. deliveryWayOjb: {},
  562. executionFrequencyOptions: [],
  563. executionFrequencyObj: {},
  564. adviceTemplates: [],
  565. adviceTemplateMaps: {},
  566. unitsOption: [],
  567. unitsObj: [],
  568. stopPopup: false,
  569. stopForm: {
  570. id: 0,
  571. stop_time: '',
  572. stop_reason: '',
  573. group_index: -1,
  574. advice_index: -1
  575. },
  576. record_date: '',
  577. patient_id: 0,
  578. new_subdrug_context: {
  579. group_index: -1,
  580. advice_index: -1
  581. },
  582. modify_advice_context: {
  583. group_index: -1,
  584. advice_index: -1
  585. },
  586. tableData: []
  587. }
  588. },
  589. methods: {
  590. // openNewChild(index, item) {
  591. // if (item.stop_state == 1 || item.execution_state == 1) {
  592. // Toast("医嘱已停止或执行,不能添加子医嘱");
  593. // return false;
  594. // }
  595. // this.adviceForm = {
  596. // id: 0,
  597. // advice_type: 2,
  598. // advice_date: parseTime(item.advice_date, "{y}-{m}-{d}"),
  599. // start_time: parseTime(item.start_time, "{y}-{m}-{d} {h}:{i}:00"),
  600. // advice_name: "",
  601. // advice_desc: "",
  602. // single_dose: "",
  603. // single_dose_unit: "",
  604. // prescribing_number: "",
  605. // prescribing_number_unit: "",
  606. // delivery_way: item.delivery_way,
  607. // execution_frequency: item.execution_frequency,
  608. // advice_doctor: "",
  609. // remark: "",
  610. // parent_id: item.id
  611. // };
  612. // this.formTitle = "添加子药";
  613. // this.showPopup = true;
  614. // },
  615. deleteAdviceAction: function (group_index, advice_index) {
  616. Dialog.confirm({
  617. title: '医嘱删除',
  618. message: '确认删除这条医嘱吗?'
  619. }).then(() => {
  620. Toast.loading({ forbidClick: true, duration: 0 })
  621. var group_no = 0
  622. var advice_id = this.advice_groups[group_index].advices[advice_index]
  623. .id
  624. DeleteDoctorAdviceNew(group_no, advice_id)
  625. .then(rs => {
  626. if (rs.data.state == 1) {
  627. var group = this.advice_groups[group_index]
  628. var advice = group.advices[advice_index]
  629. if (advice.parent_id > 0) {
  630. group.advices.splice(advice_index, 1)
  631. } else {
  632. var child_count = 0
  633. for (
  634. let index = advice_index + 1;
  635. index < group.advices.length;
  636. index++
  637. ) {
  638. const adv = group.advices[index]
  639. if (adv.parent_id == advice.id) {
  640. child_count++
  641. }
  642. }
  643. group.advices.splice(group_index, child_count + 1)
  644. }
  645. if (group.advices.length == 0) {
  646. this.advice_groups.splice(group_index, 1)
  647. }
  648. Toast.success('删除成功')
  649. } else {
  650. Toast.fail(rs.data.msg)
  651. }
  652. })
  653. .catch(err => {
  654. Toast.fail(err)
  655. })
  656. })
  657. },
  658. deleteResetData (index, row) {
  659. if (row.parent_id > 0) {
  660. this.tableDate.splice(index, 1)
  661. } else {
  662. var spliceIndex = -1
  663. var splitNums = 0
  664. for (var kndex in this.tableDate) {
  665. if (this.tableDate[kndex].id == row.id) {
  666. spliceIndex = kndex
  667. splitNums++
  668. } else if (this.tableDate[kndex].parent_id == row.id) {
  669. splitNums++
  670. }
  671. }
  672. this.tableDate.splice(spliceIndex, splitNums)
  673. }
  674. },
  675. // openStop(index, item) {
  676. // if (item.stop_state == 1) {
  677. // Toast("医嘱已停止");
  678. // return false;
  679. // }
  680. // this.stopForm.id = item.parent_id > 0 ? item.parent_id : item.id;
  681. // this.stopForm.stop_time = "";
  682. // this.stopForm.stop_reason = "";
  683. // this.currentIndex = index;
  684. // this.stopPopup = true;
  685. // },
  686. stopAdviceAction: function (group_index, advice_index) {
  687. var group = this.advice_groups[group_index]
  688. var advice = group.advices[advice_index]
  689. if (advice.stop_state == 1) {
  690. Toast('医嘱已停止')
  691. return
  692. }
  693. this.stopForm.id = advice.parent_id > 0 ? advice.parent_id : advice.id
  694. this.stopForm.stop_time = ''
  695. this.stopForm.stop_reason = ''
  696. this.stopForm.group_index = group_index
  697. this.stopForm.advice_index = advice_index
  698. this.stopPopup = true
  699. },
  700. submitStopAdvice () {
  701. if (this.stopForm.stop_time.length == 0) {
  702. Toast('请选择停止时间')
  703. return false
  704. }
  705. if (this.stopForm.stop_reason.length == 0) {
  706. Toast('请填写停止原因')
  707. return false
  708. }
  709. Toast.loading({ forbidClick: true, duration: 0 })
  710. StopDoctorAdvice(this.stopForm.id, {
  711. id: this.stopForm.id,
  712. stop_time: this.stopForm.stop_time,
  713. stop_reason: this.stopForm.stop_reason
  714. }).then(response => {
  715. if (response.data.state == 0) {
  716. Toast.fail(response.data.msg)
  717. return false
  718. } else {
  719. Toast.success('医嘱停止成功')
  720. var group_index = this.stopForm.group_index
  721. var advice_index = this.stopForm.advice_index
  722. var group = this.advice_groups[group_index]
  723. var advice = group.advices[advice_index]
  724. for (
  725. let index = advice_index;
  726. index < group.advices.length;
  727. index++
  728. ) {
  729. const adv = group.advices[index]
  730. if (adv.id == advice.id || adv.parent_id == advice.id) {
  731. adv.stop_state = 1
  732. adv.stop_doctor = response.data.data.advice.stop_doctor
  733. adv.stop_reason = response.data.data.advice.stop_reason
  734. adv.stop_time = response.data.data.advice.stop_time
  735. }
  736. }
  737. this.popupDidHide()
  738. return false
  739. }
  740. })
  741. },
  742. parseTime: function (time, layout) {
  743. if (time == 0) {
  744. return ''
  745. }
  746. return parseTime(time, layout)
  747. },
  748. openEdit (index, item) {
  749. if (item.advice_type == 1) {
  750. Toast('长期医嘱不能修改')
  751. return false
  752. }
  753. if (item.stop_state == 1 || item.execution_state == 1) {
  754. Toast('医嘱已停止或执行,不能修改')
  755. return false
  756. }
  757. if (item.advice_doctor != this.doctor_id) {
  758. Toast('不能修改非本人添加的医嘱')
  759. return false
  760. }
  761. this.currentIndex = index
  762. for (var key in this.adviceForm) {
  763. this.adviceForm[key] = item[key]
  764. }
  765. this.adviceForm.advice_date = parseTime(
  766. this.adviceForm.advice_date,
  767. '{m}-{d}'
  768. )
  769. this.adviceForm.start_time = parseTime(
  770. this.adviceForm.start_time,
  771. '{m}-{d} {h}:{i}:00'
  772. )
  773. this.formTitle = '修改医嘱'
  774. this.showPopup = true
  775. },
  776. popupDidHide () {
  777. this.showPopup = false
  778. this.showForm = true
  779. this.visibility = false
  780. this.stopPopup = false
  781. },
  782. // modifyAdviceAction (id, index) {
  783. // console.log('id', id)
  784. // console.log('index', index)
  785. // },
  786. modifyAdviceAction: function (group_index, advice_index) {
  787. console.log('group_index', group_index)
  788. console.log('advice_index', advice_index)
  789. var group = this.advice_groups[group_index]
  790. var advice = group.advices[advice_index]
  791. if (advice.advice_type == 1) {
  792. Toast('长期医嘱不能修改')
  793. return
  794. }
  795. if (advice.stop_state == 1 || advice.execution_state == 1) {
  796. Toast('医嘱已停止或执行,不能修改')
  797. return
  798. }
  799. if (advice.advice_doctor != this.doctor_id) {
  800. Toast('不能修改非本人添加的医嘱')
  801. return
  802. }
  803. this.modify_advice_context.group_index = group_index
  804. this.modify_advice_context.advice_index = advice_index
  805. this.showPopup = true
  806. this.$nextTick(() => {
  807. this.$refs.modify_advice_form.showWithModify({
  808. id: advice.id,
  809. parent_id: advice.parent_id,
  810. title: advice.advice_name,
  811. advice_desc: advice.advice_desc,
  812. // drug_spec: advice.drug_spec,
  813. drug_spec_unit: advice.drug_spec_unit,
  814. delivery_way: advice.delivery_way,
  815. execution_frequency: advice.execution_frequency,
  816. single_dose: advice.single_dose,
  817. single_dose_unit: advice.single_dose_unit,
  818. prescribing_number: advice.prescribing_number,
  819. prescribing_number_unit: advice.prescribing_number_unit
  820. })
  821. })
  822. },
  823. didModifyAdvice: function (advice) {
  824. Toast.loading({ forbidClick: true, duration: 0 })
  825. EditDoctorAdvice(advice.id, {
  826. advice_name: advice.title,
  827. advice_desc: advice.advice_desc,
  828. // drug_spec: String(advice.drug_spec),
  829. drug_spec_unit: advice.drug_spec_unit,
  830. delivery_way: advice.delivery_way,
  831. execution_frequency: advice.execution_frequency,
  832. single_dose: String(advice.single_dose),
  833. single_dose_unit: advice.single_dose_unit,
  834. prescribing_number: String(advice.prescribing_number),
  835. prescribing_number_unit: advice.prescribing_number_unit
  836. }).then(response => {
  837. if (response.data.state == 0) {
  838. Toast.fail(response.data.msg)
  839. return false
  840. } else {
  841. Toast.success('修改成功')
  842. var resp_advice = response.data.data.advice
  843. var group_index = this.modify_advice_context.group_index
  844. var advice_index = this.modify_advice_context.advice_index
  845. var group = this.advice_groups[group_index]
  846. var advice = group.advices[advice_index]
  847. advice.advice_name = resp_advice.advice_name
  848. advice.advice_desc = resp_advice.advice_desc;
  849. // advice.drug_spec = resp_advice.drug_spec
  850. (advice.drug_spec_unit = resp_advice.drug_spec_unit),
  851. (advice.delivery_way = resp_advice.delivery_way),
  852. (advice.execution_frequency = resp_advice.execution_frequency),
  853. (advice.single_dose = resp_advice.single_dose),
  854. (advice.single_dose_unit = resp_advice.single_dose_unit),
  855. (advice.prescribing_number = resp_advice.prescribing_number),
  856. (advice.prescribing_number_unit =
  857. resp_advice.prescribing_number_unit)
  858. // for (let index = 0; index < group.advices.length; index++) {
  859. // const advice = group.advices[index];
  860. // if (advice.id == resp_advice.id) {
  861. // advice.advice_name = resp_advice.advice_name
  862. // advice.drug_spec = resp_advice.drug_spec
  863. // advice.drug_spec_unit = resp_advice.drug_spec_unit,
  864. // advice.delivery_way = resp_advice.delivery_way,
  865. // advice.execution_frequency = resp_advice.execution_frequency,
  866. // advice.single_dose = resp_advice.single_dose,
  867. // advice.single_dose_unit = resp_advice.single_dose_unit,
  868. // advice.prescribing_number = resp_advice.prescribing_number,
  869. // advice.prescribing_number_unit = resp_advice.prescribing_number_unit
  870. // break
  871. // }
  872. // }
  873. this.$refs.modify_advice_form.dismiss()
  874. this.modify_advice_context.group_index = -1
  875. this.modify_advice_context.advice_index = -1
  876. this.popupDidHide()
  877. return false
  878. }
  879. })
  880. },
  881. submitEditAdvice () {
  882. if (this.adviceForm.advice_name.length == 0) {
  883. Toast('请填写医嘱名称')
  884. return
  885. }
  886. if (this.adviceForm.start_time.length == 0) {
  887. Toast('请选择开始时间')
  888. return
  889. }
  890. Toast.loading({ forbidClick: true, duration: 0 })
  891. EditDoctorAdvice(this.adviceForm.id, this.adviceForm).then(response => {
  892. if (response.data.state == 0) {
  893. Toast.fail(response.data.msg)
  894. return false
  895. } else {
  896. Toast.success('修改成功')
  897. for (var key in response.data.data.advice) {
  898. this.tableDate[this.currentIndex][key] =
  899. response.data.data.advice[key]
  900. }
  901. if (this.adviceForm.parent_id > 0) {
  902. this.tableDate[this.currentIndex].start_time_show = ''
  903. } else {
  904. this.tableDate[this.currentIndex].start_time_show = parseTime(
  905. response.data.data.advice.start_time,
  906. '{m}-{d} {h}:{i}'
  907. )
  908. }
  909. this.currentIndex = -1
  910. this.popupDidHide()
  911. return false
  912. }
  913. })
  914. },
  915. addSubdrugAction: function (group_index, advice_index) {
  916. console.log('group_index', group_index)
  917. console.log('advice_index', advice_index)
  918. var group = this.advice_groups[group_index]
  919. var advice = group.advices[advice_index]
  920. this.showPopup = true
  921. this.new_subdrug_context.group_index = group_index
  922. this.new_subdrug_context.advice_index = advice_index
  923. this.$nextTick(() => {
  924. this.$refs.subdrug_form.showWithNewSubDrug(
  925. advice.id,
  926. parseTime(advice.record_date, '{y}-{m}-{d}'),
  927. parseTime(advice.start_time, '{y}-{m}-{d} {h}:{i}'),
  928. advice.delivery_way,
  929. advice.execution_frequency
  930. )
  931. })
  932. },
  933. didAddSubdrug: function (subdrug) {
  934. Toast.loading({ forbidClick: true, duration: 0 })
  935. CreateDoctorAdvice(this.patient_id, {
  936. parent_id: subdrug.parent_id,
  937. advice_type: 3,
  938. advice_date: subdrug.record_time,
  939. start_time: subdrug.start_time,
  940. advice_name: subdrug.title,
  941. advice_desc: subdrug.advice_desc,
  942. // drug_spec: String(subdrug.drug_spec),
  943. drug_spec_unit: subdrug.drug_spec_unit,
  944. single_dose: String(subdrug.single_dose),
  945. single_dose_unit: subdrug.single_dose_unit,
  946. prescribing_number: String(subdrug.prescribing_number),
  947. prescribing_number_unit: subdrug.prescribing_number_unit
  948. })
  949. .then(rs => {
  950. if (rs.data.state == 0) {
  951. Toast.fail(rs.data.msg)
  952. } else {
  953. Toast.success('添加成功')
  954. var resp_advice = rs.data.data.advice
  955. var group_index = this.new_subdrug_context.group_index
  956. var advice_index = this.new_subdrug_context.advice_index
  957. var group = this.advice_groups[group_index]
  958. var insert_index = -1
  959. var last_child_index = -1
  960. for (
  961. let index = advice_index + 1;
  962. index < group.advices.length;
  963. index++
  964. ) {
  965. const advice = group.advices[index]
  966. if (resp_advice.parent_id != advice.parent_id) {
  967. insert_index = index
  968. break
  969. } else {
  970. last_child_index = index
  971. }
  972. }
  973. if (insert_index < 0) {
  974. if (last_child_index < 0) {
  975. group.advices.splice(advice_index + 1, 0, resp_advice)
  976. } else {
  977. group.advices.splice(last_child_index + 1, 0, resp_advice)
  978. }
  979. } else {
  980. group.advices.splice(insert_index, 0, resp_advice)
  981. }
  982. this.$refs.subdrug_form.dismiss()
  983. this.new_subdrug_context.group_index = -1
  984. this.new_subdrug_context.advice_index = -1
  985. this.popupDidHide()
  986. }
  987. })
  988. .catch(err => {
  989. Toast.fail(err)
  990. })
  991. },
  992. // submitNewAdvice() {
  993. // if (this.adviceForm.advice_name.length == 0) {
  994. // Toast("请填写医嘱名称");
  995. // return;
  996. // }
  997. // if (this.adviceForm.start_time.length == 0) {
  998. // Toast("请选择开始时间");
  999. // return;
  1000. // }
  1001. // Toast.loading({ forbidClick: true, duration: 0 });
  1002. // CreateDoctorAdvice(this.patient_id, this.adviceForm).then(response => {
  1003. // if (response.data.state == 0) {
  1004. // Toast.fail(response.data.msg);
  1005. // return false;
  1006. // } else {
  1007. // Toast.success("添加成功");
  1008. // if (this.adviceForm.parent_id > 0) {
  1009. // var spliceIndex = -1;
  1010. // for (let index = this.tableDate.length - 1; ; index--) {
  1011. // if (
  1012. // this.tableDate[index].parent_id === this.adviceForm.parent_id
  1013. // ) {
  1014. // spliceIndex = index;
  1015. // break;
  1016. // } else if (
  1017. // this.tableDate[index].id === this.adviceForm.parent_id
  1018. // ) {
  1019. // spliceIndex = index;
  1020. // break;
  1021. // }
  1022. // }
  1023. // if (spliceIndex > -1) {
  1024. // spliceIndex += 1;
  1025. // if (spliceIndex === this.tableDate.length) {
  1026. // this.tableDate.push(response.data.data.advice);
  1027. // } else {
  1028. // var swapData = this.tableDate.splice(spliceIndex);
  1029. // this.tableDate.push(response.data.data.advice);
  1030. // for (var index in swapData) {
  1031. // this.tableDate.push(swapData[index]); // = this.doctor_advices.concat(swapData);
  1032. // }
  1033. // // this.tableDate = this.tableDate.concat(swapData);
  1034. // }
  1035. // }
  1036. // } else {
  1037. // this.tableDate.unshift(response.data.data.advice);
  1038. // }
  1039. // this.currentIndex = -1;
  1040. // this.popupDidHide();
  1041. // return false;
  1042. // }
  1043. // });
  1044. // },
  1045. chooseTime () {
  1046. this.$refs.picker.open()
  1047. },
  1048. chooseStopTime () {
  1049. this.$refs.stoptime.open()
  1050. },
  1051. selectAdviceName (key) {
  1052. if (key in this.adviceTemplateMaps) {
  1053. this.adviceForm.advice_name = this.adviceTemplateMaps[key].advice_name
  1054. this.adviceForm.advice_desc = this.adviceTemplateMaps[key].advice_desc
  1055. this.adviceForm.single_dose_unit = this.adviceTemplateMaps[
  1056. key
  1057. ].single_dose_unit
  1058. this.adviceForm.prescribing_number_unit = this.adviceTemplateMaps[
  1059. key
  1060. ].prescribing_number_unit
  1061. this.adviceForm.single_dose =
  1062. this.adviceTemplateMaps[key].single_dose + ''
  1063. this.adviceForm.prescribing_number =
  1064. this.adviceTemplateMaps[key].prescribing_number + ''
  1065. this.adviceForm.delivery_way = this.adviceTemplateMaps[
  1066. key
  1067. ].delivery_way
  1068. this.adviceForm.execution_frequency = this.adviceTemplateMaps[
  1069. key
  1070. ].execution_frequency
  1071. }
  1072. },
  1073. menuCancle: function () {
  1074. this.visibility = false
  1075. this.showForm = true
  1076. },
  1077. menuComfirm: function (val) {
  1078. this.visibility = false
  1079. this.showForm = true
  1080. switch (val.type) {
  1081. case 1:
  1082. if (val.selectId in this.adviceTemplateMaps) {
  1083. this.selectAdviceName(val.selectId)
  1084. this.adviceForm.template_id = val.selectId
  1085. }
  1086. break
  1087. case 2:
  1088. if (val.selectId in this.deliveryWayOjb) {
  1089. this.adviceForm.jjtj_id = val.selectId
  1090. this.adviceForm.delivery_way = this.deliveryWayOjb[
  1091. val.selectId
  1092. ].name
  1093. }
  1094. break
  1095. case 3:
  1096. if (val.selectId in this.executionFrequencyObj) {
  1097. this.adviceForm.zxpl_id = val.selectId
  1098. this.adviceForm.execution_frequency = this.executionFrequencyObj[
  1099. val.selectId
  1100. ].name
  1101. }
  1102. break
  1103. case 4:
  1104. if (val.selectId in this.unitsObj) {
  1105. this.adviceForm.sdu_id = val.selectId
  1106. this.adviceForm.single_dose_unit = this.unitsObj[val.selectId].name
  1107. }
  1108. break
  1109. case 5:
  1110. if (val.selectId in this.unitsObj) {
  1111. this.adviceForm.pnu_id = val.selectId
  1112. this.adviceForm.prescribing_number_unit = this.unitsObj[
  1113. val.selectId
  1114. ].name
  1115. }
  1116. break
  1117. }
  1118. },
  1119. getAdviceConfig () {
  1120. getAdviceConfig().then(response => {
  1121. if (response.data.state == 1) {
  1122. this.deliveryWayOptions =
  1123. response.data.data.drugways === null
  1124. ? []
  1125. : response.data.data.drugways
  1126. this.executionFrequencyOptions =
  1127. response.data.data.efs === null ? [] : response.data.data.efs
  1128. var dl = this.deliveryWayOptions.length
  1129. for (let index = 0; index < dl; index++) {
  1130. this.deliveryWayOjb[
  1131. this.deliveryWayOptions[index].id
  1132. ] = this.deliveryWayOptions[index]
  1133. }
  1134. var el = this.executionFrequencyOptions.length
  1135. for (let index = 0; index < el; index++) {
  1136. this.executionFrequencyObj[
  1137. this.executionFrequencyOptions[index].id
  1138. ] = this.executionFrequencyOptions[index]
  1139. }
  1140. this.adviceTemplates =
  1141. response.data.data.advice_templates === null
  1142. ? []
  1143. : response.data.data.advice_templates
  1144. // var templateLen = this.adviceTemplates.length;
  1145. // for (let index = 0; index < templateLen; index++) {
  1146. // var item = this.adviceTemplates[index];
  1147. // item["name"] = item.advice_name;
  1148. // this.$set(
  1149. // this.adviceTemplateMaps,
  1150. // this.adviceTemplates[index].id,
  1151. // item
  1152. // );
  1153. // }
  1154. }
  1155. })
  1156. },
  1157. handleConfirm (time) {
  1158. this.adviceForm.start_time = this.handleTime(time)
  1159. },
  1160. handleStopConfirm (time) {
  1161. this.stopForm.stop_time = this.handleTime(time)
  1162. },
  1163. handleTime (time) {
  1164. var year = time.getFullYear()
  1165. var month = time.getMonth() + 1
  1166. var day = time.getDate()
  1167. var hour = time.getHours()
  1168. var minute = time.getMinutes()
  1169. if (month < 10) {
  1170. month = '0' + month
  1171. }
  1172. if (day < 10) {
  1173. day = '0' + day
  1174. }
  1175. if (hour < 10) {
  1176. hour = '0' + hour
  1177. }
  1178. if (minute < 10) {
  1179. minute = '0' + minute
  1180. }
  1181. return year + '-' + month + '-' + day + ' ' + hour + ':' + minute + ':00'
  1182. },
  1183. setAdviceNo (index, item) {
  1184. var itemNo = ''
  1185. if (index == 0) {
  1186. adviceno = 1
  1187. adviceno++
  1188. return '1'
  1189. } else {
  1190. if (item.parent_id > 0) {
  1191. return ''
  1192. } else {
  1193. itemNo = '' + adviceno
  1194. adviceno++
  1195. return itemNo
  1196. }
  1197. }
  1198. },
  1199. showSubMenu: function (val) {
  1200. switch (val) {
  1201. case 'advice_name':
  1202. this.propForm.type = 1
  1203. this.showForm = false
  1204. this.propForm.title = '选择'
  1205. this.visibility = true
  1206. this.propForm.list = []
  1207. this.propForm.optionList = this.adviceTemplateMaps
  1208. this.propForm.isMultiple = 1
  1209. this.propForm.selectId = this.adviceForm.template_id
  1210. break
  1211. case 'delivery_way':
  1212. this.propForm.type = 2
  1213. this.showForm = false
  1214. this.propForm.title = '选择'
  1215. this.visibility = true
  1216. this.propForm.list = []
  1217. this.propForm.optionList = this.deliveryWayOptions
  1218. this.propForm.isMultiple = 1
  1219. this.propForm.selectId = this.adviceForm.jjtj_id
  1220. break
  1221. case 'execution_frequency':
  1222. this.propForm.type = 3
  1223. this.showForm = false
  1224. this.propForm.title = '选择'
  1225. this.visibility = true
  1226. this.propForm.list = []
  1227. this.propForm.optionList = this.executionFrequencyOptions
  1228. this.propForm.isMultiple = 1
  1229. this.propForm.selectId = this.adviceForm.zxpl_id
  1230. break
  1231. case 'single_dose_unit':
  1232. this.propForm.type = 4
  1233. this.showForm = false
  1234. this.propForm.title = '选择'
  1235. this.visibility = true
  1236. this.propForm.list = []
  1237. this.propForm.optionList = this.unitsOption
  1238. this.propForm.isMultiple = 1
  1239. this.propForm.selectId = this.adviceForm.sdu_id
  1240. break
  1241. case 'prescribing_number_unit':
  1242. this.propForm.type = 5
  1243. this.showForm = false
  1244. this.propForm.title = '选择'
  1245. this.visibility = true
  1246. this.propForm.list = []
  1247. this.propForm.optionList = this.unitsOption
  1248. this.propForm.isMultiple = 1
  1249. this.propForm.selectId = this.adviceForm.pnu_id
  1250. break
  1251. }
  1252. },
  1253. handleStartDateConfirm: function (val) {
  1254. this.queryParams.start_time = parseTime(
  1255. this.start_time / 1000,
  1256. '{y}-{m}-{d}'
  1257. )
  1258. this.startSearchTimeShow = this.queryParams.start_time
  1259. this.onLoad()
  1260. },
  1261. handleEndDateConfirm: function (val) {
  1262. this.queryParams.end_time = parseTime(
  1263. this.end_time / 1000,
  1264. '{y}-{m}-{d}'
  1265. )
  1266. this.endSearchTimeShow = this.queryParams.end_time
  1267. this.onLoad()
  1268. },
  1269. selectStartSearchTime: function () {
  1270. this.$refs.start_date_picker.open()
  1271. },
  1272. selectEndSearchTime: function () {
  1273. this.$refs.end_date_picker.open()
  1274. },
  1275. tranDoctor (id) {
  1276. if (id in this.adminUserOptions) {
  1277. return this.adminUserOptions[id].name
  1278. } else {
  1279. return '未知'
  1280. }
  1281. },
  1282. selectType (id, showName) {
  1283. this.queryParams.advice_type = id
  1284. this.adviceNameShow = showName
  1285. this.onLoad()
  1286. },
  1287. selectStopType (id, showName) {
  1288. this.queryParams.stop_state = id
  1289. this.stopNameShow = showName
  1290. this.onLoad()
  1291. },
  1292. searchKey () {
  1293. this.onLoad()
  1294. },
  1295. fetchAllAdminUsers () {
  1296. fetchAllAdminUsers().then(response => {
  1297. if (response.data.state == 1) {
  1298. var ul = response.data.data.users.length
  1299. for (let index = 0; index < ul; index++) {
  1300. this.adminUserOptions[response.data.data.users[index].id] =
  1301. response.data.data.users[index]
  1302. }
  1303. }
  1304. })
  1305. },
  1306. onLoad () {
  1307. this.tableDate = []
  1308. allno = 1
  1309. // 异步更新数据
  1310. GetDoctorAdvices(this.queryParams).then(response => {
  1311. if (response.data.state == 1) {
  1312. if (this.queryParams.need_doctor == 1) {
  1313. var ul = response.data.data.users.length
  1314. for (let index = 0; index < ul; index++) {
  1315. this.adminUserOptions[response.data.data.users[index].id] =
  1316. response.data.data.users[index]
  1317. }
  1318. this.queryParams.need_doctor = 0
  1319. }
  1320. var resp_advices = response.data.data.advices
  1321. if (resp_advices.length > 0) {
  1322. var newGroupObject = function () {
  1323. return Object.assign(
  1324. {},
  1325. {
  1326. group_no: 0,
  1327. advices: []
  1328. }
  1329. )
  1330. }
  1331. var initGroupBlock = function (group, advice) {
  1332. group.group_no = advice.groupno
  1333. }
  1334. var advice_groups = []
  1335. var group = newGroupObject()
  1336. for (let index = 0; index < resp_advices.length; index++) {
  1337. const advice = resp_advices[index]
  1338. if (advice.groupno == 0) {
  1339. // 老版本的医嘱
  1340. if (advice.parent_id > 0) {
  1341. if (advice_groups.length > 0) {
  1342. var parent_group = advice_groups[advice_groups.length - 1]
  1343. if (parent_group.advices.length > 0) {
  1344. if (parent_group.advices[0].id == advice.parent_id) {
  1345. parent_group.advices.push(advice)
  1346. }
  1347. }
  1348. }
  1349. continue
  1350. } else {
  1351. if (group.group_no > 0) {
  1352. advice_groups.push(group)
  1353. group = newGroupObject()
  1354. }
  1355. initGroupBlock(group, advice)
  1356. group.advices.push(advice)
  1357. advice_groups.push(group)
  1358. group = newGroupObject()
  1359. continue
  1360. }
  1361. } else {
  1362. if (group.group_no > 0 && group.group_no != advice.groupno) {
  1363. advice_groups.push(group)
  1364. group = newGroupObject()
  1365. }
  1366. if (group.group_no == 0) {
  1367. initGroupBlock(group, advice)
  1368. }
  1369. if (group.group_no == advice.groupno) {
  1370. group.advices.push(advice)
  1371. }
  1372. }
  1373. }
  1374. if (group.group_no > 0) {
  1375. // 上述的算法会导致最后一组没有加到advice_groups,这里要手动加上
  1376. advice_groups.push(group)
  1377. }
  1378. this.advice_groups = advice_groups
  1379. } else {
  1380. this.advice_groups = []
  1381. }
  1382. console.log('advice_groups是什么', advice_groups)
  1383. let arr = [...this.advice_groups]
  1384. let arr2 = []
  1385. arr.map(item => {
  1386. console.log('item是什么', item.advices)
  1387. arr2.push(...item.advices)
  1388. })
  1389. console.log('arr2是什么', arr2)
  1390. this.tableData = arr2
  1391. // this.tabelData = advice_groups
  1392. // var sl = response.data.data.advices.length;
  1393. // for (let index = 0; index < sl; index++) {
  1394. // var advice = response.data.data.advices[index];
  1395. // if (advice.parent_id == 0) {
  1396. // advice.no = allno;
  1397. // advice.start_time_show = parseTime(
  1398. // advice.start_time,
  1399. // "{y}-{m}-{d} {h}:{i}"
  1400. // );
  1401. // allno++;
  1402. // } else {
  1403. // advice.start_time_show = "";
  1404. // advice.no = "";
  1405. // }
  1406. // if (advice.stop_state == 1 && advice.parent_id == 0) {
  1407. // advice.stop_time_show = parseTime(
  1408. // advice.stop_time,
  1409. // "{y}-{m}-{d} {h}:{i}"
  1410. // );
  1411. // } else {
  1412. // advice.stop_time_show = "";
  1413. // }
  1414. // this.tableDate.push(advice);
  1415. // }
  1416. }
  1417. })
  1418. }
  1419. },
  1420. created () {
  1421. allno = 1
  1422. adviceno = 1
  1423. // this.fetchAllAdminUsers();
  1424. this.queryParams.id = this.$route.query.patient_id
  1425. this.doctor = this.$store.getters.user.user.user_name
  1426. this.doctor_id = this.$store.getters.user.user.id
  1427. this.patient_id = this.$route.query.patient_id
  1428. var date = new Date()
  1429. date.setMonth(date.getMonth() - 1)
  1430. // var year = date.getFullYear();
  1431. // var month = date.getMonth();
  1432. // var day = date.getDate();
  1433. // if (month < 10) {
  1434. // month = "0" + month;
  1435. // }
  1436. // if (day < 10) {
  1437. // day = "0" + day;
  1438. // }
  1439. // var nowDate = year + "-" + month + "-" + day;
  1440. this.start_time = date
  1441. this.startSearchTimeShow = parseTime(
  1442. this.start_time.getTime(),
  1443. '{y}-{m}-{d}'
  1444. )
  1445. this.endSearchTimeShow = parseTime(new Date().getTime(), '{y}-{m}-{d}')
  1446. this.queryParams.start_time = this.startSearchTimeShow
  1447. this.onLoad()
  1448. this.getAdviceConfig()
  1449. this.unitsOption = getDataConfig('hemodialysis', 'units')
  1450. for (var index in this.unitsOption) {
  1451. this.unitsObj[this.unitsOption[index].id] = this.unitsOption[index]
  1452. }
  1453. }
  1454. }
  1455. </script>
  1456. <style style="stylesheet/scss" lang="scss" scoped>
  1457. .fixedTop {
  1458. padding-top: 36px;
  1459. background: #fff;
  1460. min-height: calc(100vh - 200px);
  1461. // @media only screen and (min-width: 376px) and (max-width: 668px) {
  1462. // padding-top: 50px !important;
  1463. // }
  1464. @media only screen and (min-width: 813px) and (max-width: 1024px) {
  1465. padding-top: 54px !important;
  1466. }
  1467. @media only screen and (min-width: 737px) and (max-width: 768px) {
  1468. padding-top: 76px !important;
  1469. }
  1470. // @media only screen and (min-width: 415px) and (max-width: 736px) {
  1471. // padding-top: 48px !important;
  1472. // }
  1473. .choice {
  1474. border-bottom: 1px #e5e5e5 solid;
  1475. ul {
  1476. @include display-flex;
  1477. @include align-items-center;
  1478. @include text-align;
  1479. @include justify-content-between;
  1480. width: 96%;
  1481. margin: 0 auto;
  1482. font-size: 0.32rem;
  1483. color: $pgh-color;
  1484. li {
  1485. @include display-flex;
  1486. @include align-items-center;
  1487. @include text-align;
  1488. @include justify-content-between;
  1489. padding: 0.3rem 0;
  1490. .iconfont {
  1491. margin: 0 0.1rem;
  1492. @media only screen and (max-width: 812px) {
  1493. font-size: 12px !important;
  1494. }
  1495. }
  1496. .line {
  1497. background: #a8b3ba;
  1498. width: 0.2rem;
  1499. height: 1px;
  1500. margin: 0 0.2rem;
  1501. display: inline-block;
  1502. }
  1503. }
  1504. }
  1505. }
  1506. .tableSearch {
  1507. width: 100%;
  1508. margin: 0 auto;
  1509. padding: 0.24rem 0;
  1510. background: #f6f8f9;
  1511. ul {
  1512. width: 50%;
  1513. background: #fff;
  1514. margin: 0 auto;
  1515. border-radius: 30px;
  1516. li {
  1517. @include display-flex;
  1518. @include align-items-center;
  1519. @include text-align;
  1520. padding-left: 15px;
  1521. .iconfont {
  1522. font-size: 0.42rem;
  1523. }
  1524. input {
  1525. border: none;
  1526. border-radius: 30px;
  1527. padding: 0.15rem;
  1528. width: 100%;
  1529. color: $pgh-color;
  1530. }
  1531. }
  1532. }
  1533. }
  1534. .content {
  1535. .cell {
  1536. float: left;
  1537. width: 3.42rem;
  1538. // width: 100%;
  1539. margin: 0.35rem 0.3rem 0 0.4rem;
  1540. label {
  1541. display: block;
  1542. height: 0.55rem;
  1543. line-height: 0.55rem;
  1544. color: $pgh-color;
  1545. }
  1546. select {
  1547. width: 100%;
  1548. padding: 0.2rem 0;
  1549. border: 1px $border-color solid;
  1550. border-radius: 2px;
  1551. padding-left: 5px;
  1552. }
  1553. .inputBox {
  1554. border: 1px $border-color solid;
  1555. border-radius: 2px;
  1556. padding: 0.18rem 0;
  1557. padding-left: 5px;
  1558. }
  1559. .textarea {
  1560. width: 100%;
  1561. height: 1.22rem;
  1562. border: 1px $border-color solid;
  1563. border-radius: 2px;
  1564. padding-left: 5px;
  1565. }
  1566. }
  1567. .width {
  1568. width: 90%;
  1569. @include box-sizing;
  1570. margin-top: 1rem;
  1571. label {
  1572. display: inline-block;
  1573. }
  1574. button {
  1575. background: $main-color;
  1576. color: #fff;
  1577. border-radius: 6px;
  1578. width: 3rem;
  1579. height: 0.9rem;
  1580. line-height: 0.9rem;
  1581. text-align: center;
  1582. margin: 0 0.1rem 0.6rem 0.1rem;
  1583. border: 1px $main-color solid;
  1584. &.smt-danger {
  1585. background: #fff;
  1586. color: $main-color;
  1587. }
  1588. }
  1589. }
  1590. .center {
  1591. text-align: center;
  1592. }
  1593. .row-class-active > td {
  1594. background: #badcff;
  1595. }
  1596. }
  1597. .table {
  1598. tr {
  1599. td {
  1600. padding-left: 5px;
  1601. padding-right: 5px;
  1602. }
  1603. .advice_name {
  1604. text-align: left;
  1605. }
  1606. .subdrug_name {
  1607. text-align: left;
  1608. padding-left: 25px;
  1609. }
  1610. }
  1611. }
  1612. .AdviceTable {
  1613. padding-top: 0;
  1614. background: #fff;
  1615. min-height: calc(100vh - 230px);
  1616. }
  1617. }
  1618. </style>