初始化仓库
This commit is contained in:
56
member/models/forms/PayForm.php
Normal file
56
member/models/forms/PayForm.php
Normal file
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
namespace member\models\forms;
|
||||
|
||||
use common\core\BaseModel;
|
||||
use common\models\UserPatientRecord;
|
||||
use yii\db\Exception;
|
||||
|
||||
//缴费
|
||||
class PayForm extends BaseModel
|
||||
{
|
||||
public $up_id;
|
||||
public $height;
|
||||
public $weight;
|
||||
public $region;
|
||||
public $address;
|
||||
|
||||
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
[['up_id', 'height', 'weight'], 'required'],
|
||||
[['up_id'], 'integer'],
|
||||
[['height', 'weight'], 'number'],
|
||||
[['region', 'address'], 'string', 'max' => 255],
|
||||
];
|
||||
}
|
||||
|
||||
public function GoPutRecord()
|
||||
{
|
||||
if (!$this->validate()){
|
||||
throw new Exception($this->getErrorMsg());
|
||||
}
|
||||
$is_record=UserPatientRecord::find()->where(['up_id'=>$this->up_id])->one();
|
||||
if ($is_record){
|
||||
throw new Exception('您已建过档');
|
||||
}
|
||||
$UserPatientRecord=new UserPatientRecord();
|
||||
$UserPatientRecord->attributes=$this->attributes;
|
||||
|
||||
$UserPatientRecord->saveOrFail();
|
||||
|
||||
return ['建档成功,病案号为'.$UserPatientRecord->id];
|
||||
}
|
||||
|
||||
public function attributeLabels()
|
||||
{
|
||||
return [
|
||||
'up_id'=>'就诊人id',
|
||||
'height' => 'Height',
|
||||
'weight' => 'Weight',
|
||||
'region' => 'Region',
|
||||
'address' => 'Address',
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user