新增
This commit is contained in:
@@ -5,6 +5,7 @@ declare(strict_types=1);
|
||||
namespace app\adminapi\controller\tcm;
|
||||
|
||||
use app\adminapi\controller\BaseAdminController;
|
||||
use app\adminapi\logic\tcm\PrescriptionLibraryAiLogic;
|
||||
use app\adminapi\logic\tcm\PrescriptionLibraryLogic;
|
||||
use app\adminapi\validate\tcm\PrescriptionLibraryValidate;
|
||||
|
||||
@@ -77,4 +78,74 @@ class PrescriptionLibraryController extends BaseAdminController
|
||||
}
|
||||
return $this->data($detail);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 读取已保存的双模型 AI 解释,不触发上游调用
|
||||
*/
|
||||
public function aiReports()
|
||||
{
|
||||
$params = (new PrescriptionLibraryValidate())->get()->goCheck('aiReports');
|
||||
$reports = PrescriptionLibraryAiLogic::getSavedReports(
|
||||
(int) $params['id'],
|
||||
$this->adminId,
|
||||
$this->adminInfo
|
||||
);
|
||||
if ($reports === null) {
|
||||
return $this->fail(PrescriptionLibraryAiLogic::getError());
|
||||
}
|
||||
return $this->data($reports);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 查询当前数据范围内完全没有 AI 报告的处方,不触发上游调用
|
||||
*/
|
||||
public function missingAiReports()
|
||||
{
|
||||
$params = (new PrescriptionLibraryValidate())->get()->goCheck('missingAiReports');
|
||||
$result = PrescriptionLibraryAiLogic::getMissingReports(
|
||||
(int) ($params['limit'] ?? 500),
|
||||
$this->adminId,
|
||||
$this->adminInfo
|
||||
);
|
||||
if ($result === null) {
|
||||
return $this->fail(PrescriptionLibraryAiLogic::getError());
|
||||
}
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 整份重新生成两个固定模型的 AI 解释并保存成功项
|
||||
*/
|
||||
public function generateAiReports()
|
||||
{
|
||||
$params = (new PrescriptionLibraryValidate())->post()->goCheck('generateAiReports');
|
||||
$reports = PrescriptionLibraryAiLogic::generateAll(
|
||||
(int) $params['id'],
|
||||
$this->adminId,
|
||||
$this->adminInfo
|
||||
);
|
||||
if ($reports === null) {
|
||||
return $this->fail(PrescriptionLibraryAiLogic::getError());
|
||||
}
|
||||
return $this->data($reports);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 编辑一份已保存的 AI 解释
|
||||
*/
|
||||
public function editAiReport()
|
||||
{
|
||||
$params = (new PrescriptionLibraryValidate())->post()->goCheck('editAiReport');
|
||||
$report = PrescriptionLibraryAiLogic::editReport(
|
||||
(int) $params['id'],
|
||||
(int) $params['report_id'],
|
||||
$params['content'] ?? null,
|
||||
$this->adminId,
|
||||
$this->adminInfo
|
||||
);
|
||||
if ($report === null) {
|
||||
return $this->fail(PrescriptionLibraryAiLogic::getError());
|
||||
}
|
||||
return $this->data($report);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user