123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142 |
- <?php
- namespace App\Models;
- use Encore\Admin\Facades\Admin;
- use Illuminate\Database\Eloquent\Model;
- use Illuminate\Support\Facades\Auth;
- class FourActivity extends SoftBaseModel
- {
- public static $mode = 'admin';
- protected $fillable = [
- 'title',
- 'activities_type',
- 'active_time','place',
- 'audience_crowd',
- 'anchor',
- 'educational_materials',
- 'publicity_board',
- 'member_num',
- 'planned_number',
- 'actual_number',
- 'filling_people',
- 'filling_time',
- 'mode',
- 'declaration_form',
- 'task_book',
- 'final_report',
- 'return_receipt',
- 'ext',
- 'workstation_id',
- 'workstation_name',
- 'audit_status',
- 'audit_remark',
- 'type',
- 'content'
- ];
- //四进类型[1:进社区,2:进企业,3:进学校,4:进特殊群体]
- const ACTIVITIES_TYPE_COMMUNITY = 1;
- const ACTIVITIES_TYPE_ENTERPRISE = 2;
- const ACTIVITIES_TYPE_SCHOOL = 3;
- const ACTIVITIES_TYPE_SPECIAL_GROUP = 4;
- //受众人群[1:老年,2:员工,3:中小学生,4:大学生,5:孕妇,6:应急相关人群,7:慢病人群,8:精神障碍患者家属,9:社工,10:护理人员,11:其他]',
- const AUDIENCE_CROWD_OLD = 1;
- const AUDIENCE_CROWD_STAFF = 2;
- const AUDIENCE_CROWD_MIDDLE_MIN_STUDENT = 3;
- const AUDIENCE_CROWD_COLLEGE_STUDENT = 4;
- const AUDIENCE_CROWD_PREGNANT_WOMAN = 5;
- const AUDIENCE_CROWD_EMERGENCY_RELATED_POPULATIONS = 6;
- const AUDIENCE_CROWD_CHRONIC_DISEASE_POPULATION = 7;
- const AUDIENCE_CROWD_MENTAL_FAMILY_MEMBERS = 8;
- const AUDIENCE_CROWD_SOCIAL_WORKER = 9;
- const AUDIENCE_CROWD_NURSING_STAFF = 10;
- const AUDIENCE_CROWD_OTHER = 11;
- const AUDIENCE_CROWD_MAP = array(
- self::AUDIENCE_CROWD_OLD=>"老年",
- self::AUDIENCE_CROWD_STAFF=>"员工",
- self::AUDIENCE_CROWD_MIDDLE_MIN_STUDENT=>"中小学生",
- self::AUDIENCE_CROWD_COLLEGE_STUDENT=>"大学生",
- self::AUDIENCE_CROWD_PREGNANT_WOMAN=>"孕妇",
- self::AUDIENCE_CROWD_EMERGENCY_RELATED_POPULATIONS=>"应急相关人群",
- self::AUDIENCE_CROWD_CHRONIC_DISEASE_POPULATION=>"慢病人群",
- self::AUDIENCE_CROWD_MENTAL_FAMILY_MEMBERS=>"精神障碍患者家属",
- self::AUDIENCE_CROWD_SOCIAL_WORKER=>"社工",
- self::AUDIENCE_CROWD_NURSING_STAFF=>"护理人员",
- self::AUDIENCE_CROWD_OTHER=>"其他",
- );
- //方式[1:健康宣传活动,2:健康教育讲座,3:培训,4:小组讨论与座谈,5:知识竞赛,6:心理行为问题筛查与健康咨询,7:其它]
- const MODE_HEALTH_PROMOTION_ACTIVITIES = 1;
- const MODE_HEALTH_EDUCATION_LECTURE = 2;
- const MODE_TRAIN = 3;
- const MODE_GROUP_DISCUSSION_AND_DISCUSSION = 4;
- const MODE_KNOWLEDGE_COMPETITION = 5;
- const MODE_PSYCHOLOGICAL_AND_HEALTH_COUNSELING = 6;
- const MODE_OTHER = 7;
- //活动类型[1:科普基地,2:宣传活动,3:特色服务]
- const TYPE_SCIENCE_POPULARIZATION_BASE = 1;
- const TYPE_PROMOTION_ACTIVITIES = 2;
- const TYPE_FEATURED_SERVICES = 3;
- const TYPE_FEATURED_REPORT_RECEIPT = 4;
- const TYPE_MAP= array(
- self::TYPE_SCIENCE_POPULARIZATION_BASE=>"科普基地",
- self::TYPE_PROMOTION_ACTIVITIES=>"宣传活动",
- self::TYPE_FEATURED_SERVICES=>"特色项目",
- self::TYPE_FEATURED_REPORT_RECEIPT=>"回执上报",
- )
- ;
- const MODE_MAP= array(
- self::MODE_HEALTH_PROMOTION_ACTIVITIES=>"健康宣传活动",
- self::MODE_HEALTH_EDUCATION_LECTURE=>"健康教育讲座",
- self::MODE_TRAIN=>"培训",
- self::MODE_GROUP_DISCUSSION_AND_DISCUSSION=>"小组讨论与座谈",
- self::MODE_KNOWLEDGE_COMPETITION=>"知识竞赛",
- self::MODE_PSYCHOLOGICAL_AND_HEALTH_COUNSELING=>"心理行为问题筛查与健康咨询",
- self::MODE_OTHER=>"其它",
- )
- ;
-
- const ACTIVITIES_TYPE_MAP = array(
- self::ACTIVITIES_TYPE_COMMUNITY=>"进社区",
- self::ACTIVITIES_TYPE_ENTERPRISE=>"进企业",
- self::ACTIVITIES_TYPE_SCHOOL=>"进学校",
- self::ACTIVITIES_TYPE_SPECIAL_GROUP=>"进特殊群体",
- );
- const AUDIT_STATUS_PENDING = 0;
- const AUDIT_STATUS_PASS = 1;
- const AUDIT_STATUS_REJECT = 2;
- const AUDIT_STATUS_MAP = array(
- self::AUDIT_STATUS_PENDING=>"待审核",
- self::AUDIT_STATUS_PASS=>"已通过",
- self::AUDIT_STATUS_REJECT=>"已驳回",
- );
- // protected $casts = ['cover'=>'array','comment_tag'=>'array'];
- public static function boot ()
- {
- parent::boot();
- if(self::$mode == 'admin'){
- static::creating(function ($model){
- $model->creator = Admin::user()->id;
- });
- }
- if(self::$mode == 'admin'){
- static::updating(function ($model){
- $model->updator = Admin::user()->id;
- });
- }
- }
- public function setExtAttribute($ext)
- {
- if (is_array($ext)) {
- $this->attributes['ext'] = json_encode($ext);
- }
- }
- public function getExtAttribute($ext)
- {
- return json_decode($ext, true);
- }
- }
|