更新
This commit is contained in:
@@ -24,7 +24,7 @@ use app\adminapi\validate\LoginValidate;
|
||||
*/
|
||||
class LoginController extends BaseAdminController
|
||||
{
|
||||
public array $notNeedLogin = ['account', 'workWechatConfig', 'workWechatLogin', 'checkDbColumn'];
|
||||
public array $notNeedLogin = ['account', 'workWechatConfig', 'workWechatLogin', 'checkDbColumn', 'changeFirstPassword'];
|
||||
|
||||
/**
|
||||
* @notes 账号登录
|
||||
@@ -101,6 +101,41 @@ class LoginController extends BaseAdminController
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 首次登录修改密码
|
||||
* @return \think\response\Json
|
||||
*/
|
||||
public function changeFirstPassword()
|
||||
{
|
||||
$password = $this->request->post('password', '');
|
||||
$passwordConfirm = $this->request->post('password_confirm', '');
|
||||
|
||||
if (empty($password)) {
|
||||
return $this->fail('请输入新密码');
|
||||
}
|
||||
|
||||
if (strlen($password) < 6) {
|
||||
return $this->fail('密码长度不能少于6位');
|
||||
}
|
||||
|
||||
if ($password !== $passwordConfirm) {
|
||||
return $this->fail('两次输入的密码不一致');
|
||||
}
|
||||
|
||||
$token = $this->request->header('token');
|
||||
if (empty($token)) {
|
||||
return $this->fail('请先登录');
|
||||
}
|
||||
|
||||
$result = (new LoginLogic())->changeFirstPassword($token, $password);
|
||||
|
||||
if ($result === false) {
|
||||
return $this->fail(LoginLogic::getError());
|
||||
}
|
||||
|
||||
return $this->success('密码修改成功');
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 退出登录
|
||||
* @return \think\response\Json
|
||||
|
||||
@@ -32,6 +32,7 @@ class AppointmentController extends BaseAdminController
|
||||
public function create()
|
||||
{
|
||||
$params = (new AppointmentValidate())->post()->goCheck('create');
|
||||
$params['assistant_id'] = $this->adminId;
|
||||
$result = AppointmentLogic::create($params);
|
||||
if ($result === false) {
|
||||
return $this->fail(AppointmentLogic::getError());
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
namespace app\adminapi\controller\doctor;
|
||||
|
||||
use app\adminapi\controller\BaseAdminController;
|
||||
use app\adminapi\lists\doctor\MedicineLists;
|
||||
use app\adminapi\logic\doctor\MedicineLogic;
|
||||
use app\adminapi\validate\doctor\MedicineValidate;
|
||||
|
||||
/**
|
||||
* 药品库控制器
|
||||
*/
|
||||
class MedicineController extends BaseAdminController
|
||||
{
|
||||
/**
|
||||
* 药品列表
|
||||
*/
|
||||
public function lists()
|
||||
{
|
||||
return $this->dataLists(new MedicineLists());
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加药品
|
||||
*/
|
||||
public function add()
|
||||
{
|
||||
$params = (new MedicineValidate())->post()->goCheck('add');
|
||||
$result = MedicineLogic::add($params);
|
||||
if ($result) {
|
||||
return $this->success('添加成功', [], 1, 1);
|
||||
}
|
||||
return $this->fail(MedicineLogic::getError());
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑药品
|
||||
*/
|
||||
public function edit()
|
||||
{
|
||||
$params = (new MedicineValidate())->post()->goCheck('edit');
|
||||
$result = MedicineLogic::edit($params);
|
||||
if ($result) {
|
||||
return $this->success('编辑成功', [], 1, 1);
|
||||
}
|
||||
return $this->fail(MedicineLogic::getError());
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除药品
|
||||
*/
|
||||
public function delete()
|
||||
{
|
||||
$params = (new MedicineValidate())->post()->goCheck('delete');
|
||||
MedicineLogic::delete($params);
|
||||
return $this->success('删除成功', [], 1, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* 药品详情
|
||||
*/
|
||||
public function detail()
|
||||
{
|
||||
$params = (new MedicineValidate())->goCheck('detail');
|
||||
$result = MedicineLogic::detail($params);
|
||||
return $this->data($result);
|
||||
}
|
||||
}
|
||||
@@ -29,8 +29,17 @@ class RosterController extends BaseAdminController
|
||||
*/
|
||||
public function save()
|
||||
{
|
||||
$params = (new RosterValidate())->post()->goCheck('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);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace app\adminapi\controller\doctor;
|
||||
|
||||
use app\adminapi\controller\BaseAdminController;
|
||||
use app\adminapi\lists\doctor\StatisticsLists;
|
||||
|
||||
/**
|
||||
* 医生统计控制器
|
||||
* Class StatisticsController
|
||||
* @package app\adminapi\controller\doctor
|
||||
*/
|
||||
class StatisticsController extends BaseAdminController
|
||||
{
|
||||
/**
|
||||
* @notes 医生诊单统计列表
|
||||
* @return \think\response\Json
|
||||
*/
|
||||
public function lists()
|
||||
{
|
||||
return $this->dataLists(new StatisticsLists());
|
||||
}
|
||||
}
|
||||
@@ -263,7 +263,7 @@ class DiagnosisController extends BaseAdminController
|
||||
|
||||
$result = DiagnosisLogic::endCall($params);
|
||||
if ($result) {
|
||||
return $this->success('结束通话成功', [], 1, 1);
|
||||
return $this->success('', [], 1, 1);
|
||||
}
|
||||
return $this->fail(DiagnosisLogic::getError());
|
||||
}
|
||||
@@ -317,7 +317,7 @@ class DiagnosisController extends BaseAdminController
|
||||
$params['admin_id'] = (int)$this->adminId;
|
||||
$result = DiagnosisLogic::bindCallRoom($params);
|
||||
if ($result) {
|
||||
return $this->success('绑定成功', [], 1, 1);
|
||||
return $this->success('', [], 1, 1);
|
||||
}
|
||||
return $this->fail(DiagnosisLogic::getError());
|
||||
}
|
||||
|
||||
@@ -42,7 +42,8 @@ class PrescriptionLibraryController extends BaseAdminController
|
||||
public function edit()
|
||||
{
|
||||
$params = (new PrescriptionLibraryValidate())->post()->goCheck('edit');
|
||||
$result = PrescriptionLibraryLogic::edit($params, $this->adminId);
|
||||
$canAll = PrescriptionLibraryLogic::canManageAllPrescriptions($this->adminId, $this->adminInfo);
|
||||
$result = PrescriptionLibraryLogic::edit($params, $this->adminId, $canAll);
|
||||
if (!$result) {
|
||||
return $this->fail(PrescriptionLibraryLogic::getError());
|
||||
}
|
||||
@@ -55,7 +56,8 @@ class PrescriptionLibraryController extends BaseAdminController
|
||||
public function delete()
|
||||
{
|
||||
$params = (new PrescriptionLibraryValidate())->post()->goCheck('delete');
|
||||
$result = PrescriptionLibraryLogic::delete($params['id'], $this->adminId);
|
||||
$canAll = PrescriptionLibraryLogic::canManageAllPrescriptions($this->adminId, $this->adminInfo);
|
||||
$result = PrescriptionLibraryLogic::delete((int) $params['id'], $this->adminId, $canAll);
|
||||
if (!$result) {
|
||||
return $this->fail(PrescriptionLibraryLogic::getError());
|
||||
}
|
||||
@@ -68,7 +70,8 @@ class PrescriptionLibraryController extends BaseAdminController
|
||||
public function detail()
|
||||
{
|
||||
$params = (new PrescriptionLibraryValidate())->get()->goCheck('detail');
|
||||
$detail = PrescriptionLibraryLogic::detail((int)$params['id'], $this->adminId);
|
||||
$canAll = PrescriptionLibraryLogic::canManageAllPrescriptions($this->adminId, $this->adminInfo);
|
||||
$detail = PrescriptionLibraryLogic::detail((int) $params['id'], $this->adminId, $canAll);
|
||||
if (!$detail) {
|
||||
return $this->fail('处方不存在或无权限查看');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user