12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- <?php
- namespace app\admin\model;
- use support\Model;
- class UserMedicalExaminationReport extends Model
- {
- /**
- * The table associated with the model.
- *
- * @var string
- */
- protected $table = 'user_medical_examination_report';
- /**
- * The primary key associated with the table.
- *
- * @var string
- */
- protected $primaryKey = 'report_id';
- /**
- * Indicates if the model should be timestamped.
- *
- * @var bool
- */
- public $timestamps = false;
- /**
- * Notes:检测是否存在
- * @param string $group
- * @return bool
- * User: yym
- * Date: 2022/9/15
- */
- public static function checkStatus(string $group)
- {
- return static::where(['report_group' => $group])->exists();
- }
- /**
- * Notes:插入数据
- * @param array $data
- * @return false|int
- * User: yym
- * Date: 2022/9/15
- */
- public static function insertData(array $data)
- {
- if(empty($data))
- {
- return false;
- }
- return static::insertGetId($data);
- }
- /**
- * Notes:更新数据
- * @param string $group
- * @param array $data
- * @return false|int
- * User: yym
- * Date: 2022/9/15
- */
- public static function updateData(string $group, array $data)
- {
- if(empty($group) || empty($data))
- {
- return false;
- }
- return static::where(['report_group' => $group])->update($data);
- }
- /**
- * Notes:获取会员体检信息
- * @param int $user_id
- * @return array
- * User: yym
- * Date: 2022/9/21
- */
- public static function getList(int $user_id)
- {
- $list = static::where(['report_user_id' => $user_id])
- ->orderBy('report_time', 'desc')
- ->get()
- ->toArray();
- $count = static::where(['report_user_id' => $user_id])->count();
- return [$list, $count];
- }
- }
|