123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- <?php
- /**
- * Created by PhpStorm.
- * User: zilongs
- * Date: 20-9-29
- * Time: 下午2:35
- */
- namespace App\Models;
- class Organization extends BaseModel
- {
- CONST HOSPITOAL = 1, ORGANIZATION = 2, CLINC = 3;
- protected static $_getType = [
- self::HOSPITOAL => '医院',
- self::ORGANIZATION => '机构',
- self::CLINC => '医院',
- ];
- public static function getType()
- {
- return self::$_getType;
- }
- public function docter()
- {
- $ret = $this->belongsToMany(Docter::class)->where('status', 1);
- $req = request()->post();
- if (!empty($req['schedule_type'])) {
- $ret->where('type', $req['schedule_type']);
- }
- return $ret;
- }
- public function vaccines()
- {
- return $this->belongsToMany(Vaccines::class,'vaccines_id');
- }
- public function user()
- {
- return $this->hasOne(CdmsUsers::class,'org_id','id');
- }
- public function communityNotice()
- {
- return $this->hasOne(CommunityNotice::class, 'organization_id', 'id');
- }
- public function offices(){
- return $this->hasMany(Office::class,'org_id','id');
- }
- public function docterOrganization()
- {
- return $this->hasMany(DocterOrganization::class)->where('state', 1)->where('authentication_end_time', '>', time());
- }
- }
|