新增搜索平台疾病分类接口

This commit is contained in:
2023-03-01 14:37:12 +08:00
parent ad7e6551f1
commit 5a4fcaaf7f
5 changed files with 103 additions and 25 deletions
+20
View File
@@ -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);
}
}