<template>
  <div style="background-color: #f0f2f5; padding-bottom: 20px; min-height: 100%; " >
    <div style="padding: 20px; background-color: #fff;">
      订单详情
    </div>
<div class="contentx" v-if="item!=null">
        <div class="desct">
        </div>
        <div class="order-status" v-if="item!=null" >
                  <el-steps  :active="item.status==4?item.status:item.status-1" align-center finish-status="success">
                    <el-step :title="item.dictLabel" v-for="(item,index) in inquiryStatusOptions" v-if="index<4"></el-step>
                  </el-steps>
        </div>
        <el-card shadow="never" style="margin-top: 15px">
              <div class="operate-container"  v-if="item!=null">
               <span style="margin-left: 20px" class="color-danger">订单状态：
                  <el-tag prop="status" v-for="(ite, index) in inquiryStatusOptions"    v-if="item.status==ite.dictValue">{{ite.dictLabel}}</el-tag>
               </span>
                <div class="operate-button-container" >
                  <el-button size="mini" @click="cancelorder()" v-if="item.status==2 && item.packageOrderId==null">取消订单</el-button>
               </div>
              <div class="operate-button-container" >
                 <el-button size="mini" @click="refundorder()" v-if="item.status<1" v-hasPermi="['his:inquiryOrder:refundOrder']" >退款</el-button>
              </div>
              <div class="operate-button-container" >
                 <el-button size="mini" @click="editStatus()" v-hasPermi="['his:inquiryOrder:editStatus']">修改订单</el-button>
              </div>
              <div class="operate-button-container" >
                 <el-button size="mini" @click="sendInquiryMsg()" v-if="item.status==3" v-hasPermi="['his:inquiryOrder:sendMsg']">发送消息</el-button>
              </div>
              <div class="operate-button-container" >
                 <el-button size="mini" @click="handledetails()" v-hasPermi="['his:inquiryOrderReport:query']">咨询报告</el-button>
              </div>
              <div class="operate-button-container" >
                 <el-button size="mini" @click="handlePatient()" v-hasPermi="['his:inquiryOrderReport:query']">患者诊断数据</el-button>
              </div>


             </div>
<div class="desct">
  基本信息
