PHP code example of lsg / auto-screen

1. Go to this page and download the library: Download lsg/auto-screen library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

lsg / auto-screen example snippets

  

namespace App\Http\Controllers\Clinical;
use Lsg\AutoScreen\Support\MakeValidateRequest;

class PatientController extends BaseController
{
    public function createPatients(MakeValidateRequest $request)
    {
        $user = request()->user;
        $card_no = $request->input('card_no', '');
        $gender = get_idcard_sex($card_no);
        $birth_year = get_idcard_year($card_no);
        if (Patients::where('users_id', $user->id)->where('card_no', $card_no)->exists()) {
            throw new ApiException('患者已存在,请勿重复添加');
        }
        $res = Patients::makeCreate(['users_id' => $user->id, 'gender' => $gender, 'birth_year' => $birth_year]);

        return success($res);
    }
  

use App\Http\Controllers\TestController;
use App\Http\Controllers\Clinical\PatientController;
return [
    'name'    => [
        [TestController::class . '@index',PatientController::class . '@createPatients'],
        ['bail', 's . '@index',PatientController::class . '@createPatients'],
        ['bail', '



namespace App\Http;

use Illuminate\Foundation\Http\Kernel as HttpKernel;

class Kernel extends HttpKernel
{
    /**
     * The application's global HTTP middleware stack.
     *
     * These middleware are run during every request to your application.
     *
     * @var array<int, class-string|string>
     */
    protected $middleware = [
        // \App\Http\Middleware\TrustHosts::class,
        // \App\Http\Middleware\TrustProxies::class,
        // \Fruitcake\Cors\HandleCors::class,
        \App\Http\Middleware\PreventRequestsDuringMaintenance::class,
        \Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
        \App\Http\Middleware\TrimStrings::class,
        \Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
    ];

    /**
     * The application's route middleware groups.
     *
     * @var array<string, array<int, class-string|string>>
     */
    protected $middlewareGroups = [
        'api' => [
            // \Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class,
            // 'throttle:api',
            // \Illuminate\Routing\Middleware\SubstituteBindings::class,
        ],
    ];

    /**
     * The application's route middleware.
     *
     * These middleware may be assigned to groups or used individually.
     *
     * @var array<string, class-string|string>
     */
    protected $routeMiddleware = [
        'auth'                 => \App\Http\Middleware\Authenticate::class,
        //缓存中间件
        'cache.make'           => \App\Http\Middleware\CacheMake::class,
        //入参验证器
        'validate.make'        => \Lsg\AutoScreen\Middleware\ValidateMake::class,
    ];
}
  

Route::group([
            'middleware' => ['cache.make:1,cancers'],
        ], function () {
            // 顶部六要素统计
            Route::get('top_six_element', [WorkbenchController::class, 'topSixElement']);
        });

bash
composer  vendor:publish --provider="Lsg\AutoScreen\AutoScreenServiceProvider"

config/app.php
增加 
//自动查询脚本
Lsg\AutoScreen\AutoScreenServiceProvider::class
bash

php artisan task:make_list AutoList
//在app/Lists下面生成了自动列表代码
使用方法:
 *      0.声明一个列表路由(比如/api/patient/list)
 *      1.在controller层$service->list($itemCode),
 *      2.在service层use当前类


//更新自动验证缓存
php artisan task:make_validate