患者信息、挂号记录、处方记录、退款功能鉴权
This commit is contained in:
@@ -114,7 +114,11 @@ class FinanceController extends BaseAdminController
|
||||
*/
|
||||
public function actionAdminRefundAgree()
|
||||
{
|
||||
// TODO 退款记录生成,然后走退款流程
|
||||
$identity = \Yii::$app->user->identity;
|
||||
if ($identity != 10) {
|
||||
throw new Exception('权限不足,仅超管有权限退款');
|
||||
}
|
||||
|
||||
// 获取前端传递的POST数据
|
||||
$post = \Yii::$app->request->post();
|
||||
|
||||
@@ -526,7 +530,7 @@ class FinanceController extends BaseAdminController
|
||||
$parameter['header'] = ['单号','订单类型', '用户', '金额', '状态', '时间'];
|
||||
$parameter['data'] = Ledger::inventory($params,\Yii::$app->user->identity->store_id);
|
||||
}
|
||||
|
||||
|
||||
ExportService::ExportByCors($parameter);
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,8 @@ class Register extends \common\modelsgii\Register
|
||||
const EVENT_CREATED = 'RegisterCreated';
|
||||
const EVENT_PAYED = 'RegisterPayed';
|
||||
const EVENT_CANCELED = 'RegisterCanceled';
|
||||
public $status_text;
|
||||
public $status_type;
|
||||
|
||||
public function behaviors()
|
||||
{
|
||||
|
||||
@@ -87,6 +87,40 @@ class ExamineController extends BasePharmacistController
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @doc-name 处方列表
|
||||
* @doc-param int status 状态0待审核 1已审核通过 2未通过
|
||||
* @doc-return mixed @PrescriptionChinese{*,@UserPatient{*}} 中药处方
|
||||
* @doc-return mixed @PrescriptionWest{*,@UserPatient{*}} 中药处方
|
||||
*/
|
||||
public function actionListByDoctor()
|
||||
{
|
||||
$prescription = Prescription::find()->where(['up_id' => \Yii::$app->request->get('up_id'), 'store_id' => \Yii::$app->request->get('store_id')])->with('patients')->orderBy('created_at DESC')->asArray()->all();
|
||||
if (!$prescription) {
|
||||
throw new Exception('暂无数据');
|
||||
}
|
||||
|
||||
foreach ($prescription as &$v) {
|
||||
$tmp = json_decode($v['content'], true);
|
||||
$v['p_category'] = $tmp['category'];
|
||||
$v['p_repice'] = $tmp['repice'];
|
||||
$v['p_drugs'] = [];
|
||||
foreach ($tmp['repice'] as $repiceInfo) {
|
||||
$drugJson = json_decode($repiceInfo['content'], true);
|
||||
if (!array_key_exists('drug_name', $drugJson)) {
|
||||
$v['p_drugs'] = array_column($drugJson, 'name');
|
||||
} else {
|
||||
$v['p_drugs'][] = $drugJson['drug_name'];
|
||||
}
|
||||
|
||||
}
|
||||
// $v['p_drug_name'] = json_decode($tmp['repice'][0]['content'])['drug_name'];
|
||||
$v['created_at'] = !empty($v['created_at']) ? date('Y-m-d H:i:s', $v['created_at']) : '';
|
||||
}
|
||||
|
||||
return $prescription;
|
||||
}
|
||||
|
||||
/**
|
||||
* @doc-name 处方审核
|
||||
* @doc-param int prescription_id 处方id
|
||||
|
||||
@@ -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 处方记录
|
||||
|
||||
@@ -60,6 +60,46 @@ class StoreAcceptController extends BaseAppController
|
||||
$register['prescription'] = $prescription;
|
||||
return $register;
|
||||
}
|
||||
/**
|
||||
* @doc-name 患者信息(线下患者挂号信息)
|
||||
* @doc-param int register_id 挂号id
|
||||
* @doc-param int patient_id 患者id
|
||||
* @doc-return mixed @Register{*} 挂号信息
|
||||
* @doc-return mixed @UserPatient{*} 患者信息
|
||||
* @doc-return mixed @UserPatientHealthInquiry{*} 健康信息
|
||||
* @doc-return mixed @Store{name-string-门店} 门店信息
|
||||
* @doc-return mixed @Doctor{name-string-医生} 医生信息
|
||||
* @doc-return mixed @Depart{name-string-科室} 科室信息
|
||||
*/
|
||||
public function actionPatientDetailAll()
|
||||
{
|
||||
$post=\Yii::$app->request->post();
|
||||
$this->requestValidate($post,[
|
||||
[['patient_id','register_id'],'required']
|
||||
]);
|
||||
|
||||
$register=Register::find()->where([
|
||||
'id'=>$post['register_id'],
|
||||
'service_user_id'=>\Yii::$app->user->id,
|
||||
'user_patient_id'=>$post['patient_id'],
|
||||
'is_cancel'=>0,
|
||||
'is_delete'=>0
|
||||
])->with(['patient','healthInquery'])
|
||||
->with(['depart'=>function($d){
|
||||
$d->select('name');
|
||||
}])
|
||||
->with(['doctor'=>function($d){
|
||||
$d->select('name');
|
||||
}])
|
||||
->with(['store'=>function($s){
|
||||
$s->select('name');
|
||||
}])
|
||||
->asArray()->one();
|
||||
if (!$register) throw new Exception('挂号不存在');
|
||||
$prescription = Prescription::find()->select('id,prescription_no')->where(['register_id' => $register['id']])->all();
|
||||
$register['prescription'] = $prescription;
|
||||
return $register;
|
||||
}
|
||||
|
||||
/**
|
||||
* @doc-name 患者详情
|
||||
|
||||
Reference in New Issue
Block a user