Merge branch 'fix_prescriptions' into 'diplomatic-quarter-live'

Fix prescriptions

See merge request Cloud_Solution/diplomatic-quarter!121
merge-update-with-lab-changes
Mohammad Aljammal 5 years ago
commit 2cb37bf8a0

@ -244,8 +244,8 @@ const LANGUAGE = 2;
const PATIENT_OUT_SA = 0; const PATIENT_OUT_SA = 0;
const SESSION_ID = 'TMRhVmkGhOsvamErw'; const SESSION_ID = 'TMRhVmkGhOsvamErw';
const IS_DENTAL_ALLOWED_BACKEND = false; const IS_DENTAL_ALLOWED_BACKEND = false;
const PATIENT_TYPE = 2; const PATIENT_TYPE = 1;
const PATIENT_TYPE_ID = 2; const PATIENT_TYPE_ID = 1;
var DEVICE_TOKEN = ""; var DEVICE_TOKEN = "";
var DeviceTypeID = Platform.isIOS ? 1 : 2; var DeviceTypeID = Platform.isIOS ? 1 : 2;
const LANGUAGE_ID = 2; const LANGUAGE_ID = 2;

@ -82,7 +82,7 @@ class RequestPrescriptionReport {
data['EpisodeID'] = this.episodeID; data['EpisodeID'] = this.episodeID;
data['ClinicID'] = this.clinicID; data['ClinicID'] = this.clinicID;
data['ProjectID'] = this.projectID; data['ProjectID'] = this.projectID;
data['DischargeNo'] = this.dischargeNo; // data['DischargeNo'] = this.dischargeNo;
return data; return data;
} }
} }

