first commit
This commit is contained in:
@@ -0,0 +1,198 @@
|
||||
<?php
|
||||
|
||||
namespace app\adminapi\controller\doctor;
|
||||
|
||||
use app\adminapi\controller\BaseAdminController;
|
||||
use app\adminapi\lists\doctor\AppointmentLists;
|
||||
use app\adminapi\logic\doctor\AppointmentLogic;
|
||||
use app\adminapi\logic\doctor\DoctorNoteLogic;
|
||||
use app\adminapi\validate\doctor\AppointmentValidate;
|
||||
|
||||
/**
|
||||
* 医生预约控制器
|
||||
* Class AppointmentController
|
||||
* @package app\adminapi\controller\doctor
|
||||
*/
|
||||
class AppointmentController extends BaseAdminController
|
||||
{
|
||||
/**
|
||||
* @notes 获取可用时间段
|
||||
* @return \think\response\Json
|
||||
*/
|
||||
public function availableSlots()
|
||||
{
|
||||
$params = (new AppointmentValidate())->goCheck('availableSlots');
|
||||
$result = AppointmentLogic::getAvailableSlots($params);
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 创建预约
|
||||
* @return \think\response\Json
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
$params = (new AppointmentValidate())->post()->goCheck('create');
|
||||
$params['assistant_id'] = $this->adminId;
|
||||
$result = AppointmentLogic::create($params, $this->adminId, $this->adminInfo);
|
||||
if ($result === false) {
|
||||
return $this->fail(AppointmentLogic::getError());
|
||||
}
|
||||
return $this->success('预约成功', $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 取消预约
|
||||
* @return \think\response\Json
|
||||
*/
|
||||
public function cancel()
|
||||
{
|
||||
$params = (new AppointmentValidate())->post()->goCheck('cancel');
|
||||
$result = AppointmentLogic::cancel($params, $this->adminId, $this->adminInfo);
|
||||
if ($result === false) {
|
||||
return $this->fail(AppointmentLogic::getError());
|
||||
}
|
||||
return $this->success('取消成功');
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 预约列表
|
||||
* @return \think\response\Json
|
||||
*/
|
||||
public function lists()
|
||||
{
|
||||
return $this->dataLists(new AppointmentLists());
|
||||
}
|
||||
|
||||
/**
|
||||
* 后台编辑挂号记录(消费者处方-挂号列表等,perms: doctor.appointment/edit)
|
||||
*/
|
||||
public function edit()
|
||||
{
|
||||
$params = (new AppointmentValidate())->post()->goCheck('adminEdit');
|
||||
$post = $this->request->post();
|
||||
if (array_key_exists('assistant_id', $post)) {
|
||||
$params['assistant_id'] = $post['assistant_id'];
|
||||
}
|
||||
$result = AppointmentLogic::adminEdit($params, $this->adminId, $this->adminInfo);
|
||||
if ($result === false) {
|
||||
return $this->fail(AppointmentLogic::getError());
|
||||
}
|
||||
|
||||
return $this->success('保存成功');
|
||||
}
|
||||
|
||||
/** 批量修改挂号渠道来源(消费者处方-挂号列表) */
|
||||
public function batchEditChannel()
|
||||
{
|
||||
$params = (new AppointmentValidate())->post()->goCheck('batchEditChannel');
|
||||
$post = $this->request->post();
|
||||
if (\array_key_exists('channel_source_detail', $post)) {
|
||||
$params['channel_source_detail'] = $post['channel_source_detail'];
|
||||
}
|
||||
$result = AppointmentLogic::adminBatchEditChannel($params, $this->adminId, $this->adminInfo);
|
||||
if ($result === false) {
|
||||
return $this->fail(AppointmentLogic::getError());
|
||||
}
|
||||
|
||||
return $this->success((string) ($result['msg'] ?? '操作成功'), $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 预约详情
|
||||
* @return \think\response\Json
|
||||
*/
|
||||
public function detail()
|
||||
{
|
||||
$params = (new AppointmentValidate())->goCheck('detail');
|
||||
$result = AppointmentLogic::detail($params);
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 获取医生可用号源数
|
||||
* @return \think\response\Json
|
||||
*/
|
||||
public function doctorAvailability()
|
||||
{
|
||||
$doctorId = $this->request->get('doctor_id');
|
||||
$date = $this->request->get('date');
|
||||
|
||||
if (!$doctorId || !$date) {
|
||||
return $this->fail('参数错误');
|
||||
}
|
||||
|
||||
$availableCount = AppointmentLogic::getDoctorAvailability($doctorId, $date);
|
||||
return $this->data(['available_count' => $availableCount]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 完成预约
|
||||
* @return \think\response\Json
|
||||
*/
|
||||
public function complete()
|
||||
{
|
||||
$params = (new AppointmentValidate())->post()->goCheck('complete');
|
||||
$result = AppointmentLogic::complete($params);
|
||||
if ($result === false) {
|
||||
return $this->fail(AppointmentLogic::getError());
|
||||
}
|
||||
return $this->success('操作成功');
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 接诊台聚合详情(患者信息 + 诊单病例 + 血糖血压记录)
|
||||
* @return \think\response\Json
|
||||
*/
|
||||
public function reception()
|
||||
{
|
||||
$params = (new AppointmentValidate())->goCheck('reception');
|
||||
$result = AppointmentLogic::reception($params);
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 通知接诊医助(发企业微信)
|
||||
* @return \think\response\Json
|
||||
*/
|
||||
public function notifyAssistant()
|
||||
{
|
||||
$params = (new AppointmentValidate())->post()->goCheck('notifyAssistant');
|
||||
$result = AppointmentLogic::notifyAssistant((int) $params['id']);
|
||||
if (empty($result['ok'])) {
|
||||
return $this->fail($result['message'] ?? '通知失败');
|
||||
}
|
||||
return $this->success('通知已发送');
|
||||
}
|
||||
|
||||
public function addDoctorNote()
|
||||
{
|
||||
$params = (new AppointmentValidate())->post()->goCheck('addDoctorNote');
|
||||
$params['doctor_id'] = $this->adminId;
|
||||
$result = DoctorNoteLogic::addOrAppend($params);
|
||||
if ($result === false) {
|
||||
return $this->fail(DoctorNoteLogic::getError());
|
||||
}
|
||||
return $this->success('保存成功');
|
||||
}
|
||||
|
||||
public function doctorNotes()
|
||||
{
|
||||
$params = (new AppointmentValidate())->goCheck('doctorNotes');
|
||||
return $this->data(DoctorNoteLogic::getByDiagnosis((int) $params['diagnosis_id']));
|
||||
}
|
||||
|
||||
public function deleteDoctorNoteImage()
|
||||
{
|
||||
$params = (new AppointmentValidate())->post()->goCheck('deleteDoctorNoteImage');
|
||||
$result = DoctorNoteLogic::deleteImage(
|
||||
(int) $params['note_id'],
|
||||
$params['image_type'],
|
||||
$params['image_path']
|
||||
);
|
||||
if ($result === false) {
|
||||
return $this->fail(DoctorNoteLogic::getError());
|
||||
}
|
||||
return $this->success('删除成功');
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
<?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('复制成功', []);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?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());
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 部门统计列表
|
||||
* @return \think\response\Json
|
||||
*/
|
||||
public function deptLists()
|
||||
{
|
||||
return $this->dataLists(new StatisticsLists('dept'));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user