FourActivity.php 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. <?php
  2. namespace App\Models;
  3. use Encore\Admin\Facades\Admin;
  4. use Illuminate\Database\Eloquent\Model;
  5. use Illuminate\Support\Facades\Auth;
  6. class FourActivity extends SoftBaseModel
  7. {
  8. public static $mode = 'admin';
  9. protected $fillable = [
  10. 'title',
  11. 'activities_type',
  12. 'active_time','place',
  13. 'audience_crowd',
  14. 'anchor',
  15. 'educational_materials',
  16. 'publicity_board',
  17. 'member_num',
  18. 'planned_number',
  19. 'actual_number',
  20. 'filling_people',
  21. 'filling_time',
  22. 'mode',
  23. 'declaration_form',
  24. 'task_book',
  25. 'final_report',
  26. 'return_receipt',
  27. 'ext',
  28. 'workstation_id',
  29. 'workstation_name',
  30. 'audit_status',
  31. 'audit_remark',
  32. 'type',
  33. 'content'
  34. ];
  35. //四进类型[1:进社区,2:进企业,3:进学校,4:进特殊群体]
  36. const ACTIVITIES_TYPE_COMMUNITY = 1;
  37. const ACTIVITIES_TYPE_ENTERPRISE = 2;
  38. const ACTIVITIES_TYPE_SCHOOL = 3;
  39. const ACTIVITIES_TYPE_SPECIAL_GROUP = 4;
  40. //受众人群[1:老年,2:员工,3:中小学生,4:大学生,5:孕妇,6:应急相关人群,7:慢病人群,8:精神障碍患者家属,9:社工,10:护理人员,11:其他]',
  41. const AUDIENCE_CROWD_OLD = 1;
  42. const AUDIENCE_CROWD_STAFF = 2;
  43. const AUDIENCE_CROWD_MIDDLE_MIN_STUDENT = 3;
  44. const AUDIENCE_CROWD_COLLEGE_STUDENT = 4;
  45. const AUDIENCE_CROWD_PREGNANT_WOMAN = 5;
  46. const AUDIENCE_CROWD_EMERGENCY_RELATED_POPULATIONS = 6;
  47. const AUDIENCE_CROWD_CHRONIC_DISEASE_POPULATION = 7;
  48. const AUDIENCE_CROWD_MENTAL_FAMILY_MEMBERS = 8;
  49. const AUDIENCE_CROWD_SOCIAL_WORKER = 9;
  50. const AUDIENCE_CROWD_NURSING_STAFF = 10;
  51. const AUDIENCE_CROWD_OTHER = 11;
  52. const AUDIENCE_CROWD_MAP = array(
  53. self::AUDIENCE_CROWD_OLD=>"老年",
  54. self::AUDIENCE_CROWD_STAFF=>"员工",
  55. self::AUDIENCE_CROWD_MIDDLE_MIN_STUDENT=>"中小学生",
  56. self::AUDIENCE_CROWD_COLLEGE_STUDENT=>"大学生",
  57. self::AUDIENCE_CROWD_PREGNANT_WOMAN=>"孕妇",
  58. self::AUDIENCE_CROWD_EMERGENCY_RELATED_POPULATIONS=>"应急相关人群",
  59. self::AUDIENCE_CROWD_CHRONIC_DISEASE_POPULATION=>"慢病人群",
  60. self::AUDIENCE_CROWD_MENTAL_FAMILY_MEMBERS=>"精神障碍患者家属",
  61. self::AUDIENCE_CROWD_SOCIAL_WORKER=>"社工",
  62. self::AUDIENCE_CROWD_NURSING_STAFF=>"护理人员",
  63. self::AUDIENCE_CROWD_OTHER=>"其他",
  64. );
  65. //方式[1:健康宣传活动,2:健康教育讲座,3:培训,4:小组讨论与座谈,5:知识竞赛,6:心理行为问题筛查与健康咨询,7:其它]
  66. const MODE_HEALTH_PROMOTION_ACTIVITIES = 1;
  67. const MODE_HEALTH_EDUCATION_LECTURE = 2;
  68. const MODE_TRAIN = 3;
  69. const MODE_GROUP_DISCUSSION_AND_DISCUSSION = 4;
  70. const MODE_KNOWLEDGE_COMPETITION = 5;
  71. const MODE_PSYCHOLOGICAL_AND_HEALTH_COUNSELING = 6;
  72. const MODE_OTHER = 7;
  73. //活动类型[1:科普基地,2:宣传活动,3:特色服务]
  74. const TYPE_SCIENCE_POPULARIZATION_BASE = 1;
  75. const TYPE_PROMOTION_ACTIVITIES = 2;
  76. const TYPE_FEATURED_SERVICES = 3;
  77. const TYPE_FEATURED_REPORT_RECEIPT = 4;
  78. const TYPE_MAP= array(
  79. self::TYPE_SCIENCE_POPULARIZATION_BASE=>"科普基地",
  80. self::TYPE_PROMOTION_ACTIVITIES=>"宣传活动",
  81. self::TYPE_FEATURED_SERVICES=>"特色项目",
  82. self::TYPE_FEATURED_REPORT_RECEIPT=>"回执上报",
  83. )
  84. ;
  85. const MODE_MAP= array(
  86. self::MODE_HEALTH_PROMOTION_ACTIVITIES=>"健康宣传活动",
  87. self::MODE_HEALTH_EDUCATION_LECTURE=>"健康教育讲座",
  88. self::MODE_TRAIN=>"培训",
  89. self::MODE_GROUP_DISCUSSION_AND_DISCUSSION=>"小组讨论与座谈",
  90. self::MODE_KNOWLEDGE_COMPETITION=>"知识竞赛",
  91. self::MODE_PSYCHOLOGICAL_AND_HEALTH_COUNSELING=>"心理行为问题筛查与健康咨询",
  92. self::MODE_OTHER=>"其它",
  93. )
  94. ;
  95. const ACTIVITIES_TYPE_MAP = array(
  96. self::ACTIVITIES_TYPE_COMMUNITY=>"进社区",
  97. self::ACTIVITIES_TYPE_ENTERPRISE=>"进企业",
  98. self::ACTIVITIES_TYPE_SCHOOL=>"进学校",
  99. self::ACTIVITIES_TYPE_SPECIAL_GROUP=>"进特殊群体",
  100. );
  101. const AUDIT_STATUS_PENDING = 0;
  102. const AUDIT_STATUS_PASS = 1;
  103. const AUDIT_STATUS_REJECT = 2;
  104. const AUDIT_STATUS_MAP = array(
  105. self::AUDIT_STATUS_PENDING=>"待审核",
  106. self::AUDIT_STATUS_PASS=>"已通过",
  107. self::AUDIT_STATUS_REJECT=>"已驳回",
  108. );
  109. // protected $casts = ['cover'=>'array','comment_tag'=>'array'];
  110. public static function boot ()
  111. {
  112. parent::boot();
  113. if(self::$mode == 'admin'){
  114. static::creating(function ($model){
  115. $model->creator = Admin::user()->id;
  116. });
  117. }
  118. if(self::$mode == 'admin'){
  119. static::updating(function ($model){
  120. $model->updator = Admin::user()->id;
  121. });
  122. }
  123. }
  124. public function setExtAttribute($ext)
  125. {
  126. if (is_array($ext)) {
  127. $this->attributes['ext'] = json_encode($ext);
  128. }
  129. }
  130. public function getExtAttribute($ext)
  131. {
  132. return json_decode($ext, true);
  133. }
  134. }