123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351 |
- <template>
- <div class="main-contain">
- <div class="position">
- <bread-crumb :crumbs="crumbs"></bread-crumb>
- <el-row style="float:right;">
- <el-col :span="24">
- <el-button size="small" icon="el-icon-printer" type="primary" @click="printAction">打印</el-button>
- </el-col>
- </el-row>
- </div>
- <div class="app-container" style="background-color: white;" v-show="show">
- <div id="dialysisTable">
- <div class="order_title_panl">
- <span class="main_title">临时医嘱</span>
- </div>
- <p style="width: 960px;text-align: right;margin: 0 auto 10px;">日期:{{ time }}</p>
- <table class="table dialysisTable" border="1" cellspacing="0" cellpadding="0">
- <tr>
- <th width="20px">序号</th>
- <th width="100px">姓名</th>
- <th width="50px">医嘱名称</th>
- <th width="50px">药品规格</th>
- <th width="50px">单位</th>
- <th width="50px">数量</th>
- </tr>
-
- <tr v-for="(item,index) in tableData" :key="index">
- <th width="20px">
- {{ index+1 }}
- </th>
- <th width="100px">
- {{ item.patient_name }}
- </th>
- <th width="50px">
- {{ item.advice_name }}
- </th>
- <th width="50px">
- {{ getSpecicalName(item.drug_id) }}
- </th>
- <th width="50px">
- {{ item.prescribing_number_unit }}
- </th>
- <th width="50px">
- {{ item.prescribing_number }}
- </th>
- </tr>
-
- </table>
- </div>
- </div>
-
-
- </div>
- </template>
-
- <script>
- import BreadCrumb from '@/xt_pages/components/bread-crumb'
- import { getSchedualDoctors } from '@/api/advice'
- import { parseTime } from '@/utils'
- import { jsGetAge } from "@/utils/tools";
- import print from 'print-js'
- const moment = require('moment')
- export default {
- components:{
- BreadCrumb
- },
- data(){
- return{
- crumbs: [
- { path: false, name: '药品' },
- { path: false, name: '打印' }
- ],
- tableData:[],
- start_time:"",
- end_time:"",
- print_time:moment(new Date()).add('year', 0).format('YYYY-MM-DD'),
-
- zone_selected: 0,
- scheduleMap:[],
- time:'',
- show:true,
- showOne:false,
- delivery_way:"",
- org_id:0,
- drugList:[]
- }
- },
- methods:{
- getAge: function (val) {
- var thisLen = val.patient.id_card_no.length;
- var birth = "";
- if (thisLen == 15) {
- birth = "19" + val.patient.id_card_no.substr(6, 6);
- } else {
- birth = val.patient.id_card_no.substr(6, 8);
- }
- var birthtwo =
- birth.substr(0, 4) +
- "-" +
- birth.substr(4, 2) +
- "-" +
- birth.substr(6, 2);
-
- var age = jsGetAge(birthtwo, "-");
- return age;
- },
- printAction: function() {
- 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;} }'
-
- printJS({
- printable: 'dialysisTable',
- type: 'html',
- documentTitle: ' ',
- style: style,
- scanStyles: false
- })
- },
- requestSchedualDoctors (time) {
- let newTime = moment(time).format('YYYY-MM-DD')
- getSchedualDoctors({
- date: newTime,
- patient_type: 0,
- advice_type: 2,
- delivery_way:this.delivery_way,
- }).then(rs => {
- var resp = rs.data
- if (resp.state == 1) {
- this.admin_user = resp.data.adminUser
- var config = resp.data.config
- let project_config = resp.data.project_config
- var hisAdvices = resp.data.hisAdvices
- var drugList = resp.data.drug
- this.drugList = []
- this.drugList = drugList
- var newArr = []
- if(hisAdvices!=null && hisAdvices.length>0){
- for(let i=0;i<hisAdvices.length>0;i++){
- for(let j=0;j<hisAdvices[i].doctor_advice.length;j++){
- hisAdvices[i].doctor_advice[j].patient_name = ""
- hisAdvices[i].doctor_advice[j].patient_name = hisAdvices[i].patient.name
- if(hisAdvices[i].doctor_advice[j].delivery_way !='口服' && hisAdvices[i].doctor_advice[j].delivery_way!='中药口服'){
- if(hisAdvices[i].doctor_advice[j].execution_frequency.indexOf('上机前')==-1){
- newArr.push(hisAdvices[i].doctor_advice[j])
- }
- }
- }
- }
- }
- this.tableData = []
- this.tableData = newArr
- console.log("newArr------",newArr)
-
- }
- })
- },
- compare (property) {
- return function (a, b) {
- var value1 = a[property]
- var value2 = b[property]
- return value1 - value2
- }
- },
- parseTime: function (time, layout) {
- if (time == 0) {
- return ''
- }
- return parseTime(time, layout)
- },
- getName (val) {
- for (let i = 0; i < this.admin_user.length; i++) {
- if (this.admin_user[i].id == val) {
- return this.admin_user[i].name
- }
- }
- },
- getSpecicalName(drug_id){
- var specification_name = ""
- for(let i=0;i<this.drugList.length;i++){
- if(drug_id == this.drugList[i].id){
- specification_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
- }
- }
- return specification_name
- }
- },
- computed: {
- filtedScheduals: function () {
- var scheduleMap = new Object()
- if (this.zone_selected == 0) {
- for (const key in this.scheduleMap) {
- scheduleMap[key] = this.scheduleMap[key]
- }
- } else {
- var zone_name = this.zones[this.zone_selected].text
- scheduleMap[zone_name] = this.scheduleMap[zone_name]
- }
-
- if (this.schedule_type_selected != 0) {
- var _scheduleMap = {}
- for (const key in scheduleMap) {
- var origin_schedules = scheduleMap[key]
- var schedules = []
- for (let index = 0; index < origin_schedules.length; index++) {
- const schedule = origin_schedules[index]
- if (schedule.schedule_type == this.schedule_type_selected) {
- schedules.push(schedule)
- }
- }
- if (schedules.length > 0) {
- _scheduleMap[key] = schedules
- }
- }
-
- scheduleMap = _scheduleMap
- }
- for (var key in scheduleMap) {
- let mapArr = scheduleMap[key]
- for (let i = 0; i < mapArr.length; i++) {
- mapArr[i]['new_advice'] = []
- }
- }
-
- for (var key in scheduleMap) {
- let mapArr = scheduleMap[key]
- for (let i = 0; i < mapArr.length; i++) {
- var maps = mapArr[i]
- var resp_advices = maps.doctor_advice
- if (resp_advices.length > 0) {
- var newGroupObject = function () {
- return Object.assign(
- {},
- {
- group_no: 0,
- advices: []
- }
- )
- }
- var initGroupBlock = function (group, advice) {
- group.group_no = advice.groupno
- }
-
- var advice_groups = []
- var group = newGroupObject()
- for (let index = 0; index < resp_advices.length; index++) {
- const advice = resp_advices[index]
- if (advice.groupno == 0) {
- // 老版本的医嘱
- if (advice.parent_id > 0) {
- if (advice_groups.length > 0) {
- var parent_group = advice_groups[advice_groups.length - 1]
- if (parent_group.advices.length > 0) {
- if (parent_group.advices[0].id == advice.parent_id) {
- parent_group.advices.push(advice)
- }
- }
- }
- continue
- } else {
- if (group.group_no > 0) {
- advice_groups.push(group)
- group = newGroupObject()
- }
-
- initGroupBlock(group, advice)
- group.advices.push(advice)
- advice_groups.push(group)
- group = newGroupObject()
- continue
- }
- } else {
- if (group.group_no > 0 && group.group_no != advice.groupno) {
- advice_groups.push(group)
- group = newGroupObject()
- }
- if (group.group_no == 0) {
- initGroupBlock(group, advice)
- }
- if (group.group_no == advice.groupno) {
- group.advices.push(advice)
- }
- }
- }
- if (group.group_no > 0) {
- // 上述的算法会导致最后一组没有加到advice_groups,这里要手动加
- advice_groups.push(group)
- }
- advice_groups = advice_groups
- } else {
- advice_groups = []
- }
- maps.new_advice = advice_groups
- }
- }
- console.log("222222",scheduleMap)
- return scheduleMap
- }
- },
- created(){
- var time = this.$route.query.time
- var delivery_way = this.$route.query.delivery_way
- this.delivery_way = delivery_way
- this.time = moment(time).format('YYYY-MM-DD')
- console.log(11,this.$route.query)
- this.requestSchedualDoctors(time)
- this.org_id = this.$store.getters.xt_user.template_info.org_id;
- }
- }
- </script>
-
-
- <style rel="stylesheet/scss" lang="scss" scoped>
- .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;
- }
- </style>
|