Commit 6a6bbd65 by 赵增煜
parents 759b5b57 c297fbb9
......@@ -28,6 +28,7 @@ protected function grid()
$grid->column('id')->sortable();
$grid->column('status')->switch();
$grid->column('is_open')->switch()->help('药店控制');
$grid->column('name');
// $grid->column('business_license')->image('', 50, 50);
// $grid->column('drug_biz_license')->image('', 50, 50);
......@@ -37,7 +38,12 @@ protected function grid()
// $grid->column('pre_packaged_food')->image('', 50, 50);
$grid->column('area');
$grid->column('address');
$grid->column('business_hours');
$grid->column('营业时间')->display(function () {
$start = \Carbon\Carbon::parse($this->business_start)->format('H:i');
$end = \Carbon\Carbon::parse($this->business_end)->format('H:i');
return $start.'~'.$end;
});
$grid->column('mobile');
// $grid->column('lng');
// $grid->column('lat');
......@@ -84,7 +90,6 @@ protected function detail($id)
$show->field('area')->width(4);
$show->field('address')->width(4);
$show->field('mobile')->width(4);
$show->field('business_hours')->width(4);
$show->field('lng')->width(4);
$show->field('lat')->width(4);
$show->field('status')->width(4);
......@@ -116,10 +121,11 @@ protected function form()
$form->text('area')->width(4);
$form->text('address')->width(4);
$form->mobile('mobile')->width(4)->required()->help('药店登录账号');
$form->text('business_hours')->width(4);
$form->timeRange('business_start', 'business_end', '营业时间')->required();
$form->map('lat', 'lng', '经纬度坐标');
$form->select('user_id')->options(User::all()->pluck('openid', 'id'))->width(4)->help('实际后台操作可以不用关联');
$form->switch('status')->width(4);
$form->switch('is_open')->width(4);
$form->display('created_at')->width(4);
$form->display('updated_at')->width(4);
......
......@@ -7,6 +7,7 @@
use App\Models\DoctorModel;
use App\Models\InquiryModel;
use App\Models\PatientModel;
use App\Models\PharmacistModel;
use App\Models\PharmacyDrugModel;
use App\Models\PharmacyModel;
use App\Models\PrescriptionModel;
......@@ -117,15 +118,36 @@ protected function form()
{
return Form::make(new PrescriptionRepository(), function (Form $form) {
$form->display('id')->width(4);
$form->radio('status')->options(PrescriptionModel::PRESCRIPTION_STATUS_MAP);
$form->radio('status')->options(PrescriptionModel::PRESCRIPTION_STATUS_MAP)->default(PrescriptionModel::PRESCRIPTION_STATUS_PENDING);
$form->select('patient_id')->options(PatientModel::all()->pluck('name', 'id'))->width(4);
$form->hidden('patient_name');
$form->hidden('patient_age');
$form->hidden('patient_gender');
$form->select('diagnosis_id')->options(DiagnosiModel::all()->pluck('name', 'id'))->width(4);
$form->select('doctor_id')->options(DoctorModel::all()->pluck('name', 'id'))->width(4);
$form->select('pharmacy_id')->options(PharmacyModel::all()->pluck('name', 'id'))->width(4);
$form->select('pharmacist_id')->options(DoctorModel::all()->pluck('name', 'id'))->width(4);
$form->hidden('diagnosis_name');
$form->select('doctor_id')->options(DoctorModel::where('status', 1)->pluck('name', 'id'))->width(4);
$form->hidden('doctor_name');
$form->hidden('doctor_online_hospital_name');
$form->hidden('doctor_department');
$form->hidden('doctor_title');
$form->hidden('doctor_license_no');
$form->hidden('doctor_signed_pic');
$form->select('pharmacy_id')->options(PharmacyModel::where('status', 1)->pluck('name', 'id'))->width(4);
$form->hidden('pharmacy_name');
$form->select('pharmacist_id')->options(PharmacistModel::where('status', 1)->pluck('name', 'id'))->width(4);
$form->hidden('pharmacist_name');
$form->hidden('pharmacist_license_number');
$form->hidden('pharmacist_signed_pic');
$form->multipleSelect('inquiry_info')->options(InquiryModel::all()->pluck('question', 'id'))->width(4)->saving(function ($v) {
return json_encode($v);
});
$form->multipleSelect('drug_info')->options(PharmacyDrugModel::with('drug')->get()->pluck('drug')->pluck('name', 'id'))->width(4)->saving(function ($v) {
return json_encode($v);
});
......@@ -133,9 +155,54 @@ protected function form()
$form->display('created_at')->width(4);
$form->display('updated_at')->width(4);
// 添加隐藏字段以保存冗余数据
$form->saving(function (Form $form) {
$patient = PatientModel::find($form->input('patient_id'));
$doctor = DoctorModel::find($form->input('doctor_id'));
$pharmacist = PharmacistModel::find($form->input('pharmacist_id'));
$diagnosis = DiagnosiModel::find($form->input('diagnosis_id'));
$pharmacy = PharmacyModel::find($form->input('pharmacy_id'));
// 根据身份证计算年龄和性别
if ($patient) {
$form->patient_name = $patient->name;
$form->patient_age = getAgeByIdCard($patient->id_card);
$form->patient_gender = $patient->gender;
}
if ($diagnosis) {
$form->diagnosis_name = $diagnosis->name; // 假设有诊断名称字段
}
if ($doctor) {
$form->doctor_name = $doctor->name;
$form->doctor_online_hospital_name = $doctor->online_hospital_name; // 假设有在线医院名称字段
$form->doctor_department = $doctor->department;
$form->doctor_title = $doctor->doctor_title;
$form->doctor_license_no = $doctor->license_no;
$form->doctor_signed_pic = $doctor->signed_pic;
}
if ($pharmacist) {
$form->pharmacist_name = $pharmacist->name;
$form->pharmacist_license_number = $pharmacist->license_number;
$form->pharmacist_signed_pic = $pharmacist->signed_pic;
}
if ($pharmacy) {
$form->pharmacy_name = $pharmacy->name;
}
});
// 右上角按钮控制
$form->disableDeleteButton(); // 去掉删除按钮
});
}
// 计算年龄的辅助方法
private function calculateAge($id_card)
{
// 根据身份证计算年龄的逻辑
// 返回计算出的年龄
}
}
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('pharmacy', function (Blueprint $table) {
$table->boolean('is_open')->default(0)->comment('是否开店[0=闭店,1=开店]');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('pharmacy', function (Blueprint $table) {
//
});
}
};
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('pharmacy', function (Blueprint $table) {
$table->time('business_start')->comment('营业开始时间');
$table->time('business_end')->comment('营业结束时间');
$table->dropColumn('business_hours');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('pharmacy', function (Blueprint $table) {
//
});
}
};
......@@ -20,6 +20,7 @@
'lat' => '纬度',
'status' => '启用',
'user_id' => '关联用户',
'is_open' => '开店状态',
],
'options' => [
],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment