Merge branch 'monthly_reports' into 'master'

Monthly reports

See merge request Cloud_Solution/diplomatic-quarter!41
merge-update-with-lab-changes
Mohammad Aljammal 5 years ago
commit 4b0365480c

@ -148,6 +148,10 @@ const CANCEL_LIVECARE_REQUEST =
const SEND_LIVECARE_INVOICE_EMAIL =
'Services/Notifications.svc/REST/SendInvoiceForLiveCare';
const GET_USER_TERMS ='/Services/Patients.svc/REST/GetUserTermsAndConditions';
const UPDATE_HEALTH_TERMS ='/services/Patients.svc/REST/UpdatePateintHealthSummaryReport';
//URL to get medicine and pharmacies list
const CHANNEL = 3;
const GENERAL_ID = 'Cs2020@2016\$2958';

@ -451,4 +451,12 @@ const Map<String, Map<String, String>> localizedValues = {
"MonthlyReports": {"en": "Monthly Reports", "ar": "تقارير شهرية"},
"locationDialogMessage": {"en": "Allow the HMG app to access your location will assist you in showing the hospitals according to the nearest to you.", "ar": "السماح لتطبيق مجموعة الحبيب الطبية بالوصول إلى موقعك سيساعدك في إظهار المستشفيات وفقًا للأقرب إليك."},
"km":{"en":"KMs:","ar":"كم"},
"PatientHealthSummaryReport":{"en":"Patient Health Summary Report","ar":" ملخص التقارير الشهرية"},
"ToViewTheTermsAndConditions":{"en":"To View The Terms And Conditions Report","ar":" عرض الشروط والأحكام "},
"ClickHere":{"en":"Click here","ar":"أنقر هنا"},
"IAgreeToTheTermsAndConditions":{"en":"I agree to the terms and conditions ","ar":"أوافق على الشروط والاحكام "},
"IAgreeToTheTermsAndConditionsSubtitle":{"en":"I agree to the terms and conditions ","ar":"هذا ملخص التقرير الصحي الشهري و الذي يسرد المؤشرات الصحية و نتائج التحاليل لأخر الزيارات. يرجى ملاحظة أن هذا التقرير هو تقرير يتم ارساله بشكل آلي من النظام و لا يعتبر رسمي و لا تؤخذ عليه أي قرارات طبية"},
"Save":{"en":"Save","ar":"حفظ "},
"UserAgreement":{"en":"User Agreement","ar":"اتفاقية الخصوصية "},
"UpdateSuccessfully":{"en":"Update Successfully","ar":"تم التحديث بنجاح"},
};

