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

 Conflicts:
	lib/config/localized_values.dart
	lib/util/translations_delegate_base.dart
merge-requests/241/head
Elham Rababah 5 years ago
commit 7ce1d2dd55

@ -42,6 +42,8 @@ class BaseAppClient {
DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile); DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile);
if (body['DoctorID'] == null) if (body['DoctorID'] == null)
body['DoctorID'] = doctorProfile?.doctorID; body['DoctorID'] = doctorProfile?.doctorID;
if (body['DoctorID'] == "")
body['DoctorID'] = null;
body['EditedBy'] = doctorProfile?.doctorID; body['EditedBy'] = doctorProfile?.doctorID;
if (body['ProjectID'] == null) { if (body['ProjectID'] == null) {
body['ProjectID'] = doctorProfile?.projectID; body['ProjectID'] = doctorProfile?.projectID;

@ -519,6 +519,8 @@ const Map<String, Map<String, String>> localizedValues = {
'en': "You make referral successfully", 'en': "You make referral successfully",
'ar': "You make referral successfully" 'ar': "You make referral successfully"
}, },
'fromTime': {'en': "From Time", 'ar': "من وقت"},
'toTime': {'en': "To Time", 'ar': "الى وقت"},
'diagnoseType': {'en': "Diagnose Type", 'ar': "نوع التشخيص"}, 'diagnoseType': {'en': "Diagnose Type", 'ar': "نوع التشخيص"},
'condition': {'en': "Condition", 'ar': "الحالة"}, 'condition': {'en': "Condition", 'ar': "الحالة"},
'id': {'en': "ID", 'ar': "بطاقة هوية"}, 'id': {'en': "ID", 'ar': "بطاقة هوية"},
@ -526,7 +528,14 @@ const Map<String, Map<String, String>> localizedValues = {
'codeNo': {'en': "Code #", 'ar': "# الرمز"}, 'codeNo': {'en': "Code #", 'ar': "# الرمز"},
'covered': {'en': "Covered", 'ar': "مغطى"}, 'covered': {'en': "Covered", 'ar': "مغطى"},
'approvalRequired': {'en': "Approval Required", 'ar': "الموافقة مطلوبة"}, 'approvalRequired': {'en': "Approval Required", 'ar': "الموافقة مطلوبة"},
'uncoveredByDoctor': {'en': "Uncovered By Doctor", 'ar':"غير مغطى من قبل الدكتور" }, 'uncoveredByDoctor': {
'en': "Uncovered By Doctor",
'ar': "غير مغطى من قبل الدكتور"
},
'chiefComplaintEmptyMsg': {
'en': "There is no Chief Complaint",
'ar': "ليس هناك شكوى رئيس"
},
'addAssessment': {'en': "Add ASSESSMENT", 'ar':"أضف التقييم" }, 'addAssessment': {'en': "Add ASSESSMENT", 'ar':"أضف التقييم" },
'assessment': {'en': "ASSESSMENT", 'ar':" التقييم" }, 'assessment': {'en': "ASSESSMENT", 'ar':" التقييم" },
}; };

