/*
 * @Descripttion: HJ
 * @Company: 思宏科技
 * @version: v1.0
 * @Author: HJ
 * @Date: 2021-06-09 16:04:24
 * @LastEditors: Please set LastEditors
 * @LastEditTime: 2021-12-06 14:44:29
 */
import request from '../../src/js/request'
import {
  _ARTICLES,
  _HOSPITAL_INFO,
  _MERCHANT,
  _NURSE_ORDER,
  _PATIENT,
  _NURSE
} from '../base-api'

// 获取医院地址信息
export const fhGetHospitalAddress = params =>
  request({
    url: `${_HOSPITAL_INFO}/address-info`,
    params
  })

// 获取患者信息
export const fhGetPatientInfo = () => {
  console.log(_PATIENT)
  return request({
    url: `${_PATIENT}`
  })
}

// 保存患者档案
export const fhSavePatientInfo = data =>
  request({
    url: `${_PATIENT}`,
    method: 'post',
    data
  })

// 保存患者档案
export const fhEditPatientInfo = data =>
  request({
    url: `${_PATIENT}`,
    method: 'put',
    data
  })

// 获取用户订单
export const fhGetNurseOrders = key =>
  request({
    url: `${_NURSE_ORDER}/${key}`
  })

// 获取订单支付成功的信息
export const fhGetNursePayInfo = orderId =>
  request({
    url: `${_NURSE_ORDER}/${orderId}/pay-success`,
    method: 'post'
  })

// 获取护工订单详情
export const fhGetNurseOrder = orderId =>
  request({
    url: `${_NURSE_ORDER}/${orderId}`
  })

// 获取护工列表
export function fhGetNurse(params) {
  return request({
    url: `${_NURSE_ORDER}/nurses`,
    params
  })
}

// 预览护工订单
export function fhConfirmOrder(storeId, data) {
  return request({
    url: `${_NURSE_ORDER}/${storeId}/confirm`,
    method: 'post',
    data
  })
}

// 提交订单
export function fhSubmitOrder(storeId, data) {
  return request({
    url: `${_NURSE_ORDER}/${storeId}/submit`,
    method: 'post',
    data
  })
}

// 支付订单
export const fhPayNurseOrders = (orderId, data) =>
  request({
    url: `${_NURSE_ORDER}/${orderId}/pay`,
    method: 'put',
    data
  })

// 取消订单
export const fhCancelNurseOrders = orderId =>
  request({
    url: `${_NURSE_ORDER}/${orderId}/cancel`,
    method: 'put'
  })

// 取消订单
export const fhRefundNurseOrders = (orderId, data) =>
  request({
    url: `${_NURSE_ORDER}/${orderId}/refund`,
    method: 'post',
    data
  })

// 获取文章分类
export const fhGetArticleCategories = () =>
  request({
    url: `${_ARTICLES}/categories`
  })

// 获取文章列表
export const fhGetArticles = params =>
  request({
    url: `${_ARTICLES}`,
    params
  })

// 获取文章详情
export const fhGetArticle = id =>
  request({
    url: `${_ARTICLES}/${id}`
  })

// 获取医院合作商家
export const fhGetHospitalMerchant = params =>
  request({
    url: `${_MERCHANT}`,
    params
  })

// 扫码登录时编辑患者住院信息
export const fhPutInfo = (memberId,hospitalId) =>
request({
  url: `/nurse/client/${memberId}/patients/hospitalization-record/${hospitalId}`,
  method: 'PUT'
})