<?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::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/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('admin/SystemLogGetList','App\Http\Controllers\API\LogController@GetList');//admin后台获取日志列表
    Route::post('admin/GetLogTableName','App\Http\Controllers\API\LogController@GetLogTableName');//admin后台获取日志表名

    //--------------以上为系统基本接口
    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/GetCheckUpList','App\Http\Controllers\API\Admin\YeWu\HealthCheckupController@GetCheckUpList');  //admin后台获取体检记录
    Route::post('admin/GetAppointmentList','App\Http\Controllers\API\Admin\YeWu\AppointmentController@GetAppointmentList');  //admin后台获取预约记录
    Route::post('admin/DelAppointment','App\Http\Controllers\API\Admin\YeWu\AppointmentController@Del'); //admin后台删除预约记录
    Route::post('admin/XTSignBindUser','App\Http\Controllers\API\XTSignController@bindUser');//admin后台用户绑定协同签名useid
    Route::post('admin/UkeyBindUser','App\Http\Controllers\API\UkeyController@Bind');//admin后台用户绑定协同签名useid
    Route::post('admin/AppointmentCount','App\Http\Controllers\API\Admin\YeWu\AppointmentController@AppointmentCount');  //admin后台预约统计
    Route::post('admin/AppointmentCountByMonth','App\Http\Controllers\API\Admin\YeWu\AppointmentController@AppointmentCountByMonth');  //admin后台预约统计
    Route::post('admin/InstitutionGetList','App\Http\Controllers\API\Admin\YeWu\InstitutionController@GetList');//获取体检机构列表
    Route::post('admin/InstitutionSavdSeting','App\Http\Controllers\API\Admin\YeWu\InstitutionController@SavdSeting');//保存机构设置
    Route::post('admin/InstitutionGetSetingDetail','App\Http\Controllers\API\Admin\YeWu\InstitutionController@GetSetingDetail');//获取机构设置详情
    Route::post('admin/GetConfigs','App\Http\Controllers\API\Admin\YeWu\ConfigsController@GetConfigs');//获取设置
    Route::post('admin/SaveConfig','App\Http\Controllers\API\Admin\YeWu\ConfigsController@SaveConfig');//保存设置
    Route::post('admin/AppointmentGetPicList','App\Http\Controllers\API\Admin\YeWu\AppointmentController@GetPicList');  //获取预约记录图片

    Route::post('admin/CheckUpCount','App\Http\Controllers\API\Admin\YeWu\HealthCheckupController@CheckUpCount');//体检统计

    //平台推送相关
    Route::post('admin/PingTaiPushGetList','App\Http\Controllers\API\Admin\YeWu\PingTaiPushController@GetList');
    Route::post('admin/PingTaiPushCountByOrg','App\Http\Controllers\API\Admin\YeWu\PingTaiPushController@CountByOrg');
    Route::post('admin/PingTaiPushCountByMonth','App\Http\Controllers\API\Admin\YeWu\PingTaiPushController@CountByMonth');
    Route::post('admin/PingTaiPushGetDetail','App\Http\Controllers\API\Admin\YeWu\PingTaiPushController@GetDetail');
    Route::post('admin/GetPingTaiOrgList','App\Http\Controllers\API\Admin\YeWu\PingTaiPushController@GetPingTaiOrgList');

    //冲突记录
    Route::post('admin/ConflictRecordGetList','App\Http\Controllers\API\Admin\YeWu\ConflictRecordController@GetList');
    Route::post('admin/ConflictRecordExport','App\Http\Controllers\API\Admin\YeWu\ConflictRecordController@ExportList');
    //取消操作日志
    Route::post('admin/DeleteOperationLogGetList','App\Http\Controllers\API\Admin\YeWu\DeleteOperationLogController@GetList');
    Route::post('admin/DeleteOperationLogExport','App\Http\Controllers\API\Admin\YeWu\DeleteOperationLogController@ExportList');

});


Route::post('wxGetOpenid','App\Http\Controllers\API\mH5\LoginController@wxGetOpenid')->middleware('log'); //mH5手机用户获取openid
Route::post('AppLogin','App\Http\Controllers\API\mH5\LoginController@AppLogin')->middleware('log'); //APP嵌套h5登录，参数APP内用户唯一id
Route::post('H5GetPersonReportDetail','App\Http\Controllers\API\mH5\PersonController@H5GetPersonReportDetail')->middleware('log');//用户扫码跳转输入身份证和电话 查询用户体检详情和pdf
Route::post('GetConfigInArray','App\Http\Controllers\API\Admin\YeWu\ConfigsController@GetConfigInArray')->middleware('log');//获取设置

