<?php

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/

Route::middleware('auth:sanctum')->get('/user', function (Request $request) {
    return $request->user();
});


Route::post('admin/login','App\Http\Controllers\API\Admin\LoginController@Login')->middleware('log');   //登录
Route::post('/tokenRefresh','App\Http\Controllers\API\TokenController@TokenRefresh')->middleware('log');  //刷新token
Route::post('/GetServiceDateTime','App\Http\Controllers\API\ToolsController@GetServiceDateTime')->middleware('log');  //获取当前服务器时间


Route::group(['middleware'=>['checktoken','log'],'prefix'=>'v1'],function () {  //路由分组
    Route::post('admin/getBaseMenuList','App\Http\Controllers\API\Admin\BaseInfoController@GetBaseMenuList');   //登录后获取admin后台用户对应菜单列表
    Route::post('admin/GetBaseUserInfo','App\Http\Controllers\API\Admin\BaseInfoController@GetBaseUserInfo');   //获取admin用户基本信息
    Route::post('admin/getMenuList','App\Http\Controllers\API\Admin\MenuController@GetList');  //admin后台所有菜单管理
    Route::post('admin/GetFatherMenuList','App\Http\Controllers\API\Admin\MenuController@GetFatherMenuList');  //admin后台获取一级菜单
    Route::post('admin/AddMenu','App\Http\Controllers\API\Admin\MenuController@AddMenu');  //admin后台添加菜单
    Route::post('admin/EditMenu','App\Http\Controllers\API\Admin\MenuController@EditMenu');  //admin后台修改菜单
    Route::post('admin/getUserList','App\Http\Controllers\API\Admin\UserController@GetInfoList');  //admin后台获取用户列表
    Route::post('admin/resetPwd','App\Http\Controllers\API\Admin\UserController@resetPwd');  //admin后台获重置用户密码
    Route::post('admin/GetSystemUserDetail','App\Http\Controllers\API\Admin\UserController@GetDetail');  //admin后台获取用户详情
    Route::post('admin/adminChangePwd','App\Http\Controllers\API\Admin\UserController@ChangePwd');  //admin后台修改密码
    Route::post('admin/SaveSystemUserInfo','App\Http\Controllers\API\Admin\UserController@Save');  //admin后台保存用户信息
    Route::post('admin/getGroupList','App\Http\Controllers\API\Admin\GroupController@GetList');  //admin后台组列表
    Route::post('admin/GroupChangeMenu','App\Http\Controllers\API\Admin\GroupController@ChangeMenu');  //admin后台组列表
    Route::post('admin/GetGroupMenuList','App\Http\Controllers\API\Admin\GroupController@GetGroupMenuList');  //管理员查询分组使用的菜单
    Route::post('admin/SaveGroup','App\Http\Controllers\API\Admin\GroupController@Save');  //admin后台组列表
    Route::post('admin/CheckMenuAuth','App\Http\Controllers\API\Admin\BaseInfoController@CheckMenuAuth');  //admin后台检查用户菜单权限
    Route::post('UpFile','App\Http\Controllers\API\UpLoadController@UpFile');  //上传文件
    Route::post('admin/ChangInfo','App\Http\Controllers\API\Admin\UserController@ChangInfo');  //修改自身用户信息
    Route::post('admin/GetConfigInfo','App\Http\Controllers\API\Admin\ConfigController@GetConfigInfo');  //获取配置信息
    Route::post('admin/SaveConfigInfo','App\Http\Controllers\API\Admin\ConfigController@SaveConfig');  //保存配置信息
    //--------------以上为系统基本接口
    Route::post('admin/GetHealthOrganizationEnableList','App\Http\Controllers\API\Admin\YeWu\HealthOrganizationController@GetEnableList');  //admin后台获取可用体检机构列表
    Route::post('admin/CreateCalendar','App\Http\Controllers\API\Admin\YeWu\healthCalendarController@CreateCalendar');  //admin后台创建日历
    Route::post('admin/CalendarGetList','App\Http\Controllers\API\Admin\YeWu\healthCalendarController@getList');  //admin后台获取日历列表
    Route::post('admin/CalendarListDel','App\Http\Controllers\API\Admin\YeWu\healthCalendarController@Del');  //admin后台删除日历
    Route::post('admin/CalendarChangeInfo','App\Http\Controllers\API\Admin\YeWu\healthCalendarController@ChangeInfo');  //admin后台更新日历
    Route::post('admin/GetCheckItemClassList','App\Http\Controllers\API\Admin\YeWu\CheckItemController@GetClassList');//admin后台获取检查项目类别列表
    Route::post('admin/GetCheckItemList','App\Http\Controllers\API\Admin\YeWu\CheckItemController@GetItemList');//admin后台获取检
    Route::post('admin/GetDeviceList','App\Http\Controllers\API\Admin\YeWu\DevicesController@GetList');//admin后台获取设备列表
    Route::post('admin/SaveDeviceList','App\Http\Controllers\API\Admin\YeWu\DevicesController@Save');//admin后台保存设备列表
    Route::post('admin/GetEnableDeviceList','App\Http\Controllers\API\Admin\YeWu\DevicesController@GetEnableList');//admin后台可用设备列表
    Route::post('admin/DelDevice','App\Http\Controllers\API\Admin\YeWu\DevicesController@Del');//admin后台删除设备列表
    Route::post('admin/ItemBindDevice','App\Http\Controllers\API\Admin\YeWu\CheckItemController@BindDevice');//admin后台检查项目绑定设备
    Route::post('admin/GetYuYueTypes','App\Http\Controllers\API\Admin\YeWu\YuYueTypeController@GetTypes');//admin后台获取预约类型
    Route::post('admin/SaveItemInfo','App\Http\Controllers\API\Admin\YeWu\CheckItemController@Save');//admin后台保存检查项目信息
    Route::post('admin/GetDepartmentList','App\Http\Controllers\API\Admin\YeWu\DepartmentController@GetList');//admin后台获取科室列表
    Route::post('admin/SaveDepartment','App\Http\Controllers\API\Admin\YeWu\DepartmentController@Save');//保存科室信息
    Route::post('admin/DelDepartment','App\Http\Controllers\API\Admin\YeWu\DepartmentController@Del');//删除科室信息
    Route::post('admin/GetEnableDepartmentList','App\Http\Controllers\API\Admin\YeWu\DepartmentController@GetEnableList');//获取启用的科室列表
    Route::post('admin/SaveDepartmentResource','App\Http\Controllers\API\Admin\YeWu\DepartmentResourceController@Save');//保存科室资源信息
    Route::post('admin/DepartmentResourceGetList','App\Http\Controllers\API\Admin\YeWu\DepartmentResourceController@GetList');//获取科室资源list
    Route::post('admin/DepartmentResourceGetEnableList','App\Http\Controllers\API\Admin\YeWu\DepartmentResourceController@GetEnableList');//获取可用科室资源
    Route::post('admin/DepartmentResourceDel','App\Http\Controllers\API\Admin\YeWu\DepartmentResourceController@Del');//删除科室资源信息
    Route::post('admin/DepartmentResourceBindDevice','App\Http\Controllers\API\Admin\YeWu\DepartmentResourceController@BindDevice');//绑定科室资源与设备
    Route::post('admin/ResourceGetBindDeviceList','App\Http\Controllers\API\Admin\YeWu\DepartmentResourceController@GetBindDeviceList');//获取资源已经绑定的设备
    Route::post('admin/TimePeriodSave','App\Http\Controllers\API\Admin\YeWu\TimePeriodController@Save');//保存时间段信息
    Route::post('admin/TimePeriodGetList','App\Http\Controllers\API\Admin\YeWu\TimePeriodController@GetList');//保存时间段信息
    Route::post('admin/TimePeriodGetEnableList','App\Http\Controllers\API\Admin\YeWu\TimePeriodController@GetEnableList');//获取启用的时间段列表
    Route::post('admin/TimePeriodGetDetail','App\Http\Controllers\API\Admin\YeWu\TimePeriodController@GetDetail');//获取时间段详情
    Route::post('admin/TimePeriodDel','App\Http\Controllers\API\Admin\YeWu\TimePeriodController@Del');//删除时间段信息
    Route::post('admin/PlanModelGetList','App\Http\Controllers\API\Admin\YeWu\PlanModelController@GetList');//获取预约计划模板list
    Route::post('admin/PlanModelSave','App\Http\Controllers\API\Admin\YeWu\PlanModelController@Save');//保存计划模板
    Route::post('admin/GetAppointmentRatio','App\Http\Controllers\API\Admin\YeWu\PlanModelController@GetAppointmentRatio');//获取预约类型比例
    Route::post('admin/GetPlanModelDetailInfo','App\Http\Controllers\API\Admin\YeWu\PlanModelController@GetDetailInfo');//获取计划模板详情
    Route::post('admin/PlanModelDel','App\Http\Controllers\API\Admin\YeWu\PlanModelController@Del');//删除计划模板
    Route::post('admin/SaveAppointmentRatio','App\Http\Controllers\API\Admin\YeWu\PlanModelController@SaveAppointmentRatio');//保存渠道比例
    Route::post('admin/CreatePlanList','App\Http\Controllers\API\Admin\YeWu\PlanListController@Create');//生成计划明细
    Route::post('admin/PlanListGetList','App\Http\Controllers\API\Admin\YeWu\PlanListController@GetList');//生成计划明细
    Route::post('admin/PlanListGetDetail','App\Http\Controllers\API\Admin\YeWu\PlanListController@GetDetail');//计划详情
    Route::post('admin/GetPlanUsedList','App\Http\Controllers\API\Admin\YeWu\PlanListController@GetUsedList');//计划占用详情列表
    Route::post('admin/PlanDetailChangeInfo','App\Http\Controllers\API\Admin\YeWu\PlanListController@ChangeInfo');//修改计划详情信息
    Route::post('admin/PlanListDel','App\Http\Controllers\API\Admin\YeWu\PlanListController@Del');//删除计划详情
    Route::post('admin/GetMainList','App\Http\Controllers\API\Admin\YeWu\WorkMainController@GetList');//获取主表列表
    Route::post('admin/GetLoglist','App\Http\Controllers\API\Admin\YeWu\WorkMainController@GetLoglist');//获取日志
    Route::post('admin/CancelYuYue','App\Http\Controllers\API\Admin\YeWu\PlanListController@CancelYuYue');//取消预约
    Route::post('admin/SetHuChi','App\Http\Controllers\API\Admin\YeWu\CheckItemController@SetHuChi');//设置互斥
    Route::post('admin/DelHuChi','App\Http\Controllers\API\Admin\YeWu\CheckItemController@DelHuChi');//删除互斥
    Route::post('admin/CheckEntrstItemGroup','App\Http\Controllers\API\Admin\YeWu\WorkMainController@CheckEntrstItemGroup');//批量检查医嘱检查项目是否可以同时预约
    Route::post('admin/GetHuChiList','App\Http\Controllers\API\Admin\YeWu\CheckItemController@GetHuChiList');//获取某个项目已经设置的互斥列表
    Route::post('admin/InpatientWardGetList','App\Http\Controllers\API\Admin\YeWu\InpatientWardController@GetList');//获取病区列表
    Route::post('admin/InpatientWardSave','App\Http\Controllers\API\Admin\YeWu\InpatientWardController@Save');//保存病区
    Route::post('admin/InpatientWardDel','App\Http\Controllers\API\Admin\YeWu\InpatientWardController@Del');//删除病区
    Route::post('admin/SignIn','App\Http\Controllers\API\Admin\YeWu\SignInController@SignIn');//签到
    Route::post('admin/CancelSign','App\Http\Controllers\API\Admin\YeWu\SignInController@CancelSign');//取消签到
    Route::post('admin/countAppointmentType','App\Http\Controllers\API\Admin\YeWu\AppointmentTypeController@countAppointmentType');//预约渠道统计
    Route::post('admin/CountMakeList','App\Http\Controllers\API\Admin\YeWu\WorkMainController@CountMakeList');//开单统计
});

