|
@@ -1,6 +1,3 @@
|
|
|
-import 'dart:convert';
|
|
|
-
|
|
|
-import 'package:fis_jsonrpc/services/analyzeConfig.m.dart';
|
|
|
import 'package:fis_jsonrpc/services/followUp.dart';
|
|
|
import 'package:fis_jsonrpc/services/followUp.m.dart';
|
|
|
import 'package:uuid/uuid.dart';
|
|
@@ -20,11 +17,15 @@ class FollowUpServiceMock extends VitalFollowUpService {
|
|
|
entity.syncType = OfflineDataSyncType.create;
|
|
|
entity.userCode = Store.user.userCode!;
|
|
|
entity.patientCode = Store.user.currentSelectPatientInfo!.code!;
|
|
|
+ entity.contractDoctor =
|
|
|
+ Store.user.currentSelectPatientInfo!.contractedDoctorName!;
|
|
|
entity.typeKey = request.key!;
|
|
|
entity.templateCode = request.templateCode!;
|
|
|
entity.mode = request.followUpMode;
|
|
|
entity.followUpTime = request.followUpTime!;
|
|
|
- entity.dataJson = jsonEncode(request); // 完整缓存请求
|
|
|
+ entity.nextFollowUpTime = request.nextFollowUpTime!;
|
|
|
+ entity.followUpPhtots = request.followUpPhotos!;
|
|
|
+ entity.dataJson = request.followUpData!;
|
|
|
|
|
|
final id = await db.repositories.followUp.insert(entity);
|
|
|
final result = id > 0 ? entity.code : "";
|
|
@@ -39,27 +40,18 @@ class FollowUpServiceMock extends VitalFollowUpService {
|
|
|
entity = FollowUpEntity();
|
|
|
entity.isValid = true;
|
|
|
entity.syncType = OfflineDataSyncType.update;
|
|
|
- entity.dataJson = jsonEncode(request);
|
|
|
- } else {
|
|
|
- if (entity.syncType == OfflineDataSyncType.create) {
|
|
|
- final jsonMap = jsonDecode(entity.dataJson);
|
|
|
- // 创建类型里含有templateCode,不能丢了
|
|
|
- final createReq = CreateFollowUpRequest.fromJson(jsonMap);
|
|
|
- createReq.followUpMode = request.followUpMode!;
|
|
|
- createReq.followUpTime = request.followUpTime;
|
|
|
- createReq.nextFollowUpTime = request.nextFollowUpTime;
|
|
|
- createReq.followUpPhotos = request.followUpPhotos;
|
|
|
- createReq.followUpData = request.followUpData;
|
|
|
- } else {
|
|
|
- entity.dataJson = jsonEncode(request);
|
|
|
- }
|
|
|
}
|
|
|
-
|
|
|
entity.code = request.code!;
|
|
|
entity.userCode = Store.user.userCode!;
|
|
|
entity.patientCode = Store.user.currentSelectPatientInfo!.code!;
|
|
|
+ entity.contractDoctor =
|
|
|
+ Store.user.currentSelectPatientInfo!.contractedDoctorName!;
|
|
|
entity.typeKey = request.key!;
|
|
|
+ entity.mode = request.followUpMode!;
|
|
|
entity.followUpTime = request.followUpTime!;
|
|
|
+ entity.nextFollowUpTime = request.nextFollowUpTime!;
|
|
|
+ entity.followUpPhtots = request.followUpPhotos!;
|
|
|
+ entity.dataJson = request.followUpData!;
|
|
|
|
|
|
int result;
|
|
|
if (entity.id == 0) {
|
|
@@ -75,11 +67,33 @@ class FollowUpServiceMock extends VitalFollowUpService {
|
|
|
GetFollowUpRecordListRequest request) async {
|
|
|
final entities = await db.repositories.followUp
|
|
|
.queryPatientAllList(request.patientCode!, Store.user.userCode!);
|
|
|
- final list = entities.map((e) {
|
|
|
- final dto = FollowUpRecordDTO();
|
|
|
-// dto.birthday
|
|
|
- return dto;
|
|
|
- }).toList();
|
|
|
- return list;
|
|
|
+ if (entities.isEmpty) {
|
|
|
+ return [];
|
|
|
+ }
|
|
|
+
|
|
|
+ // 都放一个Record里
|
|
|
+ final record = FollowUpRecordDTO();
|
|
|
+ final patient = Store.user.currentSelectPatientInfo;
|
|
|
+ record.patientName = patient?.patientName ?? "";
|
|
|
+ // record.contractedDoctor = patient?.contractedDoctorName ?? "";
|
|
|
+ record.contractedDoctor = entities.first.contractDoctor;
|
|
|
+ record.followUpRecordDatas = entities
|
|
|
+ .map(
|
|
|
+ (e) => FollowUpRecordDataDTO(
|
|
|
+ code: e.code,
|
|
|
+ templateCode: e.templateCode,
|
|
|
+ key: e.typeKey,
|
|
|
+ followUpDoctor: e.contractDoctor,
|
|
|
+ followUpState: FollowUpStateEnum.FollowUpVisit,
|
|
|
+ followUpMode: e.mode,
|
|
|
+ followUpTime: e.followUpTime,
|
|
|
+ nextFollowUpTime: e.nextFollowUpTime,
|
|
|
+ followUpPhotos: e.followUpPhtots,
|
|
|
+ followUpData: e.dataJson,
|
|
|
+ ),
|
|
|
+ )
|
|
|
+ .toList();
|
|
|
+
|
|
|
+ return [record];
|
|
|
}
|
|
|
}
|