finish the operation Reports from our side

merge-requests/862/head
Elham Rababh 4 years ago
parent 231614e914
commit a44a207116

@ -348,7 +348,7 @@ const GET_EPISODE_FOR_INPATIENT =
const GET_OPERATION_REPORT =
"/Services/DoctorApplication.svc/REST/DoctorApp_GetReservationDetails";
const UPDATE_OPERATION_REPORT =
"/Services/DoctorApplication.svc/REST/DoctorApp_CreateUpdateOperationReport";
"Services/DoctorApplication.svc/REST/DoctorApp_CreateUpdateOperationReport";
var selectedPatientType = 1;

@ -709,5 +709,6 @@ const Map<String, Map<String, String>> localizedValues = {
"en":"Request Type",
"ar":"نوع الطلب"},
"special": {"en": "Special", "ar": "خاص"},
"allClinic": {"en": "All Clinics", "ar": "جميع العيادات"}
"allClinic": {"en": "All Clinics", "ar": "جميع العيادات"} ,
"operationReports": {"en": "Operation Reports", "ar": "تقارير العملية"}
};

@ -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';
class OperationReportViewModel extends BaseViewModel {
bool hasError = false;
@ -28,6 +29,7 @@ class OperationReportViewModel extends BaseViewModel {
CreateUpdateOperationReportRequestModel
createUpdateOperationReport) async {
setState(ViewState.BusyLocal);
await _operationReportService.updateOperationReport(createUpdateOperationReport);
if (_operationReportService.hasError) {
error = _operationReportService.error;
setState(ViewState.ErrorLocal);

@ -90,15 +90,11 @@ class _ProgressNoteState extends State<OperationReportScreen> {
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: <Widget>[
if (!isDischargedPatient)
AddNewOrder(
onTap: () async {
await locator<AnalyticsService>().logEvent(
@ -108,8 +104,8 @@ class _ProgressNoteState extends State<OperationReportScreen> {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => UpdateOperatiomReport(
patientModel: model,
builder: (context) => UpdateOperationReport(
operationReportViewModel: model,
patient: patient,
visitType: widget.visitType,
isUpdate: false,
@ -118,11 +114,12 @@ class _ProgressNoteState extends State<OperationReportScreen> {
),
);
},
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,
@ -558,97 +555,4 @@ class _ProgressNoteState extends State<OperationReportScreen> {
),
);
}
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();
})
],
),
)
],
),
),
),
),
),
));
}
}

@ -76,8 +76,7 @@ class _UpdateOperationReportState extends State<UpdateOperationReport> {
TextEditingController circulatingNurseController = TextEditingController();
TextEditingController BloodTransfusedDetailController =
TextEditingController();
TextEditingController anasthetistController =
TextEditingController();
TextEditingController anasthetistController = TextEditingController();
setSelectedType(int val) {
setState(() {
@ -87,240 +86,491 @@ class _UpdateOperationReportState extends State<UpdateOperationReport> {
@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) {
preOpDiagmosisController.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.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: [
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: preOpDiagmosisController,
maxLines: 1,
minLines: 1,
hasBorder: true,
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: "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).addProgressNote,
controller: postOpDiagmosisNoteController,
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: "Post Op Diagmosis",
//TranslationBase.of(context).addProgressNote,
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:
postOpDiagmosisNoteController.text.isEmpty &&
isSubmitted
? TranslationBase.of(context).emptyMessage
: null,
// 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:
circulatingNurseController.text.isEmpty &&
isSubmitted
? TranslationBase.of(context).emptyMessage
: null,
),
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,
),
],
),
SizedBox(height: 4,),
],
),
),
),
),
],
],
),
),
),
),
),
bottomSheet: Container(
height: preOpDiagmosisController.text.isNotEmpty ? 130 : 70,
height: 70,
margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5),
child: Column(
children: <Widget>[
Container(
margin: EdgeInsets.all(5),
child: AppButton(
title: (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;
});
GifLoaderDialogUtils.showMyDialog(context);
Map profile = await sharedPref.getObj(DOCTOR_PROFILE);
if (widget.isUpdate) {
CreateUpdateOperationReportRequestModel
createUpdateOperationReportRequestModel =
CreateUpdateOperationReportRequestModel(
inasion: inasionController.text,
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
);
await widget.operationReportViewModel
.updateOperationReport(createUpdateOperationReportRequestModel);
}
if (widget.operationReportViewModel.state ==
ViewState.ErrorLocal) {
Helpers.showErrorToast(
widget.operationReportViewModel.error);
} else {
// await widget.operationReportViewModel.(
// progressNoteRequest.toJson());
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();
DrAppToastMsg.showSuccesToast(
"Your Order added Successfully");
Navigator.of(context).pop();
}
GifLoaderDialogUtils.hideDialog(context);
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),
createdBy: widget.operationReportViewModel.doctorProfile.doctorID,
setupID: SETUP_ID);
await widget.operationReportViewModel.updateOperationReport(
createUpdateOperationReportRequestModel);
if (widget.operationReportViewModel.state ==
ViewState.ErrorLocal) {
Helpers.showErrorToast(
widget.operationReportViewModel.error);
} else {
// await widget.operationReportViewModel.(
// operationReportsRequest.toJson());
})),
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<Permission, PermissionStatus> 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();
preOpDiagmosisController.text += reconizedWord + '\n';
});
} else {
print(result.finalResult);
}
}
Future<void> initSpeechState() async {
bool hasSpeech = await speech.initialize(
onError: errorListener, onStatus: statusListener);
print(hasSpeech);
if (!mounted) return;
}
}

@ -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];

Loading…
Cancel
Save