Merge branch 'medical-profile-services' into 'development'

Medical profile services

See merge request Cloud_Solution/doctor_app_flutter!679
merge-requests/680/merge
Mohammad Aljammal 5 years ago
commit acd709368b

@ -298,6 +298,8 @@ const GET_PROCEDURE_TEMPLETE =
const GET_PROCEDURE_TEMPLETE_DETAILS = const GET_PROCEDURE_TEMPLETE_DETAILS =
"Services/Doctors.svc/REST/DAPP_ProcedureTemplateDetailsGet"; "Services/Doctors.svc/REST/DAPP_ProcedureTemplateDetailsGet";
const DOCTOR_CHECK_HAS_LIVE_CARE = "Services/DoctorApplication.svc/REST/CheckDoctorHasLiveCare";
var selectedPatientType = 1; var selectedPatientType = 1;
//*********change value to decode json from Dropdown ************ //*********change value to decode json from Dropdown ************

@ -6,7 +6,8 @@ class DashboardService extends BaseService {
List<DashboardModel> _dashboardItemsList = []; List<DashboardModel> _dashboardItemsList = [];
List<DashboardModel> get dashboardItemsList => _dashboardItemsList; List<DashboardModel> get dashboardItemsList => _dashboardItemsList;
// DashboardModel _dashboard = DashboardModel(); bool hasVirtualClinic;
String sServiceID;
Future getDashboard() async { Future getDashboard() async {
hasError = false; hasError = false;
@ -28,4 +29,22 @@ class DashboardService extends BaseService {
}, },
); );
} }
Future checkDoctorHasLiveCare() async {
hasError = false;
await baseAppClient.post(
DOCTOR_CHECK_HAS_LIVE_CARE,
onSuccess: (dynamic response, int statusCode) {
hasVirtualClinic = response['HasVirtualClinic'];
sServiceID = response['SserviceID'];
},
onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
},
body: {
"DoctorID": 9920
},
);
}
} }

