diff --git a/lib/config/config.dart b/lib/config/config.dart index 01a89033..616e862a 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -347,6 +347,8 @@ const GET_EPISODE_FOR_INPATIENT = "/Services/DoctorApplication.svc/REST/DoctorApp_GetEpisodeForInpatient"; const GET_OPERATION_REPORT = "/Services/DoctorApplication.svc/REST/DoctorApp_GetReservationDetails"; +const UPDATE_OPERATION_REPORT = + "Services/DoctorApplication.svc/REST/DoctorApp_CreateUpdateOperationReport"; const NURSING_PROGRESS_NOTE = "Services/DoctorApplication.svc/REST/DoctorApp_GetNursingProgressNote"; diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 9b91015f..b711124f 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -709,5 +709,6 @@ const Map> localizedValues = { "en":"Request Type", "ar":"نوع الطلب"}, "special": {"en": "Special", "ar": "خاص"}, - "allClinic": {"en": "All Clinics", "ar": "جميع العيادات"} + "allClinic": {"en": "All Clinics", "ar": "جميع العيادات"} , + "operationReports": {"en": "Operation Reports", "ar": "تقارير العملية"} }; diff --git a/lib/core/service/operation_report_servive.dart b/lib/core/service/operation_report_servive.dart index 30b76cc7..4eb7ad8d 100644 --- a/lib/core/service/operation_report_servive.dart +++ b/lib/core/service/operation_report_servive.dart @@ -1,5 +1,6 @@ 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'; @@ -28,4 +29,14 @@ class OperationReportService extends BaseService { super.error = error; }, body: getOperationReportRequestModel.toJson()); } + + Future updateOperationReport(CreateUpdateOperationReportRequestModel createUpdateOperationReport) async { + await baseAppClient.post(UPDATE_OPERATION_REPORT, + onSuccess: (dynamic response, int statusCode) { + + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: createUpdateOperationReport.toJson(),isFallLanguage: true); + } } diff --git a/lib/core/viewModel/operation_report_view_model.dart b/lib/core/viewModel/operation_report_view_model.dart index 246eff87..77867d95 100644 --- a/lib/core/viewModel/operation_report_view_model.dart +++ b/lib/core/viewModel/operation_report_view_model.dart @@ -2,6 +2,7 @@ import 'package:doctor_app_flutter/core/enum/viewstate.dart'; 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'; class OperationReportViewModel extends BaseViewModel { @@ -23,4 +24,18 @@ class OperationReportViewModel extends BaseViewModel { setState(ViewState.Idle); } } + + + + Future updateOperationReport( + CreateUpdateOperationReportRequestModel + createUpdateOperationReport) async { + setState(ViewState.BusyLocal); + await _operationReportService.updateOperationReport(createUpdateOperationReport); + if (_operationReportService.hasError) { + error = _operationReportService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } } diff --git a/lib/models/operation_report/create_update_operation_report_request_model.dart b/lib/models/operation_report/create_update_operation_report_request_model.dart new file mode 100644 index 00000000..f6d72b1b --- /dev/null +++ b/lib/models/operation_report/create_update_operation_report_request_model.dart @@ -0,0 +1,108 @@ +class CreateUpdateOperationReportRequestModel { + String setupID; + int patientID; + int reservationNo; + int admissionNo; + String preOpDiagmosis; + String postOpDiagmosis; + String surgeon; + String assistant; + String anasthetist; + String operation; + String inasion; + String finding; + String surgeryProcedure; + String postOpInstruction; + int createdBy; + int editedBy; + String complicationDetails; + String bloodLossDetail; + String histopathSpecimen; + String microbiologySpecimen; + String otherSpecimen; + String scrubNurse; + String circulatingNurse; + String bloodTransfusedDetail; + + CreateUpdateOperationReportRequestModel( + {this.setupID, + this.patientID, + this.reservationNo, + this.admissionNo, + this.preOpDiagmosis, + this.postOpDiagmosis, + this.surgeon, + this.assistant, + this.anasthetist, + this.operation, + this.inasion, + this.finding, + this.surgeryProcedure, + this.postOpInstruction, + this.createdBy, + this.editedBy, + this.complicationDetails, + this.bloodLossDetail, + this.histopathSpecimen, + this.microbiologySpecimen, + this.otherSpecimen, + this.scrubNurse, + this.circulatingNurse, + this.bloodTransfusedDetail}); + + CreateUpdateOperationReportRequestModel.fromJson(Map json) { + setupID = json['SetupID']; + patientID = json['PatientID']; + reservationNo = json['reservationNo']; + admissionNo = json['AdmissionNo']; + preOpDiagmosis = json['preOpDiagmosis']; + postOpDiagmosis = json['postOpDiagmosis']; + surgeon = json['surgeon']; + assistant = json['assistant']; + anasthetist = json['anasthetist']; + operation = json['operation']; + inasion = json['inasion']; + finding = json['finding']; + surgeryProcedure = json['surgeryProcedure']; + postOpInstruction = json['postOpInstruction']; + createdBy = json['CreatedBy']; + editedBy = json['EditedBy']; + complicationDetails = json['complicationDetails']; + bloodLossDetail = json['bloodLossDetail']; + histopathSpecimen = json['histopathSpecimen']; + microbiologySpecimen = json['microbiologySpecimen']; + otherSpecimen = json['otherSpecimen']; + scrubNurse = json['scrubNurse']; + circulatingNurse = json['circulatingNurse']; + bloodTransfusedDetail = json['BloodTransfusedDetail']; + } + + Map toJson() { + final Map data = new Map(); + data['SetupID'] = this.setupID; + data['PatientID'] = this.patientID; + data['reservationNo'] = this.reservationNo; + data['AdmissionNo'] = this.admissionNo; + data['preOpDiagmosis'] = this.preOpDiagmosis; + data['postOpDiagmosis'] = this.postOpDiagmosis; + 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['CreatedBy'] = this.createdBy; + data['EditedBy'] = this.editedBy; + data['complicationDetails'] = this.complicationDetails; + 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; + } +} diff --git a/lib/screens/patients/profile/operation_report/operation_report.dart b/lib/screens/patients/profile/operation_report/operation_report.dart index b00259e4..14ebbc86 100644 --- a/lib/screens/patients/profile/operation_report/operation_report.dart +++ b/lib/screens/patients/profile/operation_report/operation_report.dart @@ -89,15 +89,11 @@ class _ProgressNoteState extends State { patient, isInpatient: true, ), - body: model.operationReportList == null || - model.operationReportList.length == 0 - ? DrAppEmbeddedError( - error: TranslationBase.of(context).errorNoProgressNote) - : Container( + body: + Container( color: Colors.grey[200], child: Column( children: [ - if (!isDischargedPatient) AddNewOrder( onTap: () async { await locator().logEvent( @@ -107,8 +103,8 @@ class _ProgressNoteState extends State { Navigator.push( context, MaterialPageRoute( - builder: (context) => UpdateOperatiomReport( - patientModel: model, + builder: (context) => UpdateOperationReport( + operationReportViewModel: model, patient: patient, visitType: widget.visitType, isUpdate: false, @@ -117,11 +113,12 @@ class _ProgressNoteState extends State { ), ); }, - label: widget.visitType == 3 - ? TranslationBase.of(context).addNewOrderSheet - : TranslationBase.of(context).addProgressNote, + label: TranslationBase.of(context).operationReports, ), - Expanded( + model.operationReportList == null || + model.operationReportList.length == 0 + ? DrAppEmbeddedError( + error: TranslationBase.of(context).errorNoProgressNote):Expanded( child: Container( child: ListView.builder( itemCount: model.operationReportList.length, @@ -557,97 +554,4 @@ class _ProgressNoteState extends State { ), ); } - - showMyDialog({BuildContext context, Function confirmFun, String actionName}) { - showDialog( - context: context, - builder: (ctx) => Center( - child: Container( - width: MediaQuery.of(context).size.width * 0.8, - height: 200, - child: AppScaffold( - isShowAppBar: false, - body: Container( - color: Colors.white, - child: Center( - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - // SizedBox(height: 20,), - SizedBox( - height: 10, - ), - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - AppText( - TranslationBase.of(context).noteConfirm, - fontWeight: FontWeight.w600, - color: Colors.black, - fontSize: 16, - ), - ], - ), - SizedBox( - height: 10, - ), - DividerWithSpacesAround(), - SizedBox( - height: 12, - ), - - Container( - padding: EdgeInsets.all(20), - color: Colors.white, - child: AppText( - projectViewModel.isArabic - ? "هل أنت متأكد أنك تريد تنفيذ $actionName هذا الأمر؟" - : 'Are you sure you want $actionName this order?', - fontSize: 15, - textAlign: TextAlign.center, - ), - ), - - SizedBox( - height: 8, - ), - DividerWithSpacesAround(), - FractionallySizedBox( - widthFactor: 0.75, - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - FlatButton( - child: AppText( - TranslationBase.of(context).cancel, - fontWeight: FontWeight.w600, - color: Colors.black, - fontSize: 16, - ), //Text("Cancel"), - onPressed: () { - Navigator.of(context).pop(); - }), - FlatButton( - child: AppText( - TranslationBase.of(context).noteConfirm, - fontWeight: FontWeight.w600, - color: Colors.red.shade700, - fontSize: 16, - ), //Text("Confirm", ), - onPressed: () async { - await confirmFun(); - Navigator.of(context).pop(); - }) - ], - ), - ) - ], - ), - ), - ), - ), - ), - )); - } } diff --git a/lib/screens/patients/profile/operation_report/update_operation_report.dart b/lib/screens/patients/profile/operation_report/update_operation_report.dart index 8b46ffce..dc64acb5 100644 --- a/lib/screens/patients/profile/operation_report/update_operation_report.dart +++ b/lib/screens/patients/profile/operation_report/update_operation_report.dart @@ -11,6 +11,7 @@ import 'package:doctor_app_flutter/core/viewModel/patient_view_model.dart'; 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/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/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/models/patient/progress_note_request.dart'; import 'package:doctor_app_flutter/screens/patients/profile/soap_update/shared_soap_widgets/bottom_sheet_title.dart'; @@ -28,27 +29,27 @@ import 'package:provider/provider.dart'; import 'package:speech_to_text/speech_recognition_error.dart'; import 'package:speech_to_text/speech_to_text.dart' as stt; -class UpdateOperatiomReport extends StatefulWidget { +class UpdateOperationReport extends StatefulWidget { final NoteModel note; - final OperationReportViewModel patientModel; + final OperationReportViewModel operationReportViewModel; final PatiantInformtion patient; final int visitType; final bool isUpdate; - const UpdateOperatiomReport( + const UpdateOperationReport( {Key key, this.note, - this.patientModel, + this.operationReportViewModel, this.patient, this.visitType, this.isUpdate}) : super(key: key); @override - _UpdateOperatiomReportState createState() => _UpdateOperatiomReportState(); + _UpdateOperationReportState createState() => _UpdateOperationReportState(); } -class _UpdateOperatiomReportState extends State { +class _UpdateOperationReportState extends State { int selectedType; bool isSubmitted = false; stt.SpeechToText speech = stt.SpeechToText(); @@ -56,7 +57,26 @@ class _UpdateOperatiomReportState extends State { var event = RobotProvider(); ProjectViewModel projectViewModel; - TextEditingController progressNoteController = TextEditingController(); + TextEditingController preOpDiagmosisController = TextEditingController(); + TextEditingController postOpDiagmosisNoteController = TextEditingController(); + TextEditingController surgeonController = TextEditingController(); + TextEditingController assistantNoteController = TextEditingController(); + TextEditingController operationController = TextEditingController(); + TextEditingController inasionController = TextEditingController(); + TextEditingController findingController = TextEditingController(); + TextEditingController surgeryProcedureController = TextEditingController(); + TextEditingController postOpInstructionController = TextEditingController(); + TextEditingController complicationDetailsController = TextEditingController(); + TextEditingController bloodLossDetailController = TextEditingController(); + TextEditingController histopathSpecimenController = TextEditingController(); + TextEditingController microbiologySpecimenController = + TextEditingController(); + TextEditingController otherSpecimenController = TextEditingController(); + TextEditingController scrubNurseController = TextEditingController(); + TextEditingController circulatingNurseController = TextEditingController(); + TextEditingController BloodTransfusedDetailController = + TextEditingController(); + TextEditingController anasthetistController = TextEditingController(); setSelectedType(int val) { setState(() { @@ -66,265 +86,491 @@ class _UpdateOperatiomReportState extends State { @override void initState() { - requestPermissions(); - event.controller.stream.listen((p) { - if (p['startPopUp'] == 'true') { - if (this.mounted) { - initSpeechState().then((value) => {onVoiceText()}); - } - } - }); super.initState(); } @override Widget build(BuildContext context) { projectViewModel = Provider.of(context); - - if (widget.note != null) { - progressNoteController.text = widget.note.notes; - } - + //TODO Elham* add translation to hints return AppScaffold( - isShowAppBar: false, + isShowAppBar: true, backgroundColor: Theme.of(context).scaffoldBackgroundColor, + appBar: BottomSheetTitle( + title: (widget.isUpdate + ? TranslationBase.of(context).noteUpdate + : TranslationBase.of(context).noteAdd) + + TranslationBase.of(context).operationReports, + ), body: SingleChildScrollView( child: Container( height: MediaQuery.of(context).size.height * 1.0, child: Padding( padding: EdgeInsets.all(0.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - BottomSheetTitle( - title: widget.visitType == 3 - ? (widget.isUpdate - ? TranslationBase.of(context).noteUpdate - : TranslationBase.of(context).noteAdd) + - TranslationBase.of(context).orderSheet - : (widget.isUpdate - ? TranslationBase.of(context).noteUpdate - : TranslationBase.of(context).noteAdd) + - TranslationBase.of(context).progressNote, - ), - SizedBox( - height: 10.0, - ), - Center( - child: FractionallySizedBox( - widthFactor: 0.9, - child: Column( - children: [ - Stack( + child: SingleChildScrollView( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 10.0, + ), + SingleChildScrollView( + child: Center( + child: FractionallySizedBox( + widthFactor: 0.9, + child: Column( children: [ AppTextFieldCustom( - hintText: widget.visitType == 3 - ? (widget.isUpdate - ? TranslationBase.of(context) - .noteUpdate - : TranslationBase.of(context) - .noteAdd) + - TranslationBase.of(context).orderSheet - : (widget.isUpdate - ? TranslationBase.of(context) - .noteUpdate - : TranslationBase.of(context) - .noteAdd) + - TranslationBase.of(context).progressNote, - //TranslationBase.of(context).addProgressNote, - controller: progressNoteController, - maxLines: 35, - minLines: 25, + hintText: "Pre Op Diagmosis", + //TranslationBase.of(context).addoperationReports, + controller: preOpDiagmosisController, + maxLines: 1, + minLines: 1, + hasBorder: true, + + // isTextFieldHasSuffix: true, + validationError: + preOpDiagmosisController.text.isEmpty && + isSubmitted + ? TranslationBase.of(context).emptyMessage + : null, + ), + SizedBox( + height: 4, + ), + AppTextFieldCustom( + hintText: "Post Op Diagmosis", + //TranslationBase.of(context).addoperationReports, + controller: postOpDiagmosisNoteController, + maxLines: 1, + minLines: 1, + hasBorder: true, + + // isTextFieldHasSuffix: true, + validationError: + postOpDiagmosisNoteController.text.isEmpty && + isSubmitted + ? TranslationBase.of(context).emptyMessage + : null, + ), + SizedBox( + height: 4, + ), + AppTextFieldCustom( + hintText: "Surgeon", + //TranslationBase.of(context).addoperationReports, + controller: surgeonController, + maxLines: 1, + minLines: 1, + hasBorder: true, + + // isTextFieldHasSuffix: true, + validationError: + surgeonController.text.isEmpty && isSubmitted + ? TranslationBase.of(context).emptyMessage + : null, + ), + SizedBox( + height: 4, + ), + AppTextFieldCustom( + hintText: "assistant", + //TranslationBase.of(context).addoperationReports, + controller: assistantNoteController, + maxLines: 1, + minLines: 1, + hasBorder: true, + + // isTextFieldHasSuffix: true, + validationError: + assistantNoteController.text.isEmpty && + isSubmitted + ? TranslationBase.of(context).emptyMessage + : null, + ), + SizedBox( + height: 4, + ), + AppTextFieldCustom( + hintText: "Operation", + //TranslationBase.of(context).addoperationReports, + controller: operationController, + maxLines: 1, + minLines: 1, + hasBorder: true, + + // isTextFieldHasSuffix: true, + validationError: + operationController.text.isEmpty && + isSubmitted + ? TranslationBase.of(context).emptyMessage + : null, + ), + SizedBox( + height: 4, + ), + AppTextFieldCustom( + hintText: "inasion", + //TranslationBase.of(context).addoperationReports, + controller: inasionController, + maxLines: 1, + minLines: 1, + hasBorder: true, + + // isTextFieldHasSuffix: true, + validationError: + inasionController.text.isEmpty && isSubmitted + ? TranslationBase.of(context).emptyMessage + : null, + ), + SizedBox( + height: 4, + ), + AppTextFieldCustom( + hintText: "finding", + //TranslationBase.of(context).addoperationReports, + controller: findingController, + maxLines: 1, + minLines: 1, + hasBorder: true, + + // isTextFieldHasSuffix: true, + validationError: + findingController.text.isEmpty && isSubmitted + ? TranslationBase.of(context).emptyMessage + : null, + ), + SizedBox( + height: 4, + ), + AppTextFieldCustom( + hintText: "Surgery Procedure", + //TranslationBase.of(context).addoperationReports, + controller: surgeryProcedureController, + maxLines: 1, + minLines: 1, + hasBorder: true, + + // isTextFieldHasSuffix: true, + validationError: + surgeryProcedureController.text.isEmpty && + isSubmitted + ? TranslationBase.of(context).emptyMessage + : null, + ), + SizedBox( + height: 4, + ), + AppTextFieldCustom( + hintText: "Post Op Instruction", + //TranslationBase.of(context).addoperationReports, + controller: postOpInstructionController, + maxLines: 1, + minLines: 1, + hasBorder: true, + + // isTextFieldHasSuffix: true, + validationError: + postOpInstructionController.text.isEmpty && + isSubmitted + ? TranslationBase.of(context).emptyMessage + : null, + ), + SizedBox( + height: 4, + ), + AppTextFieldCustom( + hintText: "Complication Details", + //TranslationBase.of(context).addoperationReports, + controller: complicationDetailsController, + maxLines: 1, + minLines: 1, + hasBorder: true, + + // isTextFieldHasSuffix: true, + validationError: + complicationDetailsController.text.isEmpty && + isSubmitted + ? TranslationBase.of(context).emptyMessage + : null, + ), + SizedBox( + height: 4, + ), + AppTextFieldCustom( + hintText: "Blood Loss Detail", + //TranslationBase.of(context).addoperationReports, + controller: bloodLossDetailController, + maxLines: 1, + minLines: 1, + hasBorder: true, + + // isTextFieldHasSuffix: true, + validationError: + bloodLossDetailController.text.isEmpty && + isSubmitted + ? TranslationBase.of(context).emptyMessage + : null, + ), + SizedBox( + height: 4, + ), + AppTextFieldCustom( + hintText: "histopal the Specimen", + //TranslationBase.of(context).addoperationReports, + controller: histopathSpecimenController, + maxLines: 1, + minLines: 1, + hasBorder: true, + + // isTextFieldHasSuffix: true, + validationError: + histopathSpecimenController.text.isEmpty && + isSubmitted + ? TranslationBase.of(context).emptyMessage + : null, + ), + SizedBox( + height: 4, + ), + AppTextFieldCustom( + hintText: "microbiology Specimen ", + //TranslationBase.of(context).addoperationReports, + controller: microbiologySpecimenController, + maxLines: 1, + minLines: 1, + hasBorder: true, + + // isTextFieldHasSuffix: true, + validationError: + microbiologySpecimenController.text.isEmpty && + isSubmitted + ? TranslationBase.of(context).emptyMessage + : null, + ), + SizedBox( + height: 4, + ), + AppTextFieldCustom( + hintText: "other Specimen", + //TranslationBase.of(context).addoperationReports, + controller: otherSpecimenController, + maxLines: 1, + minLines: 1, + hasBorder: true, + + // isTextFieldHasSuffix: true, + validationError: + otherSpecimenController.text.isEmpty && + isSubmitted + ? TranslationBase.of(context).emptyMessage + : null, + ), + SizedBox( + height: 4, + ), + AppTextFieldCustom( + hintText: "scrub Nurse", + //TranslationBase.of(context).addoperationReports, + controller: scrubNurseController, + maxLines: 1, + minLines: 1, + hasBorder: true, + + // isTextFieldHasSuffix: true, + validationError: + scrubNurseController.text.isEmpty && + isSubmitted + ? TranslationBase.of(context).emptyMessage + : null, + ), + SizedBox( + height: 4, + ), + AppTextFieldCustom( + hintText: "circulating Nurse", + //TranslationBase.of(context).addoperationReports, + controller: circulatingNurseController, + maxLines: 1, + minLines: 1, hasBorder: true, // isTextFieldHasSuffix: true, validationError: - progressNoteController.text.isEmpty && + circulatingNurseController.text.isEmpty && isSubmitted ? TranslationBase.of(context).emptyMessage : null, ), - Positioned( - top: - -2, //MediaQuery.of(context).size.height * 0, - right: projectViewModel.isArabic - ? MediaQuery.of(context).size.width * 0.75 - : 15, - child: Column( - children: [ - IconButton( - icon: Icon(DoctorApp.speechtotext, - color: Colors.black, size: 35), - onPressed: () { - initSpeechState() - .then((value) => {onVoiceText()}); - }, - ), - ], - )) + SizedBox( + height: 4, + ), + AppTextFieldCustom( + hintText: "Blood Transfused Detail", + //TranslationBase.of(context).addoperationReports, + controller: BloodTransfusedDetailController, + maxLines: 1, + minLines: 1, + hasBorder: true, + + // isTextFieldHasSuffix: true, + validationError: BloodTransfusedDetailController + .text.isEmpty && + isSubmitted + ? TranslationBase.of(context).emptyMessage + : null, + ), + SizedBox( + height: 4, + ), + AppTextFieldCustom( + hintText: "Anasthetist", + //TranslationBase.of(context).addoperationReports, + controller: anasthetistController, + maxLines: 1, + minLines: 1, + hasBorder: true, + + // isTextFieldHasSuffix: true, + validationError: + anasthetistController.text.isEmpty && + isSubmitted + ? TranslationBase.of(context).emptyMessage + : null, + ), + SizedBox( + height: 250, + ), ], ), - ], + ), ), ), - ), - ], + ], + ), ), ), ), ), bottomSheet: Container( - height: progressNoteController.text.isNotEmpty ? 130 : 70, + height: 70, margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5), child: Column( children: [ - if (progressNoteController.text.isNotEmpty) - Container( - margin: EdgeInsets.all(5), - child: AppButton( - title: TranslationBase.of(context).clearText, - onPressed: () { - setState(() { - progressNoteController.text = ''; - }); - }, - ), - ), Container( - margin: EdgeInsets.all(5), - child: AppButton( - title: widget.visitType == 3 - ? (widget.isUpdate - ? TranslationBase.of(context).noteUpdate - : TranslationBase.of(context).noteAdd) + - TranslationBase.of(context).orderSheet - : (widget.isUpdate - ? TranslationBase.of(context).noteUpdate - : TranslationBase.of(context).noteAdd) + - TranslationBase.of(context).progressNote, - color: Color(0xff359846), - // disabled: progressNoteController.text.isEmpty, - fontWeight: FontWeight.w700, - onPressed: () async { - setState(() { - isSubmitted = true; - }); - if (progressNoteController.text.trim().isNotEmpty) { - GifLoaderDialogUtils.showMyDialog(context); - Map profile = await sharedPref.getObj(DOCTOR_PROFILE); - - DoctorProfileModel doctorProfile = - DoctorProfileModel.fromJson(profile); + margin: EdgeInsets.all(5), + child: AppButton( + title: (widget.isUpdate + ? TranslationBase.of(context).noteUpdate + : TranslationBase.of(context).noteAdd) + + TranslationBase.of(context).operationReports, + color: Color(0xff359846), + // disabled: operationReportsController.text.isEmpty, + fontWeight: FontWeight.w700, + onPressed: () async { + setState(() { + isSubmitted = true; + }); + if (isFormValid()) { + GifLoaderDialogUtils.showMyDialog(context); + await widget.operationReportViewModel.getDoctorProfile(); - if (widget.isUpdate) { - UpdateNoteReqModel reqModel = UpdateNoteReqModel( + CreateUpdateOperationReportRequestModel + createUpdateOperationReportRequestModel = + CreateUpdateOperationReportRequestModel( + inasion: inasionController.text, + /// TODO Elham* Add dynamic reservation + reservationNo: 0, + preOpDiagmosis: preOpDiagmosisController.text, + postOpDiagmosis: postOpDiagmosisNoteController.text, + surgeon: surgeonController.text, + assistant: assistantNoteController.text, + anasthetist: assistantNoteController.text, + operation: operationController.text, + finding: findingController.text, + surgeryProcedure: surgeonController.text, + postOpInstruction: postOpInstructionController.text, + complicationDetails: + complicationDetailsController.text, + bloodLossDetail: bloodLossDetailController.text, + histopathSpecimen: histopathSpecimenController.text, + microbiologySpecimen: + microbiologySpecimenController.text, + otherSpecimen: otherSpecimenController.text, + scrubNurse: surgeonController.text, + circulatingNurse: circulatingNurseController.text, + bloodTransfusedDetail: + bloodLossDetailController.text, + patientID: widget.patient.patientId, admissionNo: int.parse(widget.patient.admissionNo), - cancelledNote: false, - lineItemNo: widget.note.lineItemNo, - createdBy: widget.note.createdBy, - notes: progressNoteController.text, - verifiedNote: false, - patientTypeID: widget.patient.patientType, - patientOutSA: false, - ); - // await widget.patientModel - // .updatePatientProgressNote(reqModel); - } else { - CreateNoteModel reqModel = CreateNoteModel( - admissionNo: - int.parse(widget.patient.admissionNo), - createdBy: doctorProfile.doctorID, - visitType: widget.visitType, - patientID: widget.patient.patientId, - nursingRemarks: ' ', - patientTypeID: widget.patient.patientType, - patientOutSA: false, - notes: progressNoteController.text); + createdBy: widget.operationReportViewModel.doctorProfile.doctorID, + setupID: SETUP_ID); + await widget.operationReportViewModel.updateOperationReport( + createUpdateOperationReportRequestModel); - // await widget.patientModel - // .createPatientProgressNote(reqModel); - } + if (widget.operationReportViewModel.state == + ViewState.ErrorLocal) { + Helpers.showErrorToast( + widget.operationReportViewModel.error); + } else { + // await widget.operationReportViewModel.( + // operationReportsRequest.toJson()); - if (widget.patientModel.state == ViewState.ErrorLocal) { - Helpers.showErrorToast(widget.patientModel.error); - } else { - ProgressNoteRequest progressNoteRequest = - ProgressNoteRequest( - visitType: widget.visitType, - // if equal 5 then this will return progress note - admissionNo: - int.parse(widget.patient.admissionNo), - projectID: widget.patient.projectId, - patientTypeID: widget.patient.patientType, - languageID: 2); - // await widget.patientModel.getPatientProgressNote( - // progressNoteRequest.toJson()); - } - GifLoaderDialogUtils.hideDialog(context); - DrAppToastMsg.showSuccesToast( - "Your Order added Successfully"); - Navigator.of(context).pop(); - } else { - Helpers.showErrorToast("You cant add only spaces"); - } - })), + DrAppToastMsg.showSuccesToast( + "Your Order added Successfully"); + Navigator.of(context).pop(); + } + GifLoaderDialogUtils.hideDialog(context); + } + }, + ), + ), ], ), ), ); } - onVoiceText() async { - new SpeechToText(context: context).showAlertDialog(context); - var lang = TranslationBase.of(AppGlobal.CONTEX).locale.languageCode; - bool available = await speech.initialize( - onStatus: statusListener, onError: errorListener); - if (available) { - speech.listen( - onResult: resultListener, - listenMode: stt.ListenMode.confirmation, - localeId: lang == 'en' ? 'en-US' : 'ar-SA', - ); + isFormValid() { + if (preOpDiagmosisController.text != null && + preOpDiagmosisController.text.isNotEmpty && + postOpDiagmosisNoteController.text != null && + postOpDiagmosisNoteController.text.isNotEmpty && + surgeonController.text != null && + surgeonController.text.isNotEmpty && + assistantNoteController.text != null && + assistantNoteController.text.isNotEmpty && + operationController.text != null && + operationController.text.isNotEmpty && + inasionController.text != null && + inasionController.text.isNotEmpty && + findingController.text != null && + findingController.text.isNotEmpty && + surgeryProcedureController.text != null && + surgeryProcedureController.text.isNotEmpty && + postOpInstructionController.text != null && + postOpInstructionController.text.isNotEmpty && + complicationDetailsController.text != null && + complicationDetailsController.text.isNotEmpty && + bloodLossDetailController.text != null && + bloodLossDetailController.text.isNotEmpty && + histopathSpecimenController.text != null && + histopathSpecimenController.text.isNotEmpty && + microbiologySpecimenController.text != null && + microbiologySpecimenController.text.isNotEmpty && + otherSpecimenController.text != null && + otherSpecimenController.text.isNotEmpty && + scrubNurseController.text != null && + scrubNurseController.text.isNotEmpty && + circulatingNurseController.text != null && + circulatingNurseController.text.isNotEmpty && + BloodTransfusedDetailController.text != null && + BloodTransfusedDetailController.text.isNotEmpty && + anasthetistController.text != null && + anasthetistController.text.isNotEmpty) { + return true; } else { - print("The user has denied the use of speech recognition."); + return false; } } - - void errorListener(SpeechRecognitionError error) { - event.setValue({"searchText": 'null'}); - //SpeechToText.closeAlertDialog(context); - print(error); - } - - void statusListener(String status) { - reconizedWord = status == 'listening' ? 'Lisening...' : 'Sorry....'; - } - - void requestPermissions() async { - Map statuses = await [ - Permission.microphone, - ].request(); - } - - void resultListener(result) { - reconizedWord = result.recognizedWords; - event.setValue({"searchText": reconizedWord}); - - if (result.finalResult == true) { - setState(() { - SpeechToText.closeAlertDialog(context); - speech.stop(); - progressNoteController.text += reconizedWord + '\n'; - }); - } else { - print(result.finalResult); - } - } - - Future initSpeechState() async { - bool hasSpeech = await speech.initialize( - onError: errorListener, onStatus: statusListener); - print(hasSpeech); - if (!mounted) return; - } } diff --git a/lib/util/translations_delegate_base.dart b/lib/util/translations_delegate_base.dart index 0297aa45..59f66811 100644 --- a/lib/util/translations_delegate_base.dart +++ b/lib/util/translations_delegate_base.dart @@ -212,6 +212,7 @@ class TranslationBase { String get replay => localizedValues['replay'][locale.languageCode]; String get progressNote => localizedValues['progressNote'][locale.languageCode]; + String get operationReports => localizedValues['operationReports'][locale.languageCode]; String get progress => localizedValues['progress'][locale.languageCode];