新增搜索平台疾病分类接口
This commit is contained in:
parent
ad7e6551f1
commit
5a4fcaaf7f
@ -114,7 +114,12 @@ class BasicDataController extends AbstractController
|
||||
return $this->response->json($data);
|
||||
}
|
||||
|
||||
// 搜索商品
|
||||
/**
|
||||
* 搜索商品
|
||||
* @return ResponseInterface
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function getProductSearch(): ResponseInterface
|
||||
{
|
||||
$request = $this->container->get(BasicDataRequest::class);
|
||||
@ -124,4 +129,20 @@ class BasicDataController extends AbstractController
|
||||
$data = $BasicDataService->getProductSearch();
|
||||
return $this->response->json($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 搜索平台疾病分类
|
||||
* @return ResponseInterface
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function getDiseaseIcdSearch(): ResponseInterface
|
||||
{
|
||||
$request = $this->container->get(BasicDataRequest::class);
|
||||
$request->scene('getDiseaseIcdSearch')->validateResolved();
|
||||
|
||||
$BasicDataService = new BasicDataService();
|
||||
$data = $BasicDataService->getDiseaseIcdSearch();
|
||||
return $this->response->json($data);
|
||||
}
|
||||
}
|
||||
@ -73,4 +73,24 @@ class DiseaseClassIcd extends Model
|
||||
{
|
||||
return self::where($params)->limit($limit)->get($fields);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取关键字搜索列表
|
||||
* @param array $params
|
||||
* @param string $keyword
|
||||
* @param array $fields
|
||||
* @return Collection|array
|
||||
*/
|
||||
public static function getSearchKeywordList(array $params = [],string $keyword = '',array $fields = ['*']): Collection|array
|
||||
{
|
||||
return self::when($keyword, function ($query, $keyword) {
|
||||
$query->where(function ($query) use ($keyword) {
|
||||
$query->orwhere("icd_name", 'like', '%' . $keyword . '%');
|
||||
$query->orwhere("icd_code", 'like', '%' . $keyword . '%');
|
||||
$query->orwhere("icd_spell", 'like', '%' . $keyword . '%');
|
||||
});
|
||||
})
|
||||
->where($params)
|
||||
->get($fields);
|
||||
}
|
||||
}
|
||||
|
||||
@ -20,7 +20,10 @@ class BasicDataRequest extends FormRequest
|
||||
],
|
||||
'getProductSearch' => [ // 搜索商品
|
||||
'product_keyword',
|
||||
]
|
||||
],
|
||||
'getDiseaseIcdSearch' => [ // 搜索平台疾病分类
|
||||
'icd_keyword',
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
@ -40,7 +43,6 @@ class BasicDataRequest extends FormRequest
|
||||
'province_id' => 'required_with:city_id,county_id',
|
||||
'city_id' => 'required_with:county_id',
|
||||
'disease_class_name' => 'required',
|
||||
'product_keyword' => 'required',
|
||||
];
|
||||
}
|
||||
|
||||
@ -53,7 +55,6 @@ class BasicDataRequest extends FormRequest
|
||||
'province_id.required_with' => "请选择省份",
|
||||
'city_id.required_with' => "请选择城市",
|
||||
'disease_class_name.required' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'product_keyword.required' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@ -5,6 +5,7 @@ namespace App\Services;
|
||||
use App\Model\BasicBank;
|
||||
use App\Model\DiseaseClass;
|
||||
use App\Model\DiseaseClassExpertise;
|
||||
use App\Model\DiseaseClassIcd;
|
||||
use App\Model\Hospital;
|
||||
use App\Model\HospitalDepartmentCustom;
|
||||
use App\Model\OperationManual;
|
||||
@ -191,7 +192,12 @@ class BasicDataService extends BaseService
|
||||
return success($disease_class_expertise);
|
||||
}
|
||||
|
||||
public function getProductSearch(){
|
||||
/**
|
||||
* 搜索商品
|
||||
* @return array
|
||||
*/
|
||||
public function getProductSearch(): array
|
||||
{
|
||||
$product_keyword = $this->request->input('product_keyword');
|
||||
|
||||
$fields = [
|
||||
@ -222,4 +228,28 @@ class BasicDataService extends BaseService
|
||||
|
||||
return success($product->toArray());
|
||||
}
|
||||
|
||||
/**
|
||||
* 搜索平台疾病分类
|
||||
* @return array
|
||||
*/
|
||||
public function getDiseaseIcdSearch(): array
|
||||
{
|
||||
$icd_keyword = $this->request->input('icd_keyword','');
|
||||
|
||||
$fields = [
|
||||
'icd_id',
|
||||
'icd_name',
|
||||
];
|
||||
$params = array();
|
||||
$params['icd_status'] = 1;// 状态(0:删除 1:正常)
|
||||
$params['icd_enable'] = 1;// 是否启用(0:否 1:是)
|
||||
$disease_class_icd = DiseaseClassIcd::getSearchKeywordList($params, $icd_keyword, $fields);
|
||||
if (empty($disease_class_icd)){
|
||||
return success();
|
||||
}
|
||||
|
||||
return success($disease_class_icd->toArray());
|
||||
|
||||
}
|
||||
}
|
||||
@ -287,6 +287,12 @@ Router::addGroup('/basic', function () {
|
||||
Router::get('/expertise', [BasicDataController::class, 'getDiseaseExpertiseList']);
|
||||
});
|
||||
|
||||
// 平台疾病分类
|
||||
Router::addGroup('/icd', function () {
|
||||
// 搜索平台疾病分类
|
||||
Router::get('/search', [BasicDataController::class, 'getDiseaseIcdSearch']);
|
||||
});
|
||||
|
||||
// 搜索商品
|
||||
Router::addGroup('/product', function () {
|
||||
// 搜索商品
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user