Prescriptions for in patient

merge-requests/534/head
hussam al-habibeh 5 years ago
parent a95bb8be04
commit 017074ba56

@ -251,6 +251,9 @@ const GET_PRESCRIPTION_REPORT_ENH =
'Services/Patients.svc/REST/GetPrescriptionReport_enh';
const GET_PHARMACY_LIST = "Services/Patients.svc/REST/GetPharmcyList";
const GET_PRESCRIPTION_IN_PATIENT =
'Services/DoctorApplication.svc/REST/GetPrescriptionReportForInPatient';
var selectedPatientType = 1;
//*********change value to decode json from Dropdown ************

@ -0,0 +1,26 @@
class InPatientPrescriptionRequestModel {
String vidaAuthTokenID;
dynamic patientMRN;
dynamic appNo;
dynamic admissionNo;
InPatientPrescriptionRequestModel(
{this.vidaAuthTokenID, this.patientMRN, this.appNo, this.admissionNo});
InPatientPrescriptionRequestModel.fromJson(Map<String, dynamic> json) {
vidaAuthTokenID = json['VidaAuthTokenID'];
patientMRN = json['PatientID'];
appNo = json['AppointmentNo'];
admissionNo = json['AdmissionNo'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['VidaAuthTokenID'] = this.vidaAuthTokenID;
data['PatientID'] = this.patientMRN;
data['AppointmentNo'] = this.appNo;
data['AdmissionNo'] = this.admissionNo;
return data;
}
}

@ -0,0 +1,200 @@
class PrescriotionInPatient {
int admissionNo;
int authorizedBy;
dynamic bedNo;
String comments;
int createdBy;
String createdByName;
dynamic createdByNameN;
String createdOn;
String direction;
int directionID;
dynamic directionN;
String dose;
int editedBy;
dynamic iVDiluentLine;
int iVDiluentType;
dynamic iVDiluentVolume;
dynamic iVRate;
dynamic iVStability;
String itemDescription;
int itemID;
int lineItemNo;
int locationId;
int noOfDoses;
int orderNo;
int patientID;
String pharmacyRemarks;
String prescriptionDatetime;
int prescriptionNo;
String processedBy;
int projectID;
int refillID;
String refillType;
dynamic refillTypeN;
int reviewedPharmacist;
dynamic roomId;
String route;
int routeId;
dynamic routeN;
dynamic setupID;
String startDatetime;
int status;
String statusDescription;
dynamic statusDescriptionN;
String stopDatetime;
int unitofMeasurement;
String unitofMeasurementDescription;
dynamic unitofMeasurementDescriptionN;
PrescriotionInPatient(
{this.admissionNo,
this.authorizedBy,
this.bedNo,
this.comments,
this.createdBy,
this.createdByName,
this.createdByNameN,
this.createdOn,
this.direction,
this.directionID,
this.directionN,
this.dose,
this.editedBy,
this.iVDiluentLine,
this.iVDiluentType,
this.iVDiluentVolume,
this.iVRate,
this.iVStability,
this.itemDescription,
this.itemID,
this.lineItemNo,
this.locationId,
this.noOfDoses,
this.orderNo,
this.patientID,
this.pharmacyRemarks,
this.prescriptionDatetime,
this.prescriptionNo,
this.processedBy,
this.projectID,
this.refillID,
this.refillType,
this.refillTypeN,
this.reviewedPharmacist,
this.roomId,
this.route,
this.routeId,
this.routeN,
this.setupID,
this.startDatetime,
this.status,
this.statusDescription,
this.statusDescriptionN,
this.stopDatetime,
this.unitofMeasurement,
this.unitofMeasurementDescription,
this.unitofMeasurementDescriptionN});
PrescriotionInPatient.fromJson(Map<String, dynamic> json) {
admissionNo = json['AdmissionNo'];
authorizedBy = json['AuthorizedBy'];
bedNo = json['BedNo'];
comments = json['Comments'];
createdBy = json['CreatedBy'];
createdByName = json['CreatedByName'];
createdByNameN = json['CreatedByNameN'];
createdOn = json['CreatedOn'];
direction = json['Direction'];
directionID = json['DirectionID'];
directionN = json['DirectionN'];
dose = json['Dose'];
editedBy = json['EditedBy'];
iVDiluentLine = json['IVDiluentLine'];
iVDiluentType = json['IVDiluentType'];
iVDiluentVolume = json['IVDiluentVolume'];
iVRate = json['IVRate'];
iVStability = json['IVStability'];
itemDescription = json['ItemDescription'];
itemID = json['ItemID'];
lineItemNo = json['LineItemNo'];
locationId = json['LocationId'];
noOfDoses = json['NoOfDoses'];
orderNo = json['OrderNo'];
patientID = json['PatientID'];
pharmacyRemarks = json['PharmacyRemarks'];
prescriptionDatetime = json['PrescriptionDatetime'];
prescriptionNo = json['PrescriptionNo'];
processedBy = json['ProcessedBy'];
projectID = json['ProjectID'];
refillID = json['RefillID'];
refillType = json['RefillType'];
refillTypeN = json['RefillTypeN'];
reviewedPharmacist = json['ReviewedPharmacist'];
roomId = json['RoomId'];
route = json['Route'];
routeId = json['RouteId'];
routeN = json['RouteN'];
setupID = json['SetupID'];
startDatetime = json['StartDatetime'];
status = json['Status'];
statusDescription = json['StatusDescription'];
statusDescriptionN = json['StatusDescriptionN'];
stopDatetime = json['StopDatetime'];
unitofMeasurement = json['UnitofMeasurement'];
unitofMeasurementDescription = json['UnitofMeasurementDescription'];
unitofMeasurementDescriptionN = json['UnitofMeasurementDescriptionN'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['AdmissionNo'] = this.admissionNo;
data['AuthorizedBy'] = this.authorizedBy;
data['BedNo'] = this.bedNo;
data['Comments'] = this.comments;
data['CreatedBy'] = this.createdBy;
data['CreatedByName'] = this.createdByName;
data['CreatedByNameN'] = this.createdByNameN;
data['CreatedOn'] = this.createdOn;
data['Direction'] = this.direction;
data['DirectionID'] = this.directionID;
data['DirectionN'] = this.directionN;
data['Dose'] = this.dose;
data['EditedBy'] = this.editedBy;
data['IVDiluentLine'] = this.iVDiluentLine;
data['IVDiluentType'] = this.iVDiluentType;
data['IVDiluentVolume'] = this.iVDiluentVolume;
data['IVRate'] = this.iVRate;
data['IVStability'] = this.iVStability;
data['ItemDescription'] = this.itemDescription;
data['ItemID'] = this.itemID;
data['LineItemNo'] = this.lineItemNo;
data['LocationId'] = this.locationId;
data['NoOfDoses'] = this.noOfDoses;
data['OrderNo'] = this.orderNo;
data['PatientID'] = this.patientID;
data['PharmacyRemarks'] = this.pharmacyRemarks;
data['PrescriptionDatetime'] = this.prescriptionDatetime;
data['PrescriptionNo'] = this.prescriptionNo;
data['ProcessedBy'] = this.processedBy;
data['ProjectID'] = this.projectID;
data['RefillID'] = this.refillID;
data['RefillType'] = this.refillType;
data['RefillTypeN'] = this.refillTypeN;
data['ReviewedPharmacist'] = this.reviewedPharmacist;
data['RoomId'] = this.roomId;
data['Route'] = this.route;
data['RouteId'] = this.routeId;
data['RouteN'] = this.routeN;
data['SetupID'] = this.setupID;
data['StartDatetime'] = this.startDatetime;
data['Status'] = this.status;
data['StatusDescription'] = this.statusDescription;
data['StatusDescriptionN'] = this.statusDescriptionN;
data['StopDatetime'] = this.stopDatetime;
data['UnitofMeasurement'] = this.unitofMeasurement;
data['UnitofMeasurementDescription'] = this.unitofMeasurementDescription;
data['UnitofMeasurementDescriptionN'] = this.unitofMeasurementDescriptionN;
return data;
}
}

@ -2,13 +2,16 @@ class PrescriptionReqModel {
String vidaAuthTokenID;
dynamic patientMRN;
dynamic appNo;
dynamic admissionNo;
PrescriptionReqModel({this.vidaAuthTokenID, this.patientMRN, this.appNo});
PrescriptionReqModel(
{this.vidaAuthTokenID, this.patientMRN, this.appNo, this.admissionNo});
PrescriptionReqModel.fromJson(Map<String, dynamic> json) {
vidaAuthTokenID = json['VidaAuthTokenID'];
patientMRN = json['PatientMRN'];
appNo = json['AppointmentNo'];
admissionNo = json['AdmissionNo'];
}
Map<String, dynamic> toJson() {
@ -16,6 +19,8 @@ class PrescriptionReqModel {
data['VidaAuthTokenID'] = this.vidaAuthTokenID;
data['PatientMRN'] = this.patientMRN;
data['AppointmentNo'] = this.appNo;
data['AdmissionNo'] = this.admissionNo;
return data;
}
}

@ -1,26 +1,53 @@
import 'package:doctor_app_flutter/config/config.dart';
import 'package:doctor_app_flutter/core/model/Prescriptions/Prescriptions.dart';
import 'package:doctor_app_flutter/core/model/Prescriptions/in_patient_prescription_model.dart';
import 'package:doctor_app_flutter/core/model/Prescriptions/perscription_pharmacy.dart';
import 'package:doctor_app_flutter/core/model/Prescriptions/prescription_in_patient.dart';
import 'package:doctor_app_flutter/core/model/Prescriptions/prescription_report.dart';
import 'package:doctor_app_flutter/core/model/Prescriptions/prescription_report_enh.dart';
import 'package:doctor_app_flutter/core/model/Prescriptions/prescriptions_order.dart';
import 'package:doctor_app_flutter/core/model/Prescriptions/request_get_list_pharmacy_for_prescriptions.dart';
import 'package:doctor_app_flutter/core/model/Prescriptions/request_prescription_report.dart';
import 'package:doctor_app_flutter/core/model/Prescriptions/request_prescription_report_enh.dart';
import 'package:doctor_app_flutter/core/model/prescription_req_model.dart';
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
import 'package:flutter/cupertino.dart';
import 'base/base_service.dart';
class PrescriptionsService extends BaseService {
List<Prescriptions> prescriptionsList = List();
List<PrescriptionsOrder> prescriptionsOrderList = List();
List<PrescriotionInPatient> prescriptionInPatientList = List();
InPatientPrescriptionRequestModel _inPatientPrescriptionRequestModel =
InPatientPrescriptionRequestModel();
Future getPrescriptionInPatient({int mrn, String adn}) async {
_inPatientPrescriptionRequestModel = InPatientPrescriptionRequestModel(
patientMRN: mrn,
admissionNo: adn,
);
hasError = false;
prescriptionInPatientList.clear();
await baseAppClient.post(GET_PRESCRIPTION_IN_PATIENT,
onSuccess: (dynamic response, int statusCode) {
prescriptionsList.clear();
response['List_PrescriptionReportForInPatient'].forEach((prescriptions) {
prescriptionInPatientList
.add(PrescriotionInPatient.fromJson(prescriptions));
});
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, body: _inPatientPrescriptionRequestModel.toJson());
}
Future getPrescriptions(PatiantInformtion patient) async {
hasError = false;
Map<String, dynamic> body = Map();
body['isDentalAllowedBackend'] = false;
await baseAppClient.postPatient(PRESCRIPTIONS,patient: patient,
await baseAppClient.postPatient(PRESCRIPTIONS, patient: patient,
onSuccess: (dynamic response, int statusCode) {
prescriptionsList.clear();
response['PatientPrescriptionList'].forEach((prescriptions) {
@ -37,7 +64,9 @@ class PrescriptionsService extends BaseService {
appointmentNo: 0, isDentalAllowedBackend: false);
List<PrescriptionReport> prescriptionReportList = List();
Future getPrescriptionReport({Prescriptions prescriptions,@required PatiantInformtion patient}) async {
Future getPrescriptionReport(
{Prescriptions prescriptions,
@required PatiantInformtion patient}) async {
hasError = false;
_requestPrescriptionReport.dischargeNo = prescriptions.dischargeNo;
_requestPrescriptionReport.projectID = prescriptions.projectID;
@ -50,8 +79,7 @@ class PrescriptionsService extends BaseService {
prescriptions.isInOutPatient
? GET_PRESCRIPTION_REPORT_ENH
: GET_PRESCRIPTION_REPORT_NEW,
patient: patient,
onSuccess: (dynamic response, int statusCode) {
patient: patient, onSuccess: (dynamic response, int statusCode) {
prescriptionReportList.clear();
prescriptionReportEnhList.clear();
if (prescriptions.isInOutPatient) {
@ -82,11 +110,11 @@ class PrescriptionsService extends BaseService {
);
List<PharmacyPrescriptions> pharmacyPrescriptionsList = List();
Future getListPharmacyForPrescriptions({int itemId,@required PatiantInformtion patient}) async {
Future getListPharmacyForPrescriptions(
{int itemId, @required PatiantInformtion patient}) async {
hasError = false;
requestGetListPharmacyForPrescriptions.itemID = itemId;
await baseAppClient.postPatient(GET_PHARMACY_LIST,
patient: patient,
await baseAppClient.postPatient(GET_PHARMACY_LIST, patient: patient,
onSuccess: (dynamic response, int statusCode) {
pharmacyPrescriptionsList.clear();
response['PharmList'].forEach((prescriptions) {
@ -107,7 +135,8 @@ class PrescriptionsService extends BaseService {
List<PrescriptionReportEnh> prescriptionReportEnhList = List();
Future getPrescriptionReportEnh(
{PrescriptionsOrder prescriptionsOrder, @required PatiantInformtion patient}) async {
{PrescriptionsOrder prescriptionsOrder,
@required PatiantInformtion patient}) async {
///This logic copy from the old app from class [order-history.component.ts] in line 45
bool isInPatient = false;
prescriptionsList.forEach((element) {
@ -141,8 +170,7 @@ class PrescriptionsService extends BaseService {
await baseAppClient.postPatient(
isInPatient ? GET_PRESCRIPTION_REPORT_ENH : GET_PRESCRIPTION_REPORT_NEW,
patient: patient,
onSuccess: (dynamic response, int statusCode) {
patient: patient, onSuccess: (dynamic response, int statusCode) {
prescriptionReportEnhList.clear();
if (isInPatient) {
@ -163,20 +191,21 @@ class PrescriptionsService extends BaseService {
super.error = error;
}, body: _requestPrescriptionReportEnh.toJson());
}
Future getPrescriptionsOrders() async {
Map<String, dynamic> body = Map();
body['isDentalAllowedBackend'] = false;
await baseAppClient.post(GET_PRESCRIPTIONS_ALL_ORDERS,
onSuccess: (dynamic response, int statusCode) {
prescriptionsOrderList.clear();
response['PatientER_GetPatientAllPresOrdersList']
.forEach((prescriptionsOrder) {
prescriptionsOrderList
.add(PrescriptionsOrder.fromJson(prescriptionsOrder));
});
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, body: body);
prescriptionsOrderList.clear();
response['PatientER_GetPatientAllPresOrdersList']
.forEach((prescriptionsOrder) {
prescriptionsOrderList
.add(PrescriptionsOrder.fromJson(prescriptionsOrder));
});
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, body: body);
}
}

@ -3,6 +3,7 @@ import 'package:doctor_app_flutter/core/enum/viewstate.dart';
import 'package:doctor_app_flutter/core/model/Prescription_model.dart';
import 'package:doctor_app_flutter/core/model/Prescriptions/Prescriptions.dart';
import 'package:doctor_app_flutter/core/model/Prescriptions/perscription_pharmacy.dart';
import 'package:doctor_app_flutter/core/model/Prescriptions/prescription_in_patient.dart';
import 'package:doctor_app_flutter/core/model/Prescriptions/prescription_report.dart';
import 'package:doctor_app_flutter/core/model/Prescriptions/prescription_report_enh.dart';
import 'package:doctor_app_flutter/core/model/Prescriptions/prescriptions_order.dart';
@ -56,6 +57,24 @@ class PrescriptionViewModel extends BaseViewModel {
? _prescriptionsOrderListClinic
: _prescriptionsOrderListHospital;
List<PrescriotionInPatient> get inPatientPrescription =>
_prescriptionsService.prescriptionInPatientList;
getPrescriptionsInPatient(PatiantInformtion patient) async {
setState(ViewState.Busy);
await _prescriptionsService.getPrescriptionInPatient(
mrn: patient.patientId, adn: patient.admissionNo);
if (_prescriptionsService.hasError) {
error = _prescriptionsService.error;
setState(ViewState.Error);
} else {
_filterList();
await _getPrescriptionsOrders();
setState(ViewState.Idle);
}
}
Future getItem({int itemID}) async {
hasError = false;
//_insuranceCardService.clearInsuranceCard();

@ -0,0 +1,453 @@
import 'package:doctor_app_flutter/core/model/Prescriptions/Prescriptions.dart';
import 'package:doctor_app_flutter/core/model/Prescriptions/prescription_in_patient.dart';
import 'package:doctor_app_flutter/core/model/Prescriptions/prescription_report.dart';
import 'package:doctor_app_flutter/core/viewModel/prescription_view_model.dart';
import 'package:doctor_app_flutter/core/viewModel/prescriptions_view_model.dart';
import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart';
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/screens/base/base_view.dart';
import 'package:doctor_app_flutter/screens/prescription/prescription_details_page.dart';
import 'package:doctor_app_flutter/util/date-utils.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-header-new-design-app-bar.dart';
import 'package:doctor_app_flutter/widgets/patients/profile/patient_profile_header_with_appointment_card.dart';
import 'package:doctor_app_flutter/widgets/patients/profile/patient_profile_header_with_appointment_card_app_bar.dart';
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/dialogs/ShowImageDialog.dart';
import 'package:doctor_app_flutter/widgets/transitions/fade_page.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
class PrescriptionItemsInPatientPage extends StatelessWidget {
final PrescriotionInPatient prescriptions;
final PatiantInformtion patient;
final String patientType;
final String arrivalType;
final DateTime startOn;
final DateTime stopOn;
final int prescriptionIndex;
PrescriptionItemsInPatientPage(
{Key key,
this.prescriptions,
this.patient,
this.patientType,
this.arrivalType,
this.stopOn,
this.startOn,
this.prescriptionIndex});
@override
Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context);
return BaseView<PrescriptionViewModel>(
onModelReady: (model) async {
if (model.inPatientPrescription.length == 0) {
await model.getPrescriptionsInPatient(patient);
}
},
builder: (_, model, widget) => AppScaffold(
isShowAppBar: true,
backgroundColor: Colors.grey[100],
baseViewModel: model,
appBar: PatientProfileHeaderNewDesignAppBar(
patient, patient.patientType.toString(), patient.arrivedOn),
body: SingleChildScrollView(
child: Container(
child: Column(
children: [
// if (!prescriptions.isInOutPatient)
// ...List.generate(
// model.prescriptionReportList.length,
// (index) => Container(
// decoration: BoxDecoration(
// borderRadius: BorderRadius.circular(12),
// color: Colors.white,
// ),
// margin: EdgeInsets.all(12),
// child: Padding(
// padding: const EdgeInsets.all(8.0),
// child: Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// Container(
// margin:
// EdgeInsets.only(left: 18, right: 18),
// child: AppText(
// model.prescriptionReportList[index]
// .itemDescription.isNotEmpty
// ? model
// .prescriptionReportList[index]
// .itemDescription
// : model
// .prescriptionReportList[index]
// .itemDescriptionN,
// bold: true,
// )),
// SizedBox(
// height: 12,
// ),
// Row(
// children: [
// SizedBox(
// width: 18,
// ),
// Container(
// decoration: BoxDecoration(
// shape: BoxShape.circle,
// border: Border.all(
// width: 0.5,
// color: Colors.grey)),
// height: 55,
// width: 55,
// child: InkWell(
// onTap: () {
// showDialog(
// context: context,
// child: ShowImageDialog(
// imageUrl: model
// .prescriptionReportEnhList[
// index]
// .imageSRCUrl,
// ));
// },
// child: Padding(
// padding: const EdgeInsets.all(8.0),
// child: Image.network(
// model
// .prescriptionReportList[index]
// .imageSRCUrl,
// fit: BoxFit.cover,
// ),
// ),
// ),
// ),
// SizedBox(
// width: 10,
// ),
// Expanded(
// child: Column(
// crossAxisAlignment:
// CrossAxisAlignment.start,
// children: [
// Row(
// children: [
// AppText(
// TranslationBase.of(context)
// .route,
// color: Colors.grey,
// ),
// Expanded(
// child: AppText(" " +
// model
// .prescriptionReportList[
// index]
// .routeN)),
// ],
// ),
// Row(
// children: [
// AppText(
// TranslationBase.of(context)
// .frequency,
// color: Colors.grey,
// ),
// AppText(" " +
// model
// .prescriptionReportList[
// index]
// .frequencyN ??
// ''),
// ],
// ),
// Row(
// children: [
// AppText(
// TranslationBase.of(context)
// .dailyDoses,
// color: Colors.grey,
// ),
// AppText(" " +
// model
// .prescriptionReportList[
// index]
// .doseDailyQuantity ??
// ''),
// ],
// ),
// Row(
// children: [
// AppText(
// TranslationBase.of(context)
// .duration,
// color: Colors.grey,
// ),
// AppText(" " +
// model
// .prescriptionReportList[
// index]
// .days
// .toString() ??
// ''),
// ],
// ),
// SizedBox(
// height: 12,
// ),
// AppText(model
// .prescriptionReportList[
// index]
// .remarks ??
// ''),
// ],
// ),
// )
// ],
// )
// ],
// ),
// ),
// ))
// else
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12),
color: Colors.white,
),
margin: EdgeInsets.all(12),
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
margin: EdgeInsets.only(left: 18, right: 18),
child: AppText(
model.inPatientPrescription[prescriptionIndex]
.itemDescription,
bold: true,
),
),
SizedBox(
height: 12,
),
Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
SizedBox(
width: 18,
),
// Container(
// decoration: BoxDecoration(
// shape: BoxShape.circle,
// border: Border.all(
// width: 0.5, color: Colors.grey)),
// height: 55,
// width: 55,
// child: InkWell(
// onTap: () {
// showDialog(
// context: context,
// // child: ShowImageDialog(
// // imageUrl: model
// // .inPatientPrescription[index]
// // .imageSRCUrl,
// // ),
// );
// },
// child: Padding(
// padding: const EdgeInsets.all(8.0),
// // child: Image.network(
// // model.prescriptionReportEnhList[index]
// // .imageSRCUrl,
// // fit: BoxFit.cover,
// // ),
// ),
// ),
// ),
SizedBox(
width: 10,
),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
AppText(
'Direction',
color: Colors.grey,
),
Expanded(
child: AppText(" " +
model
.inPatientPrescription[
prescriptionIndex]
.direction ??
'')),
],
),
Row(
children: [
AppText(
'Route',
color: Colors.grey,
),
AppText(" " +
model
.inPatientPrescription[
prescriptionIndex]
.route
.toString() ??
''),
],
),
Row(
children: [
AppText(
'Refill',
color: Colors.grey,
),
Expanded(
child: AppText(" " +
model
.inPatientPrescription[
prescriptionIndex]
.refillType ??
'')),
],
),
Row(
children: [
AppText(
'Start Date ',
color: Colors.grey,
),
Expanded(
child: AppText(
'${DateUtils.getDayMonthYearDateFormatted(startOn, isArabic: projectViewModel.isArabic)}',
color: Colors.black,
fontWeight: FontWeight.w600,
fontSize: 14,
),
),
],
),
Row(
children: [
AppText(
'Stop Date',
color: Colors.grey,
),
Expanded(
child: AppText(
'${DateUtils.getDayMonthYearDateFormatted(stopOn, isArabic: projectViewModel.isArabic)}',
color: Colors.black,
fontWeight: FontWeight.w600,
fontSize: 14,
),
),
],
),
Row(
children: [
AppText(
'UOM',
color: Colors.grey,
),
AppText(" " +
model
.inPatientPrescription[
prescriptionIndex]
.unitofMeasurementDescription ??
''),
],
),
Row(
children: [
AppText(
TranslationBase.of(context).dailyDoses,
color: Colors.grey,
),
AppText(" " +
model
.inPatientPrescription[
prescriptionIndex]
.dose
.toString() ??
''),
],
),
Row(
children: [
AppText(
'Status',
color: Colors.grey,
),
AppText(" " +
model
.inPatientPrescription[
prescriptionIndex]
.statusDescription
.toString() ??
''),
],
),
Row(
children: [
AppText(
'Processed',
color: Colors.grey,
),
AppText(" " +
model
.inPatientPrescription[
prescriptionIndex]
.processedBy ??
''),
],
),
Row(
children: [
AppText(
TranslationBase.of(context).dailyDoses,
color: Colors.grey,
),
AppText(" " +
model
.inPatientPrescription[
prescriptionIndex]
.dose
.toString() ??
''),
],
),
SizedBox(
height: 12,
),
AppText(model
.inPatientPrescription[
prescriptionIndex]
.comments ??
''),
],
),
)
],
)
],
),
),
),
],
),
),
),
),
);
}
}

@ -5,6 +5,7 @@ import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart';
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/screens/base/base_view.dart';
import 'package:doctor_app_flutter/screens/prescription/add_prescription_form.dart';
import 'package:doctor_app_flutter/screens/prescription/prescription_item_in_patient_page.dart';
import 'package:doctor_app_flutter/screens/prescription/prescription_items_page.dart';
import 'package:doctor_app_flutter/util/date-utils.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
@ -15,6 +16,7 @@ import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/app_expandable_notifier_new.dart';
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/doctor_card.dart';
import 'package:doctor_app_flutter/widgets/shared/user-guid/in_patient_doctor_card.dart';
import 'package:doctor_app_flutter/widgets/transitions/fade_page.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
@ -29,116 +31,193 @@ class PrescriptionsPage extends StatelessWidget {
String arrivalType = routeArgs['arrivalType'];
ProjectViewModel projectViewModel = Provider.of(context);
return BaseView<PrescriptionViewModel>(
onModelReady: (model) => model.getPrescriptions(patient,patientType:patientType),
onModelReady: (model) => patientType == "1"
? model.getPrescriptionsInPatient(patient)
: model.getPrescriptions(patient, patientType: patientType),
builder: (_, model, w) => AppScaffold(
baseViewModel: model,
isShowAppBar: true,
backgroundColor: Colors.grey[100],
appBar: PatientProfileHeaderNewDesignAppBar(
patient, patientType ?? '0', arrivalType),
body: FractionallySizedBox(
widthFactor: 1.0,
child: ListView(
physics: BouncingScrollPhysics(),
children: <Widget>[
SizedBox(
height: 12,
),
if(model.prescriptionsList.isNotEmpty && patient.patientStatusType != 43)
Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
AppText(
'Order',
style: "caption2",
color: Colors.black,
fontSize: 13,
),
AppText(
'Prescriptions',
bold: true,
fontSize: 22,
),
],
),
),
if(patient.patientStatusType == 43)
Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
AppText(
'Order',
style: "caption2",
color: Colors.black,
fontSize: 13,
baseViewModel: model,
isShowAppBar: true,
backgroundColor: Colors.grey[100],
appBar: PatientProfileHeaderNewDesignAppBar(
patient, patientType ?? '0', arrivalType),
body: patientType != "1"
? FractionallySizedBox(
widthFactor: 1.0,
child: ListView(
physics: BouncingScrollPhysics(),
children: <Widget>[
SizedBox(
height: 12,
),
if (model.prescriptionsList.isNotEmpty &&
patient.patientStatusType != 43)
Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
AppText(
'Order',
style: "caption2",
color: Colors.black,
fontSize: 13,
),
AppText(
'Prescriptions',
bold: true,
fontSize: 22,
),
],
),
AppText(
'Prescriptions',
bold: true,
fontSize: 22,
),
if (patient.patientStatusType == 43)
Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
AppText(
'Order',
style: "caption2",
color: Colors.black,
fontSize: 13,
),
AppText(
'Prescriptions',
bold: true,
fontSize: 22,
),
],
),
],
),
),
if (patientType != null &&
patientType == '7' &&
patient.patientStatusType == 43)
AddNewOrder( onTap: () {
addPrescriptionForm(
context, model, patient, model.prescriptionList);
},label: 'Apply for New Prescriptions Order',),
...List.generate(
model.prescriptionsList.length,
(index) => InkWell(
onTap: () => Navigator.push(
context,
FadePage(
page: PrescriptionItemsPage(
prescriptions:
model.prescriptionsList[index],
patient: patient,
patientType: patientType,
arrivalType: arrivalType,
),
if (patientType != null &&
patientType == '7' &&
patient.patientStatusType == 43)
AddNewOrder(
onTap: () {
addPrescriptionForm(context, model, patient,
model.prescriptionList);
},
label: 'Apply for New Prescriptions Order',
),
...List.generate(
model.prescriptionsList.length,
(index) => InkWell(
onTap: () => Navigator.push(
context,
FadePage(
page: PrescriptionItemsPage(
prescriptions:
model.prescriptionsList[index],
patient: patient,
patientType: patientType,
arrivalType: arrivalType,
),
),
),
child: DoctorCard(
doctorName:
model.prescriptionsList[index].doctorName,
profileUrl: model
.prescriptionsList[index].doctorImageURL,
branch: model.prescriptionsList[index].name,
clinic: model.prescriptionsList[index]
.clinicDescription,
isPrescriptions: true,
appointmentDate:
DateUtils.getDateTimeFromServerFormat(
model.prescriptionsList[index]
.appointmentDate,
),
))),
if (model.prescriptionsList.isEmpty &&
patient.patientStatusType != 43)
Center(
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
SizedBox(
height: 100,
),
child: DoctorCard(
doctorName:
model.prescriptionsList[index].doctorName,
profileUrl:
model.prescriptionsList[index].doctorImageURL,
branch: model.prescriptionsList[index].name,
clinic: model
.prescriptionsList[index].clinicDescription,
isPrescriptions: true,
appointmentDate:
DateUtils.getDateTimeFromServerFormat(
model.prescriptionsList[index].appointmentDate,
),
))),
if(model.prescriptionsList.isEmpty && patient.patientStatusType != 43)
Center(
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
SizedBox(height: 100,),
Image.asset('assets/images/no-data.png'),
Padding(
padding: const EdgeInsets.all(8.0),
child: AppText('No Lab Result Found'),
)
Image.asset('assets/images/no-data.png'),
Padding(
padding: const EdgeInsets.all(8.0),
child: AppText('No Prescriptions Found'),
)
],
),
)
],
),
)
: FractionallySizedBox(
widthFactor: 1.0,
child: ListView(
physics: BouncingScrollPhysics(),
children: <Widget>[
// SizedBox(
// height: 12,
// ),
],
),
)
],
),
),
));
...List.generate(
model.inPatientPrescription.length,
(index) => InkWell(
onTap: () => Navigator.push(
context,
FadePage(
page: PrescriptionItemsInPatientPage(
prescriptionIndex: index,
prescriptions: model
.inPatientPrescription[index],
patient: patient,
patientType: patientType,
arrivalType: arrivalType,
startOn: DateUtils
.getDateTimeFromServerFormat(
model.inPatientPrescription[index]
.startDatetime,
),
stopOn: DateUtils
.getDateTimeFromServerFormat(
model.inPatientPrescription[index]
.stopDatetime,
),
),
),
),
child: InPatientDoctorCard(
doctorName: model.inPatientPrescription[index]
.itemDescription,
profileUrl: 'sss',
branch: 'hamza',
clinic: 'basheer',
isPrescriptions: true,
appointmentDate:
DateUtils.getDateTimeFromServerFormat(
model.inPatientPrescription[index]
.prescriptionDatetime,
),
createdBy: model.inPatientPrescription[index]
.createdByName,
))),
if (model.inPatientPrescription.length == 0)
Center(
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
SizedBox(
height: 100,
),
Image.asset('assets/images/no-data.png'),
Padding(
padding: const EdgeInsets.all(8.0),
child: AppText('No Prescriptions Found'),
)
],
),
)
],
),
)));
}
}

