doctorAdvicePrint.vue 33KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797
  1. <template>
  2. <div class="main-contain">
  3. <div class="position">
  4. <bread-crumb :crumbs="crumbs"></bread-crumb>
  5. <el-row style="float:right;">
  6. <el-col :span="24">
  7. <el-button size="small" icon="el-icon-printer" type="primary" @click="printAction">打印</el-button>
  8. </el-col>
  9. </el-row>
  10. </div>
  11. <div class="app-container" style="background-color: white;" v-show="show">
  12. <div id="dialysisTable">
  13. <div class="order_title_panl">
  14. <span class="main_title">透析医嘱</span>
  15. </div>
  16. <p style="width: 960px;text-align: right;margin: 0 auto 10px;">日期:{{ time }}</p>
  17. <table class="table dialysisTable" border="1" cellspacing="0" cellpadding="0">
  18. <tr>
  19. <th width="40px">姓名</th>
  20. <th width="40px">透析器</th>
  21. <!-- <th width="50px">类型</th> -->
  22. <th width="50px">开始时间</th>
  23. <th width="100px">医嘱内容</th>
  24. <th width="50px">执行时间</th>
  25. <th width="50px">执行护士</th>
  26. <th width="50px">校对护士</th>
  27. <th width="50px">校对时间</th>
  28. <th width="50px">开嘱医生</th>
  29. <th width="50px">开嘱时间</th>
  30. </tr>
  31. <template v-for="(schedules, zone_name, index) in scheduleMap">
  32. <tr :key="index">
  33. <td>{{ zone_name }}</td>
  34. <!-- <td></td> -->
  35. <td></td>
  36. <td></td>
  37. <td></td>
  38. <td></td>
  39. <td></td>
  40. <td></td>
  41. <td></td>
  42. <td></td>
  43. <td></td>
  44. </tr>
  45. <template v-for="schedule in schedules">
  46. <template v-for="(group, group_index) in schedule.new_advice">
  47. <tr v-for="(advice, advice_index) in group.advices" :key="advice_index">
  48. <td
  49. v-if="advice_index == 0"
  50. :rowspan="group.advices.length"
  51. >{{ advice.parent_id == 0 ? schedule.patient.name : "" }}
  52. <br>
  53. ({{ advice.parent_id == 0 ? schedule.dialysis_no : ""}})
  54. <br>
  55. <span v-if="schedule.mode_id == 1">(HD)</span>
  56. <span v-if="schedule.mode_id == 2">(HDF)</span>
  57. <span v-if="schedule.mode_id == 3">(HD+HP)</span>
  58. <span v-if="schedule.mode_id == 4">(HP)</span>
  59. <span v-if="schedule.mode_id == 5">(HF)</span>
  60. <span v-if="schedule.mode_id == 6">(SCUF)</span>
  61. <span v-if="schedule.mode_id == 7">(IUF)</span>
  62. <span v-if="schedule.mode_id == 8">(HFHD)</span>
  63. <span v-if="schedule.mode_id == 9">(HFHD+HP)</span>
  64. <span v-if="schedule.mode_id == 10">(PHF)</span>
  65. <span v-if="schedule.mode_id == 11">(HFR)</span>
  66. <span v-if="schedule.mode_id == 12">(HDF+HP)</span>
  67. <span v-if="schedule.mode_id == 13">(CRRT)</span>
  68. <span v-if="schedule.mode_id == 14">(腹水回输)</span>
  69. </td>
  70. <td v-if="advice_index == 0" :rowspan="group.advices.length">
  71. {{advice.parent_id == 0 && schedule.prescription!=null ? schedule.prescription.dialyzer_perfusion_apparatus : ""}}
  72. </td>
  73. <!-- <td
  74. v-if="advice_index == 0"
  75. :rowspan="group.advices.length"
  76. >{{ getAdaviceType(advice.advice_type, advice.parent_id) }}</td>-->
  77. <td v-if="advice_index == 0" :rowspan="group.advices.length">
  78. {{
  79. advice.parent_id == 0
  80. ? parseTime(advice.start_time, "{m}-{d} {h}:{i}")
  81. : ""
  82. }}
  83. </td>
  84. <td
  85. :class="
  86. advice.parent_id == 0
  87. ? 'advice_content'
  88. : 'subadvice_content'
  89. "
  90. >
  91. <span>{{ advice.advice_name }}</span>
  92. <span>{{ advice.advice_desc }}{{ advice.drug_spec_unit }}</span>
  93. <span v-if="advice.prescribing_number">
  94. {{ advice.prescribing_number
  95. }}{{ advice.prescribing_number_unit }}
  96. </span>
  97. <span v-if="advice.single_dose">
  98. 单次用量 {{ advice.single_dose
  99. }}{{ advice.single_dose_unit }}
  100. </span>
  101. <span>{{ advice.delivery_way }}</span>
  102. <span>{{ advice.execution_frequency }}</span>
  103. <span
  104. v-if="advice.parent_id == 0 && advice.remark.length > 0"
  105. >({{ advice.remark }})</span>
  106. </td>
  107. <td>{{ parseTime(advice.execution_time, "{m}-{d} {h}:{i}") }}</td>
  108. <td>{{ getName(advice.execution_staff) }}</td>
  109. <td>{{ getName(advice.checker) }}</td>
  110. <td>{{ parseTime(advice.check_time, "{m}-{d} {h}:{i}") }}</td>
  111. <td>{{ getName(advice.advice_doctor) }}</td>
  112. <td>{{ parseTime(advice.created_time, "{m}-{d} {h}:{i}") }}</td>
  113. </tr>
  114. </template>
  115. </template>
  116. </template>
  117. </table>
  118. </div>
  119. </div>
  120. <div class="app-container" style="background-color: white;" v-show="showOne">
  121. <div id="dialysisTable">
  122. <div class="order_title_panl">
  123. <span class="main_title">透析医嘱</span>
  124. </div>
  125. <p style="width: 960px;text-align: right;margin: 0 auto 10px;">日期:{{ time }}</p>
  126. <table class="table dialysisTable" border="1" cellspacing="0" cellpadding="0">
  127. <tr>
  128. <th width="40px">姓名</th>
  129. <th width="40px">透析器</th>
  130. <!-- <th width="50px">类型</th> -->
  131. <th width="50px">开始时间</th>
  132. <th width="100px">医嘱内容</th>
  133. <th width="50px">执行时间</th>
  134. <th width="50px">执行护士</th>
  135. <th width="50px">校对护士</th>
  136. <th width="50px">校对时间</th>
  137. <th width="50px">开嘱医生</th>
  138. <th width="50px">开嘱时间</th>
  139. </tr>
  140. <template v-for="(schedules, zone_name, index) in scheduleMap">
  141. <tr :key="index">
  142. <td>{{ zone_name }}</td>
  143. <!-- <td></td> -->
  144. <td></td>
  145. <td></td>
  146. <td></td>
  147. <td></td>
  148. <td></td>
  149. <td></td>
  150. <td></td>
  151. <td></td>
  152. <td></td>
  153. </tr>
  154. <template v-for="schedule in schedules">
  155. <template v-for="(group, group_index) in schedule.new_advice">
  156. <tr v-for="(advice, advice_index) in group.advices" :key="advice_index">
  157. <td
  158. v-if="advice_index == 0"
  159. :rowspan="group.advices.length"
  160. >{{ advice.parent_id == 0 ? schedule.patient.name : "" }}
  161. <br>
  162. ({{ advice.parent_id == 0 ? schedule.dialysis_no : ""}})
  163. <br>
  164. <span v-if="schedule.mode_id == 1">(HD)</span>
  165. <span v-if="schedule.mode_id == 2">(HDF)</span>
  166. <span v-if="schedule.mode_id == 3">(HD+HP)</span>
  167. <span v-if="schedule.mode_id == 4">(HP)</span>
  168. <span v-if="schedule.mode_id == 5">(HF)</span>
  169. <span v-if="schedule.mode_id == 6">(SCUF)</span>
  170. <span v-if="schedule.mode_id == 7">(IUF)</span>
  171. <span v-if="schedule.mode_id == 8">(HFHD)</span>
  172. <span v-if="schedule.mode_id == 9">(HFHD+HP)</span>
  173. <span v-if="schedule.mode_id == 10">(PHF)</span>
  174. <span v-if="schedule.mode_id == 11">(HFR)</span>
  175. <span v-if="schedule.mode_id == 12">(HDF+HP)</span>
  176. <span v-if="schedule.mode_id == 13">(CRRT)</span>
  177. <span v-if="schedule.mode_id == 14">(腹水回输)</span>
  178. </td>
  179. <td v-if="advice_index == 0" :rowspan="group.advices.length">
  180. {{advice.parent_id == 0 && schedule.prescription!=null ? schedule.prescription.dialyzer_perfusion_apparatus : ""}}
  181. </td>
  182. <!-- <td
  183. v-if="advice_index == 0"
  184. :rowspan="group.advices.length"
  185. >{{ getAdaviceType(advice.advice_type, advice.parent_id) }}</td>-->
  186. <td v-if="advice_index == 0" :rowspan="group.advices.length">
  187. {{
  188. advice.parent_id == 0
  189. ? parseTime(advice.start_time, "{m}-{d} {h}:{i}")
  190. : ""
  191. }}
  192. </td>
  193. <td
  194. :class="
  195. advice.parent_id == 0
  196. ? 'advice_content'
  197. : 'subadvice_content'
  198. "
  199. >
  200. <span>{{ advice.advice_name }}</span>
  201. <span>{{ advice.advice_desc }}{{ advice.drug_spec_unit }}</span>
  202. <span v-if="advice.prescribing_number">
  203. {{ advice.prescribing_number
  204. }}{{ advice.prescribing_number_unit }}
  205. </span>
  206. <span v-if="advice.single_dose">
  207. 单次用量 {{ advice.single_dose
  208. }}{{ advice.single_dose_unit }}
  209. </span>
  210. <span>{{ advice.delivery_way }}</span>
  211. <span>{{ advice.execution_frequency }}</span>
  212. <span
  213. v-if="advice.parent_id == 0 && advice.remark.length > 0"
  214. >({{ advice.remark }})</span>
  215. </td>
  216. <td>{{ parseTime(advice.execution_time, "{m}-{d} {h}:{i}") }}</td>
  217. <td>{{ getName(advice.execution_staff) }}</td>
  218. <td>{{ getName(advice.checker) }}</td>
  219. <td>{{ parseTime(advice.check_time, "{m}-{d} {h}:{i}") }}</td>
  220. <td>{{ getName(advice.advice_doctor) }}</td>
  221. <td>{{ parseTime(advice.created_time, "{m}-{d} {h}:{i}") }}</td>
  222. </tr>
  223. </template>
  224. </template>
  225. </template>
  226. </table>
  227. </div>
  228. </div>
  229. </div>
  230. </template>
  231. <script>
  232. import BreadCrumb from '@/xt_pages/components/bread-crumb'
  233. import { getSchedualDoctors } from '@/api/advice'
  234. import { parseTime } from '@/utils'
  235. import print from 'print-js'
  236. const moment = require('moment')
  237. export default {
  238. components:{
  239. BreadCrumb
  240. },
  241. data(){
  242. return{
  243. crumbs: [
  244. { path: false, name: '耗材药品' },
  245. { path: false, name: '打印' }
  246. ],
  247. tableData:[],
  248. start_time:"",
  249. end_time:"",
  250. print_time:moment(new Date()).add('year', 0).format('YYYY-MM-DD'),
  251. zone_selected: 0,
  252. scheduleMap:[],
  253. time:'',
  254. show:true,
  255. showOne:false,
  256. delivery_way:""
  257. }
  258. },
  259. methods:{
  260. printAction: function() {
  261. const style = '@media print { .dialysisTable{width:960px;margin: 0 auto;text-align: center;border-collapse: collapse;}.order_title_panl {text-align: center;.main_title {font-size: 18px;line-height: 40px;font-weight: 500;}}.dialysisTable tr{padding: 10px 0;}.dialysisTable th {color: #000;padding: 0;margin: 0;height: 30px;}.dialysisTable tr td {padding: 12px 0;}.subadvice_content {text-align: left;padding-left: 25px !important;padding-right: 5px !important;}.advice_content {text-align: left;padding-left: 5px !important;padding-right: 5px !important;padding: 15px 5px !important;} }'
  262. printJS({
  263. printable: 'dialysisTable',
  264. type: 'html',
  265. documentTitle: ' ',
  266. style: style,
  267. scanStyles: false
  268. })
  269. },
  270. requestSchedualDoctors (time) {
  271. let newTime = moment(time).format('YYYY-MM-DD')
  272. getSchedualDoctors({
  273. date: newTime,
  274. patient_type: 0,
  275. advice_type: 2,
  276. delivery_way:this.delivery_way,
  277. }).then(rs => {
  278. var resp = rs.data
  279. if (resp.state == 1) {
  280. this.admin_user = resp.data.adminUser
  281. var config = resp.data.config
  282. if(config.is_open == 0 || config.is_open == 2){
  283. var schedulesArr = resp.data.scheduals
  284. let schedules = []
  285. var ids = this.$store.getters.temp_params.advice_ids
  286. console.log('ids',ids)
  287. schedulesArr.map(item => {
  288. if(ids.indexOf(item.patient_id) > -1){
  289. schedules.push(item)
  290. }
  291. })
  292. for (let i = 0; i < schedules.length; i++) {
  293. schedules[i].dialysis_no = schedules[i].patient.dialysis_no
  294. }
  295. var arr = []
  296. for (let j = 0; j < schedules.length; j++) {
  297. arr.push(schedules[j].dialysis_no)
  298. }
  299. arr.sort(function (a, b) {
  300. return a - b
  301. })
  302. var arrTwo = []
  303. for (let i = 0; i < arr.length; i++) {
  304. for (let j = 0; j < schedules.length; j++) {
  305. if (arr[i] == schedules[j].dialysis_no) {
  306. arrTwo.push(schedules[j])
  307. }
  308. }
  309. }
  310. arrTwo.map((item, index) => {
  311. item.doctor_advice.sort(this.compare('start_time'))
  312. })
  313. const res = new Map()
  314. let a = arrTwo.filter(
  315. a => !res.has(a.dialysis_no) && res.set(a.dialysis_no, 1)
  316. )
  317. schedules = a
  318. var zoneMap = {}
  319. var scheduleMap = {}
  320. for (let index = 0; index < schedules.length; index++) {
  321. const schedule = schedules[index]
  322. if (schedule.doctor_advice.length == 0) {
  323. continue
  324. }
  325. if (scheduleMap[schedule.device_number.zone.name] == null) {
  326. scheduleMap[schedule.device_number.zone.name] = []
  327. }
  328. scheduleMap[schedule.device_number.zone.name].push(schedule)
  329. if (zoneMap[schedule.device_number.zone.name] == null) {
  330. zoneMap[schedule.device_number.zone.name] =
  331. schedule.device_number.zone
  332. }
  333. }
  334. var zones = []
  335. zones.push({ value: 0, text: '全部分区' })
  336. for (var zoneName in zoneMap) {
  337. zones.push({ value: zoneMap[zoneName].id, text: zoneName })
  338. }
  339. zones = zones.sort(function (a, b) {
  340. return a.value > b.value
  341. })
  342. this.zones = zones
  343. for (var key in scheduleMap) {
  344. let mapArr = scheduleMap[key]
  345. for (let i = 0; i < mapArr.length; i++) {
  346. mapArr[i]['new_advice'] = []
  347. }
  348. }
  349. for (var key in scheduleMap) {
  350. let mapArr = scheduleMap[key]
  351. for (let i = 0; i < mapArr.length; i++) {
  352. var maps = mapArr[i]
  353. var resp_advices = maps.doctor_advice
  354. if (resp_advices.length > 0) {
  355. var newGroupObject = function () {
  356. return Object.assign(
  357. {},
  358. {
  359. group_no: 0,
  360. advices: []
  361. }
  362. )
  363. }
  364. var initGroupBlock = function (group, advice) {
  365. group.group_no = advice.groupno
  366. }
  367. var advice_groups = []
  368. var group = newGroupObject()
  369. for (let index = 0; index < resp_advices.length; index++) {
  370. const advice = resp_advices[index]
  371. if (advice.groupno == 0) {
  372. // 老版本的医嘱
  373. if (advice.parent_id > 0) {
  374. if (advice_groups.length > 0) {
  375. var parent_group = advice_groups[advice_groups.length - 1]
  376. if (parent_group.advices.length > 0) {
  377. if (parent_group.advices[0].id == advice.parent_id) {
  378. parent_group.advices.push(advice)
  379. }
  380. }
  381. }
  382. continue
  383. } else {
  384. if (group.group_no > 0) {
  385. advice_groups.push(group)
  386. group = newGroupObject()
  387. }
  388. initGroupBlock(group, advice)
  389. group.advices.push(advice)
  390. advice_groups.push(group)
  391. group = newGroupObject()
  392. continue
  393. }
  394. } else {
  395. if (group.group_no > 0 && group.group_no != advice.groupno) {
  396. advice_groups.push(group)
  397. group = newGroupObject()
  398. }
  399. if (group.group_no == 0) {
  400. initGroupBlock(group, advice)
  401. }
  402. if (group.group_no == advice.groupno) {
  403. group.advices.push(advice)
  404. }
  405. }
  406. }
  407. if (group.group_no > 0) {
  408. // 上述的算法会导致最后一组没有加到advice_groups,这里要手动加
  409. advice_groups.push(group)
  410. }
  411. advice_groups = advice_groups
  412. } else {
  413. advice_groups = []
  414. }
  415. maps.new_advice = advice_groups
  416. }
  417. }
  418. this.scheduleMap = scheduleMap
  419. }
  420. if(config.is_open == 1){
  421. var schedulesArr = resp.data.hisAdvices
  422. let schedules = []
  423. var ids = this.$store.getters.temp_params.advice_ids
  424. console.log('ids',ids)
  425. schedulesArr.map(item => {
  426. if(ids.indexOf(item.patient_id) > -1){
  427. schedules.push(item)
  428. }
  429. })
  430. for (let i = 0; i < schedules.length; i++) {
  431. schedules[i].dialysis_no = schedules[i].patient.dialysis_no
  432. }
  433. var arr = []
  434. for (let j = 0; j < schedules.length; j++) {
  435. arr.push(schedules[j].dialysis_no)
  436. }
  437. arr.sort(function (a, b) {
  438. return a - b
  439. })
  440. var arrTwo = []
  441. for (let i = 0; i < arr.length; i++) {
  442. for (let j = 0; j < schedules.length; j++) {
  443. if (arr[i] == schedules[j].dialysis_no) {
  444. arrTwo.push(schedules[j])
  445. }
  446. }
  447. }
  448. arrTwo.map((item, index) => {
  449. item.doctor_advice.sort(this.compare('start_time'))
  450. })
  451. const res = new Map()
  452. let a = arrTwo.filter(
  453. a => !res.has(a.dialysis_no) && res.set(a.dialysis_no, 1)
  454. )
  455. schedules = a
  456. var zoneMap = {}
  457. var scheduleMap = {}
  458. for (let index = 0; index < schedules.length; index++) {
  459. const schedule = schedules[index]
  460. if (schedule.doctor_advice.length == 0) {
  461. continue
  462. }
  463. if (scheduleMap[schedule.device_number.zone.name] == null) {
  464. scheduleMap[schedule.device_number.zone.name] = []
  465. }
  466. scheduleMap[schedule.device_number.zone.name].push(schedule)
  467. if (zoneMap[schedule.device_number.zone.name] == null) {
  468. zoneMap[schedule.device_number.zone.name] =
  469. schedule.device_number.zone
  470. }
  471. }
  472. var zones = []
  473. zones.push({ value: 0, text: '全部分区' })
  474. for (var zoneName in zoneMap) {
  475. zones.push({ value: zoneMap[zoneName].id, text: zoneName })
  476. }
  477. zones = zones.sort(function (a, b) {
  478. return a.value > b.value
  479. })
  480. this.zones = zones
  481. for (var key in scheduleMap) {
  482. let mapArr = scheduleMap[key]
  483. for (let i = 0; i < mapArr.length; i++) {
  484. mapArr[i]['new_advice'] = []
  485. }
  486. }
  487. for (var key in scheduleMap) {
  488. let mapArr = scheduleMap[key]
  489. for (let i = 0; i < mapArr.length; i++) {
  490. var maps = mapArr[i]
  491. var resp_advices = maps.doctor_advice
  492. if (resp_advices.length > 0) {
  493. var newGroupObject = function () {
  494. return Object.assign(
  495. {},
  496. {
  497. group_no: 0,
  498. advices: []
  499. }
  500. )
  501. }
  502. var initGroupBlock = function (group, advice) {
  503. group.group_no = advice.groupno
  504. }
  505. var advice_groups = []
  506. var group = newGroupObject()
  507. for (let index = 0; index < resp_advices.length; index++) {
  508. const advice = resp_advices[index]
  509. if (advice.groupno == 0) {
  510. // 老版本的医嘱
  511. if (advice.parent_id > 0) {
  512. if (advice_groups.length > 0) {
  513. var parent_group = advice_groups[advice_groups.length - 1]
  514. if (parent_group.advices.length > 0) {
  515. if (parent_group.advices[0].id == advice.parent_id) {
  516. parent_group.advices.push(advice)
  517. }
  518. }
  519. }
  520. continue
  521. } else {
  522. if (group.group_no > 0) {
  523. advice_groups.push(group)
  524. group = newGroupObject()
  525. }
  526. initGroupBlock(group, advice)
  527. group.advices.push(advice)
  528. advice_groups.push(group)
  529. group = newGroupObject()
  530. continue
  531. }
  532. } else {
  533. if (group.group_no > 0 && group.group_no != advice.groupno) {
  534. advice_groups.push(group)
  535. group = newGroupObject()
  536. }
  537. if (group.group_no == 0) {
  538. initGroupBlock(group, advice)
  539. }
  540. if (group.group_no == advice.groupno) {
  541. group.advices.push(advice)
  542. }
  543. }
  544. }
  545. if (group.group_no > 0) {
  546. // 上述的算法会导致最后一组没有加到advice_groups,这里要手动加
  547. advice_groups.push(group)
  548. }
  549. advice_groups = advice_groups
  550. } else {
  551. advice_groups = []
  552. }
  553. maps.new_advice = advice_groups
  554. }
  555. }
  556. this.scheduleMap = scheduleMap
  557. }
  558. }
  559. })
  560. },
  561. compare (property) {
  562. return function (a, b) {
  563. var value1 = a[property]
  564. var value2 = b[property]
  565. return value1 - value2
  566. }
  567. },
  568. parseTime: function (time, layout) {
  569. if (time == 0) {
  570. return ''
  571. }
  572. return parseTime(time, layout)
  573. },
  574. getName (val) {
  575. for (let i = 0; i < this.admin_user.length; i++) {
  576. if (this.admin_user[i].id == val) {
  577. return this.admin_user[i].name
  578. }
  579. }
  580. },
  581. },
  582. computed: {
  583. filtedScheduals: function () {
  584. var scheduleMap = new Object()
  585. if (this.zone_selected == 0) {
  586. for (const key in this.scheduleMap) {
  587. scheduleMap[key] = this.scheduleMap[key]
  588. }
  589. } else {
  590. var zone_name = this.zones[this.zone_selected].text
  591. scheduleMap[zone_name] = this.scheduleMap[zone_name]
  592. }
  593. if (this.schedule_type_selected != 0) {
  594. var _scheduleMap = {}
  595. for (const key in scheduleMap) {
  596. var origin_schedules = scheduleMap[key]
  597. var schedules = []
  598. for (let index = 0; index < origin_schedules.length; index++) {
  599. const schedule = origin_schedules[index]
  600. if (schedule.schedule_type == this.schedule_type_selected) {
  601. schedules.push(schedule)
  602. }
  603. }
  604. if (schedules.length > 0) {
  605. _scheduleMap[key] = schedules
  606. }
  607. }
  608. scheduleMap = _scheduleMap
  609. }
  610. for (var key in scheduleMap) {
  611. let mapArr = scheduleMap[key]
  612. for (let i = 0; i < mapArr.length; i++) {
  613. mapArr[i]['new_advice'] = []
  614. }
  615. }
  616. for (var key in scheduleMap) {
  617. let mapArr = scheduleMap[key]
  618. for (let i = 0; i < mapArr.length; i++) {
  619. var maps = mapArr[i]
  620. var resp_advices = maps.doctor_advice
  621. if (resp_advices.length > 0) {
  622. var newGroupObject = function () {
  623. return Object.assign(
  624. {},
  625. {
  626. group_no: 0,
  627. advices: []
  628. }
  629. )
  630. }
  631. var initGroupBlock = function (group, advice) {
  632. group.group_no = advice.groupno
  633. }
  634. var advice_groups = []
  635. var group = newGroupObject()
  636. for (let index = 0; index < resp_advices.length; index++) {
  637. const advice = resp_advices[index]
  638. if (advice.groupno == 0) {
  639. // 老版本的医嘱
  640. if (advice.parent_id > 0) {
  641. if (advice_groups.length > 0) {
  642. var parent_group = advice_groups[advice_groups.length - 1]
  643. if (parent_group.advices.length > 0) {
  644. if (parent_group.advices[0].id == advice.parent_id) {
  645. parent_group.advices.push(advice)
  646. }
  647. }
  648. }
  649. continue
  650. } else {
  651. if (group.group_no > 0) {
  652. advice_groups.push(group)
  653. group = newGroupObject()
  654. }
  655. initGroupBlock(group, advice)
  656. group.advices.push(advice)
  657. advice_groups.push(group)
  658. group = newGroupObject()
  659. continue
  660. }
  661. } else {
  662. if (group.group_no > 0 && group.group_no != advice.groupno) {
  663. advice_groups.push(group)
  664. group = newGroupObject()
  665. }
  666. if (group.group_no == 0) {
  667. initGroupBlock(group, advice)
  668. }
  669. if (group.group_no == advice.groupno) {
  670. group.advices.push(advice)
  671. }
  672. }
  673. }
  674. if (group.group_no > 0) {
  675. // 上述的算法会导致最后一组没有加到advice_groups,这里要手动加
  676. advice_groups.push(group)
  677. }
  678. advice_groups = advice_groups
  679. } else {
  680. advice_groups = []
  681. }
  682. maps.new_advice = advice_groups
  683. }
  684. }
  685. console.log("222222",scheduleMap)
  686. return scheduleMap
  687. }
  688. },
  689. created(){
  690. var time = this.$route.query.time
  691. var delivery_way = this.$route.query.delivery_way
  692. console.log("delivery_Way",delivery_way)
  693. this.delivery_way = delivery_way
  694. this.time = moment(time).format('YYYY-MM-DD')
  695. console.log(11,this.$route.query)
  696. this.requestSchedualDoctors(time)
  697. }
  698. }
  699. </script>
  700. <style rel="stylesheet/scss" lang="scss" scoped>
  701. .dialysisTable{
  702. width:960px;
  703. margin: 0 auto;
  704. text-align: center;
  705. border-collapse: collapse;
  706. }
  707. .order_title_panl {
  708. text-align: center;
  709. .main_title {
  710. font-size: 18px;
  711. line-height: 40px;
  712. font-weight: 500;
  713. }
  714. }
  715. .dialysisTable tr{
  716. padding: 10px 0;
  717. }
  718. .dialysisTable th {
  719. color: #000;
  720. padding: 0;
  721. margin: 0;
  722. height: 30px;
  723. }
  724. .dialysisTable tr td {
  725. padding: 12px 0;
  726. }
  727. .subadvice_content {
  728. text-align: left;
  729. padding-left: 25px !important;
  730. padding-right: 5px !important;
  731. }
  732. .advice_content {
  733. text-align: left;
  734. padding-left: 5px !important;
  735. padding-right: 5px !important;
  736. padding: 15px 5px !important;
  737. }
  738. </style>