Commit 3ed9dc55 by 赵增煜

合并冲突

parents f4ad1080 b73d1225
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
// 问诊人控制器 // 问诊人控制器
class PrescriptionController extends BaseApiController class PrescriptionController extends BaseApiController
{ {
public function test() public function test()
{ {
// 分派医师 医师当日开方未达到上限以及是否在时间段的搜索出来 // 分派医师 医师当日开方未达到上限以及是否在时间段的搜索出来
...@@ -121,4 +122,5 @@ public function create(Request $request) ...@@ -121,4 +122,5 @@ public function create(Request $request)
return $this->success($data); return $this->success($data);
} }
} }
...@@ -13,9 +13,9 @@ class PharmacistModel extends Model ...@@ -13,9 +13,9 @@ class PharmacistModel extends Model
protected $table = 'pharmacist'; protected $table = 'pharmacist';
// 药师所属于的用户,一对一 // 药师关联的药店,多对一
public function user() public function pharmacy()
{ {
return $this->belongsTo(User::class, 'user_id', 'id'); return $this->belongsTo(PharmacyModel::class, 'pharmacy_id', 'id');
} }
} }
...@@ -12,4 +12,16 @@ class PharmacyModel extends Model ...@@ -12,4 +12,16 @@ class PharmacyModel extends Model
use SoftDeletes; use SoftDeletes;
protected $table = 'pharmacy'; protected $table = 'pharmacy';
// 药店所属于的用户,一对一
public function user()
{
return $this->belongsTo(User::class, 'user_id', 'id');
}
// 药店关联的药师,一对多
public function pharmacy()
{
return $this->hasMany(User::class, 'pharmacy_id', 'id');
}
} }
...@@ -68,10 +68,10 @@ public function doctor() ...@@ -68,10 +68,10 @@ public function doctor()
return $this->hasOne(DoctorModel::class, 'user_id', 'id'); return $this->hasOne(DoctorModel::class, 'user_id', 'id');
} }
// 用户关联的药,一对一 // 用户关联的药,一对一
public function pharmacist() public function pharmacy()
{ {
return $this->hasOne(PharmacistModel::class, 'user_id', 'id'); return $this->hasOne(PharmacyModel::class, 'user_id', 'id');
} }
// 用户关联的问诊人,一对多 // 用户关联的问诊人,一对多
......
...@@ -30,6 +30,7 @@ public function up() ...@@ -30,6 +30,7 @@ public function up()
$table->string('lng', 12)->comment('经度'); $table->string('lng', 12)->comment('经度');
$table->string('lat', 12)->comment('纬度'); $table->string('lat', 12)->comment('纬度');
$table->boolean('status')->default(0)->comment('启用[0=未启用,1=启用]'); $table->boolean('status')->default(0)->comment('启用[0=未启用,1=启用]');
$table->bigInteger('user_id')->nullable()->unique('uk_userid')->comment('用户表ID');
$table->timestamps(); $table->timestamps();
$table->softDeletes(); $table->softDeletes();
}); });
......
...@@ -25,7 +25,7 @@ public function up() ...@@ -25,7 +25,7 @@ public function up()
$table->string('physician_license')->comment('执业资格证书'); $table->string('physician_license')->comment('执业资格证书');
$table->string('signed_pic')->comment('签名照'); $table->string('signed_pic')->comment('签名照');
$table->boolean('status')->default(0)->comment('启用[0=未启用,1=启用]'); $table->boolean('status')->default(0)->comment('启用[0=未启用,1=启用]');
$table->bigInteger('user_id')->nullable()->unique('uk_userid')->comment('用户表ID'); $table->bigInteger('pharmacy_id')->index('idx_pharmacyid')->comment('药店ID');
$table->timestamps(); $table->timestamps();
$table->softDeletes(); $table->softDeletes();
}); });
......
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