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);
}