Merge branch 'feature-ucaf' into 'development'

Feature ucaf

See merge request Cloud_Solution/doctor_app_flutter!261
merge-requests/262/merge
Mohammad Aljammal 4 years ago
commit 601b1d12cb

@ -629,4 +629,6 @@ const Map<String, Map<String, String>> localizedValues = {
'editedBy': {'en': "Edited By :", 'ar':"عدلت : " },
'currentMedications': {'en': "Current Medications", 'ar':"الأدوية الحالية" },
'noItem': {'en': "No items exists in this list", 'ar':"لا توجد عناصر في هذه القائمة" },
'postUcafSuccessMsg': {'en': "UCAF request send successfully", 'ar':"تم ارسال طلب UCAF بنجاح" },
'vitalSignDetailEmpty': {'en': "There is no data for this vital sign", 'ar':"لا توجد بيانات لهذه العلامة الحيوية" },
};

@ -41,8 +41,8 @@ class UcafService extends LookupService {
hasError = false;
Map<String, dynamic> body = Map();
body['PatientMRN'] = patient.patientMRN;
body['AppointmentNo'] = patient.appointmentNo;
body['EpisodeID'] = patient.episodeNo;
// body['AppointmentNo'] = patient.appointmentNo;
// body['EpisodeID'] = patient.episodeNo;
await baseAppClient.post(
GET_PATIENT_VITAL_SIGN_DATA,
@ -101,4 +101,19 @@ class UcafService extends LookupService {
}, body: body);
}
Future postUCAF(PatiantInformtion patient) async {
hasError = false;
Map<String, dynamic> body = Map();
body['PatientMRN'] = patient.patientMRN;
body['AppointmentNo'] = patient.appointmentNo;
await baseAppClient.post (POST_UCAF,
onSuccess: (dynamic response, int statusCode) {
print("Success");
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, body: body);
}
}

@ -115,4 +115,15 @@ class UcafViewModel extends BaseViewModel {
return null;
}
}
Future postUCAF(PatiantInformtion patient) async {
setState(ViewState.Busy);
await _ucafService.postUCAF(patient);
if (_ucafService.hasError) {
error = _ucafService.error;
setState(ViewState.ErrorLocal);
} else {
setState(ViewState.Idle); // but with empty list
}
}
}

