finish operation details report

merge-requests/869/head
Elham Rababh 4 years ago
parent 6e61bd8c1d
commit 22b424515c

@ -5,8 +5,8 @@ const ONLY_NUMBERS = "[0-9]";
const ONLY_LETTERS = "[a-zA-Z &'\"]";
const ONLY_DATE = "[0-9/]";
const BASE_URL_LIVE_CARE = 'https://livecare.hmg.com/';
const BASE_URL = 'https://hmgwebservices.com/';
// const BASE_URL = 'https://uat.hmgwebservices.com/';
// const BASE_URL = 'https://hmgwebservices.com/';
const BASE_URL = 'https://uat.hmgwebservices.com/';
const PHARMACY_ITEMS_URL = "Services/Lists.svc/REST/GetPharmcyItems_Region_enh";
const PHARMACY_LIST_URL = "Services/Patients.svc/REST/GetPharmcyList";
const PATIENT_PROGRESS_NOTE_URL =
@ -345,8 +345,14 @@ const GET_MEDICATION_FOR_IN_PATIENT =
"Services/DoctorApplication.svc/REST/Doctor_GetMedicationForInpatient";
const GET_EPISODE_FOR_INPATIENT =
"/Services/DoctorApplication.svc/REST/DoctorApp_GetEpisodeForInpatient";
const GET_OPERATION_REPORT =
///Operation Details Services
const GET_RESERVATIONS =
"Services/DoctorApplication.svc/REST/DoctorApp_GetReservationDetails";
const GET_OPERATION_DETAILS =
"Services/DoctorApplication.svc/REST/DoctorApp_GetOperationDetails";
const UPDATE_OPERATION_REPORT =
"Services/DoctorApplication.svc/REST/DoctorApp_CreateUpdateOperationReport";

