新增家庭成员接口、修正医生名片
This commit is contained in:
parent
707a0eb6fd
commit
32bd4d8d5d
@ -5,6 +5,7 @@ namespace App\Controller;
|
||||
use App\Constants\HttpEnumCode;
|
||||
use App\Request\PatientFamilyRequest;
|
||||
use App\Services\PatientFamilyService;
|
||||
use GuzzleHttp\Exception\GuzzleException;
|
||||
use Hyperf\Validation\Contract\ValidatorFactoryInterface;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Container\NotFoundExceptionInterface;
|
||||
@ -32,11 +33,12 @@ class PatientFamilyController extends AbstractController
|
||||
|
||||
/**
|
||||
* 新增家庭成员
|
||||
* @return array|ResponseInterface
|
||||
* @return ResponseInterface
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public function addFamily(): array|ResponseInterface
|
||||
public function addFamily(): ResponseInterface
|
||||
{
|
||||
$request = $this->container->get(PatientFamilyRequest::class);
|
||||
$request->scene('addFamily')->validateResolved();
|
||||
@ -44,7 +46,7 @@ class PatientFamilyController extends AbstractController
|
||||
// 检测入参身份证号
|
||||
$res = $this->checkRequestIdCard();
|
||||
if (!empty($res)) {
|
||||
return fail(HttpEnumCode::HTTP_ERROR, $res);
|
||||
return $this->response->json(fail(HttpEnumCode::HTTP_ERROR, $res));
|
||||
}
|
||||
|
||||
$patientFamilyService = new PatientFamilyService();
|
||||
@ -52,6 +54,155 @@ class PatientFamilyController extends AbstractController
|
||||
return $this->response->json($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改家庭成员
|
||||
* @return ResponseInterface
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function editFamily(): ResponseInterface
|
||||
{
|
||||
$request = $this->container->get(PatientFamilyRequest::class);
|
||||
$request->scene('editFamily')->validateResolved();
|
||||
|
||||
// 检测入参身份证号
|
||||
$res = $this->checkRequestIdCard();
|
||||
if (!empty($res)) {
|
||||
return $this->response->json(fail(HttpEnumCode::HTTP_ERROR, $res));
|
||||
}
|
||||
|
||||
$patientFamilyService = new PatientFamilyService();
|
||||
|
||||
$data = $patientFamilyService->editFamily();
|
||||
|
||||
return $this->response->json($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除家庭成员
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function deleteFamily(): ResponseInterface
|
||||
{
|
||||
$patientFamilyService = new PatientFamilyService();
|
||||
|
||||
$data = $patientFamilyService->deleteFamily();
|
||||
|
||||
return $this->response->json($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取家庭成员详情
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function getFamily(): ResponseInterface
|
||||
{
|
||||
$patientFamilyService = new PatientFamilyService();
|
||||
|
||||
$data = $patientFamilyService->getFamily();
|
||||
|
||||
return $this->response->json($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取家庭成员详情-个人情况
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function getFamilyPersonal(): ResponseInterface
|
||||
{
|
||||
$patientFamilyService = new PatientFamilyService();
|
||||
|
||||
$data = $patientFamilyService->getFamilyPersonal();
|
||||
|
||||
return $this->response->json($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改家庭成员-个人情况
|
||||
* @return ResponseInterface
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function editFamilyPersonal(): ResponseInterface
|
||||
{
|
||||
$request = $this->container->get(PatientFamilyRequest::class);
|
||||
$request->scene('editFamilyPersonal')->validateResolved();
|
||||
|
||||
$patientFamilyService = new PatientFamilyService();
|
||||
|
||||
$data = $patientFamilyService->editFamilyPersonal();
|
||||
|
||||
return $this->response->json($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增家庭成员-个人情况
|
||||
* @return ResponseInterface
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function addFamilyPersonal(): ResponseInterface
|
||||
{
|
||||
$request = $this->container->get(PatientFamilyRequest::class);
|
||||
$request->scene('addFamilyPersonal')->validateResolved();
|
||||
|
||||
$patientFamilyService = new PatientFamilyService();
|
||||
|
||||
$data = $patientFamilyService->addFamilyPersonal();
|
||||
|
||||
return $this->response->json($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取家庭成员-健康状况
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function getFamilyHealth(): ResponseInterface
|
||||
{
|
||||
$patientFamilyService = new PatientFamilyService();
|
||||
|
||||
$data = $patientFamilyService->getFamilyHealth();
|
||||
|
||||
return $this->response->json($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改家庭成员-健康情况
|
||||
* @return ResponseInterface
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function editFamilyHealth(): ResponseInterface
|
||||
{
|
||||
$request = $this->container->get(PatientFamilyRequest::class);
|
||||
$request->scene('editFamilyHealth')->validateResolved();
|
||||
|
||||
$patientFamilyService = new PatientFamilyService();
|
||||
|
||||
$data = $patientFamilyService->editFamilyHealth();
|
||||
|
||||
return $this->response->json($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增家庭成员-健康情况
|
||||
* @return ResponseInterface
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function addFamilyHealth(): ResponseInterface
|
||||
{
|
||||
$request = $this->container->get(PatientFamilyRequest::class);
|
||||
$request->scene('addFamilyHealth')->validateResolved();
|
||||
|
||||
$patientFamilyService = new PatientFamilyService();
|
||||
|
||||
$data = $patientFamilyService->addFamilyHealth();
|
||||
|
||||
return $this->response->json($data);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 检测入参身份证号
|
||||
* @return string
|
||||
|
||||
@ -7,13 +7,15 @@ namespace App\Model;
|
||||
|
||||
|
||||
use Hyperf\Database\Model\Collection;
|
||||
use Hyperf\Database\Model\Model;
|
||||
use Hyperf\Snowflake\Concern\Snowflake;
|
||||
|
||||
/**
|
||||
* @property int $family_health_id 主键id
|
||||
* @property int $family_id 家庭成员id
|
||||
* @property int $patient_id 患者id
|
||||
* @property string $disease_name 疾病名称
|
||||
* @property int $disease_class_id 疾病分类id-系统
|
||||
* @property string $disease_class_name 疾病名称-系统
|
||||
* @property string $diagnosis_date 确诊日期
|
||||
* @property string $diagnosis_hospital 确诊医院
|
||||
* @property string $drugs_name 正在服药名称
|
||||
@ -32,7 +34,7 @@ class PatientFamilyHealth extends Model
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
protected array $fillable = ['family_health_id', 'family_id', 'patient_id', 'disease_name', 'diagnosis_date', 'diagnosis_hospital', 'drugs_name', 'created_at', 'updated_at'];
|
||||
protected array $fillable = ['family_health_id', 'family_id', 'patient_id', 'disease_class_id', 'disease_class_name', 'diagnosis_date', 'diagnosis_hospital', 'drugs_name', 'created_at', 'updated_at'];
|
||||
|
||||
protected string $primaryKey = "family_health_id";
|
||||
|
||||
@ -57,4 +59,25 @@ class PatientFamilyHealth extends Model
|
||||
{
|
||||
return self::where($params)->get($fields);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
* @param array $params
|
||||
* @param array $data
|
||||
* @return int
|
||||
*/
|
||||
public static function edit(array $params = [], array $data = []): int
|
||||
{
|
||||
return self::where($params)->update($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增
|
||||
* @param array $data
|
||||
* @return Model|PatientFamilyHealth
|
||||
*/
|
||||
public static function addPatientFamilyHealth(array $data = []): \Hyperf\Database\Model\Model|PatientFamilyHealth
|
||||
{
|
||||
return self::create($data);
|
||||
}
|
||||
}
|
||||
|
||||
@ -65,4 +65,25 @@ class PatientFamilyPersonal extends Model
|
||||
{
|
||||
return self::where($params)->get($fields);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增
|
||||
* @param array $data
|
||||
* @return \Hyperf\Database\Model\Model|PatientFamilyPersonal
|
||||
*/
|
||||
public static function addPatientFamilyPersonal(array $data = []): \Hyperf\Database\Model\Model|PatientFamilyPersonal
|
||||
{
|
||||
return self::create($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
* @param array $params
|
||||
* @param array $data
|
||||
* @return int
|
||||
*/
|
||||
public static function edit(array $params = [], array $data = []): int
|
||||
{
|
||||
return self::where($params)->update($data);
|
||||
}
|
||||
}
|
||||
|
||||
@ -31,7 +31,62 @@ class PatientFamilyRequest extends FormRequest
|
||||
'height',
|
||||
'weight',
|
||||
'marital_status',
|
||||
]
|
||||
],
|
||||
'editFamily' => [ // 修改家庭成员
|
||||
'relation',
|
||||
'is_default',
|
||||
'card_name',
|
||||
'type',
|
||||
'id_number',
|
||||
'province_id',
|
||||
'city_id',
|
||||
'county_id',
|
||||
'height',
|
||||
'weight',
|
||||
'marital_status',
|
||||
],
|
||||
'editFamilyPersonal' => [ // 修改家庭成员-个人情况
|
||||
'is_allergy_history',// 过敏史
|
||||
'allergy_history',
|
||||
'is_family_history', // 家族病史
|
||||
'family_history',
|
||||
'is_pregnant',// 备孕、妊娠、哺乳期
|
||||
'pregnant',
|
||||
'is_operation', // 是否存在手术(0:否 1:是)
|
||||
'operation',
|
||||
'drink_wine_status', // 饮酒状态(1:从不 2:偶尔 3:经常 4:每天 5:已戒酒)
|
||||
'smoke_status',// 吸烟状态(1:从不 2:偶尔 3:经常 4:每天 5:已戒烟)
|
||||
'chemical_compound_status', // 化合物状态(1:从不 2:偶尔 3:经常 4:每天)
|
||||
'chemical_compound_describe',
|
||||
],
|
||||
'addFamilyPersonal' => [ // 新增家庭成员-个人情况
|
||||
'family_id',
|
||||
'is_allergy_history',// 过敏史
|
||||
'allergy_history',
|
||||
'is_family_history', // 家族病史
|
||||
'family_history',
|
||||
'is_pregnant',// 备孕、妊娠、哺乳期
|
||||
'pregnant',
|
||||
'is_operation', // 是否存在手术(0:否 1:是)
|
||||
'operation',
|
||||
'drink_wine_status', // 饮酒状态(1:从不 2:偶尔 3:经常 4:每天 5:已戒酒)
|
||||
'smoke_status',// 吸烟状态(1:从不 2:偶尔 3:经常 4:每天 5:已戒烟)
|
||||
'chemical_compound_status', // 化合物状态(1:从不 2:偶尔 3:经常 4:每天)
|
||||
'chemical_compound_describe',
|
||||
],
|
||||
'editFamilyHealth' => [ // 修改家庭成员-健康情况
|
||||
'disease_class_id',
|
||||
'diagnosis_date',// 确诊日期
|
||||
'diagnosis_hospital',//确诊医院
|
||||
'drugs_name', // 家族病史
|
||||
],
|
||||
'addFamilyHealth' => [ // 新增家庭成员-健康情况
|
||||
'family_id',
|
||||
'disease_class_id',
|
||||
'diagnosis_date',// 确诊日期
|
||||
'diagnosis_hospital',//确诊医院
|
||||
'drugs_name', // 家族病史
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
@ -59,6 +114,16 @@ class PatientFamilyRequest extends FormRequest
|
||||
'height' => ['sometimes','numeric'], // 身高
|
||||
'weight' => ['sometimes','numeric'], // 体重
|
||||
'marital_status' => ['sometimes',Rule::in(['0', '1'])], // 婚姻状况(0:未婚 1:已婚)
|
||||
'is_allergy_history' => ['sometimes','numeric','min:0','max:1'],
|
||||
'is_family_history' => ['sometimes','numeric','min:0','max:1'],
|
||||
'is_pregnant' => ['sometimes','numeric','min:0','max:1'],
|
||||
'is_operation' => ['sometimes','numeric','min:0','max:1'],
|
||||
'drink_wine_status' => ['sometimes','numeric','min:1','max:5'],
|
||||
'smoke_status' => ['sometimes','numeric','min:1','max:5'],
|
||||
'chemical_compound_status' => ['sometimes','numeric','min:1','max:4'],
|
||||
'family_id' => "required",
|
||||
'disease_class_id' => "required",
|
||||
'diagnosis_date' => ['sometimes','date'],
|
||||
];
|
||||
}
|
||||
|
||||
@ -83,6 +148,30 @@ class PatientFamilyRequest extends FormRequest
|
||||
'weight.numeric' => "体重错误",
|
||||
'blood_type.in' => "血型错误",
|
||||
'marital_status.in' => "婚姻状况错误",
|
||||
'is_allergy_history.numeric' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'is_allergy_history.min' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'is_allergy_history.max' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'is_family_history.numeric' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'is_family_history.min' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'is_family_history.max' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'is_pregnant.numeric' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'is_pregnant.min' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'is_pregnant.max' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'is_operation.numeric' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'is_operation.min' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'is_operation.max' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'drink_wine_status.numeric' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'drink_wine_status.min' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'drink_wine_status.max' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'smoke_status.numeric' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'smoke_status.min' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'smoke_status.max' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'chemical_compound_status.numeric' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'chemical_compound_status.min' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'chemical_compound_status.max' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'family_id.required' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'disease_class_id.required' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'diagnosis_date.date' => "日期格式错误",
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@ -81,9 +81,9 @@ class AreaService extends BaseService
|
||||
|
||||
if (!empty($province) || !empty($city) || !empty($county)){
|
||||
$result = array();
|
||||
$result['province'] = $province;
|
||||
$result['city'] = $city;
|
||||
$result['county'] = $county;
|
||||
$result['province'] = $province ?? [];
|
||||
$result['city'] = $city ?? [];
|
||||
$result['county'] = $county ?? [];
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
@ -5,9 +5,13 @@ namespace App\Services;
|
||||
use App\Constants\HttpEnumCode;
|
||||
use App\Model\BasicJob;
|
||||
use App\Model\BasicNation;
|
||||
use App\Model\DiseaseClass;
|
||||
use App\Model\PatientFamily as PatientFamilyModel;
|
||||
use App\Model\PatientFamilyHealth;
|
||||
use App\Model\PatientFamilyPersonal as PatientFamilyPersonalModel;
|
||||
use App\Utils\Mask;
|
||||
use Extend\VerifyDun\IdCard;
|
||||
use GuzzleHttp\Exception\GuzzleException;
|
||||
use Hyperf\DbConnection\Db;
|
||||
use Hyperf\Validation\Contract\ValidatorFactoryInterface;
|
||||
|
||||
@ -46,10 +50,10 @@ class PatientFamilyService extends BaseService
|
||||
/**
|
||||
* 新增家庭成员-cuowu
|
||||
* @return array
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public function addFamily(): array
|
||||
{
|
||||
|
||||
$user_info = $this->request->getAttribute("userInfo") ?? [];
|
||||
|
||||
$request_params = $this->request->all();
|
||||
@ -96,12 +100,15 @@ class PatientFamilyService extends BaseService
|
||||
}
|
||||
}
|
||||
|
||||
$areaService = new AreaService();
|
||||
|
||||
if (!empty($request_params['province_id'])){
|
||||
$areaService = new AreaService();
|
||||
$req = $areaService->checkAreaById($request_params['province_id'],$request_params['city_id'],$request_params['county_id']);
|
||||
if(empty($req)){
|
||||
return fail(HttpEnumCode::HTTP_ERROR,"地区选择错误");
|
||||
}
|
||||
|
||||
$area = $areaService->getAreaById($request_params['province_id'],$request_params['city_id'],$request_params['county_id']);
|
||||
}
|
||||
|
||||
if ($request_params['type'] == 1) {
|
||||
@ -174,25 +181,39 @@ class PatientFamilyService extends BaseService
|
||||
$data['mobile_mask'] = Mask::maskPhoneStr($request_params['mobile']);
|
||||
$data['type'] = $request_params['type'];
|
||||
$data['id_number'] = $request_params['id_number'];
|
||||
$data['id_number_mask'] = Mask::maskIdCard($request_params['id_number']);
|
||||
$data['sex'] = $sex ?? 0;
|
||||
$data['age'] = empty($age) ? null : $age;
|
||||
|
||||
if (isset($area)) {
|
||||
$data['province_id'] = $request_params['province_id'];
|
||||
$data['province'] = $area['province']['area_name'];
|
||||
$data['province'] = $area['province']['area_name'] ?? "";
|
||||
|
||||
$data['city_id'] = $request_params['city_id'];
|
||||
$data['city'] = $area['city']['area_name'];
|
||||
$data['city'] = $area['city']['area_name'] ?? "";
|
||||
|
||||
$data['county_id'] = $request_params['county_id'];
|
||||
$data['county'] = $area['county']['area_name'];
|
||||
$data['county'] = $area['county']['area_name'] ?? "";
|
||||
}
|
||||
|
||||
if (!empty($request_params['height'])){
|
||||
$data['height'] = $request_params['height'];
|
||||
}
|
||||
|
||||
if (!empty($request_params['weight'])){
|
||||
$data['weight'] = $request_params['weight'];
|
||||
}
|
||||
|
||||
$data['marital_status'] = $request_params['marital_status'] ?? 0;
|
||||
$data['nation_id'] = $request_params['nation_id'] ?? null;
|
||||
$data['nation_name'] = $nation['nation_name'] ?? "";
|
||||
$data['job_id'] = $request_params['job_id'] ?? null;
|
||||
$data['job_name'] = $job['job_name'] ?? "";
|
||||
if (!empty($request_params['nation_id'])){
|
||||
$data['nation_id'] = $request_params['nation_id'];
|
||||
$data['nation_name'] = $nation['nation_name'];
|
||||
}
|
||||
|
||||
if (!empty($request_params['job_id'])){
|
||||
$data['job_id'] = $request_params['job_id'];
|
||||
$data['job_name'] = $job['job_name'];
|
||||
}
|
||||
|
||||
$patient_family = PatientFamilyModel::addPatientFamily($data);
|
||||
if (empty($patient_family)) {
|
||||
@ -211,5 +232,531 @@ class PatientFamilyService extends BaseService
|
||||
return success($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除家庭成员
|
||||
* @return array
|
||||
*/
|
||||
public function deleteFamily(): array
|
||||
{
|
||||
$family_id = $this->request->route('family_id');
|
||||
|
||||
$user_info = $this->request->getAttribute("userInfo") ?? [];
|
||||
|
||||
// 查看是否存在
|
||||
$params = array();
|
||||
$params['family_id'] = $family_id;
|
||||
$params['patient_id'] = $user_info['client_user_id'];
|
||||
$params['status'] = 1;
|
||||
$patient_family = PatientFamilyModel::getOne($params);
|
||||
if (empty($patient_family)) {
|
||||
return fail();
|
||||
}
|
||||
|
||||
Db::beginTransaction();
|
||||
|
||||
try {
|
||||
// 删除家庭成员
|
||||
$params = array();
|
||||
$params['family_id'] = $family_id;
|
||||
|
||||
$data = array();
|
||||
$data['status'] = 2; // 状态(1:正常 2:删除)
|
||||
PatientFamilyModel::edit($params, $data);
|
||||
|
||||
Db::commit();
|
||||
} catch (\Exception $e) {
|
||||
Db::rollBack();
|
||||
return fail(HttpEnumCode::SERVER_ERROR, $e->getMessage());
|
||||
}
|
||||
return success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取家庭成员详情
|
||||
* @return array
|
||||
*/
|
||||
public function getFamily(): array
|
||||
{
|
||||
$family_id = $this->request->route('family_id');
|
||||
|
||||
$user_info = $this->request->getAttribute("userInfo");
|
||||
|
||||
// 查看是否存在
|
||||
$params = array();
|
||||
$params['family_id'] = $family_id;
|
||||
$params['patient_id'] = $user_info['client_user_id'];
|
||||
$params['status'] = 1;
|
||||
|
||||
$patient_family = PatientFamilyModel::getOne($params);
|
||||
if (empty($patient_family)){
|
||||
return success();
|
||||
}
|
||||
|
||||
return success($patient_family->toArray());
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改家庭成员
|
||||
* @return array
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public function editFamily(): array
|
||||
{
|
||||
$family_id = $this->request->route('family_id');
|
||||
|
||||
$user_info = $this->request->getAttribute("userInfo");
|
||||
|
||||
$request_params = $this->request->all();
|
||||
|
||||
// 查看是否存在
|
||||
$params = array();
|
||||
$params['family_id'] = $family_id;
|
||||
$params['patient_id'] = $user_info['client_user_id'];
|
||||
$params['status'] = 1;
|
||||
$patient_family = PatientFamilyModel::getOne($params);
|
||||
if (empty($patient_family)) {
|
||||
return fail(HttpEnumCode::HTTP_ERROR, "成员不存在");
|
||||
}
|
||||
|
||||
// 获取全部家庭成员
|
||||
$params = array();
|
||||
$params[] = ["patient_id", '=', $user_info['client_user_id']];
|
||||
$params[] = ["status", '=', 1];
|
||||
$params[] = ["family_id", '!=', $family_id];
|
||||
$patient_familys = PatientFamilyModel::getList($params);
|
||||
if (!empty($patient_familys)) {
|
||||
foreach ($patient_familys as $key => $value) {
|
||||
if ($value['family_id'] == $family_id){
|
||||
continue;
|
||||
}
|
||||
// 检测姓名是否重复
|
||||
if ($patient_family['card_name'] != $request_params['card_name']) {
|
||||
if ($request_params['card_name'] == $value['card_name']) {
|
||||
// 姓名改变 检测是否与其他家庭成员姓名重复
|
||||
return fail(HttpEnumCode::HTTP_ERROR, "姓名重复");
|
||||
}
|
||||
}
|
||||
|
||||
// 检测证件号是否重复
|
||||
if ($value['type'] == $request_params['type'] && $request_params['id_number'] == $value['id_number']) {
|
||||
return fail(HttpEnumCode::HTTP_ERROR, "证件号码重复");
|
||||
}
|
||||
|
||||
// 检测患者关系-本人类型是否重复
|
||||
if ($request_params['relation'] == 1 && $value['relation'] == 1) {
|
||||
return fail(HttpEnumCode::HTTP_ERROR, "患者类型重复");
|
||||
}
|
||||
|
||||
// 检测是否默认字段是否重复
|
||||
if (isset($request_params['is_default'])) {
|
||||
if ($request_params['is_default'] == 1 && $value['is_default'] == 1) {
|
||||
// 记录原默认id
|
||||
$is_default_id = $value['family_id'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 检测省市区
|
||||
if ($request_params['province_id'] != $patient_family['province_id'] || $request_params['city_id'] != $patient_family['city_id'] || $request_params['county_id'] != $patient_family['county_id']){
|
||||
$areaService = new AreaService();
|
||||
|
||||
$req = $areaService->checkAreaById($request_params['province_id'],$request_params['city_id'],$request_params['county_id']);
|
||||
if(empty($req)){
|
||||
return fail(HttpEnumCode::HTTP_ERROR,"地区选择错误");
|
||||
}
|
||||
|
||||
$area = $areaService->getAreaById($request_params['province_id'],$request_params['city_id'],$request_params['county_id']);
|
||||
}
|
||||
|
||||
// 检测证件号是否修改
|
||||
if ($patient_family['id_number'] != $request_params['id_number'] || $patient_family['card_name'] != $request_params['card_name']){
|
||||
// 解析年龄、性别字段
|
||||
$age = getIdCardAge($this->request->input('id_number'));
|
||||
|
||||
$sex = getIdCardSex($this->request->input('id_number'));
|
||||
|
||||
// 实人认证-生产环境开启
|
||||
if (env("APP_ENV") == "prod"){
|
||||
$IdCard = new IdCard();
|
||||
|
||||
$params =array();
|
||||
$params['name'] = $request_params['card_name'];
|
||||
$params['cardNo'] = $request_params['id_number'];
|
||||
$res = $IdCard->checkIdCard($params);
|
||||
if (!empty($res)){
|
||||
return fail(HttpEnumCode::HTTP_ERROR,$res);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 民族
|
||||
if ($patient_family['nation_id'] != $request_params['nation_id']){
|
||||
$params = array();
|
||||
$params['nation_id'] = $request_params['nation_id'];
|
||||
$nation = BasicNation::getOne($params);
|
||||
if (empty($nation)){
|
||||
return fail(HttpEnumCode::HTTP_ERROR,"民族选择错误");
|
||||
}
|
||||
}
|
||||
|
||||
// 职业
|
||||
if ($patient_family['job_id'] != $request_params['job_id']){
|
||||
$params = array();
|
||||
$params['job_id'] = $request_params['job_id'];
|
||||
$job = BasicJob::getOne($params);
|
||||
if (empty($job)){
|
||||
return fail(HttpEnumCode::HTTP_ERROR,"职位选择错误");
|
||||
}
|
||||
}
|
||||
|
||||
Db::beginTransaction();
|
||||
|
||||
try {
|
||||
// 修改是否默认
|
||||
if (isset($is_default_id)) {
|
||||
$params = array();
|
||||
$params['family_id'] = $is_default_id;
|
||||
|
||||
$data = array();
|
||||
$data['is_default'] = 0;
|
||||
$data['updated_at'] = date('Y-m-d H:i:s', time());
|
||||
PatientFamilyModel::edit($params, $data);
|
||||
}
|
||||
|
||||
// 修改 患者家庭成员信息表-基本信息(patient_family)
|
||||
$params = array();
|
||||
$params['family_id'] = $family_id;
|
||||
|
||||
$data = array();
|
||||
$data['relation'] = $request_params['relation'];
|
||||
$data['status'] = 1;
|
||||
|
||||
if (isset($request_params['is_default'])) {
|
||||
if ($request_params['is_default'] != ""){
|
||||
$data['is_default'] = $request_params['is_default'];
|
||||
}
|
||||
}
|
||||
|
||||
if ($patient_family['card_name'] != $request_params['card_name'] || $patient_family['id_number'] != $request_params['id_number']) {
|
||||
$data['card_name'] = $request_params['card_name'];
|
||||
$data['card_name_mask'] = Mask::maskNameStr($request_params['card_name']);
|
||||
|
||||
$data['id_number'] = $request_params['id_number'];
|
||||
$data['id_number_mask'] = Mask::maskIdCard($request_params['id_number']);
|
||||
}
|
||||
|
||||
if ($patient_family['mobile'] != $request_params['mobile']) {
|
||||
$data['mobile'] = $request_params['mobile'];
|
||||
$data['mobile_mask'] = Mask::maskPhoneStr($request_params['mobile']);
|
||||
}
|
||||
|
||||
$data['type'] = $request_params['type'];
|
||||
if (isset($sex)) {
|
||||
$data['sex'] = $sex ?? 0;
|
||||
}
|
||||
if (isset($age)) {
|
||||
$data['age'] = empty($age) ? "" : $age;
|
||||
}
|
||||
|
||||
if (isset($area)) {
|
||||
// 如有改动,变量确定存在
|
||||
if ($request_params['province_id'] != $patient_family['province_id']){
|
||||
$data['province_id'] = $request_params['province_id'];
|
||||
$data['province'] = $area['province']['area_name'] ?? "";
|
||||
}
|
||||
|
||||
if ($request_params['city_id'] != $patient_family['city_id']){
|
||||
$data['city_id'] = $request_params['city_id'];
|
||||
$data['city'] = $area['city']['area_name'] ?? "";
|
||||
}
|
||||
|
||||
if ($request_params['county_id'] != $patient_family['county_id']){
|
||||
$data['county_id'] = $request_params['county_id'];
|
||||
$data['county'] = $area['county']['area_name'] ?? "";
|
||||
}
|
||||
}
|
||||
|
||||
if ($request_params['height'] != $patient_family['height']){
|
||||
$data['height'] = $request_params['height'];
|
||||
}
|
||||
|
||||
if ($request_params['weight'] != $patient_family['weight']){
|
||||
$data['weight'] = $request_params['weight'];
|
||||
}
|
||||
|
||||
if ($request_params['marital_status'] != $patient_family['marital_status']){
|
||||
$data['marital_status'] = $request_params['marital_status'];
|
||||
}
|
||||
|
||||
if ($request_params['nation_id'] != $patient_family['nation_id']){
|
||||
$data['nation_id'] = $request_params['nation_id'];
|
||||
$data['nation_name'] = $nation['nation_name'];
|
||||
}
|
||||
|
||||
if ($request_params['job_id'] != $patient_family['job_id']){
|
||||
$data['job_id'] = $request_params['job_id'];
|
||||
$data['job_name'] = $job['job_name'];
|
||||
}
|
||||
|
||||
$data['updated_at'] = date('Y-m-d H:i:s', time());
|
||||
PatientFamilyModel::edit($params, $data);
|
||||
|
||||
Db::commit();
|
||||
|
||||
} catch (\Exception $e) {
|
||||
Db::rollBack();
|
||||
return fail(HttpEnumCode::SERVER_ERROR, $e->getMessage());
|
||||
}
|
||||
|
||||
return success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取家庭成员详情-个人情况
|
||||
* @return array
|
||||
*/
|
||||
public function getFamilyPersonal(): array
|
||||
{
|
||||
$family_id = $this->request->route('family_id');
|
||||
|
||||
$user_info = $this->request->getAttribute("userInfo");
|
||||
|
||||
$params = array();
|
||||
$params['family_id'] = $family_id;
|
||||
$params['patient_id'] = $user_info['client_user_id'];
|
||||
$patient_family_personal = PatientFamilyPersonalModel::getOne($params);
|
||||
|
||||
if (empty($patient_family_personal)){
|
||||
return success();
|
||||
}
|
||||
|
||||
return success($patient_family_personal->toArray());
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改家庭成员-个人情况
|
||||
* @return array
|
||||
*/
|
||||
public function editFamilyPersonal(): array
|
||||
{
|
||||
$family_personal_id = $this->request->route('family_personal_id');
|
||||
$user_info = $this->request->getAttribute("userInfo");
|
||||
$request_params = $this->request->all();
|
||||
|
||||
// 获取家庭成员-个人情况数据
|
||||
$params = array();
|
||||
$params['family_personal_id'] = $family_personal_id;
|
||||
$params['patient_id'] = $user_info['client_user_id'];
|
||||
$patient_family_personal = PatientFamilyPersonalModel::getOne($params);
|
||||
if (empty($patient_family_personal)) {
|
||||
return fail();
|
||||
}
|
||||
|
||||
// 修改
|
||||
$data = array();
|
||||
if ($request_params['is_allergy_history'] != $patient_family_personal['is_allergy_history']){
|
||||
// 是否存在过敏史(0:否 1:是)
|
||||
$data['is_allergy_history'] = $request_params['is_allergy_history'];
|
||||
$data['allergy_history'] = $request_params['allergy_history'];
|
||||
}
|
||||
|
||||
if ($request_params['is_family_history'] != $patient_family_personal['is_family_history']){
|
||||
// 是否存在家族病史(0:否 1:是)
|
||||
$data['is_family_history'] = $request_params['is_family_history'];
|
||||
$data['family_history'] = $request_params['family_history'];
|
||||
}
|
||||
|
||||
if ($request_params['is_pregnant'] != $patient_family_personal['is_pregnant']){
|
||||
// 是否备孕、妊娠、哺乳期(0:否 1:是)
|
||||
$data['is_pregnant'] = $request_params['is_pregnant'];
|
||||
$data['pregnant'] = $request_params['pregnant'];
|
||||
}
|
||||
|
||||
if ($request_params['is_operation'] != $patient_family_personal['is_operation']){
|
||||
// 是否存在手术(0:否 1:是)
|
||||
$data['is_operation'] = $request_params['is_operation'];
|
||||
$data['operation'] = $request_params['operation'];
|
||||
}
|
||||
|
||||
if ($request_params['drink_wine_status'] != $patient_family_personal['drink_wine_status']){
|
||||
// 饮酒状态(1:从不 2:偶尔 3:经常 4:每天 5:已戒酒)
|
||||
$data['drink_wine_status'] = $request_params['drink_wine_status'];
|
||||
}
|
||||
|
||||
if ($request_params['smoke_status'] != $patient_family_personal['smoke_status']){
|
||||
// 吸烟状态(1:从不 2:偶尔 3:经常 4:每天 5:已戒烟)
|
||||
$data['smoke_status'] = $request_params['smoke_status'];
|
||||
}
|
||||
|
||||
if ($request_params['chemical_compound_status'] != $patient_family_personal['chemical_compound_status']){
|
||||
// 化合物状态(1:从不 2:偶尔 3:经常 4:每天)
|
||||
$data['chemical_compound_status'] = $request_params['chemical_compound_status'];
|
||||
$data['chemical_compound_describe'] = $request_params['chemical_compound_describe'];
|
||||
}
|
||||
|
||||
$data['updated_at'] = date('Y-m-d H:i:s', time());
|
||||
|
||||
$params = array();
|
||||
$params['family_personal_id'] = $patient_family_personal['family_personal_id'];
|
||||
|
||||
PatientFamilyPersonalModel::edit($params, $data);
|
||||
return success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增家庭成员-个人情况
|
||||
* @return array
|
||||
*/
|
||||
public function addFamilyPersonal(): array
|
||||
{
|
||||
$user_info = $this->request->getAttribute("userInfo");
|
||||
$request_params = $this->request->all();
|
||||
|
||||
$params = array();
|
||||
$params['family_id'] = $request_params['family_id'];
|
||||
$params['patient_id'] = $user_info['client_user_id'];
|
||||
$params['status'] = 1;
|
||||
$patient_family = PatientFamilyModel::getOne($params);
|
||||
if (empty($patient_family)) {
|
||||
return fail();
|
||||
}
|
||||
|
||||
// 获取家庭成员-个人情况
|
||||
$params = array();
|
||||
$params['family_id'] = $request_params['family_id'];
|
||||
$params['patient_id'] = $user_info['client_user_id'];
|
||||
$patient_family_personal = PatientFamilyPersonalModel::getOne($params);
|
||||
if (!empty($patient_family_personal)) {
|
||||
return fail();
|
||||
}
|
||||
|
||||
$data = array();
|
||||
$data['family_id'] = $request_params['family_id'];
|
||||
$data['patient_id'] = $user_info['client_user_id'];
|
||||
$data['is_allergy_history'] = $request_params['is_allergy_history'];
|
||||
$data['allergy_history'] = $request_params['allergy_history'];
|
||||
$data['is_family_history'] = $request_params['is_family_history'];
|
||||
$data['family_history'] = $request_params['family_history'];
|
||||
$data['is_pregnant'] = $request_params['is_pregnant'];
|
||||
$data['pregnant'] = $request_params['pregnant'];
|
||||
$data['is_operation'] = $request_params['is_operation'];
|
||||
$data['operation'] = $request_params['operation'];
|
||||
$data['drink_wine_status'] = $request_params['drink_wine_status'];
|
||||
$data['smoke_status'] = $request_params['smoke_status'];
|
||||
$data['chemical_compound_status'] = $request_params['chemical_compound_status'];
|
||||
$data['chemical_compound_describe'] = $request_params['chemical_compound_describe'];
|
||||
$patient_family_personal = PatientFamilyPersonalModel::addPatientFamilyPersonal($data);
|
||||
if (empty($patient_family_personal)){
|
||||
return fail();
|
||||
}
|
||||
|
||||
return success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取家庭成员-健康状况
|
||||
* @return array
|
||||
*/
|
||||
public function getFamilyHealth(): array
|
||||
{
|
||||
$family_id = $this->request->route('family_id');
|
||||
|
||||
$user_info = $this->request->getAttribute("userInfo");
|
||||
|
||||
$params = array();
|
||||
$params['family_id'] = $family_id;
|
||||
$params['patient_id'] = $user_info['client_user_id'];
|
||||
$patient_family_health = PatientFamilyHealth::getOne($params);
|
||||
if (empty($patient_family_health)){
|
||||
return success();
|
||||
}
|
||||
|
||||
return success($patient_family_health->toArray());
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改家庭成员-健康情况
|
||||
* @return array
|
||||
*/
|
||||
public function editFamilyHealth(): array
|
||||
{
|
||||
$family_health_id = $this->request->route('family_health_id');
|
||||
$user_info = $this->request->getAttribute("userInfo");
|
||||
$request_params = $this->request->all();
|
||||
|
||||
// 获取家庭成员-个人情况数据
|
||||
$params = array();
|
||||
$params['family_health_id'] = $family_health_id;
|
||||
$params['patient_id'] = $user_info['client_user_id'];
|
||||
$patient_family_health = PatientFamilyHealth::getOne($params);
|
||||
if (empty($patient_family_health)) {
|
||||
return fail();
|
||||
}
|
||||
|
||||
$data = array();
|
||||
if ($request_params['disease_class_id'] != $patient_family_health['disease_class_id']){
|
||||
// 疾病分类id-系统
|
||||
$data['disease_class_id'] = $request_params['disease_class_id'];
|
||||
|
||||
// 检测疾病是否正确
|
||||
$params = array();
|
||||
$params['disease_class_id'] = $request_params['disease_class_id'];
|
||||
$disease_class = DiseaseClass::getOne($params);
|
||||
if (empty($disease_class)){
|
||||
return fail(HttpEnumCode::HTTP_ERROR,"疾病数据错误");
|
||||
}
|
||||
|
||||
$data['disease_class_name'] = $disease_class['disease_class_name'];
|
||||
}
|
||||
|
||||
if ($request_params['diagnosis_date'] != $patient_family_health['diagnosis_date']){
|
||||
$data['diagnosis_date'] = $request_params['diagnosis_date'];
|
||||
}
|
||||
|
||||
if ($request_params['diagnosis_hospital'] != $patient_family_health['diagnosis_hospital']){
|
||||
$data['diagnosis_hospital'] = $request_params['diagnosis_hospital'];
|
||||
}
|
||||
|
||||
if ($request_params['drugs_name'] != $patient_family_health['drugs_name']){
|
||||
$data['drugs_name'] = $request_params['drugs_name'];
|
||||
}
|
||||
|
||||
$data['updated_at'] = date('Y-m-d H:i:s', time());
|
||||
|
||||
$params = array();
|
||||
$params['family_health_id'] = $patient_family_health['family_health_id'];
|
||||
|
||||
PatientFamilyHealth::edit($params,$data);
|
||||
|
||||
return success();
|
||||
}
|
||||
|
||||
public function addFamilyHealth(){
|
||||
$user_info = $this->request->getAttribute("userInfo");
|
||||
$request_params = $this->request->all();
|
||||
|
||||
$params = array();
|
||||
$params['family_id'] = $request_params['family_id'];
|
||||
$params['patient_id'] = $user_info['client_user_id'];
|
||||
$params['status'] = 1;
|
||||
$patient_family = PatientFamilyModel::getOne($params);
|
||||
if (empty($patient_family)) {
|
||||
return fail();
|
||||
}
|
||||
|
||||
// 获取家庭成员-个人情况数据
|
||||
$params = array();
|
||||
$params['family_id'] = $patient_family['family_id'];
|
||||
$params['patient_id'] = $user_info['client_user_id'];
|
||||
$patient_family_health = PatientFamilyHealth::getOne($params);
|
||||
if (empty($patient_family_health)) {
|
||||
return fail();
|
||||
}
|
||||
|
||||
$data = array();
|
||||
$data['family_id'] = $request_params['family_id'];
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@ -1254,6 +1254,10 @@ class UserDoctorService extends BaseService
|
||||
|
||||
$fields = [
|
||||
'doctor_id',
|
||||
'user_name',
|
||||
'avatar',
|
||||
'doctor_title',
|
||||
'department_custom_name',
|
||||
'iden_auth_status',
|
||||
'idcard_status',
|
||||
'multi_point_status',
|
||||
@ -1312,7 +1316,7 @@ class UserDoctorService extends BaseService
|
||||
$result['avatar'] = addAliyunOssWebsite($user_doctor['avatar']);
|
||||
$result['department_custom_name'] = $user_doctor['department_custom_name'];
|
||||
$result['hospital_name'] = $hospital['hospital_name'];
|
||||
$result['qr_code_url'] = addAliyunOssWebsite($user_doctor['qr_code']);
|
||||
$result['qr_code_url'] = addAliyunOssWebsite($user_doctor['qr_code'] ?? $qr_code);
|
||||
|
||||
return success($result);
|
||||
}
|
||||
|
||||
@ -230,6 +230,39 @@ Router::addGroup('/patient', function () {
|
||||
|
||||
// 新增家庭成员
|
||||
Router::post('', [PatientFamilyController::class, 'addFamily']);
|
||||
|
||||
// 修改家庭成员
|
||||
Router::put('/{family_id:\d+}', [PatientFamilyController::class, 'editFamily']);
|
||||
|
||||
// 删除家庭成员
|
||||
Router::delete('/{family_id:\d+}', [PatientFamilyController::class, 'deleteFamily']);
|
||||
|
||||
// 获取家庭成员详情
|
||||
Router::get('/{family_id:\d+}', [PatientFamilyController::class, 'getFamily']);
|
||||
|
||||
// 个人情况
|
||||
Router::addGroup('/personal', function () {
|
||||
// 获取家庭成员详情-个人情况
|
||||
Router::get('/{family_id:\d+}', [PatientFamilyController::class, 'getFamilyPersonal']);
|
||||
|
||||
// 修改家庭成员-个人情况
|
||||
Router::put('/{family_personal_id:\d+}', [PatientFamilyController::class, 'editFamilyPersonal']);
|
||||
|
||||
// 新增家庭成员-个人情况
|
||||
Router::post('', [PatientFamilyController::class, 'addFamilyPersonal']);
|
||||
});
|
||||
|
||||
// 健康情况
|
||||
Router::addGroup('/health', function () {
|
||||
// 获取家庭成员-健康状况
|
||||
Router::get('/{family_id:\d+}', [PatientFamilyController::class, 'getFamilyHealth']);
|
||||
|
||||
// 修改家庭成员-健康情况
|
||||
Router::put('/{family_health_id:\d+}', [PatientFamilyController::class, 'editFamilyHealth']);
|
||||
|
||||
// 新增家庭成员-健康情况
|
||||
Router::post('', [PatientFamilyController::class, 'addFamilyHealth']);
|
||||
});
|
||||
});
|
||||
|
||||
// 病例
|
||||
|
||||
@ -21,56 +21,60 @@ class IdCard extends Base
|
||||
*/
|
||||
public function checkIdCard(array $params): string
|
||||
{
|
||||
// 组合请求地址
|
||||
$api_url = $this->api_url . $this->version . '/idcard/check';
|
||||
try {
|
||||
// 组合请求地址
|
||||
$api_url = $this->api_url . $this->version . '/idcard/check';
|
||||
|
||||
$this->params['businessId'] = "f7262b91aac1448a848d29c0800b109a";
|
||||
$this->params['businessId'] = "f7262b91aac1448a848d29c0800b109a";
|
||||
|
||||
$this->params = array_merge($this->params,$params);
|
||||
$this->params = array_merge($this->params,$params);
|
||||
|
||||
// 获取签名
|
||||
$this->params['signature'] = $this->gen_signature();
|
||||
// 获取签名
|
||||
$this->params['signature'] = $this->gen_signature();
|
||||
|
||||
$this->options["form_params"] = $this->params;
|
||||
$this->options["form_params"] = $this->params;
|
||||
|
||||
$result = $this->httpRuest->getRequest($api_url,$this->options);
|
||||
$result = $this->httpRuest->getRequest($api_url,$this->options);
|
||||
|
||||
if (empty($result)){
|
||||
return "身份证认证失败";
|
||||
}
|
||||
|
||||
if ($result['code'] != "200"){
|
||||
throw new BusinessException("姓名与身份证号不一致");
|
||||
}
|
||||
|
||||
if (empty($result['result'])){
|
||||
return "身份证认证失败";
|
||||
}
|
||||
|
||||
// 处理不通过情况
|
||||
if ($result['result']['status'] == 2){
|
||||
switch ($result['result']['reasonType']) {
|
||||
case 2:
|
||||
return "输入姓名和身份证号不一致";
|
||||
break;
|
||||
case 3:
|
||||
return "查无此身份证";
|
||||
break;
|
||||
case 4:
|
||||
return "身份证照片信息与输入信息不一致";
|
||||
break;
|
||||
|
||||
default:
|
||||
return "身份证认证失败";
|
||||
break;
|
||||
if (empty($result)){
|
||||
return "身份证认证失败";
|
||||
}
|
||||
}
|
||||
|
||||
// 处理status为其他情况
|
||||
if ($result['result']['status'] != 1){
|
||||
return "身份证认证失败";
|
||||
}
|
||||
if ($result['code'] != "200"){
|
||||
throw new BusinessException("姓名与身份证号不一致");
|
||||
}
|
||||
|
||||
return "";
|
||||
if (empty($result['result'])){
|
||||
return "身份证认证失败";
|
||||
}
|
||||
|
||||
// 处理不通过情况
|
||||
if ($result['result']['status'] == 2){
|
||||
switch ($result['result']['reasonType']) {
|
||||
case 2:
|
||||
return "输入姓名和身份证号不一致";
|
||||
break;
|
||||
case 3:
|
||||
return "查无此身份证";
|
||||
break;
|
||||
case 4:
|
||||
return "身份证照片信息与输入信息不一致";
|
||||
break;
|
||||
|
||||
default:
|
||||
return "身份证认证失败";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// 处理status为其他情况
|
||||
if ($result['result']['status'] != 1){
|
||||
return "身份证认证失败";
|
||||
}
|
||||
|
||||
return "";
|
||||
} catch (\Exception $e) {
|
||||
throw new BusinessException($e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user