@ -12,14 +12,18 @@ import 'authentication_view_model.dart';
import 'base_view_model.dart'; import 'base_view_model.dart';
class DashboardViewModel extends BaseViewModel { class DashboardViewModel extends BaseViewModel {
final FirebaseMessaging _firebaseMessaging = FirebaseMessaging(); final FirebaseMessaging _firebaseMessaging = FirebaseMessaging();
DashboardService _dashboardService = locator<DashboardService>(); DashboardService _dashboardService = locator<DashboardService>();
List<DashboardModel> get dashboardItemsList => List<DashboardModel> get dashboardItemsList =>
_dashboardService.dashboardItemsList; _dashboardService.dashboardItemsList;
Future setFirebaseNotification(ProjectViewModel projectsProvider, AuthenticationViewModel authProvider) async{ bool get hasVirtualClinic => _dashboardService.hasVirtualClinic;
String get sServiceID => _dashboardService.sServiceID;
Future setFirebaseNotification(ProjectViewModel projectsProvider,
AuthenticationViewModel authProvider) async {
setState(ViewState.Busy); setState(ViewState.Busy);
await projectsProvider.getDoctorClinicsList(); await projectsProvider.getDoctorClinicsList();
@ -50,12 +54,27 @@ class DashboardViewModel extends BaseViewModel {
setState(ViewState.Idle); setState(ViewState.Idle);
} }
Future changeClinic(int clinicId, AuthenticationViewModel authProvider) async { Future checkDoctorHasLiveCare() async {
setState(ViewState.Busy);
await _dashboardService.checkDoctorHasLiveCare();
if (_dashboardService.hasError) {
error = _dashboardService.error;
setState(ViewState.Error);
} else
setState(ViewState.Idle);
}
Future changeClinic(
int clinicId, AuthenticationViewModel authProvider) async {
setState(ViewState.BusyLocal); setState(ViewState.BusyLocal);
await getDoctorProfile(); await getDoctorProfile();
ClinicModel clinicModel = ClinicModel(doctorID:doctorProfile.doctorID,clinicID: clinicId, projectID: doctorProfile.projectID,); ClinicModel clinicModel = ClinicModel(
doctorID: doctorProfile.doctorID,
clinicID: clinicId,
projectID: doctorProfile.projectID,
);
await authProvider.getDoctorProfileBasedOnClinic(clinicModel); await authProvider.getDoctorProfileBasedOnClinic(clinicModel);
if(authProvider.state == ViewState.ErrorLocal) { if (authProvider.state == ViewState.ErrorLocal) {
error = authProvider.error; error = authProvider.error;
} }
} }

@ -33,7 +33,6 @@ import 'package:provider/provider.dart';
import 'package:sticky_headers/sticky_headers/widget.dart'; import 'package:sticky_headers/sticky_headers/widget.dart';
import '../../widgets/shared/app_texts_widget.dart'; import '../../widgets/shared/app_texts_widget.dart';
import 'home_page_card.dart';
class HomeScreen extends StatefulWidget { class HomeScreen extends StatefulWidget {
HomeScreen({Key key, this.title}) : super(key: key); HomeScreen({Key key, this.title}) : super(key: key);
@ -55,6 +54,7 @@ class _HomeScreenState extends State<HomeScreen> {
int sliderActiveIndex = 0; int sliderActiveIndex = 0;
var clinicId; var clinicId;
AuthenticationViewModel authenticationViewModel; AuthenticationViewModel authenticationViewModel;
int colorIndex = 0;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -68,9 +68,11 @@ class _HomeScreenState extends State<HomeScreen> {
return BaseView<DashboardViewModel>( return BaseView<DashboardViewModel>(
onModelReady: (model) async { onModelReady: (model) async {
await model.setFirebaseNotification(projectsProvider, authenticationViewModel); await model.setFirebaseNotification(
projectsProvider, authenticationViewModel);
await model.getDashboard(); await model.getDashboard();
await model.getDoctorProfile(isGetProfile: true); await model.getDoctorProfile(isGetProfile: true);
await model.checkDoctorHasLiveCare();
}, },
builder: (_, model, w) => AppScaffold( builder: (_, model, w) => AppScaffold(
baseViewModel: model, baseViewModel: model,
@ -289,117 +291,7 @@ class _HomeScreenState extends State<HomeScreen> {
child: ListView( child: ListView(
scrollDirection: Axis.horizontal, scrollDirection: Axis.horizontal,
children: [ children: [
HomePatientCard( ...homePatientsCardsWidget(model),
backgroundColor: Color(0xffD02127),
backgroundIconColor: Colors.white12,
cardIcon: DoctorApp.inpatient,
textColor: Colors.white,
text: "Live Care Patients",
onTap: () {
Navigator.push(
context,
FadePage(
page: PatientInPatientScreen(),
),
);
},
),
HomePatientCard(
backgroundColor: Color(0xffD02127),
backgroundIconColor: Colors.white12,
cardIcon: DoctorApp.inpatient,
textColor: Colors.white,
text: TranslationBase.of(context)
.myInPatient,
onTap: () {
Navigator.push(
context,
FadePage(
page: PatientInPatientScreen(),
),
);
},
),
HomePatientCard(
backgroundColor: Colors.grey[300],
backgroundIconColor: Colors.white38,
cardIcon: DoctorApp.arrival_patients,
textColor: Colors.black,
text: TranslationBase.of(context)
.myOutPatient_2lines,
onTap: () {
String date =
AppDateUtils.convertDateToFormat(
DateTime(
DateTime.now().year,
DateTime.now().month,
DateTime.now().day),
'yyyy-MM-dd');
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => OutPatientsScreen(
patientSearchRequestModel:
PatientSearchRequestModel(
from: date,
to: date,
doctorID:
authenticationViewModel
.doctorProfile
.doctorID)),
));
},
),
HomePatientCard(
backgroundColor: Color(0xff2B353E),
backgroundIconColor: Colors.white10,
cardIcon: DoctorApp.referral_1,
textColor: Colors.white,
text: TranslationBase.of(context)
.myPatientsReferral,
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
PatientReferralScreen(),
),
);
},
),
HomePatientCard(
backgroundColor: Color(0xffD02127),
backgroundIconColor: Colors.white10,
cardIcon: DoctorApp.search,
textColor: Colors.white,
text: TranslationBase.of(context)
.searchPatientDashBoard,
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
PatientSearchScreen(),
));
},
),
HomePatientCard(
backgroundColor: Color(0xffC9C9C9),
backgroundIconColor: Colors.black12,
cardIcon: DoctorApp.search_medicines,
textColor: Color(0xff2B353E),
text: TranslationBase.of(context)
.searchMedicineDashboard,
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
MedicineSearchScreen(),
));
},
),
])), ])),
SizedBox( SizedBox(
height: 20, height: 20,
@ -416,4 +308,153 @@ class _HomeScreenState extends State<HomeScreen> {
), ),
); );
} }
List<Widget> homePatientsCardsWidget(DashboardViewModel model) {
colorIndex = 0;
List<Color> backgroundColors = List(3);
backgroundColors[0] = Color(0xffD02127);
backgroundColors[1] = Colors.grey[300];
backgroundColors[2] = Color(0xff2B353E);
List<Color> backgroundIconColors = List(3);
backgroundIconColors[0] = Colors.white12;
backgroundIconColors[1] = Colors.white38;
backgroundIconColors[2] = Colors.white10;
List<Color> textColors = List(3);
textColors[0] = Colors.white;
textColors[1] = Colors.black;
textColors[2] = Colors.white;
List<HomePatientCard> patientCards = List();
if (model.hasVirtualClinic) {
patientCards.add(HomePatientCard(
backgroundColor: backgroundColors[colorIndex],
backgroundIconColor: backgroundIconColors[colorIndex],
cardIcon: DoctorApp.inpatient,
textColor: textColors[colorIndex],
text:
"${TranslationBase.of(context).liveCare}\n${TranslationBase.of(context).patients}",
onTap: () {
Navigator.push(
context,
FadePage(
page: PatientInPatientScreen(),
),
);
},
));
changeColorIndex();
}
patientCards.add(HomePatientCard(
backgroundColor: backgroundColors[colorIndex],
backgroundIconColor: backgroundIconColors[colorIndex],
cardIcon: DoctorApp.inpatient,
textColor: textColors[colorIndex],
text: TranslationBase.of(context).myInPatient,
onTap: () {
Navigator.push(
context,
FadePage(
page: PatientInPatientScreen(),
),
);
},
));
changeColorIndex();
patientCards.add(HomePatientCard(
backgroundColor: backgroundColors[colorIndex],
backgroundIconColor: backgroundIconColors[colorIndex],
cardIcon: DoctorApp.arrival_patients,
textColor: textColors[colorIndex],
text: TranslationBase.of(context).myOutPatient_2lines,
onTap: () {
String date = AppDateUtils.convertDateToFormat(
DateTime(
DateTime.now().year, DateTime.now().month, DateTime.now().day),
'yyyy-MM-dd');
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => OutPatientsScreen(
patientSearchRequestModel: PatientSearchRequestModel(
from: date,
to: date,
doctorID:
authenticationViewModel.doctorProfile.doctorID)),
));
},
));
changeColorIndex();
patientCards.add(HomePatientCard(
backgroundColor: backgroundColors[colorIndex],
backgroundIconColor: backgroundIconColors[colorIndex],
cardIcon: DoctorApp.referral_1,
textColor: textColors[colorIndex],
text: TranslationBase.of(context)
.myPatientsReferral,
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
PatientReferralScreen(),
),
);
},
));
changeColorIndex();
patientCards.add(HomePatientCard(
backgroundColor: backgroundColors[colorIndex],
backgroundIconColor: backgroundIconColors[colorIndex],
cardIcon: DoctorApp.search,
textColor: textColors[colorIndex],
text: TranslationBase.of(context)
.searchPatientDashBoard,
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
PatientSearchScreen(),
));
},
));
changeColorIndex();
patientCards.add(HomePatientCard(
backgroundColor: backgroundColors[colorIndex],
backgroundIconColor: backgroundIconColors[colorIndex],
cardIcon: DoctorApp.search_medicines,
textColor: textColors[colorIndex],
text: TranslationBase.of(context)
.searchMedicineDashboard,
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
MedicineSearchScreen(),
));
},
));
changeColorIndex();
return [
...List.generate(patientCards.length, (index) => patientCards[index])
.toList()
];
}
changeColorIndex() {
colorIndex++;
if (colorIndex > 2) {
colorIndex = 0;
}
}
} }

