血透系统pad前端

AdviceTable.vue 50KB

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