患者信息、挂号记录、处方记录、退款功能鉴权

This commit is contained in:
2024-09-26 11:09:42 +08:00
parent 60dfeb3c05
commit 90a71b6511
5 changed files with 163 additions and 2 deletions

View File

@@ -99,6 +99,87 @@ class PatientController extends BaseServiceController
return $this->create($query, $post);
}
/**
* @doc-name 就诊记录列表-医生端
* @doc-param int up_id 就诊人id
*/
public function actionRecordListByDoctor()
{
$post = \Yii::$app->request->post();
$up_id = \Yii::$app->request->post('up_id');
if (!$up_id) {
throw new Exception('就诊人id不能为空');
}
$Register = Register::find()->where([
'user_patient_id' => $up_id,
'store_id' => $post['store_id'],
'is_delete' => 0,
'is_cancel'=>0,
])->all();
if (!$Register) throw new Exception('暂无挂号记录');
$query = Register::find()->where([
'user_patient_id' => $up_id,
'store_id' => $post['store_id'],
'is_delete' => 0,
])->with(['store','depart','patient','doctor'])->orderBy(['id'=>SORT_DESC]);
if (!empty($post['patient_id'])) $query->andWhere(['user_patient_id'=>$post['patient_id']]);
$this->field=[
Register::class=>[
'id','user_id','order_no','service_user_id',
'store'=>'store.name',
'user_patient_id',
'depart'=>'depart.name',
'doctor'=>'doctor.name',
'order_number','price',
'patient'=>'patient.name',
'idcard'=>'patient.id_card',
'mobile'=>'patient.mobile',
'status','status_text','status_type','is_pay','created_at','is_cancel'
]
];
$list = $this->create($query,$post);
foreach ($list->models as &$model) {
$model->status_text = self::getStatusInfo($model->status, 'text');
$model->status_type = self::getStatusInfo($model->status, 'type');
}
return $list;
}
public static function getStatusInfo($status , $type)
{
$data = [
// 0待支付1已支付待接诊2接诊中3已结束4已取消5待评价6已评价7已拒诊
'text' => [
0 => '待支付',
1 => '已支付待接诊',
2 => '接诊中',
3 => '已结束',
4 => '已取消',
5 => '待评价',
6 => '已评价',
7 => '已拒诊'
],
'type' => [
0 => 'info',
1 => 'info',
2 => 'success',
3 => 'info',
4 => 'error',
5 => 'info',
6 => 'success',
7 => 'warning',
]
];
return $data[$type][$status];
}
/**
* @doc-name 处方记录