updates & fixes

development-3.3_voipCall
haroon amjad 1 year ago
parent 793f9ff905
commit f0204fcbb0

@ -22,7 +22,7 @@ class VitalSignData {
int patientType;
int pulseBeatPerMinute;
int pulseRhythm;
int respirationBeatPerMinute;
num respirationBeatPerMinute;
int respirationPattern;
int sao2;
int status;

@ -14,8 +14,7 @@ class SickLeaveViewModel extends BaseViewModel {
SickLeaveService _sickLeaveService = locator<SickLeaveService>();
PatientService _patientService = locator<PatientService>();
SickLeaveStatisticsModel get sickLeaveStatistics =>
_sickLeaveService.sickLeavestatisitics;
SickLeaveStatisticsModel get sickLeaveStatistics => _sickLeaveService.sickLeavestatisitics;
get getAllSIckLeave => _sickLeaveService.getAllSickLeave;
@ -31,10 +30,7 @@ class SickLeaveViewModel extends BaseViewModel {
get postSechedule => _sickLeaveService.postReschedule;
get getAllSIckLeavePatient => removeDuplicates([
..._sickLeaveService.getAllSickLeavePatient,
..._sickLeaveService.getAllSickLeaveDoctor
]);
get getAllSIckLeavePatient => removeDuplicates([..._sickLeaveService.getAllSickLeaveDoctor, ..._sickLeaveService.getAllSickLeavePatient]);
Future addSickLeave(AddSickLeaveRequest addSickLeaveRequest) async {
setState(ViewState.BusyLocal);
@ -89,17 +85,13 @@ class SickLeaveViewModel extends BaseViewModel {
setState(ViewState.Idle);
}
Future getSickLeaveForPatient(PatiantInformtion patient,
{bool isLocalBusy = false}) async {
Future getSickLeaveForPatient(PatiantInformtion patient, {bool isLocalBusy = false}) async {
if (isLocalBusy)
setState(ViewState.BusyLocal);
else
setState(ViewState.Busy);
var patientMRN = patient.patientMRN ?? patient.patientId;
var services = [
_sickLeaveService.getSickLeavePatient(patientMRN),
_sickLeaveService.getSickLeaveDoctor(patientMRN)
];
var services = [_sickLeaveService.getSickLeavePatient(patientMRN), _sickLeaveService.getSickLeaveDoctor(patientMRN)];
final results = await Future.wait(services);
if (_sickLeaveService.hasError) {
@ -184,15 +176,13 @@ class SickLeaveViewModel extends BaseViewModel {
} else
setState(ViewState.Idle);
}
List<SickLeavePatientModel> removeDuplicates(List<SickLeavePatientModel> items) {
List<SickLeavePatientModel>uniqueItems = [];
var uniqueIDs = items
.map((e) => e.appointmentNo)
.toSet();
List<SickLeavePatientModel> uniqueItems = [];
var uniqueIDs = items.map((e) => e.appointmentNo).toSet();
uniqueIDs.forEach((e) {
uniqueItems.add(items.firstWhere((i) => i.appointmentNo == e));
});
return uniqueItems;
}
}

@ -29,255 +29,185 @@ class PatientSickLeaveScreen extends StatelessWidget {
Widget build(BuildContext context) {
ProjectViewModel projectsProvider = Provider.of<ProjectViewModel>(context);
final routeArgs = ModalRoute
.of(context)
.settings
.arguments as Map;
final routeArgs = ModalRoute.of(context).settings.arguments as Map;
patient = routeArgs['patient'];
bool isInpatient = routeArgs['isInpatient'];
return BaseView<SickLeaveViewModel>(
onModelReady: (model) async {
await model.getSickLeaveForPatient(patient);
},
builder: (_, model, w) =>
AppScaffold(
baseViewModel: model,
isShowAppBar: true,
backgroundColor: Colors.grey[100],
appBar: PatientProfileAppBar(
patient,
isInpatient: isInpatient,
),
body: Column(children: [
patient.patientStatusType == 43
? Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: EdgeInsets.all(10),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(
height: SizeConfig.isHeightVeryShort
? 30
: SizeConfig.isHeightShort
? 35
: 10,
),
if (!projectsProvider.isArabic)
builder: (_, model, w) => AppScaffold(
baseViewModel: model,
isShowAppBar: true,
backgroundColor: Colors.grey[100],
appBar: PatientProfileAppBar(
patient,
isInpatient: isInpatient,
),
body: Column(children: [
patient.patientStatusType == 43
? Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: EdgeInsets.all(10),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(
height: SizeConfig.isHeightVeryShort
? 30
: SizeConfig.isHeightShort
? 35
: 10,
),
if (!projectsProvider.isArabic)
AppText(
TranslationBase.of(context).patient,
fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * (SizeConfig.isWidthLarge ? 3 : 4),
fontWeight: FontWeight.w700,
letterSpacing: -0.72,
color: Color(0xFF2E303A),
),
AppText(
TranslationBase
.of(context)
.patient,
fontSize: SizeConfig
.getTextMultiplierBasedOnWidth() * (SizeConfig
.isWidthLarge ? 3 : 4),
fontWeight: FontWeight.w700,
letterSpacing: -0.72,
TranslationBase.of(context).sickLeave,
fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * (SizeConfig.isWidthLarge ? 6 : 6),
fontWeight: FontWeight.bold,
letterSpacing: -1.44,
color: Color(0xFF2E303A),
),
AppText(
TranslationBase
.of(context)
.sickLeave,
fontSize: SizeConfig.getTextMultiplierBasedOnWidth() *
(SizeConfig.isWidthLarge ? 6 : 6),
fontWeight: FontWeight.bold,
letterSpacing: -1.44,
color: Color(0xFF2E303A),
),
],
],
),
),
),
AddNewOrder(
label: TranslationBase
.of(context)
.noSickLeaveApplied,
onTap: () async {
await locator<AnalyticsService>().logEvent(
eventCategory: "Add Sick Leave Screen"
"Leave Screen",
eventAction: "apply For Sick Leave",
);
openSickLeave(context, model);
}),
],
)
: SizedBox(),
model.getAllSIckLeavePatient.length > 0
? Expanded(
child: FractionallySizedBox(
widthFactor: 0.95,
child: ListView.builder(
scrollDirection: Axis.vertical,
shrinkWrap: true,
itemCount: model.getAllSIckLeavePatient.length,
itemBuilder: (BuildContext ctxt, int index) {
SickLeavePatientModel item = model
.getAllSIckLeavePatient[index];
return Column(
children: [
CardWithBgWidget(
padding: 0,
marginLeft: 10,
marginSymmetric: 10,
hasBorder: false,
bgColor: Colors.black,
widget: Container(
color: Colors.white,
padding: EdgeInsets.all(20),
child: InkWell(
child: Column(
children: [
if (item.doctorName != null)
Row(crossAxisAlignment: CrossAxisAlignment
.start,
mainAxisAlignment: MainAxisAlignment
.start,
children: [
Expanded(
// width: MediaQuery.of(context).size.width*0.51,
child: AppText(
Utils.capitalize(
item.doctorName ?? ""),
fontSize: 18,
color: Color(0xff2e303a),
fontWeight: FontWeight.w700,
fontFamily: 'Poppins',
textOverflow: TextOverflow
.ellipsis,
),
AddNewOrder(
label: TranslationBase.of(context).noSickLeaveApplied,
onTap: () async {
await locator<AnalyticsService>().logEvent(
eventCategory: "Add Sick Leave Screen"
"Leave Screen",
eventAction: "apply For Sick Leave",
);
openSickLeave(context, model);
}),
],
)
: SizedBox(),
model.getAllSIckLeavePatient.length > 0
? Expanded(
child: FractionallySizedBox(
widthFactor: 0.95,
child: ListView.builder(
scrollDirection: Axis.vertical,
shrinkWrap: true,
itemCount: model.getAllSIckLeavePatient.length,
itemBuilder: (BuildContext ctxt, int index) {
SickLeavePatientModel item = model.getAllSIckLeavePatient[index];
return Column(
children: [
CardWithBgWidget(
padding: 0,
marginLeft: 10,
marginSymmetric: 10,
hasBorder: false,
bgColor: Colors.black,
widget: Container(
color: Colors.white,
padding: EdgeInsets.all(20),
child: InkWell(
child: Column(
children: [
if (item.doctorName != null)
Row(crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start, children: [
Expanded(
// width: MediaQuery.of(context).size.width*0.51,
child: AppText(
Utils.capitalize(item.doctorName ?? ""),
fontSize: 18,
color: Color(0xff2e303a),
fontWeight: FontWeight.w700,
fontFamily: 'Poppins',
textOverflow: TextOverflow.ellipsis,
),
]),
SizedBox(
height: 10,
),
Row(
children: [
ClipRRect(
borderRadius: BorderRadius.circular(
50.0),
child: CachedNetworkImage(
imageUrl: item.doctorImageURL ??
"https://hmgwebservices.com/Images/MobileImages/DUBAI/unkown.png",
height: 30,
width: 30,
errorWidget: (context, url,
error) =>
AppText(
'No Image',
fontSize: 10,
),
),
),
SizedBox(
width: 10,
),
Expanded(
child: Column(
children: [
CustomRow(
label: TranslationBase
.of(context)
.daysSickleave,
labelSize: SizeConfig
.getTextMultiplierBasedOnWidth() *
3.3,
valueSize: SizeConfig
.getTextMultiplierBasedOnWidth() *
4,
value:
(item.sickLeaveDays
.toString() != null &&
item.sickLeaveDays
.toString() != "null")
? item.sickLeaveDays
.toString()
: item.noOfDays
.toString(),
]),
SizedBox(
height: 10,
),
Row(
children: [
ClipRRect(
borderRadius: BorderRadius.circular(50.0),
child: CachedNetworkImage(
imageUrl: item.doctorImageURL ?? "https://hmgwebservices.com/Images/MobileImages/DUBAI/unkown.png",
height: 30,
width: 30,
errorWidget: (context, url, error) => AppText(
'No Image',
fontSize: 10,
),
CustomRow(
label: TranslationBase
.of(context)
.startDate + ' ' ?? "",
labelSize: SizeConfig
.getTextMultiplierBasedOnWidth() *
3.3,
valueSize: SizeConfig
.getTextMultiplierBasedOnWidth() *
4,
value: AppDateUtils
.getDayMonthYearDateFormatted(
item.startDate.contains(
"/Date(")
? AppDateUtils
.convertStringToDate(
item.startDate)
: DateTime.parse(
item.startDate),
),
),
SizedBox(
width: 10,
),
Expanded(
child: Column(
children: [
CustomRow(
label: TranslationBase.of(context).daysSickleave,
labelSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3.3,
valueSize: SizeConfig.getTextMultiplierBasedOnWidth() * 4,
value:
(item.sickLeaveDays.toString() != null && item.sickLeaveDays.toString() != "null") ? item.sickLeaveDays.toString() : item.noOfDays.toString(),
),
),
CustomRow(
label: TranslationBase
.of(context)
.endDate + ' ' ?? "",
labelSize: SizeConfig
.getTextMultiplierBasedOnWidth() *
3.3,
valueSize: SizeConfig
.getTextMultiplierBasedOnWidth() *
4,
value: AppDateUtils
.getDayMonthYearDateFormatted(
item.startDate.contains(
"/Date(")
? AppDateUtils
.convertStringToDate(
item.endDate ?? "").add(
Duration(
days: item.noOfDays ??
item
.sickLeaveDays),
)
: DateTime.parse(
item.startDate ?? "")
.add(
Duration(
days: item.noOfDays ??
""),
CustomRow(
label: TranslationBase.of(context).startDate + ' ' ?? "",
labelSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3.3,
valueSize: SizeConfig.getTextMultiplierBasedOnWidth() * 4,
value: AppDateUtils.getDayMonthYearDateFormatted(
item.startDate.contains("/Date(") ? AppDateUtils.convertStringToDate(item.startDate) : DateTime.parse(item.startDate),
),
),
),
],
crossAxisAlignment: CrossAxisAlignment
.start,
CustomRow(
label: TranslationBase.of(context).endDate + ' ' ?? "",
labelSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3.3,
valueSize: SizeConfig.getTextMultiplierBasedOnWidth() * 4,
value: AppDateUtils.getDayMonthYearDateFormatted(
item.startDate.contains("/Date(")
? AppDateUtils.convertStringToDate(item.endDate ?? "").add(
Duration(days: item.noOfDays ?? item.sickLeaveDays),
)
: DateTime.parse(item.startDate ?? "").add(
Duration(days: item.noOfDays ?? ""),
),
),
),
],
crossAxisAlignment: CrossAxisAlignment.start,
),
),
),
],
),
],
],
),
],
),
),
),
),
),
],
);
}),
),
)
: patient.patientStatusType != 43
],
);
}),
),
)
: patient.patientStatusType != 43
? ErrorMessage(
error: TranslationBase
.of(context)
.noSickLeave,
)
error: TranslationBase.of(context).noSickLeave,
)
: SizedBox(),
SizedBox(
height: 100,
)
]),
),
SizedBox(
height: 100,
)
]),
),
);
}
@ -296,4 +226,3 @@ class PatientSickLeaveScreen extends StatelessWidget {
);
}
}

@ -148,12 +148,14 @@ class _AddAssessmentDetailsState extends State<AddAssessmentDetails> {
controller: icdNameController,
itemSubmitted: (item) => setState(() {
widget.mySelectedAssessment.selectedICD = item;
icdNameController.text = '${item.code.trim()}/${item.description}';
// icdNameController.text = '${item.code.trim()}/${item.description}';
icdNameController.text = '${item.description}';
}),
key: key,
suggestions: model.listOfICD10,
suggestionsAmount: 10,
itemBuilder: (context, suggestion) =>
new Padding(child: AppText(suggestion.description + " / " + suggestion.code.toString()), padding: EdgeInsets.all(8.0)),
new Padding(child: AppText(suggestion.description + " / " + suggestion.code.toString(), fontSize: 12.0), padding: EdgeInsets.all(8.0)),
itemSorter: (a, b) => 1,
itemFilter: (suggestion, input) =>
// suggestion.description.toLowerCase().startsWith(input.toLowerCase()) ||

@ -30,19 +30,13 @@ class UpdateAssessmentPage extends StatefulWidget {
final Function changeLoadingState;
final int currentIndex;
UpdateAssessmentPage(
{Key key,
this.changePageViewIndex,
this.patientInfo,
this.changeLoadingState,
this.currentIndex});
UpdateAssessmentPage({Key key, this.changePageViewIndex, this.patientInfo, this.changeLoadingState, this.currentIndex});
@override
_UpdateAssessmentPageState createState() => _UpdateAssessmentPageState();
}
class _UpdateAssessmentPageState extends State<UpdateAssessmentPage>
implements AssessmentCallBack {
class _UpdateAssessmentPageState extends State<UpdateAssessmentPage> implements AssessmentCallBack {
bool isAssessmentExpand = false;
List<MySelectedAssessment> mySelectedAssessmentList = List();
@ -71,21 +65,18 @@ class _UpdateAssessmentPageState extends State<UpdateAssessmentPage>
masterKeys: MasterKeysService.DiagnosisCondition,
id: element.conditionID,
);
if (diagnosisCondition != null &&
diagnosisType != null &&
diagnosisCondition != null) {
MySelectedAssessment temMySelectedAssessment =
SoapUtils.generateMySelectedAssessment(
appointmentNo: element.appointmentNo,
remark: element.remarks,
diagnosisType: diagnosisType,
diagnosisCondition: diagnosisCondition,
selectedICD: selectedICD,
doctorID: element.doctorID,
doctorName: element.doctorName,
createdBy: element.createdBy,
createdOn: element.createdOn,
icdCode10ID: element.icdCode10ID);
if (diagnosisCondition != null && diagnosisType != null && diagnosisCondition != null) {
MySelectedAssessment temMySelectedAssessment = SoapUtils.generateMySelectedAssessment(
appointmentNo: element.appointmentNo,
remark: element.remarks,
diagnosisType: diagnosisType,
diagnosisCondition: diagnosisCondition,
selectedICD: selectedICD,
doctorID: element.doctorID,
doctorName: element.doctorName,
createdBy: element.createdBy,
createdOn: element.createdOn,
icdCode10ID: element.icdCode10ID);
mySelectedAssessmentList.add(temMySelectedAssessment);
}
@ -126,111 +117,73 @@ class _UpdateAssessmentPageState extends State<UpdateAssessmentPage>
Column(
children: [
SOAPOpenItems(
label:
"${TranslationBase.of(context).addAssessment}",
label: "${TranslationBase.of(context).addAssessment}",
onTap: () {
openAssessmentDialog(context,
isUpdate: false, model: model);
openAssessmentDialog(context, isUpdate: false, model: model);
},
),
SizedBox(
height: 20,
),
Column(
children:
mySelectedAssessmentList.map((assessment) {
children: mySelectedAssessmentList.map((assessment) {
return Container(
margin: EdgeInsets.only(
left: 5, right: 5, top: 15, bottom: 15),
margin: EdgeInsets.only(left: 5, right: 5, top: 15, bottom: 15),
child: Column(
children: [
Row(
children: [
RichText(
text: new TextSpan(
style: new TextStyle(
fontSize: SizeConfig
.getTextMultiplierBasedOnWidth() *
3.6,
color: Color(0xFF2E303A),
fontFamily: 'Poppins',
RichText(
text: new TextSpan(
style: new TextStyle(
fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3.6,
color: Color(0xFF2E303A),
fontFamily: 'Poppins',
fontWeight: FontWeight.w600,
letterSpacing: -0.4),
children: <TextSpan>[
new TextSpan(
text: "ICD : ".toUpperCase(),
),
new TextSpan(text: (assessment != null && assessment.selectedICD != null) ? assessment.selectedICD.code.trim().toUpperCase() ?? "" : ""),
],
),
),
Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
AppText(
assessment.createdOn != null
? AppDateUtils.getDayMonthYearDateFormatted(DateTime.parse(assessment.createdOn), isMonthShort: true)
: AppDateUtils.getDayMonthYearDateFormatted(DateTime.now()),
fontWeight: FontWeight.w600,
letterSpacing: -0.4),
children: <TextSpan>[
new TextSpan(
text: "ICD : ".toUpperCase(),
fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3.6,
),
AppText(
assessment.createdOn != null ? AppDateUtils.getHour(DateTime.parse(assessment.createdOn)) : AppDateUtils.getHour(DateTime.now()),
fontWeight: FontWeight.w600,
color: Color(0xFF575757),
fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3.6,
),
new TextSpan(
text: assessment
.selectedICD.code
.trim()
.toUpperCase() ??
""),
],
),
),
Column(
crossAxisAlignment:
CrossAxisAlignment.end,
children: [
AppText(
assessment.createdOn != null
? AppDateUtils
.getDayMonthYearDateFormatted(
DateTime.parse(
assessment
.createdOn), isMonthShort: true)
: AppDateUtils
.getDayMonthYearDateFormatted(
DateTime.now()),
fontWeight: FontWeight.w600,
fontSize: SizeConfig
.getTextMultiplierBasedOnWidth() *
3.6,
),
AppText(
assessment.createdOn != null
? AppDateUtils.getHour(
DateTime.parse(
assessment
.createdOn))
: AppDateUtils.getHour(
DateTime.now()),
fontWeight: FontWeight.w600,
color: Color(0xFF575757),
fontSize: SizeConfig
.getTextMultiplierBasedOnWidth() *
3.6,
),
],
),
],
],
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
),
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
crossAxisAlignment:
CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Column(
crossAxisAlignment:
CrossAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
width: MediaQuery.of(context)
.size
.width *
0.50,
width: MediaQuery.of(context).size.width * 0.50,
child: RichText(
text: new TextSpan(
style: new TextStyle(
fontSize: SizeConfig
.getTextMultiplierBasedOnWidth() *
4.3,
fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 4.3,
color: Color(0xFF2E303A),
fontFamily: 'Poppins',
fontWeight: FontWeight.w600,
@ -238,9 +191,8 @@ class _UpdateAssessmentPageState extends State<UpdateAssessmentPage>
),
children: <TextSpan>[
new TextSpan(
text: assessment
.selectedICD.description
.toString(),
text: (assessment != null && assessment.selectedICD != null) ? assessment.selectedICD.description.toString() : "",
// text: assessment.selectedICD.description.toString(),
),
],
),
@ -249,34 +201,24 @@ class _UpdateAssessmentPageState extends State<UpdateAssessmentPage>
RichText(
text: new TextSpan(
style: new TextStyle(
fontSize: SizeConfig
.getTextMultiplierBasedOnWidth() *
3.5,
fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3.5,
color: Color(0xFF2E303A),
fontFamily: 'Poppins',
fontWeight: FontWeight.w600,
),
children: <TextSpan>[
new TextSpan(
text: TranslationBase.of(
context)
.appointmentNo,
text: TranslationBase.of(context).appointmentNo,
style: new TextStyle(
fontSize: SizeConfig
.getTextMultiplierBasedOnWidth() *
3,
fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3,
letterSpacing: -0.4,
color: Color(0xFF575757),
),
),
new TextSpan(
text: assessment.appointmentId
.toString() ??
"",
text: assessment.appointmentId.toString() ?? "",
style: new TextStyle(
fontSize: SizeConfig
.getTextMultiplierBasedOnWidth() *
3.6,
fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3.6,
letterSpacing: -0.48,
color: Color(0xFF2B353E),
),
@ -287,36 +229,19 @@ class _UpdateAssessmentPageState extends State<UpdateAssessmentPage>
RichText(
text: new TextSpan(
style: new TextStyle(
fontSize: SizeConfig
.getTextMultiplierBasedOnWidth() *
3,
color: Color(0xFF2E303A),
fontFamily: 'Poppins',
fontWeight: FontWeight.w600),
fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3, color: Color(0xFF2E303A), fontFamily: 'Poppins', fontWeight: FontWeight.w600),
children: <TextSpan>[
new TextSpan(
text: TranslationBase.of(
context)
.condition +
" : ",
text: TranslationBase.of(context).condition + " : ",
style: new TextStyle(
letterSpacing: -0.4,
color: Color(0xFF575757),
),
),
new TextSpan(
text: projectViewModel
.isArabic
? assessment
.selectedDiagnosisCondition
.nameAr
: assessment
.selectedDiagnosisCondition
.nameEn,
text: projectViewModel.isArabic ? assessment.selectedDiagnosisCondition.nameAr : assessment.selectedDiagnosisCondition.nameEn,
style: new TextStyle(
fontSize: SizeConfig
.getTextMultiplierBasedOnWidth() *
3.6,
fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3.6,
letterSpacing: -0.48,
color: Color(0xFF2B353E),
),
@ -327,36 +252,19 @@ class _UpdateAssessmentPageState extends State<UpdateAssessmentPage>
RichText(
text: new TextSpan(
style: new TextStyle(
fontSize: SizeConfig
.getTextMultiplierBasedOnWidth() *
3,
color: Color(0xFF2E303A),
fontFamily: 'Poppins',
fontWeight: FontWeight.w600),
fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3, color: Color(0xFF2E303A), fontFamily: 'Poppins', fontWeight: FontWeight.w600),
children: <TextSpan>[
new TextSpan(
text: TranslationBase.of(
context)
.dType +
' : ',
text: TranslationBase.of(context).dType + ' : ',
style: new TextStyle(
letterSpacing: -0.4,
color: Color(0xFF575757),
),
),
new TextSpan(
text: projectViewModel
.isArabic
? assessment
.selectedDiagnosisType
.nameAr
: assessment
.selectedDiagnosisType
.nameEn,
text: projectViewModel.isArabic ? assessment.selectedDiagnosisType.nameAr : assessment.selectedDiagnosisType.nameEn,
style: new TextStyle(
fontSize: SizeConfig
.getTextMultiplierBasedOnWidth() *
3.6,
fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3.6,
letterSpacing: -0.48,
color: Color(0xFF2B353E),
),
@ -368,35 +276,20 @@ class _UpdateAssessmentPageState extends State<UpdateAssessmentPage>
RichText(
text: new TextSpan(
style: new TextStyle(
fontSize: SizeConfig
.getTextMultiplierBasedOnWidth() *
3.6,
color: Color(0xFF2E303A),
fontFamily: 'Poppins',
fontWeight:
FontWeight.w600),
fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3.6, color: Color(0xFF2E303A), fontFamily: 'Poppins', fontWeight: FontWeight.w600),
children: <TextSpan>[
new TextSpan(
text: TranslationBase.of(
context)
.doctor +
' : ',
text: TranslationBase.of(context).doctor + ' : ',
style: new TextStyle(
fontSize: SizeConfig
.getTextMultiplierBasedOnWidth() *
3,
fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3,
letterSpacing: -0.4,
color: Color(0xFF575757),
),
),
new TextSpan(
text:
assessment.doctorName ??
'',
text: assessment.doctorName ?? '',
style: new TextStyle(
fontSize: SizeConfig
.getTextMultiplierBasedOnWidth() *
3.6,
fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3.6,
letterSpacing: -0.48,
color: Color(0xFF2B353E),
),
@ -408,29 +301,14 @@ class _UpdateAssessmentPageState extends State<UpdateAssessmentPage>
height: 6,
),
Row(
mainAxisAlignment:
MainAxisAlignment.start,
crossAxisAlignment:
CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(
height: 6,
),
AppText(
(assessment.remark != null &&
assessment.remark !=
'')
? TranslationBase.of(
context)
.remarks +
" : "
: '',
fontSize: SizeConfig
.getTextMultiplierBasedOnWidth() *
3,
color: Color(0xFF2E303A),
fontFamily: 'Poppins',
fontWeight: FontWeight.w600),
AppText((assessment.remark != null && assessment.remark != '') ? TranslationBase.of(context).remarks + " : " : '',
fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3, color: Color(0xFF2E303A), fontFamily: 'Poppins', fontWeight: FontWeight.w600),
RemarkText(
remark: assessment.remark ?? "",
),
@ -439,22 +317,14 @@ class _UpdateAssessmentPageState extends State<UpdateAssessmentPage>
],
),
Column(
crossAxisAlignment:
CrossAxisAlignment.end,
crossAxisAlignment: CrossAxisAlignment.end,
children: [
SizedBox(
height: MediaQuery.of(context)
.size
.height *
0.05,
height: MediaQuery.of(context).size.height * 0.05,
),
InkWell(
onTap: () {
openAssessmentDialog(context,
isUpdate: true,
assessment: assessment,
model: model);
openAssessmentDialog(context, isUpdate: true, assessment: assessment, model: model);
},
child: Icon(
DoctorApp.edit,
@ -488,11 +358,9 @@ class _UpdateAssessmentPageState extends State<UpdateAssessmentPage>
);
}
openAssessmentDialog(BuildContext context,
{MySelectedAssessment assessment, bool isUpdate, SOAPViewModel model}) {
openAssessmentDialog(BuildContext context, {MySelectedAssessment assessment, bool isUpdate, SOAPViewModel model}) {
if (assessment == null) {
assessment = SoapUtils.generateMySelectedAssessment(
remark: '', appointmentNo: widget.patientInfo.appointmentNo);
assessment = SoapUtils.generateMySelectedAssessment(remark: '', appointmentNo: widget.patientInfo.appointmentNo);
}
showModalBottomSheet(
backgroundColor: Colors.white,
@ -504,11 +372,9 @@ class _UpdateAssessmentPageState extends State<UpdateAssessmentPage>
patientInfo: widget.patientInfo,
isUpdate: isUpdate,
mySelectedAssessmentList: mySelectedAssessmentList,
addSelectedAssessment: (MySelectedAssessment mySelectedAssessment,
bool isUpdate) async {
addSelectedAssessment: (MySelectedAssessment mySelectedAssessment, bool isUpdate) async {
setState(() {
if (!isUpdate)
mySelectedAssessmentList.add(mySelectedAssessment);
if (!isUpdate) mySelectedAssessmentList.add(mySelectedAssessment);
});
});
});

@ -29,6 +29,7 @@ class DrugToDrug extends StatefulWidget {
class _DrugToDrug extends State<DrugToDrug> {
int typeID = 1;
bool isLoaded = false;
/// TODO Elham* fix this
List<Map<dynamic, dynamic>> expandableList = [
{'name': 'CRITICAL', 'level': 'LEVEL_4'},
@ -38,7 +39,6 @@ class _DrugToDrug extends State<DrugToDrug> {
{'name': 'INFO', 'level': 'INFO'},
];
VitalSignsViewModel vitalSignsViewModel = new VitalSignsViewModel();
SOAPViewModel soapViewModel = new SOAPViewModel();
@ -53,49 +53,31 @@ class _DrugToDrug extends State<DrugToDrug> {
Widget build(BuildContext context) {
return isLoaded == true
? BaseView<PrescriptionViewModel>(
onModelReady: (prescriptionViewModel) => prescriptionViewModel.getDrugToDrug(
vitalSignsViewModel.patientVitalSigns,
widget.listAssessment,
soapViewModel.patientAllergiesList,
widget.patient,
widget.prescription),
builder: (BuildContext context, PrescriptionViewModel prescriptionViewModel,
Widget child) =>
NetworkBaseView(
baseViewModel: prescriptionViewModel,
child: Container(
height: SizeConfig.realScreenHeight * .9,
child: new ListView.builder(
itemCount: expandableList.length,
itemBuilder: (context, i) {
return new ExpansionTile(
title: new AppText(
expandableList[i]['name'] +
' ' +
'(' +
getDrugInfo(expandableList[i]['level'],
prescriptionViewModel)
.length
.toString() +
')',
fontSize: 20,
fontWeight: FontWeight.bold,
),
children: getDrugInfo(
expandableList[i]['level'], prescriptionViewModel)
.map((item) {
return Container(
padding: EdgeInsets.all(10),
child: AppText(
item['comment'],
color: Colors.red[900],
));
}).toList());
}))))
: Container(
height: SizeConfig.realScreenHeight * .45,
child: GifLoaderContainer()
);
onModelReady: (prescriptionViewModel) =>
prescriptionViewModel.getDrugToDrug(vitalSignsViewModel.patientVitalSigns, widget.listAssessment, soapViewModel.patientAllergiesList, widget.patient, widget.prescription),
builder: (BuildContext context, PrescriptionViewModel prescriptionViewModel, Widget child) => NetworkBaseView(
baseViewModel: prescriptionViewModel,
child: Container(
height: SizeConfig.realScreenHeight * .9,
child: new ListView.builder(
itemCount: expandableList.length,
itemBuilder: (context, i) {
return new ExpansionTile(
title: new AppText(
expandableList[i]['name'] + ' ' + '(' + getDrugInfo(expandableList[i]['level'], prescriptionViewModel).length.toString() + ')',
fontSize: 20,
fontWeight: FontWeight.bold,
),
children: getDrugInfo(expandableList[i]['level'], prescriptionViewModel).map((item) {
return Container(
padding: EdgeInsets.all(10),
child: AppText(
item['comment'],
color: Colors.red[900],
));
}).toList());
}))))
: Container(height: SizeConfig.realScreenHeight * .45, child: GifLoaderContainer());
}
getTypeID() async {
@ -106,14 +88,12 @@ class _DrugToDrug extends State<DrugToDrug> {
}
getRequestedData() async {
GeneralGetReqForSOAP generalGetReqForSOAP = GeneralGetReqForSOAP(
/// TODO Elham* fix this today
/// TODO Elham* fix this today
patientMRN: widget.patient.patientMRN,
episodeId: widget.patient.episodeNo,
appointmentNo:
widget.patient.appointmentNo,
appointmentNo: widget.patient.appointmentNo,
doctorID: '',
editedBy: '');

@ -35,13 +35,7 @@ class PrescriptionFormWidget extends StatefulWidget {
final MedicineViewModel medicineViewModel;
final GetMedicationResponseModel selectedMedication;
const PrescriptionFormWidget(
{Key key,
this.patient,
this.prescriptionList,
this.prescriptionViewModel,
this.medicineViewModel,
this.selectedMedication});
const PrescriptionFormWidget({Key key, this.patient, this.prescriptionList, this.prescriptionViewModel, this.medicineViewModel, this.selectedMedication});
@override
_PrescriptionFormWidgetState createState() => _PrescriptionFormWidgetState();
@ -67,8 +61,7 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
DateTime selectedDate = DateTime.now();
int strengthChar;
GlobalKey key =
new GlobalKey<AutoCompleteTextFieldState<GetMedicationResponseModel>>();
GlobalKey key = new GlobalKey<AutoCompleteTextFieldState<GetMedicationResponseModel>>();
TextEditingController drugIdController = TextEditingController();
TextEditingController doseController = TextEditingController();
@ -97,8 +90,7 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
onVoiceText() async {
new SpeechToText(context: context).showAlertDialog(context);
var lang = TranslationBase.of(AppGlobal.CONTEX).locale.languageCode;
bool available = await speech.initialize(
onStatus: statusListener, onError: errorListener);
bool available = await speech.initialize(onStatus: statusListener, onError: errorListener);
if (available) {
speech.listen(
onResult: resultListener,
@ -135,8 +127,7 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
}
Future<void> initSpeechState() async {
bool hasSpeech = await speech.initialize(
onError: errorListener, onStatus: statusListener);
bool hasSpeech = await speech.initialize(onError: errorListener, onStatus: statusListener);
print(hasSpeech);
if (!mounted) return;
}
@ -185,7 +176,7 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
children: [
Container(
width: MediaQuery.of(context).size.width * 0.35,
child: AppTextFieldCustom(
child: AppTextFieldCustom(
validationError: strengthError,
hintText: TranslationBase.of(context).strength,
isTextFieldHasSuffix: false,
@ -197,8 +188,7 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
});
if (strengthChar >= 5) {
DrAppToastMsg.showErrorToast(
TranslationBase.of(context)
.only5DigitsAllowedForStrength,
TranslationBase.of(context).only5DigitsAllowedForStrength,
);
}
},
@ -212,10 +202,7 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
),
PrescriptionTextFiled(
width: MediaQuery.of(context).size.width * 0.510,
element:
widget.medicineViewModel.itemMedicineListUnit.length == 1
? widget.medicineViewModel.itemMedicineListUnit[0]
: units,
element: widget.medicineViewModel.itemMedicineListUnit.length == 1 ? widget.medicineViewModel.itemMedicineListUnit[0] : units,
elementError: unitError,
keyName: 'description',
keyId: 'parameterCode',
@ -233,9 +220,7 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
SizedBox(height: spaceBetweenTextFields),
PrescriptionTextFiled(
elementList: widget.medicineViewModel.itemMedicineListRoute,
element: widget.medicineViewModel.itemMedicineListRoute.length == 1
? route = widget.medicineViewModel.itemMedicineListRoute[0]
: route,
element: widget.medicineViewModel.itemMedicineListRoute.length == 1 ? route = widget.medicineViewModel.itemMedicineListRoute[0] : route,
elementError: routeError,
keyId: 'parameterCode',
keyName: 'description',
@ -252,9 +237,7 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
hintText: TranslationBase.of(context).frequency,
elementError: frequencyError,
// element: frequency,
element: widget.medicineViewModel.itemMedicineListRoute.length == 1
? frequency = widget.medicineViewModel.itemMedicineListRoute[0]
: frequency,
element: widget.medicineViewModel.itemMedicineListRoute.length == 1 ? frequency = widget.medicineViewModel.itemMedicineListRoute[0] : frequency,
elementList: widget.medicineViewModel.itemMedicineList,
keyId: 'parameterCode',
keyName: 'description',
@ -262,15 +245,9 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
setState(() {
frequency = selectedValue;
frequency['isDefault'] = true;
if (widget.selectedMedication != null &&
duration != null &&
frequency != null &&
strengthController.text != null) {
widget.medicineViewModel.getBoxQuantity(
freq: frequency['parameterCode'],
duration: duration['id'],
itemCode: widget.selectedMedication.itemId,
strength: double.parse(strengthController.text));
if (widget.selectedMedication != null && duration != null && frequency != null && strengthController.text != null) {
widget.medicineViewModel
.getBoxQuantity(freq: frequency['parameterCode'], duration: duration['id'], itemCode: widget.selectedMedication.itemId, strength: double.parse(strengthController.text));
return;
}
@ -300,9 +277,7 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
Container(
width: MediaQuery.of(context).size.width * 0.29,
child: AppTextFieldCustom(
hintText: widget
.medicineViewModel.patientAssessmentList[0].icdCode10ID
.toString(),
hintText: widget.medicineViewModel.patientAssessmentList[0].icdCode10ID.toString(),
enabled: true,
),
),
@ -311,16 +286,15 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
color: Colors.white,
child: AppTextFieldCustom(
maxLines: 5,
hintText: widget
.medicineViewModel.patientAssessmentList[0].asciiDesc
.toString(),
hintText: widget.medicineViewModel.patientAssessmentList[0].asciiDesc.toString(),
enabled: true,
),
),
],
),
),
SizedBox(height: spaceBetweenTextFields), Container(
SizedBox(height: spaceBetweenTextFields),
Container(
color: Colors.transparent,
child: InkWell(
onTap: () => selectDate(context, widget.prescriptionViewModel),
@ -334,9 +308,7 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
color: Colors.black,
),
),
dropDownText: selectedDate != null
? "${AppDateUtils.convertStringToDateFormat(selectedDate.toString(), "yyyy-MM-dd")}"
: null,
dropDownText: selectedDate != null ? "${AppDateUtils.convertStringToDateFormat(selectedDate.toString(), "yyyy-MM-dd")}" : null,
enabled: false,
),
),
@ -352,10 +324,7 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
okFunction: (selectedValue) {
setState(() {
duration = selectedValue;
if (widget.selectedMedication != null &&
duration != null &&
frequency != null &&
strengthController.text != null) {
if (widget.selectedMedication != null && duration != null && frequency != null && strengthController.text != null) {
box = widget.medicineViewModel.boxQuintity;
return;
}
@ -378,17 +347,13 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
child: AppTextFieldCustom(
hintText: TranslationBase.of(context).boxQuantity,
isTextFieldHasSuffix: false,
dropDownText: box != null
? widget.medicineViewModel.boxQuintity.toString()
: null,
dropDownText: box != null ? widget.medicineViewModel.boxQuintity.toString() : null,
enabled: false,
),
),
SizedBox(height: spaceBetweenTextFields),
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(6.0)),
border: Border.all(width: 1.0, color: HexColor("#CCCCCC"))),
decoration: BoxDecoration(borderRadius: BorderRadius.all(Radius.circular(6.0)), border: Border.all(width: 1.0, color: HexColor("#CCCCCC"))),
child: Stack(
children: [
TextFields(
@ -459,14 +424,9 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
eventCategory: "Add Prescription Form",
eventAction: "Add Prescription",
);
if (duration != null &&
doseTime != null &&
frequency != null &&
selectedDate != null &&
strengthController.text != "") {
if (duration != null && doseTime != null && frequency != null && selectedDate != null && strengthController.text != "") {
if (widget.selectedMedication.isNarcotic == true) {
DrAppToastMsg.showErrorToast(TranslationBase.of(context)
.narcoticMedicineCanOnlyBePrescribedFromVida);
DrAppToastMsg.showErrorToast(TranslationBase.of(context).narcoticMedicineCanOnlyBePrescribedFromVida);
Navigator.pop(context);
return;
}

@ -37,21 +37,13 @@ class PrescriptionCheckOutScreen extends StatefulWidget {
final List<PrescriptionModel> prescriptionList;
final ProcedureTempleteDetailsModel groupProcedures;
const PrescriptionCheckOutScreen(
{Key key,
this.model,
this.patient,
this.prescriptionList,
this.groupProcedures})
: super(key: key);
const PrescriptionCheckOutScreen({Key key, this.model, this.patient, this.prescriptionList, this.groupProcedures}) : super(key: key);
@override
_PrescriptionCheckOutScreenState createState() =>
_PrescriptionCheckOutScreenState();
_PrescriptionCheckOutScreenState createState() => _PrescriptionCheckOutScreenState();
}
class _PrescriptionCheckOutScreenState
extends State<PrescriptionCheckOutScreen> {
class _PrescriptionCheckOutScreenState extends State<PrescriptionCheckOutScreen> {
postPrescription(
{String duration,
String doseTimeIn,
@ -68,8 +60,7 @@ class _PrescriptionCheckOutScreenState
String icdCode,
PatiantInformtion patient,
String patientType}) async {
PostPrescriptionReqModel postProcedureReqModel =
new PostPrescriptionReqModel();
PostPrescriptionReqModel postProcedureReqModel = new PostPrescriptionReqModel();
List<PrescriptionRequestModel> prescriptionList = List();
postProcedureReqModel.appointmentNo = patient.appointmentNo;
@ -121,8 +112,7 @@ class _PrescriptionCheckOutScreenState
DateTime selectedDate;
int strengthChar;
GetMedicationResponseModel _selectedMedication;
GlobalKey key =
new GlobalKey<AutoCompleteTextFieldState<GetMedicationResponseModel>>();
GlobalKey key = new GlobalKey<AutoCompleteTextFieldState<GetMedicationResponseModel>>();
TextEditingController drugIdController = TextEditingController();
TextEditingController doseController = TextEditingController();
@ -160,8 +150,7 @@ class _PrescriptionCheckOutScreenState
onVoiceText() async {
new SpeechToText(context: context).showAlertDialog(context);
var lang = TranslationBase.of(AppGlobal.CONTEX).locale.languageCode;
bool available = await speech.initialize(
onStatus: statusListener, onError: errorListener);
bool available = await speech.initialize(onStatus: statusListener, onError: errorListener);
if (available) {
speech.listen(
onResult: resultListener,
@ -204,8 +193,7 @@ class _PrescriptionCheckOutScreenState
}
Future<void> initSpeechState() async {
bool hasSpeech = await speech.initialize(
onError: errorListener, onStatus: statusListener);
bool hasSpeech = await speech.initialize(onError: errorListener, onStatus: statusListener);
print(hasSpeech);
if (!mounted) return;
}
@ -222,19 +210,13 @@ class _PrescriptionCheckOutScreenState
return BaseView<MedicineViewModel>(
onModelReady: (model) async {
// TODO Elham* move this logic to the model
model.getItem(
itemID: int.parse(
widget.groupProcedures.aliasN.replaceAll("item code ;", "")));
model.getItem(itemID: int.parse(widget.groupProcedures.aliasN.replaceAll("item code ;", "")));
x = model.patientAssessmentList.map((element) {
return element.icdCode10ID;
});
GetAssessmentReqModel getAssessmentReqModel = GetAssessmentReqModel(
patientMRN: widget.patient.patientMRN,
episodeID: widget.patient.episodeNo.toString(),
editedBy: '',
doctorID: '',
appointmentNo: widget.patient.appointmentNo);
GetAssessmentReqModel getAssessmentReqModel =
GetAssessmentReqModel(patientMRN: widget.patient.patientMRN, episodeID: widget.patient.episodeNo.toString(), editedBy: '', doctorID: '', appointmentNo: widget.patient.appointmentNo);
if (model.medicationStrengthList.length == 0) {
await model.getMedicationStrength();
}
@ -265,8 +247,7 @@ class _PrescriptionCheckOutScreenState
height: MediaQuery.of(context).size.height * 1.35,
color: Color(0xffF8F8F8),
child: Padding(
padding:
EdgeInsets.symmetric(horizontal: 12.0, vertical: 10.0),
padding: EdgeInsets.symmetric(horizontal: 12.0, vertical: 10.0),
child: Column(
children: [
Column(
@ -290,8 +271,7 @@ class _PrescriptionCheckOutScreenState
width: 7.0,
),
AppText(
TranslationBase.of(context)
.newPrescriptionOrder,
TranslationBase.of(context).newPrescriptionOrder,
fontWeight: FontWeight.w700,
fontSize: 20,
),
@ -325,16 +305,14 @@ class _PrescriptionCheckOutScreenState
child: Column(
children: [
AppText(
widget.groupProcedures.procedureName ??
"",
widget.groupProcedures.procedureName ?? "",
bold: true,
),
Container(
child: Row(
children: [
AppText(
TranslationBase.of(context)
.orderType,
TranslationBase.of(context).orderType,
fontWeight: FontWeight.w600,
),
Radio(
@ -345,8 +323,7 @@ class _PrescriptionCheckOutScreenState
setSelectedType(value);
},
),
Text(TranslationBase.of(context)
.regular),
Text(TranslationBase.of(context).regular),
],
),
),
@ -356,10 +333,7 @@ class _PrescriptionCheckOutScreenState
child: Row(
children: [
Container(
width: MediaQuery.of(context)
.size
.width *
0.35,
width: MediaQuery.of(context).size.width * 0.35,
child: AppTextFieldCustom(
height: 40,
validationError: strengthError,
@ -372,16 +346,12 @@ class _PrescriptionCheckOutScreenState
strengthChar = value.length;
});
if (strengthChar >= 5) {
DrAppToastMsg
.showErrorToast(
TranslationBase.of(
context)
.only5DigitsAllowedForStrength,
DrAppToastMsg.showErrorToast(
TranslationBase.of(context).only5DigitsAllowedForStrength,
);
}
},
inputType: TextInputType
.numberWithOptions(
inputType: TextInputType.numberWithOptions(
decimal: true,
),
),
@ -390,17 +360,13 @@ class _PrescriptionCheckOutScreenState
width: 5.0,
),
PrescriptionTextFiled(
width: MediaQuery.of(context)
.size
.width *
0.560,
width: MediaQuery.of(context).size.width * 0.560,
element: units,
elementError: unitError,
keyName: 'description',
keyId: 'parameterCode',
hintText: 'Select',
elementList:
model.itemMedicineListUnit,
elementList: model.itemMedicineListUnit,
okFunction: (selectedValue) {
setState(() {
units = selectedValue;
@ -413,8 +379,7 @@ class _PrescriptionCheckOutScreenState
),
SizedBox(height: spaceBetweenTextFields),
PrescriptionTextFiled(
elementList:
model.itemMedicineListRoute,
elementList: model.itemMedicineListRoute,
element: route,
elementError: routeError,
keyId: 'parameterCode',
@ -425,13 +390,11 @@ class _PrescriptionCheckOutScreenState
route['isDefault'] = true;
});
},
hintText:
TranslationBase.of(context).route,
hintText: TranslationBase.of(context).route,
),
SizedBox(height: spaceBetweenTextFields),
PrescriptionTextFiled(
hintText: TranslationBase.of(context)
.frequency,
hintText: TranslationBase.of(context).frequency,
elementError: frequencyError,
element: frequency,
elementList: model.itemMedicineList,
@ -441,21 +404,9 @@ class _PrescriptionCheckOutScreenState
setState(() {
frequency = selectedValue;
frequency['isDefault'] = true;
if (_selectedMedication != null &&
duration != null &&
frequency != null &&
strengthController.text !=
null) {
if (_selectedMedication != null && duration != null && frequency != null && strengthController.text != null) {
model.getBoxQuantity(
freq: frequency[
'parameterCode'],
duration: duration['id'],
itemCode:
_selectedMedication
.itemId,
strength: double.parse(
strengthController
.text));
freq: frequency['parameterCode'], duration: duration['id'], itemCode: _selectedMedication.itemId, strength: double.parse(strengthController.text));
return;
}
@ -463,12 +414,10 @@ class _PrescriptionCheckOutScreenState
}),
SizedBox(height: spaceBetweenTextFields),
PrescriptionTextFiled(
hintText: TranslationBase.of(context)
.doseTime,
hintText: TranslationBase.of(context).doseTime,
elementError: doseTimeError,
element: doseTime,
elementList:
model.medicationDoseTimeList,
elementList: model.medicationDoseTimeList,
keyId: 'id',
keyName: 'nameEn',
okFunction: (selectedValue) {
@ -477,8 +426,7 @@ class _PrescriptionCheckOutScreenState
});
}),
SizedBox(height: spaceBetweenTextFields),
if (model
.patientAssessmentList.isNotEmpty)
if (model.patientAssessmentList.isNotEmpty)
Container(
height: screenSize.height * 0.070,
width: double.infinity,
@ -486,47 +434,19 @@ class _PrescriptionCheckOutScreenState
child: Row(
children: [
Container(
width: MediaQuery.of(context)
.size
.width *
0.29,
width: MediaQuery.of(context).size.width * 0.29,
child: TextField(
decoration:
textFieldSelectorDecoration(
model
.patientAssessmentList[
0]
.icdCode10ID
.toString(),
indication != null
? indication[
'name']
: null,
false),
decoration: textFieldSelectorDecoration(model.patientAssessmentList[0].icdCode10ID.toString(), indication != null ? indication['name'] : null, false),
enabled: true,
readOnly: true,
),
),
Container(
width: MediaQuery.of(context)
.size
.width *
0.65,
width: MediaQuery.of(context).size.width * 0.65,
color: Colors.white,
child: TextField(
maxLines: 5,
decoration:
textFieldSelectorDecoration(
model
.patientAssessmentList[
0]
.asciiDesc
.toString(),
indication != null
? indication[
'name']
: null,
false),
decoration: textFieldSelectorDecoration(model.patientAssessmentList[0].asciiDesc.toString(), indication != null ? indication['name'] : null, false),
enabled: true,
readOnly: true,
),
@ -539,16 +459,10 @@ class _PrescriptionCheckOutScreenState
height: screenSize.height * 0.070,
color: Colors.white,
child: InkWell(
onTap: () =>
selectDate(context, widget.model),
onTap: () => selectDate(context, widget.model),
child: TextField(
decoration: textFieldSelectorDecoration(
TranslationBase.of(context)
.date,
selectedDate != null
? "${AppDateUtils.convertStringToDateFormat(selectedDate.toString(), "yyyy-MM-dd")}"
: null,
true,
decoration: textFieldSelectorDecoration(TranslationBase.of(context).date,
selectedDate != null ? "${AppDateUtils.convertStringToDateFormat(selectedDate.toString(), "yyyy-MM-dd")}" : null, true,
suffixIcon: Icon(
Icons.calendar_today,
color: Colors.black,
@ -561,28 +475,19 @@ class _PrescriptionCheckOutScreenState
PrescriptionTextFiled(
element: duration,
elementError: durationError,
hintText: TranslationBase.of(context)
.duration,
elementList:
model.medicationDurationList,
hintText: TranslationBase.of(context).duration,
elementList: model.medicationDurationList,
keyName: 'nameEn',
keyId: 'id',
okFunction: (selectedValue) {
setState(() {
duration = selectedValue;
if (_selectedMedication != null &&
duration != null &&
frequency != null &&
strengthController.text !=
null) {
if (_selectedMedication != null && duration != null && frequency != null && strengthController.text != null) {
model.getBoxQuantity(
freq:
frequency['parameterCode'],
freq: frequency['parameterCode'],
duration: duration['id'],
itemCode:
_selectedMedication.itemId,
strength: double.parse(
strengthController.text),
itemCode: _selectedMedication.itemId,
strength: double.parse(strengthController.text),
);
box = model.boxQuintity;
@ -595,20 +500,13 @@ class _PrescriptionCheckOutScreenState
SizedBox(height: spaceBetweenTextFields),
SizedBox(height: spaceBetweenTextFields),
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.all(
Radius.circular(6.0)),
border: Border.all(
width: 1.0,
color: HexColor("#CCCCCC"))),
decoration: BoxDecoration(borderRadius: BorderRadius.all(Radius.circular(6.0)), border: Border.all(width: 1.0, color: HexColor("#CCCCCC"))),
child: Stack(
children: [
TextFields(
maxLines: 6,
minLines: 4,
hintText:
TranslationBase.of(context)
.instruction,
hintText: TranslationBase.of(context).instruction,
controller: instructionController,
//keyboardType: TextInputType.number,
),
@ -622,9 +520,7 @@ class _PrescriptionCheckOutScreenState
size: 35,
),
onPressed: () {
initSpeechState().then(
(value) =>
{onVoiceText()});
initSpeechState().then((value) => {onVoiceText()});
},
),
),
@ -633,15 +529,13 @@ class _PrescriptionCheckOutScreenState
),
SizedBox(height: spaceBetweenTextFields),
Container(
margin: EdgeInsets.all(
SizeConfig.widthMultiplier * 5),
margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5),
child: Wrap(
alignment: WrapAlignment.center,
children: <Widget>[
AppButton(
color: AppGlobal.appGreenColor,
title: TranslationBase.of(context)
.addMedication,
title: TranslationBase.of(context).addMedication,
fontWeight: FontWeight.w600,
onPressed: () async {
if (route != null &&
@ -650,101 +544,41 @@ class _PrescriptionCheckOutScreenState
frequency != null &&
units != null &&
selectedDate != null &&
strengthController.text !=
"") {
if (double.parse(
strengthController
.text) >
1000.0) {
strengthController.text != "") {
if (double.parse(strengthController.text) > 1000.0) {
DrAppToastMsg.showErrorToast(
TranslationBase.of(context).thousandIsTheMAXForTheStrength,);
TranslationBase.of(context).thousandIsTheMAXForTheStrength,
);
return;
}
if (double.parse(
strengthController
.text) <
0.0) {
if (double.parse(strengthController.text) < 0.0) {
DrAppToastMsg.showErrorToast(
TranslationBase.of(context).strengthCanNotBeZero,);
TranslationBase.of(context).strengthCanNotBeZero,
);
return;
}
if (formKey.currentState
.validate()) {
if (formKey.currentState.validate()) {
Navigator.pop(context);
{
postPrescription(
icdCode: model
.patientAssessmentList
.isNotEmpty
? model
.patientAssessmentList[
0]
.icdCode10ID
.isEmpty
icdCode: model.patientAssessmentList.isNotEmpty
? model.patientAssessmentList[0].icdCode10ID.isEmpty
? "test"
: model
.patientAssessmentList[
0]
.icdCode10ID
.toString()
: model.patientAssessmentList[0].icdCode10ID.toString()
: "test",
dose: strengthController
.text,
doseUnit: model
.itemMedicineListUnit
.length ==
1
? model
.itemMedicineListUnit[
0][
'parameterCode']
.toString()
: units['parameterCode']
.toString(),
dose: strengthController.text,
doseUnit:
model.itemMedicineListUnit.length == 1 ? model.itemMedicineListUnit[0]['parameterCode'].toString() : units['parameterCode'].toString(),
patient: widget.patient,
doseTimeIn:
doseTime['id']
.toString(),
doseTimeIn: doseTime['id'].toString(),
model: widget.model,
duration: duration['id']
.toString(),
frequency: model
.itemMedicineList
.length ==
1
? model
.itemMedicineList[
0][
'parameterCode']
.toString()
: frequency[
'parameterCode']
.toString(),
route: model.itemMedicineListRoute
.length ==
1
? model
.itemMedicineListRoute[
0][
'parameterCode']
.toString()
: route['parameterCode']
.toString(),
drugId: (widget
.groupProcedures
.aliasN
.replaceAll(
"item code ;",
"")),
strength:
strengthController
.text,
indication:
indicationController
.text,
instruction:
instructionController
.text,
duration: duration['id'].toString(),
frequency: model.itemMedicineList.length == 1 ? model.itemMedicineList[0]['parameterCode'].toString() : frequency['parameterCode'].toString(),
route: model.itemMedicineListRoute.length == 1 ? model.itemMedicineListRoute[0]['parameterCode'].toString() : route['parameterCode'].toString(),
drugId: (widget.groupProcedures.aliasN.replaceAll("item code ;", "")),
strength: strengthController.text,
indication: indicationController.text,
instruction: instructionController.text,
doseTime: selectedDate,
);
}
@ -752,52 +586,32 @@ class _PrescriptionCheckOutScreenState
} else {
setState(() {
if (duration == null) {
durationError =
TranslationBase.of(
context)
.fieldRequired;
durationError = TranslationBase.of(context).fieldRequired;
} else {
durationError = null;
}
if (doseTime == null) {
doseTimeError =
TranslationBase.of(
context)
.fieldRequired;
doseTimeError = TranslationBase.of(context).fieldRequired;
} else {
doseTimeError = null;
}
if (route == null) {
routeError =
TranslationBase.of(
context)
.fieldRequired;
routeError = TranslationBase.of(context).fieldRequired;
} else {
routeError = null;
}
if (frequency == null) {
frequencyError =
TranslationBase.of(
context)
.fieldRequired;
frequencyError = TranslationBase.of(context).fieldRequired;
} else {
frequencyError = null;
}
if (units == null) {
unitError =
TranslationBase.of(
context)
.fieldRequired;
unitError = TranslationBase.of(context).fieldRequired;
} else {
unitError = null;
}
if (strengthController
.text ==
"") {
strengthError =
TranslationBase.of(
context)
.fieldRequired;
if (strengthController.text == "") {
strengthError = TranslationBase.of(context).fieldRequired;
} else {
strengthError = null;
}
@ -849,9 +663,7 @@ class _PrescriptionCheckOutScreenState
/// TODO Elham* Use it from the textfeild utils
InputDecoration textFieldSelectorDecoration(
String hintText, String selectedText, bool isDropDown,
{Icon suffixIcon}) {
InputDecoration textFieldSelectorDecoration(String hintText, String selectedText, bool isDropDown, {Icon suffixIcon}) {
return InputDecoration(
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0),

Loading…
Cancel
Save