96 lines
2.4 KiB
PHP
Executable File
96 lines
2.4 KiB
PHP
Executable File
<?php
|
|
|
|
namespace app\adminapi\controller\doctor;
|
|
|
|
use app\adminapi\controller\BaseAdminController;
|
|
use app\adminapi\lists\doctor\RosterLists;
|
|
use app\adminapi\logic\doctor\RosterLogic;
|
|
use app\adminapi\validate\doctor\RosterValidate;
|
|
|
|
/**
|
|
* 医生排班控制器
|
|
* Class RosterController
|
|
* @package app\adminapi\controller\doctor
|
|
*/
|
|
class RosterController extends BaseAdminController
|
|
{
|
|
/**
|
|
* @notes 排班列表
|
|
* @return \think\response\Json
|
|
*/
|
|
public function lists()
|
|
{
|
|
return $this->dataLists(new RosterLists());
|
|
}
|
|
|
|
/**
|
|
* @notes 保存排班(新增或更新)
|
|
* @return \think\response\Json
|
|
*/
|
|
public function save()
|
|
{
|
|
$post = request()->post();
|
|
$defaults = [];
|
|
if (empty($post['period'])) {
|
|
$defaults['period'] = 'segment';
|
|
}
|
|
$params = (new RosterValidate())->post()->goCheck('save', $defaults);
|
|
$result = RosterLogic::save($params);
|
|
if ($result === false) {
|
|
return $this->fail(RosterLogic::getError());
|
|
}
|
|
|
|
return $this->success('保存成功', $result);
|
|
}
|
|
|
|
/**
|
|
* @notes 删除排班
|
|
* @return \think\response\Json
|
|
*/
|
|
public function delete()
|
|
{
|
|
$params = (new RosterValidate())->post()->goCheck('delete');
|
|
RosterLogic::delete($params);
|
|
return $this->success('删除成功');
|
|
}
|
|
|
|
/**
|
|
* @notes 排班详情
|
|
* @return \think\response\Json
|
|
*/
|
|
public function detail()
|
|
{
|
|
$params = (new RosterValidate())->goCheck('detail');
|
|
$result = RosterLogic::detail($params);
|
|
return $this->data($result);
|
|
}
|
|
|
|
/**
|
|
* @notes 批量保存排班
|
|
* @return \think\response\Json
|
|
*/
|
|
public function batchSave()
|
|
{
|
|
$params = (new RosterValidate())->post()->goCheck('batchSave');
|
|
$result = RosterLogic::batchSave($params);
|
|
if ($result === false) {
|
|
return $this->fail(RosterLogic::getError());
|
|
}
|
|
return $this->success('批量保存成功', $result);
|
|
}
|
|
|
|
/**
|
|
* @notes 复制排班
|
|
* @return \think\response\Json
|
|
*/
|
|
public function copy()
|
|
{
|
|
$params = (new RosterValidate())->post()->goCheck('copy');
|
|
$result = RosterLogic::copy($params);
|
|
if ($result === false) {
|
|
return $this->fail(RosterLogic::getError());
|
|
}
|
|
return $this->success('复制成功', []);
|
|
}
|
|
}
|