## 安装

- git clone 到本地
- 执行 `composer install` 创建好数据库
- 配置 **.env** 中数据库连接信息,没有.env请复制.env.example命名为.env
- 执行 `php artisan key:generate`
- 执行 `php artisan migrate`
- 执行 `php artisan db:seed`
- 执行 `php artisan passport:install`
- 执行 `php artisan vendor:publish --tag=laravel-admin-grid-lightbox`
- 执行 `php artisan vendor:publish --tag=laravel-admin-wang-editor2`
- storage下所有目录 和 bootstrap/cache 目录应该是可写的
- 键入 '域名/admin/auth/login'(后台登录)
- 用户名：admin；密码：admin

- 生成文档 php artisan l5-swagger:generate 
- api文档在api/documentation里面, 也可以看上面的 `在线api文档`
- api文档接口调试授权生成器请在`config/l5-swagger.php`配置
 
 
## cron计划任务自动监听
 linux执行: crontab -e
  
     <!-- 添加一条新的记录 -->
     * * * * * /php目录/bin/php /项目目录/artisan cron:run > /dev/null 2>&1

## 微信接口已经集成（不用这个就需要自己编写）
- overtrue/laravel-wechat:~5.0 需要在config/wechat.php下配置相关信息
- overtrue/wechat(目前使用)
## passport 8.0
获取client ID 和 秘钥（用于swagger接口调试申请token）

    php artisan passport:client --password 

## USEFUL LINK
- transformer [fractal](http://fractal.thephpleague.com/)
- apizza https://apizza.net/pro/#/project/3b5527149ee5681048874c0771678232/browse

##composer 拓展安装
- 编辑器
- 后台图片工具

##后台定时命令
订单超时 每日11:00执行
cd /www/wwwroot/BaoMa && php artisan order orderOut<br>
预约超时 每日11:00 执行
cd /www/wwwroot/BaoMa && php artisan order appiontOut<br>
认证到期 每日11:00 执行
cd /www/wwwroot/BaoMa && php artisan order thenOut<br>
认证失效 每日11:00 执行
cd /www/wwwroot/BaoMa && php artisan order thenLose<br>
排班提醒 每日00:00 执行
cd /www/wwwroot/BaoMa && php artisan  scheduleNotice<br>
服务包过期 每10分钟执行
cd /www/wwwroot/BaoMa && php artisan  packExpiredCheck<br>

# 数据清空语句
delete from bm_cdms_users where id > 1;<br>
delete from bm_cdms_role_users where user_id >1;<br>
delete from bm_admin_operation_log;<br>
delete from bm_cdms_operation_log;<br>
delete from bm_articles;<br>
delete from bm_axb;<br>
delete from bm_call_logs;<br>
delete from bm_call_phone;<br>
delete from bm_collections;<br>
delete from bm_community_notice;<br>
delete from bm_coupon_distribution_list;<br>
delete from bm_coupon_types;<br>
delete from bm_coupons;<br>
delete from bm_docter_messages;<br>
delete from bm_docter_organization;<br>
delete from bm_docter_service_times;<br>
delete from bm_docter_settings;<br>
delete from bm_docter_times;<br>
delete from bm_docter_user;<br>
delete from bm_docter_verify;<br>
delete from bm_docters;<br>
delete from bm_evaluates;<br>
delete from bm_feedbacks;<br>
delete from bm_im_message;<br>
delete from bm_menubar;<br>
delete from bm_notices;<br>
delete from bm_nurses;<br>
delete from bm_order_nurses;<br>
delete from bm_order_packs;<br>
delete from bm_order_patients;<br>
delete from bm_order_vaccines;<br>
delete from bm_orders;<br>
delete from bm_organization_settings;<br>
delete from bm_organization_vaccines;<br>
delete from bm_patient_remarks;<br>
delete from bm_patients;<br>
delete from bm_payments;<br>
delete from bm_qualifications;<br>
delete from bm_schedule_periods;<br>
delete from bm_schedules;<br>
delete from bm_self_schedule;<br>
delete from bm_servebanners;<br>
delete from bm_service_applys;<br>
delete from bm_service_packs;<br>
delete from bm_suggests;<br>
delete from bm_suggests_detail;<br>
delete from bm_team_docters;<br>
delete from bm_teams;<br>
delete from bm_time_periods;<br>
delete from bm_user_balance_logs;<br>
delete from bm_user_coupons;<br>
delete from bm_user_docter;<br>
delete from bm_user_messages;<br>
delete from bm_users;<br>
delete from bm_vaccines;<br>
delete from bm_week_schedule;<br>
delete from bm_organizations;<br>
delete from bm_refund_application;<br>


## 清空用户数据
delete  from bm_order_packs where order_id in (select id from bm_orders where user_id =10007 );<br>
delete  from bm_order_patients where order_id in (select id from bm_orders where user_id =10007 );<br>
delete  from bm_order_vaccines where order_id in (select id from bm_orders where user_id =10007 );<br>
delete  from bm_order_nurses where order_id in (select id from bm_orders where user_id = 10007);<br>
delete from bm_feedbacks  where user_id =10007;<br> 
delete  from bm_users where id = 10007;<br>
delete  from bm_orders where user_id = 10007;<br>


## 清空医生数据
delete from bm_docter_settings where docter_id  = 1007;<br>
delete  from bm_order_packs where order_id in (select docter_id from bm_orders where docter_id=10007 );<br>
delete  from bm_order_patients where order_id in (select id from bm_orders where docter_id=10007 );<br>
delete  from bm_order_vaccines where order_id in (select id from bm_orders where docter_id=10007 );<br>
delete  from bm_order_nurses where order_id in (select id from bm_orders where docter_id= 10007);<br>
delete from bm_docters where id = 10007;<br>
delete from bm_docter_organization where docter_id  = 10007;<br>

# 导入用户数据
##  导入用户数据要严格按照顺序来执行
1. 导入机构表
    - php artisan import:importDocter organization organization
2. 导入医生表
    -  php artisan import:importDocter docter docter
3. 导入机构科室表 
    - php artisan import:importDocter organization_office office
4. 导入用户表
    - php artisan import:importUser user user
5. 导入患者表
    - php artisan import:importUser patients patients

# 导入订单数据
## 导入订单数据之前必须要导入用户数据，否则会报错
- php artisan importOrder nurse nurseOrder
- php artisan importOrder service order
- php artisan importOrder vaccine vaccineOrder
- php artisan importOrder chat chatOrder
- php artisan importOrder phone phoneOrder


