import request from '@/utils/request'
import { start } from 'chromedriver'
import { param } from 'jquery'

export function getAdviceConfig () {
  return request({
    url: '/m/api/getadviceconfigs',
    method: 'get'
  })
}

export function CreateDoctorAdvice (id, advice, mode) {
  return request({
    url: '/m/api/advice/create?id=' + id + '&mode=' + mode,
    method: 'post',
    data: advice
  })
}
export function EditDoctorAdvice (id, advice, mode, advice_date, patient_id) {
  
  return request({
    url: '/m/api/advice/edit?id=' + id + '&mode=' + mode + '&advice_date=' + advice_date + '&patient_id=' + patient_id,
    method: 'put',
    data: advice,
    headers: {'Permission': 1}

  })
}

export function StopDoctorAdvice (id, advice, mode) {
  return request({
    url: '/m/api/advice/stop?id=' + id + '&mode=' + mode,
    method: 'Post',
    data: advice,
    headers: {'Permission': 1}

  })
}

export function ExecDoctorAdvice (params) {
 
  return request({
    url: '/m/api/advice/exec',
    method: 'Post',
    params: params,
    headers: {'Permission': 1}

  })
}

export function CheckDoctorAdvice (params) {
  return request({
    url: '/m/api/advice/check',
    method: 'Post',
    params: params,
    headers: {'Permission': 1}

  })
}


export function checkMobileDoctorAdvice(params){
  return request({
    url: '/m/api/mobile/advice/check',
    method: 'Post',
    params: params,
    headers: {'Permission': 1}

  })
}

export function DeleteDoctorAdvice (id) {
  return request({
    url: '/m/api/advice/delete?id=' + id + '&mode=' + mode,
    method: 'Delete',
    headers: {'Permission': 1}

  })
}

export function DeleteDoctorAdviceNew (group_no, advice_id, mode, is_sub, patient_id, advice_date) {
  return request({
    url: '/m/api/newadvice/delete',
    method: 'Delete',
    headers: {'Permission': 1},
    params: {
      groupno: group_no,
      advice_id: advice_id,
      mode: mode,
      is_sub: is_sub,
      patient_id: patient_id,
      advice_date: advice_date
    }
  })
}

export function getSchedualDoctors (params) {
  // console.log('param22222', params)
  return request({
    url: '/m/api/schedule/advices',
    method: 'get',
    params: params
  })
}

export function batchCreateAdvices (patient_id, group_no, data, mode, is_child) {
  return request({
    url: '/m/api/advice/creategroup',
    method: 'post',
    headers: {'Permission': 1},
    params: {
      id: patient_id,
      group_no: group_no,
      mode: mode,
      is_child: is_child
    },
    data: data
  })
}

export function modifyAdviceGroupStartTime (group_no, start_time_str, mode) {
  return request({
    url: '/m/api/advice/group/modify_starttime',
    method: 'post',
    headers: {'Permission': 1},
    params: {
      group_no: group_no,
      start_time: start_time_str,
      mode: mode
    }
  })
}

export function ExecSingleDoctorAdvice (params) {
  return request({
    url: '/m/api/advice/exec/single',
    method: 'Post',
    headers: {'Permission': 1},
    params: params
  })
}

export function DeleteSubDoctorAdvice (params) {
  return request({
    url: '/m/api/delete/subadvice?advice_id=' + params,
    method: 'Delete',
    headers: {'Permission': 1}

  })
}

// export function ModifyExecDoctorAdvice(params){
//   return request({
//     url:'/m/api/delete/subadvice?advice_id='+params,
//     method:'Delete',
//   })
// }

export function ModifyExecDoctorAdvice (params) {
  return request({
    url: '/m/api/advice/exec/modify',
    method: 'Post',
    params: params,
    headers: {'Permission': 1}

  })
}

export function GetRemindLongAdvice (params) {
  return request({
    url: '/m/api/dialysis/advice_remind',
    method: 'Get',
    params: params
  })
}

export function GetRemindLongAdviceOne (params) {
  return request({
    url: '/m/api/dialysis/advice_remind/one',
    method: 'Get',
    params: params
  })
}

export function GetLastOrNextDoctorAdvice (params) {
  return request({
    url: '/m/api/doctoradvice/get',
    method: 'get',
    params: params
  })
}

export function batchAdviceExecution (params) {
  console.log('paramsw22www', params)
  return request({
    url: '/m/api/batchadviceexecution',
    method: 'get',
    params: params
  })
}

export function batchAdviceCheck (params) {
  return request({
    url: '/m/api/batchadvicecheck',
    method: 'get',
    params: params
  })
}

export function batchDeleteAdvice (params) {
  return request({
    url: '/m/api/batchdeleteadvice',
    method: 'get',
    params: params
  })
}

export function execProject (data) {
  return request({
    url: '/m/api/project/exec',
    method: 'post',
    params: data
  })
}

export function checkProject (data) {
  return request({
    url: '/m/api/project/check',
    method: 'post',
    params: data
  })
}

export function getScheduleByPatient (params) {
  return request({
    url: '/m/api/patient/getschedulebypatient',
    method: 'get',
    params: params
  })
}

export function excetionMobileAdvice (params) {
  return request({
    url: '/m/api/exectionmobileadvice',
    method: 'get',
    params: params
  })
}

export function settleMobileAdvice (params) {
  return request({
    url: '/m/api/settlemobileadvice',
    method: 'get',
    params: params
  })
}

export function checkMobileAdvice (params) {
  return request({
    url: '/m/api/checkmobileadvice',
    method: 'get',
    params: params
  })
}

export function BatchHandleExecTime(params){
  
  return request({
    url:"/m/api/batchandleexectime",
    method:"get",
    params:params,
  })
}

export function batchCheckAdvice(params){

  return request({
    url:"/m/api/batchcheckadvice",
    method:"Get",
    params:params,
  })
}

export function getAllMobileDrugList(params){

  return request({
    url:"/m/api/getallmobiledruglist",
    method:"Get",
    params:params
  })
} 

export function saveLongMobileAdvice(data){
  
  return request({
    url:"/m/api/savelongmobileadvice",
    method:"post",
    data:data,
  })
}

export function getLongDoctorAdviceByPatient(params){
  
  return request({
    url:"/m/api/getlongdoctoradvicebypatient",
    method:"get",
    params:params
  })
}

export function saveSelfChildDrugLongAdvice(data){
  
  return request({
    url:"/m/api/saveselfchilddruglongadvice",
    method:"post",
    data:data,
  })
}

export function deleteSelfAdvcieSubAdvice(params){
  
  return request({
    url:"/m/api/deleteselfadvicesubadvice",
    method:"Get",
    params:params
  })
}

export function getEditAdviceAction(params){
  
  return request({
    url:"/m/api/geteditadviceaction",
    method:"Get",
    params:params,
  })
}

export function updateLongMobileAdvice(data){
 
  return request({
    url:"/m/api/updatelongmobileadvice",
    method:"post",
    data:data,
  })
}


export function updateEditDrugOrder(data){

  return request({
    url:"/m/api/updateeditdrugorder",
    method:"post",
    data:data,
  })
}

export function saveLongAdviceTemplate(data){
 
  return request({
    url:"/m/api/savelongadvicetemplate",
    method:"post",
    data:data,
  })
}

export function stopLongAdvice(params){

  return request({
    url:"/m/api/stoplongadvice",
    method:"get",
    params:params,
  })
}