医生简介

This commit is contained in:
wucongxing 2024-02-04 16:33:50 +08:00
parent 51735e429e
commit 329ab42f05
2 changed files with 40 additions and 8 deletions

View File

@ -11,7 +11,7 @@ use Hyperf\Snowflake\Concern\Snowflake;
/** /**
* @property int $record_id 主键id * @property int $record_id 主键id
* @property int $doctor_id 医生id * @property int $doctor_id 医生id
* @property int $is_verified 是否已审核0: 1: * @property int $introduction_status 个人简介审核状态0:未审核 1:审核通过 2:审核中 3:审核失败
* @property string $avatar 头像 * @property string $avatar 头像
* @property string $be_good_at 擅长 * @property string $be_good_at 擅长
* @property string $brief_introduction 医生简介 * @property string $brief_introduction 医生简介
@ -31,7 +31,7 @@ class DoctorIntroductionRecord extends Model
/** /**
* The attributes that are mass assignable. * The attributes that are mass assignable.
*/ */
protected array $fillable = ['record_id', 'doctor_id', 'is_verified', 'avatar', 'be_good_at', 'brief_introduction', 'expertise_ids', 'created_at', 'updated_at']; protected array $fillable = ['record_id', 'doctor_id', 'introduction_status', 'avatar', 'be_good_at', 'brief_introduction', 'expertise_ids', 'created_at', 'updated_at'];
protected string $primaryKey = "record_id"; protected string $primaryKey = "record_id";
@ -66,4 +66,31 @@ class DoctorIntroductionRecord extends Model
{ {
return self::create($data); return self::create($data);
} }
/**
* 获取信息-单条
* @param array $params
* @param array $fields
* @return object|null
*/
public static function getLastOne(array $params, array $fields = ['*']): object|null
{
return self::where($params)->latest()->first($fields);
}
/**
* 获取某种状态的最后一条数据
* @param array $params
* @param array $introduction_status
* @param array $fields
* @return object|null
*/
public static function getStatusLastOne(array $params, array $introduction_status,array $fields = ["*"]): object|null
{
return self::where($params)
->whereIn("introduction_status", $introduction_status)
->latest()
->first($fields);
}
} }

View File

@ -917,16 +917,21 @@ class DoctorAuthService extends BaseService
$UserDoctorService = new UserDoctorService(); $UserDoctorService = new UserDoctorService();
$result['doctor_expertise'] = $UserDoctorService->getDoctorSelectedExpertise($doctor['doctor_id']); $result['doctor_expertise'] = $UserDoctorService->getDoctorSelectedExpertise($doctor['doctor_id']);
if ($doctor['introduction_status'] == 2 || $doctor['introduction_status'] == 3){ if ($doctor['introduction_status'] == 2){
// 获取修改数据 // 获取修改数据
$params = array(); $params = array();
$params['doctor_id'] = $doctor['doctor_id']; $params['doctor_id'] = $doctor['doctor_id'];
$params['is_verified'] = 0; $params['introduction_status'] = 2;
$doctor_introduction_record = DoctorIntroductionRecord::getOne($params); $doctor_introduction_record = DoctorIntroductionRecord::getLastOne($params);
if (empty($doctor_introduction_record)){ } elseif ($doctor['introduction_status'] == 3){
return fail(); // 获取修改数据
} $params = array();
$params['doctor_id'] = $doctor['doctor_id'];
$params['introduction_status'] = 3;
$doctor_introduction_record = DoctorIntroductionRecord::getLastOne($params);
}
if (!empty($doctor_introduction_record)){
if (!empty($doctor_introduction_record['avatar'])){ if (!empty($doctor_introduction_record['avatar'])){
$result['avatar'] = PcreMatch::pregRemoveOssWebsite($doctor_introduction_record['avatar']); $result['avatar'] = PcreMatch::pregRemoveOssWebsite($doctor_introduction_record['avatar']);
} }