更新获取身份认证信息接口认证失败原因字段返回
This commit is contained in:
parent
2bda61d29f
commit
c68c3ea000
@ -5,6 +5,7 @@ namespace App\Services;
|
||||
use App\Constants\DoctorTitleCode;
|
||||
use App\Constants\HttpEnumCode;
|
||||
use App\Model\DoctorExpertise;
|
||||
use App\Model\DoctorIdenFail;
|
||||
use App\Model\Hospital;
|
||||
use App\Model\HospitalDepartmentCustom;
|
||||
use App\Model\UserDoctor;
|
||||
@ -212,7 +213,6 @@ class DoctorAuthService extends BaseService
|
||||
'user_id',
|
||||
'idcard_status',
|
||||
'iden_auth_status',
|
||||
'iden_auth_fail_reason',
|
||||
'avatar',
|
||||
'hospital_id',
|
||||
'department_custom_id',
|
||||
@ -238,7 +238,7 @@ class DoctorAuthService extends BaseService
|
||||
$result = $doctor->toArray();
|
||||
|
||||
// 头像
|
||||
if (!empty($doctor['avatar'])){
|
||||
if (!empty($doctor['avatar'])) {
|
||||
$result['avatar'] = addAliyunOssWebsite($doctor['avatar']);
|
||||
}
|
||||
|
||||
@ -257,7 +257,7 @@ class DoctorAuthService extends BaseService
|
||||
// 医师执业证
|
||||
if (!empty($user_doctor_info['license_cert'])) {
|
||||
$license_cert = explode(',', $user_doctor_info['license_cert']);
|
||||
foreach ($license_cert as &$item){
|
||||
foreach ($license_cert as &$item) {
|
||||
$item = addAliyunOssWebsite($item);
|
||||
}
|
||||
$result['license_cert'] = $license_cert;
|
||||
@ -266,7 +266,7 @@ class DoctorAuthService extends BaseService
|
||||
// 医师职称证
|
||||
if (!empty($user_doctor_info['qualification_cert'])) {
|
||||
$qualification_cert = explode(',', $user_doctor_info['qualification_cert']);
|
||||
foreach ($qualification_cert as &$item){
|
||||
foreach ($qualification_cert as &$item) {
|
||||
$item = addAliyunOssWebsite($item);
|
||||
}
|
||||
$result['qualification_cert'] = $qualification_cert;
|
||||
@ -275,7 +275,7 @@ class DoctorAuthService extends BaseService
|
||||
// 医师资格证
|
||||
if (!empty($user_doctor_info['work_cert'])) {
|
||||
$work_cert = explode(',', $user_doctor_info['work_cert']);
|
||||
foreach ($work_cert as &$item){
|
||||
foreach ($work_cert as &$item) {
|
||||
$item = addAliyunOssWebsite($item);
|
||||
}
|
||||
$result['work_cert'] = $work_cert;
|
||||
@ -302,6 +302,17 @@ class DoctorAuthService extends BaseService
|
||||
$UserDoctorService = new UserDoctorService();
|
||||
$result['doctor_expertise'] = $UserDoctorService->getDoctorSelectedExpertise($doctor['doctor_id']);
|
||||
|
||||
// 获取医生身份认证失败原因
|
||||
$iden_auth_fail_reson = $this->getIdenAuthFailReason($doctor['iden_auth_status'], $doctor['doctor_id']);
|
||||
|
||||
$result['avatar_reason'] = $iden_auth_fail_reson['avatar_reason'] ?? "";
|
||||
$result['department_custom_mobile_reason'] = $iden_auth_fail_reson['department_custom_mobile_reason'] ?? "";
|
||||
$result['brief_introduction_reason'] = $iden_auth_fail_reson['brief_introduction_reason'] ?? "";
|
||||
$result['be_good_at_reason'] = $iden_auth_fail_reson['be_good_at_reason'] ?? "";
|
||||
$result['license_cert_reason'] = $iden_auth_fail_reson['license_cert_reason'] ?? "";
|
||||
$result['qualification_cert_reason'] = $iden_auth_fail_reson['qualification_cert_reason'] ?? "";
|
||||
$result['work_cert_reason'] = $iden_auth_fail_reson['work_cert_reason'] ?? "";
|
||||
|
||||
return success($result);
|
||||
}
|
||||
|
||||
@ -418,28 +429,28 @@ class DoctorAuthService extends BaseService
|
||||
$params['doctor_id'] = $user_info['client_user_id'];
|
||||
$doctor_expertise = DoctorExpertise::getList($params);
|
||||
if (!empty($doctor_expertise)) {
|
||||
$expertise_ids = array_column($doctor_expertise->toArray(),'expertise_id');
|
||||
$expertise_ids = array_column($doctor_expertise->toArray(), 'expertise_id');
|
||||
}
|
||||
|
||||
// 对比已选择专长
|
||||
// 对比专长是否删除
|
||||
$is_delete_expertise = array_diff($request_params['doctor_expertise'],$expertise_ids);
|
||||
$is_delete_expertise = array_diff($request_params['doctor_expertise'], $expertise_ids);
|
||||
|
||||
if (empty($is_delete_expertise)){
|
||||
if (empty($is_delete_expertise)) {
|
||||
// 对比专长是否新增
|
||||
$is_add_expertise = array_diff($expertise_ids,$request_params['doctor_expertise']) ;
|
||||
$is_add_expertise = array_diff($expertise_ids, $request_params['doctor_expertise']);
|
||||
}
|
||||
|
||||
// 专长是否改动:false(未改动) true(已改动)
|
||||
$expertise_is_change = false;
|
||||
if (!empty($is_delete_expertise) || !empty($is_add_expertise)){
|
||||
if (!empty($is_delete_expertise) || !empty($is_add_expertise)) {
|
||||
$expertise_is_change = true;
|
||||
}
|
||||
|
||||
Db::beginTransaction();
|
||||
try {
|
||||
// 专长有改动
|
||||
if ($expertise_is_change){
|
||||
if ($expertise_is_change) {
|
||||
// 删除原专长
|
||||
$params = array();
|
||||
$params['doctor_id'] = $user_info['client_user_id'];
|
||||
@ -487,7 +498,7 @@ class DoctorAuthService extends BaseService
|
||||
}
|
||||
|
||||
// 修改审核状态
|
||||
if (!empty($doctor_data) || !empty($doctor_info_data) || $expertise_is_change){
|
||||
if (!empty($doctor_data) || !empty($doctor_info_data) || $expertise_is_change) {
|
||||
$params = array();
|
||||
$params['doctor_id'] = $user_info['client_user_id'];
|
||||
|
||||
@ -531,7 +542,7 @@ class DoctorAuthService extends BaseService
|
||||
$params = array();
|
||||
$params['doctor_id'] = $user_info['client_user_id'];
|
||||
$user_doctor_info = UserDoctorInfo::getOne($params);
|
||||
if (empty($user_doctor_info)){
|
||||
if (empty($user_doctor_info)) {
|
||||
return success();
|
||||
}
|
||||
|
||||
@ -565,16 +576,16 @@ class DoctorAuthService extends BaseService
|
||||
return fail(HttpEnumCode::HTTP_ERROR, "未知医生");
|
||||
}
|
||||
|
||||
if ($doctor['idcard_status'] != 1){
|
||||
if ($doctor['idcard_status'] != 1) {
|
||||
return fail(HttpEnumCode::HTTP_ERROR, "请先进行实名认证");
|
||||
}
|
||||
|
||||
if ($doctor['iden_auth_status'] != 1){
|
||||
if ($doctor['iden_auth_status'] != 1) {
|
||||
return fail(HttpEnumCode::HTTP_ERROR, "请先进行身份认证");
|
||||
}
|
||||
|
||||
// 审核中
|
||||
if ($doctor['multi_point_status'] == 2){
|
||||
if ($doctor['multi_point_status'] == 2) {
|
||||
return fail(HttpEnumCode::HTTP_ERROR, "审核中,暂不允许修改");
|
||||
}
|
||||
|
||||
@ -590,23 +601,23 @@ class DoctorAuthService extends BaseService
|
||||
|
||||
// 身份证正面
|
||||
$id_card_front = PcreMatch::pregRemoveOssWebsite($id_card_front);
|
||||
if ($id_card_front != $user_doctor_info['id_card_front']){
|
||||
if ($id_card_front != $user_doctor_info['id_card_front']) {
|
||||
$doctor_info_data['id_card_front'] = $id_card_front;
|
||||
}
|
||||
|
||||
// 身份证反面
|
||||
$id_card_back = PcreMatch::pregRemoveOssWebsite($id_card_back);
|
||||
if ($id_card_back != $user_doctor_info['id_card_back']){
|
||||
if ($id_card_back != $user_doctor_info['id_card_back']) {
|
||||
$doctor_info_data['id_card_back'] = $id_card_back;
|
||||
}
|
||||
|
||||
// 签名
|
||||
$sign_image = PcreMatch::pregRemoveOssWebsite($sign_image);
|
||||
if ($sign_image != $user_doctor_info['sign_image']){
|
||||
if ($sign_image != $user_doctor_info['sign_image']) {
|
||||
$doctor_info_data['sign_image'] = $sign_image;
|
||||
}
|
||||
|
||||
if (empty($doctor_info_data)){
|
||||
if (empty($doctor_info_data)) {
|
||||
return success();
|
||||
}
|
||||
|
||||
@ -643,4 +654,64 @@ class DoctorAuthService extends BaseService
|
||||
|
||||
return success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取医生身份认证失败原因
|
||||
* @param int|string $iden_auth_status
|
||||
* @param string|int $doctor_id
|
||||
* @return array
|
||||
*/
|
||||
public function getIdenAuthFailReason(int|string $iden_auth_status, string|int $doctor_id): array
|
||||
{
|
||||
$result = array();
|
||||
|
||||
// 身份认证状态(0:未认证 1:认证通过 2:审核中 3:认证失败)
|
||||
if ($iden_auth_status == 3) {
|
||||
// 获取认证失败字段
|
||||
$params = array();
|
||||
$params['doctor_id'] = $doctor_id;
|
||||
$doctor_iden_fails = DoctorIdenFail::getList($params);
|
||||
|
||||
if (!empty($doctor_iden_fails)) {
|
||||
foreach ($doctor_iden_fails as $doctor_iden_fail) {
|
||||
// 头像
|
||||
if ($doctor_iden_fail['field_name'] == "avatar") {
|
||||
$result['avatar_reason'] = $doctor_iden_fail['fail_reason'];
|
||||
}
|
||||
|
||||
// 科室电话
|
||||
if ($doctor_iden_fail['field_name'] == "department_custom_mobile") {
|
||||
$result['department_custom_mobile_reason'] = $doctor_iden_fail['fail_reason'];
|
||||
}
|
||||
|
||||
// 医生简介
|
||||
if ($doctor_iden_fail['field_name'] == "brief_introduction") {
|
||||
$result['brief_introduction_reason'] = $doctor_iden_fail['fail_reason'];
|
||||
}
|
||||
|
||||
// 擅长
|
||||
if ($doctor_iden_fail['field_name'] == "be_good_at") {
|
||||
$result['be_good_at_reason'] = $doctor_iden_fail['fail_reason'];
|
||||
}
|
||||
|
||||
// 医师执业证
|
||||
if ($doctor_iden_fail['field_name'] == "license_cert") {
|
||||
$result['license_cert_reason'] = $doctor_iden_fail['fail_reason'];
|
||||
}
|
||||
|
||||
// 医师资格证
|
||||
if ($doctor_iden_fail['field_name'] == "qualification_cert") {
|
||||
$result['qualification_cert_reason'] = $doctor_iden_fail['fail_reason'];
|
||||
}
|
||||
|
||||
// 医师工作证
|
||||
if ($doctor_iden_fail['field_name'] == "work_cert") {
|
||||
$result['work_cert_reason'] = $doctor_iden_fail['fail_reason'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user