@ -7,7 +7,7 @@ import 'package:diplomaticquarterapp/pages/feedback/appointment_history.dart';
class ReportsService extends BaseService {
List<Reports> reportsList = List();
List<AppointmentHistory> appointHistoryList = List();
String userAgreementContent = "";
RequestReports _requestReports = RequestReports(
isReport: true,
encounterType: 1,
@ -44,7 +44,7 @@ class ReportsService extends BaseService {
hasError = false;
Map<String, dynamic> body = new Map<String, dynamic>();
body['IsForMedicalReport'] = true;
await baseAppClient.post(GET_PATIENT_AppointmentHistory,
await baseAppClient.post(GET_PATIENT_AppointmentHistory,
onSuccess: (dynamic response, int statusCode) {
appointHistoryList = [];
response['AppoimentAllHistoryResultList'].forEach((appoint) {
@ -56,6 +56,33 @@ class ReportsService extends BaseService {
}, body: body);
}
Future getUserTermsAndConditions() async {
hasError = false;
await baseAppClient.post(GET_USER_TERMS,
onSuccess: (dynamic response, int statusCode) {
userAgreementContent = response['UserAgreementContent'];
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, body: Map<String, dynamic>());
}
Future updatePatientHealthSummaryReport({bool isSummary}) async {
Map<String, dynamic> body = Map<String, dynamic>();
body['RSummaryReport'] = isSummary;
hasError = false;
await baseAppClient.post(UPDATE_HEALTH_TERMS,
onSuccess: (dynamic response, int statusCode) {
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, body: body);
}
Future insertRequestForMedicalReport(
AppointmentHistory appointmentHistory) async {
Map<String, dynamic> body = new Map<String, dynamic>();
@ -63,7 +90,7 @@ class ReportsService extends BaseService {
body['DoctorID'] = appointmentHistory.doctorID;
body['SetupID'] = appointmentHistory.setupID;
body['EncounterNo'] = appointmentHistory.appointmentNo;
body['EncounterType'] = 1;// appointmentHistory.appointmentType;
body['EncounterType'] = 1; // appointmentHistory.appointmentType;
body['IsActive'] = appointmentHistory.isActiveDoctor;
body['ProjectID'] = appointmentHistory.projectID;
body['Remarks'] = "";
@ -73,7 +100,7 @@ class ReportsService extends BaseService {
body['Status'] = 1;
body['CreatedBy'] = 102;
hasError = false;
await baseAppClient.post(INSERT_REQUEST_FOR_MEDICAL_REPORT,
await baseAppClient.post(INSERT_REQUEST_FOR_MEDICAL_REPORT,
onSuccess: (dynamic response, int statusCode) {},
onFailure: (String error, int statusCode) {
hasError = true;

@ -13,72 +13,34 @@ class ReportsMonthlyViewModel extends BaseViewModel {
ReportsService _reportsService = locator<ReportsService>();
List<Reports> reportsOrderRequestList = List();
List<Reports> reportsOrderReadyList = List();
List<Reports> reportsOrderCompletedList = List();
List<Reports> reportsOrderCanceledList = List();
List<AppointmentHistory> get appointHistoryList =>
_reportsService.appointHistoryList;
getReports() async {
String get userAgreementContent => _reportsService.userAgreementContent;
getUserTermsAndConditions() async{
setState(ViewState.Busy);
reportsOrderRequestList.clear();
reportsOrderReadyList.clear();
reportsOrderCompletedList.clear();
reportsOrderCanceledList.clear();
await _reportsService.getReports();
await _reportsService.getUserTermsAndConditions();
if (_reportsService.hasError) {
error = _reportsService.error;
setState(ViewState.Error);
} else {
_filterList();
setState(ViewState.Idle);
}
}
getPatentAppointmentHistory() async {
setState(ViewState.Busy);
await _reportsService.getPatentAppointmentHistory();
updatePatientHealthSummaryReport({String message, bool isSummary})async{
setState(ViewState.BusyLocal);
await _reportsService.updatePatientHealthSummaryReport(isSummary: isSummary);
if (_reportsService.hasError) {
error = _reportsService.error;
setState(ViewState.Error);
AppToast.showErrorToast(message: error);
setState(ViewState.ErrorLocal);
} else {
AppToast.showSuccessToast(message: message);
setState(ViewState.Idle);
}
}
void _filterList() {
_reportsService.reportsList.forEach((report) {
switch (report.status) {
case 1:
reportsOrderRequestList.add(report);
break;
case 2:
reportsOrderReadyList.add(report);
break;
case 3:
reportsOrderCompletedList.add(report);
break;
case 4:
reportsOrderCanceledList.add(report);
break;
default:
}
});
}
insertRequestForMedicalReport(AppointmentHistory appointmentHistory)async{
setState(ViewState.Busy);
await _reportsService.insertRequestForMedicalReport(appointmentHistory);
if (_reportsService.hasError) {
error = _reportsService.error;
AppToast.showErrorToast(message: error);
setState(ViewState.ErrorLocal);
} else {
AppToast.showSuccessToast(message: 'The order was send ');
setState(ViewState.Idle);
}
}
}

@ -66,7 +66,7 @@ class MyApp extends StatelessWidget {
hintColor: Colors.grey[400],
disabledColor: Colors.grey[300],
errorColor: Color.fromRGBO(235, 80, 60, 1.0),
scaffoldBackgroundColor:Hexcolor('#E0E0E0'),// Colors.grey[100],
scaffoldBackgroundColor:Hexcolor('#E9E9E9'),// Colors.grey[100],
textSelectionColor: Color.fromRGBO(80, 100, 253, 0.5),
textSelectionHandleColor: Color.fromRGBO(80, 100, 253, 1.0),
canvasColor: Colors.white,

@ -5,6 +5,7 @@ import 'package:diplomaticquarterapp/core/viewModels/medical/medical_view_model.
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/pages/MyAppointments/MyAppointments.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/pages/medical/reports/monthly_reports.dart';
import 'package:diplomaticquarterapp/pages/vaccine/my_vaccines_screen.dart';
import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescriptions_home_page.dart';
import 'package:diplomaticquarterapp/pages/medical/radiology/radiology_home_page.dart';
@ -329,11 +330,17 @@ class _MedicalProfilePageState extends State<MedicalProfilePage> {
),
Expanded(
flex: 1,
child: MedicalProfileItem(
title: TranslationBase.of(context).monthly,
imagePath: 'medical_history_icon.png',
subTitle: TranslationBase.of(context)
.monthlySubtitle,
child: InkWell(
onTap: (){
Navigator.push(context,
FadePage(page: MonthlyReportsPage()));
},
child: MedicalProfileItem(
title: TranslationBase.of(context).monthly,
imagePath: 'medical_history_icon.png',
subTitle: TranslationBase.of(context)
.monthlySubtitle,
),
),
),
]),

@ -1,17 +1,166 @@
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/core/viewModels/medical/reports_monthly_view_model.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/pages/medical/reports/user_agreement_page.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/input/custom_switch.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
class MonthlyReportsPage extends StatefulWidget {
@override
_MonthlyReportsPageState createState() => _MonthlyReportsPageState();
}
class _MonthlyReportsPageState extends State<MonthlyReportsPage> {
bool isAgree = false;
bool isSummary = false;
class MonthlyReportsPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return BaseView<ReportsMonthlyViewModel>(
builder: (_, model, w) => AppScaffold(
isShowAppBar: true,
appBarTitle: TranslationBase.of(context).monthlyReports,
body: Container(),
body: SingleChildScrollView(
child: Container(
padding: EdgeInsets.all(12),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
padding: EdgeInsets.all(9),
height: 55,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(Radius.circular(8)),
shape: BoxShape.rectangle,
border: Border.all(color: Colors.grey)),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Texts(
TranslationBase.of(context).patientHealthSummaryReport,
bold: true,
),
CustomSwitch(
value: isSummary,
activeColor: Colors.red,
inactiveColor: Colors.grey,
onChanged: () async {
setState(() {
isSummary = !isSummary;
});
},
)
],
),
),
SizedBox(
height: 15,
),
Container(
margin: EdgeInsets.all(8),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Texts(
model.user.emailAddress,
bold: true,
),
],
),
),
Divider(
height: 10.4,
thickness: 1.0,
),
SizedBox(
height: 15,
),
Container(
margin: EdgeInsets.all(8),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Expanded(
child: Texts(TranslationBase.of(context)
.toViewTheTermsAndConditions),
),
InkWell(
onTap: () {
Navigator.push(
context,
FadePage(
page: UserAgreementContent(),
),
);
},
child: Texts(
TranslationBase.of(context).clickHere,
color: Colors.blue,
),
)
],
),
),
SizedBox(
height: 5,
),
Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.start,
children: [
Checkbox(
value: isAgree,
onChanged: (value) {
setState(() {
isAgree = !isAgree;
});
},
activeColor: Colors.red,
),
Texts(TranslationBase.of(context)
.iAgreeToTheTermsAndConditions),
],
),
Container(
margin: EdgeInsets.all(8),
width: double.infinity,
child: SecondaryButton(
textColor: Colors.white,
label: TranslationBase.of(context).save,
disabled: !isAgree,
loading: model.state == ViewState.BusyLocal,
onTap: () {
model.updatePatientHealthSummaryReport(
message: TranslationBase.of(context)
.updateSuccessfully,
isSummary: isSummary);
},
),
),
Padding(
padding: const EdgeInsets.all(5.0),
child: Texts(
TranslationBase.of(context)
.iAgreeToTheTermsAndConditionsSubtitle,
fontWeight: FontWeight.normal,
),
),
SizedBox(
height: 12,
),
Center(child: Image.asset('assets/images/report.jpg'))
],
),
),
),
),
);
}

@ -0,0 +1,25 @@
import 'package:diplomaticquarterapp/core/viewModels/medical/reports_monthly_view_model.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter_html/flutter_html.dart';
class UserAgreementContent extends StatelessWidget {
@override
Widget build(BuildContext context) {
return BaseView<ReportsMonthlyViewModel>(
onModelReady: (model) => model.getUserTermsAndConditions(),
builder: (_, model, w) => AppScaffold(
isShowAppBar: true,
baseViewModel: model,
appBarTitle: TranslationBase.of(context).userAgreement,
body: SingleChildScrollView(
child: Html(
data: model.userAgreementContent,
),
),
),
);
}
}

@ -512,8 +512,15 @@ class TranslationBase {
String get locationDialogMessage =>
localizedValues['locationDialogMessage'][locale.languageCode];
String get km =>
localizedValues['km'][locale.languageCode];
String get km => localizedValues['km'][locale.languageCode];
String get patientHealthSummaryReport => localizedValues['PatientHealthSummaryReport'][locale.languageCode];
String get toViewTheTermsAndConditions => localizedValues['ToViewTheTermsAndConditions'][locale.languageCode];
String get clickHere => localizedValues['ClickHere'][locale.languageCode];
String get iAgreeToTheTermsAndConditions => localizedValues['IAgreeToTheTermsAndConditions'][locale.languageCode];
String get iAgreeToTheTermsAndConditionsSubtitle => localizedValues['IAgreeToTheTermsAndConditionsSubtitle'][locale.languageCode];
String get save => localizedValues['Save'][locale.languageCode];
String get userAgreement => localizedValues['UserAgreement'][locale.languageCode];
String get updateSuccessfully => localizedValues['UpdateSuccessfully'][locale.languageCode];
}
class TranslationBaseDelegate extends LocalizationsDelegate<TranslationBase> {

@ -171,7 +171,7 @@ class _SecondaryButtonState extends State<SecondaryButton>
width: MediaQuery.of(context).size.width,
height: 100,
decoration: BoxDecoration(
color: Theme.of(context).disabledColor,
color: Theme.of(context).primaryColor,
),
),
),

@ -34,7 +34,7 @@ class _CustomSwitchState extends State<CustomSwitch>
void initState() {
super.initState();
_animationController =
AnimationController(vsync: this, duration: Duration(milliseconds: 800));
AnimationController(vsync: this, duration: Duration(milliseconds: 500));
_circleAnimation = Tween(begin: 0.0, end: 30.0).animate(CurvedAnimation(
parent: _animationController,
curve: Curves.easeOutQuint,

@ -32,6 +32,9 @@ dependencies:
permission_handler: ^5.0.0+hotfix.3
device_info: ^0.4.2+4
# Flutter Html View
flutter_html: ^1.0.2
# Native
flutter_device_type: ^0.2.0
local_auth: ^0.6.2+3
@ -77,7 +80,7 @@ dependencies:
table_calendar: ^2.2.3
# SVG Images
flutter_svg: ^0.17.4
flutter_svg: ^0.18.0
# Location Helper
map_launcher: ^0.8.1

Loading…
Cancel
Save