From 4b54ca7d473e1c090322576327af249beba6c618 Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Thu, 14 Jan 2021 17:53:46 +0200 Subject: [PATCH] prescription --- lib/landing_page.dart | 4 +- .../prescription/prescription_screen.dart | 62 ++++++++++++++----- 2 files changed, 48 insertions(+), 18 deletions(-) diff --git a/lib/landing_page.dart b/lib/landing_page.dart index edfc496c..9d4bfbb0 100644 --- a/lib/landing_page.dart +++ b/lib/landing_page.dart @@ -65,8 +65,8 @@ class _LandingPageState extends State { builder: Builder(builder: (context) => DashboardScreen()), ), MessagesScreen(), - //MyScheduleScreen(), - NewPrescriptionScreen(), + MyScheduleScreen(), + //NewPrescriptionScreen(), ServicesScreen() ], ), diff --git a/lib/screens/prescription/prescription_screen.dart b/lib/screens/prescription/prescription_screen.dart index 45e5173f..54e31f12 100644 --- a/lib/screens/prescription/prescription_screen.dart +++ b/lib/screens/prescription/prescription_screen.dart @@ -453,6 +453,27 @@ class _NewPrescriptionScreenState extends State { .edit), onTap: () { updatePrescriptionForm( + dose: model + .prescriptionList[ + 0] + .entityList[ + index] + .doseTimingID + .toString(), + frequency: model + .prescriptionList[ + 0] + .entityList[ + index] + .frequencyID + .toString(), + rouat: model + .prescriptionList[ + 0] + .entityList[ + index] + .routeID + .toString(), patient: patient, drugId: model @@ -466,7 +487,7 @@ class _NewPrescriptionScreenState extends State { 0] .entityList[ index] - .medicationName, + .doseDetail, remarks: model .prescriptionList[ 0] @@ -571,13 +592,17 @@ class _NewPrescriptionScreenState extends State { } } - void updatePrescriptionForm( - {context, - String drugName, - int drugId, - String remarks, - PrescriptionViewModel model, - PatiantInformtion patient}) { + void updatePrescriptionForm({ + context, + String drugName, + int drugId, + String remarks, + PrescriptionViewModel model, + PatiantInformtion patient, + String rouat, + String frequency, + String dose, + }) { TextEditingController remarksController = TextEditingController(); TextEditingController doseController = TextEditingController(); TextEditingController frequencyController = TextEditingController(); @@ -587,11 +612,11 @@ class _NewPrescriptionScreenState extends State { isScrollControlled: true, builder: (BuildContext bc) { return Container( - height: 600, + height: MediaQuery.of(context).size.height * 0.73, child: Form( child: Padding( padding: - EdgeInsets.symmetric(horizontal: 20.0, vertical: 10.0), + EdgeInsets.symmetric(horizontal: 20.0, vertical: 12.0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -626,7 +651,7 @@ class _NewPrescriptionScreenState extends State { border: Border.all( width: 1.0, color: HexColor("#CCCCCC"))), child: TextFields( - hintText: 'Dose', + hintText: 'Dose Time', controller: doseController, keyboardType: TextInputType.number, ), @@ -649,7 +674,6 @@ class _NewPrescriptionScreenState extends State { SizedBox( height: 12.0, ), - AppText('Remarks'), Container( decoration: BoxDecoration( borderRadius: @@ -667,7 +691,7 @@ class _NewPrescriptionScreenState extends State { height: 12.0, ), SizedBox( - height: 140.0, + height: MediaQuery.of(context).size.height * 0.12, ), Container( margin: @@ -679,6 +703,9 @@ class _NewPrescriptionScreenState extends State { title: 'update prescription'.toUpperCase(), onPressed: () { updatePrescription( + doseId: dose, + frequencyId: frequency, + routeId: rouat, patient: patient, model: model, drugId: drugId, @@ -704,10 +731,13 @@ class _NewPrescriptionScreenState extends State { updatePrescription( {PrescriptionViewModel model, int drugId, + String frequencyId, String remarks, String dose, + String doseId, String frequency, String route, + String routeId, PatiantInformtion patient}) async { //PrescriptionViewModel model = PrescriptionViewModel(); PostPrescriptionReqModel updatePrescriptionReqModel = @@ -725,12 +755,12 @@ class _NewPrescriptionScreenState extends State { dose: frequency.isNotEmpty ? int.parse(dose) : 1, itemId: drugId, doseUnitId: 1, - route: frequency.isNotEmpty ? int.parse(route) : 1, - frequency: frequency.isNotEmpty ? int.parse(frequency) : 1, + route: route.isNotEmpty ? int.parse(route) : routeId, + frequency: frequency.isNotEmpty ? int.parse(frequency) : frequencyId, remarks: remarks.isEmpty ? '' : remarks, approvalRequired: true, icdcode10Id: "test2", - doseTime: 1, + doseTime: dose.isNotEmpty ? int.parse(frequency) : doseId, duration: 2, doseStartDate: "2020-12-20T13:07:41.769Z")); updatePrescriptionReqModel.prescriptionRequestModel = sss;