@ -0,0 +1,199 @@
import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart';
import 'package:doctor_app_flutter/util/date-utils.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/patients/profile/large_avatar.dart';
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
import 'package:eva_icons_flutter/eva_icons_flutter.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:provider/provider.dart';
class InPatientDoctorCard extends StatelessWidget {
final String doctorName;
final String branch;
final DateTime appointmentDate;
final String profileUrl;
final String invoiceNO;
final String orderNo;
final Function onTap;
final bool isPrescriptions;
final String clinic;
final createdBy;
InPatientDoctorCard(
{this.doctorName,
this.branch,
this.profileUrl,
this.invoiceNO,
this.onTap,
this.appointmentDate,
this.orderNo,
this.isPrescriptions = false,
this.clinic,
this.createdBy});
@override
Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context);
return Container(
margin: EdgeInsets.all(10),
decoration: BoxDecoration(
border: Border.all(
width: 0.5,
color: Colors.white,
),
borderRadius: BorderRadius.all(
Radius.circular(15.0),
),
color: Colors.white),
child: Padding(
padding: const EdgeInsets.all(15.0),
child: InkWell(
onTap: onTap,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Row(
children: [
Expanded(
child: AppText(
doctorName,
bold: true,
)),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
AppText(
'${DateUtils.getDayMonthYearDateFormatted(appointmentDate, isArabic: projectViewModel.isArabic)}',
color: Colors.black,
fontWeight: FontWeight.w600,
fontSize: 14,
),
if (!isPrescriptions)
AppText(
'${DateUtils.getHour(appointmentDate)}',
fontWeight: FontWeight.w600,
color: Colors.grey[700],
fontSize: 14,
),
],
),
),
],
),
Row(
children: [
AppText(
'CreatedBy ',
//bold: true,
),
Expanded(
child: AppText(
createdBy,
bold: true,
),
),
],
),
Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
// Container(
// child: LargeAvatar(
// name: doctorName,
// url: profileUrl,
// ),
// width: 55,
// height: 55,
// ),
Expanded(
child: Row(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Expanded(
child: Container(
margin: EdgeInsets.all(10),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
// if (orderNo != null && !isPrescriptions)
// Row(
// children: <Widget>[
// AppText(
// TranslationBase.of(context).orderNo +
// ": ",
// color: Colors.grey[500],
// fontSize: 14,
// ),
// AppText(
// orderNo ?? '',
// fontSize: 14,
// )
// ],
// ),
// if (invoiceNO != null && !isPrescriptions)
// Row(
// children: <Widget>[
// AppText(
// TranslationBase.of(context)
// .invoiceNo +
// ": ",
// fontSize: 14,
// color: Colors.grey[500],
// ),
// AppText(
// invoiceNO,
// fontSize: 14,
// )
// ],
// ),
// if (clinic != null)
// Row(
// children: <Widget>[
// AppText(
// TranslationBase.of(context).clinic +
// ": ",
// color: Colors.grey[500],
// fontSize: 14,
// ),
// AppText(
// clinic,
// fontSize: 14,
// )
// ],
// ),
// if (branch != null)
// Row(
// children: <Widget>[
// AppText(
// TranslationBase.of(context).branch +
// ": ",
// fontSize: 14,
// color: Colors.grey[500],
// ),
// AppText(
// branch,
// fontSize: 14,
// )
// ],
// )
]),
),
),
Icon(
EvaIcons.eye,
)
],
),
),
],
),
],
),
),
),
);
}
}
Loading…
Cancel
Save