血透系统pad前端

AdviceTable.vue 52KB

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