</div>
        <el-descriptions title="" :column="3" border>
            <el-descriptions-item label="订单号" ><span v-if="item!=null">{{item.orderSn}}</span></el-descriptions-item>
            <el-descriptions-item label="订单类型" ><dict-tag :options="inquiryTypeOptions" :value="item.inquiryType"/></el-descriptions-item>
            <el-descriptions-item label="优惠金额" ><span v-if="item!=null">{{item.discountMoney}}</span></el-descriptions-item>
            <el-descriptions-item label="订单金额" ><span v-if="item!=null">{{item.money}}</span></el-descriptions-item>
            <el-descriptions-item label="支付金额" ><span v-if="item!=null">{{item.payMoney}}</span></el-descriptions-item>
            <el-descriptions-item label="支付类型" ><span v-if="item!=null">{{item.payType}}</span></el-descriptions-item>
            <el-descriptions-item label="是否支付" ><dict-tag :options="orOptions" :value="item.isPay"/></el-descriptions-item>
            <el-descriptions-item label="支付时间" ><span v-if="item!=null">{{item.payTime}}</span></el-descriptions-item>
            <el-descriptions-item label="状态" ><dict-tag :options="inquiryStatusOptions" :value="item.status"/></el-descriptions-item>
            <el-descriptions-item label="创建时间" ><span v-if="item!=null">{{item.createTime}}</span></el-descriptions-item>
            <el-descriptions-item :label="item.inquiryType==1?'问诊标题':'咨询标题'" ><span v-if="item!=null">{{item.title}}</span></el-descriptions-item>
            <el-descriptions-item label="患者姓名" ><span v-if="item!=null">{{item.patientName}}</span></el-descriptions-item>
            <el-descriptions-item label="科室" ><span v-if="item!=null">{{item.deptName}}</span></el-descriptions-item>
            <el-descriptions-item label="优惠劵发送人" ><span v-if="item!=null">{{item.sendName}}</span></el-descriptions-item>
            <el-descriptions-item label="咨询类型" ><dict-tag :options="inquiryTypeOptions" :value="item.inquiryType"/></el-descriptions-item>
            <el-descriptions-item label="审核人" ><span v-if="item!=null">{{item.userName}}</span></el-descriptions-item>
            <el-descriptions-item label="审核时间" ><span v-if="item!=null">{{item.auditTime}}</span></el-descriptions-item>
            <el-descriptions-item label="咨询开始时间" ><span v-if="item!=null">{{item.startTime}}</span></el-descriptions-item>
            <el-descriptions-item label="结束时间" ><span v-if="item!=null">{{item.finishTime}}</span></el-descriptions-item>
            <el-descriptions-item label="备注" ><span v-if="item!=null">{{item.companyUserRemark}}</span></el-descriptions-item>
            </el-descriptions>
             </el-card>
        <el-dialog
          title="聊天记录"
          :visible.sync="dialogVisible"
          width="80%"
          :before-close="handleClose1" append-to-body >
          <msgDetails  ref="msgDetails" :msgDialogClose="msgDialogClose" />
          <span slot="footer" class="dialog-footer">
            <el-button @click="dialogVisible = false">取 消</el-button>
            <el-button type="primary" @click="dialogVisible = false">确 定</el-button>
          </span>
        </el-dialog>
         <el-dialog
           title="处方单"
           :visible.sync="editStatusOpen"
           width="60%"
           append-to-body >
              <el-form ref="form" :model="statusForm"  label-width="120px">
                <el-form-item label="订单状态" prop="status">
                      <el-select v-model="statusForm.status" placeholder="订单状态">
                            <el-option
                                v-for="dict in inquiryStatusOptions"
                                :key="dict.dictValue"
                                :label="dict.dictLabel"
                                :value="parseInt(dict.dictValue)"
                              />
                            </el-select>
                 </el-form-item>
              </el-form>
           <span slot="footer" class="dialog-footer">
             <el-button @click="editStatusOpen = false">取 消</el-button>
             <el-button type="primary" @click="editStatusOpenOk">确 定</el-button>
           </span>
         </el-dialog>

        <el-dialog
        title="患者问诊数据"
        :visible.sync="patientOpen"
        width="1000px"
        append-to-body>
          <el-form ref="patientForm" :model="patientForm" label-width="110px" >

            <el-row>
              <el-col :span="12">
                <el-form-item label="患者姓名" prop="patientName">
                  <el-input disabled v-model="item.patientName"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="患者性别" prop="sex">
                  <el-select disabled v-model="JSON.parse(item.patientJson).sex">
                    <el-option label="男" :value = "1"></el-option>
                    <el-option label="女" :value = "0"></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
            </el-row>

            <el-row>
              <el-col :span="12">
                <el-form-item label="患者年龄" prop="age">
                  <el-input disabled v-model="JSON.parse(item.patientJson).age"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="患者电话" prop="mobile">
                  <el-input disabled v-model="JSON.parse(item.patientJson).mobile"></el-input>
                </el-form-item>
              </el-col>
            </el-row>

            <el-row>
              <el-col :span="12">
                <el-form-item label="患者会员电话" prop="userPhone">
                  <el-input disabled v-model="patientForm.userPhone"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="客户标签" prop="tag">
                  <el-input  v-model="patientForm.tag"></el-input>
                </el-form-item>
              </el-col>
            </el-row>

            <el-row>
              <el-col :span="12">
                <el-form-item label="客服姓名" prop="companyUserName">
                  <el-input disabled v-model="patientForm.companyUserName"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="课程档期" prop="courseName">
                  <el-input  v-model="patientForm.courseName"></el-input>
                </el-form-item>
              </el-col>
            </el-row>

            <el-row>
              <el-col :span="12">
                <el-form-item label="预约医生" prop="doctorName">
                  <el-input disabled v-model="item.doctorName"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="会诊时间" prop="subTime">
                  <el-date-picker
                  v-model="patientForm.subTime"
                  type="date"
                  value-format="yyyy-MM-dd"
                  placeholder="选择日期">
                  </el-date-picker>
                </el-form-item>
              </el-col>
            </el-row>

            <el-row>
              <el-col :span="12">
                <el-form-item label="就诊状态" prop="sex">
                  <el-select  v-model="patientForm.diagnosisStatus">
                    <el-option label="初诊" :value = "1"></el-option>
                    <el-option label="复诊" :value = "2"></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="部门负责人" prop="deptManager">
                  <el-input v-model="patientForm.deptManager"></el-input>
                </el-form-item>
              </el-col>
            </el-row>

            <el-form-item label="患者病情主诉">
              <el-input
              type="textarea"
              placeholder="请输入内容"
              v-model="patientForm.patientCondition">
              </el-input>
            </el-form-item>

            <div class="contentx">
              <div class="desct">
                医生建议及处置
              </div>
            </div>
            <el-form-item label="诊断">
              <el-input
              type="textarea"
              placeholder="请输入内容"
              v-model="patientForm.doctorAdviceJson.diagnosis">
              </el-input>
            </el-form-item>
            <el-form-item label="饮食方面">
              <el-input
              type="textarea"
              placeholder="请输入内容"
              v-model="patientForm.doctorAdviceJson.foodAdvice">
              </el-input>
            </el-form-item>
            <el-form-item label="运动方面">
              <el-input
              type="textarea"
              placeholder="请输入内容"
              v-model="patientForm.doctorAdviceJson.sportAdvice">
              </el-input>
            </el-form-item>
            <el-form-item label="保健方面">
              <el-input
              type="textarea"
              placeholder="请输入内容"
              v-model="patientForm.doctorAdviceJson.healthAdvice">
              </el-input>
            </el-form-item>

            <el-form-item label="注意禁忌">
              <el-input
              type="textarea"
              placeholder="请输入内容"
              v-model="patientForm.taboo">
              </el-input>
            </el-form-item>
            <el-form-item label="客户需求">
              <el-input  v-model="patientForm.customerRequire"></el-input>
            </el-form-item>
            <el-row>
              <el-col :span="12">
                <el-form-item label="职业医师" prop="age">
                  <el-input  v-model="patientForm.professionalDoctor"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="医生助理" prop="mobile">
                  <el-input  v-model="patientForm.assistantDoctor"></el-input>
                </el-form-item>
              </el-col>
            </el-row>
            <div class="contentx">
              <div class="desct">
                治疗方面
              </div>
              </div>
            <div v-for="(i,index) in patientForm.doctorAdviceJson.treatmentAdvice" :key="index">
              <el-row>
                <el-col :span="8">
                  <el-form-item label="诊断内容" prop="content">
                    <el-input  v-model="i.content"></el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="建议治疗" prop="advice">
                    <el-input  v-model="i.advice"></el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-button style="margin: 5px;" v-if="index+1 == patientForm.doctorAdviceJson.treatmentAdvice.length" @click="addItem(patientForm.doctorAdviceJson.treatmentAdvice.length)" type="primary" size="mini">+</el-button>
                  <el-button style="margin: 5px;"  v-if="index !== 0" type="danger" size="mini" @click="delItem(i,index)">-</el-button>
                </el-col>
                
              </el-row>
            </div>
          </el-form>
          <span slot="footer" class="dialog-footer">
             <el-button @click="patientOpen = false">取 消</el-button>
             <el-button type="primary" @click="patientInquirySubmit">确 定</el-button>
          </span>
        </el-dialog>
 </div>

