<?php

namespace App\Services;

use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;

class ConflictService
{
    public function logConflict($name, $idCardNum, $currentOrgName,$doctor_name, $lastOrgName, $lastCheckupTime, $type, $source)
    {
        try {
            DB::table('conflict_record')->insert([
                'name' => $name,
                'id_card_num' => $idCardNum,
                'current_org_name' => $currentOrgName,
                'doctor_name' => $doctor_name,
                'last_org_name' => $lastOrgName,
                'last_checkup_time' => $lastCheckupTime,
                'type' => $type,
                'source' => $source,
                'created_at' => date('Y-m-d H:i:s'),
                'updated_at' => date('Y-m-d H:i:s'),
            ]);
        } catch (\Exception $e) {
            Log::error('冲突记录写入失败: ' . $e->getMessage());
        }
    }
}