@ -57,20 +57,30 @@ class PrescriptionsService extends BaseService {
List<PrescriptionReport> prescriptionReportList = List(); List<PrescriptionReport> prescriptionReportList = List();
Future getPrescriptionReport( Future getPrescriptionReport(
{int dischargeNo, int projectId, int clinicID, String setupID,int episodeID}) async { {Prescriptions prescriptions}) async {
hasError = false; hasError = false;
_requestPrescriptionReport.dischargeNo = dischargeNo; _requestPrescriptionReport.dischargeNo = prescriptions.dischargeNo;
_requestPrescriptionReport.projectID = projectId; _requestPrescriptionReport.projectID = prescriptions.projectID;
_requestPrescriptionReport.clinicID = clinicID; _requestPrescriptionReport.clinicID = prescriptions.clinicID;
_requestPrescriptionReport.setupID = setupID; _requestPrescriptionReport.setupID = prescriptions.setupID;
_requestPrescriptionReport.episodeID = episodeID; _requestPrescriptionReport.episodeID = prescriptions.episodeID;
_requestPrescriptionReport.appointmentNo = prescriptions.appointmentNo;
await baseAppClient.post(GET_PRESCRIPTION_REPORT,
await baseAppClient.post(prescriptions.isInOutPatient? GET_PRESCRIPTION_REPORT_ENH : GET_PRESCRIPTION_REPORT,
onSuccess: (dynamic response, int statusCode) { onSuccess: (dynamic response, int statusCode) {
prescriptionReportList.clear(); prescriptionReportList.clear();
response['INP_GetPrescriptionReport_List'].forEach((prescriptions) { prescriptionReportEnhList.clear();
prescriptionReportList.add(PrescriptionReport.fromJson(prescriptions)); if(prescriptions.isInOutPatient){
}); response['ListPRM'].forEach((prescriptions) {
prescriptionReportEnhList.add(PrescriptionReportEnh.fromJson(prescriptions));
});
}else{
response['INP_GetPrescriptionReport_List'].forEach((prescriptions) {
prescriptionReportList.add(PrescriptionReport.fromJson(prescriptions));
});
}
}, onFailure: (String error, int statusCode) { }, onFailure: (String error, int statusCode) {
hasError = true; hasError = true;
super.error = error; super.error = error;

@ -154,7 +154,7 @@ class MyBalanceViewModel extends BaseViewModel {
Future getFamilyFiles() async { Future getFamilyFiles() async {
setState(ViewState.Busy); setState(ViewState.Busy);
await _myBalanceService.getFamilyFiles(); await _myBalanceService.getSharedRecordByStatus();
if (_myBalanceService.hasError) { if (_myBalanceService.hasError) {
error = _myBalanceService.error; error = _myBalanceService.error;
setState(ViewState.ErrorLocal); setState(ViewState.ErrorLocal);

@ -103,9 +103,9 @@ class PrescriptionsViewModel extends BaseViewModel {
notifyListeners(); notifyListeners();
} }
getPrescriptionReport({int dischargeNo,int projectId,int clinicID,String setupID,int episodeID}) async { getPrescriptionReport({Prescriptions prescriptions}) async {
setState(ViewState.Busy); setState(ViewState.Busy);
await _prescriptionsService.getPrescriptionReport(dischargeNo: dischargeNo,projectId: projectId,clinicID: clinicID,setupID: setupID,episodeID: episodeID); await _prescriptionsService.getPrescriptionReport(prescriptions: prescriptions);
if (_prescriptionsService.hasError) { if (_prescriptionsService.hasError) {
error = _prescriptionsService.error; error = _prescriptionsService.error;
setState(ViewState.ErrorLocal); setState(ViewState.ErrorLocal);

@ -35,9 +35,11 @@ class _SelectPatientFamilyDialogState extends State<SelectPatientFamilyDialog> {
(index) => Column( (index) => Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
if(widget.getAllSharedRecordsByStatusList[index].status==3)
SizedBox( SizedBox(
height: 2, height: 2,
), ),
if(widget.getAllSharedRecordsByStatusList[index].status==3)
Row( Row(
children: <Widget>[ children: <Widget>[
Expanded( Expanded(
@ -65,6 +67,8 @@ class _SelectPatientFamilyDialogState extends State<SelectPatientFamilyDialog> {
) )
], ],
), ),
if(widget.getAllSharedRecordsByStatusList[index].status==3)
SizedBox( SizedBox(
height: 5.0, height: 5.0,
), ),

@ -136,7 +136,7 @@ class PrescriptionDetailsPage extends StatelessWidget {
height: 50, height: 50,
width: double.infinity, width: double.infinity,
child: Center( child: Center(
child: Text(prescriptionReport.frequencyN))), child: Text(prescriptionReport.frequencyN?? ''))),
Container( Container(
color: Colors.white, color: Colors.white,
height: 50, height: 50,

@ -1,5 +1,6 @@
import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/core/model/prescriptions/Prescriptions.dart'; import 'package:diplomaticquarterapp/core/model/prescriptions/Prescriptions.dart';
import 'package:diplomaticquarterapp/core/model/prescriptions/prescription_report.dart';
import 'package:diplomaticquarterapp/core/viewModels/medical/prescriptions_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/prescriptions_view_model.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescription_details_page.dart'; import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescription_details_page.dart';
@ -20,63 +21,124 @@ class PrescriptionItemsPage extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return BaseView<PrescriptionsViewModel>( return BaseView<PrescriptionsViewModel>(
onModelReady: (model) => onModelReady: (model) =>
model.getPrescriptionReport(dischargeNo: prescriptions.dischargeNo,setupID:prescriptions.setupID,clinicID: prescriptions.clinicID,projectId: prescriptions.projectID,episodeID: prescriptions.episodeID), model.getPrescriptionReport(prescriptions: prescriptions),
builder: (_, model, widget) => AppScaffold( builder: (_, model, widget) => AppScaffold(
isShowAppBar: true, isShowAppBar: true,
appBarTitle: TranslationBase.of(context).prescriptions, appBarTitle: TranslationBase.of(context).prescriptions,
baseViewModel: model, baseViewModel: model,
body: Container( body: Container(
height: MediaQuery.of(context).size.height * 0.8, height: MediaQuery.of(context).size.height * 0.8,
child: ListView.builder( child: Column(
itemBuilder: (context, index) => InkWell( children: [
onTap: () => Navigator.push(
context, if(!prescriptions.isInOutPatient)
FadePage( ...List.generate(model.prescriptionReportList.length, (index) => InkWell(
page: PrescriptionDetailsPage( onTap: () => Navigator.push(
prescriptionReport: model.prescriptionReportList[index], context,
FadePage(
page: PrescriptionDetailsPage(
prescriptionReport: model.prescriptionReportList[index],
),
),
), ),
), child: Container(
), width: double.infinity,
child: Container( margin: EdgeInsets.only(top: 10, left: 10, right: 10),
width: double.infinity, padding: EdgeInsets.all(8.0),
margin: EdgeInsets.only(top: 10, left: 10, right: 10), decoration: BoxDecoration(
padding: EdgeInsets.all(8.0), color: Colors.white,
decoration: BoxDecoration( borderRadius: BorderRadius.all(
Radius.circular(10.0),
),
border: Border.all(color: Colors.grey[200], width: 0.5),
),
child: Row(
children: <Widget>[
ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(5)),
child: Image.network(
model.prescriptionReportList[index].imageSRCUrl,
fit: BoxFit.cover,
width: 60,
height: 70,
),
),
Expanded(
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Center(
child: Texts(model.prescriptionReportList[index].itemDescription.isNotEmpty?
model.prescriptionReportList[index].itemDescription :model
.prescriptionReportList[index].itemDescriptionN)),
)),
Icon(
Icons.arrow_forward_ios,
size: 18,
color: Colors.grey[500],
)
],
),
),
))
else
...List.generate(
model.prescriptionReportEnhList.length,
(index) => InkWell(
onTap: (){
PrescriptionReport prescriptionReport = PrescriptionReport(
imageSRCUrl: model.prescriptionReportEnhList[index].imageSRCUrl,
itemDescription: model.prescriptionReportEnhList[index].itemDescription,
itemDescriptionN: model.prescriptionReportEnhList[index].itemDescription,
routeN: model.prescriptionReportEnhList[index].route,
frequency: model.prescriptionReportEnhList[index].frequency,
frequencyN: model.prescriptionReportEnhList[index].frequency,
doseDailyQuantity: model.prescriptionReportEnhList[index].doseDailyQuantity,
days: model.prescriptionReportEnhList[index].days,
itemID: model.prescriptionReportEnhList[index].itemID,
remarks: model.prescriptionReportEnhList[index].remarks
);
Navigator.push(
context,
FadePage(
page: PrescriptionDetailsPage(
prescriptionReport:prescriptionReport,
),
),
);
},
child: Container(
margin: EdgeInsets.all(8.0),
color: Colors.white, color: Colors.white,
borderRadius: BorderRadius.all( child: Row(
Radius.circular(10.0), children: <Widget>[
ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(5)),
child: Image.network(
model.prescriptionReportEnhList[index].imageSRCUrl,
fit: BoxFit.cover,
width: 60,
height: 70,
),
),
Expanded(
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Texts(model.prescriptionReportEnhList[index]
.itemDescription),
],
),
),
),
],
), ),
border: Border.all(color: Colors.grey[200], width: 0.5),
), ),
child: Row(
children: <Widget>[
ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(5)),
child: Image.network(
model.prescriptionReportList[index].imageSRCUrl,
fit: BoxFit.cover,
width: 60,
height: 70,
),
), ),
Expanded( )
child: Padding( ],
padding: const EdgeInsets.all(8.0),
child: Center(
child: Texts(model.prescriptionReportList[index].itemDescription.isNotEmpty?
model.prescriptionReportList[index].itemDescription :model
.prescriptionReportList[index].itemDescriptionN)),
)),
Icon(
Icons.arrow_forward_ios,
size: 18,
color: Colors.grey[500],
)
],
),
),
),
itemCount: model.prescriptionReportList.length,
), ),
), ),
bottomSheet: Container( bottomSheet: Container(

Loading…
Cancel
Save