|
@@ -69,7 +69,8 @@ class PatientManager implements IPatientManager {
|
|
|
try {
|
|
|
if (kIsOnline && !kIsWeb) {
|
|
|
//在线状态,先查询是否存在本地未提交数据
|
|
|
- final entity = await db.repositories.patient.singleByCode(code);
|
|
|
+ final entity = await db.repositories.patient
|
|
|
+ .singleByCodeWithUserCode(code, Store.user.userCode!);
|
|
|
if (entity != null &&
|
|
|
entity.dataJson.isNotEmpty &&
|
|
|
entity.syncState != OfflineDataSyncState.success) {
|
|
@@ -172,7 +173,8 @@ class PatientManager implements IPatientManager {
|
|
|
|
|
|
Future<PatientEntity?> _checkPatientExist(String code) async {
|
|
|
try {
|
|
|
- final entity = await db.repositories.patient.singleByCode(code);
|
|
|
+ final entity = await db.repositories.patient
|
|
|
+ .singleByCodeWithUserCode(code, Store.user.userCode!);
|
|
|
return entity;
|
|
|
} catch (e) {
|
|
|
logger.e(
|
|
@@ -359,7 +361,8 @@ class PatientManager implements IPatientManager {
|
|
|
Future<bool> removePatient(String code) async {
|
|
|
bool result = false;
|
|
|
try {
|
|
|
- final entity = await db.repositories.patient.singleByCode(code);
|
|
|
+ final entity = await db.repositories.patient
|
|
|
+ .singleByCodeWithUserCode(code, Store.user.userCode!);
|
|
|
if (entity != null) {
|
|
|
result = await db.repositories.patient.delete(entity.id);
|
|
|
if (!result) {
|
|
@@ -409,8 +412,8 @@ class PatientManager implements IPatientManager {
|
|
|
}
|
|
|
|
|
|
Future<void> _syncCloud2Offline(PatientDTO dto) async {
|
|
|
- PatientEntity? entity =
|
|
|
- await db.repositories.patient.singleByCode(dto.code!);
|
|
|
+ PatientEntity? entity = await db.repositories.patient
|
|
|
+ .singleByCodeWithUserCode(dto.code!, Store.user.userCode!);
|
|
|
if (entity == null) {
|
|
|
entity = PatientEntity();
|
|
|
entity.isValid = true;
|