@ -1,5 +1,58 @@
import 'package:doctor_app_flutter/config/config.dart';
import 'package:doctor_app_flutter/core/service/base/base_service.dart'; import 'package:doctor_app_flutter/core/service/base/base_service.dart';
import 'package:doctor_app_flutter/models/SOAP/ChiefComplaint/GetChiefComplaintReqModel.dart';
import 'package:doctor_app_flutter/models/SOAP/ChiefComplaint/GetChiefComplaintResModel.dart';
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/models/patient/vital_sign/patient-vital-sign-data.dart';
class UcafService extends BaseService { class UcafService extends BaseService {
List<GetChiefComplaintResModel> patientChiefComplaintList = [];
VitalSignData patientVitalSigns;
Future getPatientChiefComplaint(PatiantInformtion patient) async {
hasError = false;
Map<String, dynamic> body = Map();
body['PatientMRN'] = patient.patientMRN;
body['AppointmentNo'] = patient.appointmentNo;
body['EpisodeID'] = patient.episodeNo;
body['DoctorID'] = "";
await baseAppClient.post (GET_CHIEF_COMPLAINT,
onSuccess: (dynamic response, int statusCode) {
print("Success");
patientChiefComplaintList.clear();
response['List_ChiefComplaint']['entityList'].forEach((v) {
patientChiefComplaintList.add(GetChiefComplaintResModel.fromJson(v));
});
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, body: body);
}
Future getPatientVitalSign(PatiantInformtion patient) async {
patientVitalSigns = null;
hasError = false;
Map<String, dynamic> body = Map();
body['PatientMRN'] = patient.patientMRN;
body['AppointmentNo'] = patient.appointmentNo;
body['EpisodeID'] = patient.episodeNo;
await baseAppClient.post(
GET_PATIENT_VITAL_SIGN_DATA,
onSuccess: (dynamic response, int statusCode) {
if(response['VitalSignsList'] != null){
if(response['VitalSignsList']['entityList'] != null && (response['VitalSignsList']['entityList'] as List).length > 0){
patientVitalSigns = VitalSignData.fromJson(response['VitalSignsList']['entityList'][0]);
}
}
},
onFailure: (String error, int statusCode) {
hasError = true;
super.error = error.toString();
},
body: body,
);
}
} }

@ -11,43 +11,8 @@ class VitalSignsService extends BaseService{
List<VitalSignResModel> patientVitalSignOrderdSubList = []; List<VitalSignResModel> patientVitalSignOrderdSubList = [];
VitalSignData patientVitalSigns; VitalSignData patientVitalSigns;
/*Future getPatientVitalSign(patient) async {
hasError = false;
await baseAppClient.post(
GET_PATIENT_VITAL_SIGN,
onSuccess: (dynamic response, int statusCode) {
patientVitalSignList = [];
response['List_DoctorPatientVitalSign'].forEach((v) {
patientVitalSignList.add(new VitalSignResModel.fromJson(v));
});
if (patientVitalSignList.length > 0) {
List<VitalSignResModel> patientVitalSignOrderdSubListTemp = [];
patientVitalSignOrderdSubListTemp = patientVitalSignList;
patientVitalSignOrderdSubListTemp
.sort((VitalSignResModel a, VitalSignResModel b) {
return b.vitalSignDate.microsecondsSinceEpoch -
a.vitalSignDate.microsecondsSinceEpoch;
});
patientVitalSignOrderdSubList.clear();
int length = patientVitalSignOrderdSubListTemp.length >= 20
? 20
: patientVitalSignOrderdSubListTemp.length;
for (int x = 0; x < length; x++) {
patientVitalSignOrderdSubList
.add(patientVitalSignOrderdSubListTemp[x]);
}
}
},
onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
},
body: patient,
);
} // Vit*/
Future getPatientVitalSign(PatiantInformtion patient) async { Future getPatientVitalSign(PatiantInformtion patient) async {
patientVitalSigns = null;
hasError = false; hasError = false;
Map<String, dynamic> body = Map(); Map<String, dynamic> body = Map();
body['PatientMRN'] = patient.patientMRN; body['PatientMRN'] = patient.patientMRN;

@ -11,6 +11,8 @@ class PrescriptionService extends BaseService {
List<PrescriptionModel> get prescriptionList => _prescriptionList; List<PrescriptionModel> get prescriptionList => _prescriptionList;
List<SearchDrugModel> _drugsList = List(); List<SearchDrugModel> _drugsList = List();
List<SearchDrugModel> get drugsList => _drugsList; List<SearchDrugModel> get drugsList => _drugsList;
List<dynamic> doctorsList = [];
List<dynamic> specialityList = [];
PrescriptionReqModel _prescriptionReqModel = PrescriptionReqModel( PrescriptionReqModel _prescriptionReqModel = PrescriptionReqModel(
patientMRN: 3120877, patientMRN: 3120877,
@ -26,7 +28,8 @@ class PrescriptionService extends BaseService {
PostPrescriptionReqModel _postPrescriptionReqModel = PostPrescriptionReqModel _postPrescriptionReqModel =
PostPrescriptionReqModel(); PostPrescriptionReqModel();
Future getPrescription() async { Future getPrescription({int mrn}) async {
_prescriptionReqModel = PrescriptionReqModel(patientMRN: 3120877);
hasError = false; hasError = false;
_prescriptionList.clear(); _prescriptionList.clear();
await baseAppClient.post(GET_PRESCRIPTION_LIST, await baseAppClient.post(GET_PRESCRIPTION_LIST,
@ -41,10 +44,11 @@ class PrescriptionService extends BaseService {
Future getDrugs() async { Future getDrugs() async {
hasError = false; hasError = false;
_drugsList.clear();
await baseAppClient.post(SEARCH_DRUG, await baseAppClient.post(SEARCH_DRUG,
onSuccess: (dynamic response, int statusCode) { onSuccess: (dynamic response, int statusCode) {
_drugsList.add(SearchDrugModel.fromJson(response['MedicationList'])); doctorsList = [];
doctorsList = response['MedicationList']['entityList'];
}, onFailure: (String error, int statusCode) { }, onFailure: (String error, int statusCode) {
hasError = true; hasError = true;
super.error = error; super.error = error;

@ -1,9 +1,30 @@
import 'package:doctor_app_flutter/core/enum/viewstate.dart';
import 'package:doctor_app_flutter/core/service/patient-ucaf-service.dart'; import 'package:doctor_app_flutter/core/service/patient-ucaf-service.dart';
import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart';
import 'package:doctor_app_flutter/models/SOAP/ChiefComplaint/GetChiefComplaintResModel.dart';
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/models/patient/vital_sign/patient-vital-sign-data.dart';
import '../../locator.dart'; import '../../locator.dart';
class UcafViewModel extends BaseViewModel { class UcafViewModel extends BaseViewModel {
UcafService _ucafService = locator<UcafService>(); UcafService _ucafService = locator<UcafService>();
List<GetChiefComplaintResModel> get patientChiefComplaintList => _ucafService.patientChiefComplaintList;
VitalSignData get patientVitalSigns => _ucafService.patientVitalSigns;
Future getUCAFData(PatiantInformtion patient) async {
setState(ViewState.Busy);
await _ucafService.getPatientVitalSign(patient);
await _ucafService.getPatientChiefComplaint(patient);
if (_ucafService.hasError) {
error = _ucafService.error;
setState(ViewState.Error);
} else {
setState(ViewState.Idle);
}
}
} }

@ -12,13 +12,13 @@ class PrescriptionViewModel extends BaseViewModel {
List<PrescriptionModel> get prescriptionList => List<PrescriptionModel> get prescriptionList =>
_prescriptionService.prescriptionList; _prescriptionService.prescriptionList;
List<SearchDrugModel> get drugsList => _prescriptionService.drugsList; List<dynamic> get drugsList => _prescriptionService.doctorsList;
Future getPrescription() async { Future getPrescription({int mrn}) async {
hasError = false; hasError = false;
//_insuranceCardService.clearInsuranceCard(); //_insuranceCardService.clearInsuranceCard();
setState(ViewState.Busy); setState(ViewState.Busy);
await _prescriptionService.getPrescription(); await _prescriptionService.getPrescription(mrn: mrn);
if (_prescriptionService.hasError) { if (_prescriptionService.hasError) {
error = _prescriptionService.error; error = _prescriptionService.error;
setState(ViewState.ErrorLocal); setState(ViewState.ErrorLocal);
@ -27,7 +27,7 @@ class PrescriptionViewModel extends BaseViewModel {
} }
Future postPrescription( Future postPrescription(
PostPrescriptionReqModel postProcedureReqModel) async { PostPrescriptionReqModel postProcedureReqModel, int mrn) async {
hasError = false; hasError = false;
//_insuranceCardService.clearInsuranceCard(); //_insuranceCardService.clearInsuranceCard();
setState(ViewState.Busy); setState(ViewState.Busy);
@ -36,13 +36,13 @@ class PrescriptionViewModel extends BaseViewModel {
error = _prescriptionService.error; error = _prescriptionService.error;
setState(ViewState.ErrorLocal); setState(ViewState.ErrorLocal);
} else { } else {
await getPrescription(); await getPrescription(mrn: mrn);
setState(ViewState.Idle); setState(ViewState.Idle);
} }
} }
Future updatePrescription( Future updatePrescription(
PostPrescriptionReqModel updatePrescriptionReqModel) async { PostPrescriptionReqModel updatePrescriptionReqModel, int mrn) async {
hasError = false; hasError = false;
//_insuranceCardService.clearInsuranceCard(); //_insuranceCardService.clearInsuranceCard();
setState(ViewState.Busy); setState(ViewState.Busy);
@ -51,7 +51,7 @@ class PrescriptionViewModel extends BaseViewModel {
error = _prescriptionService.error; error = _prescriptionService.error;
setState(ViewState.ErrorLocal); setState(ViewState.ErrorLocal);
} else { } else {
await getPrescription(); await getPrescription(mrn: mrn);
setState(ViewState.Idle); setState(ViewState.Idle);
} }
} }

@ -99,6 +99,7 @@ class SickLeaveViewModel extends BaseViewModel {
Future addReschedule(request) async { Future addReschedule(request) async {
setState(ViewState.Busy); setState(ViewState.Busy);
await _sickLeaveService.addReschedule(request); await _sickLeaveService.addReschedule(request);
notifyListeners();
if (_sickLeaveService.hasError) { if (_sickLeaveService.hasError) {
error = _sickLeaveService.error; error = _sickLeaveService.error;
setState(ViewState.Error); setState(ViewState.Error);

@ -124,11 +124,13 @@ class _MedicalFilePageState extends State<MedicalFilePage> {
'Doctor : '.toUpperCase(), 'Doctor : '.toUpperCase(),
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
), ),
AppText( Expanded(
child: AppText(
model.medicalFileList[0].entityList[0] model.medicalFileList[0].entityList[0]
.timelines[index].doctorName, .timelines[index].doctorName,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
), ),
),
], ],
), ),
Row( Row(

@ -466,13 +466,6 @@ class _PatientsScreenState extends State<PatientsScreen> {
height: height:
10.0, 10.0,
), ),
Padding(
padding: EdgeInsets.symmetric(
vertical:
5.5,
horizontal:
22.5),
child:
AppText( AppText(
item.firstName + item.firstName +
" " + " " +
@ -484,7 +477,6 @@ class _PatientsScreenState extends State<PatientsScreen> {
backGroundcolor: backGroundcolor:
Colors.white, Colors.white,
), ),
),
], ],
), ),
Row( Row(

@ -14,6 +14,7 @@ import 'package:flutter/services.dart';
import 'package:hexcolor/hexcolor.dart'; import 'package:hexcolor/hexcolor.dart';
import '../../../../routes.dart'; import '../../../../routes.dart';
import '../../../QR_reader_screen.dart';
class UCAFInputScreen extends StatefulWidget { class UCAFInputScreen extends StatefulWidget {
@override @override
@ -55,15 +56,20 @@ class _UCAFInputScreenState extends State<UCAFInputScreen> {
final screenSize = MediaQuery.of(context).size; final screenSize = MediaQuery.of(context).size;
return BaseView<UcafViewModel>( return BaseView<UcafViewModel>(
onModelReady: (model) => model.getUCAFData(patient),
builder: (_, model, w) => AppScaffold( builder: (_, model, w) => AppScaffold(
baseViewModel: model, baseViewModel: model,
appBarTitle: TranslationBase.of(context).ucaf, appBarTitle: TranslationBase.of(context).ucaf,
body: SingleChildScrollView( body: model.patientVitalSigns != null &&
model.patientChiefComplaintList != null &&
model.patientChiefComplaintList.length > 0
? SingleChildScrollView(
child: Column( child: Column(
children: [ children: [
PatientHeaderWidgetNoAvatar(patient), PatientHeaderWidgetNoAvatar(patient),
Container( Container(
margin: EdgeInsets.symmetric(vertical: 16, horizontal: 16), margin:
EdgeInsets.symmetric(vertical: 16, horizontal: 16),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
@ -101,7 +107,8 @@ class _UCAFInputScreenState extends State<UCAFInputScreen> {
height: screenSize.height * 0.070, height: screenSize.height * 0.070,
child: TextField( child: TextField(
decoration: Helpers.textFieldSelectorDecoration( decoration: Helpers.textFieldSelectorDecoration(
TranslationBase.of(context).durationOfIllness, TranslationBase.of(context)
.durationOfIllness,
null, null,
false), false),
enabled: true, enabled: true,
@ -130,7 +137,7 @@ class _UCAFInputScreenState extends State<UCAFInputScreen> {
width: 8, width: 8,
), ),
AppText( AppText(
"120/80", "${model.patientVitalSigns.bloodPressureHigher}/${model.patientVitalSigns.bloodPressureLower}",
fontSize: SizeConfig.textMultiplier * 2, fontSize: SizeConfig.textMultiplier * 2,
color: Colors.grey.shade800, color: Colors.grey.shade800,
fontWeight: FontWeight.normal, fontWeight: FontWeight.normal,
@ -149,7 +156,7 @@ class _UCAFInputScreenState extends State<UCAFInputScreen> {
width: 8, width: 8,
), ),
AppText( AppText(
"37.5(C), 98.6(F)", "${model.patientVitalSigns.temperatureCelcius}(C), ${model.patientVitalSigns.temperatureCelcius * (9 / 5) + 32}(F)",
fontSize: SizeConfig.textMultiplier * 2, fontSize: SizeConfig.textMultiplier * 2,
color: Colors.grey.shade800, color: Colors.grey.shade800,
fontWeight: FontWeight.normal, fontWeight: FontWeight.normal,
@ -176,7 +183,7 @@ class _UCAFInputScreenState extends State<UCAFInputScreen> {
width: 8, width: 8,
), ),
AppText( AppText(
"80", "${model.patientVitalSigns.pulseBeatPerMinute}",
fontSize: SizeConfig.textMultiplier * 2, fontSize: SizeConfig.textMultiplier * 2,
color: Colors.grey.shade800, color: Colors.grey.shade800,
fontWeight: FontWeight.normal, fontWeight: FontWeight.normal,
@ -189,7 +196,8 @@ class _UCAFInputScreenState extends State<UCAFInputScreen> {
height: 16, height: 16,
), ),
AppText( AppText(
TranslationBase.of(context).chiefComplaintsAndSymptoms, TranslationBase.of(context)
.chiefComplaintsAndSymptoms,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontSize: SizeConfig.textMultiplier * 2.5, fontSize: SizeConfig.textMultiplier * 2.5,
), ),
@ -208,14 +216,17 @@ class _UCAFInputScreenState extends State<UCAFInputScreen> {
Container( Container(
child: TextField( child: TextField(
decoration: Helpers.textFieldSelectorDecoration( decoration: Helpers.textFieldSelectorDecoration(
TranslationBase.of(context).additionalTextComplaints, TranslationBase.of(context)
null, .additionalTextComplaints,
helpers.parseHtmlString(model
.patientChiefComplaintList[0]
.chiefComplaint),
false), false),
enabled: true, enabled: false,
controller: _additionalComplaintsController, controller: _additionalComplaintsController,
keyboardType: TextInputType.text, keyboardType: TextInputType.text,
minLines: 4, /*minLines: 4,
maxLines: 6, maxLines: 6,*/
)), )),
SizedBox( SizedBox(
height: 16, height: 16,
@ -236,10 +247,12 @@ class _UCAFInputScreenState extends State<UCAFInputScreen> {
value: conditionsData[index]['isChecked'], value: conditionsData[index]['isChecked'],
onChanged: (newValue) { onChanged: (newValue) {
setState(() { setState(() {
conditionsData[index]['isChecked'] = newValue; conditionsData[index]['isChecked'] =
newValue;
}); });
}, },
controlAffinity: ListTileControlAffinity.leading, controlAffinity:
ListTileControlAffinity.leading,
contentPadding: EdgeInsets.all(0), contentPadding: EdgeInsets.all(0),
)), )),
SizedBox( SizedBox(
@ -279,7 +292,8 @@ class _UCAFInputScreenState extends State<UCAFInputScreen> {
child: Container( child: Container(
height: screenSize.height * 0.070, height: screenSize.height * 0.070,
child: TextField( child: TextField(
decoration: Helpers.textFieldSelectorDecoration( decoration:
Helpers.textFieldSelectorDecoration(
TranslationBase.of(context).when, TranslationBase.of(context).when,
null, null,
false), false),
@ -295,7 +309,8 @@ class _UCAFInputScreenState extends State<UCAFInputScreen> {
child: Container( child: Container(
height: screenSize.height * 0.070, height: screenSize.height * 0.070,
child: TextField( child: TextField(
decoration: Helpers.textFieldSelectorDecoration( decoration:
Helpers.textFieldSelectorDecoration(
TranslationBase.of(context).where, TranslationBase.of(context).where,
null, null,
false), false),
@ -312,7 +327,8 @@ class _UCAFInputScreenState extends State<UCAFInputScreen> {
Container( Container(
child: TextField( child: TextField(
decoration: Helpers.textFieldSelectorDecoration( decoration: Helpers.textFieldSelectorDecoration(
TranslationBase.of(context).specifyPossibleLineManagement, TranslationBase.of(context)
.specifyPossibleLineManagement,
null, null,
false), false),
enabled: true, enabled: true,
@ -325,8 +341,7 @@ class _UCAFInputScreenState extends State<UCAFInputScreen> {
height: 16, height: 16,
), ),
AppText( AppText(
TranslationBase.of(context) TranslationBase.of(context).significantSigns,
.significantSigns,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontSize: SizeConfig.textMultiplier * 2.0, fontSize: SizeConfig.textMultiplier * 2.0,
), ),
@ -342,8 +357,6 @@ class _UCAFInputScreenState extends State<UCAFInputScreen> {
enabled: true, enabled: true,
controller: _signsController, controller: _signsController,
keyboardType: TextInputType.text, keyboardType: TextInputType.text,
minLines: 4,
maxLines: 6,
)), )),
SizedBox( SizedBox(
height: 16, height: 16,
@ -352,7 +365,9 @@ class _UCAFInputScreenState extends State<UCAFInputScreen> {
title: TranslationBase.of(context).next, title: TranslationBase.of(context).next,
color: HexColor("#B8382B"), color: HexColor("#B8382B"),
onPressed: () { onPressed: () {
Navigator.of(context).pushNamed(PATIENT_UCAF_DETAIL, arguments: {'patient': patient}); Navigator.of(context).pushNamed(
PATIENT_UCAF_DETAIL,
arguments: {'patient': patient});
}, },
), ),
], ],
@ -360,6 +375,18 @@ class _UCAFInputScreenState extends State<UCAFInputScreen> {
), ),
], ],
), ),
)
: Container(
child: Center(
child: AppText(
model.patientVitalSigns == null
? TranslationBase.of(context).vitalSignEmptyMsg
: TranslationBase.of(context).chiefComplaintEmptyMsg,
fontWeight: FontWeight.normal,
color: HexColor("#B8382B"),
fontSize: SizeConfig.textMultiplier * 2.5,
),
),
), ),
), ),
); );

@ -124,7 +124,10 @@ class _AdmissionRequestDetailScreenState
ListSelectDialog dialog = ListSelectDialog dialog =
ListSelectDialog( ListSelectDialog(
list: model.speciality, list: model.speciality,
attributeName: model.selectedLanguage == 'ar' ? 'nameAr' :'nameEn' , attributeName:
model.selectedLanguage == 'ar'
? 'nameAr'
: 'nameEn',
attributeValueId: 'id', attributeValueId: 'id',
okText: okText:
TranslationBase.of(context) TranslationBase.of(context)
@ -149,7 +152,12 @@ class _AdmissionRequestDetailScreenState
TranslationBase.of(context) TranslationBase.of(context)
.speciality, .speciality,
_selectedSpeciality != null _selectedSpeciality != null
? model.selectedLanguage == 'ar' ? _selectedSpeciality['nameAr'] : _selectedSpeciality['nameEn'] ? model.selectedLanguage ==
'ar'
? _selectedSpeciality[
'nameAr']
: _selectedSpeciality[
'nameEn']
: null, : null,
true), true),
enabled: false, enabled: false,
@ -170,10 +178,13 @@ class _AdmissionRequestDetailScreenState
list: model.doctorsList, list: model.doctorsList,
attributeName: 'DoctorName', attributeName: 'DoctorName',
attributeValueId: 'DoctorID', attributeValueId: 'DoctorID',
okText: TranslationBase.of(context).ok, okText:
TranslationBase.of(context)
.ok,
okFunction: (selectedValue) { okFunction: (selectedValue) {
setState(() { setState(() {
_selectedDoctor = selectedValue; _selectedDoctor =
selectedValue;
}); });
}, },
); );
@ -187,10 +198,13 @@ class _AdmissionRequestDetailScreenState
} }
: null, : null,
child: TextField( child: TextField(
decoration: Helpers.textFieldSelectorDecoration( decoration:
TranslationBase.of(context).doctor, Helpers.textFieldSelectorDecoration(
TranslationBase.of(context)
.doctor,
_selectedDoctor != null _selectedDoctor != null
? _selectedDoctor['DoctorName'] ? _selectedDoctor[
'DoctorName']
: null, : null,
true), true),
enabled: false, enabled: false,
@ -202,17 +216,16 @@ class _AdmissionRequestDetailScreenState
), ),
Container( Container(
height: screenSize.height * 0.070, height: screenSize.height * 0.070,
decoration: decoration: Helpers.containerBorderDecoration(
Helpers.containerBorderDecoration( Color(0xFFEEEEEE), Color(0xFFCCCCCC),
Color(0xFFEEEEEE),
Color(0xFFCCCCCC),
borderWidth: 0.0), borderWidth: 0.0),
child: InkWell( child: InkWell(
onTap: () => null, onTap: () => null,
child: TextField( child: TextField(
decoration: decoration:
Helpers.textFieldSelectorDecoration( Helpers.textFieldSelectorDecoration(
TranslationBase.of(context).referringDate, TranslationBase.of(context)
.referringDate,
null, null,
true, true,
suffixIcon: Icon( suffixIcon: Icon(
@ -236,9 +249,11 @@ class _AdmissionRequestDetailScreenState
child: TextField( child: TextField(
decoration: decoration:
Helpers.textFieldSelectorDecoration( Helpers.textFieldSelectorDecoration(
TranslationBase.of(context).referringDoctor, TranslationBase.of(context)
.referringDoctor,
null, null,
true, dropDownColor: Color(0xFFCCCCCC)), true,
dropDownColor: Color(0xFFCCCCCC)),
enabled: false, enabled: false,
// controller: _remarksController, // controller: _remarksController,
keyboardType: TextInputType.text, keyboardType: TextInputType.text,
@ -256,7 +271,9 @@ class _AdmissionRequestDetailScreenState
title: TranslationBase.of(context).next, title: TranslationBase.of(context).next,
color: HexColor("#B8382B"), color: HexColor("#B8382B"),
onPressed: () { onPressed: () {
Navigator.of(context).pushNamed(PATIENT_ADMISSION_REQUEST_2, arguments: {'patient': patient}); Navigator.of(context).pushNamed(
PATIENT_ADMISSION_REQUEST_2,
arguments: {'patient': patient});
}, },
), ),
), ),

@ -139,13 +139,13 @@ class _AdmissionRequestSecondScreenState
_emergencyAdmission = newValue; _emergencyAdmission = newValue;
}); });
}, },
controlAffinity: ListTileControlAffinity.leading, controlAffinity:
ListTileControlAffinity.leading,
contentPadding: EdgeInsets.all(0), contentPadding: EdgeInsets.all(0),
), ),
CheckboxListTile( CheckboxListTile(
title: AppText( title: AppText(
TranslationBase.of(context) TranslationBase.of(context).patientPregnant,
.patientPregnant,
fontWeight: FontWeight.normal, fontWeight: FontWeight.normal,
fontSize: SizeConfig.textMultiplier * 2.1, fontSize: SizeConfig.textMultiplier * 2.1,
), ),
@ -155,13 +155,16 @@ class _AdmissionRequestSecondScreenState
_patientPregnant = newValue; _patientPregnant = newValue;
}); });
}, },
controlAffinity: ListTileControlAffinity.leading, controlAffinity:
ListTileControlAffinity.leading,
contentPadding: EdgeInsets.all(0), contentPadding: EdgeInsets.all(0),
), ),
Container( Container(
child: TextField( child: TextField(
decoration: Helpers.textFieldSelectorDecoration( decoration:
TranslationBase.of(context).treatmentLine, Helpers.textFieldSelectorDecoration(
TranslationBase.of(context)
.treatmentLine,
null, null,
false), false),
enabled: true, enabled: true,
@ -176,7 +179,8 @@ class _AdmissionRequestSecondScreenState
Container( Container(
height: screenSize.height * 0.070, height: screenSize.height * 0.070,
child: InkWell( child: InkWell(
onTap: /*model.doctorsList != null && onTap:
/*model.doctorsList != null &&
model.doctorsList.length > 0 model.doctorsList.length > 0
? () { ? () {
ListSelectDialog dialog = ListSelectDialog dialog =
@ -199,13 +203,16 @@ class _AdmissionRequestSecondScreenState
}, },
); );
} }
:*/ null, :*/
null,
child: TextField( child: TextField(
decoration: Helpers.textFieldSelectorDecoration( decoration:
Helpers.textFieldSelectorDecoration(
TranslationBase.of(context).ward, TranslationBase.of(context).ward,
/* _selectedWard != null /* _selectedWard != null
? _selectedWard['DoctorName'] ? _selectedWard['DoctorName']
:*/ null, :*/
null,
true), true),
enabled: false, enabled: false,
), ),
@ -224,13 +231,15 @@ class _AdmissionRequestSecondScreenState
_preAnesthesiaReferred = newValue; _preAnesthesiaReferred = newValue;
}); });
}, },
controlAffinity: ListTileControlAffinity.leading, controlAffinity:
ListTileControlAffinity.leading,
contentPadding: EdgeInsets.all(0), contentPadding: EdgeInsets.all(0),
), ),
Container( Container(
height: screenSize.height * 0.070, height: screenSize.height * 0.070,
child: InkWell( child: InkWell(
onTap: /*model.doctorsList != null && onTap:
/*model.doctorsList != null &&
model.doctorsList.length > 0 model.doctorsList.length > 0
? () { ? () {
ListSelectDialog dialog = ListSelectDialog dialog =
@ -253,13 +262,17 @@ class _AdmissionRequestSecondScreenState
}, },
); );
} }
:*/ null, :*/
null,
child: TextField( child: TextField(
decoration: Helpers.textFieldSelectorDecoration( decoration:
TranslationBase.of(context).admissionType, Helpers.textFieldSelectorDecoration(
TranslationBase.of(context)
.admissionType,
/* _admissionType != null /* _admissionType != null
? _admissionType['DoctorName'] ? _admissionType['DoctorName']
:*/ null, :*/
null,
true), true),
enabled: false, enabled: false,
), ),
@ -271,7 +284,8 @@ class _AdmissionRequestSecondScreenState
Container( Container(
height: screenSize.height * 0.070, height: screenSize.height * 0.070,
child: InkWell( child: InkWell(
onTap: /*model.doctorsList != null && onTap:
/*model.doctorsList != null &&
model.doctorsList.length > 0 model.doctorsList.length > 0
? () { ? () {
ListSelectDialog dialog = ListSelectDialog dialog =
@ -294,13 +308,17 @@ class _AdmissionRequestSecondScreenState
}, },
); );
} }
:*/ null, :*/
null,
child: TextField( child: TextField(
decoration: Helpers.textFieldSelectorDecoration( decoration:
TranslationBase.of(context).diagnosis, Helpers.textFieldSelectorDecoration(
TranslationBase.of(context)
.diagnosis,
/* _admissionType != null /* _admissionType != null
? _admissionType['DoctorName'] ? _admissionType['DoctorName']
:*/ null, :*/
null,
true), true),
enabled: false, enabled: false,
), ),
@ -311,8 +329,10 @@ class _AdmissionRequestSecondScreenState
), ),
Container( Container(
child: TextField( child: TextField(
decoration: Helpers.textFieldSelectorDecoration( decoration:
TranslationBase.of(context).preOperativeOrders, Helpers.textFieldSelectorDecoration(
TranslationBase.of(context)
.preOperativeOrders,
null, null,
false), false),
enabled: true, enabled: true,
@ -327,7 +347,8 @@ class _AdmissionRequestSecondScreenState
Container( Container(
height: screenSize.height * 0.070, height: screenSize.height * 0.070,
child: InkWell( child: InkWell(
onTap: /*model.doctorsList != null && onTap:
/*model.doctorsList != null &&
model.doctorsList.length > 0 model.doctorsList.length > 0
? () { ? () {
ListSelectDialog dialog = ListSelectDialog dialog =
@ -350,13 +371,17 @@ class _AdmissionRequestSecondScreenState
}, },
); );
} }
:*/ null, :*/
null,
child: TextField( child: TextField(
decoration: Helpers.textFieldSelectorDecoration( decoration:
TranslationBase.of(context).allergies, Helpers.textFieldSelectorDecoration(
TranslationBase.of(context)
.allergies,
/* _admissionType != null /* _admissionType != null
? _admissionType['DoctorName'] ? _admissionType['DoctorName']
:*/ null, :*/
null,
true), true),
enabled: false, enabled: false,
), ),
@ -375,7 +400,9 @@ class _AdmissionRequestSecondScreenState
title: TranslationBase.of(context).next, title: TranslationBase.of(context).next,
color: HexColor("#B8382B"), color: HexColor("#B8382B"),
onPressed: () { onPressed: () {
Navigator.of(context).pushNamed(PATIENT_ADMISSION_REQUEST_3, arguments: {'patient': patient}); Navigator.of(context).pushNamed(
PATIENT_ADMISSION_REQUEST_3,
arguments: {'patient': patient});
}, },
), ),
), ),

@ -5,78 +5,235 @@ import 'package:doctor_app_flutter/core/enum/viewstate.dart';
import 'package:doctor_app_flutter/core/model/post_prescrition_req_model.dart'; import 'package:doctor_app_flutter/core/model/post_prescrition_req_model.dart';
import 'package:doctor_app_flutter/core/viewModel/prescription_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/prescription_view_model.dart';
import 'package:doctor_app_flutter/models/livecare/transfer_to_admin.dart'; import 'package:doctor_app_flutter/models/livecare/transfer_to_admin.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/screens/prescription/prescription_screen.dart'; import 'package:doctor_app_flutter/screens/prescription/prescription_screen.dart';
import 'package:doctor_app_flutter/screens/prescription/prescription_warnings.dart'; import 'package:doctor_app_flutter/screens/prescription/prescription_warnings.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/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/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/patients/dynamic_elements.dart'; import 'package:doctor_app_flutter/widgets/patients/dynamic_elements.dart';
import 'package:doctor_app_flutter/widgets/shared/TextFields.dart'; import 'package:doctor_app_flutter/widgets/shared/TextFields.dart';
import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_buttons_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';
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';
class AddPrescriptionFormScreen extends StatefulWidget { addPrescriptionForm(
@override context, PrescriptionViewModel model, PatiantInformtion patient) {
_AddPrescriptionFormScreenState createState() => showModalBottomSheet(
_AddPrescriptionFormScreenState(); isScrollControlled: true,
context: context,
builder: (BuildContext bc) {
return PrescriptionFormWidget(model, patient);
});
} }
class _AddPrescriptionFormScreenState extends State<AddPrescriptionFormScreen> { postProcedure(
PrescriptionViewModel model = PrescriptionViewModel(); {String duration,
// PostPrescriptionReqModel addPrescriptionModel = PostPrescriptionReqModel(); String doseTimeIn,
// List<PrescriptionRequestModel> sss = List(); String dose,
// void _presentDatePicker(id) { String drugId,
// showDatePicker( String strength,
// context: context, String route,
// initialDate: DateTime.now(), String frequency,
// firstDate: DateTime(2019), String indication,
// lastDate: DateTime(2050), String instruction,
// ).then((pickedDate) { PrescriptionViewModel model,
// if (pickedDate == null) { DateTime doseTime,
// return; PatiantInformtion patient}) async {
// } PostPrescriptionReqModel postProcedureReqModel =
// setState(() { new PostPrescriptionReqModel();
// // var selectedDate = DateFormat.yMd().format(pickedDate); List<PrescriptionRequestModel> sss = List();
// final df = new DateFormat('yyyy-MM-dd');
// model.startDate = df.format(pickedDate); postProcedureReqModel.appointmentNo = 2016055159;
// postProcedureReqModel.clinicID = 17;
// strengthController.text = sss.add(PrescriptionRequestModel(doseStartDate: '')); postProcedureReqModel.episodeID = 200012330;
// //addSickLeave.startDate = selectedDate; postProcedureReqModel.patientMRN = 3120877;
// }); postProcedureReqModel.vidaAuthTokenID =
// }); "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMDAyIiwianRpIjoiOGFjNDRjZGQtOWE0Mi00M2YxLWE2YTQtMWQ4NzBmZmYwNTUyIiwiZW1haWwiOiIiLCJpZCI6IjEwMDIiLCJOYW1lIjoiVEVNUCAtIERPQ1RPUiIsIkVtcGxveWVlSWQiOiI0NzA5IiwiRmFjaWxpdHlHcm91cElkIjoiMDEwMjY2IiwiRmFjaWxpdHlJZCI6IjE1IiwiUGhhcmFtY3lGYWNpbGl0eUlkIjoiNTUiLCJJU19QSEFSTUFDWV9DT05ORUNURUQiOiJUcnVlIiwiRG9jdG9ySWQiOiI0NzA5IiwiU0VTU0lPTklEIjoiMjE1OTU2NDkiLCJDbGluaWNJZCI6IjEiLCJyb2xlIjpbIkRPQ1RPUlMiLCJIRUFEIERPQ1RPUlMiLCJBRE1JTklTVFJBVE9SUyIsIlJFQ0VQVElPTklTVCIsIkVSIE5VUlNFIiwiRVIgUkVDRVBUSU9OSVNUIiwiUEhBUk1BQ1kgQUNDT1VOVCBTVEFGRiIsIlBIQVJNQUNZIE5VUlNFIiwiSU5QQVRJRU5UIFBIQVJNQUNJU1QiLCJBRE1JU1NJT04gU1RBRkYiLCJBUFBST1ZBTCBTVEFGRiIsIkNPTlNFTlQgIiwiTUVESUNBTCBSRVBPUlQgLSBTSUNLIExFQVZFIE1BTkFHRVIiXSwibmJmIjoxNjA4NzM2NjY5LCJleHAiOjE2MDk2MDA2NjksImlhdCI6MTYwODczNjY2OX0.9EDgYrbe5fQA2CvgLdFT4s_PL7hD5R_Qggfpv4lDtUY";
// } sss.add(PrescriptionRequestModel(
@override covered: true,
Widget build(BuildContext context) { dose: 1,
return addPrescriptionForm(context, model); itemId: int.parse(drugId),
doseUnitId: 1,
route: int.parse(route),
frequency: int.parse(frequency),
remarks: instruction,
approvalRequired: true,
icdcode10Id: "test2",
doseTime: int.parse(doseTimeIn),
duration: int.parse(duration),
doseStartDate: doseTime.toIso8601String()));
postProcedureReqModel.prescriptionRequestModel = sss;
//postProcedureReqModel.procedures = controlsProcedure;
await model.postPrescription(postProcedureReqModel, patient.patientMRN);
if (model.state == ViewState.ErrorLocal) {
helpers.showErrorToast(model.error);
} else if (model.state == ViewState.Idle) {
DrAppToastMsg.showSuccesToast('Medication has been added');
} }
} }
addPrescriptionForm(context, PrescriptionViewModel model) { class PrescriptionFormWidget extends StatefulWidget {
final PrescriptionViewModel model;
PatiantInformtion patient;
PrescriptionFormWidget(this.model, this.patient);
@override
_PrescriptionFormWidgetState createState() => _PrescriptionFormWidgetState();
}
class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
TextEditingController durationController = TextEditingController(); TextEditingController durationController = TextEditingController();
TextEditingController strengthController = TextEditingController(); TextEditingController strengthController = TextEditingController();
TextEditingController routeController = TextEditingController(); TextEditingController routeController = TextEditingController();
TextEditingController frequencyController = TextEditingController(); TextEditingController frequencyController = TextEditingController();
TextEditingController indicationController = TextEditingController(); TextEditingController indicationController = TextEditingController();
TextEditingController instructionController = TextEditingController(); TextEditingController instructionController = TextEditingController();
DateTime selectedDate;
dynamic selectedDrug;
TextEditingController drugIdController = TextEditingController(); TextEditingController drugIdController = TextEditingController();
TextEditingController doseController = TextEditingController(); TextEditingController doseController = TextEditingController();
final GlobalKey<FormState> formKey = GlobalKey<FormState>(); final GlobalKey<FormState> formKey = GlobalKey<FormState>();
final double spaceBetweenTextFileds = 12; final double spaceBetweenTextFileds = 12;
List<dynamic> referToList;
dynamic type;
dynamic strength;
dynamic route;
dynamic frequency;
dynamic duration;
dynamic doseTime;
showModalBottomSheet( List<dynamic> strengthList;
isScrollControlled: true, List<dynamic> routeList;
context: context, List<dynamic> frequencyList;
builder: (BuildContext bc) { List<dynamic> durationList;
return //BaseView<PrescriptionViewModel>( List<dynamic> doseTimeList;
//onModelReady: (model) => model.getDrugs(), //PatiantInformtion patient;
//builder: (BuildContext context, PrescriptionViewModel model, dynamic _strength;
//Widget child) => dynamic _selectedBranch;
@override
void initState() {
super.initState();
referToList = List();
strengthList = List();
routeList = List();
frequencyList = List();
durationList = List();
doseTimeList = List();
dynamic regularOrder = {"id": 1, "name": "regular Order"};
dynamic urgentOrder = {"id": 2, "name": "urgent Order"};
dynamic strength1 = {"id": 1, "name": "1"};
dynamic strength2 = {"id": 2, "name": "2"};
dynamic strength3 = {"id": 3, "name": "3"};
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"};
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 duration1 = {"id": 1, "name": "For 1 Day"};
dynamic duration2 = {"id": 2, "name": "For 2 Days"};
dynamic duration3 = {"id": 3, "name": "For 3 Days"};
dynamic duration4 = {"id": 4, "name": "For 4 Days"};
dynamic duration5 = {"id": 5, "name": "For 5 Days"};
dynamic duration6 = {"id": 6, "name": "For 6 Days"};
dynamic duration7 = {"id": 7, "name": "For 7 Days"};
dynamic duration8 = {"id": 8, "name": "For 8 Days"};
dynamic duration9 = {"id": 9, "name": "For 9 Days"};
dynamic duration10 = {"id": 10, "name": "For 10 Days"};
dynamic duration11 = {"id": 14, "name": "For 14 Days"};
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"};
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);
frequencyList.add(frequency1);
frequencyList.add(frequency2);
frequencyList.add(frequency3);
frequencyList.add(frequency4);
frequencyList.add(frequency5);
frequencyList.add(frequency6);
frequencyList.add(frequency7);
frequencyList.add(frequency8);
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);
strengthList.add(strength1);
strengthList.add(strength2);
strengthList.add(strength3);
durationList.add(duration1);
durationList.add(duration2);
durationList.add(duration3);
durationList.add(duration4);
durationList.add(duration5);
durationList.add(duration6);
durationList.add(duration7);
durationList.add(duration8);
durationList.add(duration9);
durationList.add(duration10);
durationList.add(duration11);
referToList.add(regularOrder);
referToList.add(urgentOrder);
}
@override
Widget build(BuildContext context) {
final screenSize = MediaQuery.of(context).size;
// final routeArgs = ModalRoute.of(context).settings.arguments as Map;
// patient = routeArgs['patient'];
return BaseView<PrescriptionViewModel>(
onModelReady: (model) => model.getDrugs(),
builder: (BuildContext context, PrescriptionViewModel model,
Widget child) =>
DraggableScrollableSheet( DraggableScrollableSheet(
initialChildSize: 0.90, initialChildSize: 0.90,
maxChildSize: 0.90, maxChildSize: 0.90,
@ -94,9 +251,7 @@ addPrescriptionForm(context, PrescriptionViewModel model) {
//mainAxisAlignment: MainAxisAlignment.spaceEvenly, //mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [ children: [
AppText( AppText(
TranslationBase.of(context) TranslationBase.of(context).medicines.toUpperCase(),
.medicines
.toUpperCase(),
fontWeight: FontWeight.w900, fontWeight: FontWeight.w900,
), ),
SizedBox( SizedBox(
@ -109,126 +264,259 @@ addPrescriptionForm(context, PrescriptionViewModel model) {
//mainAxisAlignment: MainAxisAlignment.end, //mainAxisAlignment: MainAxisAlignment.end,
children: [ children: [
Container( Container(
decoration: BoxDecoration( height: screenSize.height * 0.070,
borderRadius: BorderRadius.all( child: InkWell(
Radius.circular(6.0)), onTap: model.drugsList != null &&
border: Border.all( model.drugsList.length > 0
width: 1.0, ? () {
color: HexColor("#CCCCCC"))), ListSelectDialog dialog =
child: TextFields( ListSelectDialog(
hintText: TranslationBase.of(context) list: model.drugsList,
.searchMedicine, attributeName: 'GenericName',
controller: drugIdController, attributeValueId: 'ItemId',
keyboardType: TextInputType.number, okText:
validator: (value) { TranslationBase.of(context)
if (value.isEmpty) .ok,
return TranslationBase.of(context) okFunction: (selectedValue) {
.emptyMessage; setState(() {
else selectedDrug =
return null; selectedValue;
}), });
},
);
showDialog(
barrierDismissible: false,
context: context,
builder:
(BuildContext context) {
return dialog;
},
);
}
: null,
child: TextField(
decoration: textFieldSelectorDecoration(
TranslationBase.of(context).search,
selectedDrug != null
? selectedDrug['GenericName']
: null,
true),
enabled: false,
),
),
), ),
SizedBox( SizedBox(
height: spaceBetweenTextFileds, height: spaceBetweenTextFileds,
), ),
Container( Container(
decoration: BoxDecoration( height: screenSize.height * 0.070,
borderRadius: BorderRadius.all( child: InkWell(
Radius.circular(6.0)), onTap: referToList != null
border: Border.all( ? () {
width: 1.0, ListSelectDialog dialog =
color: HexColor("#CCCCCC"))), ListSelectDialog(
child: TextFields( list: referToList,
hintText: TranslationBase.of(context) attributeName: 'name',
attributeValueId: 'id',
okText:
TranslationBase.of(context)
.ok,
okFunction: (selectedValue) {
setState(() {
type = selectedValue;
_selectedBranch = null;
});
},
);
showDialog(
barrierDismissible: false,
context: context,
builder:
(BuildContext context) {
return dialog;
},
);
}
: null,
child: TextField(
decoration: textFieldSelectorDecoration(
TranslationBase.of(context)
.orderType, .orderType,
type != null ? type['name'] : null,
true),
enabled: false,
),
), ),
), ),
SizedBox(height: spaceBetweenTextFileds), SizedBox(height: spaceBetweenTextFileds),
Container( Container(
decoration: BoxDecoration( height: screenSize.height * 0.070,
borderRadius: BorderRadius.all( child: InkWell(
Radius.circular(6.0)), onTap: strengthList != null
border: Border.all( ? () {
width: 1.0, ListSelectDialog dialog =
color: HexColor("#CCCCCC"))), ListSelectDialog(
child: TextFields( list: strengthList,
hintText: TranslationBase.of(context) attributeName: 'name',
.strength, attributeValueId: 'id',
keyboardType: TextInputType.number, okText:
controller: strengthController, TranslationBase.of(context)
validator: (value) { .ok,
if (value.isEmpty) okFunction: (selectedValue) {
return TranslationBase.of(context) setState(() {
.emptyMessage; strength = selectedValue;
else _selectedBranch = null;
return null; });
},
);
showDialog(
barrierDismissible: false,
context: context,
builder:
(BuildContext context) {
return dialog;
}, },
);
}
: null,
child: TextField(
decoration: textFieldSelectorDecoration(
TranslationBase.of(context)
.strength,
strength != null
? strength['name']
: null,
true),
enabled: false,
),
), ),
), ),
SizedBox(height: spaceBetweenTextFileds), SizedBox(height: spaceBetweenTextFileds),
Container( Container(
decoration: BoxDecoration( height: screenSize.height * 0.070,
borderRadius: BorderRadius.all( child: InkWell(
Radius.circular(6.0)), onTap: routeList != null
border: Border.all( ? () {
width: 1.0, ListSelectDialog dialog =
color: HexColor("#CCCCCC"))), ListSelectDialog(
child: TextFields( list: routeList,
hintText: attributeName: 'name',
TranslationBase.of(context).route, attributeValueId: 'id',
controller: routeController, okText:
keyboardType: TextInputType.number, TranslationBase.of(context)
validator: (value) { .ok,
if (value.isEmpty) okFunction: (selectedValue) {
return TranslationBase.of(context) setState(() {
.emptyMessage; route = selectedValue;
else _selectedBranch = null;
return null; });
}, },
);
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(height: spaceBetweenTextFileds), SizedBox(height: spaceBetweenTextFileds),
Container( Container(
decoration: BoxDecoration( height: screenSize.height * 0.070,
borderRadius: BorderRadius.all( child: InkWell(
Radius.circular(6.0)), onTap: frequencyList != null
border: Border.all( ? () {
width: 1.0, ListSelectDialog dialog =
color: HexColor("#CCCCCC"))), ListSelectDialog(
child: TextFields( list: frequencyList,
hintText: TranslationBase.of(context) attributeName: 'name',
.frequency, attributeValueId: 'id',
controller: frequencyController, okText:
keyboardType: TextInputType.number, TranslationBase.of(context)
validator: (value) { .ok,
if (value.isEmpty) okFunction: (selectedValue) {
return TranslationBase.of(context) setState(() {
.emptyMessage; frequency = selectedValue;
else _selectedBranch = null;
return null; });
},
);
showDialog(
barrierDismissible: false,
context: context,
builder:
(BuildContext context) {
return dialog;
}, },
);
}
: null,
child: TextField(
decoration: textFieldSelectorDecoration(
TranslationBase.of(context)
.frequency,
frequency != null
? frequency['name']
: null,
true),
enabled: false,
),
), ),
), ),
SizedBox(height: spaceBetweenTextFileds), SizedBox(height: spaceBetweenTextFileds),
Container( Container(
decoration: BoxDecoration( height: screenSize.height * 0.070,
borderRadius: BorderRadius.all( child: InkWell(
Radius.circular(6.0)), onTap: doseTimeList != null
border: Border.all( ? () {
width: 1.0, ListSelectDialog dialog =
color: HexColor("#CCCCCC"))), ListSelectDialog(
child: TextFields( list: doseTimeList,
hintText: TranslationBase.of(context) attributeName: 'name',
.doseTime, attributeValueId: 'id',
controller: doseController, okText:
keyboardType: TextInputType.number, TranslationBase.of(context)
validator: (value) { .ok,
if (value.isEmpty) okFunction: (selectedValue) {
return TranslationBase.of(context) setState(() {
.emptyMessage; doseTime = selectedValue;
else _selectedBranch = null;
return null; });
},
);
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(height: spaceBetweenTextFileds), SizedBox(height: spaceBetweenTextFileds),
@ -255,46 +543,69 @@ addPrescriptionForm(context, PrescriptionViewModel model) {
), ),
SizedBox(height: spaceBetweenTextFileds), SizedBox(height: spaceBetweenTextFileds),
Container( Container(
decoration: BoxDecoration( height: screenSize.height * 0.070,
borderRadius: BorderRadius.all( child: InkWell(
Radius.circular(6.0)), onTap: () =>
border: Border.all( selectDate(context, widget.model),
width: 1.0, child: TextField(
color: HexColor("#CCCCCC"))), decoration:
child: TextFields( Helpers.textFieldSelectorDecoration(
hintText: TranslationBase.of(context) TranslationBase.of(context)
.fromDate, .date,
keyboardType: TextInputType.datetime, selectedDate != null
validator: (value) { ? "${DateUtils.convertStringToDateFormat(selectedDate.toString(), "yyyy-MM-dd")}"
if (value.isEmpty) : null,
return TranslationBase.of(context) true,
.emptyMessage; suffixIcon: Icon(
else Icons.calendar_today,
return null; color: Colors.black,
}, )),
enabled: false,
),
), ),
), ),
SizedBox(height: spaceBetweenTextFileds), SizedBox(height: spaceBetweenTextFileds),
Container( Container(
decoration: BoxDecoration( height: screenSize.height * 0.070,
borderRadius: BorderRadius.all( child: InkWell(
Radius.circular(6.0)), onTap: durationList != null
border: Border.all( ? () {
width: 1.0, ListSelectDialog dialog =
color: HexColor("#CCCCCC"))), ListSelectDialog(
child: TextFields( list: durationList,
hintText: TranslationBase.of(context) attributeName: 'name',
attributeValueId: 'id',
okText:
TranslationBase.of(context)
.ok,
okFunction: (selectedValue) {
setState(() {
duration = selectedValue;
_selectedBranch = null;
});
},
);
showDialog(
barrierDismissible: false,
context: context,
builder:
(BuildContext context) {
return dialog;
},
);
}
: null,
child: TextField(
decoration: textFieldSelectorDecoration(
TranslationBase.of(context)
.duration, .duration,
// borderColor: Colors.white, duration != null
keyboardType: TextInputType.number, ? duration['name']
controller: durationController, : null,
validator: (value) { true),
if (value.isEmpty) enabled: false,
return TranslationBase.of(context) ),
.emptyMessage; ),
else
return null;
}),
), ),
SizedBox(height: spaceBetweenTextFileds), SizedBox(height: spaceBetweenTextFileds),
Container( Container(
@ -336,21 +647,25 @@ addPrescriptionForm(context, PrescriptionViewModel model) {
if (formKey.currentState if (formKey.currentState
.validate()) { .validate()) {
postProcedure( postProcedure(
model: model, patient: widget.patient,
doseTimeIn:
doseTime['id'].toString(),
model: widget.model,
duration: duration:
durationController.text, duration['id'].toString(),
dose: doseController.text, frequency: frequency['id']
frequency: .toString(),
frequencyController.text, route: route['id'].toString(),
route: routeController.text, drugId: selectedDrug['ItemId']
drugId: drugIdController.text, .toString(),
strength: strength:
strengthController.text, strength['id'].toString(),
indication: indication:
indicationController.text, indicationController.text,
instruction: instruction:
indicationController.text, instructionController
); .text,
doseTime: selectedDate);
Navigator.pop(context); Navigator.pop(context);
} }
{ {
@ -375,69 +690,56 @@ addPrescriptionForm(context, PrescriptionViewModel model) {
), ),
), ),
); );
}); }),
//); );
});
} }
// openAllergiesList(BuildContext context) { selectDate(BuildContext context, PrescriptionViewModel model) async {
// showModalBottomSheet( DateTime selectedDate;
// backgroundColor: Colors.white, selectedDate = DateTime.now().add(Duration(hours: 15));
// isScrollControlled: true, final DateTime picked = await showDatePicker(
// context: context, context: context,
// builder: (context) { initialDate: selectedDate,
// return AddAllergies( firstDate: DateTime.now().add(Duration(hours: 15)),
// addAllergiesFun: (MySelectedAllergy mySelectedAllergy) { lastDate: DateTime(2040),
// setState(() { initialEntryMode: DatePickerEntryMode.calendar,
// widget.myAllergiesList.add(mySelectedAllergy); );
// Navigator.of(context).pop(); if (picked != null && picked != selectedDate) {
// }); setState(() {
// }, this.selectedDate = picked;
// ); });
// }); }
// } }
postProcedure(
{String duration,
String dose,
String drugId,
String strength,
String route,
String frequency,
String indication,
String instruction,
PrescriptionViewModel model}) async {
PostPrescriptionReqModel postProcedureReqModel =
new PostPrescriptionReqModel();
List<PrescriptionRequestModel> sss = List();
postProcedureReqModel.appointmentNo = 2016055159;
postProcedureReqModel.clinicID = 17;
postProcedureReqModel.episodeID = 200012330;
postProcedureReqModel.patientMRN = 3120877;
postProcedureReqModel.vidaAuthTokenID =
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMDAyIiwianRpIjoiOGFjNDRjZGQtOWE0Mi00M2YxLWE2YTQtMWQ4NzBmZmYwNTUyIiwiZW1haWwiOiIiLCJpZCI6IjEwMDIiLCJOYW1lIjoiVEVNUCAtIERPQ1RPUiIsIkVtcGxveWVlSWQiOiI0NzA5IiwiRmFjaWxpdHlHcm91cElkIjoiMDEwMjY2IiwiRmFjaWxpdHlJZCI6IjE1IiwiUGhhcmFtY3lGYWNpbGl0eUlkIjoiNTUiLCJJU19QSEFSTUFDWV9DT05ORUNURUQiOiJUcnVlIiwiRG9jdG9ySWQiOiI0NzA5IiwiU0VTU0lPTklEIjoiMjE1OTU2NDkiLCJDbGluaWNJZCI6IjEiLCJyb2xlIjpbIkRPQ1RPUlMiLCJIRUFEIERPQ1RPUlMiLCJBRE1JTklTVFJBVE9SUyIsIlJFQ0VQVElPTklTVCIsIkVSIE5VUlNFIiwiRVIgUkVDRVBUSU9OSVNUIiwiUEhBUk1BQ1kgQUNDT1VOVCBTVEFGRiIsIlBIQVJNQUNZIE5VUlNFIiwiSU5QQVRJRU5UIFBIQVJNQUNJU1QiLCJBRE1JU1NJT04gU1RBRkYiLCJBUFBST1ZBTCBTVEFGRiIsIkNPTlNFTlQgIiwiTUVESUNBTCBSRVBPUlQgLSBTSUNLIExFQVZFIE1BTkFHRVIiXSwibmJmIjoxNjA4NzM2NjY5LCJleHAiOjE2MDk2MDA2NjksImlhdCI6MTYwODczNjY2OX0.9EDgYrbe5fQA2CvgLdFT4s_PL7hD5R_Qggfpv4lDtUY";
sss.add(PrescriptionRequestModel(
covered: true,
dose: int.parse(dose),
itemId: int.parse(drugId),
doseUnitId: 1,
route: int.parse(route),
frequency: int.parse(frequency),
remarks: instruction,
approvalRequired: true,
icdcode10Id: "test2",
doseTime: 1,
duration: int.parse(duration),
doseStartDate: "2020-12-20T13:07:41.769Z"));
postProcedureReqModel.prescriptionRequestModel = sss;
//postProcedureReqModel.procedures = controlsProcedure;
await model.postPrescription(postProcedureReqModel);
if (model.state == ViewState.ErrorLocal) { InputDecoration textFieldSelectorDecoration(
helpers.showErrorToast(model.error); String hintText, String selectedText, bool isDropDown,
} else if (model.state == ViewState.Idle) { {Icon suffixIcon}) {
DrAppToastMsg.showSuccesToast('Medication has been added'); 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,
),
);
} }
} }

@ -33,12 +33,13 @@ class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final screenSize = MediaQuery.of(context).size;
final routeArgs = ModalRoute.of(context).settings.arguments as Map; final routeArgs = ModalRoute.of(context).settings.arguments as Map;
patient = routeArgs['patient']; patient = routeArgs['patient'];
return BaseView<PrescriptionViewModel>( return BaseView<PrescriptionViewModel>(
onModelReady: (model) => model.getPrescription(), onModelReady: (model) => model.getPrescription(mrn: patient.patientMRN),
builder: (BuildContext context, PrescriptionViewModel model, builder:
Widget child) => (BuildContext context, PrescriptionViewModel model, Widget child) =>
AppScaffold( AppScaffold(
isShowAppBar: true, isShowAppBar: true,
appBarTitle: TranslationBase.of(context).prescription, appBarTitle: TranslationBase.of(context).prescription,
@ -65,14 +66,17 @@ class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> {
width: 20, width: 20,
), ),
Column( Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment:
CrossAxisAlignment.start,
children: [ children: [
AppText( AppText(
patient.firstName + ' ' + patient.lastName, patient.firstName +
' ' +
patient.lastName,
color: Colors.black, color: Colors.black,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
if (model.prescriptionList.length > 0) //if (model.prescriptionList.length > 0)
Row( Row(
children: [ children: [
AppText( AppText(
@ -105,27 +109,32 @@ class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> {
thickness: 1.0, thickness: 1.0,
color: Colors.grey, color: Colors.grey,
), ),
if (model.prescriptionList.length != 0) (model.prescriptionList.length != 0)
SizedBox( ? SizedBox(
height: model.prescriptionList[0].rowcount == 0 height:
model.prescriptionList[0].rowcount == 0
? 200.0 ? 200.0
: 10.0), : 10.0)
: SizedBox(height: 200.0),
//model.prescriptionList == null //model.prescriptionList == null
if (model.prescriptionList.length != 0) (model.prescriptionList.length != 0)
model.prescriptionList[0].rowcount == 0 ? model.prescriptionList[0].rowcount == 0
? Column( ? Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment:
MainAxisAlignment.center,
crossAxisAlignment: crossAxisAlignment:
CrossAxisAlignment.stretch, CrossAxisAlignment.stretch,
children: [ children: [
InkWell( InkWell(
onTap: () { onTap: () {
addPrescriptionForm(context, model); addPrescriptionForm(
context, model, patient);
//model.postPrescription(); //model.postPrescription();
}, },
child: CircleAvatar( child: CircleAvatar(
radius: 65, radius: 65,
backgroundColor: Color(0XFFB8382C), backgroundColor:
Color(0XFFB8382C),
child: CircleAvatar( child: CircleAvatar(
radius: 60, radius: 60,
backgroundColor: Colors.white, backgroundColor: Colors.white,
@ -157,7 +166,8 @@ class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> {
MainAxisAlignment.center, MainAxisAlignment.center,
children: [ children: [
AppText( AppText(
TranslationBase.of(context).addNow, TranslationBase.of(context)
.addNow,
color: Color(0XFFB8382C), color: Color(0XFFB8382C),
fontWeight: FontWeight.w900, fontWeight: FontWeight.w900,
), ),
@ -181,10 +191,12 @@ class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> {
border: Border.all( border: Border.all(
color: Colors.grey), color: Colors.grey),
borderRadius: borderRadius:
BorderRadius.circular(10.0), BorderRadius.circular(
10.0),
), ),
child: Padding( child: Padding(
padding: EdgeInsets.all(8.0), padding:
EdgeInsets.all(8.0),
child: Row( child: Row(
mainAxisAlignment: mainAxisAlignment:
MainAxisAlignment MainAxisAlignment
@ -192,19 +204,22 @@ class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> {
children: [ children: [
AppText( AppText(
' Add more medication', ' Add more medication',
fontWeight: FontWeight.w100, fontWeight:
FontWeight.w100,
fontSize: 12.5, fontSize: 12.5,
), ),
Icon( Icon(
Icons.add, Icons.add,
color: Color(0XFFB8382C), color:
Color(0XFFB8382C),
) )
], ],
), ),
), ),
), ),
onTap: () { onTap: () {
addPrescriptionForm(context, model); addPrescriptionForm(
context, model, patient);
//model.postPrescription(); //model.postPrescription();
}, },
), ),
@ -212,7 +227,8 @@ class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> {
height: 15.0, height: 15.0,
), ),
...List.generate( ...List.generate(
model.prescriptionList[0].rowcount, model.prescriptionList[0]
.rowcount,
(index) => Container( (index) => Container(
//height: 240, //height: 240,
child: Column( child: Column(
@ -225,13 +241,13 @@ class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> {
// CrossAxisAlignment.start, // CrossAxisAlignment.start,
children: [ children: [
Container( Container(
height: height: MediaQuery.of(
MediaQuery.of(context) context)
.size .size
.height * .height *
0.23, 0.23,
width: width: MediaQuery.of(
MediaQuery.of(context) context)
.size .size
.width * .width *
0.09, 0.09,
@ -239,19 +255,20 @@ class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> {
children: [ children: [
AppText( AppText(
'8\nDEC', '8\nDEC',
color: Colors.green, color: Colors
.green,
) )
], ],
), ),
), ),
Container( Container(
height: height: MediaQuery.of(
MediaQuery.of(context) context)
.size .size
.height * .height *
0.282, 0.282,
width: width: MediaQuery.of(
MediaQuery.of(context) context)
.size .size
.width * .width *
0.77, 0.77,
@ -264,37 +281,38 @@ class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> {
fontWeight: fontWeight:
FontWeight FontWeight
.w700, .w700,
fontSize: 14.0, fontSize:
14.0,
), ),
Expanded( Expanded(
child: AppText( child:
AppText(
model model
.prescriptionList[ .prescriptionList[0]
0] .entityList[index]
.entityList[
index]
.startDate, .startDate,
fontSize: fontSize:
12.0, 12.0,
), ),
), ),
SizedBox( SizedBox(
width: 6.0, width:
6.0,
), ),
AppText( AppText(
'Order Type:', 'Order Type:',
fontWeight: fontWeight:
FontWeight FontWeight
.w700, .w700,
fontSize: 14.0, fontSize:
14.0,
), ),
Expanded( Expanded(
child: AppText( child:
AppText(
model model
.prescriptionList[ .prescriptionList[0]
0] .entityList[index]
.entityList[
index]
.orderTypeDescription, .orderTypeDescription,
fontSize: fontSize:
13.0, 13.0,
@ -308,18 +326,16 @@ class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> {
Row( Row(
children: [ children: [
Container( Container(
child: Expanded( child:
Expanded(
child: child:
AppText( AppText(
model model
.prescriptionList[ .prescriptionList[0]
0] .entityList[index]
.entityList[
index]
.medicationName, .medicationName,
fontWeight: fontWeight:
FontWeight FontWeight.w700,
.w700,
fontSize: fontSize:
15.0, 15.0,
), ),
@ -333,12 +349,11 @@ class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> {
Row( Row(
children: [ children: [
Expanded( Expanded(
child: AppText( child:
AppText(
model model
.prescriptionList[ .prescriptionList[0]
0] .entityList[index]
.entityList[
index]
.doseDetail, .doseDetail,
fontSize: fontSize:
15.0, 15.0,
@ -356,18 +371,16 @@ class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> {
fontWeight: fontWeight:
FontWeight FontWeight
.w700, .w700,
fontSize: 17.0, fontSize:
17.0,
), ),
Expanded( Expanded(
child: AppText( child: AppText(
model model
.prescriptionList[ .prescriptionList[0]
0] .entityList[index]
.entityList[
index]
.indication, .indication,
fontSize: fontSize: 15.0),
15.0),
) )
], ],
), ),
@ -377,16 +390,14 @@ class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> {
Row( Row(
children: [ children: [
Expanded( Expanded(
child: AppText( child:
AppText(
model model
.prescriptionList[ .prescriptionList[0]
0] .entityList[index]
.entityList[
index]
.doctorName, .doctorName,
fontWeight: fontWeight:
FontWeight FontWeight.w700,
.w700,
), ),
) )
], ],
@ -394,12 +405,11 @@ class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> {
Row( Row(
children: [ children: [
Expanded( Expanded(
child: AppText( child:
AppText(
model model
.prescriptionList[ .prescriptionList[0]
0] .entityList[index]
.entityList[
index]
.remarks, .remarks,
fontSize: fontSize:
14.0, 14.0,
@ -413,8 +423,10 @@ class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> {
Divider( Divider(
height: 0, height: 0,
thickness: 1.0, thickness:
color: Colors.grey, 1.0,
color: Colors
.grey,
), ),
// SizedBox( // SizedBox(
// height: 40, // height: 40,
@ -423,13 +435,13 @@ class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> {
), ),
), ),
Container( Container(
height: height: MediaQuery.of(
MediaQuery.of(context) context)
.size .size
.height * .height *
0.05, 0.05,
width: width: MediaQuery.of(
MediaQuery.of(context) context)
.size .size
.width * .width *
0.06, 0.06,
@ -437,7 +449,8 @@ class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> {
children: [ children: [
InkWell( InkWell(
child: Icon( child: Icon(
Icons.edit), Icons
.edit),
onTap: () { onTap: () {
updatePrescriptionForm( updatePrescriptionForm(
context, context,
@ -471,6 +484,59 @@ class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> {
), ),
), ),
) )
: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment:
CrossAxisAlignment.stretch,
children: [
InkWell(
onTap: () {
addPrescriptionForm(
context, model, patient);
//model.postPrescription();
},
child: CircleAvatar(
radius: 65,
backgroundColor: Color(0XFFB8382C),
child: CircleAvatar(
radius: 60,
backgroundColor: Colors.white,
child: Icon(
Icons.add,
color: Colors.black,
size: 45.0,
),
),
),
),
SizedBox(
height: 15.0,
),
Row(
mainAxisAlignment:
MainAxisAlignment.center,
children: [
AppText(
TranslationBase.of(context)
.noPrescriptionListed,
color: Colors.black,
fontWeight: FontWeight.w900,
),
],
),
Row(
mainAxisAlignment:
MainAxisAlignment.center,
children: [
AppText(
TranslationBase.of(context).addNow,
color: Color(0XFFB8382C),
fontWeight: FontWeight.w900,
),
],
),
],
)
], ],
), ),
), ),
@ -479,6 +545,23 @@ class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> {
); );
} }
selectDate(BuildContext context, PrescriptionViewModel model) async {
DateTime selectedDate;
selectedDate = DateTime.now();
final DateTime picked = await showDatePicker(
context: context,
initialDate: selectedDate,
firstDate: DateTime.now().add(Duration(hours: 2)),
lastDate: DateTime(2040),
initialEntryMode: DatePickerEntryMode.calendar,
);
if (picked != null && picked != selectedDate) {
setState(() {
selectedDate = picked;
});
}
}
void updatePrescriptionForm( void updatePrescriptionForm(
context, String drugName, int drugId, PrescriptionViewModel model) { context, String drugName, int drugId, PrescriptionViewModel model) {
TextEditingController remarksController = TextEditingController(); TextEditingController remarksController = TextEditingController();
@ -637,7 +720,8 @@ class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> {
updatePrescriptionReqModel.prescriptionRequestModel = sss; updatePrescriptionReqModel.prescriptionRequestModel = sss;
//postProcedureReqModel.procedures = controlsProcedure; //postProcedureReqModel.procedures = controlsProcedure;
await model.updatePrescription(updatePrescriptionReqModel); await model.updatePrescription(
updatePrescriptionReqModel, patient.patientMRN);
if (model.state == ViewState.ErrorLocal) { if (model.state == ViewState.ErrorLocal) {
helpers.showErrorToast(model.error); helpers.showErrorToast(model.error);

@ -509,7 +509,7 @@ class _AddSelectedProcedureState extends State<AddSelectedProcedure> {
baseViewModel: widget.model, baseViewModel: widget.model,
child: SingleChildScrollView( child: SingleChildScrollView(
child: Container( child: Container(
height: 790, height: 810,
child: Padding( child: Padding(
padding: EdgeInsets.all(12.0), padding: EdgeInsets.all(12.0),
child: Column( child: Column(
@ -566,7 +566,7 @@ class _AddSelectedProcedureState extends State<AddSelectedProcedure> {
maxLines: 5, maxLines: 5,
), ),
SizedBox( SizedBox(
height: 80.0, height: 50.0,
), ),
Container( Container(
margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5), margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5),

@ -299,7 +299,7 @@ class AddRescheduleLeavScreen extends StatelessWidget {
getDoctor(model, doctorId) { getDoctor(model, doctorId) {
var obj; var obj;
obj = model.where((i) => i['doctorID'].toString() == doctorId).toList(); obj = model.where((i) => i['doctorID'].toString() == doctorId).toList();
print(obj); //print(obj);
return obj.length > 0 ? obj[0]['doctorName'] : ""; return obj.length > 0 ? obj[0]['doctorName'] : "";
} }
@ -307,7 +307,7 @@ class AddRescheduleLeavScreen extends StatelessWidget {
getReasons(model, reasonID) { getReasons(model, reasonID) {
var obj; var obj;
obj = model.where((i) => i['id'] == reasonID).toList(); obj = model.where((i) => i['id'] == reasonID).toList();
print(obj); //print(obj);
return obj.length > 0 return obj.length > 0
? projectsProvider.isArabic == true ? projectsProvider.isArabic == true

@ -24,6 +24,7 @@ import 'package:hexcolor/hexcolor.dart';
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';
import 'package:doctor_app_flutter/models/sickleave/get_all_sickleave_response.dart'; import 'package:doctor_app_flutter/models/sickleave/get_all_sickleave_response.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:doctor_app_flutter/screens/reschedule-leaves/add-rescheduleleave.dart';
Helpers helpers = Helpers(); Helpers helpers = Helpers();
@ -49,13 +50,40 @@ class _RescheduleLeaveScreen extends State<RescheduleLeaveScreen> {
var fromDate; var fromDate;
var toDate; var toDate;
var clinicID; var clinicID;
var fromTime;
var toTime;
TextEditingController _controller4; TextEditingController _controller4;
void _presentDatePicker(id) { void _presentDatePicker(id) {
var date = new DateTime.now(); var date = new DateTime.now();
var initialDate = id == 'fromDate'
? new DateTime(date.year, date.month, date.day + 15)
: new DateTime(fromDate.year, fromDate.month, fromDate.day);
var firstDate = id == 'fromDate'
? new DateTime(date.year, date.month, date.day + 15)
: new DateTime(fromDate.year, fromDate.month, fromDate.day);
showDatePicker( showDatePicker(
context: context, context: context,
initialDate: new DateTime(date.year, date.month, date.day + 15), initialDate: initialDate,
firstDate: new DateTime(date.year, date.month, date.day + 15), firstDate: firstDate,
lastDate: DateTime(2050),
).then((pickedDate) {
if (pickedDate == null) {
return;
}
setState(() {
final df = new DateFormat('yyyy-MM-dd');
fromDate = pickedDate; //df.format();
_toDateController.text = df.format(pickedDate);
toDate = pickedDate;
});
});
}
void _presentCurrentDate(id) {
showDatePicker(
context: context,
initialDate: DateTime.now(),
firstDate: DateTime.now(),
lastDate: DateTime(2050), lastDate: DateTime(2050),
).then((pickedDate) { ).then((pickedDate) {
if (pickedDate == null) { if (pickedDate == null) {
@ -328,7 +356,7 @@ class _RescheduleLeaveScreen extends State<RescheduleLeaveScreen> {
TextInputType.number, TextInputType.number,
controller: _toDateController, controller: _toDateController,
onTap: () { onTap: () {
_presentDatePicker( _presentCurrentDate(
'fromDate'); 'fromDate');
}, },
inputFormatter: ONLY_DATE, inputFormatter: ONLY_DATE,
@ -355,14 +383,11 @@ class _RescheduleLeaveScreen extends State<RescheduleLeaveScreen> {
crossAxisAlignment: crossAxisAlignment:
CrossAxisAlignment.start, CrossAxisAlignment.start,
children: [ children: [
// new AppTextFormField(
// readOnly: true,
// hintText: "",
// borderColor: Colors.white,
// onSaved: (value) {},
// inputFormatter: ONLY_NUMBERS),
DateTimePicker( DateTimePicker(
timeHintText:
TranslationBase.of(
context)
.fromTime,
type: type:
DateTimePickerType.time, DateTimePickerType.time,
controller: _controller4, controller: _controller4,
@ -373,6 +398,7 @@ class _RescheduleLeaveScreen extends State<RescheduleLeaveScreen> {
//locale: Locale('en', 'US'), //locale: Locale('en', 'US'),
onChanged: (val) => () { onChanged: (val) => () {
print(val); print(val);
this.fromTime = val;
}, },
validator: (val) { validator: (val) {
print(val); print(val);
@ -403,16 +429,15 @@ class _RescheduleLeaveScreen extends State<RescheduleLeaveScreen> {
CrossAxisAlignment.start, CrossAxisAlignment.start,
children: [ children: [
DateTimePicker( DateTimePicker(
timeHintText:
TranslationBase.of(
context)
.toTime,
type: type:
DateTimePickerType.time, DateTimePickerType.time,
controller: _controller4, controller: _controller4,
//initialValue: _initialValue,
// icon: Icon(Icons.access_time),
//use24HourFormat: false,
//locale: Locale('en', 'US'),
onChanged: (val) => () { onChanged: (val) => () {
print(val); this.toTime = val;
}, },
validator: (val) { validator: (val) {
print(val); print(val);
@ -761,7 +786,7 @@ class _RescheduleLeaveScreen extends State<RescheduleLeaveScreen> {
"clinicId": this.profile['ClinicID'], "clinicId": this.profile['ClinicID'],
"doctorId": this.profile['DoctorID'], "doctorId": this.profile['DoctorID'],
"dateTimeFrom": df.format(fromDate), "dateTimeFrom": df.format(fromDate),
"dateTimeTo": df.format(toDate), "dateTimeTo": toDate != null ? df.format(toDate) : df.format(fromDate),
"date": df.format(DateTime.now()), "date": df.format(DateTime.now()),
"reasonId": reason == null ? model.allOffTime[0]['code'] : reason, "reasonId": reason == null ? model.allOffTime[0]['code'] : reason,
"coveringDoctorId": "coveringDoctorId":
@ -772,8 +797,8 @@ class _RescheduleLeaveScreen extends State<RescheduleLeaveScreen> {
"weekDayId": 1, "weekDayId": 1,
"shiftId": 1, "shiftId": 1,
"isOpen": true, "isOpen": true,
"timeFrom": null, "timeFrom": fromTime,
"timeTo": null, "timeTo": toTime,
"timeFromstr": "", "timeFromstr": "",
"timeTostr": "" "timeTostr": ""
} }
@ -784,7 +809,13 @@ class _RescheduleLeaveScreen extends State<RescheduleLeaveScreen> {
model.addReschedule(request).then((response) { model.addReschedule(request).then((response) {
DrAppToastMsg.showSuccesToast(TranslationBase.of(context).leaveCreated); DrAppToastMsg.showSuccesToast(TranslationBase.of(context).leaveCreated);
Navigator.pop(context); Navigator.pop(context);
model.getRescheduleLeave(); Navigator.push(
context,
MaterialPageRoute(
builder: (context) => AddRescheduleLeavScreen(),
// MyReferredPatient(),
),
);
}); });
} }
@ -797,7 +828,7 @@ class _RescheduleLeaveScreen extends State<RescheduleLeaveScreen> {
"clinicId": this.profile['ClinicID'], "clinicId": this.profile['ClinicID'],
"doctorId": this.profile['DoctorID'], "doctorId": this.profile['DoctorID'],
"dateTimeFrom": df.format(fromDate), "dateTimeFrom": df.format(fromDate),
"dateTimeTo": df.format(toDate), "dateTimeTo": toDate != null ? df.format(toDate) : df.format(fromDate),
"date": df.format(DateTime.now()), "date": df.format(DateTime.now()),
"reasonId": reason == null ? model.allOffTime[0]['code'] : reason, "reasonId": reason == null ? model.allOffTime[0]['code'] : reason,
"coveringDoctorId": "coveringDoctorId":
@ -808,8 +839,8 @@ class _RescheduleLeaveScreen extends State<RescheduleLeaveScreen> {
"weekDayId": 1, "weekDayId": 1,
"shiftId": 1, "shiftId": 1,
"isOpen": true, "isOpen": true,
"timeFrom": null, "timeFrom": fromTime,
"timeTo": null, "timeTo": toTime,
"timeFromstr": "", "timeFromstr": "",
"timeTostr": "" "timeTostr": ""
} }

@ -289,6 +289,10 @@ class TranslationBase {
String get toDate => localizedValues['toDate'][locale.languageCode]; String get toDate => localizedValues['toDate'][locale.languageCode];
String get fromTime => localizedValues['fromTime'][locale.languageCode];
String get toTime => localizedValues['toTime'][locale.languageCode];
String get searchPatientImageCaptionTitle => String get searchPatientImageCaptionTitle =>
localizedValues['searchPatientImageCaptionTitle'][locale.languageCode]; localizedValues['searchPatientImageCaptionTitle'][locale.languageCode];
@ -550,6 +554,7 @@ class TranslationBase {
String get uncoveredByDoctor => localizedValues['uncoveredByDoctor'][locale.languageCode]; String get uncoveredByDoctor => localizedValues['uncoveredByDoctor'][locale.languageCode];
String get addAssessment => localizedValues['addAssessment'][locale.languageCode]; String get addAssessment => localizedValues['addAssessment'][locale.languageCode];
String get assessment => localizedValues['assessment'][locale.languageCode]; String get assessment => localizedValues['assessment'][locale.languageCode];
String get chiefComplaintEmptyMsg => localizedValues['chiefComplaintEmptyMsg'][locale.languageCode];
} }
class TranslationBaseDelegate extends LocalizationsDelegate<TranslationBase> { class TranslationBaseDelegate extends LocalizationsDelegate<TranslationBase> {

@ -94,7 +94,7 @@ class PatientProfileWidget extends StatelessWidget {
color: Color(0xffCCCCCC), color: Color(0xffCCCCCC),
), ),
Container( Container(
height: 10 * SizeConfig.textMultiplier, height: 11 * SizeConfig.textMultiplier,
child: Row( child: Row(
children: [ children: [
Expanded( Expanded(
@ -232,7 +232,8 @@ class PatientProfileWidget extends StatelessWidget {
SizeConfig.textMultiplier, SizeConfig.textMultiplier,
), ),
), ),
AppText( Expanded(
child: AppText(
patient.admissionDate != null patient.admissionDate != null
? "${DateUtils.convertDateFromServerFormat(patient.admissionDate, 'EEEE dd, MMMM yyyy hh:mm a')}" ? "${DateUtils.convertDateFromServerFormat(patient.admissionDate, 'EEEE dd, MMMM yyyy hh:mm a')}"
: "", : "",
@ -241,6 +242,7 @@ class PatientProfileWidget extends StatelessWidget {
fontSize: fontSize:
1.6 * SizeConfig.textMultiplier, 1.6 * SizeConfig.textMultiplier,
), ),
),
], ],
), ),
SizedBox( SizedBox(
@ -374,7 +376,8 @@ class PatientProfileWidget extends StatelessWidget {
SizedBox( SizedBox(
width: 4, width: 4,
), ),
AppText( Expanded(
child: AppText(
"${patient.nursingStationName}\n${patient.roomId}", "${patient.nursingStationName}\n${patient.roomId}",
fontWeight: fontWeight:
FontWeight.normal, FontWeight.normal,
@ -382,6 +385,7 @@ class PatientProfileWidget extends StatelessWidget {
SizeConfig SizeConfig
.textMultiplier, .textMultiplier,
), ),
),
], ],
), ),
), ),

@ -505,6 +505,8 @@ class _AddExaminationDailogState extends State<AddExaminationDailog> {
baseViewModel: model, baseViewModel: model,
child: MasterKeyCheckboxSearchWidget( child: MasterKeyCheckboxSearchWidget(
model: model, model: model,
hintSearchText: 'Search Examination',
buttonName: 'Add Examination',
masterList: model.physicalExaminationList, masterList: model.physicalExaminationList,
removeHistory: (history){ removeHistory: (history){
setState(() { setState(() {

@ -66,10 +66,13 @@ class _ListSelectDialogState extends State<ListSelectDialog> {
...widget.list ...widget.list
.map((item) => RadioListTile( .map((item) => RadioListTile(
title: Text("${item[widget.attributeName].toString()}"), title: Text("${item[widget.attributeName].toString()}"),
groupValue: widget.selectedValue[widget.attributeValueId].toString(), groupValue: widget.selectedValue[widget.attributeValueId]
.toString(),
value: item[widget.attributeValueId].toString(), value: item[widget.attributeValueId].toString(),
activeColor: Colors.blue.shade700, activeColor: Colors.blue.shade700,
selected: item[widget.attributeValueId].toString() == widget.selectedValue[widget.attributeValueId].toString(), selected: item[widget.attributeValueId].toString() ==
widget.selectedValue[widget.attributeValueId]
.toString(),
onChanged: (val) { onChanged: (val) {
setState(() { setState(() {
widget.selectedValue = item; widget.selectedValue = item;

@ -503,7 +503,7 @@ packages:
name: meta name: meta
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.3.0-nullsafety.4" version: "1.3.0-nullsafety.3"
mime: mime:
dependency: transitive dependency: transitive
description: description:
@ -760,7 +760,7 @@ packages:
name: stack_trace name: stack_trace
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.10.0-nullsafety.2" version: "1.10.0-nullsafety.1"
stream_channel: stream_channel:
dependency: transitive dependency: transitive
description: description:
@ -895,5 +895,5 @@ packages:
source: hosted source: hosted
version: "2.2.1" version: "2.2.1"
sdks: 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" flutter: ">=1.22.0 <2.0.0"

Loading…
Cancel
Save