<div class="contentx" v-if="item!=null">
<div class="desct">
  咨询内容
</div>
  <el-descriptions title="" :column="3" border>
  <el-descriptions-item label="患者姓名" ><span v-if="item!=null">{{JSON.parse(item.patientJson).patientName}}</span></el-descriptions-item>
  <el-descriptions-item label="患者年龄" ><span v-if="item!=null">{{JSON.parse(item.patientJson).age}}</span></el-descriptions-item>
  <el-descriptions-item label="患者性别" ><span >{{JSON.parse(item.patientJson).sex==1?'男':'女'}}</span></el-descriptions-item>
  <el-descriptions-item label="身份证号" ><span >{{JSON.parse(item.patientJson).idCard}}</span></el-descriptions-item>
  <el-descriptions-item label="是否就诊" > <span >就诊过</span></el-descriptions-item>
  <el-descriptions-item label="电话" ><span v-if="item!=null">{{JSON.parse(item.patientJson).mobile}}</span></el-descriptions-item>
  <el-descriptions-item label="学习周期" ><span v-if="item!=null">{{JSON.parse(item.patientJson).study}}</span></el-descriptions-item>
  <el-descriptions-item label="期望咨询方式" ><span >语音咨询</span></el-descriptions-item>
  <el-descriptions-item label="用药情况" ><span v-if="item!=null">{{JSON.parse(item.patientJson).medication}}</span></el-descriptions-item>
  <el-descriptions-item label="咨询时间" ><span v-if="item!=null">{{item.startTime}}</span></el-descriptions-item>
  <el-descriptions-item :label="item.inquiryType==1?'主诉':'咨询问题'" span="3"><span v-if="item!=null">{{JSON.parse(item.patientJson).title}}</span></el-descriptions-item>

  <el-descriptions-item label="面部照片" span="3">
            <el-image v-if="faceImages!=null&&faceImages!=''" v-for="img in faceImages" :key="img.id"
                    style="width: 100px"
                    :src="img"
                    :preview-src-list="[img]">
            </el-image>
  </el-descriptions-item>
  <el-descriptions-item label="舌苔照片" span="3">
      <el-image v-if="tongueImages!=null&&tongueImages!=''" v-for="img in tongueImages" :key="img.id"
              style="width: 100px"
              :src="img"
              :preview-src-list="[img]">
      </el-image>
     </el-descriptions-item>
  <el-descriptions-item label="检测报告或患病证书" span="3">
        <el-image v-if="imgs!=null&&imgs!=''"  v-for="img in imgs" :key="img.id"
                style="width: 100px"
                :src="img"
                :preview-src-list="[img]">
        </el-image>
  </el-descriptions-item>