@ -1,28 +1,53 @@
import 'package:doctor_app_flutter/config/config.dart';
import 'package:doctor_app_flutter/core/service/base/base_service.dart';
import 'package:doctor_app_flutter/models/operation_report/create_update_operation_report_request_model.dart';
import 'package:doctor_app_flutter/models/operation_report/get_operation_report_model.dart';
import 'package:doctor_app_flutter/models/operation_report/get_operation_report_request_model.dart';
import 'package:doctor_app_flutter/models/operation_report/get_operation_details_request_modle.dart';
import 'package:doctor_app_flutter/models/operation_report/get_operation_details_response_modle.dart';
import 'package:doctor_app_flutter/models/operation_report/get_reservations_response_model.dart';
import 'package:doctor_app_flutter/models/operation_report/get_reservations_request_model.dart';
class OperationReportService extends BaseService {
List<GetOperationReportModel> _operationReportList = [];
List<GetOperationReportModel> get operationReportList => _operationReportList;
List<GetReservationsResponseModel> _reservationList = [];
List<GetReservationsResponseModel> get reservationList => _reservationList;
Future getOperationReport(
{GetOperationReportRequestModel getOperationReportRequestModel,
List<GetOperationDetailsResponseModel> _operationDetailsList = [];
List<GetOperationDetailsResponseModel> get operationDetailsList => _operationDetailsList;
Future getReservations(
{GetReservationsRequestModel getReservationsRequestModel,
int patientId}) async {
getOperationReportRequestModel =
GetOperationReportRequestModel(patientID: patientId, doctorID: "");
getReservationsRequestModel =
GetReservationsRequestModel(patientID: patientId, doctorID: "");
hasError = false;
await baseAppClient.post(GET_OPERATION_REPORT,
await baseAppClient.post(GET_RESERVATIONS,
onSuccess: (dynamic response, int statusCode) {
print("Success");
_operationReportList.clear();
_reservationList.clear();
response['List_OTReservationDetails'].forEach(
(v) {
_operationReportList.add(GetOperationReportModel.fromJson(v));
_reservationList.add(GetReservationsResponseModel.fromJson(v));
},
);
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, body: getReservationsRequestModel.toJson());
}
Future getOperationReportDetails(
{GetOperationDetailsRequestModel getOperationReportRequestModel,
}) async {
hasError = false;
await baseAppClient.post(GET_OPERATION_DETAILS,
onSuccess: (dynamic response, int statusCode) {
print("Success");
_operationDetailsList.clear();
response['List_OperationDetails'].forEach(
(v) {
_operationDetailsList.add(GetOperationDetailsResponseModel.fromJson(v));
},
);
}, onFailure: (String error, int statusCode) {

@ -22,7 +22,7 @@ class BaseViewModel extends ChangeNotifier {
void setState(ViewState viewState) {
_state = viewState;
notifyListeners();
notifyListeners();
}
Future<DoctorProfileModel> getDoctorProfile({bool isGetProfile = false}) async {

@ -3,20 +3,38 @@ import 'package:doctor_app_flutter/core/service/operation_report_servive.dart';
import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart';
import 'package:doctor_app_flutter/locator.dart';
import 'package:doctor_app_flutter/models/operation_report/create_update_operation_report_request_model.dart';
import 'package:doctor_app_flutter/models/operation_report/get_operation_report_model.dart';
import 'package:doctor_app_flutter/models/operation_report/get_operation_details_request_modle.dart';
import 'package:doctor_app_flutter/models/operation_report/get_operation_details_response_modle.dart';
import 'package:doctor_app_flutter/models/operation_report/get_reservations_response_model.dart';
class OperationReportViewModel extends BaseViewModel {
bool hasError = false;
OperationReportService _operationReportService =
locator<OperationReportService>();
List<GetOperationReportModel> get operationReportList =>
_operationReportService.operationReportList;
List<GetReservationsResponseModel> get reservationList =>
_operationReportService.reservationList;
Future getOperationReport(int patientId) async {
List<GetOperationDetailsResponseModel> get operationDetailsList =>
_operationReportService.operationDetailsList;
Future getReservations(int patientId) async {
hasError = false;
setState(ViewState.Busy);
await _operationReportService.getReservations(patientId: patientId);
if (_operationReportService.hasError) {
error = _operationReportService.error;
setState(ViewState.ErrorLocal);
} else {
setState(ViewState.Idle);
}
}
Future getOperationReportDetails(GetReservationsResponseModel reservation) async {
hasError = false;
setState(ViewState.Busy);
await _operationReportService.getOperationReport(patientId: patientId);
GetOperationDetailsRequestModel getOperationReportRequestModel = GetOperationDetailsRequestModel(reservationNo:reservation.oTReservationID, patientID: reservation.patientID, setupID: "010266" );
await _operationReportService.getOperationReportDetails(getOperationReportRequestModel:getOperationReportRequestModel);
if (_operationReportService.hasError) {
error = _operationReportService.error;
setState(ViewState.ErrorLocal);

@ -0,0 +1,68 @@
class GetOperationDetailsRequestModel {
bool isDentalAllowedBackend;
double versionID;
int channel;
int languageID;
String iPAdress;
String generalid;
int deviceTypeID;
String tokenID;
int patientID;
int reservationNo;
String sessionID;
int projectID;
String setupID;
bool patientOutSA;
GetOperationDetailsRequestModel(
{this.isDentalAllowedBackend = false,
this.versionID,
this.channel,
this.languageID,
this.iPAdress,
this.generalid,
this.deviceTypeID,
this.tokenID,
this.patientID,
this.reservationNo,
this.sessionID,
this.projectID,
this.setupID,
this.patientOutSA});
GetOperationDetailsRequestModel.fromJson(Map<String, dynamic> json) {
isDentalAllowedBackend = json['isDentalAllowedBackend'];
versionID = json['VersionID'];
channel = json['Channel'];
languageID = json['LanguageID'];
iPAdress = json['IPAdress'];
generalid = json['generalid'];
deviceTypeID = json['DeviceTypeID'];
tokenID = json['TokenID'];
patientID = json['PatientID'];
reservationNo = json['reservationNo'];
sessionID = json['SessionID'];
projectID = json['ProjectID'];
setupID = json['SetupID'];
patientOutSA = json['PatientOutSA'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['isDentalAllowedBackend'] = this.isDentalAllowedBackend;
data['VersionID'] = this.versionID;
data['Channel'] = this.channel;
data['LanguageID'] = this.languageID;
data['IPAdress'] = this.iPAdress;
data['generalid'] = this.generalid;
data['DeviceTypeID'] = this.deviceTypeID;
data['TokenID'] = this.tokenID;
data['PatientID'] = this.patientID;
data['reservationNo'] = this.reservationNo;
data['SessionID'] = this.sessionID;
data['ProjectID'] = this.projectID;
data['SetupID'] = this.setupID;
data['PatientOutSA'] = this.patientOutSA;
return data;
}
}

@ -0,0 +1,148 @@
class GetOperationDetailsResponseModel {
String setupID;
int projectID;
int reservationNo;
int patientID;
int admissionID;
Null surgeryDate;
String preOpDiagnosis;
String postOpDiagnosis;
String surgeon;
String assistant;
String anasthetist;
String operation;
String inasion;
String finding;
String surgeryProcedure;
String postOpInstruction;
bool isActive;
int createdBy;
String createdName;
Null createdNameN;
String createdOn;
Null editedBy;
Null editedByName;
Null editedByNameN;
Null editedOn;
Null oRBookStatus;
String complicationDetail;
String bloodLossDetail;
String histopathSpecimen;
String microbiologySpecimen;
String otherSpecimen;
Null scrubNurse;
Null circulatingNurse;
Null bloodTransfusedDetail;
GetOperationDetailsResponseModel(
{this.setupID,
this.projectID,
this.reservationNo,
this.patientID,
this.admissionID,
this.surgeryDate,
this.preOpDiagnosis,
this.postOpDiagnosis,
this.surgeon,
this.assistant,
this.anasthetist,
this.operation,
this.inasion,
this.finding,
this.surgeryProcedure,
this.postOpInstruction,
this.isActive,
this.createdBy,
this.createdName,
this.createdNameN,
this.createdOn,
this.editedBy,
this.editedByName,
this.editedByNameN,
this.editedOn,
this.oRBookStatus,
this.complicationDetail,
this.bloodLossDetail,
this.histopathSpecimen,
this.microbiologySpecimen,
this.otherSpecimen,
this.scrubNurse,
this.circulatingNurse,
this.bloodTransfusedDetail});
GetOperationDetailsResponseModel.fromJson(Map<String, dynamic> json) {
setupID = json['SetupID'];
projectID = json['ProjectID'];
reservationNo = json['ReservationNo'];
patientID = json['PatientID'];
admissionID = json['AdmissionID'];
surgeryDate = json['SurgeryDate'];
preOpDiagnosis = json['PreOpDiagnosis'];
postOpDiagnosis = json['PostOpDiagnosis'];
surgeon = json['Surgeon'];
assistant = json['Assistant'];
anasthetist = json['Anasthetist'];
operation = json['Operation'];
inasion = json['Inasion'];
finding = json['Finding'];
surgeryProcedure = json['SurgeryProcedure'];
postOpInstruction = json['PostOpInstruction'];
isActive = json['IsActive'];
createdBy = json['CreatedBy'];
createdName = json['CreatedName'];
createdNameN = json['CreatedNameN'];
createdOn = json['CreatedOn'];
editedBy = json['EditedBy'];
editedByName = json['EditedByName'];
editedByNameN = json['EditedByNameN'];
editedOn = json['EditedOn'];
oRBookStatus = json['ORBookStatus'];
complicationDetail = json['ComplicationDetail'];
bloodLossDetail = json['BloodLossDetail'];
histopathSpecimen = json['HistopathSpecimen'];
microbiologySpecimen = json['MicrobiologySpecimen'];
otherSpecimen = json['OtherSpecimen'];
scrubNurse = json['ScrubNurse'];
circulatingNurse = json['CirculatingNurse'];
bloodTransfusedDetail = json['BloodTransfusedDetail'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['SetupID'] = this.setupID;
data['ProjectID'] = this.projectID;
data['ReservationNo'] = this.reservationNo;
data['PatientID'] = this.patientID;
data['AdmissionID'] = this.admissionID;
data['SurgeryDate'] = this.surgeryDate;
data['PreOpDiagnosis'] = this.preOpDiagnosis;
data['PostOpDiagnosis'] = this.postOpDiagnosis;
data['Surgeon'] = this.surgeon;
data['Assistant'] = this.assistant;
data['Anasthetist'] = this.anasthetist;
data['Operation'] = this.operation;
data['Inasion'] = this.inasion;
data['Finding'] = this.finding;
data['SurgeryProcedure'] = this.surgeryProcedure;
data['PostOpInstruction'] = this.postOpInstruction;
data['IsActive'] = this.isActive;
data['CreatedBy'] = this.createdBy;
data['CreatedName'] = this.createdName;
data['CreatedNameN'] = this.createdNameN;
data['CreatedOn'] = this.createdOn;
data['EditedBy'] = this.editedBy;
data['EditedByName'] = this.editedByName;
data['EditedByNameN'] = this.editedByNameN;
data['EditedOn'] = this.editedOn;
data['ORBookStatus'] = this.oRBookStatus;
data['ComplicationDetail'] = this.complicationDetail;
data['BloodLossDetail'] = this.bloodLossDetail;
data['HistopathSpecimen'] = this.histopathSpecimen;
data['MicrobiologySpecimen'] = this.microbiologySpecimen;
data['OtherSpecimen'] = this.otherSpecimen;
data['ScrubNurse'] = this.scrubNurse;
data['CirculatingNurse'] = this.circulatingNurse;
data['BloodTransfusedDetail'] = this.bloodTransfusedDetail;
return data;
}
}

@ -1,4 +1,4 @@
class GetOperationReportRequestModel {
class GetReservationsRequestModel {
int patientID;
int projectID;
String doctorID;
@ -13,7 +13,7 @@ class GetOperationReportRequestModel {
String tokenID;
String sessionID;
GetOperationReportRequestModel(
GetReservationsRequestModel(
{this.patientID,
this.projectID,
this.doctorID,
@ -28,7 +28,7 @@ class GetOperationReportRequestModel {
this.tokenID,
this.sessionID});
GetOperationReportRequestModel.fromJson(Map<String, dynamic> json) {
GetReservationsRequestModel.fromJson(Map<String, dynamic> json) {
patientID = json['PatientID'];
projectID = json['ProjectID'];
doctorID = json['DoctorID'];

@ -1,4 +1,4 @@
class GetOperationReportModel {
class GetReservationsResponseModel {
String setupID;
int projectID;
int oTReservationID;
@ -35,7 +35,7 @@ class GetOperationReportModel {
String clinicDescription;
Null clinicDescriptionN;
GetOperationReportModel(
GetReservationsResponseModel(
{this.setupID,
this.projectID,
this.oTReservationID,
@ -72,7 +72,7 @@ class GetOperationReportModel {
this.clinicDescription,
this.clinicDescriptionN});
GetOperationReportModel.fromJson(Map<String, dynamic> json) {
GetReservationsResponseModel.fromJson(Map<String, dynamic> json) {
setupID = json['SetupID'];
projectID = json['ProjectID'];
oTReservationID = json['OTReservationID'];

@ -55,7 +55,7 @@ class _ProgressNoteState extends State<OperationReportScreen> {
if (routeArgs.containsKey('isDischargedPatient'))
isDischargedPatient = routeArgs['isDischargedPatient'];
return BaseView<OperationReportViewModel>(
onModelReady: (model) => model.getOperationReport(patient.patientMRN),
onModelReady: (model) => model.getReservations(patient.patientMRN),
builder: (_, model, w) => AppScaffold(
baseViewModel: model,
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
@ -68,14 +68,14 @@ class _ProgressNoteState extends State<OperationReportScreen> {
color: Colors.grey[200],
child: Column(
children: <Widget>[
model.operationReportList == null ||
model.operationReportList.length == 0
model.reservationList == null ||
model.reservationList.length == 0
? DrAppEmbeddedError(
error: TranslationBase.of(context).errorNoProgressNote)
: Expanded(
child: Container(
child: ListView.builder(
itemCount: model.operationReportList.length,
itemCount: model.reservationList.length,
itemBuilder: (BuildContext ctxt, int index) {
return FractionallySizedBox(
widthFactor: 0.95,
@ -119,7 +119,7 @@ class _ProgressNoteState extends State<OperationReportScreen> {
Expanded(
child: AppText(
model
.operationReportList[
.reservationList[
index]
.doctorName ??
'',
@ -137,14 +137,14 @@ class _ProgressNoteState extends State<OperationReportScreen> {
children: [
AppText(
model
.operationReportList[
.reservationList[
index]
.createdOn !=
null
? AppDateUtils.getDayMonthYearDateFormatted(
AppDateUtils
.getDateTimeFromServerFormat(model
.operationReportList[
.reservationList[
index]
.createdOn),
isArabic:
@ -162,14 +162,14 @@ class _ProgressNoteState extends State<OperationReportScreen> {
),
AppText(
model
.operationReportList[
.reservationList[
index]
.createdOn !=
null
? AppDateUtils.getHour(
AppDateUtils
.getDateTimeFromServerFormat(model
.operationReportList[
.reservationList[
index]
.createdOn))
: AppDateUtils.getHour(
@ -186,7 +186,25 @@ class _ProgressNoteState extends State<OperationReportScreen> {
SizedBox(
height: 8,
),
if (model.operationReportList[index]
Row(
mainAxisAlignment:
MainAxisAlignment.start,
children: [
AppText(
"Reservation: ",
fontSize: 10,
),
Expanded(
child: AppText(
model.reservationList[index].oTReservationID.toString(),
fontSize: 10,
),
)
]),
SizedBox(
height: 8,
),
if (model.reservationList[index]
.operationDate !=
null)
Row(
@ -202,7 +220,7 @@ class _ProgressNoteState extends State<OperationReportScreen> {
AppDateUtils.getDayMonthYearDateFormatted(
AppDateUtils
.getDateTimeFromServerFormat(model
.operationReportList[
.reservationList[
index]
.operationDate),
isArabic:
@ -213,7 +231,7 @@ class _ProgressNoteState extends State<OperationReportScreen> {
),
)
]),
if (model.operationReportList[index]
if (model.reservationList[index]
.timeStart !=
null)
Row(
@ -227,14 +245,14 @@ class _ProgressNoteState extends State<OperationReportScreen> {
Expanded(
child: AppText(
model
.operationReportList[
.reservationList[
index]
.timeStart,
fontSize: 10,
),
)
]),
if (model.operationReportList[index]
if (model.reservationList[index]
.remarks !=
null)
Row(
@ -248,7 +266,7 @@ class _ProgressNoteState extends State<OperationReportScreen> {
Expanded(
child: AppText(
model
.operationReportList[
.reservationList[
index]
.remarks ??
'',
@ -290,11 +308,9 @@ class _ProgressNoteState extends State<OperationReportScreen> {
MaterialPageRoute(
builder: (context) =>
UpdateOperationReport(
operationReport: model
.operationReportList[
reservation: model
.reservationList[
index],
operationReportViewModel:
model,
patient: patient,
isUpdate: true,
)),

Loading…
Cancel
Save