修正医生处方列表参数错误问题,新增获取处方列表接口
This commit is contained in:
@@ -18,7 +18,7 @@ use Hyperf\Snowflake\Concern\Snowflake;
|
||||
* @property int $doctor_id 医生id
|
||||
* @property int $patient_id 患者id
|
||||
* @property int $pharmacist_id 药师id
|
||||
* @property int $prescription_status 处方状态(1:待审核 3:待使用 4:已失效 5:已使用)
|
||||
* @property int $prescription_status 处方状态(1:待审核 2:待使用 3:已失效 4:已使用)
|
||||
* @property int $pharmacist_audit_status 药师审核状态(0:审核中 1:审核成功 2:审核驳回)
|
||||
* @property string $pharmacist_fail_reason 药师审核驳回原因
|
||||
* @property int $platform_audit_status 处方平台审核状态(0:审核中 1:审核成功 2:审核驳回)
|
||||
@@ -52,13 +52,29 @@ class OrderPrescription extends Model
|
||||
protected string $primaryKey = "order_prescription_id";
|
||||
|
||||
/**
|
||||
* 关联处方病例表
|
||||
* 关联处方疾病表
|
||||
*/
|
||||
public function OrderPrescriptionIcd(): HasMany
|
||||
{
|
||||
return $this->HasMany(OrderPrescriptionIcd::class, 'order_prescription_id','order_prescription_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* 关联处方商品表
|
||||
*/
|
||||
public function OrderPrescriptionProduct(): HasMany
|
||||
{
|
||||
return $this->HasMany(OrderPrescriptionProduct::class, 'order_prescription_id','order_prescription_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* 关联医生表
|
||||
*/
|
||||
public function UserDoctor(): HasOne
|
||||
{
|
||||
return $this->hasOne(UserDoctor::class, 'doctor_id','doctor_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取信息-单条
|
||||
* @param array $params
|
||||
@@ -168,4 +184,33 @@ class OrderPrescription extends Model
|
||||
return self::where($params)->count();
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页
|
||||
* 处方疾病表
|
||||
* 处方商品表
|
||||
* @param array $params
|
||||
* @param array $fields
|
||||
* @param int|null $page
|
||||
* @param int|null $per_page
|
||||
* @return array
|
||||
*/
|
||||
public static function getWithPage(array $params, array $fields = ["*"], int $page = null, ?int $per_page = 10): array
|
||||
{
|
||||
$raw = self::with([
|
||||
"UserDoctor:doctor_id,user_name,doctor_title",
|
||||
"OrderPrescriptionIcd:prescription_icd_id,order_prescription_id,icd_name",
|
||||
"OrderPrescriptionProduct:prescription_product_id,order_prescription_id,product_name,product_spec"
|
||||
])
|
||||
->where($params)->paginate($per_page, $fields, "page", $page);
|
||||
|
||||
$data = array();
|
||||
$data['current_page'] = $raw->currentPage();// 当前页码
|
||||
$data['total'] = $raw->total();//数据总数
|
||||
$data['data'] = $raw->items();//数据
|
||||
$data['per_page'] = $raw->perPage();//每页个数
|
||||
$data['last_page'] = $raw->lastPage();//最后一页
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user