51 lines
1.5 KiB
PHP
51 lines
1.5 KiB
PHP
<?php
|
|
|
|
namespace App\Services;
|
|
|
|
use App\Model\OrderPrescription;
|
|
use App\Model\ReportRegulatory;
|
|
|
|
/**
|
|
* 监管平台
|
|
*/
|
|
class ReportRegulatoryService extends BaseService
|
|
{
|
|
/**
|
|
* 增加上报监管平台表
|
|
* @param string $order_inquiry_id
|
|
* @param string $order_prescription_id
|
|
* @return bool
|
|
*/
|
|
public function addReportRegulatory(string $order_inquiry_id): bool
|
|
{
|
|
// 检测是否已添加数据
|
|
$params = array();
|
|
$params['order_inquiry_id'] = $order_inquiry_id;
|
|
$report_regulatory = ReportRegulatory::getOne($params);
|
|
if (empty($report_regulatory)){
|
|
// 检测是否存在处方
|
|
$params = array();
|
|
$params['order_inquiry_id'] = $order_inquiry_id;
|
|
$params['pharmacist_audit_status'] = 1;
|
|
$params['platform_audit_status'] = 1;
|
|
$order_prescription = OrderPrescription::getOne($params);
|
|
|
|
// 添加数据
|
|
$data = array();
|
|
$data['order_inquiry_id'] = $order_inquiry_id;
|
|
if (!empty($order_prescription)){
|
|
$data['order_prescription_id'] = $order_prescription['order_prescription_id'];
|
|
$data['is_further_consult'] = 1;
|
|
$data['is_prescription'] = 1;
|
|
}
|
|
$report_regulatory = ReportRegulatory::addReportRegulatory($data);
|
|
if (empty($report_regulatory)){
|
|
return false;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
} |