This commit is contained in:
2024-07-17 19:08:04 +08:00
parent 8b6a279ff6
commit f0b052b9cb

View File

@@ -55,11 +55,11 @@ class Reportty
return json(Tools::set_fail('用户不存在')); return json(Tools::set_fail('用户不存在'));
} }
$day3 = date('Y-m-d 00:00:00',strtotime('-3 day')); //$day3 = date('Y-m-d 00:00:00',strtotime('-3 day'));
$his_record = Db::table('fa_ty_chathistory') $his_record = Db::table('fa_ty_chathistory')
//->where('username',$user['username']) //->where('username',$user['username'])
->order('id asc') ->order('id asc')
->where('createtime','>',$day3)//3天之内 //->where('createtime','>',$day3)//3天之内
->select(); ->select();
$config = [ $config = [
'stream'=>false, 'stream'=>false,
@@ -72,7 +72,7 @@ class Reportty
} }
$chatobj->setBefore($content); $chatobj->setBefore($content);
$chatobj->chat($question,$config,$answer_json_arr); $chatobj->returnAnswer($question,$config,$answer_json_arr);
//把返回的报告保存起来 //把返回的报告保存起来
foreach ($answer_json_arr as $josn){ foreach ($answer_json_arr as $josn){
$item = json_decode($josn,true); $item = json_decode($josn,true);
@@ -81,12 +81,13 @@ class Reportty
$data = [ $data = [
'doctor'=>$user['username'], 'doctor'=>$user['username'],
//病人 //病人
'username'=>Db::table('fa_ty_users')->where('doctor',$user['username'])->value('username'), //'username'=>Db::table('fa_ty_users')->where('doctor',$user['username'])->value('username'),
'report_content'=>$choice['message']['content'], 'report_content'=>$choice['message']['content'],
]; ];
Db::table('fa_ty_medical_report')->insert($data); Db::table('fa_ty_medical_report')->insert($data);
} }
} }
return json(Tools::set_ok());
} }