Commit 0914b832 by lujunyi

Merge branch 'develop'

parents 1b6fa3c7 0e000050
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
use App\Models\PharmacyModel; use App\Models\PharmacyModel;
use App\Models\User; use App\Models\User;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Support\Facades\Log;
use Jxlwqq\IdValidator\IdValidator; use Jxlwqq\IdValidator\IdValidator;
use Milon\Barcode\DNS2D; use Milon\Barcode\DNS2D;
...@@ -220,8 +221,8 @@ public function duplicate(Request $request) ...@@ -220,8 +221,8 @@ public function duplicate(Request $request)
$authInfo = auth('api')->user(); $authInfo = auth('api')->user();
// 确保传递了 ID 参数 // 确保传递了 ID 参数
if (! isset($data['id']) || empty($data['id'])) { if (! isset($data['id']) || empty($data['id']) || ! is_numeric($data['id'])) {
return $this->failed('ID 参数缺失'); return $this->failed('无效二维码');
} }
// 根据传递的 ID 查找对应患者数据 // 根据传递的 ID 查找对应患者数据
...@@ -238,6 +239,14 @@ public function duplicate(Request $request) ...@@ -238,6 +239,14 @@ public function duplicate(Request $request)
$newPatient->user_id = $authInfo->id; $newPatient->user_id = $authInfo->id;
} elseif ($authInfo->last_login_type == User::LOGIN_TYPE_PHARMACY) { // 药店 } elseif ($authInfo->last_login_type == User::LOGIN_TYPE_PHARMACY) { // 药店
$pharmacy = PharmacyModel::query()->where('user_id', $authInfo->id)->first(); $pharmacy = PharmacyModel::query()->where('user_id', $authInfo->id)->first();
// 校验该药店是否已经存在手机号+用户名
$patientInfo = PatientModel::where('mobile', $existingPatient->mobile)->where('name', $existingPatient->name)->where('pharmacy_id', $pharmacy->id)->first();
// Log::info('patient=>'. json_encode($patientInfo).'=='.json_encode($existingPatient).'=='. $pharmacy->id);
if ($patientInfo) {
// return $this->failed('该问诊人信息已存在');
// return $this->failed('该问诊人信息已存在', ['data' => false], 200);
return $this->success($patientInfo);
}
if ($pharmacy) { if ($pharmacy) {
$newPatient->pharmacy_id = $pharmacy->id; $newPatient->pharmacy_id = $pharmacy->id;
} else { } else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment