import 'package:vital_local_database/core/index.dart'; import 'package:vitalapp/database/entities/defines.dart'; import 'package:vitalapp/database/entities/patient.dart'; import 'interfaces/patient.dart'; class PatientRepository extends BaseDbRepository implements IPatientRepository { PatientRepository(super.database); @override PatientEntity createEntityInstance() => PatientEntity(); @override Future singleByCode( String code, String userCode, ) async { final entity = await queryable .where((x) => [ x.isValid.equals(true), x.code.equals(code), x.userCode.equals(userCode), //添加用户Code ]) .first(); return entity; } @override Future isNotUploadedPatient( String code, String userCode, ) async { final entity = await singleByCode(code, userCode); return entity != null && entity.syncState != OfflineDataSyncState.success; } }