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

@ -1,28 +1,53 @@
import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/config/config.dart';
import 'package:doctor_app_flutter/core/service/base/base_service.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/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_report_request_model.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 { class OperationReportService extends BaseService {
List<GetOperationReportModel> _operationReportList = []; List<GetReservationsResponseModel> _reservationList = [];
List<GetOperationReportModel> get operationReportList => _operationReportList; List<GetReservationsResponseModel> get reservationList => _reservationList;
Future getOperationReport( List<GetOperationDetailsResponseModel> _operationDetailsList = [];
{GetOperationReportRequestModel getOperationReportRequestModel, List<GetOperationDetailsResponseModel> get operationDetailsList => _operationDetailsList;
Future getReservations(
{GetReservationsRequestModel getReservationsRequestModel,
int patientId}) async { int patientId}) async {
getOperationReportRequestModel = getReservationsRequestModel =
GetOperationReportRequestModel(patientID: patientId, doctorID: ""); GetReservationsRequestModel(patientID: patientId, doctorID: "");
hasError = false; hasError = false;
await baseAppClient.post(GET_OPERATION_REPORT, await baseAppClient.post(GET_RESERVATIONS,
onSuccess: (dynamic response, int statusCode) { onSuccess: (dynamic response, int statusCode) {
print("Success"); print("Success");
_operationReportList.clear(); _reservationList.clear();
response['List_OTReservationDetails'].forEach( response['List_OTReservationDetails'].forEach(
(v) { (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) { }, onFailure: (String error, int statusCode) {

@ -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/core/viewModel/base_view_model.dart';
import 'package:doctor_app_flutter/locator.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/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 { class OperationReportViewModel extends BaseViewModel {
bool hasError = false; bool hasError = false;
OperationReportService _operationReportService = OperationReportService _operationReportService =
locator<OperationReportService>(); locator<OperationReportService>();
List<GetOperationReportModel> get operationReportList => List<GetReservationsResponseModel> get reservationList =>
_operationReportService.operationReportList; _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; hasError = false;
setState(ViewState.Busy); 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) { if (_operationReportService.hasError) {
error = _operationReportService.error; error = _operationReportService.error;
setState(ViewState.ErrorLocal); 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 patientID;
int projectID; int projectID;
String doctorID; String doctorID;
@ -13,7 +13,7 @@ class GetOperationReportRequestModel {
String tokenID; String tokenID;
String sessionID; String sessionID;
GetOperationReportRequestModel( GetReservationsRequestModel(
{this.patientID, {this.patientID,
this.projectID, this.projectID,
this.doctorID, this.doctorID,
@ -28,7 +28,7 @@ class GetOperationReportRequestModel {
this.tokenID, this.tokenID,
this.sessionID}); this.sessionID});
GetOperationReportRequestModel.fromJson(Map<String, dynamic> json) { GetReservationsRequestModel.fromJson(Map<String, dynamic> json) {
patientID = json['PatientID']; patientID = json['PatientID'];
projectID = json['ProjectID']; projectID = json['ProjectID'];
doctorID = json['DoctorID']; doctorID = json['DoctorID'];

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

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

@ -12,9 +12,11 @@ import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart';
import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart';
import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart'; import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart';
import 'package:doctor_app_flutter/models/operation_report/create_update_operation_report_request_model.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_response_modle.dart';
import 'package:doctor_app_flutter/models/operation_report/get_reservations_response_model.dart';
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/models/patient/progress_note_request.dart'; import 'package:doctor_app_flutter/models/patient/progress_note_request.dart';
import 'package:doctor_app_flutter/screens/base/base_view.dart';
import 'package:doctor_app_flutter/screens/patients/profile/soap_update/shared_soap_widgets/bottom_sheet_title.dart'; import 'package:doctor_app_flutter/screens/patients/profile/soap_update/shared_soap_widgets/bottom_sheet_title.dart';
import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart';
import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/helpers.dart';
@ -31,19 +33,19 @@ import 'package:speech_to_text/speech_recognition_error.dart';
import 'package:speech_to_text/speech_to_text.dart' as stt; import 'package:speech_to_text/speech_to_text.dart' as stt;
class UpdateOperationReport extends StatefulWidget { class UpdateOperationReport extends StatefulWidget {
final GetOperationReportModel operationReport; final GetReservationsResponseModel reservation;
final OperationReportViewModel operationReportViewModel; // final OperationReportViewModel operationReportViewModel;
final PatiantInformtion patient; final PatiantInformtion patient;
final int visitType; final int visitType;
final bool isUpdate; final bool isUpdate;
const UpdateOperationReport( const UpdateOperationReport(
{Key key, {Key key,
this.operationReportViewModel, // this.operationReportViewModel,
this.patient, this.patient,
this.visitType, this.visitType,
this.isUpdate, this.isUpdate,
this.operationReport}) this.reservation})
: super(key: key); : super(key: key);
@override @override
@ -94,17 +96,46 @@ class _UpdateOperationReportState extends State<UpdateOperationReport> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
projectViewModel = Provider.of(context); projectViewModel = Provider.of(context);
if(widget.isUpdate)
OTReservationID.text = widget.operationReport.oTReservationID.toString();
//TODO Elham* add translation to hints //TODO Elham* add translation to hints
return AppScaffold(
return BaseView<OperationReportViewModel>(
onModelReady: (model) async {
await model
.getOperationReportDetails(widget.reservation);
OTReservationID.text = widget.reservation.oTReservationID.toString();
if (model.operationDetailsList.isNotEmpty) {
GetOperationDetailsResponseModel oldDetails =
model.operationDetailsList[0];
postOpDiagmosisNoteController.text = oldDetails.postOpInstruction;
preOpDiagmosisController.text = oldDetails.preOpDiagnosis;
surgeonController.text = oldDetails.surgeon;
assistantNoteController.text = oldDetails.assistant;
operationController.text = oldDetails.operation;
inasionController.text = oldDetails.inasion;
findingController.text = oldDetails.finding;
surgeryProcedureController.text = oldDetails.surgeryProcedure;
postOpInstructionController.text = oldDetails.postOpInstruction;
complicationDetailsController.text = oldDetails.complicationDetail;
bloodLossDetailController.text = oldDetails.bloodLossDetail;
histopathSpecimenController.text = oldDetails.histopathSpecimen;
microbiologySpecimenController.text =
oldDetails.microbiologySpecimen;
otherSpecimenController.text = oldDetails.otherSpecimen;
scrubNurseController.text = oldDetails.scrubNurse;
circulatingNurseController.text = oldDetails.circulatingNurse;
BloodTransfusedDetailController.text =
oldDetails.bloodTransfusedDetail;
anasthetistController.text = oldDetails.anasthetist;
}
},
builder: (_, model, w) => AppScaffold(
isShowAppBar: true, isShowAppBar: true,
baseViewModel: model,
backgroundColor: Theme.of(context).scaffoldBackgroundColor, backgroundColor: Theme.of(context).scaffoldBackgroundColor,
appBar: BottomSheetTitle( appBar: BottomSheetTitle(
title: (widget.isUpdate title: TranslationBase.of(context).operationReports,
? TranslationBase.of(context).noteUpdate
: TranslationBase.of(context).noteAdd) +
TranslationBase.of(context).operationReports,
), ),
body: SingleChildScrollView( body: SingleChildScrollView(
child: Container( child: Container(
@ -145,10 +176,11 @@ class _UpdateOperationReportState extends State<UpdateOperationReport> {
hasBorder: true, hasBorder: true,
// isTextFieldHasSuffix: true, // isTextFieldHasSuffix: true,
validationError: validationError: preOpDiagmosisController
preOpDiagmosisController.text.isEmpty && .text.isEmpty &&
isSubmitted isSubmitted
? TranslationBase.of(context).emptyMessage ? TranslationBase.of(context)
.emptyMessage
: null, : null,
), ),
SizedBox( SizedBox(
@ -164,9 +196,11 @@ class _UpdateOperationReportState extends State<UpdateOperationReport> {
// isTextFieldHasSuffix: true, // isTextFieldHasSuffix: true,
validationError: validationError:
postOpDiagmosisNoteController.text.isEmpty && postOpDiagmosisNoteController
.text.isEmpty &&
isSubmitted isSubmitted
? TranslationBase.of(context).emptyMessage ? TranslationBase.of(context)
.emptyMessage
: null, : null,
), ),
SizedBox( SizedBox(
@ -182,8 +216,10 @@ class _UpdateOperationReportState extends State<UpdateOperationReport> {
// isTextFieldHasSuffix: true, // isTextFieldHasSuffix: true,
validationError: validationError:
surgeonController.text.isEmpty && isSubmitted surgeonController.text.isEmpty &&
? TranslationBase.of(context).emptyMessage isSubmitted
? TranslationBase.of(context)
.emptyMessage
: null, : null,
), ),
SizedBox( SizedBox(
@ -198,10 +234,11 @@ class _UpdateOperationReportState extends State<UpdateOperationReport> {
hasBorder: true, hasBorder: true,
// isTextFieldHasSuffix: true, // isTextFieldHasSuffix: true,
validationError: validationError: assistantNoteController
assistantNoteController.text.isEmpty && .text.isEmpty &&
isSubmitted isSubmitted
? TranslationBase.of(context).emptyMessage ? TranslationBase.of(context)
.emptyMessage
: null, : null,
), ),
SizedBox( SizedBox(
@ -219,7 +256,8 @@ class _UpdateOperationReportState extends State<UpdateOperationReport> {
validationError: validationError:
operationController.text.isEmpty && operationController.text.isEmpty &&
isSubmitted isSubmitted
? TranslationBase.of(context).emptyMessage ? TranslationBase.of(context)
.emptyMessage
: null, : null,
), ),
SizedBox( SizedBox(
@ -235,8 +273,10 @@ class _UpdateOperationReportState extends State<UpdateOperationReport> {
// isTextFieldHasSuffix: true, // isTextFieldHasSuffix: true,
validationError: validationError:
inasionController.text.isEmpty && isSubmitted inasionController.text.isEmpty &&
? TranslationBase.of(context).emptyMessage isSubmitted
? TranslationBase.of(context)
.emptyMessage
: null, : null,
), ),
SizedBox( SizedBox(
@ -252,8 +292,10 @@ class _UpdateOperationReportState extends State<UpdateOperationReport> {
// isTextFieldHasSuffix: true, // isTextFieldHasSuffix: true,
validationError: validationError:
findingController.text.isEmpty && isSubmitted findingController.text.isEmpty &&
? TranslationBase.of(context).emptyMessage isSubmitted
? TranslationBase.of(context)
.emptyMessage
: null, : null,
), ),
SizedBox( SizedBox(
@ -269,9 +311,11 @@ class _UpdateOperationReportState extends State<UpdateOperationReport> {
// isTextFieldHasSuffix: true, // isTextFieldHasSuffix: true,
validationError: validationError:
surgeryProcedureController.text.isEmpty && surgeryProcedureController
.text.isEmpty &&
isSubmitted isSubmitted
? TranslationBase.of(context).emptyMessage ? TranslationBase.of(context)
.emptyMessage
: null, : null,
), ),
SizedBox( SizedBox(
@ -287,9 +331,11 @@ class _UpdateOperationReportState extends State<UpdateOperationReport> {
// isTextFieldHasSuffix: true, // isTextFieldHasSuffix: true,
validationError: validationError:
postOpInstructionController.text.isEmpty && postOpInstructionController
.text.isEmpty &&
isSubmitted isSubmitted
? TranslationBase.of(context).emptyMessage ? TranslationBase.of(context)
.emptyMessage
: null, : null,
), ),
SizedBox( SizedBox(
@ -305,9 +351,11 @@ class _UpdateOperationReportState extends State<UpdateOperationReport> {
// isTextFieldHasSuffix: true, // isTextFieldHasSuffix: true,
validationError: validationError:
complicationDetailsController.text.isEmpty && complicationDetailsController
.text.isEmpty &&
isSubmitted isSubmitted
? TranslationBase.of(context).emptyMessage ? TranslationBase.of(context)
.emptyMessage
: null, : null,
), ),
SizedBox( SizedBox(
@ -322,10 +370,11 @@ class _UpdateOperationReportState extends State<UpdateOperationReport> {
hasBorder: true, hasBorder: true,
// isTextFieldHasSuffix: true, // isTextFieldHasSuffix: true,
validationError: validationError: bloodLossDetailController
bloodLossDetailController.text.isEmpty && .text.isEmpty &&
isSubmitted isSubmitted
? TranslationBase.of(context).emptyMessage ? TranslationBase.of(context)
.emptyMessage
: null, : null,
), ),
SizedBox( SizedBox(
@ -341,9 +390,11 @@ class _UpdateOperationReportState extends State<UpdateOperationReport> {
// isTextFieldHasSuffix: true, // isTextFieldHasSuffix: true,
validationError: validationError:
histopathSpecimenController.text.isEmpty && histopathSpecimenController
.text.isEmpty &&
isSubmitted isSubmitted
? TranslationBase.of(context).emptyMessage ? TranslationBase.of(context)
.emptyMessage
: null, : null,
), ),
SizedBox( SizedBox(
@ -352,16 +403,19 @@ class _UpdateOperationReportState extends State<UpdateOperationReport> {
AppTextFieldCustom( AppTextFieldCustom(
hintText: "microbiology Specimen ", hintText: "microbiology Specimen ",
//TranslationBase.of(context).addoperationReports, //TranslationBase.of(context).addoperationReports,
controller: microbiologySpecimenController, controller:
microbiologySpecimenController,
maxLines: 1, maxLines: 1,
minLines: 1, minLines: 1,
hasBorder: true, hasBorder: true,
// isTextFieldHasSuffix: true, // isTextFieldHasSuffix: true,
validationError: validationError:
microbiologySpecimenController.text.isEmpty && microbiologySpecimenController
.text.isEmpty &&
isSubmitted isSubmitted
? TranslationBase.of(context).emptyMessage ? TranslationBase.of(context)
.emptyMessage
: null, : null,
), ),
SizedBox( SizedBox(
@ -376,10 +430,11 @@ class _UpdateOperationReportState extends State<UpdateOperationReport> {
hasBorder: true, hasBorder: true,
// isTextFieldHasSuffix: true, // isTextFieldHasSuffix: true,
validationError: validationError: otherSpecimenController
otherSpecimenController.text.isEmpty && .text.isEmpty &&
isSubmitted isSubmitted
? TranslationBase.of(context).emptyMessage ? TranslationBase.of(context)
.emptyMessage
: null, : null,
), ),
SizedBox( SizedBox(
@ -397,7 +452,8 @@ class _UpdateOperationReportState extends State<UpdateOperationReport> {
validationError: validationError:
scrubNurseController.text.isEmpty && scrubNurseController.text.isEmpty &&
isSubmitted isSubmitted
? TranslationBase.of(context).emptyMessage ? TranslationBase.of(context)
.emptyMessage
: null, : null,
), ),
SizedBox( SizedBox(
@ -413,9 +469,11 @@ class _UpdateOperationReportState extends State<UpdateOperationReport> {
// isTextFieldHasSuffix: true, // isTextFieldHasSuffix: true,
validationError: validationError:
circulatingNurseController.text.isEmpty && circulatingNurseController
.text.isEmpty &&
isSubmitted isSubmitted
? TranslationBase.of(context).emptyMessage ? TranslationBase.of(context)
.emptyMessage
: null, : null,
), ),
SizedBox( SizedBox(
@ -424,16 +482,19 @@ class _UpdateOperationReportState extends State<UpdateOperationReport> {
AppTextFieldCustom( AppTextFieldCustom(
hintText: "Blood Transfused Detail", hintText: "Blood Transfused Detail",
//TranslationBase.of(context).addoperationReports, //TranslationBase.of(context).addoperationReports,
controller: BloodTransfusedDetailController, controller:
BloodTransfusedDetailController,
maxLines: 1, maxLines: 1,
minLines: 1, minLines: 1,
hasBorder: true, hasBorder: true,
// isTextFieldHasSuffix: true, // isTextFieldHasSuffix: true,
validationError: BloodTransfusedDetailController validationError:
BloodTransfusedDetailController
.text.isEmpty && .text.isEmpty &&
isSubmitted isSubmitted
? TranslationBase.of(context).emptyMessage ? TranslationBase.of(context)
.emptyMessage
: null, : null,
), ),
SizedBox( SizedBox(
@ -451,7 +512,8 @@ class _UpdateOperationReportState extends State<UpdateOperationReport> {
validationError: validationError:
anasthetistController.text.isEmpty && anasthetistController.text.isEmpty &&
isSubmitted isSubmitted
? TranslationBase.of(context).emptyMessage ? TranslationBase.of(context)
.emptyMessage
: null, : null,
), ),
SizedBox( SizedBox(
@ -468,7 +530,7 @@ class _UpdateOperationReportState extends State<UpdateOperationReport> {
), ),
), ),
), ),
bottomSheet: Container( bottomSheet: model.state == ViewState.Idle?Container(height: 0,): Container(
height: 70, height: 70,
margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5), margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5),
child: Column( child: Column(
@ -489,7 +551,8 @@ class _UpdateOperationReportState extends State<UpdateOperationReport> {
}); });
if (isFormValid()) { if (isFormValid()) {
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context);
await widget.operationReportViewModel.getDoctorProfile(); await model
.getDoctorProfile();
CreateUpdateOperationReportRequestModel CreateUpdateOperationReportRequestModel
createUpdateOperationReportRequestModel = createUpdateOperationReportRequestModel =
@ -497,41 +560,50 @@ class _UpdateOperationReportState extends State<UpdateOperationReport> {
inasion: inasionController.text, inasion: inasionController.text,
/// TODO Elham* Add dynamic reservation /// TODO Elham* Add dynamic reservation
reservationNo:widget.operationReport.oTReservationID , reservationNo:
preOpDiagmosis: preOpDiagmosisController.text, widget.reservation.oTReservationID,
postOpDiagmosis: postOpDiagmosisNoteController.text, preOpDiagmosis:
preOpDiagmosisController.text,
postOpDiagmosis:
postOpDiagmosisNoteController.text,
surgeon: surgeonController.text, surgeon: surgeonController.text,
assistant: assistantNoteController.text, assistant: assistantNoteController.text,
anasthetist: assistantNoteController.text, anasthetist: assistantNoteController.text,
operation: operationController.text, operation: operationController.text,
finding: findingController.text, finding: findingController.text,
surgeryProcedure: surgeonController.text, surgeryProcedure: surgeonController.text,
postOpInstruction: postOpInstructionController.text, postOpInstruction:
postOpInstructionController.text,
complicationDetails: complicationDetails:
complicationDetailsController.text, complicationDetailsController.text,
bloodLossDetail: bloodLossDetailController.text, bloodLossDetail:
histopathSpecimen: histopathSpecimenController.text, bloodLossDetailController.text,
histopathSpecimen:
histopathSpecimenController.text,
microbiologySpecimen: microbiologySpecimen:
microbiologySpecimenController.text, microbiologySpecimenController.text,
otherSpecimen: otherSpecimenController.text, otherSpecimen: otherSpecimenController.text,
scrubNurse: surgeonController.text, scrubNurse: surgeonController.text,
circulatingNurse: circulatingNurseController.text, circulatingNurse:
circulatingNurseController.text,
bloodTransfusedDetail: bloodTransfusedDetail:
bloodLossDetailController.text, bloodLossDetailController.text,
patientID: widget.patient.patientId, patientID: widget.patient.patientId,
admissionNo: int.parse(widget.patient.admissionNo), admissionNo:
createdBy: widget.operationReportViewModel int.parse(widget.patient.admissionNo),
createdBy: model
.doctorProfile.doctorID, .doctorProfile.doctorID,
setupID: SETUP_ID); setupID: SETUP_ID);
await widget.operationReportViewModel.updateOperationReport( await model
.updateOperationReport(
createUpdateOperationReportRequestModel); createUpdateOperationReportRequestModel);
if (widget.operationReportViewModel.state == if (model.state ==
ViewState.ErrorLocal) { ViewState.ErrorLocal) {
Helpers.showErrorToast( Helpers.showErrorToast(
widget.operationReportViewModel.error); model.error);
} else { } else {
// await widget.operationReportViewModel.( // await model.(
// operationReportsRequest.toJson()); // operationReportsRequest.toJson());
DrAppToastMsg.showSuccesToast( DrAppToastMsg.showSuccesToast(
@ -546,7 +618,7 @@ class _UpdateOperationReportState extends State<UpdateOperationReport> {
], ],
), ),
), ),
); ));
} }
isFormValid() { isFormValid() {

Loading…
Cancel
Save