//暂时不加权限
Route::group(['middleware'=>['log']],function () {
    Route::post('admin/getMainDetail','App\Http\Controllers\API\Admin\YeWu\WorkMainController@getMainDetail');//获取主表信息
    Route::post('admin/GetEnablePlan','App\Http\Controllers\API\Admin\YeWu\PlanListController@GetEnablePlan');//获取可用的计划，用于计划占用
    Route::post('admin/PlanYuYue','App\Http\Controllers\API\Admin\YeWu\PlanListController@YuYue');//开始预约
    Route::post('admin/CheckEntrstItemGroup','App\Http\Controllers\API\Admin\YeWu\WorkMainController@CheckEntrstItemGroup');//批量检查医嘱检查项目是否可以同时预约
    Route::post('admin/CheckIsDaiJian','App\Http\Controllers\API\Admin\YeWu\WorkMainController@CheckIsDaiJian');//检查当前时段是否有存在已经预约的待检查项目
    Route::post('admin/GetPlanUsedList','App\Http\Controllers\API\Admin\YeWu\PlanListController@GetUsedList');//计划占用详情列表
    Route::get('admin/NoPayCancel','App\Http\Controllers\API\Admin\YeWu\WorkMainController@NoPayCancel');//检查是否有超时未支付的门诊预约记录，如果有则给其取消，并恢复名额
    Route::post('admin/DoctorCancelYuYue','App\Http\Controllers\API\Admin\YeWu\WorkMainController@DoctorCancelYuYue');//医生取消预约
    Route::post('admin/NearestEnablePlanDate','App\Http\Controllers\API\Admin\YeWu\PlanListController@NearestEnablePlanDate');//获取最近可用日期
    Route::post('testSendMsg','App\Http\Controllers\TestSendMsgController@SendMsg');//测试发送短信
    Route::post('admin/GetPersonYuYueList','App\Http\Controllers\API\Admin\YeWu\WorkMainController@GetPersonYuYueList');//医生获取某人全部预约记录
    Route::post('admin/EntrustGetList','App\Http\Controllers\API\Admin\YeWu\EntrustController@GetList');//获取医嘱列表，非主工作列表
    Route::post('admin/getMainDetail_duoren','App\Http\Controllers\API\Admin\YeWu\EntrustController@getMainDetail_duoren');//获取医嘱信息（支持多人）

    Route::post('admin/AutoYuYue','App\Http\Controllers\API\Admin\YeWu\PlanListController@AutoYuYue');//自动预约
});

