76 lines
1.8 KiB
PHP
76 lines
1.8 KiB
PHP
<?php
|
|
|
|
namespace App\Services;
|
|
|
|
use App\Model\Hospital;
|
|
use App\Model\HospitalDepartmentCustom;
|
|
|
|
/**
|
|
* 基础数据服务类
|
|
*/
|
|
class BasicDataService extends BaseService
|
|
{
|
|
/**
|
|
* 获取医院数据
|
|
* @return array
|
|
*/
|
|
public function getHospital(): array
|
|
{
|
|
$hospital_name = $this->request->input('hospital_name');
|
|
$province_id = $this->request->input('province_id');
|
|
$city_id = $this->request->input('city_id');
|
|
$county_id = $this->request->input('county_id');
|
|
|
|
$params = array();
|
|
$params[] = ['hospital_status', '=', 1];
|
|
|
|
if (!empty($hospital_name)) {
|
|
$params[] = ['hospital_name', 'like', '%' . $hospital_name . '%'];
|
|
}
|
|
|
|
if (!empty($province_id)) {
|
|
$params[] = ['province_id', '=', $province_id];
|
|
}
|
|
|
|
if (!empty($city_id)) {
|
|
$params[] = ['city_id', '=', $city_id];
|
|
}
|
|
|
|
if (!empty($county_id)) {
|
|
$params[] = ['county_id', '=', $county_id];
|
|
}
|
|
|
|
$fields = [
|
|
'hospital_id',
|
|
'hospital_name',
|
|
];
|
|
|
|
$hospital = Hospital::getList($params,$fields);
|
|
if (empty($hospital)){
|
|
return success();
|
|
}
|
|
|
|
return success($hospital->toArray());
|
|
}
|
|
|
|
/**
|
|
* 获取自定义科室数据
|
|
* @return array
|
|
*/
|
|
public function getCustomDepartment(): array
|
|
{
|
|
$params = array();
|
|
$params['department_status'] = 1;
|
|
|
|
$fields = [
|
|
'department_custom_id',
|
|
'department_custom_name',
|
|
];
|
|
$hospital_department_custom = HospitalDepartmentCustom::getList($params,$fields);
|
|
if (empty($hospital_department_custom)){
|
|
return success();
|
|
}
|
|
|
|
return success($hospital_department_custom->toArray());
|
|
}
|
|
} |