This commit is contained in:
Your Name
2026-03-23 18:02:16 +08:00
parent 18fee2e8f8
commit 250d173c2f
525 changed files with 10659 additions and 793 deletions
@@ -36,7 +36,7 @@ class UploadController extends BaseAdminController
{
try {
$cid = $this->request->post('cid', 0);
$result = UploadService::image($cid);
$result = UploadService::image($cid, $this->adminId);
return $this->success('上传成功', $result);
} catch (Exception $e) {
return $this->fail($e->getMessage());
@@ -53,7 +53,7 @@ class UploadController extends BaseAdminController
{
try {
$cid = $this->request->post('cid', 0);
$result = UploadService::video($cid);
$result = UploadService::video($cid, $this->adminId);
return $this->success('上传成功', $result);
} catch (Exception $e) {
return $this->fail($e->getMessage());
@@ -70,7 +70,7 @@ class UploadController extends BaseAdminController
{
try {
$cid = $this->request->post('cid', 0);
$result = UploadService::file($cid);
$result = UploadService::file($cid, $this->adminId);
return $this->success('上传成功', $result);
} catch (Exception $e) {
return $this->fail($e->getMessage());
@@ -283,6 +283,44 @@ class DiagnosisController extends BaseAdminController
$result = DiagnosisLogic::getCallRecords($params);
return $this->data($result);
}
/**
* @notes 获取诊单关联的腾讯云 IM 单聊记录(admin_getroammsg
*/
public function getImChatMessages()
{
$diagnosisId = (int)$this->request->get('diagnosis_id', 0);
if ($diagnosisId <= 0) {
return $this->fail('诊单ID不能为空');
}
$result = DiagnosisLogic::getImChatMessagesForDiagnosis($diagnosisId);
if ($result === false) {
return $this->fail(DiagnosisLogic::getError());
}
return $this->data($result);
}
/**
* @notes 绑定 TRTC 房间号到当前诊单通话记录(便于云端录制回调关联)
* @return \think\response\Json
*/
public function bindCallRoom()
{
$params = $this->request->post();
if (empty($params['diagnosis_id'])) {
return $this->fail('诊单ID不能为空');
}
if (empty($params['room_id'])) {
return $this->fail('房间号不能为空');
}
$result = DiagnosisLogic::bindCallRoom($params);
if ($result) {
return $this->success('绑定成功', [], 1, 1);
}
return $this->fail(DiagnosisLogic::getError());
}
/**
* @notes 获取患者通话签名(用于测试)
* @return \think\response\Json
@@ -13,6 +13,14 @@ use app\adminapi\validate\tcm\PrescriptionValidate;
*/
class PrescriptionController extends BaseAdminController
{
/**
* @notes 处方列表
*/
public function lists()
{
return $this->dataLists(new \app\adminapi\lists\tcm\PrescriptionLists());
}
/**
* @notes 添加处方
*/
@@ -27,6 +35,32 @@ class PrescriptionController extends BaseAdminController
return $this->success('保存成功', ['id' => $id]);
}
/**
* @notes 编辑处方
*/
public function edit()
{
$params = (new PrescriptionValidate())->post()->goCheck('edit');
$result = PrescriptionLogic::edit($params, $this->adminId);
if (!$result) {
return $this->fail(PrescriptionLogic::getError());
}
return $this->success('编辑成功');
}
/**
* @notes 删除处方
*/
public function delete()
{
$params = (new PrescriptionValidate())->post()->goCheck('delete');
$result = PrescriptionLogic::delete($params['id']);
if (!$result) {
return $this->fail(PrescriptionLogic::getError());
}
return $this->success('删除成功');
}
/**
* @notes 处方详情
*/
@@ -0,0 +1,77 @@
<?php
declare(strict_types=1);
namespace app\adminapi\controller\tcm;
use app\adminapi\controller\BaseAdminController;
use app\adminapi\logic\tcm\PrescriptionLibraryLogic;
use app\adminapi\validate\tcm\PrescriptionLibraryValidate;
/**
* 处方库控制器
*/
class PrescriptionLibraryController extends BaseAdminController
{
/**
* @notes 处方库列表
*/
public function lists()
{
return $this->dataLists(new \app\adminapi\lists\tcm\PrescriptionLibraryLists());
}
/**
* @notes 添加处方库
*/
public function add()
{
$params = (new PrescriptionLibraryValidate())->post()->goCheck('add');
$params['creator_id'] = $this->adminId;
$params['creator_name'] = $this->adminInfo['name'] ?? '';
$id = PrescriptionLibraryLogic::add($params);
if ($id === null) {
return $this->fail(PrescriptionLibraryLogic::getError());
}
return $this->success('保存成功', ['id' => $id]);
}
/**
* @notes 编辑处方库
*/
public function edit()
{
$params = (new PrescriptionLibraryValidate())->post()->goCheck('edit');
$result = PrescriptionLibraryLogic::edit($params, $this->adminId);
if (!$result) {
return $this->fail(PrescriptionLibraryLogic::getError());
}
return $this->success('编辑成功');
}
/**
* @notes 删除处方库
*/
public function delete()
{
$params = (new PrescriptionLibraryValidate())->post()->goCheck('delete');
$result = PrescriptionLibraryLogic::delete($params['id'], $this->adminId);
if (!$result) {
return $this->fail(PrescriptionLibraryLogic::getError());
}
return $this->success('删除成功');
}
/**
* @notes 处方库详情
*/
public function detail()
{
$params = (new PrescriptionLibraryValidate())->get()->goCheck('detail');
$detail = PrescriptionLibraryLogic::detail((int)$params['id'], $this->adminId);
if (!$detail) {
return $this->fail('处方不存在或无权限查看');
}
return $this->data($detail);
}
}