//H5端接口
Route::post('H5/Login','App\Http\Controllers\API\H5\LoginController@Login')->middleware('log');
Route::group(['middleware'=>['checktoken','log'],'prefix'=>'v1'],function () {  //路由分组

    Route::post('H5/EntrustGetList','App\Http\Controllers\API\H5\EntrustController@GetList');//获取个人医嘱列表
    Route::post('H5/GetEnablePlan','App\Http\Controllers\API\H5\PlanController@GetEnablePlan');//获取可预约计划
    Route::post('H5/H5_YuYue','App\Http\Controllers\API\H5\PlanController@H5_YuYue');//H5_预约
    Route::post('H5/H5_CancelYuYue','App\Http\Controllers\API\H5\PlanController@H5_CancelYuYue');//H5_取消预约

});

//对外接口
Route::group(['middleware'=>['check.sign','log'],'prefix'=>'v1'],function () {
    Route::post('T/CreateEntrustRecord','App\Http\Controllers\API\Third\EntrustController@CreateRecord');//获取个人医嘱列表
});

//对外接口
Route::group(['middleware'=>['xmllog'],'prefix'=>'v1'],function () {
    Route::post('T/CreateRecordXml','App\Http\Controllers\API\Third\EntrustController@CreateRecordXml');//获取个人医嘱列表

});

