This commit is contained in:
Your Name
2026-03-20 13:56:40 +08:00
parent 7147c8e148
commit d765517b74
258 changed files with 2481 additions and 364 deletions
@@ -1014,6 +1014,7 @@ class DiagnosisLogic extends BaseLogic
// 获取小程序配置
$config = self::getMiniProgramConfig();
if (!$config) {
throw new \Exception('小程序配置未设置');
}
@@ -1022,7 +1023,7 @@ class DiagnosisLogic extends BaseLogic
// 调用微信接口生成小程序码
$qrcodeUrl = self::generateWxQrcode($config, $page, $scene);
if (!$qrcodeUrl) {
throw new \Exception('生成小程序码失败: ' . self::getError());
}
@@ -1122,7 +1123,7 @@ class DiagnosisLogic extends BaseLogic
if (!$accessToken) {
throw new \Exception('获取access_token失败: ' . self::getError());
}
// 调用微信接口生成小程序码
$url = "https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token={$accessToken}";
@@ -1213,7 +1214,7 @@ class DiagnosisLogic extends BaseLogic
// 从微信服务器获取
$url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid={$appId}&secret={$appSecret}";
$response = self::httpGet($url);
// 记录原始响应用于调试
\think\facade\Log::info('微信AccessToken响应: ' . $response);
@@ -1383,7 +1384,7 @@ class DiagnosisLogic extends BaseLogic
'user_id' => $userId,
'diagnosis_id' => $diagnosisId
])->find();
$now = time();
if ($record) {
@@ -1434,16 +1435,26 @@ class DiagnosisLogic extends BaseLogic
* @param int $patientId
* @return array|false
*/
public static function getCardList(int $patientId)
public static function getCardList(int $user_id)
{
try {
if (!$patientId) {
self::setError('患者ID不能为空');
if (!$user_id) {
self::setError('用户ID不能为空');
return false;
}
// 查询该患者的所有诊单
$cardList = Diagnosis::where('patient_id', $patientId)
// 从诊断查看记录表中获取该用户查看过的诊断ID列表
$viewRecords = \think\facade\Db::name('diagnosis_view_records')
->where('user_id', $user_id)
->where('delete_time', null)
->column('diagnosis_id');
if (empty($viewRecords)) {
return [];
}
// 根据诊断ID列表查询诊单详情
$cardList = Diagnosis::whereIn('id', $viewRecords)
->where('delete_time', null)
->field([
'id', 'patient_id', 'patient_name', 'gender', 'age',
@@ -1482,7 +1493,7 @@ class DiagnosisLogic extends BaseLogic
return $cardList;
} catch (\Exception $e) {
\think\facade\Log::error('获取就诊卡列表失败 - patient_id: ' . $patientId . ', error: ' . $e->getMessage());
\think\facade\Log::error('获取就诊卡列表失败 - user_id: ' . $user_id . ', error: ' . $e->getMessage());
self::setError($e->getMessage());
return false;
}