@ -1,11 +1,13 @@
import 'package:doctor_app_flutter/config/size_config.dart';
import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart';
import 'package:doctor_app_flutter/core/enum/viewstate.dart';
import 'package:doctor_app_flutter/core/viewModel/patient-ucaf-viewmodel.dart';
import 'package:doctor_app_flutter/models/SOAP/GetAssessmentResModel.dart';
import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart';
import 'package:doctor_app_flutter/models/SOAP/order-procedure.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/dr_app_toast_msg.dart';
import 'package:doctor_app_flutter/util/helpers.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/patients/profile/PatientHeaderWidgetNoAvatar.dart';
@ -82,7 +84,17 @@ class _UcafDetailScreenState extends State<UcafDetailScreen> {
backgroundColor: HexColor("#B8382B"),
textColor: Colors.white,
fontSize: SizeConfig.textMultiplier * 2.0,
handler: () {},
handler: () async {
await model.postUCAF(patient);
if(model.state == ViewState.Idle){
DrAppToastMsg.showSuccesToast(TranslationBase.of(context).postUcafSuccessMsg);
Navigator.of(context).popUntil((route){
return route.settings.name == PATIENTS_PROFILE;
});
} else {
DrAppToastMsg.showErrorToast(model.error);
}
},
),
),
Container(

@ -2,8 +2,10 @@ import 'package:doctor_app_flutter/models/patient/vital_sign/patient-vital-sign-
import 'package:doctor_app_flutter/models/patient/vital_sign/patient-vital-sign-history.dart';
import 'package:doctor_app_flutter/screens/patients/profile/vital_sign/vital_sign_details_wideget.dart';
import 'package:doctor_app_flutter/util/date-utils.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/charts/app_time_series_chart.dart';
import 'package:doctor_app_flutter/widgets/shared/app_expandable_notifier.dart';
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
import 'package:flutter/material.dart';
import 'package:charts_flutter/flutter.dart' as charts;
@ -29,8 +31,8 @@ class VitalSingChartAndDetials extends StatelessWidget {
@override
Widget build(BuildContext context) {
generateData();
return Column(
generateData();
return timeSeriesData.length != 0 ? Column(
children: <Widget>[
AppExpandableNotifier(
// isExpand: true,
@ -43,6 +45,12 @@ class VitalSingChartAndDetials extends StatelessWidget {
),
),
],
) : Container(
width: double.infinity,
height: MediaQuery.of(context).size.height,
child: Center(
child: AppText(TranslationBase.of(context).vitalSignDetailEmpty),
),
);
}
@ -50,14 +58,14 @@ class VitalSingChartAndDetials extends StatelessWidget {
if (vitalList.length > 0) {
vitalList.reversed.toList().forEach(
(element) {
DateTime elementDate = DateUtils.getDateTimeFromServerFormat(element.createdOn);
if( element.toJson()[viewKey]!=null && element.toJson()[viewKey]?.toInt()!=0)
timeSeriesData.add(
TimeSeriesSales2(
new DateTime(elementDate.year, elementDate.month, elementDate.day),
element.toJson()[viewKey].toDouble(),
),
);
DateTime elementDate = DateUtils.getDateTimeFromServerFormat(element.createdOn);
if(element.toJson()[viewKey]!=null && element.toJson()[viewKey]?.toInt()!=0)
timeSeriesData.add(
TimeSeriesSales2(
new DateTime(elementDate.year, elementDate.month, elementDate.day),
element.toJson()[viewKey].toDouble(),
),
);
},
);
}

@ -60,7 +60,7 @@ class DateUtils {
var difference = now.difference(firstDate);
int minutesInDays = difference.inMinutes;
int hoursInDays = minutesInDays ~/ 60;
int hoursInDays = minutesInDays ~/ 60; // ~/ : truncating division to make the result int
int minutes = minutesInDays % 60;
int days = hoursInDays ~/ 24;
int hours = hoursInDays % 24;

@ -1021,6 +1021,10 @@ class TranslationBase {
localizedValues['currentMedications'][locale.languageCode];
String get noItem =>
localizedValues['noItem'][locale.languageCode];
String get postUcafSuccessMsg =>
localizedValues['postUcafSuccessMsg'][locale.languageCode];
String get vitalSignDetailEmpty =>
localizedValues['vitalSignDetailEmpty'][locale.languageCode];
}
class TranslationBaseDelegate extends LocalizationsDelegate<TranslationBase> {

@ -48,7 +48,7 @@ class PatientHeaderWidgetNoAvatar extends StatelessWidget {
fontSize: SizeConfig.textMultiplier * 2.0,
),
AppText(
"${patient.companyName}",
"${patient.companyName != null ? patient.companyName : ""}",
fontWeight: FontWeight.bold,
fontSize: SizeConfig.textMultiplier * 2.0,
),

@ -70,7 +70,7 @@ class ProfileMedicalInfoWidget extends StatelessWidget {
nameLine2: TranslationBase.of(context).episode,
route: UPDATE_EPISODE,
icon: 'modilfy-episode.png'),
if (int.parse(patientType) == 7)
if (int.parse(patientType) == 7 || int.parse(patientType) == 6)
PatientProfileButton(
key: key,
patient: patient,
@ -106,7 +106,7 @@ class ProfileMedicalInfoWidget extends StatelessWidget {
nameLine1: TranslationBase.of(context).progress,
nameLine2: TranslationBase.of(context).note,
icon: 'heartbeat.png'),
if (selectedPatientType == 7|| int.parse(patientType) == 6)
if (int.parse(patientType) == 7 || int.parse(patientType) == 6)
PatientProfileButton(
key: key,
patient: patient,
@ -128,7 +128,7 @@ class ProfileMedicalInfoWidget extends StatelessWidget {
nameLine1: TranslationBase.of(context).orders,
nameLine2: TranslationBase.of(context).procedures,
icon: 'lab.png'),
if (selectedPatientType == 7|| int.parse(patientType) == 6)
if (int.parse(patientType) == 7 || int.parse(patientType) == 6)
PatientProfileButton(
key: key,
patient: patient,
@ -152,7 +152,7 @@ class ProfileMedicalInfoWidget extends StatelessWidget {
nameLine1: TranslationBase.of(context).patientSick,
nameLine2: TranslationBase.of(context).leave,
icon: 'sick_leaves_icons.png'),
if (selectedPatientType == 7|| int.parse(patientType) == 6)
if (int.parse(patientType) == 7 || int.parse(patientType) == 6)
PatientProfileButton(
key: key,
patient: patient,

Loading…
Cancel
Save