signPrint.vue 32KB

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