</el-descriptions>
</div>
        <div class="contentx" v-if="item!=null">
        <div class="desct">
          评价信息
        </div>

        <el-descriptions title="" :column="3" border>
          <el-descriptions-item label="患者姓名" >
               <span v-if="item!=null">{{item.patientName}}</span>
           </el-descriptions-item>
          <el-descriptions-item label="是否评价" >
               <dict-tag :options="orOptions" :value="item.isPing"/>
        </el-descriptions-item>
        <el-descriptions-item label="评分" >
          <el-rate v-if="item.pingStar!=null"
            v-model="item.pingStar"
            disabled
            show-score
            text-color="#ff9900"
            score-template="{value}">
          </el-rate>
        </el-descriptions-item>
        <el-descriptions-item label="聊天记录" >
          <el-link type="primary" @click="getSerivceMsg"  :underline="false" v-if="item.title=='服务问诊'">查看聊天记录</el-link>
           <el-link type="primary" disabled :underline="false" v-if="(msg==null || msg=='')&&item.title!='服务问诊' ">无聊天记录</el-link>
              <el-link type="primary" @click="getMsg" :underline="false" v-if="msg!=null && msg!='' ">查看聊天记录</el-link>
        </el-descriptions-item>
        <el-descriptions-item label="评价内容" >
            <span v-if="item!=null">{{item.pingContent}}</span>
        </el-descriptions-item>
        <el-descriptions-item label="医生回复" >
            <span v-if="item!=null">{{item.replyContent}}</span>
        </el-descriptions-item>
        </el-descriptions>
        </div>
<div class="contentx" v-if="item!=null">
<div class="desct">
  {{item.inquiryType==3?'药师信息':'医生信息'}}
