Merge branches 'development' and 'html_editor' of https://gitlab.com/Cloud_Solution/doctor_app_flutter into html_editor

 Conflicts:
	lib/screens/home/home_screen.dart
html_editor
Elham Rababah 5 years ago
commit c4b434497a

@ -328,4 +328,4 @@ SPEC CHECKSUMS:
PODFILE CHECKSUM: 649616dc336b3659ac6b2b25159d8e488e042b69
COCOAPODS: 1.10.0.rc.1
COCOAPODS: 1.10.1

@ -24,7 +24,7 @@ class BaseAppClient {
bool isAllowAny = false}) async {
String url = BASE_URL + endPoint;
bool callLog= true;
bool callLog = true;
try {
Map profile = await sharedPref.getObj(DOCTOR_PROFILE);
String token = await sharedPref.getString(TOKEN);
@ -48,7 +48,8 @@ class BaseAppClient {
if (body['EditedBy'] == '') {
body.remove("EditedBy");
}
body['TokenID'] = token ?? '';
body['TokenID'] = "@dm!n";// token ?? '';
// body['TokenID'] = "@dm!n" ?? '';
String lang = await sharedPref.getString(APP_Language);
if (lang != null && lang == 'ar')
body['LanguageID'] = 1;
@ -74,9 +75,9 @@ class BaseAppClient {
//int projectID = await sharedPref.getInt(PROJECT_ID);
//if (projectID == 2 || projectID == 3)
// body['PatientOutSA'] = true;
// body['PatientOutSA'] = true;
//else
body['PatientOutSA'] = false;
body['PatientOutSA'] = false;
body['DeviceTypeID'] = Platform.isAndroid ? 1 : 2;
print("URL : $url");
@ -104,7 +105,9 @@ class BaseAppClient {
if (body['OTP_SendType'] != null) {
onFailure(getError(parsed), statusCode);
} else if (!isAllowAny) {
await Provider.of<AuthenticationViewModel>(AppGlobal.CONTEX, listen: false).logout();
await Provider.of<AuthenticationViewModel>(AppGlobal.CONTEX,
listen: false)
.logout();
Helpers.showErrorToast('Your session expired Please login again');
}
if (isAllowAny) {

@ -4,8 +4,8 @@ const MAX_SMALL_SCREEN = 660;
const ONLY_NUMBERS = "[0-9]";
const ONLY_LETTERS = "[a-zA-Z &'\"]";
const ONLY_DATE = "[0-9/]";
// const BASE_URL = 'https://hmgwebservices.com/';
const BASE_URL = 'https://uat.hmgwebservices.com/';
const BASE_URL = 'https://hmgwebservices.com/';
// const BASE_URL = 'https://uat.hmgwebservices.com/';
const PHARMACY_ITEMS_URL = "Services/Lists.svc/REST/GetPharmcyItems_Region_enh";
const PHARMACY_LIST_URL = "Services/Patients.svc/REST/GetPharmcyList";
const PATIENT_PROGRESS_NOTE_URL =
@ -283,11 +283,14 @@ const GET_SICK_LEAVE_PATIENT = "Services/Patients.svc/REST/GetPatientSickLeave";
const GET_MY_OUT_PATIENT =
"Services/DoctorApplication.svc/REST/GetMyOutPatient";
const PATIENT_MEDICAL_REPORT_GET_LIST = "Services/Patients.svc/REST/DAPP_ListMedicalReport";
const PATIENT_MEDICAL_REPORT_GET_TEMPLATE = "Services/Patients.svc/REST/DAPP_GetTemplateByID";
const PATIENT_MEDICAL_REPORT_INSERT = "Services/Patients.svc/REST/DAPP_InsertMedicalReport";
const PATIENT_MEDICAL_REPORT_VERIFIED = "Services/Patients.svc/REST/DAPP_VerifiedMedicalReport";
const PATIENT_MEDICAL_REPORT_GET_LIST =
"Services/Patients.svc/REST/DAPP_ListMedicalReport";
const PATIENT_MEDICAL_REPORT_GET_TEMPLATE =
"Services/Patients.svc/REST/DAPP_GetTemplateByID";
const PATIENT_MEDICAL_REPORT_INSERT =
"Services/Patients.svc/REST/DAPP_InsertMedicalReport";
const PATIENT_MEDICAL_REPORT_VERIFIED =
"Services/Patients.svc/REST/DAPP_VerifiedMedicalReport";
const GET_PROCEDURE_TEMPLETE =
'Services/Doctors.svc/REST/DAPP_ProcedureTemplateGet';
@ -296,6 +299,8 @@ const GET_PROCEDURE_TEMPLETE_DETAILS =
"Services/Doctors.svc/REST/DAPP_ProcedureTemplateDetailsGet";
const GET_PENDING_PATIENT_ER_FOR_DOCTOR_APP ='Services/DoctorApplication.svc/REST/GetPendingPatientERForDoctorApp';
const DOCTOR_CHECK_HAS_LIVE_CARE = "Services/DoctorApplication.svc/REST/CheckDoctorHasLiveCare";
var selectedPatientType = 1;
//*********change value to decode json from Dropdown ************

@ -6,7 +6,8 @@ class DashboardService extends BaseService {
List<DashboardModel> _dashboardItemsList = [];
List<DashboardModel> get dashboardItemsList => _dashboardItemsList;
// DashboardModel _dashboard = DashboardModel();
bool hasVirtualClinic;
String sServiceID;
Future getDashboard() async {
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';
class DashboardViewModel extends BaseViewModel {
final FirebaseMessaging _firebaseMessaging = FirebaseMessaging();
DashboardService _dashboardService = locator<DashboardService>();
List<DashboardModel> get 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);
await projectsProvider.getDoctorClinicsList();
@ -50,12 +54,27 @@ class DashboardViewModel extends BaseViewModel {
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);
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);
if(authProvider.state == ViewState.ErrorLocal) {
if (authProvider.state == ViewState.ErrorLocal) {
error = authProvider.error;
}
}

@ -115,7 +115,7 @@ class ProcedureViewModel extends BaseViewModel {
tempId = templateId;
hasError = false;
//_insuranceCardService.clearInsuranceCard();
setState(ViewState.Busy);
setState(ViewState.BusyLocal);
await _procedureService.getProcedureTemplateDetails(templateId: templateId);
if (_procedureService.hasError) {
error = _procedureService.error;

@ -13,7 +13,6 @@ import 'package:doctor_app_flutter/screens/base/base_view.dart';
import 'package:doctor_app_flutter/screens/home/dashboard_slider-item-widget.dart';
import 'package:doctor_app_flutter/screens/home/dashboard_swipe_widget.dart';
import 'package:doctor_app_flutter/screens/home/home_patient_card.dart';
import 'package:doctor_app_flutter/screens/live_care/live_care_patient_screen.dart';
import 'package:doctor_app_flutter/screens/medicine/medicine_search_screen.dart';
import 'package:doctor_app_flutter/screens/patients/PatientsInPatientScreen.dart';
import 'package:doctor_app_flutter/screens/patients/out_patient/out_patient_screen.dart';
@ -34,7 +33,6 @@ import 'package:provider/provider.dart';
import 'package:sticky_headers/sticky_headers/widget.dart';
import '../../widgets/shared/app_texts_widget.dart';
import 'home_page_card.dart';
class HomeScreen extends StatefulWidget {
HomeScreen({Key key, this.title}) : super(key: key);
@ -56,6 +54,7 @@ class _HomeScreenState extends State<HomeScreen> {
int sliderActiveIndex = 0;
var clinicId;
AuthenticationViewModel authenticationViewModel;
int colorIndex = 0;
@override
Widget build(BuildContext context) {
@ -69,9 +68,11 @@ class _HomeScreenState extends State<HomeScreen> {
return BaseView<DashboardViewModel>(
onModelReady: (model) async {
await model.setFirebaseNotification(projectsProvider, authenticationViewModel);
await model.setFirebaseNotification(
projectsProvider, authenticationViewModel);
await model.getDashboard();
await model.getDoctorProfile(isGetProfile: true);
await model.checkDoctorHasLiveCare();
},
builder: (_, model, w) => AppScaffold(
baseViewModel: model,
@ -290,117 +291,7 @@ class _HomeScreenState extends State<HomeScreen> {
child: ListView(
scrollDirection: Axis.horizontal,
children: [
HomePatientCard(
backgroundColor: Color(0xffD02127),
backgroundIconColor: Colors.white12,
cardIcon: DoctorApp.inpatient,
textColor: Colors.white,
text: "Live Care Patients",
onTap: () {
Navigator.push(
context,
FadePage(
page: LiveCarePatientScreen(),
),
);
},
),
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(),
));
},
),
...homePatientsCardsWidget(model),
])),
SizedBox(
height: 20,
@ -417,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/provider/robot_provider.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/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/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/speech-text-popup.dart';
import 'package:doctor_app_flutter/widgets/shared/text_fields/html_rich_editor.dart';
import 'package:flutter/material.dart';
import 'package:html_editor_enhanced/html_editor.dart';
import 'package:permission_handler/permission_handler.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 {
@override
@ -26,42 +21,6 @@ class AddVerifyMedicalReport extends StatefulWidget {
}
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
Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of<ProjectViewModel>(context);
@ -94,9 +53,15 @@ class _AddVerifyMedicalReportState extends State<AddVerifyMedicalReport> {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
HtmlRichEditor(initialText: model
.medicalReportTemplate[0]
.templateTextHtml, height: MediaQuery.of(context).size.height * 0.75,),
if (model.medicalReportTemplate.length > 0)
HtmlRichEditor(
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,
fontWeight: FontWeight.w700,
onPressed: () async {
String txtOfMedicalReport = await HtmlEditor.getText();
String txtOfMedicalReport =
await HtmlEditor.getText();
if (txtOfMedicalReport.isNotEmpty) {
GifLoaderDialogUtils.showMyDialog(context);
model.insertMedicalReport(patient,txtOfMedicalReport
);
model.insertMedicalReport(
patient, txtOfMedicalReport);
GifLoaderDialogUtils.hideDialog(context);
if (model.state == ViewState.ErrorLocal) {
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 {
Map<Permission, PermissionStatus> statuses = await [
Permission.microphone,
].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 }

@ -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/screens/base/base_view.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/widgets/patients/profile/add-order/addNewOrder.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);
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(
baseViewModel: model,
isShowAppBar: true,
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
appBar: PatientProfileHeaderNewDesignAppBar(
patient,
patientType,
@ -80,10 +85,10 @@ class MedicalReportPage extends StatelessWidget {
},
label: TranslationBase.of(context).createNewMedicalReport,
),
if (model.state == ViewState.ErrorLocal)
Container(
child: ErrorMessage(error: model.error),
),
// if (model.state == ViewState.ErrorLocal)
// Container(
// child: ErrorMessage(error: model.error),
// ),
if (model.state != ViewState.ErrorLocal)
...List.generate(
model.medicalReportList.length,
@ -150,22 +155,26 @@ class MedicalReportPage extends StatelessWidget {
onTap: () {
if (model.medicalReportList[index].status ==
0) {
Navigator.of(context)
.pushNamed(PATIENT_MEDICAL_REPORT_INSERT, arguments: {
'patient': patient,
'patientType': patientType,
'arrivalType': arrivalType,
'type': MedicalReportStatus.ADD,
'medicalReport' : model.medicalReportList[index]
});
Navigator.of(context).pushNamed(
PATIENT_MEDICAL_REPORT_INSERT,
arguments: {
'patient': patient,
'patientType': patientType,
'arrivalType': arrivalType,
'type': MedicalReportStatus.ADD,
'medicalReport':
model.medicalReportList[index]
});
} else {
Navigator.of(context)
.pushNamed(PATIENT_MEDICAL_REPORT_DETAIL, arguments: {
'patient': patient,
'patientType': patientType,
'arrivalType': arrivalType,
'medicalReport' : model.medicalReportList[index]
});
Navigator.of(context).pushNamed(
PATIENT_MEDICAL_REPORT_DETAIL,
arguments: {
'patient': patient,
'patientType': patientType,
'arrivalType': arrivalType,
'medicalReport':
model.medicalReportList[index]
});
}
},
child: Icon(

@ -0,0 +1,189 @@
import 'package:doctor_app_flutter/client/base_app_client.dart';
import 'package:doctor_app_flutter/config/config.dart';
import 'package:doctor_app_flutter/core/model/procedure/procedure_templateModel.dart';
import 'package:doctor_app_flutter/core/model/procedure/procedure_template_details_model.dart';
import 'package:doctor_app_flutter/core/model/procedure/procedure_template_details_request_model.dart';
import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.dart';
import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart';
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
class ExpansionProcedure extends StatefulWidget {
final ProcedureTempleteModel procedureTempleteModel;
final ProcedureViewModel model;
final Function(ProcedureTempleteDetailsModel) removeFavProcedure;
final Function(ProcedureTempleteDetailsModel) addFavProcedure;
final Function(ProcedureTempleteDetailsModel) addProceduresRemarks;
final bool Function(ProcedureTempleteModel) isEntityListSelected;
final bool Function(ProcedureTempleteDetailsModel) isEntityFavListSelected;
const ExpansionProcedure(
{Key key,
this.procedureTempleteModel,
this.model,
this.removeFavProcedure,
this.addFavProcedure,
this.addProceduresRemarks,
this.isEntityListSelected,
this.isEntityFavListSelected})
: super(key: key);
@override
_ExpansionProcedureState createState() => _ExpansionProcedureState();
}
class _ExpansionProcedureState extends State<ExpansionProcedure> {
bool _isShowMore = false;
List<ProcedureTempleteDetailsModel> _templateDetailsList = List();
BaseAppClient baseAppClient = BaseAppClient();
@override
Widget build(BuildContext context) {
return Column(
children: [
InkWell(
onTap: () async {
if (!_isShowMore && _templateDetailsList.isEmpty) {
GifLoaderDialogUtils.showMyDialog(context);
await getProcedureTemplateDetails(widget.procedureTempleteModel.templateID);
GifLoaderDialogUtils.hideDialog(context);
}
setState(() {
_isShowMore = !_isShowMore;
});
},
child: Container(
padding: EdgeInsets.all(10.0),
margin: EdgeInsets.only(left: 5, right: 5),
decoration: BoxDecoration(
shape: BoxShape.rectangle,
color: Colors.white,
borderRadius: BorderRadius.all(
Radius.circular(5.0),
)),
child: Row(
children: <Widget>[
Expanded(
child: Row(
children: [
Icon(
Icons.folder,
size: 20,
color: Color(0xff575757),
),
Expanded(
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 10, vertical: 0),
child: AppText(
"Procedures for " +
widget.procedureTempleteModel.templateName,
fontSize: 16.0,
variant: "bodyText",
bold: true,
color: Color(0xff575757)),
),
),
],
)),
Container(
width: 25,
height: 25,
child: Icon(
_isShowMore
? Icons.keyboard_arrow_up
: Icons.keyboard_arrow_down,
color: Colors.grey[800],
size: 22,
),
)
],
),
),
),
if (_isShowMore)
AnimatedContainer(
padding: EdgeInsets.all(10.0),
margin: EdgeInsets.only(left: 5, right: 5),
decoration: BoxDecoration(
shape: BoxShape.rectangle,
color: Colors.white,
borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(5.0),
bottomRight: Radius.circular(5.0),
)),
duration: Duration(milliseconds: 7000),
child: Column(
children:
_templateDetailsList.map((itemProcedure) {
return Container(
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 12),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Padding(
padding:
const EdgeInsets.symmetric(horizontal: 11),
child: Checkbox(
value: widget
.isEntityFavListSelected(itemProcedure),
activeColor: Color(0xffD02127),
onChanged: (bool newValue) {
setState(() {
if (widget.isEntityFavListSelected(itemProcedure)) {
widget.removeFavProcedure(itemProcedure);
} else {
widget.addFavProcedure(itemProcedure);
}
});
}),
),
Expanded(
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 10, vertical: 0),
child: AppText(itemProcedure.procedureName,
fontSize: 14.0,
variant: "bodyText",
bold: true,
color: Color(0xff575757)),
),
),
],
),
],
),
),
);
}).toList(),
),
),
SizedBox(
height: 10,
),
],
);
}
getProcedureTemplateDetails(templateId)async {
ProcedureTempleteDetailsRequestModel _procedureTempleteDetailsRequestModel = ProcedureTempleteDetailsRequestModel(templateID: templateId, searchType: 1, patientID: 0);
_templateDetailsList.clear();
await baseAppClient.post(GET_PROCEDURE_TEMPLETE_DETAILS,
onSuccess: (dynamic response, int statusCode) {
response['HIS_ProcedureTemplateDetailsList'].forEach((template) {
setState(() {
_templateDetailsList.add(ProcedureTempleteDetailsModel.fromJson(template));
});
});
}, onFailure: (String error, int statusCode) {
DrAppToastMsg.showErrorToast(error);
}, body: _procedureTempleteDetailsRequestModel.toJson());
}
}

@ -20,15 +20,18 @@ class AddFavouriteProcedure extends StatefulWidget {
const AddFavouriteProcedure({Key key, this.model, this.patient})
: super(key: key);
@override
_AddFavouriteProcedureState createState() => _AddFavouriteProcedureState();
}
class _AddFavouriteProcedureState extends State<AddFavouriteProcedure> {
_AddFavouriteProcedureState({this.patient, this.model});
ProcedureViewModel model;
PatiantInformtion patient;
List<ProcedureTempleteDetailsModel> entityList = List();
@override
Widget build(BuildContext context) {
return BaseView<ProcedureViewModel>(
@ -49,12 +52,7 @@ class _AddFavouriteProcedureState extends State<AddFavouriteProcedure> {
Expanded(
child: NetworkBaseView(
baseViewModel: model,
child:
// selectedCategory != null
// ? selectedCategory['categoryId'] == 02 ||
// selectedCategory['categoryId'] == 03
// ?
EntityListCheckboxSearchFavProceduresWidget(
child: EntityListCheckboxSearchFavProceduresWidget(
model: widget.model,
masterList: widget.model.procedureTemplate,
removeFavProcedure: (item) {
@ -73,30 +71,7 @@ class _AddFavouriteProcedureState extends State<AddFavouriteProcedure> {
},
isEntityFavListSelected: (master) =>
isEntityListSelected(master),
)
// : ProcedureListWidget(
// model: widget.model,
// masterList: widget.model
// .categoriesList[0].entityList,
// removeHistory: (item) {
// setState(() {
// entityList.remove(item);
// });
// },
// addHistory: (history) {
// setState(() {
// entityList.add(history);
// });
// },
// addSelectedHistories: () {
// //TODO build your fun herr
// // widget.addSelectedHistories();
// },
// isEntityListSelected: (master) =>
// isEntityListSelected(master),
// )
// : null,
),
)),
),
Container(
margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5),
@ -108,8 +83,6 @@ class _AddFavouriteProcedureState extends State<AddFavouriteProcedure> {
color: Color(0xff359846),
fontWeight: FontWeight.w700,
onPressed: () {
//print(entityList.toString());
onPressed:
if (entityList.isEmpty == true) {
DrAppToastMsg.showErrorToast(
TranslationBase.of(context)
@ -119,12 +92,6 @@ class _AddFavouriteProcedureState extends State<AddFavouriteProcedure> {
}
Navigator.pop(context);
// postProcedure(
// orderType: selectedType.toString(),
// entityList: entityList,
// patient: patient,
// model: widget.model,
// remarks: remarksController.text);
},
),
],
@ -138,7 +105,7 @@ class _AddFavouriteProcedureState extends State<AddFavouriteProcedure> {
bool isEntityListSelected(ProcedureTempleteDetailsModel masterKey) {
Iterable<ProcedureTempleteDetailsModel> history = entityList
.where((element) => masterKey.templateID == element.templateID);
.where((element) => masterKey.templateID == element.templateID && masterKey.procedureName == element.procedureName);
if (history.length > 0) {
return true;
}

@ -11,6 +11,8 @@ import 'package:eva_icons_flutter/eva_icons_flutter.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'ExpansionProcedure.dart';
class EntityListCheckboxSearchFavProceduresWidget extends StatefulWidget {
final ProcedureViewModel model;
final Function addSelectedHistories;
@ -70,6 +72,7 @@ class _EntityListCheckboxSearchFavProceduresWidgetState
}
TextEditingController remarksController = TextEditingController();
@override
Widget build(BuildContext context) {
return Container(
@ -102,116 +105,14 @@ class _EntityListCheckboxSearchFavProceduresWidgetState
items.length != 0
? Column(
children: items.map((historyInfo) {
return Column(
children: [
ExpansionTile(
title: InkWell(
onTap: () {
widget.model
.getProcedureTemplateDetails(
templateId:
historyInfo.templateID);
},
child: Row(
children: [
Icon(
Icons.folder,
size: 20,
color: Color(0xff575757),
),
Expanded(
child: Padding(
padding:
const EdgeInsets.symmetric(
horizontal: 10,
vertical: 0),
child: AppText(
"Procedures for " +
historyInfo.templateName,
fontSize: 16.0,
variant: "bodyText",
bold: true,
color: Color(0xff575757)),
),
),
],
),
),
children: [
Column(
children: widget
.model.procedureTemplateDetails
.map((itemProcedure) {
return Container(
child: Padding(
padding: EdgeInsets.symmetric(
horizontal: 12),
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Row(
children: [
Padding(
padding:
const EdgeInsets
.symmetric(
horizontal: 11),
child: Checkbox(
value: widget
.isEntityFavListSelected(
itemProcedure),
activeColor: Color(
0xffD02127),
onChanged: (bool
newValue) {
setState(() {
if (widget
.isEntityFavListSelected(
itemProcedure)) {
widget.removeFavProcedure(
itemProcedure);
} else {
widget.addFavProcedure(
itemProcedure);
}
});
}),
),
Expanded(
child: Padding(
padding:
const EdgeInsets
.symmetric(
horizontal:
10,
vertical: 0),
child: AppText(
itemProcedure
.procedureName,
fontSize: 14.0,
variant:
"bodyText",
bold: true,
color: Color(
0xff575757)),
),
),
],
),
],
),
),
);
}).toList(),
),
SizedBox(
height: 2.0,
),
DividerWithSpacesAround(),
],
),
],
return ExpansionProcedure(
procedureTempleteModel: historyInfo,
model: widget.model,
removeFavProcedure: widget.removeFavProcedure,
addFavProcedure: widget.addFavProcedure,
addProceduresRemarks: widget.addProceduresRemarks,
isEntityListSelected: widget.isEntityListSelected,
isEntityFavListSelected: widget.isEntityFavListSelected,
);
}).toList(),
)

@ -0,0 +1,227 @@
import 'package:doctor_app_flutter/config/size_config.dart';
import 'package:doctor_app_flutter/core/model/procedure/categories_procedure.dart';
import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.dart';
import 'package:doctor_app_flutter/screens/base/base_view.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/shared/TextFields.dart';
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/divider_with_spaces_around.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
class ProcedureCheckOutScreen extends StatefulWidget {
@override
_ProcedureCheckOutScreenState createState() =>
_ProcedureCheckOutScreenState();
}
class _ProcedureCheckOutScreenState extends State<ProcedureCheckOutScreen> {
List<EntityList> items = List();
List<String> remarksList = List();
List<int> typeList = List();
int selectedType = 0;
setSelectedType(int val) {
setState(() {
selectedType = val;
});
}
@override
Widget build(BuildContext context) {
return BaseView<ProcedureViewModel>(
builder: (BuildContext context, ProcedureViewModel model, Widget child) =>
AppScaffold(
backgroundColor: Color(0xffF8F8F8).withOpacity(0.9),
isShowAppBar: false,
body: Column(
children: [
Container(
height: MediaQuery.of(context).size.height * 0.070,
color: Colors.white,
),
Container(
color: Colors.white,
child: Padding(
padding: const EdgeInsets.all(15.0),
child: Row(
//mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
InkWell(
child: Icon(
Icons.arrow_back_ios_sharp,
size: 24.0,
),
onTap: () {
Navigator.pop(context);
},
),
SizedBox(
width: 5.0,
),
AppText(
'Add Procedure',
fontWeight: FontWeight.w700,
fontSize: 20,
),
],
),
),
),
SizedBox(
height: MediaQuery.of(context).size.height * 0.022,
),
Padding(
padding: const EdgeInsets.all(8.0),
child: ListView.builder(
scrollDirection: Axis.vertical,
physics: AlwaysScrollableScrollPhysics(),
shrinkWrap: true,
itemCount: 1,
itemBuilder: (BuildContext context, int index) {
return Container(
decoration: BoxDecoration(
color: Colors.white,
borderRadius:
BorderRadius.all(Radius.circular(10.0))),
child: ExpansionTile(
initiallyExpanded: true,
title: Row(
children: [
Icon(
Icons.check_box,
color: Color(0xffD02127),
size: 30.5,
),
SizedBox(
width: 6.0,
),
AppText('Procedure Name'),
],
),
children: [
Container(
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 12),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Padding(
padding: const EdgeInsets.symmetric(
horizontal: 11),
child: AppText(
TranslationBase.of(context).orderType,
fontWeight: FontWeight.w700,
color: Color(0xff2B353E),
),
),
],
),
Row(
children: [
Radio(
activeColor: Color(0xFFD02127),
value: 0,
groupValue: selectedType,
onChanged: (value) {
// historyInfo.type =
// setSelectedType(value).toString();
//
// historyInfo.type = value.toString();
},
),
AppText(
'routine',
color: Color(0xff575757),
fontWeight: FontWeight.w600,
),
Radio(
activeColor: Color(0xFFD02127),
groupValue: selectedType,
value: 1,
onChanged: (value) {
// historyInfo.type =
// setSelectedType(value).toString();
//
// historyInfo.type = value.toString();
},
),
AppText(
TranslationBase.of(context).urgent,
color: Color(0xff575757),
fontWeight: FontWeight.w600,
),
],
),
],
),
),
),
SizedBox(
height: 2.0,
),
Padding(
padding: EdgeInsets.symmetric(
horizontal: 12, vertical: 15.0),
child: TextFields(
hintText: TranslationBase.of(context).remarks,
//controller: remarksController,
onChanged: (value) {
// historyInfo.remarks = value;
},
minLines: 3,
maxLines: 5,
borderWidth: 0.5,
borderColor: Colors.grey[500],
),
),
SizedBox(
height: 19.0,
),
//DividerWithSpacesAround(),
],
),
);
}),
),
],
),
bottomSheet: Container(
margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5),
child: Wrap(
alignment: WrapAlignment.center,
children: <Widget>[
AppButton(
title: TranslationBase.of(context).addSelectedProcedures,
color: Color(0xff359846),
fontWeight: FontWeight.w700,
onPressed: () {
//print(entityList.toString());
onPressed:
// if (entityList.isEmpty == true) {
// DrAppToastMsg.showErrorToast(
// TranslationBase.of(context)
// .fillTheMandatoryProcedureDetails,
// );
// return;
// }
Navigator.pop(context);
// postProcedure(
// orderType: selectedType.toString(),
// entityList: entityList,
// patient: patient,
// model: widget.model,
// remarks: remarksController.text);
},
),
],
),
),
),
);
}
}

@ -7,6 +7,7 @@ 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/procedures/add-procedure-form.dart';
import 'package:doctor_app_flutter/screens/procedures/add_procedure_homeScreen.dart';
import 'package:doctor_app_flutter/screens/procedures/procedure_checkout_screen.dart';
import 'package:doctor_app_flutter/screens/procedures/update-procedure.dart';
import 'package:doctor_app_flutter/util/helpers.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
@ -102,13 +103,18 @@ class ProcedureScreen extends StatelessWidget {
patient.patientStatusType == 43)
InkWell(
onTap: () {
// Navigator.push(
// context,
// MaterialPageRoute(
// builder: (context) => AddProcedureHome(
// patient: patient,
// model: model,
// )),
// );
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => AddProcedureHome(
patient: patient,
model: model,
)),
builder: (context) => ProcedureCheckOutScreen()),
);
},
child: Container(

@ -587,7 +587,7 @@ packages:
name: js
url: "https://pub.dartlang.org"
source: hosted
version: "0.6.3-nullsafety.1"
version: "0.6.2"
json_annotation:
dependency: transitive
description:
@ -629,7 +629,7 @@ packages:
name: meta
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0-nullsafety.4"
version: "1.3.0-nullsafety.3"
mime:
dependency: transitive
description:
@ -921,7 +921,7 @@ packages:
name: stack_trace
url: "https://pub.dartlang.org"
source: hosted
version: "1.10.0-nullsafety.2"
version: "1.10.0-nullsafety.1"
sticky_headers:
dependency: "direct main"
description:
@ -1119,5 +1119,5 @@ packages:
source: hosted
version: "2.2.1"
sdks:
dart: ">=2.10.0 <=2.11.0-213.1.beta"
dart: ">=2.10.0 <2.11.0"
flutter: ">=1.22.0 <2.0.0"

Loading…
Cancel
Save