|
@@ -17,7 +17,7 @@ import 'package:intl/intl.dart';
|
|
|
import 'package:event/event.dart';
|
|
|
|
|
|
class NotificationReceivedArgs extends EventArgs {
|
|
|
- Map<String, dynamic> jsonMessage;
|
|
|
+ dynamic jsonMessage;
|
|
|
|
|
|
NotificationReceivedArgs(this.jsonMessage);
|
|
|
}
|
|
@@ -26,7 +26,7 @@ class ConsultationService {
|
|
|
Event<NotificationReceivedArgs> NotificationReceived =
|
|
|
Event<NotificationReceivedArgs>();
|
|
|
|
|
|
- RaiseConsultationNotificationReceived(Map<String, dynamic> jsonMessage) {
|
|
|
+ RaiseConsultationNotificationReceived(dynamic jsonMessage) {
|
|
|
NotificationReceived.broadcast(NotificationReceivedArgs(jsonMessage));
|
|
|
}
|
|
|
|
|
@@ -77,23 +77,18 @@ class ConsultationService {
|
|
|
var organs = organSource.map<String>((json) => json.toString()).toList()
|
|
|
as List<String>;
|
|
|
|
|
|
-
|
|
|
-
|
|
|
body =
|
|
|
'{"jsonrpc": "2.0", "method": "GetUserListAsync", "params": [{"Token": "$token", "OrganizationCode": "$orgCode","OrganizationQueryType":3,"ExceptSelf":true}], "id": 1 }';
|
|
|
print('GetUserListAsync http.Client()' + body);
|
|
|
- response = await client.post(
|
|
|
- Uri.parse(AppSettings.host + '/IUserService'),
|
|
|
+ response = await client.post(Uri.parse(AppSettings.host + '/IUserService'),
|
|
|
body: body);
|
|
|
|
|
|
-
|
|
|
print('GetUserListAsync response.body' + response.body);
|
|
|
parsed = jsonDecode(response.body);
|
|
|
datas = parsed['result'];
|
|
|
final users = datas.map<Expert>((json) => Expert.fromJson(json)).toList()
|
|
|
as List<Expert>;
|
|
|
|
|
|
-
|
|
|
var model = new AppConsultationDataModel(experts, devices, organs, users);
|
|
|
return model;
|
|
|
}
|
|
@@ -191,6 +186,9 @@ class ConsultationService {
|
|
|
var parsed =
|
|
|
decodeResponseBody('InitiateLiveConsultationAsync', response.bodyBytes);
|
|
|
var data = parsed['result'];
|
|
|
+ print("begin RaiseConsultationNotificationReceived");
|
|
|
+ RaiseConsultationNotificationReceived(data);
|
|
|
+ print("end RaiseConsultationNotificationReceived");
|
|
|
return data;
|
|
|
}
|
|
|
|
|
@@ -230,16 +228,14 @@ class ConsultationService {
|
|
|
return data;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
Future<bool> ApprovalConsultationAsync(
|
|
|
- ApprovalConsultationRequest model) async {
|
|
|
- String consultationCode=model.consultationCode;
|
|
|
- String expertUserCode =model.expertUserCode;
|
|
|
- DateTime consultationTime=model.consultationTime;
|
|
|
- List<String> consultationMemberCodes=<String>[];
|
|
|
+ ApprovalConsultationRequest model) async {
|
|
|
+ String consultationCode = model.consultationCode;
|
|
|
+ String expertUserCode = model.expertUserCode;
|
|
|
+ DateTime consultationTime = model.consultationTime;
|
|
|
+ List<String> consultationMemberCodes = <String>[];
|
|
|
model.consultationMemberCodes.forEach((element) {
|
|
|
- consultationMemberCodes.add('"'+element+'"');
|
|
|
+ consultationMemberCodes.add('"' + element + '"');
|
|
|
});
|
|
|
var userService = GetIt.instance.get<UserService>();
|
|
|
var user = userService.getCurrentUser();
|
|
@@ -253,7 +249,8 @@ class ConsultationService {
|
|
|
var response = await client.post(
|
|
|
Uri.parse(AppSettings.host + '/ILiveConsultationService'),
|
|
|
body: body);
|
|
|
- var parsed = decodeResponseBody('ApprovalConsultationAsync', response.bodyBytes);
|
|
|
+ var parsed =
|
|
|
+ decodeResponseBody('ApprovalConsultationAsync', response.bodyBytes);
|
|
|
var data = parsed['result'];
|
|
|
return data;
|
|
|
}
|
|
@@ -265,7 +262,7 @@ class AppConsultationDataModel {
|
|
|
final List<String> organs;
|
|
|
final List<Expert> users;
|
|
|
|
|
|
- AppConsultationDataModel(this.experts, this.devices, this.organs,this.users);
|
|
|
+ AppConsultationDataModel(this.experts, this.devices, this.organs, this.users);
|
|
|
}
|
|
|
|
|
|
class TokenRequest {
|
|
@@ -373,7 +370,6 @@ class Organ {
|
|
|
}
|
|
|
|
|
|
class ApprovalConsultationRequest extends TokenRequest {
|
|
|
-
|
|
|
String consultationCode;
|
|
|
|
|
|
String expertUserCode;
|
|
@@ -382,18 +378,13 @@ class ApprovalConsultationRequest extends TokenRequest {
|
|
|
|
|
|
List<String> consultationMemberCodes;
|
|
|
|
|
|
-
|
|
|
- ApprovalConsultationRequest(
|
|
|
- this.consultationCode,
|
|
|
- this.expertUserCode,
|
|
|
- this.consultationTime,
|
|
|
- this.consultationMemberCodes,
|
|
|
- String token)
|
|
|
+ ApprovalConsultationRequest(this.consultationCode, this.expertUserCode,
|
|
|
+ this.consultationTime, this.consultationMemberCodes, String token)
|
|
|
: super(token);
|
|
|
|
|
|
- @override
|
|
|
+ @override
|
|
|
String toString() {
|
|
|
// TODO: implement toString
|
|
|
- return 'consultationCode: $consultationCode,expertUserCode:$expertUserCode,consultationTime:$consultationTime,consultationMemberCodes:$consultationMemberCodes';
|
|
|
+ return 'consultationCode: $consultationCode,expertUserCode:$expertUserCode,consultationTime:$consultationTime,consultationMemberCodes:$consultationMemberCodes';
|
|
|
}
|
|
|
}
|