</div>
<el-descriptions title="" :column="3" border >
     <el-descriptions-item :label="item.inquiryType==3?'药师姓名':'医生姓名'" >
         <span v-if="doctor!=null">{{doctor.doctorName}}</span>
     </el-descriptions-item>
     <el-descriptions-item label="工作照" >
       <el-popover v-if="doctor.avatar!=null"
                   placement="right"
                   title=""
                   trigger="hover">
                   <img slot="reference" :src="doctor.avatar" width="50px">
                   <img :src="doctor.avatar" style="max-width: 150px;">
        </el-popover>
     </el-descriptions-item>
     <el-descriptions-item label="所属医院" >
         <span v-if="doctor!=null">{{doctor.hospitalName}}</span>
     </el-descriptions-item>
     <el-descriptions-item label="科室名称" >
         <span v-if="doctor!=null">{{doctor.deptName}}</span>
     </el-descriptions-item>
     <el-descriptions-item label="职务" >
         <span v-if="doctor!=null"><dict-tag :options="positionOptions" :value="doctor.position"/></span>
     </el-descriptions-item>
     <el-descriptions-item label="评分" >
         <span v-if="doctor!=null">
         <el-rate
           v-model="doctor.pingStar"
           disabled
           show-score
           text-color="#ff9900"
           score-template="{value}">
         </el-rate>
        </span>
     </el-descriptions-item>
      <el-descriptions-item label="平均响应速度" >
         <span v-if="doctor!=null">{{doctor.speed}}</span>
     </el-descriptions-item>
    <el-descriptions-item label="性别" >
      <dict-tag :options="sexOptions" :value="doctor.sex"/>
    </el-descriptions-item>
    <el-descriptions-item label="是否专家" >
      <dict-tag :options="orOptions" :value="doctor.isExpert"/>
    </el-descriptions-item>

    <el-descriptions-item :label="item.inquiryType==3?'药师简介':'医生简介'" >
        <span v-if="doctor!=null">{{doctor.introduction}}</span>
    </el-descriptions-item>
 </el-descriptions>
</div>
<div class="contentx" v-if="item!=null">
     <div class="desct">
       操作信息
     </div>
   <el-table style="margin-top: 20px;width: 100%"
                 ref="orderHistoryTable"
                 :data="logs" border>
         <el-table-column label="操作时间"  width="160" align="center">
           <template slot-scope="scope">
             {{scope.row.changeTime}}
           </template>
         </el-table-column>
         <el-table-column label="备注" align="center">
           <template slot-scope="scope">
             {{scope.row.changeMessage}}
           </template>
         </el-table-column>
       </el-table>
     </div>
      <el-drawer
    	:with-header="false"
      :append-to-body="true"
            size="75%"
             :title="show.title" :visible.sync="show.open">
         <inquiryOrderReportDetails  ref="Details" />
       </el-drawer>
      <el-dialog title="聊天记录" :visible.sync="msgServiceDetails.open" width="80%"  append-to-body >
        <msgServiceDetails  ref="msgServiceDetails" :msgServiceDetailsClose="msgServiceDetailsClose" />
        <span slot="footer" class="dialog-footer">
          <el-button @click="msgServiceDetailsClose">取 消</el-button>
          <el-button type="primary" @click="msgServiceDetailsClose">确 定</el-button>
        </span>
      </el-dialog>
</div>
</template>

