|
@@ -0,0 +1,126 @@
|
|
|
|
+<?php
|
|
|
|
+
|
|
|
|
+namespace App\Admin\Controllers;
|
|
|
|
+
|
|
|
|
+use App\Models\Patient;
|
|
|
|
+use Encore\Admin\Controllers\AdminController;
|
|
|
|
+use Illuminate\Http\Request;
|
|
|
|
+use Encore\Admin\Form;
|
|
|
|
+use Encore\Admin\Grid;
|
|
|
|
+use Encore\Admin\Show;
|
|
|
|
+
|
|
|
|
+class UserPatientsController extends AdminController
|
|
|
|
+{
|
|
|
|
+ /**
|
|
|
|
+ * Title for current resource.
|
|
|
|
+ *
|
|
|
|
+ * @var string
|
|
|
|
+ */
|
|
|
|
+ protected $title = '档案';
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Make a grid builder.
|
|
|
|
+ *
|
|
|
|
+ * @return Grid
|
|
|
|
+ */
|
|
|
|
+ protected function grid()
|
|
|
|
+ {
|
|
|
|
+ $grid = new Grid(new Patient());
|
|
|
|
+ $uesr_id = \request('user_id');
|
|
|
|
+ $grid->filter(function ($filter){
|
|
|
|
+ $filter->disableIdFilter();
|
|
|
|
+ $filter->equal('user_id');
|
|
|
|
+ });
|
|
|
|
+ $grid->column('id', __('档案id'));
|
|
|
|
+ $grid->column('user_id', __('用户id'));
|
|
|
|
+ $grid->column('name', __('姓名'));
|
|
|
|
+ $grid->column('sex', __('性别'))->using([0=>'未知',1=>'男',2=>'女',]);
|
|
|
|
+ $grid->column('avatar', __('头像'))->image("",100,100);
|
|
|
|
+ $grid->column('age', __('年龄'));
|
|
|
|
+ $grid->column('email', __('邮箱'));
|
|
|
|
+ $grid->column('phone', __('联系电话'));
|
|
|
|
+ $grid->column('address', __('家庭住址'))->limit(20,'...');
|
|
|
|
+ $grid->column('guardian_name', __('监护人姓名'));
|
|
|
|
+ $grid->column('card_type', __('证件类型'))->using([1=>'身份证',2=>'护照']);
|
|
|
|
+ $grid->column('card_number', __('证件号'));
|
|
|
|
+ $grid->column('social_card_number', __('社保卡号'));
|
|
|
|
+ $grid->column('created_at', __('创建时间'));
|
|
|
|
+ $grid->column('updated_at', __('更新时间'));
|
|
|
|
+
|
|
|
|
+ return $grid;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Make a show builder.
|
|
|
|
+ *
|
|
|
|
+ * @param mixed $id
|
|
|
|
+ * @return Show
|
|
|
|
+ */
|
|
|
|
+ protected function detail($id)
|
|
|
|
+ {
|
|
|
|
+ $show = new Show(Patient::findOrFail($id));
|
|
|
|
+
|
|
|
|
+ $show->field('id', __('档案id'));
|
|
|
|
+ $show->field('user_id', __('用户id'));
|
|
|
|
+ $show->field('name', __('姓名'));
|
|
|
|
+ $show->field('sex', __('性别'))->using([0=>'未知',1=>'男',2=>'女',]);
|
|
|
|
+ $show->field('avatar', __('头像'))->image();
|
|
|
|
+ $show->field('card_img_url', __('身份证正面照片'))->image();
|
|
|
|
+ $show->field('card_back_img_url', __('身份证背面照片'))->image();
|
|
|
|
+ $show->field('birthday', __('生日'));
|
|
|
|
+ $show->field('age', __('年龄'));
|
|
|
|
+ $show->field('email', __('邮箱'));
|
|
|
|
+ $show->field('phone', __('联系电话'));
|
|
|
|
+ $show->field('address', __('家庭住址'));
|
|
|
|
+ $show->field('guardian_name', __('监护人姓名'));
|
|
|
|
+ $show->field('relationship_type', __('与就诊人关系类型'))
|
|
|
|
+ ->using([1=>'父亲',2=>'母亲',3=>'祖父',4=>'祖母',5=>'外祖父',6=>'外祖母',7=>'叔侄',8=>'其他']);
|
|
|
|
+ $show->field('info', __('就诊信息'));
|
|
|
|
+ $show->field('card_type', __('证件类型'))->using([1=>'身份证',2=>'护照']);
|
|
|
|
+ $show->field('card_number', __('证件号'));
|
|
|
|
+ $show->field('social_card_number', __('社保卡号'));
|
|
|
|
+ $show->field('born_hospital', __('出生医院'));
|
|
|
|
+ $show->field('created_at', __('创建时间'));
|
|
|
|
+ $show->field('updated_at', __('更新时间'));
|
|
|
|
+
|
|
|
|
+ return $show;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Make a form builder.
|
|
|
|
+ *
|
|
|
|
+ * @return Form
|
|
|
|
+ */
|
|
|
|
+ protected function form()
|
|
|
|
+ {
|
|
|
|
+ $form = new Form(new Patient());
|
|
|
|
+ $form->footer(function ($footer) {
|
|
|
|
+ // 去掉`查看`checkbox
|
|
|
|
+ $footer->disableViewCheck();
|
|
|
|
+ // 去掉`继续编辑`checkbox
|
|
|
|
+ $footer->disableEditingCheck();
|
|
|
|
+ // 去掉`继续创建`checkbox
|
|
|
|
+ $footer->disableCreatingCheck();
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ $form->text('user_id', __('用户id'));
|
|
|
|
+ $form->text('name', __('姓名'));
|
|
|
|
+ $form->select('sex',__('性别'))->options([0 => '未知', 1 => '男', '2' => '女'])->rules('required');
|
|
|
|
+ $form->image('avatar', __('头像'));
|
|
|
|
+ $form->image('card_img_url', __('身份证正面照片'))->rules('required');
|
|
|
|
+ $form->image('card_back_img_url', __('身份证背面照片'))->rules('required');
|
|
|
|
+ $form->date('birthday', __('生日'))->format('YYYY-MM-DD')->rules('required');
|
|
|
|
+ $form->email('email', __('邮箱'))->rules('required|email');
|
|
|
|
+ $form->mobile('phone', __('联系电话'))->rules('required')->options(['mask' => '999 9999 9999']);
|
|
|
|
+ $form->text('address', __('家庭住址'));
|
|
|
|
+ $form->text('guardian_name', __('监护人姓名'))->rules('required');
|
|
|
|
+ $form->select('relationship_type', __('与就诊人关系类型'))
|
|
|
|
+ ->options([1=>'父亲',2=>'母亲',3=>'祖父',4=>'祖母',5=>'外祖父',6=>'外祖母',7=>'叔侄',8=>'其他'])->rules('required');
|
|
|
|
+ $form->text('info', __('就诊信息'));
|
|
|
|
+ $form->select('card_type', __('证件类型'))->options([ 1 => '身份证', '2' => '护照'])->default(1)->rules('required');
|
|
|
|
+ $form->text('card_number', __('证件号'))->rules('required');
|
|
|
|
+ $form->text('social_card_number', __('社保卡号'));
|
|
|
|
+ $form->text('born_hospital', __('出生医院'));
|
|
|
|
+ return $form;
|
|
|
|
+ }
|
|
|
|
+}
|