import { Get, Post } from "../../lib/request/method";


export function healthReportListMethod() {
  const transform = ({ data }: AnyObject) => {
    return Array.isArray(data) ? data.map(item => {
      return {
        id: item.healthAnalysisReportId,
        reportTime: item.time3,
        description: [item.willillStateName, item.willillDegreeName, item.willillSocialName, item.willillFunctionName].filter(Boolean).join('，')
      }
    }) : []
  }
  return Get(`/analysisManage/getHarsTid`, { transform })
}
// 线下非药物治疗
export function getOfflineTreatmentListMethod(progress: string) {
  return Post(`/patientCrManage/pagePofflineCp?pageNum=1&pageSize=1000000000`, { progress }, {
    transform({ data }: AnyObject) {
      return data;
    }
  })
}
//患者线下调理方案修改预约时间  offlineId线下任务id  time预约时间
export function updateAppointmentMethod(offlineId: string, time: string) {
  return Post(`/patientCrManage/pofflineCpUpdateApply/${offlineId}`, {}, {
    params: {
      time,
    },
    transform({ data }: AnyObject) {
      return data;
    },
  })
}
  //患者线下调理方案预约取消
  export function cancelAppointmentMethod(offlineId: number) {
    return Post(`/patientCrManage/pofflineCpCancleApply/${offlineId}`, {}, {
      transform({ data }: AnyObject) {
        return data;
      }
    })
  }
  //患者线下调理方案预约
  export function appointmentMethod(offlineId: string, time: string) {
    return Post(`/patientCrManage/pofflineCpApply/${offlineId}`, {}, {
      params: {
        time,
      },
      transform({ data }: AnyObject) {
        return data;
      }
    })
  }