@ -1,6 +1,4 @@
import 'package:doctor_app_flutter/config/config.dart';
import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/enum/viewstate.dart';
import 'package:doctor_app_flutter/core/provider/robot_provider.dart';
import 'package:doctor_app_flutter/core/viewModel/PatientMedicalReportViewModel.dart'; import 'package:doctor_app_flutter/core/viewModel/PatientMedicalReportViewModel.dart';
import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart';
import 'package:doctor_app_flutter/models/patient/MedicalReport/MeidcalReportModel.dart'; import 'package:doctor_app_flutter/models/patient/MedicalReport/MeidcalReportModel.dart';
@ -11,14 +9,11 @@ import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart'; import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart';
import 'package:doctor_app_flutter/widgets/shared/speech-text-popup.dart';
import 'package:doctor_app_flutter/widgets/shared/text_fields/html_rich_editor.dart'; import 'package:doctor_app_flutter/widgets/shared/text_fields/html_rich_editor.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:html_editor_enhanced/html_editor.dart'; import 'package:html_editor_enhanced/html_editor.dart';
import 'package:permission_handler/permission_handler.dart'; import 'package:permission_handler/permission_handler.dart';
import 'package:provider/provider.dart'; 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 AddVerifyMedicalReport extends StatefulWidget { class AddVerifyMedicalReport extends StatefulWidget {
@override @override
@ -26,42 +21,6 @@ class AddVerifyMedicalReport extends StatefulWidget {
} }
class _AddVerifyMedicalReportState extends State<AddVerifyMedicalReport> { class _AddVerifyMedicalReportState extends State<AddVerifyMedicalReport> {
stt.SpeechToText speechHistoryFinding = stt.SpeechToText();
stt.SpeechToText speechLaboratoryData = stt.SpeechToText();
stt.SpeechToText speechRecommendation = stt.SpeechToText();
var recognizedWord1;
var recognizedWord2;
var recognizedWord3;
var event = RobotProvider();
TextEditingController historyFindingController = TextEditingController();
TextEditingController laboratoryDataController = TextEditingController();
TextEditingController recommendationController = TextEditingController();
String commentsError;
String comments2Error;
String comments3Error;
@override
void initState() {
requestPermissions();
event.controller.stream.listen((p) {
if (p['startPopUp'] == 'true') {
if (this.mounted) {
initSpeechState().then((value) {
onVoiceText();
});
initSpeechState2().then((value) {
onVoiceText2();
});
initSpeechState3().then((value) {
onVoiceText3();
});
}
}
});
super.initState();
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of<ProjectViewModel>(context); ProjectViewModel projectViewModel = Provider.of<ProjectViewModel>(context);
@ -94,9 +53,15 @@ class _AddVerifyMedicalReportState extends State<AddVerifyMedicalReport> {
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
HtmlRichEditor(initialText: model if (model.medicalReportTemplate.length > 0)
.medicalReportTemplate[0] HtmlRichEditor(
.templateTextHtml, height: MediaQuery.of(context).size.height * 0.75,), initialText: model
.medicalReportTemplate[0]
.templateTextHtml,
height:
MediaQuery.of(context).size.height *
0.75,
),
], ],
), ),
), ),
@ -121,13 +86,13 @@ class _AddVerifyMedicalReportState extends State<AddVerifyMedicalReport> {
// disabled: progressNoteController.text.isEmpty, // disabled: progressNoteController.text.isEmpty,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
onPressed: () async { onPressed: () async {
String txtOfMedicalReport =
String txtOfMedicalReport = await HtmlEditor.getText(); await HtmlEditor.getText();
if (txtOfMedicalReport.isNotEmpty) { if (txtOfMedicalReport.isNotEmpty) {
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context);
model.insertMedicalReport(patient,txtOfMedicalReport model.insertMedicalReport(
); patient, txtOfMedicalReport);
GifLoaderDialogUtils.hideDialog(context); GifLoaderDialogUtils.hideDialog(context);
if (model.state == ViewState.ErrorLocal) { if (model.state == ViewState.ErrorLocal) {
DrAppToastMsg.showErrorToast(model.error); DrAppToastMsg.showErrorToast(model.error);
@ -166,137 +131,11 @@ class _AddVerifyMedicalReportState extends State<AddVerifyMedicalReport> {
)); ));
} }
onVoiceText() async {
new SpeechToText(context: context).showAlertDialog(context);
var lang = TranslationBase.of(AppGlobal.CONTEX).locale.languageCode;
bool available = await speechHistoryFinding.initialize(
onStatus: statusListener, onError: errorListener);
if (available) {
speechHistoryFinding.listen(
onResult: resultListener,
listenMode: stt.ListenMode.confirmation,
localeId: lang == 'en' ? 'en-US' : 'ar-SA',
);
} else {
print("The user has denied the use of speech recognition.");
}
}
onVoiceText2() async {
new SpeechToText(context: context).showAlertDialog(context);
var lang = TranslationBase.of(AppGlobal.CONTEX).locale.languageCode;
bool available = await speechLaboratoryData.initialize(
onStatus: statusListener, onError: errorListener);
if (available) {
speechLaboratoryData.listen(
onResult: resultListener2,
listenMode: stt.ListenMode.confirmation,
localeId: lang == 'en' ? 'en-US' : 'ar-SA',
);
} else {
print("The user has denied the use of speech recognition.");
}
}
onVoiceText3() async {
new SpeechToText(context: context).showAlertDialog(context);
var lang = TranslationBase.of(AppGlobal.CONTEX).locale.languageCode;
bool available = await speechRecommendation.initialize(
onStatus: statusListener, onError: errorListener);
if (available) {
speechRecommendation.listen(
onResult: resultListener3,
listenMode: stt.ListenMode.confirmation,
localeId: lang == 'en' ? 'en-US' : 'ar-SA',
);
} else {
print("The user has denied the use of speech recognition.");
}
}
void errorListener(SpeechRecognitionError error) {
event.setValue({"searchText": 'null'});
//SpeechToText.closeAlertDialog(context);
print(error);
}
void statusListener(String status) {
recognizedWord1 = status == 'listening' ? 'Lisening...' : 'Sorry....';
recognizedWord2 = status == 'listening' ? 'Lisening...' : 'Sorry....';
recognizedWord3 = status == 'listening' ? 'Lisening...' : 'Sorry....';
}
void requestPermissions() async { void requestPermissions() async {
Map<Permission, PermissionStatus> statuses = await [ Map<Permission, PermissionStatus> statuses = await [
Permission.microphone, Permission.microphone,
].request(); ].request();
} }
void resultListener(result) {
recognizedWord1 = result.recognizedWords;
event.setValue({"searchText": recognizedWord1});
if (result.finalResult == true) {
setState(() {
SpeechToText.closeAlertDialog(context);
speechHistoryFinding.stop();
historyFindingController.text += recognizedWord1 + '\n';
});
} else {
print(result.finalResult);
}
}
void resultListener2(result) {
recognizedWord2 = result.recognizedWords;
event.setValue({"searchText": recognizedWord2});
if (result.finalResult == true) {
setState(() {
SpeechToText.closeAlertDialog(context);
speechLaboratoryData.stop();
laboratoryDataController.text += recognizedWord2 + '\n';
});
} else {
print(result.finalResult);
}
}
void resultListener3(result) {
recognizedWord3 = result.recognizedWords;
event.setValue({"searchText": recognizedWord3});
if (result.finalResult == true) {
setState(() {
SpeechToText.closeAlertDialog(context);
speechRecommendation.stop();
recommendationController.text += recognizedWord3 + '\n';
});
} else {
print(result.finalResult);
}
}
Future<void> initSpeechState() async {
bool hasSpeech = await speechHistoryFinding.initialize(
onError: errorListener, onStatus: statusListener);
print(hasSpeech);
if (!mounted) return;
}
Future<void> initSpeechState2() async {
bool hasSpeech = await speechLaboratoryData.initialize(
onError: errorListener, onStatus: statusListener);
print(hasSpeech);
if (!mounted) return;
}
Future<void> initSpeechState3() async {
bool hasSpeech = await speechRecommendation.initialize(
onError: errorListener, onStatus: statusListener);
print(hasSpeech);
if (!mounted) return;
}
} }
enum MedicalReportStatus { ADD, VERIFY } enum MedicalReportStatus { ADD, VERIFY }