Route::group(['middleware'=>['checktoken','log'],'prefix'=>'v1/mH5'],function () {  //手机H5路由分组
    Route::post('Register','App\Http\Controllers\API\mH5\PersonController@Register');  //手机H5端用户注册
    Route::post('GetPersonRecode','App\Http\Controllers\API\mH5\PersonController@GetPersonRecode');  //查询用户本年度体检记录
    Route::post('isAgeOver65','App\Http\Controllers\API\mH5\PersonController@isAgeOver65');  //判断是否过65
    Route::post('GetOrgEnableList','App\Http\Controllers\API\mH5\OrganizationController@GetEnableList');  //获取可用体检机构
    Route::post('GetEnableCalendar','App\Http\Controllers\API\mH5\OrganizationController@GetEnableCalendar');  //获取可用体检机构日历
    Route::post('StartYuYue','App\Http\Controllers\API\mH5\OrganizationController@StartYuYue');  //开始预约
    Route::post('CancelYuYue','App\Http\Controllers\API\mH5\OrganizationController@CancelYuYue');  //取消预约
    Route::post('UpFile','App\Http\Controllers\API\UpLoadController@UpFile');  //上传文件
    Route::post('UpFileBase64','App\Http\Controllers\API\UpLoadController@UpFileBase64');//上传文件base64
    Route::post('GetPersonReportDetail','App\Http\Controllers\API\mH5\PersonController@GetPersonReportDetail');//获取用户pdf
    Route::post('GetIndustryList','App\Http\Controllers\API\mH5\IndustryController@GetIndustry');
    Route::post('GetPersonPdfDetailByLink','App\Http\Controllers\API\mH5\PersonController@GetPersonPdfDetailByLink');//根据链接获取体检那边的pdf
    Route::post('H5GetAppointmentRecord','App\Http\Controllers\API\mH5\PersonController@H5GetAppointmentRecord');  //获取自己的预约记录
});


//对外接口
Route::group(['middleware'=>['check.sign','log'],'prefix'=>'v1'],function () {
    Route::post('CreateCheckupRecord','App\Http\Controllers\API\Admin\YeWu\HealthCheckupController@CreateRecord');  //创建预约记录
    Route::get('GetAppointmentRecord','App\Http\Controllers\API\Admin\YeWu\HealthCheckupController@GetAppointmentRecord');  //获取个人预约详情
    Route::get('CheckRequirements','App\Http\Controllers\API\Admin\YeWu\HealthCheckupController@CheckRequirements');  //检查是否能进行免费体检
    Route::post('UploadFile','App\Http\Controllers\API\Admin\YeWu\HealthCheckupController@UploadFile');  //上传体检报告pdf
    Route::get('GetPersonCheckUpList','App\Http\Controllers\API\Admin\YeWu\HealthCheckupController@GetPersonCheckUpList');//查询个人查询体检记录列表
    Route::get('GetPersonCheckUpDetail','App\Http\Controllers\API\Admin\YeWu\HealthCheckupController@GetPersonCheckUpDetail');//根据体检号查询体检详情
    Route::post('CreateAppointment','App\Http\Controllers\API\Admin\YeWu\AppointmentController@CreateAppointment');//创建预约记录
    Route::post('CreateCheckupPdf','App\Http\Controllers\API\Admin\YeWu\HealthCheckupController@CreateCheckupPdf');//对外接口，创建体检记录 姓名、电话、身份证、体检机构编码、体检号、pdfs
    Route::get('GetReportUrl','App\Http\Controllers\API\mH5\PersonController@GetReportUrl');//对外接口，获取用户体检报告url
    Route::post('DelCheckUpInfo','App\Http\Controllers\API\Admin\YeWu\HealthCheckupController@DelCheckUpInfo');//对外接口，删除体检记录
    Route::post('DelAppintmentInfo','App\Http\Controllers\API\Admin\YeWu\AppointmentController@DelAppintmentInfo');//对外接口，删除登记预约记录
    Route::post('Encrypt','App\Http\Controllers\API\Internal\HsmController@Encrypt');//加密

});
//给第三方非思信的接口
//对外接口
Route::group(['middleware'=>['check.sign','log'],'prefix'=>'s1'],function () {
    Route::post('GetAppointmentRecord','App\Http\Controllers\API\Internal\AppointmentController@GetAppointmentRecord');//获取预约记录
    Route::post('CreateCheckupRecord','App\Http\Controllers\API\Internal\CheckUpController@CreateCheckupRecord');//获取预约记录
    Route::post('UploadPdf','App\Http\Controllers\API\Internal\CheckUpController@UploadPdf');//获取预约记录
});
Route::post('healthCard/createInfo','App\Http\Controllers\API\Internal\HealthCertificateController@CreatInfo')->middleware('log');
Route::post('healthCard/uploadPdf','App\Http\Controllers\API\Internal\HealthCertificateController@uploadPdf')->middleware('log');

// 测试接口：验证 network_drive 上传链路
Route::post('testUploadNetworkDrive','App\Http\Controllers\API\UpLoadController@testUploadNetworkDrive');


Route::post('test','App\Http\Controllers\API\Admin\LoginController@test');
Route::any('XTSignNotify','App\Http\Controllers\API\XTSignController@Notify');
Route::post('XTSignCheckNotify','App\Http\Controllers\API\XTSignController@CheckNotify')->middleware('log');
Route::post('addSignJob','App\Http\Controllers\API\XTSignController@addSignJob')->middleware('log'); ; //添加签名任务展示二维码
Route::post('AppGetUserInfo','App\Http\Controllers\API\DxAppController@getUserInfo')->middleware('log');//大兴app根据userid查询用户信息
Route::post('UkeyGetServeInfo','App\Http\Controllers\API\UkeyController@GetServeInfo')->middleware('log');//Ukey登录获取服务器信息
Route::post('UkeyLogin','App\Http\Controllers\API\UkeyController@UkeyLogin')->middleware('log');//Ukey登录

//
Route::group(['middleware'=>['checktoken','log'],'prefix'=>'WeiHu'],function () {  //维护
    Route::post('TiJianGetList','App\Http\Controllers\API\WeiHu\TiJianListController@GetList');  //手机H5端用户注册
    Route::post('TiJianDel','App\Http\Controllers\API\WeiHu\TiJianListController@Del');  //手机H5端用户注册
});
