|
@@ -56,6 +56,21 @@ class PatientManager implements IPatientManager {
|
|
|
Future<PatientDTO?> getDetail(String code) async {
|
|
|
try {
|
|
|
final request = GetPatientRequest(code: code, token: Store.user.token);
|
|
|
+ if (kIsOnline) {
|
|
|
+ //在线状态,先查询是否存在本体未提交数据
|
|
|
+ final entity = await db.repositories.patient
|
|
|
+ .singleByCode(code, Store.user.userCode!);
|
|
|
+ if (entity != null &&
|
|
|
+ entity.dataJson.isNotEmpty &&
|
|
|
+ entity.syncState != OfflineDataSyncState.success) {
|
|
|
+ logger.i("PatientManager query patient detail location exist.");
|
|
|
+ final jsonMap = jsonDecode(entity.dataJson);
|
|
|
+ final dto = PatientDTO.fromJson(jsonMap);
|
|
|
+ return dto;
|
|
|
+ } else {
|
|
|
+ logger.i("PatientManager query patient detail location not exist.");
|
|
|
+ }
|
|
|
+ }
|
|
|
final result = await rpc.patient.getPatientDetailAsync(request);
|
|
|
return result;
|
|
|
} catch (e) {
|