Merge branch 'development' of https://gitlab.com/Cloud_Solution/doctor_app_flutter into fix_issues

 Conflicts:
	lib/config/localized_values.dart
	lib/util/translations_delegate_base.dart
merge-requests/265/head
Elham Rababah 5 years ago
commit 537f53c3de

@ -629,6 +629,8 @@ const Map<String, Map<String, String>> localizedValues = {
'editedBy': {'en': "Edited By :", 'ar':"عدلت : " }, 'editedBy': {'en': "Edited By :", 'ar':"عدلت : " },
'currentMedications': {'en': "Current Medications", 'ar':"الأدوية الحالية" }, 'currentMedications': {'en': "Current Medications", 'ar':"الأدوية الحالية" },
'noItem': {'en': "No items exists in this list", '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':"لا توجد بيانات لهذه العلامة الحيوية" },
'assessmentErrorMsg': {'en': "You have to add at least one assessment.", 'ar':"يجب عليك إضافة تقييم واحد على الأقل." }, 'assessmentErrorMsg': {'en': "You have to add at least one assessment.", 'ar':"يجب عليك إضافة تقييم واحد على الأقل." },
'examinationErrorMsg': {'en': "You have to add at least one examination.", 'ar':"يجب عليك إضافة الفحص واحد على الأقل." }, 'examinationErrorMsg': {'en': "You have to add at least one examination.", 'ar':"يجب عليك إضافة الفحص واحد على الأقل." },
'progressNoteErrorMsg': {'en': "You have to add progress Note.", 'ar':"يجب عليك إضافة ملاحظة التقدم." }, 'progressNoteErrorMsg': {'en': "You have to add progress Note.", 'ar':"يجب عليك إضافة ملاحظة التقدم." },

@ -41,8 +41,8 @@ class UcafService extends LookupService {
hasError = false; hasError = false;
Map<String, dynamic> body = Map(); Map<String, dynamic> body = Map();
body['PatientMRN'] = patient.patientMRN; body['PatientMRN'] = patient.patientMRN;
body['AppointmentNo'] = patient.appointmentNo; // body['AppointmentNo'] = patient.appointmentNo;
body['EpisodeID'] = patient.episodeNo; // body['EpisodeID'] = patient.episodeNo;
await baseAppClient.post( await baseAppClient.post(
GET_PATIENT_VITAL_SIGN_DATA, GET_PATIENT_VITAL_SIGN_DATA,
@ -101,4 +101,19 @@ class UcafService extends LookupService {
}, body: body); }, 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);
}
} }

@ -78,7 +78,7 @@ class ProcedureService extends BaseService {
patientMRN: 0, patientMRN: 0,
pageIndex: 1, pageIndex: 1,
clinicId: 0, clinicId: 0,
pageSize: 100, pageSize: 300,
); );
hasError = false; hasError = false;
_categoriesList.clear(); _categoriesList.clear();

@ -115,4 +115,15 @@ class UcafViewModel extends BaseViewModel {
return null; 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
}
}
} }

