Commit 31e2a84a by lujunyi

药品互斥 处方类型

parent 144f5313
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
namespace App\Admin\Controllers; namespace App\Admin\Controllers;
use App\Admin\Extensions\ToolBar\Actions\DrugImportAction; use App\Admin\Extensions\ToolBar\Actions\DrugImportAction;
use App\Admin\Renderable\DrugTable;
use App\Admin\Repositories\DrugRepository; use App\Admin\Repositories\DrugRepository;
use App\Models\DrugModel; use App\Models\DrugModel;
use App\Models\DrugTagModel; use App\Models\DrugTagModel;
...@@ -140,7 +141,13 @@ protected function form() ...@@ -140,7 +141,13 @@ protected function form()
->customFormat(function ($v) { ->customFormat(function ($v) {
return array_column($v, 'id'); return array_column($v, 'id');
}); });
// if ($form->isEditing()) {
$form->multipleSelectTable('excluded_drug_ids', '选择互斥药品')
->title('选择药品')
->dialogWidth('70%') // 弹窗宽度,默认 800px
->from(DrugTable::make()->payload(['drug_id' => $form->getKey()]))
->model(DrugModel::class, 'id', 'name');
// }
$form->display('created_at'); $form->display('created_at');
$form->display('updated_at'); $form->display('updated_at');
}); });
......
...@@ -31,6 +31,7 @@ protected function grid() ...@@ -31,6 +31,7 @@ protected function grid()
$grid->column('id', '处方单编号')->sortable(); $grid->column('id', '处方单编号')->sortable();
$grid->column('status')->using(PrescriptionModel::PRESCRIPTION_STATUS_MAP)->badge(PrescriptionModel::PRESCRIPTION_STATUS_MAP_COLOR); $grid->column('status')->using(PrescriptionModel::PRESCRIPTION_STATUS_MAP)->badge(PrescriptionModel::PRESCRIPTION_STATUS_MAP_COLOR);
$grid->column('prescription_type')->using(PrescriptionModel::PRESCRIPTION_TYPE_MAP);
$grid->column('patient_name'); $grid->column('patient_name');
$grid->column('patient_age'); $grid->column('patient_age');
$grid->column('patient_gender')->using(PatientModel::SEX_MAP); $grid->column('patient_gender')->using(PatientModel::SEX_MAP);
...@@ -83,6 +84,7 @@ protected function grid() ...@@ -83,6 +84,7 @@ protected function grid()
$filter->in('is_abnormal')->checkbox([0 => '否', 1 => '是'])->width(3); $filter->in('is_abnormal')->checkbox([0 => '否', 1 => '是'])->width(3);
$filter->in('is_voided')->checkbox(PrescriptionModel::IS_VOIDED_MAP)->width(3); $filter->in('is_voided')->checkbox(PrescriptionModel::IS_VOIDED_MAP)->width(3);
$filter->in('open_source')->checkbox(PrescriptionModel::OPEN_SOURCE_MAP)->width(3); $filter->in('open_source')->checkbox(PrescriptionModel::OPEN_SOURCE_MAP)->width(3);
$filter->in('prescription_type')->checkbox(PrescriptionModel::PRESCRIPTION_TYPE_MAP)->width(3);
}); });
// $show->field('is_voided')->width(3)->using(PrescriptionModel::IS_VOIDED_MAP); // $show->field('is_voided')->width(3)->using(PrescriptionModel::IS_VOIDED_MAP);
...@@ -151,6 +153,7 @@ protected function detail($id) ...@@ -151,6 +153,7 @@ protected function detail($id)
$show->field('is_voided')->width(3)->using(PrescriptionModel::IS_VOIDED_MAP); $show->field('is_voided')->width(3)->using(PrescriptionModel::IS_VOIDED_MAP);
$show->field('is_abnormal')->width(3)->using([0 => '否', 1 => '是']); $show->field('is_abnormal')->width(3)->using([0 => '否', 1 => '是']);
$show->field('prescription_type')->width(3)->using(PrescriptionModel::PRESCRIPTION_TYPE_MAP);
$show->panel()->tools(function ($tools) { $show->panel()->tools(function ($tools) {
$tools->disableEdit(); $tools->disableEdit();
......
...@@ -10,9 +10,13 @@ class DrugTable extends LazyRenderable ...@@ -10,9 +10,13 @@ class DrugTable extends LazyRenderable
{ {
public function grid(): Grid public function grid(): Grid
{ {
return Grid::make(new DrugModel(), function (Grid $grid) { $ownerDrugId = $this->payload['drug_id'] ?? 0;
$grid->model()->orderBy('id', 'DESC');
return Grid::make(new DrugModel(), function (Grid $grid) use ($ownerDrugId) {
$grid->model()->orderBy('id', 'DESC');
if ($ownerDrugId) {
$grid->model()->where('id', '!=', $ownerDrugId);
}
$grid->column('id')->sortable(); $grid->column('id')->sortable();
$grid->column('name', '药品名称'); $grid->column('name', '药品名称');
$grid->column('code', '简码'); $grid->column('code', '简码');
......
...@@ -34,6 +34,11 @@ class DrugModel extends Model ...@@ -34,6 +34,11 @@ class DrugModel extends Model
'code', 'code',
]; ];
// 数组json相互转换
protected $casts = [
'excluded_drug_ids' => 'array',
];
// 是否处方药[0=否,1=是] // 是否处方药[0=否,1=是]
const RX_TRUE = 1; const RX_TRUE = 1;
......
...@@ -87,6 +87,17 @@ class PrescriptionModel extends Model ...@@ -87,6 +87,17 @@ class PrescriptionModel extends Model
self::IS_VOIDED_TRUE => 'danger', self::IS_VOIDED_TRUE => 'danger',
]; ];
// 处方类型[0=中药,1=西药]
const PRESCRIPTION_TYPE_TCM = 0;
const PRESCRIPTION_TYPE_WM = 1;
// 处方类型-文字映射
const PRESCRIPTION_TYPE_MAP = [
self::PRESCRIPTION_TYPE_TCM => '中药',
self::PRESCRIPTION_TYPE_WM => '西药',
];
public function getDoctorSignedPicAttribute($value) public function getDoctorSignedPicAttribute($value)
{ {
if (Str::contains($value, '//') || ! $value) { if (Str::contains($value, '//') || ! $value) {
......
<?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('drug', function (Blueprint $table) {
$table->text('excluded_drug_ids')->nullable()->comment('互斥的药品id');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('drug', 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('prescription', function (Blueprint $table) {
$table->tinyInteger('prescription_type')->default(0)->comment('处方类型[0=中药,1=西药]');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('prescription', function (Blueprint $table) {
//
});
}
};
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
'is_si' => '是否医保药', 'is_si' => '是否医保药',
'limit_buy_7' => '7天限购', 'limit_buy_7' => '7天限购',
'tag' => '标签', 'tag' => '标签',
'excluded_drug_ids' => '互斥药品id组',
], ],
'options' => [ 'options' => [
], ],
......
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
'prescription_at' => '开方时间', 'prescription_at' => '开方时间',
'review_at' => '审方时间', 'review_at' => '审方时间',
'is_abnormal' => '异常处方单', 'is_abnormal' => '异常处方单',
'prescription_type' => '处方类型',
], ],
'options' => [ '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