初始化仓库
This commit is contained in:
51
platform/modules/v1/controllers/SyncController.php
Normal file
51
platform/modules/v1/controllers/SyncController.php
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
namespace platform\modules\v1\controllers;
|
||||
|
||||
use common\core\BasePlatformController;
|
||||
use yii\base\Exception;
|
||||
use common\models\UserPatient;
|
||||
use platform\models\forms\SyncPatientForm;
|
||||
|
||||
/**
|
||||
* @doc-module 互医数据同步
|
||||
*/
|
||||
class SyncController extends BasePlatformController
|
||||
{
|
||||
|
||||
/**
|
||||
* @doc-name 就诊人信息增加/修改同步
|
||||
* @doc-return mixed 同步结果
|
||||
*/
|
||||
public function actionPatient()
|
||||
{
|
||||
$post = \Yii::$app->request->post();
|
||||
|
||||
$syncPatientForm = new SyncPatientForm();
|
||||
$syncPatientForm->attributes = $post;
|
||||
return $syncPatientForm->save();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @doc-name 就诊人信息删除同步
|
||||
* @doc-return mixed 同步结果
|
||||
*/
|
||||
public function actionPatientDelete()
|
||||
{
|
||||
$post = \Yii::$app->request->post();
|
||||
|
||||
$userPatient = UserPatient::findOne(['user_id'=>$post['user_id'],'id_card'=>$post['id_card'],'is_delete' => 0]);
|
||||
if(!$userPatient){
|
||||
throw new Exception('就诊人信息错误,无法进行该操作');
|
||||
}
|
||||
|
||||
try {
|
||||
UserPatient::updateAll(['is_delete' => 1],['id' => $userPatient->id]);
|
||||
} catch (\Throwable $th) {
|
||||
throw new Exception('删除失败');
|
||||
} catch (\Exception $e) {
|
||||
throw new Exception('删除失败');
|
||||
}
|
||||
return ['删除同步成功'];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user