diff --git a/app/Admin/Controllers/PatientRecordController.php b/app/Admin/Controllers/PatientRecordController.php index be294d8..96ea55c 100644 --- a/app/Admin/Controllers/PatientRecordController.php +++ b/app/Admin/Controllers/PatientRecordController.php @@ -93,7 +93,7 @@ class PatientRecordController extends AdminController amisMake()->DateTimeControl()->name('next_treat_at')->label(__('patient-record.next_treat_at')), amisMake()->SelectControl()->options($this->getAdminUserOptions())->searchable()->name('notify_user_id')->label(__('patient-record.notify_user_id')), amisMake()->DateControl()->name('notify_at')->label(__('patient-record.notify_at')), - amisMake()->TextControl()->name('notify_remarks')->label(__('patient-record.notify_remarks')), + // amisMake()->TextControl()->name('notify_remarks')->label(__('patient-record.notify_remarks')), amisMake()->TextControl()->label(__('patient-record.creator_id'))->value($this->user()->name)->readonly(), ]); } @@ -114,7 +114,7 @@ class PatientRecordController extends AdminController amisMake()->DateTimeControl()->name('next_treat_at')->label(__('patient-record.next_treat_at'))->static(), amisMake()->TextControl()->name('notify_user.name')->label(__('patient-record.notify_user_id'))->static(), amisMake()->DateControl()->name('notify_at')->label(__('patient-record.notify_at'))->static(), - amisMake()->TextControl()->name('notify_remarks')->label(__('patient-record.notify_remarks'))->static(), + // amisMake()->TextControl()->name('notify_remarks')->label(__('patient-record.notify_remarks'))->static(), amisMake()->SelectControl()->options($this->getAdminUserOptions())->name('creator_id')->label(__('patient-record.creator_id'))->static(), amisMake()->DateTimeControl()->name('created_at')->label(__('patient.created_at'))->static(), ]); diff --git a/app/Console/Commands/PatientRecordNotify.php b/app/Console/Commands/PatientRecordNotify.php index 55845bc..019d5d5 100644 --- a/app/Console/Commands/PatientRecordNotify.php +++ b/app/Console/Commands/PatientRecordNotify.php @@ -30,8 +30,9 @@ class PatientRecordNotify extends Command public function handle() { $now = now(); - $list = PatientRecord::where('is_notified', 0) + $list = PatientRecord::with(['patient'])->where('is_notified', 0) ->whereNotNull('notify_user_id') + ->whereNotNull('next_treat_at') ->whereBetween('notify_at', [$now->copy()->startOfDay(), $now->copy()->endOfDay()]) ->get(); $app = EasyWeChat::officialAccount(); @@ -50,9 +51,16 @@ class PatientRecordNotify extends Command if ($user) { $response = $api->postJson('/cgi-bin/message/template/send', [ 'touser' => $user->openid, - 'template_id' => '', + 'template_id' => 'zdkOoIk7bfyzpW9Tuu-pxmrVkSviFvpp1yjXBUT8nEY', 'url' => url('/h5/pages/record/detail?id=' . $item->id), - 'data' => [] + 'data' => [ + 'thing1' => [ + 'value' => data_get($item->patient, 'name') .'-'. data_get($item->patient, 'phone') + ], + 'time3' => [ + 'value' => $item->next_treat_at->format('Y年m月d日 H:i:s') + ], + ] ]); if ($response->isFailed()) { logger('病历记录: 通知, 模板消息发送, 失败', $response->toArray(false)); diff --git a/public/h5/index.html b/public/h5/index.html index 4a465f8..9070fdf 100644 --- a/public/h5/index.html +++ b/public/h5/index.html @@ -1,2 +1,2 @@