<script>
import { msglist, sendMsg,listinquiryOrder,editStatus, logList,getinquiryOrder, delinquiryOrder, addinquiryOrder, updateinquiryOrder, exportinquiryOrder ,cancelOrder,refundOrder} from "@/api/his/inquiryOrder";
import {addinquiryPatient, updateinquiryPatient, detail} from "@/api/his/inquiryPatient";
import {getReportId} from "@/api/his/inquiryOrderReport";
import msgDetails from '../../components/his/msgDetails.vue';
import msgServiceDetails from '../../components/his/msgServiceDetails.vue';
import {getDoctor} from '../../../api/his/doctor.js';
import {  getPatient } from "@/api/his/patient";
import {getUser} from "@/api/his/user";
import inquiryOrderReportDetails from '../../components/his/inquiryOrderReportDetails.vue';
import {getPrescribe,getDrugInfo} from "@/api/his/prescribe";
import { js } from "js-beautify";
  export default {
    name: "user",
    components: { inquiryOrderReportDetails,msgDetails ,msgServiceDetails},
    data() {
      return {
        patientOpen: false,
        logs:[],
        editStatusOpen:false,
        usageJson:{},
        show:{
                open:false,
              },
        prescribeItem:{},
        prod:[],
        prescribeDialog:false,
        imgs:[],
        msgForm:{
          pageNum: 1,
          pageSize: 10,
          orderId:null,
        },
        statusForm:{
          orderId: null,
          status: null,
        },
        msgServiceDetails:{
          title:"",
          open:false
        },
        // 总条数
        total: 0,
        faceImages:[],
        tongueImages:[],
        dialogVisible:false,
        msg:[],
        positionOptions: [],
        inquiryStatusOptions:[],
        inquiryTypeOptions:[],
        inquiryPayOptions:[],
        inquiryOrderOptions:[],
        orOptions:[],
        item:null,
        patient:[],
        doctor:[],
        user:[],
        sexOptions: [],
        patientForm: {
          doctorAdviceJson: {
            diagnosis: '',
            foodAdvice: '',
            sportAdvice: '',
            healthAdvice: '',
            treatmentAdvice: [
              //默认一条
              {
                content: '',
                advice: '',
              }
            ]
          }
        },
      }
    },
    created() {
      this.getDicts("sys_sex").then(response => {
        this.sexOptions = response.data;
      });
      this.getDicts("sys_doc_position").then(response => {
        this.positionOptions = response.data;
      });
      this.getDicts("sys_inquiry_status").then(response => {
          this.inquiryStatusOptions = response.data;
        });
      this.getDicts("sys_inquiry_type").then(response => {
          this.inquiryTypeOptions = response.data;
        });
      this.getDicts("sys_inquiry_pay").then(response => {
          this.inquiryPayOptions = response.data;
        });
      this.getDicts("sys_inquiry_order_type").then(response => {
          this.inquiryOrderOptions = response.data;
        });
      this.getDicts("sys_company_or").then(response => {
          this.orOptions = response.data;
        });

    },
    methods: {
      addItem(length){
        this.patientForm.doctorAdviceJson.treatmentAdvice.push({
          content:'',
          advice:'',
        })
      },
      delItem(item,index){
        this.patientForm.doctorAdviceJson.treatmentAdvice.splice(index,1)
      },
      handlePatient(){
        this.patientOpen = true;
        detail(this.item.orderId).then(res => {
          this.patientForm = res.data;
          if(!this.patientForm.doctorAdviceJson) {
            this.patientForm.doctorAdviceJson = {
              diagnosis: '',
              foodAdvice: '',
              sportAdvice: '',
              healthAdvice: '',
              treatmentAdvice: [
                //默认一条
                {
                  content: '',
                  advice: '',
                }
              ]
            }
          }
        })
      },
      cancelorder(){
        var that=this;
        this.$confirm('是否确认取消订单?', "警告", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        }).then(function() {

          var data={
          orderId:that.item.orderId
             }
          return cancelOrder(data);
        }).then(() => {
          this.msgSuccess("操作成功");
          getinquiryOrder(this.item.orderId).then(response => {
              this.item = response.data;
              this.getlogList(this.item.orderId);
          });
        }).catch(function() {});
      },
      editStatusOpenOk(){
        editStatus(this.statusForm).then(response => {
          this.msgSuccess("操作成功");
          getinquiryOrder(this.item.orderId).then(response => {
              this.item = response.data;
              this.getlogList(this.item.orderId);
          });
          });
      },
      patientInquirySubmit(){
        this.patientForm.patientId = this.item.patientId;
        this.patientForm.companyUserId = this.item.companyUserId;
        this.patientForm.userId = this.item.userId;
        this.patientForm.inquiryOrderId = this.item.orderId;
        this.patientForm.subDoctorId = this.item.doctorId;
        console.log(this.patientForm);
        if(this.patientForm.id != null) {
          updateinquiryPatient(this.patientForm).then(res => {
            this.msgSuccess("更新成功");
            this.patientOpen = false;
          })
        } else {
          addinquiryPatient(this.patientForm).then(res => {
            this.msgSuccess("添加成功");
            this.patientOpen = false;
          })
        }
      },
      msgServiceDetailsClose(){
        this.msgServiceDetails.open = false;
      },
      handledetails(row){
        getReportId(this.item.orderId).then(response => {
            var id = response.data
            if(id!=null){
              this.show.open=true;
              setTimeout(() => {
                   this.$refs.Details.getDetails(id);
              }, 1);
            }else{
              this.$message('订单没有报告');
            }

        });
       },
       getMsg(row){
         const orderId = this.item.orderId;
         const doctorName = this.item.doctorName;
         const patientName = this.item.patientName;
         setTimeout(() => {
               this.$refs.msgDetails.getDetails(orderId,doctorName,patientName);
         }, 500);
          this.dialogVisible = true;
       },
       getSerivceMsg(){
         const doctorName = this.item.doctorName;
         const patientName = this.item.patientName;
         this.msgServiceDetails.open = true;
         setTimeout(() => {
           this.$refs.msgServiceDetails.getDetails(doctorName,patientName);
         }, 500);
       },


      msgDialogClose(){
        this.dialogVisible = false;
      },
       editStatus(){
         this.editStatusOpen=true;
         this.statusForm.status=this.item.status;
         this.statusForm.orderId=this.item.orderId;
       },
       prescribe(row){
         this.prescribeDialog=true;
         getPrescribe(row).then(response => {
             this.prescribeItem = response.data;
             this.usageJson=JSON.parse(this.prescribeItem.usageJson)
         });
         getDrugInfo(row).then(response => {
             this.prod = response.data;
         });
       },
      refundorder(){
        var that=this;
        this.$confirm('是否确认退款?', "警告", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        }).then(function() {
          var data={
          orderId:that.item.orderId
             }
          return refundOrder(data);
        }).then(() => {
          this.msgSuccess("操作成功");
        getinquiryOrder(this.item.orderId).then(response => {
              this.item = response.data;
              this.getlogList(this.item.orderId);
          });
        }).catch(function() {});
      },

      sendInquiryMsg(){
        var that=this;
        this.$confirm('是否确认发送消息?', "警告", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        }).then(function() {
          return sendMsg(that.item.orderId);
        }).then(() => {
          this.msgSuccess("操作成功");
        }).catch(function() {});
      },

      handleClose1(){
        this.dialogVisible=false;
      },
      handleClose2(){
        this.prescribeDialog=false;
      },
      getDetails(orderId) {
        this.imgs=null;
        this.tongueImages=null;
        this.faceImages=null;
        var that=this
        this.item=null;
        //获取问诊信息
      getinquiryOrder(orderId).then(response => {
              this.item = response.data;
              //获取医生信息
              if(this.item.doctorId!=null){
                getDoctor(this.item.doctorId).then(response => {
                    this.doctor = response.data;
                });
              }

              this.msgForm.orderId=this.item.orderId;
              this.msgList();
              this.getlogList(this.item.orderId);
               var json=JSON.parse(this.item.patientJson);
               if(json!=null&&json!=""){
                 if(json.reportImages!=null&&json.reportImages!=""){
                    this.imgs= (json.reportImages).split(",");
                 }
                if(json.tongueImages!=null&&json.tongueImages!=""){
                   this.tongueImages=json.tongueImages.split(",")
                }
                if(json.faceImages!=null&&json.faceImages!=""){
                   this.faceImages=json.faceImages.split(",")
                }

               }

       });
      },
      msgList(){
        msglist(this.msgForm).then(response => {
        this.msg = response.rows;
        this.total = response.total;
          });
      },
      getlogList(orderId){
        logList(orderId).then(response => {
            this.logs = response.rows;
        });
      },
    }
  }
</script>
<style>

  .contentx{
      height: 100%;
      background-color: #fff;
      padding: 0px 20px 20px;


      margin: 20px;
  }
  .el-descriptions-item__label.is-bordered-label{
    font-weight: normal;
  }
  .el-descriptions-item__content {
    max-width: 150px;
    min-width: 100px;
  }
  .desct{
      padding-top: 20px;
      padding-bottom: 20px;
      color: #524b4a;
      font-weight: bold;
    }
</style>
<style scoped>
.chat-records {

  overflow-y: auto;
}
.timestamp {
  font-size: 12px;
  color: #A9A9A9;
}
.chat-record {
  margin: 10px;
  flex-direction: column;
  align-items: flex-start;
}
.sent {
  background-color: #fbfdff;
  color: #000839;
}
.right{
  float: right;
}
.received {
  background-color: #fbfdff;
  color: #000000;
}

.el-descriptions-item__content {
    max-width: 150px;
    min-width: 100px;
}
</style>
<style scoped>
.order-content{
  margin: 10px;

}

.operate-container {
  background: #F2F6FC;
  height: 60px;
  margin: -20px -20px 0;
  line-height: 60px;
}

.operate-button-container {
  float: right;
  margin-right: 20px
}
</style>