@ -6,6 +6,7 @@ import 'package:doctor_app_flutter/icons_app/doctor_app_icons.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/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart';
import 'package:doctor_app_flutter/util/date-utils.dart'; import 'package:doctor_app_flutter/util/date-utils.dart';
import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/patients/profile/add-order/addNewOrder.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/add-order/addNewOrder.dart';
import 'package:doctor_app_flutter/widgets/patients/profile/large_avatar.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/large_avatar.dart';
@ -32,12 +33,16 @@ class MedicalReportPage extends StatelessWidget {
ProjectViewModel projectViewModel = Provider.of(context); ProjectViewModel projectViewModel = Provider.of(context);
return BaseView<PatientMedicalReportViewModel>( return BaseView<PatientMedicalReportViewModel>(
onModelReady: (model) => model.getMedicalReportList(patient), onModelReady: (model) async {
await model.getMedicalReportList(patient);
if (model.state == ViewState.ErrorLocal) {
DrAppToastMsg.showErrorToast(model.error);
}
},
builder: (_, model, w) => AppScaffold( builder: (_, model, w) => AppScaffold(
baseViewModel: model, baseViewModel: model,
isShowAppBar: true, isShowAppBar: true,
backgroundColor: Theme.of(context).scaffoldBackgroundColor, backgroundColor: Theme.of(context).scaffoldBackgroundColor,
appBar: PatientProfileHeaderNewDesignAppBar( appBar: PatientProfileHeaderNewDesignAppBar(
patient, patient,
patientType, patientType,
@ -80,10 +85,10 @@ class MedicalReportPage extends StatelessWidget {
}, },
label: TranslationBase.of(context).createNewMedicalReport, label: TranslationBase.of(context).createNewMedicalReport,
), ),
if (model.state == ViewState.ErrorLocal) // if (model.state == ViewState.ErrorLocal)
Container( // Container(
child: ErrorMessage(error: model.error), // child: ErrorMessage(error: model.error),
), // ),
if (model.state != ViewState.ErrorLocal) if (model.state != ViewState.ErrorLocal)
...List.generate( ...List.generate(
model.medicalReportList.length, model.medicalReportList.length,
@ -150,22 +155,26 @@ class MedicalReportPage extends StatelessWidget {
onTap: () { onTap: () {
if (model.medicalReportList[index].status == if (model.medicalReportList[index].status ==
0) { 0) {
Navigator.of(context) Navigator.of(context).pushNamed(
.pushNamed(PATIENT_MEDICAL_REPORT_INSERT, arguments: { PATIENT_MEDICAL_REPORT_INSERT,
'patient': patient, arguments: {
'patientType': patientType, 'patient': patient,
'arrivalType': arrivalType, 'patientType': patientType,
'type': MedicalReportStatus.ADD, 'arrivalType': arrivalType,
'medicalReport' : model.medicalReportList[index] 'type': MedicalReportStatus.ADD,
}); 'medicalReport':
model.medicalReportList[index]
});
} else { } else {
Navigator.of(context) Navigator.of(context).pushNamed(
.pushNamed(PATIENT_MEDICAL_REPORT_DETAIL, arguments: { PATIENT_MEDICAL_REPORT_DETAIL,
'patient': patient, arguments: {
'patientType': patientType, 'patient': patient,
'arrivalType': arrivalType, 'patientType': patientType,
'medicalReport' : model.medicalReportList[index] 'arrivalType': arrivalType,
}); 'medicalReport':
model.medicalReportList[index]
});
} }
}, },
child: Icon( child: Icon(

@ -587,7 +587,7 @@ packages:
name: js name: js
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.6.3-nullsafety.1" version: "0.6.2"
json_annotation: json_annotation:
dependency: transitive dependency: transitive
description: description:

Loading…
Cancel
Save