add ECG service
parent
fc0d1b67a4
commit
e7e4aad962
@ -0,0 +1,64 @@
|
||||
import 'package:doctor_app_flutter/util/date-utils.dart';
|
||||
|
||||
class PatientMuseResultsModel {
|
||||
int rowID;
|
||||
String setupID;
|
||||
int projectID;
|
||||
String orderNo;
|
||||
int lineItemNo;
|
||||
int patientType;
|
||||
int patientID;
|
||||
String procedureID;
|
||||
dynamic reportData;
|
||||
String imageURL;
|
||||
String createdBy;
|
||||
String createdOn;
|
||||
DateTime createdOnDateTime;
|
||||
|
||||
PatientMuseResultsModel(
|
||||
{this.rowID,
|
||||
this.setupID,
|
||||
this.projectID,
|
||||
this.orderNo,
|
||||
this.lineItemNo,
|
||||
this.patientType,
|
||||
this.patientID,
|
||||
this.procedureID,
|
||||
this.reportData,
|
||||
this.imageURL,
|
||||
this.createdBy,
|
||||
this.createdOn});
|
||||
|
||||
PatientMuseResultsModel.fromJson(Map<String, dynamic> json) {
|
||||
rowID = json['RowID'];
|
||||
setupID = json['SetupID'];
|
||||
projectID = json['ProjectID'];
|
||||
orderNo = json['OrderNo'];
|
||||
lineItemNo = json['LineItemNo'];
|
||||
patientType = json['PatientType'];
|
||||
patientID = json['PatientID'];
|
||||
procedureID = json['ProcedureID'];
|
||||
reportData = json['ReportData'];
|
||||
imageURL = json['ImageURL'];
|
||||
createdBy = json['CreatedBy'];
|
||||
createdOn = json['CreatedOn'];
|
||||
createdOnDateTime = DateUtils.getDateTimeFromServerFormat(json['CreatedOn']);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['RowID'] = this.rowID;
|
||||
data['SetupID'] = this.setupID;
|
||||
data['ProjectID'] = this.projectID;
|
||||
data['OrderNo'] = this.orderNo;
|
||||
data['LineItemNo'] = this.lineItemNo;
|
||||
data['PatientType'] = this.patientType;
|
||||
data['PatientID'] = this.patientID;
|
||||
data['ProcedureID'] = this.procedureID;
|
||||
data['ReportData'] = this.reportData;
|
||||
data['ImageURL'] = this.imageURL;
|
||||
data['CreatedBy'] = this.createdBy;
|
||||
data['CreatedOn'] = this.createdOn;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,28 @@
|
||||
import 'package:doctor_app_flutter/config/config.dart';
|
||||
import 'package:doctor_app_flutter/core/model/PatientMuseResultsModel.dart';
|
||||
import 'package:doctor_app_flutter/core/service/base/base_service.dart';
|
||||
|
||||
class PatientMuseService extends BaseService {
|
||||
List<PatientMuseResultsModel> patientMuseResultsModelList = List();
|
||||
|
||||
getECGPatient({int patientType, int patientOutSA,int patientID}) async {
|
||||
Map<String,dynamic> body = Map();
|
||||
body['PatientType'] = patientType;
|
||||
body['PatientOutSA'] = patientOutSA;
|
||||
body['PatientID'] = patientID;
|
||||
await baseAppClient.post(
|
||||
GET_ECG,
|
||||
onSuccess: (dynamic response, int statusCode) {
|
||||
patientMuseResultsModelList.clear();
|
||||
response['HIS_GetPatientMuseResultsList'].forEach((v) {
|
||||
patientMuseResultsModelList.add(PatientMuseResultsModel.fromJson(v));
|
||||
});
|
||||
},
|
||||
onFailure: (String error, int statusCode) {
|
||||
hasError = true;
|
||||
super.error = error;
|
||||
},
|
||||
body: body,
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,23 @@
|
||||
import 'package:doctor_app_flutter/core/enum/viewstate.dart';
|
||||
import 'package:doctor_app_flutter/core/service/PatientMuseService.dart';
|
||||
import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart';
|
||||
|
||||
import '../../locator.dart';
|
||||
|
||||
class PatientMuseViewModel extends BaseViewModel {
|
||||
|
||||
PatientMuseService _patientMuseService = locator<PatientMuseService>();
|
||||
|
||||
getECGPatient({int patientType, int patientOutSA, int patientID}) async {
|
||||
setState(ViewState.Busy);
|
||||
await _patientMuseService.getECGPatient(
|
||||
patientID: patientID,
|
||||
patientOutSA: patientOutSA,
|
||||
patientType: patientType);
|
||||
if (_patientMuseService.hasError) {
|
||||
error = _patientMuseService.error;
|
||||
setState(ViewState.Error);
|
||||
} else
|
||||
setState(ViewState.Idle);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue