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

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

@@ -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