@ -632,17 +632,21 @@ class _MedicalFileDetailsState extends State<MedicalFileDetails> {
fontWeight: fontWeight:
FontWeight.w700, FontWeight.w700,
), ),
// AppText( Expanded(
// model child: AppText(
// .medicalFileList[0] model
// .entityList[0] .medicalFileList[
// .timelines[0] 0]
// .timeLineEvents[0] .entityList[0]
// .consulations[0] .timelines[0]
// .lstProcedure[index] .timeLineEvents[0]
// .orderDate .consulations[0]
// .trim(), .lstProcedure[
// ), index]
.orderDate
.trim(),
),
),
], ],
), ),
Row( Row(

@ -1,11 +1,13 @@
import 'package:doctor_app_flutter/config/size_config.dart'; 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/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/core/viewModel/patient-ucaf-viewmodel.dart';
import 'package:doctor_app_flutter/models/SOAP/GetAssessmentResModel.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/master_key_model.dart';
import 'package:doctor_app_flutter/models/SOAP/order-procedure.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/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/dr_app_toast_msg.dart';
import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/helpers.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/PatientHeaderWidgetNoAvatar.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/PatientHeaderWidgetNoAvatar.dart';
@ -82,7 +84,17 @@ class _UcafDetailScreenState extends State<UcafDetailScreen> {
backgroundColor: HexColor("#B8382B"), backgroundColor: HexColor("#B8382B"),
textColor: Colors.white, textColor: Colors.white,
fontSize: SizeConfig.textMultiplier * 2.0, 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( Container(

@ -40,7 +40,8 @@ class MyReferralDetailScreen extends StatelessWidget {
builder: (_, model, w) => AppScaffold( builder: (_, model, w) => AppScaffold(
baseViewModel: model, baseViewModel: model,
appBarTitle: TranslationBase.of(context).referPatient, appBarTitle: TranslationBase.of(context).referPatient,
body: model.patientArrivalList != null ? Column( body: model.patientArrivalList != null
? Column(
children: [ children: [
Expanded( Expanded(
child: SingleChildScrollView( child: SingleChildScrollView(
@ -52,7 +53,8 @@ class MyReferralDetailScreen extends StatelessWidget {
AppText( AppText(
authProvider.selectedClinicName != null authProvider.selectedClinicName != null
? authProvider.selectedClinicName ? authProvider.selectedClinicName
: authProvider.doctorProfile.clinicDescription, : authProvider
.doctorProfile.clinicDescription,
fontSize: SizeConfig.textMultiplier * 1.7, fontSize: SizeConfig.textMultiplier * 1.7,
color: Colors.white, color: Colors.white,
textAlign: TextAlign.center, textAlign: TextAlign.center,
@ -63,7 +65,8 @@ class MyReferralDetailScreen extends StatelessWidget {
height: 16, height: 16,
), ),
Padding( Padding(
padding: const EdgeInsets.symmetric(horizontal: 16.0), padding:
const EdgeInsets.symmetric(horizontal: 16.0),
child: AppText( child: AppText(
TranslationBase.of(context).myReferralPatient, TranslationBase.of(context).myReferralPatient,
color: Colors.black, color: Colors.black,
@ -87,34 +90,39 @@ class MyReferralDetailScreen extends StatelessWidget {
childAspectRatio: 1.8, childAspectRatio: 1.8,
crossAxisSpacing: 8, crossAxisSpacing: 8,
mainAxisSpacing: 10, mainAxisSpacing: 10,
controller: controller: new ScrollController(
new ScrollController(keepScrollOffset: false), keepScrollOffset: false),
shrinkWrap: true, shrinkWrap: true,
padding: const EdgeInsets.all(4.0), padding: const EdgeInsets.all(4.0),
crossAxisCount: 2, crossAxisCount: 2,
children: [ children: [
PatientProfileButton( PatientProfileButton(
key: key, key: key,
// patient: patient, patient: model.patientArrivalList[0],
// route: RADIOLOGY, route: MEDICAL_FILE,
nameLine1: nameLine1: TranslationBase.of(context)
TranslationBase.of(context).previewHealth, .previewHealth,
nameLine2: nameLine2: TranslationBase.of(context)
TranslationBase.of(context).summaryReport, .summaryReport,
icon: 'radiology-1.png'), icon: 'radiology-1.png'),
PatientProfileButton( PatientProfileButton(
key: key, key: key,
// patient: patient, patient: model.patientArrivalList[0],
// route: LAB_ORDERS, route: LAB_ORDERS,
nameLine1: TranslationBase.of(context).lab, nameLine1:
nameLine2: TranslationBase.of(context).result, TranslationBase.of(context).lab,
nameLine2:
TranslationBase.of(context).result,
icon: 'lab.png'), icon: 'lab.png'),
PatientProfileButton( PatientProfileButton(
key: key, key: key,
patient: model.patientArrivalList[0], patient: model.patientArrivalList[0],
route: VITAL_SIGN_DETAILS /*PATIENT_VITAL_SIGN*/, route:
nameLine1: TranslationBase.of(context).vital, VITAL_SIGN_DETAILS /*PATIENT_VITAL_SIGN*/,
nameLine2: TranslationBase.of(context).signs, nameLine1:
TranslationBase.of(context).vital,
nameLine2:
TranslationBase.of(context).signs,
icon: 'heartbeat.png'), icon: 'heartbeat.png'),
], ],
), ),
@ -161,7 +169,8 @@ class MyReferralDetailScreen extends StatelessWidget {
), ),
), ),
], ],
) : Container( )
: Container(
child: Center( child: Center(
child: AppText( child: AppText(
TranslationBase.of(context).patientNoDetailErrMsg, TranslationBase.of(context).patientNoDetailErrMsg,

@ -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/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/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/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/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_expandable_notifier.dart';
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:charts_flutter/flutter.dart' as charts; import 'package:charts_flutter/flutter.dart' as charts;
@ -30,7 +32,7 @@ class VitalSingChartAndDetials extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
generateData(); generateData();
return Column( return timeSeriesData.length != 0 ? Column(
children: <Widget>[ children: <Widget>[
AppExpandableNotifier( AppExpandableNotifier(
// isExpand: true, // 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),
),
); );
} }

@ -48,6 +48,7 @@ postProcedure(
String instruction, String instruction,
PrescriptionViewModel model, PrescriptionViewModel model,
DateTime doseTime, DateTime doseTime,
String doseUnit,
PatiantInformtion patient}) async { PatiantInformtion patient}) async {
PostPrescriptionReqModel postProcedureReqModel = PostPrescriptionReqModel postProcedureReqModel =
new PostPrescriptionReqModel(); new PostPrescriptionReqModel();
@ -60,9 +61,9 @@ postProcedure(
sss.add(PrescriptionRequestModel( sss.add(PrescriptionRequestModel(
covered: true, covered: true,
dose: 1, dose: int.parse(dose),
itemId: drugId.isEmpty ? 1 : int.parse(drugId), itemId: drugId.isEmpty ? 1 : int.parse(drugId),
doseUnitId: 1, doseUnitId: int.parse(doseUnit),
route: route.isEmpty ? 1 : int.parse(route), route: route.isEmpty ? 1 : int.parse(route),
frequency: frequency.isEmpty ? 1 : int.parse(frequency), frequency: frequency.isEmpty ? 1 : int.parse(frequency),
remarks: instruction, remarks: instruction,
@ -116,6 +117,7 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
dynamic duration; dynamic duration;
dynamic doseTime; dynamic doseTime;
dynamic indication; dynamic indication;
dynamic units;
List<dynamic> strengthList; List<dynamic> strengthList;
List<dynamic> routeList; List<dynamic> routeList;
@ -123,6 +125,7 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
List<dynamic> durationList; List<dynamic> durationList;
List<dynamic> doseTimeList; List<dynamic> doseTimeList;
List<dynamic> indicationList; List<dynamic> indicationList;
List<dynamic> unitsList;
String routeInatial = 'By Mouth'; String routeInatial = 'By Mouth';
//PatiantInformtion patient; //PatiantInformtion patient;
@ -137,12 +140,22 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
durationList = List(); durationList = List();
doseTimeList = List(); doseTimeList = List();
indicationList = List(); indicationList = List();
unitsList = List();
dynamic unit1 = {"id": 1, "name": "MG"};
dynamic unit2 = {"id": 2, "name": "MCG"};
dynamic unit3 = {"id": 3, "name": "GM"};
dynamic regularOrder = {"id": 1, "name": "regular Order"}; dynamic regularOrder = {"id": 1, "name": "regular Order"};
dynamic urgentOrder = {"id": 2, "name": "urgent Order"}; dynamic urgentOrder = {"id": 2, "name": "urgent Order"};
dynamic strength1 = {"id": 1, "name": "1"}; dynamic strength1 = {"id": 1, "name": "1"};
dynamic strength2 = {"id": 2, "name": "2"}; dynamic strength2 = {"id": 2, "name": "2"};
dynamic strength3 = {"id": 3, "name": "3"}; dynamic strength3 = {"id": 3, "name": "3"};
dynamic strength4 = {"id": 4, "name": "4"};
dynamic strength5 = {"id": 5, "name": "5"};
dynamic strength6 = {"id": 6, "name": "6"};
dynamic strength7 = {"id": 7, "name": "7"};
dynamic strength8 = {"id": 8, "name": "8"};
dynamic strength9 = {"id": 9, "name": "9"};
dynamic route1 = {"id": 7, "name": "By Mouth"}; dynamic route1 = {"id": 7, "name": "By Mouth"};
dynamic route2 = {"id": 10, "name": "Inhale by Mouth"}; dynamic route2 = {"id": 10, "name": "Inhale by Mouth"};
dynamic route3 = {"id": 15, "name": "for INJECTION"}; dynamic route3 = {"id": 15, "name": "for INJECTION"};
@ -171,6 +184,11 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
dynamic duration9 = {"id": 9, "name": "For 9 Days"}; dynamic duration9 = {"id": 9, "name": "For 9 Days"};
dynamic duration10 = {"id": 10, "name": "For 10 Days"}; dynamic duration10 = {"id": 10, "name": "For 10 Days"};
dynamic duration11 = {"id": 14, "name": "For 14 Days"}; dynamic duration11 = {"id": 14, "name": "For 14 Days"};
dynamic duration12 = {"id": 21, "name": "For 21 Days"};
dynamic duration13 = {"id": 30, "name": "For 30 Days"};
dynamic duration14 = {"id": 45, "name": "For 45 Days"};
dynamic duration15 = {"id": 60, "name": "For 60 Days"};
dynamic duration16 = {"id": 90, "name": "For 90 Days"};
dynamic doseTime1 = {"id": 1, "name": "Before Meals"}; dynamic doseTime1 = {"id": 1, "name": "Before Meals"};
dynamic doseTime2 = {"id": 2, "name": "After Meals"}; dynamic doseTime2 = {"id": 2, "name": "After Meals"};
dynamic doseTime3 = {"id": 3, "name": "With Meals"}; dynamic doseTime3 = {"id": 3, "name": "With Meals"};
@ -197,6 +215,9 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
dynamic indication9 = {"id": 554, "name": "Purpuric Dermatitis"}; dynamic indication9 = {"id": 554, "name": "Purpuric Dermatitis"};
dynamic indication10 = {"id": 555, "name": "Systemic Lupus Erythematosus"}; dynamic indication10 = {"id": 555, "name": "Systemic Lupus Erythematosus"};
unitsList.add(unit1);
unitsList.add(unit2);
unitsList.add(unit3);
indicationList.add(indication1); indicationList.add(indication1);
indicationList.add(indication2); indicationList.add(indication2);
indicationList.add(indication3); indicationList.add(indication3);
@ -240,6 +261,12 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
strengthList.add(strength1); strengthList.add(strength1);
strengthList.add(strength2); strengthList.add(strength2);
strengthList.add(strength3); strengthList.add(strength3);
strengthList.add(strength4);
strengthList.add(strength5);
strengthList.add(strength6);
strengthList.add(strength7);
strengthList.add(strength8);
strengthList.add(strength9);
durationList.add(duration1); durationList.add(duration1);
durationList.add(duration2); durationList.add(duration2);
durationList.add(duration3); durationList.add(duration3);
@ -251,6 +278,11 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
durationList.add(duration9); durationList.add(duration9);
durationList.add(duration10); durationList.add(duration10);
durationList.add(duration11); durationList.add(duration11);
durationList.add(duration12);
durationList.add(duration13);
durationList.add(duration14);
durationList.add(duration15);
durationList.add(duration16);
referToList.add(regularOrder); referToList.add(regularOrder);
referToList.add(urgentOrder); referToList.add(urgentOrder);
} }
@ -417,6 +449,13 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
SizedBox(height: spaceBetweenTextFileds), SizedBox(height: spaceBetweenTextFileds),
Container( Container(
height: screenSize.height * 0.070, height: screenSize.height * 0.070,
width: double.infinity,
child: Row(
children: [
Container(
width:
MediaQuery.of(context).size.width *
0.5,
child: InkWell( child: InkWell(
onTap: strengthList != null onTap: strengthList != null
? () { ? () {
@ -425,27 +464,32 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
list: strengthList, list: strengthList,
attributeName: 'name', attributeName: 'name',
attributeValueId: 'id', attributeValueId: 'id',
okText: okText: TranslationBase.of(
TranslationBase.of(context) context)
.ok, .ok,
okFunction: (selectedValue) { okFunction:
(selectedValue) {
setState(() { setState(() {
strength = selectedValue; strength =
selectedValue;
}); });
}, },
); );
showDialog( showDialog(
barrierDismissible: false, barrierDismissible: false,
context: context, context: context,
builder: (BuildContext context) { builder:
(BuildContext context) {
return dialog; return dialog;
}, },
); );
} }
: null, : null,
child: TextField( child: TextField(
decoration: textFieldSelectorDecoration( decoration:
TranslationBase.of(context).strength, textFieldSelectorDecoration(
TranslationBase.of(context)
.strength,
strength != null strength != null
? strength['name'] ? strength['name']
: null, : null,
@ -454,6 +498,56 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
), ),
), ),
), ),
SizedBox(
width: 10.0,
),
Container(
width:
MediaQuery.of(context).size.width *
0.40,
child: InkWell(
onTap: unitsList != null
? () {
ListSelectDialog dialog =
ListSelectDialog(
list: unitsList,
attributeName: 'name',
attributeValueId: 'id',
okText: TranslationBase.of(
context)
.ok,
okFunction:
(selectedValue) {
setState(() {
units = selectedValue;
});
},
);
showDialog(
barrierDismissible: false,
context: context,
builder:
(BuildContext context) {
return dialog;
},
);
}
: null,
child: TextField(
decoration:
textFieldSelectorDecoration(
'UNIT Type',
units != null
? units['name']
: null,
true),
enabled: false,
),
),
),
],
),
),
SizedBox(height: spaceBetweenTextFileds), SizedBox(height: spaceBetweenTextFileds),
Container( Container(
height: screenSize.height * 0.070, height: screenSize.height * 0.070,
@ -763,11 +857,11 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
selectDate(BuildContext context, PrescriptionViewModel model) async { selectDate(BuildContext context, PrescriptionViewModel model) async {
DateTime selectedDate; DateTime selectedDate;
selectedDate = DateTime.now().add(Duration(hours: 15)); selectedDate = DateTime.now();
final DateTime picked = await showDatePicker( final DateTime picked = await showDatePicker(
context: context, context: context,
initialDate: selectedDate, initialDate: selectedDate,
firstDate: DateTime.now().add(Duration(hours: 15)), firstDate: DateTime.now(),
lastDate: DateTime(2040), lastDate: DateTime(2040),
initialEntryMode: DatePickerEntryMode.calendar, initialEntryMode: DatePickerEntryMode.calendar,
); );
@ -828,6 +922,8 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
title: TranslationBase.of(context).addMedication, title: TranslationBase.of(context).addMedication,
onPressed: () { onPressed: () {
postProcedure( postProcedure(
dose: strength['id'].toString(),
doseUnit: units['id'].toString(),
patient: widget.patient, patient: widget.patient,
doseTimeIn: doseTime['id'].toString(), doseTimeIn: doseTime['id'].toString(),
model: widget.model, model: widget.model,

@ -18,6 +18,7 @@ import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.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/app_text_form_field.dart'; import 'package:doctor_app_flutter/widgets/shared/app_text_form_field.dart';
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/dialogs/dailog-list-select.dart';
import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:hexcolor/hexcolor.dart'; import 'package:hexcolor/hexcolor.dart';
@ -28,10 +29,86 @@ class NewPrescriptionScreen extends StatefulWidget {
} }
class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> { class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> {
PersistentBottomSheetController _controller;
final _scaffoldKey = GlobalKey<ScaffoldState>();
int testNum = 0; int testNum = 0;
PatiantInformtion patient; PatiantInformtion patient;
dynamic route;
dynamic doseTime;
dynamic frequencyUpdate;
List<dynamic> doseTimeList;
List<dynamic> routeList;
List<dynamic> frequencyList;
@override @override
void initState() {
super.initState();
routeList = List();
doseTimeList = List();
frequencyList = List();
dynamic frequency1 = {"id": 1, "name": "2 Times a day"};
dynamic frequency2 = {"id": 2, "name": "3 Times a day"};
dynamic frequency3 = {"id": 3, "name": "4 Times a day"};
dynamic frequency4 = {"id": 8, "name": "As Needed"};
dynamic frequency5 = {"id": 9, "name": "Bed Time"};
dynamic frequency6 = {"id": 11, "name": "Every Other Day"};
dynamic frequency7 = {"id": 29, "name": "Every Eight Hours"};
dynamic frequency8 = {"id": 34, "name": "As Directed"};
dynamic doseTime1 = {"id": 1, "name": "Before Meals"};
dynamic doseTime2 = {"id": 2, "name": "After Meals"};
dynamic doseTime3 = {"id": 3, "name": "With Meals"};
dynamic doseTime4 = {"id": 4, "name": "In The Morning"};
dynamic doseTime5 = {"id": 5, "name": "In the Evening"};
dynamic doseTime6 = {"id": 6, "name": "After Supper"};
dynamic doseTime7 = {"id": 7, "name": "With Supper"};
dynamic doseTime8 = {"id": 8, "name": "Before Breakfast"};
dynamic doseTime9 = {"id": 9, "name": "In the Afternoon"};
dynamic doseTime10 = {"id": 10, "name": "While wake"};
dynamic doseTime11 = {"id": 12, "name": "Any Time"};
dynamic doseTime12 = {"id": 21, "name": "Bed Time"};
dynamic route1 = {"id": 7, "name": "By Mouth"};
dynamic route2 = {"id": 10, "name": "Inhale by Mouth"};
dynamic route3 = {"id": 15, "name": "for INJECTION"};
dynamic route4 = {"id": 17, "name": "Drops"};
dynamic route5 = {"id": 18, "name": "Rub On"};
dynamic route6 = {"id": 20, "name": "Spary"};
dynamic route7 = {"id": 27, "name": "In Both EYES"};
dynamic route8 = {"id": 28, "name": "In Both Ears"};
dynamic route9 = {"id": 32, "name": "Intramuscular"};
frequencyList.add(frequency1);
frequencyList.add(frequency2);
frequencyList.add(frequency3);
frequencyList.add(frequency4);
frequencyList.add(frequency5);
frequencyList.add(frequency6);
frequencyList.add(frequency7);
frequencyList.add(frequency8);
doseTimeList.add(doseTime1);
doseTimeList.add(doseTime2);
doseTimeList.add(doseTime3);
doseTimeList.add(doseTime4);
doseTimeList.add(doseTime5);
doseTimeList.add(doseTime6);
doseTimeList.add(doseTime7);
doseTimeList.add(doseTime8);
doseTimeList.add(doseTime9);
doseTimeList.add(doseTime10);
doseTimeList.add(doseTime11);
doseTimeList.add(doseTime12);
routeList.add(route1);
routeList.add(route2);
routeList.add(route3);
routeList.add(route4);
routeList.add(route5);
routeList.add(route6);
routeList.add(route7);
routeList.add(route8);
routeList.add(route9);
}
Widget build(BuildContext context) { Widget build(BuildContext context) {
final screenSize = MediaQuery.of(context).size; final screenSize = MediaQuery.of(context).size;
final routeArgs = ModalRoute.of(context).settings.arguments as Map; final routeArgs = ModalRoute.of(context).settings.arguments as Map;
@ -459,6 +536,15 @@ class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> {
.edit), .edit),
onTap: () { onTap: () {
updatePrescriptionForm( updatePrescriptionForm(
doseUnit:
model.prescriptionList[0].entityList[index].doseDailyUnitID
.toString(),
doseStreangth:
model.prescriptionList[0].entityList[index].doseDailyQuantity
.toString(),
duration:
model.prescriptionList[0].entityList[index].doseDurationDays
.toString(),
startDate: startDate:
model.prescriptionList[0].entityList[index].startDate model.prescriptionList[0].entityList[index].startDate
.toString(), .toString(),
@ -469,8 +555,12 @@ class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> {
index] index]
.doseTimingID .doseTimingID
.toString(), .toString(),
frequency: frequency: model
model.prescriptionList[0].entityList[index].frequencyID .prescriptionList[
0]
.entityList[
index]
.frequencyID
.toString(), .toString(),
rouat: model rouat: model
.prescriptionList[ .prescriptionList[
@ -482,22 +572,13 @@ class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> {
patient: patient:
patient, patient,
drugId: model drugId: model
.prescriptionList[
0]
.entityList[
index]
.medicineCode,
drugName: model
.prescriptionList[
0]
.entityList[
index]
.doseDetail,
remarks: model
.prescriptionList[0] .prescriptionList[0]
.entityList[index] .entityList[index]
.remarks, .medicineCode,
drugName: model.prescriptionList[0].entityList[index].doseDetail,
remarks: model.prescriptionList[0].entityList[index].remarks,
model: model, model: model,
enteredRemarks: model.prescriptionList[0].entityList[index].remarks,
context: context); context: context);
//model.postPrescription(); //model.postPrescription();
}, },
@ -603,6 +684,10 @@ class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> {
String rouat, String rouat,
String frequency, String frequency,
String dose, String dose,
String duration,
String doseStreangth,
String doseUnit,
String enteredRemarks,
String startDate}) { String startDate}) {
TextEditingController remarksController = TextEditingController(); TextEditingController remarksController = TextEditingController();
TextEditingController doseController = TextEditingController(); TextEditingController doseController = TextEditingController();
@ -611,7 +696,9 @@ class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> {
showModalBottomSheet( showModalBottomSheet(
context: context, context: context,
isScrollControlled: true, isScrollControlled: true,
builder: (BuildContext bc) { builder: (BuildContext context) {
return StatefulBuilder(builder: (BuildContext context,
StateSetter setState /*You can rename this!*/) {
return Container( return Container(
height: MediaQuery.of(context).size.height * 0.73, height: MediaQuery.of(context).size.height * 0.73,
child: Form( child: Form(
@ -631,45 +718,128 @@ class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> {
Column( Column(
children: [ children: [
Container( Container(
decoration: BoxDecoration( height:
borderRadius: MediaQuery.of(context).size.height * 0.070,
BorderRadius.all(Radius.circular(6.0)), child: InkWell(
border: Border.all( onTap: routeList != null
width: 1.0, color: HexColor("#CCCCCC"))), ? () {
child: TextFields( ListSelectDialog dialog =
hintText: 'route', ListSelectDialog(
controller: routeController, list: routeList,
keyboardType: TextInputType.number, attributeName: 'name',
attributeValueId: 'id',
okText:
TranslationBase.of(context).ok,
okFunction: (selectedValue) {
setState(() {
route = selectedValue;
});
if (route == null) {
helpers
.showErrorToast('plase fill');
}
},
);
showDialog(
barrierDismissible: false,
context: context,
builder: (BuildContext context) {
return dialog;
},
);
}
: null,
child: TextField(
decoration: textFieldSelectorDecoration(
TranslationBase.of(context).route,
route != null ? route['name'] : null,
true),
enabled: false,
),
), ),
), ),
SizedBox( SizedBox(
height: 12.0, height: 12.0,
), ),
Container( Container(
decoration: BoxDecoration( height:
borderRadius: MediaQuery.of(context).size.height * 0.070,
BorderRadius.all(Radius.circular(6.0)), child: InkWell(
border: Border.all( onTap: doseTimeList != null
width: 1.0, color: HexColor("#CCCCCC"))), ? () {
child: TextFields( ListSelectDialog dialog =
hintText: 'Dose Time', ListSelectDialog(
controller: doseController, list: doseTimeList,
keyboardType: TextInputType.number, attributeName: 'name',
attributeValueId: 'id',
okText:
TranslationBase.of(context).ok,
okFunction: (selectedValue) {
setState(() {
doseTime = selectedValue;
});
},
);
showDialog(
barrierDismissible: false,
context: context,
builder: (BuildContext context) {
return dialog;
},
);
}
: null,
child: TextField(
decoration: textFieldSelectorDecoration(
TranslationBase.of(context).doseTime,
doseTime != null
? doseTime['name']
: null,
true),
enabled: false,
),
), ),
), ),
SizedBox( SizedBox(
height: 12.0, height: 12.0,
), ),
Container( Container(
decoration: BoxDecoration( height:
borderRadius: MediaQuery.of(context).size.height * 0.070,
BorderRadius.all(Radius.circular(6.0)), child: InkWell(
border: Border.all( onTap: frequencyList != null
width: 1.0, color: HexColor("#CCCCCC"))), ? () {
child: TextFields( ListSelectDialog dialog =
hintText: 'Frequency', ListSelectDialog(
controller: frequencyController, list: frequencyList,
keyboardType: TextInputType.number, attributeName: 'name',
attributeValueId: 'id',
okText:
TranslationBase.of(context).ok,
okFunction: (selectedValue) {
setState(() {
frequencyUpdate = selectedValue;
});
},
);
showDialog(
barrierDismissible: false,
context: context,
builder: (BuildContext context) {
return dialog;
},
);
}
: null,
child: TextField(
decoration: textFieldSelectorDecoration(
TranslationBase.of(context).frequency,
frequencyUpdate != null
? frequencyUpdate['name']
: null,
true),
enabled: false,
),
), ),
), ),
SizedBox( SizedBox(
@ -695,8 +865,8 @@ class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> {
height: MediaQuery.of(context).size.height * 0.12, height: MediaQuery.of(context).size.height * 0.12,
), ),
Container( Container(
margin: margin: EdgeInsets.all(
EdgeInsets.all(SizeConfig.widthMultiplier * 2), SizeConfig.widthMultiplier * 2),
child: Wrap( child: Wrap(
alignment: WrapAlignment.center, alignment: WrapAlignment.center,
children: <Widget>[ children: <Widget>[
@ -704,6 +874,9 @@ class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> {
title: 'update prescription'.toUpperCase(), title: 'update prescription'.toUpperCase(),
onPressed: () { onPressed: () {
updatePrescription( updatePrescription(
doseUnit: doseUnit,
doseStreangth: doseStreangth,
duration: duration,
startDate: startDate, startDate: startDate,
doseId: dose, doseId: dose,
frequencyId: frequency, frequencyId: frequency,
@ -712,9 +885,11 @@ class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> {
model: model, model: model,
drugId: drugId, drugId: drugId,
remarks: remarksController.text, remarks: remarksController.text,
route: routeController.text, route: route['id'].toString(),
frequency: frequencyController.text, frequency:
dose: doseController.text); frequencyUpdate['id'].toString(),
dose: doseTime['id'].toString(),
enteredRemarks: enteredRemarks);
Navigator.pop(context); Navigator.pop(context);
}, },
), ),
@ -728,6 +903,7 @@ class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> {
), ),
)); ));
}); });
});
} }
updatePrescription( updatePrescription(
@ -741,6 +917,10 @@ class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> {
String route, String route,
String routeId, String routeId,
String startDate, String startDate,
String doseUnit,
String doseStreangth,
String duration,
String enteredRemarks,
PatiantInformtion patient}) async { PatiantInformtion patient}) async {
//PrescriptionViewModel model = PrescriptionViewModel(); //PrescriptionViewModel model = PrescriptionViewModel();
PostPrescriptionReqModel updatePrescriptionReqModel = PostPrescriptionReqModel updatePrescriptionReqModel =
@ -754,18 +934,19 @@ class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> {
sss.add(PrescriptionRequestModel( sss.add(PrescriptionRequestModel(
covered: true, covered: true,
dose: 9, //frequency.isNotEmpty ? int.parse(dose) : 1, dose: int.parse(
doseStreangth), //frequency.isNotEmpty ? int.parse(dose) : 1,
itemId: drugId, itemId: drugId,
doseUnitId: 2, doseUnitId: int.parse(doseUnit),
route: route.isNotEmpty ? int.parse(route) : int.parse(routeId), route: route.isNotEmpty ? int.parse(route) : int.parse(routeId),
frequency: frequency.isNotEmpty frequency: frequency.isNotEmpty
? int.parse(frequency) ? int.parse(frequency)
: int.parse(frequencyId), : int.parse(frequencyId),
remarks: remarks.isEmpty ? '' : remarks, remarks: remarks.isEmpty ? enteredRemarks : remarks,
approvalRequired: true, approvalRequired: true,
icdcode10Id: "test2", icdcode10Id: "test2",
doseTime: dose.isNotEmpty ? int.parse(dose) : int.parse(doseId), doseTime: dose.isNotEmpty ? int.parse(dose) : int.parse(doseId),
duration: 2, duration: int.parse(duration),
doseStartDate: startDate)); doseStartDate: startDate));
updatePrescriptionReqModel.prescriptionRequestModel = sss; updatePrescriptionReqModel.prescriptionRequestModel = sss;
//postProcedureReqModel.procedures = controlsProcedure; //postProcedureReqModel.procedures = controlsProcedure;
@ -779,4 +960,36 @@ class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> {
DrAppToastMsg.showSuccesToast('Medication has been updated'); DrAppToastMsg.showSuccesToast('Medication has been updated');
} }
} }
InputDecoration textFieldSelectorDecoration(
String hintText, String selectedText, bool isDropDown,
{Icon suffixIcon}) {
return InputDecoration(
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0),
borderRadius: BorderRadius.circular(8),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0),
borderRadius: BorderRadius.circular(8),
),
disabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0),
borderRadius: BorderRadius.circular(8),
),
hintText: selectedText != null ? selectedText : hintText,
suffixIcon: isDropDown
? suffixIcon != null
? suffixIcon
: Icon(
Icons.arrow_drop_down,
color: Colors.black,
)
: null,
hintStyle: TextStyle(
fontSize: 14,
color: Colors.grey.shade600,
),
);
}
} }

@ -646,8 +646,7 @@ postProcedure(
postProcedureReqModel.patientMRN = patient.patientMRN; postProcedureReqModel.patientMRN = patient.patientMRN;
controls.add( controls.add(
Controls( Controls(code: remarks.isEmpty ? '' : remarks, controlValue: 'test'),
code: remarks.isEmpty ? 'ssss' : remarks, controlValue: 'sssssssss'),
); );
entityList.forEach((element) { entityList.forEach((element) {

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

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

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

@ -18,6 +18,24 @@ import './profile_medical_info_widget.dart';
class PatientProfileWidget extends StatelessWidget { class PatientProfileWidget extends StatelessWidget {
PatiantInformtion patient; PatiantInformtion patient;
String getPatientAge(dynamic birthday){
// https://leechy.dev/calculate-dates-diff-in-dart
DateTime birthDate = DateUtils.getDateTimeFromServerFormat(birthday);
final now = DateTime.now();
int years = now.year - birthDate .year;
int months = now.month - birthDate.month;
int days = now.day - birthDate.day;
if (months < 0 || (months == 0 && days < 0)) {
years--;
months += (days < 0 ? 11 : 12);
}
if (days < 0) {
final monthAgo = new DateTime(now.year, now.month - 1, birthDate.day);
days = now.difference(monthAgo).inDays + 1;
}
return "$years Yr $months Mnth $days Day";
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final routeArgs = ModalRoute.of(context).settings.arguments as Map; final routeArgs = ModalRoute.of(context).settings.arguments as Map;
@ -115,7 +133,7 @@ class PatientProfileWidget extends StatelessWidget {
height: 4, height: 4,
), ),
AppText( AppText(
"${DateUtils.convertDateFromServerFormat(patient.dateofBirth, 'dd-MM-yyyy')} / ${patient.age}", "${DateUtils.convertDateFromServerFormat(patient.dateofBirth, 'dd-MM-yyyy')} / ${getPatientAge(patient.dateofBirth)/*patient.age*/}",
fontWeight: FontWeight.normal, fontWeight: FontWeight.normal,
fontSize: 1.6 * SizeConfig.textMultiplier, fontSize: 1.6 * SizeConfig.textMultiplier,
), ),

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

Loading…
Cancel
Save