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

 Conflicts:
	lib/screens/patients/InPatientPage.dart
merge-requests/825/head
Elham Rababh 5 years ago
commit 8fc4b1596b

@ -5,8 +5,8 @@ const ONLY_NUMBERS = "[0-9]";
const ONLY_LETTERS = "[a-zA-Z &'\"]"; const ONLY_LETTERS = "[a-zA-Z &'\"]";
const ONLY_DATE = "[0-9/]"; const ONLY_DATE = "[0-9/]";
const BASE_URL_LIVE_CARE = 'https://livecare.hmg.com/'; const BASE_URL_LIVE_CARE = 'https://livecare.hmg.com/';
const BASE_URL = 'https://hmgwebservices.com/'; // const BASE_URL = 'https://hmgwebservices.com/';
// const BASE_URL = 'https://uat.hmgwebservices.com/'; const BASE_URL = 'https://uat.hmgwebservices.com/';
const PHARMACY_ITEMS_URL = "Services/Lists.svc/REST/GetPharmcyItems_Region_enh"; const PHARMACY_ITEMS_URL = "Services/Lists.svc/REST/GetPharmcyItems_Region_enh";
const PHARMACY_LIST_URL = "Services/Patients.svc/REST/GetPharmcyList"; const PHARMACY_LIST_URL = "Services/Patients.svc/REST/GetPharmcyList";
const PATIENT_PROGRESS_NOTE_URL = "Services/DoctorApplication.svc/REST/GetProgressNoteForInPatient"; const PATIENT_PROGRESS_NOTE_URL = "Services/DoctorApplication.svc/REST/GetProgressNoteForInPatient";
@ -240,6 +240,7 @@ const REMOVE_PATIENT_FROM_DOCTOR = "LiveCareApi/DoctorApp/BackPatientToQueue";
const CREATE_DOCTOR_RESPONSE = "Services/DoctorApplication.svc/REST/CreateDoctorResponse"; const CREATE_DOCTOR_RESPONSE = "Services/DoctorApplication.svc/REST/CreateDoctorResponse";
const GET_DOCTOR_NOT_REPLIED_COUNTS = "Services/DoctorApplication.svc/REST/DoctorApp_GetDoctorNotRepliedCounts"; const GET_DOCTOR_NOT_REPLIED_COUNTS = "Services/DoctorApplication.svc/REST/DoctorApp_GetDoctorNotRepliedCounts";
const ALL_SPECIAL_LAB_RESULT = "services/Patients.svc/REST/GetPatientLabSpecialResultsALL"; const ALL_SPECIAL_LAB_RESULT = "services/Patients.svc/REST/GetPatientLabSpecialResultsALL";
const GET_MEDICATION_FOR_IN_PATIENT = "Services/DoctorApplication.svc/REST/Doctor_GetMedicationForInpatient";
const GET_EPISODE_FOR_INPATIENT = "/Services/DoctorApplication.svc/REST/DoctorApp_GetEpisodeForInpatient"; const GET_EPISODE_FOR_INPATIENT = "/Services/DoctorApplication.svc/REST/DoctorApp_GetEpisodeForInpatient";
var selectedPatientType = 1; var selectedPatientType = 1;

@ -0,0 +1,136 @@
class GetMedicationForInPatientModel {
String setupID;
int projectID;
int admissionNo;
int patientID;
int orderNo;
int prescriptionNo;
int lineItemNo;
String prescriptionDatetime;
int itemID;
int directionID;
int refillID;
String dose;
int unitofMeasurement;
String startDatetime;
String stopDatetime;
int noOfDoses;
int routeId;
String comments;
int reviewedPharmacist;
dynamic reviewedPharmacistDatetime;
dynamic discountinueDatetime;
dynamic rescheduleDatetime;
int status;
String statusDescription;
int createdBy;
String createdOn;
dynamic editedBy;
dynamic editedOn;
dynamic strength;
String pHRItemDescription;
String pHRItemDescriptionN;
GetMedicationForInPatientModel(
{this.setupID,
this.projectID,
this.admissionNo,
this.patientID,
this.orderNo,
this.prescriptionNo,
this.lineItemNo,
this.prescriptionDatetime,
this.itemID,
this.directionID,
this.refillID,
this.dose,
this.unitofMeasurement,
this.startDatetime,
this.stopDatetime,
this.noOfDoses,
this.routeId,
this.comments,
this.reviewedPharmacist,
this.reviewedPharmacistDatetime,
this.discountinueDatetime,
this.rescheduleDatetime,
this.status,
this.statusDescription,
this.createdBy,
this.createdOn,
this.editedBy,
this.editedOn,
this.strength,
this.pHRItemDescription,
this.pHRItemDescriptionN});
GetMedicationForInPatientModel.fromJson(Map<String, dynamic> json) {
setupID = json['SetupID'];
projectID = json['ProjectID'];
admissionNo = json['AdmissionNo'];
patientID = json['PatientID'];
orderNo = json['OrderNo'];
prescriptionNo = json['PrescriptionNo'];
lineItemNo = json['LineItemNo'];
prescriptionDatetime = json['PrescriptionDatetime'];
itemID = json['ItemID'];
directionID = json['DirectionID'];
refillID = json['RefillID'];
dose = json['Dose'];
unitofMeasurement = json['UnitofMeasurement'];
startDatetime = json['StartDatetime'];
stopDatetime = json['StopDatetime'];
noOfDoses = json['NoOfDoses'];
routeId = json['RouteId'];
comments = json['Comments'];
reviewedPharmacist = json['ReviewedPharmacist'];
reviewedPharmacistDatetime = json['ReviewedPharmacistDatetime'];
discountinueDatetime = json['DiscountinueDatetime'];
rescheduleDatetime = json['RescheduleDatetime'];
status = json['Status'];
statusDescription = json['StatusDescription'];
createdBy = json['CreatedBy'];
createdOn = json['CreatedOn'];
editedBy = json['EditedBy'];
editedOn = json['EditedOn'];
strength = json['Strength'];
pHRItemDescription = json['PHRItemDescription'];
pHRItemDescriptionN = json['PHRItemDescriptionN'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['SetupID'] = this.setupID;
data['ProjectID'] = this.projectID;
data['AdmissionNo'] = this.admissionNo;
data['PatientID'] = this.patientID;
data['OrderNo'] = this.orderNo;
data['PrescriptionNo'] = this.prescriptionNo;
data['LineItemNo'] = this.lineItemNo;
data['PrescriptionDatetime'] = this.prescriptionDatetime;
data['ItemID'] = this.itemID;
data['DirectionID'] = this.directionID;
data['RefillID'] = this.refillID;
data['Dose'] = this.dose;
data['UnitofMeasurement'] = this.unitofMeasurement;
data['StartDatetime'] = this.startDatetime;
data['StopDatetime'] = this.stopDatetime;
data['NoOfDoses'] = this.noOfDoses;
data['RouteId'] = this.routeId;
data['Comments'] = this.comments;
data['ReviewedPharmacist'] = this.reviewedPharmacist;
data['ReviewedPharmacistDatetime'] = this.reviewedPharmacistDatetime;
data['DiscountinueDatetime'] = this.discountinueDatetime;
data['RescheduleDatetime'] = this.rescheduleDatetime;
data['Status'] = this.status;
data['StatusDescription'] = this.statusDescription;
data['CreatedBy'] = this.createdBy;
data['CreatedOn'] = this.createdOn;
data['EditedBy'] = this.editedBy;
data['EditedOn'] = this.editedOn;
data['Strength'] = this.strength;
data['PHRItemDescription'] = this.pHRItemDescription;
data['PHRItemDescriptionN'] = this.pHRItemDescriptionN;
return data;
}
}

@ -0,0 +1,60 @@
class GetMedicationForInPatientRequestModel {
bool isDentalAllowedBackend;
double versionID;
int channel;
int languageID;
String iPAdress;
String generalid;
int deviceTypeID;
String tokenID;
int patientID;
int admissionNo;
String sessionID;
int projectID;
GetMedicationForInPatientRequestModel(
{this.isDentalAllowedBackend,
this.versionID,
this.channel,
this.languageID,
this.iPAdress,
this.generalid,
this.deviceTypeID,
this.tokenID,
this.patientID,
this.admissionNo,
this.sessionID,
this.projectID});
GetMedicationForInPatientRequestModel.fromJson(Map<String, dynamic> json) {
isDentalAllowedBackend = json['isDentalAllowedBackend'];
versionID = json['VersionID'];
channel = json['Channel'];
languageID = json['LanguageID'];
iPAdress = json['IPAdress'];
generalid = json['generalid'];
deviceTypeID = json['DeviceTypeID'];
tokenID = json['TokenID'];
patientID = json['PatientID'];
admissionNo = json['AdmissionNo'];
sessionID = json['SessionID'];
projectID = json['ProjectID'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['isDentalAllowedBackend'] = this.isDentalAllowedBackend;
data['VersionID'] = this.versionID;
data['Channel'] = this.channel;
data['LanguageID'] = this.languageID;
data['IPAdress'] = this.iPAdress;
data['generalid'] = this.generalid;
data['DeviceTypeID'] = this.deviceTypeID;
data['TokenID'] = this.tokenID;
data['PatientID'] = this.patientID;
data['AdmissionNo'] = this.admissionNo;
data['SessionID'] = this.sessionID;
data['ProjectID'] = this.projectID;
return data;
}
}

@ -1,41 +1,41 @@
import 'package:doctor_app_flutter/widgets/shared/StarRating.dart'; import 'package:doctor_app_flutter/widgets/shared/StarRating.dart';
class SickLeavePatientModel { class SickLeavePatientModel {
String setupID; dynamic setupID;
int projectID; dynamic projectID;
int patientID; dynamic patientID;
int patientType; dynamic patientType;
int clinicID; dynamic clinicID;
int doctorID; dynamic doctorID;
int requestNo; dynamic requestNo;
String requestDate; dynamic requestDate;
int sickLeaveDays; dynamic sickLeaveDays;
int appointmentNo; dynamic appointmentNo;
int admissionNo; dynamic admissionNo;
int actualDoctorRate; dynamic actualDoctorRate;
String appointmentDate; dynamic appointmentDate;
String clinicName; dynamic clinicName;
String doctorImageURL; dynamic doctorImageURL;
String doctorName; dynamic doctorName;
int doctorRate; dynamic doctorRate;
String doctorTitle; dynamic doctorTitle;
int gender; dynamic gender;
String genderDescription; dynamic genderDescription;
bool isActiveDoctorProfile; bool isActiveDoctorProfile;
bool isDoctorAllowVedioCall; bool isDoctorAllowVedioCall;
bool isExecludeDoctor; bool isExecludeDoctor;
bool isInOutPatient; bool isInOutPatient;
String isInOutPatientDescription; dynamic isInOutPatientDescription;
String isInOutPatientDescriptionN; dynamic isInOutPatientDescriptionN;
bool isLiveCareAppointment; bool isLiveCareAppointment;
int noOfPatientsRate; dynamic noOfPatientsRate;
dynamic patientName; dynamic patientName;
String projectName; dynamic projectName;
String qR; dynamic qR;
// List<String> speciality; // List<String> speciality;
String strRequestDate; dynamic strRequestDate;
String startDate; dynamic startDate;
String endDate; dynamic endDate;
dynamic isExtendedLeave; dynamic isExtendedLeave;
dynamic noOfDays; dynamic noOfDays;
dynamic patientMRN; dynamic patientMRN;

@ -1,5 +1,7 @@
import 'package:doctor_app_flutter/config/config.dart'; 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/Prescriptions.dart';
import 'package:doctor_app_flutter/core/model/Prescriptions/get_medication_for_inpatient_model.dart';
import 'package:doctor_app_flutter/core/model/Prescriptions/get_medication_for_inpatient_request_model.dart';
import 'package:doctor_app_flutter/core/model/Prescriptions/in_patient_prescription_model.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/perscription_pharmacy.dart';
import 'package:doctor_app_flutter/core/model/Prescriptions/prescription_in_patient.dart'; import 'package:doctor_app_flutter/core/model/Prescriptions/prescription_in_patient.dart';
@ -16,11 +18,13 @@ import '../../base/base_service.dart';
class PrescriptionsService extends BaseService { class PrescriptionsService extends BaseService {
List<Prescriptions> prescriptionsList = List(); List<Prescriptions> prescriptionsList = List();
List<GetMedicationForInPatientModel> medicationForInPatient = List();
List<PrescriptionsOrder> prescriptionsOrderList = List(); List<PrescriptionsOrder> prescriptionsOrderList = List();
List<PrescriotionInPatient> prescriptionInPatientList = List(); List<PrescriotionInPatient> prescriptionInPatientList = List();
InPatientPrescriptionRequestModel _inPatientPrescriptionRequestModel = InPatientPrescriptionRequestModel _inPatientPrescriptionRequestModel = InPatientPrescriptionRequestModel();
InPatientPrescriptionRequestModel(); GetMedicationForInPatientRequestModel _getMedicationForInPatientRequestModel =
GetMedicationForInPatientRequestModel();
Future getPrescriptionInPatient({int mrn, String adn}) async { Future getPrescriptionInPatient({int mrn, String adn}) async {
_inPatientPrescriptionRequestModel = InPatientPrescriptionRequestModel( _inPatientPrescriptionRequestModel = InPatientPrescriptionRequestModel(
@ -30,12 +34,10 @@ class PrescriptionsService extends BaseService {
hasError = false; hasError = false;
prescriptionInPatientList.clear(); prescriptionInPatientList.clear();
await baseAppClient.post(GET_PRESCRIPTION_IN_PATIENT, await baseAppClient.post(GET_PRESCRIPTION_IN_PATIENT, onSuccess: (dynamic response, int statusCode) {
onSuccess: (dynamic response, int statusCode) {
prescriptionsList.clear(); prescriptionsList.clear();
response['List_PrescriptionReportForInPatient'].forEach((prescriptions) { response['List_PrescriptionReportForInPatient'].forEach((prescriptions) {
prescriptionInPatientList prescriptionInPatientList.add(PrescriotionInPatient.fromJson(prescriptions));
.add(PrescriotionInPatient.fromJson(prescriptions));
}); });
}, onFailure: (String error, int statusCode) { }, onFailure: (String error, int statusCode) {
hasError = true; hasError = true;
@ -47,8 +49,7 @@ class PrescriptionsService extends BaseService {
hasError = false; hasError = false;
Map<String, dynamic> body = Map(); Map<String, dynamic> body = Map();
body['isDentalAllowedBackend'] = false; body['isDentalAllowedBackend'] = false;
await baseAppClient.postPatient(PRESCRIPTIONS, patient: patient, await baseAppClient.postPatient(PRESCRIPTIONS, patient: patient, onSuccess: (dynamic response, int statusCode) {
onSuccess: (dynamic response, int statusCode) {
prescriptionsList.clear(); prescriptionsList.clear();
response['PatientPrescriptionList'].forEach((prescriptions) { response['PatientPrescriptionList'].forEach((prescriptions) {
prescriptionsList.add(Prescriptions.fromJson(prescriptions)); prescriptionsList.add(Prescriptions.fromJson(prescriptions));
@ -60,13 +61,10 @@ class PrescriptionsService extends BaseService {
} }
RequestPrescriptionReport _requestPrescriptionReport = RequestPrescriptionReport _requestPrescriptionReport =
RequestPrescriptionReport( RequestPrescriptionReport(appointmentNo: 0, isDentalAllowedBackend: false);
appointmentNo: 0, isDentalAllowedBackend: false);
List<PrescriptionReport> prescriptionReportList = List(); List<PrescriptionReport> prescriptionReportList = List();
Future getPrescriptionReport( Future getPrescriptionReport({Prescriptions prescriptions, @required PatiantInformtion patient}) async {
{Prescriptions prescriptions,
@required PatiantInformtion patient}) async {
hasError = false; hasError = false;
_requestPrescriptionReport.dischargeNo = prescriptions.dischargeNo; _requestPrescriptionReport.dischargeNo = prescriptions.dischargeNo;
_requestPrescriptionReport.projectID = prescriptions.projectID; _requestPrescriptionReport.projectID = prescriptions.projectID;
@ -76,23 +74,18 @@ class PrescriptionsService extends BaseService {
_requestPrescriptionReport.appointmentNo = prescriptions.appointmentNo; _requestPrescriptionReport.appointmentNo = prescriptions.appointmentNo;
await baseAppClient.postPatient( await baseAppClient.postPatient(
prescriptions.isInOutPatient prescriptions.isInOutPatient ? GET_PRESCRIPTION_REPORT_ENH : GET_PRESCRIPTION_REPORT_NEW,
? GET_PRESCRIPTION_REPORT_ENH
: GET_PRESCRIPTION_REPORT_NEW,
patient: patient, onSuccess: (dynamic response, int statusCode) { patient: patient, onSuccess: (dynamic response, int statusCode) {
prescriptionReportList.clear(); prescriptionReportList.clear();
prescriptionReportEnhList.clear(); prescriptionReportEnhList.clear();
if (prescriptions.isInOutPatient) { if (prescriptions.isInOutPatient) {
response['ListPRM'].forEach((prescriptions) { response['ListPRM'].forEach((prescriptions) {
prescriptionReportList prescriptionReportList.add(PrescriptionReport.fromJson(prescriptions));
.add(PrescriptionReport.fromJson(prescriptions)); prescriptionReportEnhList.add(PrescriptionReportEnh.fromJson(prescriptions));
prescriptionReportEnhList
.add(PrescriptionReportEnh.fromJson(prescriptions));
}); });
} else { } else {
response['INP_GetPrescriptionReport_List'].forEach((prescriptions) { response['INP_GetPrescriptionReport_List'].forEach((prescriptions) {
prescriptionReportList prescriptionReportList.add(PrescriptionReport.fromJson(prescriptions));
.add(PrescriptionReport.fromJson(prescriptions));
}); });
} }
}, onFailure: (String error, int statusCode) { }, onFailure: (String error, int statusCode) {
@ -101,8 +94,7 @@ class PrescriptionsService extends BaseService {
}, body: _requestPrescriptionReport.toJson()); }, body: _requestPrescriptionReport.toJson());
} }
RequestGetListPharmacyForPrescriptions RequestGetListPharmacyForPrescriptions requestGetListPharmacyForPrescriptions =
requestGetListPharmacyForPrescriptions =
RequestGetListPharmacyForPrescriptions( RequestGetListPharmacyForPrescriptions(
latitude: 0, latitude: 0,
longitude: 0, longitude: 0,
@ -110,16 +102,13 @@ class PrescriptionsService extends BaseService {
); );
List<PharmacyPrescriptions> pharmacyPrescriptionsList = List(); List<PharmacyPrescriptions> pharmacyPrescriptionsList = List();
Future getListPharmacyForPrescriptions( Future getListPharmacyForPrescriptions({int itemId, @required PatiantInformtion patient}) async {
{int itemId, @required PatiantInformtion patient}) async {
hasError = false; hasError = false;
requestGetListPharmacyForPrescriptions.itemID = itemId; requestGetListPharmacyForPrescriptions.itemID = itemId;
await baseAppClient.postPatient(GET_PHARMACY_LIST, patient: patient, await baseAppClient.postPatient(GET_PHARMACY_LIST, patient: patient, onSuccess: (dynamic response, int statusCode) {
onSuccess: (dynamic response, int statusCode) {
pharmacyPrescriptionsList.clear(); pharmacyPrescriptionsList.clear();
response['PharmList'].forEach((prescriptions) { response['PharmList'].forEach((prescriptions) {
pharmacyPrescriptionsList pharmacyPrescriptionsList.add(PharmacyPrescriptions.fromJson(prescriptions));
.add(PharmacyPrescriptions.fromJson(prescriptions));
}); });
}, onFailure: (String error, int statusCode) { }, onFailure: (String error, int statusCode) {
hasError = true; hasError = true;
@ -127,16 +116,13 @@ class PrescriptionsService extends BaseService {
}, body: requestGetListPharmacyForPrescriptions.toJson()); }, body: requestGetListPharmacyForPrescriptions.toJson());
} }
RequestPrescriptionReportEnh _requestPrescriptionReportEnh = RequestPrescriptionReportEnh _requestPrescriptionReportEnh = RequestPrescriptionReportEnh(
RequestPrescriptionReportEnh(
isDentalAllowedBackend: false, isDentalAllowedBackend: false,
); );
List<PrescriptionReportEnh> prescriptionReportEnhList = List(); List<PrescriptionReportEnh> prescriptionReportEnhList = List();
Future getPrescriptionReportEnh( 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 ///This logic copy from the old app from class [order-history.component.ts] in line 45
bool isInPatient = false; bool isInPatient = false;
prescriptionsList.forEach((element) { prescriptionsList.forEach((element) {
@ -151,8 +137,7 @@ class PrescriptionsService extends BaseService {
isInPatient = element.isInOutPatient; isInPatient = element.isInOutPatient;
} }
} else { } else {
if (int.parse(prescriptionsOrder.appointmentNo) == if (int.parse(prescriptionsOrder.appointmentNo) == element.appointmentNo) {
element.appointmentNo) {
_requestPrescriptionReportEnh.appointmentNo = element.appointmentNo; _requestPrescriptionReportEnh.appointmentNo = element.appointmentNo;
_requestPrescriptionReportEnh.clinicID = element.clinicID; _requestPrescriptionReportEnh.clinicID = element.clinicID;
_requestPrescriptionReportEnh.projectID = element.projectID; _requestPrescriptionReportEnh.projectID = element.projectID;
@ -168,20 +153,17 @@ class PrescriptionsService extends BaseService {
hasError = false; hasError = false;
await baseAppClient.postPatient( await baseAppClient.postPatient(isInPatient ? GET_PRESCRIPTION_REPORT_ENH : GET_PRESCRIPTION_REPORT_NEW,
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(); prescriptionReportEnhList.clear();
if (isInPatient) { if (isInPatient) {
response['ListPRM'].forEach((prescriptions) { response['ListPRM'].forEach((prescriptions) {
prescriptionReportEnhList prescriptionReportEnhList.add(PrescriptionReportEnh.fromJson(prescriptions));
.add(PrescriptionReportEnh.fromJson(prescriptions));
}); });
} else { } else {
response['INP_GetPrescriptionReport_List'].forEach((prescriptions) { response['INP_GetPrescriptionReport_List'].forEach((prescriptions) {
PrescriptionReportEnh reportEnh = PrescriptionReportEnh reportEnh = PrescriptionReportEnh.fromJson(prescriptions);
PrescriptionReportEnh.fromJson(prescriptions);
reportEnh.itemDescription = prescriptions['ItemDescriptionN']; reportEnh.itemDescription = prescriptions['ItemDescriptionN'];
prescriptionReportEnhList.add(reportEnh); prescriptionReportEnhList.add(reportEnh);
}); });
@ -195,17 +177,34 @@ class PrescriptionsService extends BaseService {
Future getPrescriptionsOrders() async { Future getPrescriptionsOrders() async {
Map<String, dynamic> body = Map(); Map<String, dynamic> body = Map();
body['isDentalAllowedBackend'] = false; body['isDentalAllowedBackend'] = false;
await baseAppClient.post(GET_PRESCRIPTIONS_ALL_ORDERS, await baseAppClient.post(GET_PRESCRIPTIONS_ALL_ORDERS, onSuccess: (dynamic response, int statusCode) {
onSuccess: (dynamic response, int statusCode) {
prescriptionsOrderList.clear(); prescriptionsOrderList.clear();
response['PatientER_GetPatientAllPresOrdersList'] response['PatientER_GetPatientAllPresOrdersList'].forEach((prescriptionsOrder) {
.forEach((prescriptionsOrder) { prescriptionsOrderList.add(PrescriptionsOrder.fromJson(prescriptionsOrder));
prescriptionsOrderList
.add(PrescriptionsOrder.fromJson(prescriptionsOrder));
}); });
}, onFailure: (String error, int statusCode) { }, onFailure: (String error, int statusCode) {
hasError = true; hasError = true;
super.error = error; super.error = error;
}, body: body); }, body: body);
} }
Future getMedicationForInPatient(PatiantInformtion patient) async {
hasError = false;
_getMedicationForInPatientRequestModel = GetMedicationForInPatientRequestModel(
isDentalAllowedBackend: false,
admissionNo: int.parse(patient.admissionNo),
tokenID: "@dm!n",
projectID: 15,
);
await baseAppClient.postPatient(GET_MEDICATION_FOR_IN_PATIENT, patient: patient,
onSuccess: (dynamic response, int statusCode) {
medicationForInPatient.clear();
response['List_GetMedicationForInpatient'].forEach((prescriptions) {
medicationForInPatient.add(GetMedicationForInPatientModel.fromJson(prescriptions));
});
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, body: _getMedicationForInPatientRequestModel.toJson());
}
} }

@ -36,6 +36,8 @@ class UcafViewModel extends BaseViewModel {
List<OrderProcedure> get orderProcedures => _ucafService.orderProcedureList; List<OrderProcedure> get orderProcedures => _ucafService.orderProcedureList;
Function saveUCAFOnTap;
String selectedLanguage; String selectedLanguage;
String heightCm = "0"; String heightCm = "0";
String weightKg = "0"; String weightKg = "0";
@ -45,7 +47,11 @@ class UcafViewModel extends BaseViewModel {
String respirationBeatPerMinute = "0"; String respirationBeatPerMinute = "0";
String bloodPressure = "0 / 0"; String bloodPressure = "0 / 0";
resetDataInFirst() { resetDataInFirst({bool firstPage = true}) {
if(firstPage){
_ucafService.patientVitalSignsHistory = [];
_ucafService.patientChiefComplaintList = [];
}
_ucafService.patientAssessmentList = []; _ucafService.patientAssessmentList = [];
_ucafService.orderProcedureList = []; _ucafService.orderProcedureList = [];
_ucafService.prescriptionList = null; _ucafService.prescriptionList = null;
@ -56,7 +62,7 @@ class UcafViewModel extends BaseViewModel {
} }
Future getUCAFData(PatiantInformtion patient) async { Future getUCAFData(PatiantInformtion patient) async {
setState(ViewState.Busy); // setState(ViewState.Busy);
String from; String from;
String to; String to;
@ -112,7 +118,7 @@ class UcafViewModel extends BaseViewModel {
Future getPatientAssessment(PatiantInformtion patient) async { Future getPatientAssessment(PatiantInformtion patient) async {
if (patientAssessmentList.isEmpty) { if (patientAssessmentList.isEmpty) {
setState(ViewState.Busy); // setState(ViewState.Busy);
await _ucafService.getPatientAssessment(patient); await _ucafService.getPatientAssessment(patient);
if (_ucafService.hasError) { if (_ucafService.hasError) {
error = _ucafService.error; error = _ucafService.error;
@ -139,7 +145,7 @@ class UcafViewModel extends BaseViewModel {
Future getOrderProcedures(PatiantInformtion patient) async { Future getOrderProcedures(PatiantInformtion patient) async {
if (orderProcedures.isEmpty) { if (orderProcedures.isEmpty) {
setState(ViewState.Busy); // setState(ViewState.Busy);
await _ucafService.getOrderProcedures(patient); await _ucafService.getOrderProcedures(patient);
if (_ucafService.hasError) { if (_ucafService.hasError) {
error = _ucafService.error; error = _ucafService.error;
@ -152,7 +158,7 @@ class UcafViewModel extends BaseViewModel {
Future getPrescription(PatiantInformtion patient) async { Future getPrescription(PatiantInformtion patient) async {
if (prescriptionList == null) { if (prescriptionList == null) {
setState(ViewState.Busy); // setState(ViewState.Busy);
await _ucafService.getPrescription(patient); await _ucafService.getPrescription(patient);
if (_ucafService.hasError) { if (_ucafService.hasError) {
error = _ucafService.error; error = _ucafService.error;
@ -190,7 +196,7 @@ class UcafViewModel extends BaseViewModel {
} }
Future postUCAF(PatiantInformtion patient) async { Future postUCAF(PatiantInformtion patient) async {
setState(ViewState.Busy); // setState(ViewState.Busy);
await _ucafService.postUCAF(patient); await _ucafService.postUCAF(patient);
if (_ucafService.hasError) { if (_ucafService.hasError) {
error = _ucafService.error; error = _ucafService.error;

@ -2,6 +2,7 @@ import 'package:doctor_app_flutter/core/enum/filter_type.dart';
import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/enum/viewstate.dart';
import 'package:doctor_app_flutter/core/model/Prescriptions/Prescriptions.dart'; import 'package:doctor_app_flutter/core/model/Prescriptions/Prescriptions.dart';
import 'package:doctor_app_flutter/core/model/Prescriptions/get_medication_for_inpatient_model.dart';
import 'package:doctor_app_flutter/core/model/Prescriptions/perscription_pharmacy.dart'; import 'package:doctor_app_flutter/core/model/Prescriptions/perscription_pharmacy.dart';
import 'package:doctor_app_flutter/core/model/Prescriptions/post_prescrition_req_model.dart'; import 'package:doctor_app_flutter/core/model/Prescriptions/post_prescrition_req_model.dart';
import 'package:doctor_app_flutter/core/model/Prescriptions/prescription_in_patient.dart'; import 'package:doctor_app_flutter/core/model/Prescriptions/prescription_in_patient.dart';
@ -26,11 +27,10 @@ class PrescriptionViewModel extends BaseViewModel {
FilterType filterType = FilterType.Clinic; FilterType filterType = FilterType.Clinic;
bool hasError = false; bool hasError = false;
PrescriptionService _prescriptionService = locator<PrescriptionService>(); PrescriptionService _prescriptionService = locator<PrescriptionService>();
List<GetMedicationResponseModel> get allMedicationList => List<GetMedicationResponseModel> get allMedicationList => _prescriptionService.allMedicationList;
_prescriptionService.allMedicationList; List<GetMedicationForInPatientModel> get medicationForInPatient => _prescriptionsService.medicationForInPatient;
List<PrescriptionModel> get prescriptionList => List<PrescriptionModel> get prescriptionList => _prescriptionService.prescriptionList;
_prescriptionService.prescriptionList;
List<dynamic> get drugsList => _prescriptionService.doctorsList; List<dynamic> get drugsList => _prescriptionService.doctorsList;
//List<dynamic> get allMedicationList => _prescriptionService.allMedicationList; //List<dynamic> get allMedicationList => _prescriptionService.allMedicationList;
List<dynamic> get drugToDrug => _prescriptionService.drugToDrugList; List<dynamic> get drugToDrug => _prescriptionService.drugToDrugList;
@ -41,30 +41,22 @@ class PrescriptionViewModel extends BaseViewModel {
List<PrescriptionsList> _prescriptionsOrderListClinic = List(); List<PrescriptionsList> _prescriptionsOrderListClinic = List();
List<PrescriptionsList> _prescriptionsOrderListHospital = List(); List<PrescriptionsList> _prescriptionsOrderListHospital = List();
List<PrescriptionReport> get prescriptionReportList => List<PrescriptionReport> get prescriptionReportList => _prescriptionsService.prescriptionReportList;
_prescriptionsService.prescriptionReportList;
List<Prescriptions> get prescriptionsList => List<Prescriptions> get prescriptionsList => _prescriptionsService.prescriptionsList;
_prescriptionsService.prescriptionsList;
List<PharmacyPrescriptions> get pharmacyPrescriptionsList => List<PharmacyPrescriptions> get pharmacyPrescriptionsList => _prescriptionsService.pharmacyPrescriptionsList;
_prescriptionsService.pharmacyPrescriptionsList; List<PrescriptionReportEnh> get prescriptionReportEnhList => _prescriptionsService.prescriptionReportEnhList;
List<PrescriptionReportEnh> get prescriptionReportEnhList =>
_prescriptionsService.prescriptionReportEnhList;
List<PrescriptionsList> get prescriptionsOrderList => List<PrescriptionsList> get prescriptionsOrderList =>
filterType == FilterType.Clinic filterType == FilterType.Clinic ? _prescriptionsOrderListClinic : _prescriptionsOrderListHospital;
? _prescriptionsOrderListClinic
: _prescriptionsOrderListHospital;
List<PrescriotionInPatient> get inPatientPrescription => List<PrescriotionInPatient> get inPatientPrescription => _prescriptionsService.prescriptionInPatientList;
_prescriptionsService.prescriptionInPatientList;
getPrescriptionsInPatient(PatiantInformtion patient) async { getPrescriptionsInPatient(PatiantInformtion patient) async {
setState(ViewState.Busy); setState(ViewState.Busy);
error = ""; error = "";
await _prescriptionsService.getPrescriptionInPatient( await _prescriptionsService.getPrescriptionInPatient(mrn: patient.patientId, adn: patient.admissionNo);
mrn: patient.patientId, adn: patient.admissionNo);
if (_prescriptionsService.hasError) { if (_prescriptionsService.hasError) {
error = "No Prescription Found"; error = "No Prescription Found";
setState(ViewState.Error); setState(ViewState.Error);
@ -100,8 +92,7 @@ class PrescriptionViewModel extends BaseViewModel {
setState(ViewState.Idle); setState(ViewState.Idle);
} }
Future postPrescription( Future postPrescription(PostPrescriptionReqModel postProcedureReqModel, int mrn) async {
PostPrescriptionReqModel postProcedureReqModel, int mrn) async {
hasError = false; hasError = false;
//_insuranceCardService.clearInsuranceCard(); //_insuranceCardService.clearInsuranceCard();
setState(ViewState.Busy); setState(ViewState.Busy);
@ -125,8 +116,7 @@ class PrescriptionViewModel extends BaseViewModel {
setState(ViewState.Idle); setState(ViewState.Idle);
} }
Future updatePrescription( Future updatePrescription(PostPrescriptionReqModel updatePrescriptionReqModel, int mrn) async {
PostPrescriptionReqModel updatePrescriptionReqModel, int mrn) async {
hasError = false; hasError = false;
//_insuranceCardService.clearInsuranceCard(); //_insuranceCardService.clearInsuranceCard();
setState(ViewState.Busy); setState(ViewState.Busy);
@ -152,16 +142,11 @@ class PrescriptionViewModel extends BaseViewModel {
setState(ViewState.Idle); setState(ViewState.Idle);
} }
Future getDrugToDrug( Future getDrugToDrug(VitalSignData vital, List<GetAssessmentResModel> lstAssessments,
VitalSignData vital, List<GetAllergiesResModel> allergy, PatiantInformtion patient, List<dynamic> prescription) async {
List<GetAssessmentResModel> lstAssessments,
List<GetAllergiesResModel> allergy,
PatiantInformtion patient,
List<dynamic> prescription) async {
hasError = false; hasError = false;
setState(ViewState.Busy); setState(ViewState.Busy);
await _prescriptionService.getDrugToDrug( await _prescriptionService.getDrugToDrug(vital, lstAssessments, allergy, patient, prescription);
vital, lstAssessments, allergy, patient, prescription);
if (_prescriptionService.hasError) { if (_prescriptionService.hasError) {
error = _prescriptionService.error; error = _prescriptionService.error;
setState(ViewState.ErrorLocal); setState(ViewState.ErrorLocal);
@ -174,12 +159,9 @@ class PrescriptionViewModel extends BaseViewModel {
notifyListeners(); notifyListeners();
} }
getPrescriptionReport( getPrescriptionReport({Prescriptions prescriptions, @required PatiantInformtion patient}) async {
{Prescriptions prescriptions,
@required PatiantInformtion patient}) async {
setState(ViewState.Busy); setState(ViewState.Busy);
await _prescriptionsService.getPrescriptionReport( await _prescriptionsService.getPrescriptionReport(prescriptions: prescriptions, patient: patient);
prescriptions: prescriptions, patient: patient);
if (_prescriptionsService.hasError) { if (_prescriptionsService.hasError) {
error = _prescriptionsService.error; error = _prescriptionsService.error;
setState(ViewState.ErrorLocal); setState(ViewState.ErrorLocal);
@ -188,11 +170,9 @@ class PrescriptionViewModel extends BaseViewModel {
} }
} }
getListPharmacyForPrescriptions( getListPharmacyForPrescriptions({int itemId, @required PatiantInformtion patient}) async {
{int itemId, @required PatiantInformtion patient}) async {
setState(ViewState.Busy); setState(ViewState.Busy);
await _prescriptionsService.getListPharmacyForPrescriptions( await _prescriptionsService.getListPharmacyForPrescriptions(itemId: itemId, patient: patient);
itemId: itemId, patient: patient);
if (_prescriptionsService.hasError) { if (_prescriptionsService.hasError) {
error = _prescriptionsService.error; error = _prescriptionsService.error;
setState(ViewState.Error); setState(ViewState.Error);
@ -204,48 +184,39 @@ class PrescriptionViewModel extends BaseViewModel {
void _filterList() { void _filterList() {
_prescriptionsService.prescriptionsList.forEach((element) { _prescriptionsService.prescriptionsList.forEach((element) {
/// PrescriptionsList list sort clinic /// PrescriptionsList list sort clinic
List<PrescriptionsList> prescriptionsByClinic = List<PrescriptionsList> prescriptionsByClinic = _prescriptionsOrderListClinic
_prescriptionsOrderListClinic .where((elementClinic) => elementClinic.filterName == element.clinicDescription)
.where((elementClinic) => .toList();
elementClinic.filterName == element.clinicDescription)
.toList();
if (prescriptionsByClinic.length != 0) { if (prescriptionsByClinic.length != 0) {
_prescriptionsOrderListClinic[ _prescriptionsOrderListClinic[_prescriptionsOrderListClinic.indexOf(prescriptionsByClinic[0])]
_prescriptionsOrderListClinic.indexOf(prescriptionsByClinic[0])]
.prescriptionsList .prescriptionsList
.add(element); .add(element);
} else { } else {
_prescriptionsOrderListClinic.add(PrescriptionsList( _prescriptionsOrderListClinic
filterName: element.clinicDescription, prescriptions: element)); .add(PrescriptionsList(filterName: element.clinicDescription, prescriptions: element));
} }
/// PrescriptionsList list sort via hospital /// PrescriptionsList list sort via hospital
List<PrescriptionsList> prescriptionsByHospital = List<PrescriptionsList> prescriptionsByHospital = _prescriptionsOrderListHospital
_prescriptionsOrderListHospital .where(
.where( (elementClinic) => elementClinic.filterName == element.name,
(elementClinic) => elementClinic.filterName == element.name, )
) .toList();
.toList();
if (prescriptionsByHospital.length != 0) { if (prescriptionsByHospital.length != 0) {
_prescriptionsOrderListHospital[_prescriptionsOrderListHospital _prescriptionsOrderListHospital[_prescriptionsOrderListHospital.indexOf(prescriptionsByHospital[0])]
.indexOf(prescriptionsByHospital[0])]
.prescriptionsList .prescriptionsList
.add(element); .add(element);
} else { } else {
_prescriptionsOrderListHospital.add(PrescriptionsList( _prescriptionsOrderListHospital.add(PrescriptionsList(filterName: element.name, prescriptions: element));
filterName: element.name, prescriptions: element));
} }
}); });
} }
getPrescriptionReportEnh( getPrescriptionReportEnh({PrescriptionsOrder prescriptionsOrder, @required PatiantInformtion patient}) async {
{PrescriptionsOrder prescriptionsOrder,
@required PatiantInformtion patient}) async {
setState(ViewState.Busy); setState(ViewState.Busy);
await _prescriptionsService.getPrescriptionReportEnh( await _prescriptionsService.getPrescriptionReportEnh(prescriptionsOrder: prescriptionsOrder, patient: patient);
prescriptionsOrder: prescriptionsOrder, patient: patient);
if (_prescriptionsService.hasError) { if (_prescriptionsService.hasError) {
error = _prescriptionsService.error; error = _prescriptionsService.error;
setState(ViewState.Error); setState(ViewState.Error);
@ -280,4 +251,15 @@ class PrescriptionViewModel extends BaseViewModel {
setState(ViewState.Idle); setState(ViewState.Idle);
} }
} }
getMedicationForInPatient(PatiantInformtion patient) async {
setState(ViewState.Busy);
await _prescriptionsService.getMedicationForInPatient(patient);
if (_prescriptionsService.hasError) {
error = _prescriptionsService.error;
setState(ViewState.ErrorLocal);
} else {
setState(ViewState.Idle);
}
}
} }

@ -1,6 +1,7 @@
import 'package:doctor_app_flutter/core/enum/filter_type.dart'; import 'package:doctor_app_flutter/core/enum/filter_type.dart';
import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/enum/viewstate.dart';
import 'package:doctor_app_flutter/core/model/Prescriptions/Prescriptions.dart'; import 'package:doctor_app_flutter/core/model/Prescriptions/Prescriptions.dart';
import 'package:doctor_app_flutter/core/model/Prescriptions/get_medication_for_inpatient_model.dart';
import 'package:doctor_app_flutter/core/model/Prescriptions/perscription_pharmacy.dart'; import 'package:doctor_app_flutter/core/model/Prescriptions/perscription_pharmacy.dart';
import 'package:doctor_app_flutter/core/model/Prescriptions/prescription_report.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/prescription_report_enh.dart';
@ -19,21 +20,19 @@ class PrescriptionsViewModel extends BaseViewModel {
List<PrescriptionsList> _prescriptionsOrderListClinic = List(); List<PrescriptionsList> _prescriptionsOrderListClinic = List();
List<PrescriptionsList> _prescriptionsOrderListHospital = List(); List<PrescriptionsList> _prescriptionsOrderListHospital = List();
List<PrescriptionReport> get prescriptionReportList => List<PrescriptionReport> get prescriptionReportList => _prescriptionsService.prescriptionReportList;
_prescriptionsService.prescriptionReportList;
List<Prescriptions> get prescriptionsList => List<Prescriptions> get prescriptionsList => _prescriptionsService.prescriptionsList;
_prescriptionsService.prescriptionsList;
List<PharmacyPrescriptions> get pharmacyPrescriptionsList => List<PharmacyPrescriptions> get pharmacyPrescriptionsList => _prescriptionsService.pharmacyPrescriptionsList;
_prescriptionsService.pharmacyPrescriptionsList; List<PrescriptionReportEnh> get prescriptionReportEnhList => _prescriptionsService.prescriptionReportEnhList;
List<PrescriptionReportEnh> get prescriptionReportEnhList =>
_prescriptionsService.prescriptionReportEnhList;
List<PrescriptionsList> get prescriptionsOrderList => List<PrescriptionsList> get prescriptionsOrderList =>
filterType == FilterType.Clinic filterType == FilterType.Clinic ? _prescriptionsOrderListClinic : _prescriptionsOrderListHospital;
? _prescriptionsOrderListClinic
: _prescriptionsOrderListHospital; List<GetMedicationForInPatientModel> get medicationForInPatient => _prescriptionsService.medicationForInPatient;
List<PrescriptionsList> _medicationForInPatient = List();
getPrescriptions(PatiantInformtion patient) async { getPrescriptions(PatiantInformtion patient) async {
setState(ViewState.Busy); setState(ViewState.Busy);
@ -62,38 +61,32 @@ class PrescriptionsViewModel extends BaseViewModel {
void _filterList() { void _filterList() {
_prescriptionsService.prescriptionsList.forEach((element) { _prescriptionsService.prescriptionsList.forEach((element) {
/// PrescriptionsList list sort clinic /// PrescriptionsList list sort clinic
List<PrescriptionsList> prescriptionsByClinic = List<PrescriptionsList> prescriptionsByClinic = _prescriptionsOrderListClinic
_prescriptionsOrderListClinic .where((elementClinic) => elementClinic.filterName == element.clinicDescription)
.where((elementClinic) => .toList();
elementClinic.filterName == element.clinicDescription)
.toList();
if (prescriptionsByClinic.length != 0) { if (prescriptionsByClinic.length != 0) {
_prescriptionsOrderListClinic[ _prescriptionsOrderListClinic[_prescriptionsOrderListClinic.indexOf(prescriptionsByClinic[0])]
_prescriptionsOrderListClinic.indexOf(prescriptionsByClinic[0])]
.prescriptionsList .prescriptionsList
.add(element); .add(element);
} else { } else {
_prescriptionsOrderListClinic.add(PrescriptionsList( _prescriptionsOrderListClinic
filterName: element.clinicDescription, prescriptions: element)); .add(PrescriptionsList(filterName: element.clinicDescription, prescriptions: element));
} }
/// PrescriptionsList list sort via hospital /// PrescriptionsList list sort via hospital
List<PrescriptionsList> prescriptionsByHospital = List<PrescriptionsList> prescriptionsByHospital = _prescriptionsOrderListHospital
_prescriptionsOrderListHospital .where(
.where( (elementClinic) => elementClinic.filterName == element.name,
(elementClinic) => elementClinic.filterName == element.name, )
) .toList();
.toList();
if (prescriptionsByHospital.length != 0) { if (prescriptionsByHospital.length != 0) {
_prescriptionsOrderListHospital[_prescriptionsOrderListHospital _prescriptionsOrderListHospital[_prescriptionsOrderListHospital.indexOf(prescriptionsByHospital[0])]
.indexOf(prescriptionsByHospital[0])]
.prescriptionsList .prescriptionsList
.add(element); .add(element);
} else { } else {
_prescriptionsOrderListHospital.add(PrescriptionsList( _prescriptionsOrderListHospital.add(PrescriptionsList(filterName: element.name, prescriptions: element));
filterName: element.name, prescriptions: element));
} }
}); });
} }
@ -103,12 +96,9 @@ class PrescriptionsViewModel extends BaseViewModel {
notifyListeners(); notifyListeners();
} }
getPrescriptionReport( getPrescriptionReport({Prescriptions prescriptions, @required PatiantInformtion patient}) async {
{Prescriptions prescriptions,
@required PatiantInformtion patient}) async {
setState(ViewState.Busy); setState(ViewState.Busy);
await _prescriptionsService.getPrescriptionReport( await _prescriptionsService.getPrescriptionReport(prescriptions: prescriptions, patient: patient);
prescriptions: prescriptions, patient: patient);
if (_prescriptionsService.hasError) { if (_prescriptionsService.hasError) {
error = _prescriptionsService.error; error = _prescriptionsService.error;
setState(ViewState.ErrorLocal); setState(ViewState.ErrorLocal);
@ -117,11 +107,9 @@ class PrescriptionsViewModel extends BaseViewModel {
} }
} }
getListPharmacyForPrescriptions( getListPharmacyForPrescriptions({int itemId, @required PatiantInformtion patient}) async {
{int itemId, @required PatiantInformtion patient}) async {
setState(ViewState.Busy); setState(ViewState.Busy);
await _prescriptionsService.getListPharmacyForPrescriptions( await _prescriptionsService.getListPharmacyForPrescriptions(itemId: itemId, patient: patient);
itemId: itemId, patient: patient);
if (_prescriptionsService.hasError) { if (_prescriptionsService.hasError) {
error = _prescriptionsService.error; error = _prescriptionsService.error;
setState(ViewState.Error); setState(ViewState.Error);
@ -130,12 +118,9 @@ class PrescriptionsViewModel extends BaseViewModel {
} }
} }
getPrescriptionReportEnh( getPrescriptionReportEnh({PrescriptionsOrder prescriptionsOrder, @required PatiantInformtion patient}) async {
{PrescriptionsOrder prescriptionsOrder,
@required PatiantInformtion patient}) async {
setState(ViewState.Busy); setState(ViewState.Busy);
await _prescriptionsService.getPrescriptionReportEnh( await _prescriptionsService.getPrescriptionReportEnh(prescriptionsOrder: prescriptionsOrder, patient: patient);
prescriptionsOrder: prescriptionsOrder, patient: patient);
if (_prescriptionsService.hasError) { if (_prescriptionsService.hasError) {
error = _prescriptionsService.error; error = _prescriptionsService.error;
setState(ViewState.Error); setState(ViewState.Error);
@ -143,4 +128,14 @@ class PrescriptionsViewModel extends BaseViewModel {
setState(ViewState.Idle); setState(ViewState.Idle);
} }
} }
getMedicationForInPatient(PatiantInformtion patient) async {
await _prescriptionsService.getMedicationForInPatient(patient);
if (_prescriptionsService.hasError) {
error = _prescriptionsService.error;
setState(ViewState.ErrorLocal);
} else {
setState(ViewState.Idle);
}
}
} }

@ -3,8 +3,6 @@ import 'package:doctor_app_flutter/screens/live_care/end_call_screen.dart';
import 'package:doctor_app_flutter/screens/medical-file/health_summary_page.dart'; import 'package:doctor_app_flutter/screens/medical-file/health_summary_page.dart';
import 'package:doctor_app_flutter/screens/patients/ECGPage.dart'; import 'package:doctor_app_flutter/screens/patients/ECGPage.dart';
import 'package:doctor_app_flutter/screens/patients/insurance_approval_screen_patient.dart'; import 'package:doctor_app_flutter/screens/patients/insurance_approval_screen_patient.dart';
import 'package:doctor_app_flutter/screens/patients/profile/UCAF/UCAF-detail-screen.dart';
import 'package:doctor_app_flutter/screens/patients/profile/UCAF/UCAF-input-screen.dart';
import 'package:doctor_app_flutter/screens/patients/profile/lab_result/all_lab_special_result_page.dart'; import 'package:doctor_app_flutter/screens/patients/profile/lab_result/all_lab_special_result_page.dart';
import 'package:doctor_app_flutter/screens/patients/profile/lab_result/labs_home_page.dart'; import 'package:doctor_app_flutter/screens/patients/profile/lab_result/labs_home_page.dart';
import 'package:doctor_app_flutter/screens/patients/profile/medical_report/AddVerifyMedicalReport.dart'; import 'package:doctor_app_flutter/screens/patients/profile/medical_report/AddVerifyMedicalReport.dart';
@ -22,6 +20,7 @@ import 'package:doctor_app_flutter/screens/sick-leave/show-sickleave.dart';
import 'package:doctor_app_flutter/screens/auth/verification_methods_screen.dart'; import 'package:doctor_app_flutter/screens/auth/verification_methods_screen.dart';
import './screens/auth/login_screen.dart'; import './screens/auth/login_screen.dart';
import 'screens/patients/profile/UCAF/ucaf_pager_screen.dart';
import 'screens/patients/profile/profile_screen/patient_profile_screen.dart'; import 'screens/patients/profile/profile_screen/patient_profile_screen.dart';
import './screens/patients/profile/vital_sign/vital_sign_details_screen.dart'; import './screens/patients/profile/vital_sign/vital_sign_details_screen.dart';
import 'landing_page.dart'; import 'landing_page.dart';
@ -109,8 +108,8 @@ var routes = {
ORDER_PRESCRIPTION_NEW: (_) => PrescriptionsPage(), ORDER_PRESCRIPTION_NEW: (_) => PrescriptionsPage(),
ORDER_PROCEDURE: (_) => ProcedureScreen(), ORDER_PROCEDURE: (_) => ProcedureScreen(),
MY_REFERRAL_DETAIL: (_) => MyReferralDetailScreen(), MY_REFERRAL_DETAIL: (_) => MyReferralDetailScreen(),
PATIENT_UCAF_REQUEST: (_) => UCAFInputScreen(), PATIENT_UCAF_REQUEST: (_) => UCAFPagerScreen(),
PATIENT_UCAF_DETAIL: (_) => UcafDetailScreen(), // PATIENT_UCAF_DETAIL: (_) => UcafDetailScreen(),
PATIENT_ECG: (_) => ECGPage(), PATIENT_ECG: (_) => ECGPage(),
ALL_SPECIAL_LAB_RESULT: (_) => AllLabSpecialResult(), ALL_SPECIAL_LAB_RESULT: (_) => AllLabSpecialResult(),
}; };

@ -9,6 +9,7 @@ import 'package:doctor_app_flutter/models/SOAP/order-procedure.dart';
import 'package:doctor_app_flutter/models/patient/patiant_info_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/base/base_view.dart';
import 'package:doctor_app_flutter/screens/patients/profile/UCAF/page-stepper-widget.dart'; import 'package:doctor_app_flutter/screens/patients/profile/UCAF/page-stepper-widget.dart';
import 'package:doctor_app_flutter/screens/patients/profile/UCAF/ucaf_pager_screen.dart';
import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart';
import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/helpers.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
@ -22,33 +23,63 @@ import 'package:hexcolor/hexcolor.dart';
import '../../../../routes.dart'; import '../../../../routes.dart';
class UcafDetailScreen extends StatefulWidget { class UcafDetailScreen extends StatefulWidget {
final PatiantInformtion patient;
final UcafViewModel model;
final Function changeLoadingState;
UcafDetailScreen(this.patient, this.model, {this.changeLoadingState});
@override @override
_UcafDetailScreenState createState() => _UcafDetailScreenState(); _UcafDetailScreenState createState() => _UcafDetailScreenState(this.patient, this.model);
} }
class _UcafDetailScreenState extends State<UcafDetailScreen> { class _UcafDetailScreenState extends State<UcafDetailScreen> {
final PatiantInformtion patient;
final UcafViewModel model;
UcafViewModel ucafModel;
int _activeTap = 0; int _activeTap = 0;
_UcafDetailScreenState(this.patient, this.model);
@override @override
Widget build(BuildContext context) { void initState() {
final routeArgs = ModalRoute.of(context).settings.arguments as Map; model.saveUCAFOnTap = () async{
PatiantInformtion patient = routeArgs['patient']; widget.changeLoadingState(true);
String patientType = routeArgs['patientType']; await ucafModel.postUCAF(patient);
String arrivalType = routeArgs['arrivalType']; widget.changeLoadingState(false);
if (ucafModel.state == ViewState.Idle) {
DrAppToastMsg.showSuccesToast(
TranslationBase.of(context)
.postUcafSuccessMsg);
Navigator.of(context).popUntil((route) {
return route.settings.name ==
PATIENTS_PROFILE;
});
} else {
DrAppToastMsg.showErrorToast(ucafModel.error);
}
};
super.initState();
}
@override
Widget build(BuildContext context) {
final screenSize = MediaQuery.of(context).size; final screenSize = MediaQuery.of(context).size;
return BaseView<UcafViewModel>( return BaseView<UcafViewModel>(
onModelReady: (model) async { onModelReady: (model) async {
model.resetDataInFirst(); ucafModel = model;
model.resetDataInFirst(firstPage: false);
await model.getLanguage(); await model.getLanguage();
await model.getPatientAssessment(patient); await model.getPatientAssessment(patient);
widget.changeLoadingState(false);
}, },
builder: (_, model, w) => AppScaffold( builder: (_, model, w) => AppScaffold(
baseViewModel: model, baseViewModel: model,
isShowAppBar: true, isShowAppBar: false,
appBar: PatientProfileAppBar(patient),
appBarTitle: TranslationBase.of(context).ucaf,
body: Column( body: Column(
children: [ children: [
Expanded( Expanded(
@ -57,35 +88,6 @@ class _UcafDetailScreenState extends State<UcafDetailScreen> {
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
// PatientHeaderWidgetNoAvatar(patient),
Container(
margin: EdgeInsets.all(16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
AppText(
"${TranslationBase.of(context).patient}",
fontFamily: 'Poppins',
fontSize: SizeConfig.textMultiplier * 1.6,
fontWeight: FontWeight.w600,
),
AppText(
"${TranslationBase.of(context).ucaf}",
fontFamily: 'Poppins',
fontSize: SizeConfig.textMultiplier * 3,
fontWeight: FontWeight.bold,
)
],
),
),
PageStepperWidget(
stepsCount: 2,
currentStepIndex: 2,
screenSize: screenSize,
),
SizedBox(
height: 10,
),
Container( Container(
margin: EdgeInsets.symmetric( margin: EdgeInsets.symmetric(
vertical: 16, horizontal: 16), vertical: 16, horizontal: 16),
@ -106,64 +108,7 @@ class _UcafDetailScreenState extends State<UcafDetailScreen> {
), ),
), ),
), ),
Container(
margin: EdgeInsets.symmetric(vertical: 8, horizontal: 16),
child: Row(
children: [
Expanded(
child: Container(
child: AppButton(
title: TranslationBase.of(context).cancel,
hasBorder: true,
vPadding: 8,
hPadding: 8,
borderColor: Colors.white,
color: Colors.white,
fontColor: HexColor("#B8382B"),
fontSize: 2.2,
onPressed: () {
Navigator.of(context).popUntil((route) {
return route.settings.name ==
PATIENTS_PROFILE;
});
},
),
),
),
SizedBox(
width: 8,
),
Expanded(
child: Container(
child: AppButton(
title: TranslationBase.of(context).save,
hasBorder: true,
vPadding: 8,
hPadding: 8,
borderColor: HexColor("#B8382B"),
color: HexColor("#B8382B"),
fontColor: Colors.white,
fontSize: 2.0,
onPressed: () async {
await model.postUCAF(patient);
if (model.state == ViewState.Idle) {
DrAppToastMsg.showSuccesToast(
TranslationBase.of(context)
.postUcafSuccessMsg);
Navigator.of(context).popUntil((route) {
return route.settings.name ==
PATIENTS_PROFILE;
});
} else {
DrAppToastMsg.showErrorToast(model.error);
}
},
),
),
),
],
),
),
], ],
), ),
)); ));
@ -209,12 +154,18 @@ class _UcafDetailScreenState extends State<UcafDetailScreen> {
onTap: () async { onTap: () async {
print(__treatmentSteps.indexOf(item)); print(__treatmentSteps.indexOf(item));
if (__treatmentSteps.indexOf(item) == 0) { if (__treatmentSteps.indexOf(item) == 0) {
widget.changeLoadingState(true);
await model.getPatientAssessment(patient); await model.getPatientAssessment(patient);
widget.changeLoadingState(false);
} else if (__treatmentSteps.indexOf(item) == 1) { } else if (__treatmentSteps.indexOf(item) == 1) {
widget.changeLoadingState(true);
await model.getPrescription(patient); await model.getPrescription(patient);
widget.changeLoadingState(false);
} }
if (__treatmentSteps.indexOf(item) == 2) { if (__treatmentSteps.indexOf(item) == 2) {
widget.changeLoadingState(true);
await model.getOrderProcedures(patient); await model.getOrderProcedures(patient);
widget.changeLoadingState(false);
} }
setState(() { setState(() {
_activeTap = __treatmentSteps.indexOf(item); _activeTap = __treatmentSteps.indexOf(item);
@ -288,6 +239,7 @@ class _UcafDetailScreenState extends State<UcafDetailScreen> {
]; ];
} }
} }
} }
class DiagnosisWidget extends StatelessWidget { class DiagnosisWidget extends StatelessWidget {

@ -19,11 +19,20 @@ import 'package:hexcolor/hexcolor.dart';
import '../../../../routes.dart'; import '../../../../routes.dart';
class UCAFInputScreen extends StatefulWidget { class UCAFInputScreen extends StatefulWidget {
final PatiantInformtion patient;
final Function changeLoadingState;
UCAFInputScreen(this.patient, {this.changeLoadingState});
@override @override
_UCAFInputScreenState createState() => _UCAFInputScreenState(); _UCAFInputScreenState createState() => _UCAFInputScreenState(this.patient);
} }
class _UCAFInputScreenState extends State<UCAFInputScreen> { class _UCAFInputScreenState extends State<UCAFInputScreen> {
final PatiantInformtion patient;
_UCAFInputScreenState(this.patient);
bool _inPatient = false; bool _inPatient = false;
bool _emergencyCase = false; bool _emergencyCase = false;
final _durationOfIllnessController = TextEditingController(); final _durationOfIllnessController = TextEditingController();
@ -53,21 +62,15 @@ class _UCAFInputScreenState extends State<UCAFInputScreen> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final routeArgs = ModalRoute.of(context).settings.arguments as Map;
PatiantInformtion patient = routeArgs['patient'];
String patientType = routeArgs['patientType'];
String arrivalType = routeArgs['arrivalType'];
final screenSize = MediaQuery.of(context).size;
return BaseView<UcafViewModel>( return BaseView<UcafViewModel>(
onModelReady: (model) => model.getUCAFData(patient), onModelReady: (model) async {
model.resetDataInFirst();
await model.getUCAFData(patient);
widget.changeLoadingState(false);
},
builder: (_, model, w) => AppScaffold( builder: (_, model, w) => AppScaffold(
baseViewModel: model, baseViewModel: model,
isShowAppBar: true, isShowAppBar: false,
appBar: PatientProfileAppBar(
patient),
appBarTitle: TranslationBase.of(context).ucaf,
body: model.patientVitalSignsHistory.length > 0 && body: model.patientVitalSignsHistory.length > 0 &&
model.patientChiefComplaintList != null && model.patientChiefComplaintList != null &&
model.patientChiefComplaintList.length > 0 model.patientChiefComplaintList.length > 0
@ -79,31 +82,6 @@ class _UCAFInputScreenState extends State<UCAFInputScreen> {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
// PatientHeaderWidgetNoAvatar(patient), // PatientHeaderWidgetNoAvatar(patient),
Container(
margin: EdgeInsets.all(16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
AppText(
"${TranslationBase.of(context).patient}",
fontFamily: 'Poppins',
fontSize: SizeConfig.textMultiplier * 1.6,
fontWeight: FontWeight.w600,
),
AppText(
"${TranslationBase.of(context).ucaf}",
fontFamily: 'Poppins',
fontSize: SizeConfig.textMultiplier * 3,
fontWeight: FontWeight.bold,
)
],
),
),
PageStepperWidget(
stepsCount: 2,
currentStepIndex: 1,
screenSize: screenSize,
),
Container( Container(
margin: EdgeInsets.symmetric( margin: EdgeInsets.symmetric(
vertical: 0, horizontal: 16), vertical: 0, horizontal: 16),
@ -263,7 +241,7 @@ class _UCAFInputScreenState extends State<UCAFInputScreen> {
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
color: Color(0xFF2E303A), color: Color(0xFF2E303A),
), ),
/* SizedBox( /* SizedBox(
height: 4, height: 4,
), ),
AppText( AppText(
@ -323,7 +301,7 @@ class _UCAFInputScreenState extends State<UCAFInputScreen> {
SizedBox( SizedBox(
height: 8, height: 8,
), ),
/* AppTextFieldCustom( /* AppTextFieldCustom(
hintText: TranslationBase.of(context).other, hintText: TranslationBase.of(context).other,
dropDownText: TranslationBase.of(context).none, dropDownText: TranslationBase.of(context).none,
enabled: false, enabled: false,
@ -400,21 +378,6 @@ class _UCAFInputScreenState extends State<UCAFInputScreen> {
), ),
), ),
), ),
Container(
margin: EdgeInsets.symmetric(horizontal: 16, vertical: 8),
child: AppButton(
title: TranslationBase.of(context).next,
color: HexColor("#D02127"),
onPressed: () {
Navigator.of(context).pushNamed(PATIENT_UCAF_DETAIL,
arguments: {
'patient': patient,
'patientType': patientType,
'arrivalType': arrivalType
});
},
),
),
], ],
) )
: Center( : Center(
@ -428,9 +391,10 @@ class _UCAFInputScreenState extends State<UCAFInputScreen> {
Padding( Padding(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: AppText( child: AppText(
model.patientVitalSignsHistory.length == 0 model.patientVitalSignsHistory.length == 0
? TranslationBase.of(context).vitalSignEmptyMsg ? TranslationBase.of(context).vitalSignEmptyMsg
: TranslationBase.of(context).chiefComplaintEmptyMsg, : TranslationBase.of(context)
.chiefComplaintEmptyMsg,
fontWeight: FontWeight.normal, fontWeight: FontWeight.normal,
textAlign: TextAlign.center, textAlign: TextAlign.center,
color: HexColor("#B8382B"), color: HexColor("#B8382B"),

@ -0,0 +1,214 @@
import 'package:doctor_app_flutter/config/size_config.dart';
import 'package:doctor_app_flutter/core/viewModel/patient-ucaf-viewmodel.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/patients/profile/UCAF/page-stepper-widget.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-app-bar.dart';
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart';
import 'package:flutter/material.dart';
import '../../../../routes.dart';
import 'UCAF-detail-screen.dart';
import 'UCAF-input-screen.dart';
class UCAFPagerScreen extends StatefulWidget {
const UCAFPagerScreen({Key key}) : super(key: key);
@override
_UCAFPagerScreenState createState() => _UCAFPagerScreenState();
}
class _UCAFPagerScreenState extends State<UCAFPagerScreen>
with TickerProviderStateMixin {
PageController _controller;
int _currentIndex = 0;
bool _isLoading = true;
PatiantInformtion patient;
String patientType;
String arrivalType;
changePageViewIndex(pageIndex, {isChangeState = true}) {
if (pageIndex != _currentIndex && isChangeState) changeLoadingState(true);
_controller.jumpToPage(pageIndex);
setState(() {
_currentIndex = pageIndex;
});
}
void changeLoadingState(bool isLoading) {
setState(() {
_isLoading = isLoading;
});
}
@override
void initState() {
_controller = new PageController();
super.initState();
}
@override
Widget build(BuildContext context) {
final routeArgs = ModalRoute.of(context).settings.arguments as Map;
patient = routeArgs['patient'];
patientType = routeArgs['patientType'];
arrivalType = routeArgs['arrivalType'];
final screenSize = MediaQuery.of(context).size;
return BaseView<UcafViewModel>(
builder: (_, model, w) => AppScaffold(
isShowAppBar: true,
isLoading: _isLoading,
appBar: PatientProfileAppBar(patient),
appBarTitle: TranslationBase.of(context).ucaf,
body: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(
child: Container(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// PatientHeaderWidgetNoAvatar(patient),
Container(
margin: EdgeInsets.all(16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
AppText(
"${TranslationBase.of(context).patient}",
fontFamily: 'Poppins',
fontSize: SizeConfig.textMultiplier * 1.6,
fontWeight: FontWeight.w600,
),
AppText(
"${TranslationBase.of(context).ucaf}",
fontFamily: 'Poppins',
fontSize: SizeConfig.textMultiplier * 3,
fontWeight: FontWeight.bold,
)
],
),
),
PageStepperWidget(
stepsCount: 2,
currentStepIndex: _currentIndex + 1,
screenSize: screenSize,
),
SizedBox(
height: 10,
),
Expanded(
child: Container(
color: Theme.of(context).scaffoldBackgroundColor,
child: PageView(
physics: NeverScrollableScrollPhysics(),
controller: _controller,
onPageChanged: (index) {
setState(() {
_currentIndex = index;
});
},
scrollDirection: Axis.horizontal,
children: <Widget>[
UCAFInputScreen(
patient,
changeLoadingState: changeLoadingState,
),
UcafDetailScreen(
patient,
model,
changeLoadingState: changeLoadingState,
),
]),
),
),
],
),
),
),
_isLoading
? Container(
height: 0,
)
: ucafButtons(model),
],
),
));
}
Widget ucafButtons(UcafViewModel model) {
switch (_currentIndex) {
case 0:
return Container(
margin: EdgeInsets.symmetric(horizontal: 16, vertical: 8),
child: AppButton(
title: TranslationBase.of(context).next,
color: Color(0xFFD02127),
onPressed: () {
changePageViewIndex(1);
// Navigator.of(context).pushNamed(PATIENT_UCAF_DETAIL, arguments: {
// 'patient': patient,
// 'patientType': patientType,
// 'arrivalType': arrivalType
// });
},
),
);
case 1:
return Container(
margin: EdgeInsets.symmetric(vertical: 8, horizontal: 16),
child: Row(
children: [
Expanded(
child: Container(
child: AppButton(
title: TranslationBase.of(context).cancel,
hasBorder: true,
vPadding: 8,
hPadding: 8,
borderColor: Colors.white,
color: Colors.white,
fontColor: Color(0xFFB8382B),
fontSize: 2.2,
onPressed: () {
Navigator.of(context).popUntil((route) {
return route.settings.name == PATIENTS_PROFILE;
});
},
),
),
),
SizedBox(
width: 8,
),
Expanded(
child: Container(
child: AppButton(
title: TranslationBase.of(context).save,
hasBorder: true,
vPadding: 8,
hPadding: 8,
borderColor: Color(0xFFB8382B),
color: Color(0xFFB8382B),
fontColor: Colors.white,
fontSize: 2.0,
onPressed: () {
model.saveUCAFOnTap();
},
),
),
),
],
),
);
default:
return Container();
}
}
}

@ -1,3 +1,4 @@
import 'package:doctor_app_flutter/core/model/Prescriptions/get_medication_for_inpatient_model.dart';
import 'package:doctor_app_flutter/core/model/Prescriptions/prescription_in_patient.dart'; import 'package:doctor_app_flutter/core/model/Prescriptions/prescription_in_patient.dart';
import 'package:doctor_app_flutter/core/viewModel/prescription_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/prescription_view_model.dart';
import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart';
@ -13,7 +14,7 @@ import 'package:flutter/material.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
class PrescriptionItemsInPatientPage extends StatelessWidget { class PrescriptionItemsInPatientPage extends StatelessWidget {
final PrescriotionInPatient prescriptions; final GetMedicationForInPatientModel prescriptions;
final PatiantInformtion patient; final PatiantInformtion patient;
final String patientType; final String patientType;
final String arrivalType; final String arrivalType;
@ -36,16 +37,15 @@ class PrescriptionItemsInPatientPage extends StatelessWidget {
ProjectViewModel projectViewModel = Provider.of(context); ProjectViewModel projectViewModel = Provider.of(context);
return BaseView<PrescriptionViewModel>( return BaseView<PrescriptionViewModel>(
onModelReady: (model) async { onModelReady: (model) async {
if (model.inPatientPrescription.length == 0) { if (model.medicationForInPatient.length == 0) {
await model.getPrescriptionsInPatient(patient); await model.getMedicationForInPatient(patient);
} }
}, },
builder: (_, model, widget) => AppScaffold( builder: (_, model, widget) => AppScaffold(
isShowAppBar: true, isShowAppBar: true,
backgroundColor: Colors.grey[100], backgroundColor: Colors.grey[100],
baseViewModel: model, baseViewModel: model,
appBar: PatientProfileAppBar( appBar: PatientProfileAppBar(patient),
patient),
body: SingleChildScrollView( body: SingleChildScrollView(
child: Container( child: Container(
child: Column( child: Column(
@ -64,8 +64,7 @@ class PrescriptionItemsInPatientPage extends StatelessWidget {
Container( Container(
margin: EdgeInsets.only(left: 18, right: 18), margin: EdgeInsets.only(left: 18, right: 18),
child: AppText( child: AppText(
model.inPatientPrescription[prescriptionIndex] prescriptions.pHRItemDescription,
.itemDescription,
bold: true, bold: true,
), ),
), ),
@ -92,13 +91,7 @@ class PrescriptionItemsInPatientPage extends StatelessWidget {
TranslationBase.of(context).direction, TranslationBase.of(context).direction,
color: Colors.grey, color: Colors.grey,
), ),
Expanded( Expanded(child: AppText(" " + prescriptions.directionID.toString() ?? '')),
child: AppText(" " +
model
.inPatientPrescription[
prescriptionIndex]
.direction ??
'')),
], ],
), ),
Row( Row(
@ -107,13 +100,7 @@ class PrescriptionItemsInPatientPage extends StatelessWidget {
TranslationBase.of(context).route, TranslationBase.of(context).route,
color: Colors.grey, color: Colors.grey,
), ),
AppText(" " + AppText(" " + prescriptions.routeId.toString() ?? ''),
model
.inPatientPrescription[
prescriptionIndex]
.route
.toString() ??
''),
], ],
), ),
Row( Row(
@ -122,13 +109,7 @@ class PrescriptionItemsInPatientPage extends StatelessWidget {
TranslationBase.of(context).refill, TranslationBase.of(context).refill,
color: Colors.grey, color: Colors.grey,
), ),
Expanded( Expanded(child: AppText(" " + prescriptions.refillID.toString() ?? '')),
child: AppText(" " +
model
.inPatientPrescription[
prescriptionIndex]
.refillType ??
'')),
], ],
), ),
Row( Row(
@ -169,12 +150,7 @@ class PrescriptionItemsInPatientPage extends StatelessWidget {
'UOM', 'UOM',
color: Colors.grey, color: Colors.grey,
), ),
AppText(" " + AppText(" " + prescriptions.unitofMeasurement.toString() ?? ''),
model
.inPatientPrescription[
prescriptionIndex]
.unitofMeasurementDescription ??
''),
], ],
), ),
Row( Row(
@ -183,13 +159,7 @@ class PrescriptionItemsInPatientPage extends StatelessWidget {
TranslationBase.of(context).dailyDoses, TranslationBase.of(context).dailyDoses,
color: Colors.grey, color: Colors.grey,
), ),
AppText(" " + AppText(" " + prescriptions.dose.toString() ?? ''),
model
.inPatientPrescription[
prescriptionIndex]
.dose
.toString() ??
''),
], ],
), ),
Row( Row(
@ -198,13 +168,7 @@ class PrescriptionItemsInPatientPage extends StatelessWidget {
TranslationBase.of(context).status, TranslationBase.of(context).status,
color: Colors.grey, color: Colors.grey,
), ),
AppText(" " + AppText(" " + prescriptions.statusDescription.toString() ?? ''),
model
.inPatientPrescription[
prescriptionIndex]
.statusDescription
.toString() ??
''),
], ],
), ),
Row( Row(
@ -213,12 +177,7 @@ class PrescriptionItemsInPatientPage extends StatelessWidget {
TranslationBase.of(context).processed, TranslationBase.of(context).processed,
color: Colors.grey, color: Colors.grey,
), ),
AppText(" " + // AppText(" " + prescriptions.editedBy.toString() ?? ''),
model
.inPatientPrescription[
prescriptionIndex]
.processedBy ??
''),
], ],
), ),
Row( Row(
@ -227,23 +186,13 @@ class PrescriptionItemsInPatientPage extends StatelessWidget {
TranslationBase.of(context).dailyDoses, TranslationBase.of(context).dailyDoses,
color: Colors.grey, color: Colors.grey,
), ),
AppText(" " + AppText(" " + prescriptions.dose.toString() ?? ''),
model
.inPatientPrescription[
prescriptionIndex]
.dose
.toString() ??
''),
], ],
), ),
SizedBox( SizedBox(
height: 12, height: 12,
), ),
AppText(model AppText(prescriptions.comments ?? ''),
.inPatientPrescription[
prescriptionIndex]
.comments ??
''),
], ],
), ),
) )

@ -12,6 +12,7 @@ import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-app-
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/doctor_card.dart'; import 'package:doctor_app_flutter/widgets/shared/doctor_card.dart';
import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart';
import 'package:doctor_app_flutter/widgets/shared/user-guid/in_patient_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:doctor_app_flutter/widgets/transitions/fade_page.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
@ -28,208 +29,196 @@ class PrescriptionsPage extends StatelessWidget {
bool isFromLiveCare = routeArgs['isFromLiveCare']; bool isFromLiveCare = routeArgs['isFromLiveCare'];
bool isSelectInpatient = routeArgs['isSelectInpatient']; bool isSelectInpatient = routeArgs['isSelectInpatient'];
return BaseView<PrescriptionViewModel>( return BaseView<PrescriptionViewModel>(
onModelReady: (model) => isSelectInpatient onModelReady: (model) => patient.admissionNo == null
? model.getPrescriptionsInPatient(patient) ? model.getPrescriptions(patient, patientType: patientType)
: model.getPrescriptions(patient, patientType: patientType), : model.getMedicationForInPatient(patient),
builder: (_, model, w) => AppScaffold( builder: (_, model, w) => NetworkBaseView(
baseViewModel: model, baseViewModel: model,
isShowAppBar: true, child: AppScaffold(
backgroundColor: Colors.grey[100], baseViewModel: model,
appBar: PatientProfileAppBar( isShowAppBar: true,
patient, backgroundColor: Colors.grey[100],
isInpatient: isInpatient, appBar: PatientProfileAppBar(
), patient,
body: patient.admissionNo == null isInpatient: isInpatient,
? FractionallySizedBox( ),
widthFactor: 1.0, body: patient.admissionNo == null
child: ListView( ? FractionallySizedBox(
physics: BouncingScrollPhysics(), widthFactor: 1.0,
children: <Widget>[ child: ListView(
SizedBox( physics: BouncingScrollPhysics(),
height: 12, children: <Widget>[
), SizedBox(
if (model.prescriptionsList.isNotEmpty && height: 12,
patient.patientStatusType != 43) ),
Padding( if (model.prescriptionsList.isNotEmpty && patient.patientStatusType != 43)
padding: const EdgeInsets.all(8.0), Padding(
child: Column( padding: const EdgeInsets.all(8.0),
crossAxisAlignment: CrossAxisAlignment.start, child: Column(
children: [ crossAxisAlignment: CrossAxisAlignment.start,
AppText( children: [
TranslationBase.of(context).orders, AppText(
style: "caption2", TranslationBase.of(context).orders,
color: Colors.black, style: "caption2",
fontSize: 13, color: Colors.black,
), fontSize: 13,
AppText(
TranslationBase.of(context).prescriptions,
bold: true,
fontSize: 22,
),
],
),
),
if (patient.patientStatusType != null &&
patient.patientStatusType == 43)
Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
AppText(
TranslationBase.of(context).orders,
style: "caption2",
color: Colors.black,
fontSize: 13,
),
AppText(
TranslationBase.of(context).prescriptions,
bold: true,
fontSize: 22,
),
],
),
),
if ((patient.patientStatusType != null &&
patient.patientStatusType == 43) ||
(isFromLiveCare && patient.appointmentNo != null))
AddNewOrder(
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
BaseAddProcedureTabPage(
patient: patient,
prescriptionModel: model,
procedureType:
ProcedureType.PRESCRIPTION,
),settings: RouteSettings(name: 'AddProcedureTabPage')),
);
},
label: TranslationBase.of(context)
.applyForNewPrescriptionsOrder,
),
...List.generate(
model.prescriptionsList.length,
(index) => InkWell(
onTap: () => Navigator.push(
context,
FadePage(
page: PrescriptionItemsPage(
prescriptions:
model.prescriptionsList[index],
patient: patient,
patientType: patientType,
arrivalType: arrivalType,
),
), ),
), AppText(
child: DoctorCard( TranslationBase.of(context).prescriptions,
doctorName: bold: true,
model.prescriptionsList[index].doctorName, fontSize: 22,
profileUrl: model ),
.prescriptionsList[index].doctorImageURL, ],
branch: model.prescriptionsList[index].name,
clinic: model.prescriptionsList[index]
.clinicDescription,
isPrescriptions: true,
appointmentDate:
AppDateUtils.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'), if (patient.patientStatusType != null && patient.patientStatusType == 43)
Padding( Padding(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: AppText(TranslationBase.of(context) child: Column(
.noPrescriptionsFound), crossAxisAlignment: CrossAxisAlignment.start,
) children: [
], AppText(
), TranslationBase.of(context).orders,
) style: "caption2",
], color: Colors.black,
), fontSize: 13,
) ),
: FractionallySizedBox( AppText(
widthFactor: 1.0, TranslationBase.of(context).prescriptions,
child: ListView( bold: true,
physics: BouncingScrollPhysics(), fontSize: 22,
children: <Widget>[ ),
// SizedBox( ],
// height: 12, ),
// ), ),
if ((patient.patientStatusType != null && patient.patientStatusType == 43) ||
...List.generate( (isFromLiveCare && patient.appointmentNo != null))
model.inPatientPrescription.length, AddNewOrder(
(index) => InkWell( onTap: () {
onTap: () => Navigator.push( Navigator.push(
context, context,
FadePage( MaterialPageRoute(
page: PrescriptionItemsInPatientPage( builder: (context) => BaseAddProcedureTabPage(
prescriptionIndex: index, patient: patient,
prescriptions: model prescriptionModel: model,
.inPatientPrescription[index], procedureType: ProcedureType.PRESCRIPTION,
patient: patient, ),
patientType: patientType, settings: RouteSettings(name: 'AddProcedureTabPage')),
arrivalType: arrivalType, );
startOn: AppDateUtils },
.getDateTimeFromServerFormat( label: TranslationBase.of(context).applyForNewPrescriptionsOrder,
model.inPatientPrescription[index] ),
.startDatetime, ...List.generate(
), model.prescriptionsList.length,
stopOn: AppDateUtils (index) => InkWell(
.getDateTimeFromServerFormat( onTap: () => Navigator.push(
model.inPatientPrescription[index] context,
.stopDatetime, 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: AppDateUtils.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'),
child: InPatientDoctorCard( Padding(
doctorName: model.inPatientPrescription[index] padding: const EdgeInsets.all(8.0),
.itemDescription, child: AppText(TranslationBase.of(context).noPrescriptionsFound),
profileUrl: 'sss', )
branch: 'hamza', ],
clinic: 'basheer',
isPrescriptions: true,
appointmentDate:
AppDateUtils.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(TranslationBase.of(context)
.noPrescriptionsFound),
) )
],
),
)
: NetworkBaseView(
baseViewModel: model,
child: FractionallySizedBox(
widthFactor: 1.0,
child: ListView(
physics: BouncingScrollPhysics(),
children: <Widget>[
// SizedBox(
// height: 12,
// ),
ListView.builder(
scrollDirection: Axis.vertical,
shrinkWrap: true,
itemCount: model.medicationForInPatient.length,
itemBuilder: (context, index) {
//model.medicationForInPatient.length,
return InkWell(
onTap: () => Navigator.push(
context,
FadePage(
page: PrescriptionItemsInPatientPage(
prescriptionIndex: index,
prescriptions: model.medicationForInPatient[index],
patient: patient,
patientType: patientType,
arrivalType: arrivalType,
startOn: AppDateUtils.getDateTimeFromServerFormat(
model.medicationForInPatient[index].startDatetime,
),
stopOn: AppDateUtils.getDateTimeFromServerFormat(
model.medicationForInPatient[index].stopDatetime,
),
),
),
),
child: InPatientDoctorCard(
doctorName: model.medicationForInPatient[index].pHRItemDescription,
profileUrl: 'sss',
branch: 'hamza',
clinic: 'basheer',
isPrescriptions: true,
appointmentDate: AppDateUtils.getDateTimeFromServerFormat(
model.medicationForInPatient[index].prescriptionDatetime,
),
createdBy: model.medicationForInPatient[index].createdBy.toString(),
));
}),
if (model.medicationForInPatient.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(TranslationBase.of(context).noPrescriptionsFound),
)
],
),
)
], ],
), ),
) ),
], )),
), ));
)));
} }
} }

@ -181,7 +181,7 @@ class AddSickLeavScreen extends StatelessWidget {
children: [ children: [
AppText(TranslationBase.of(context).daysSickleave + ": "), AppText(TranslationBase.of(context).daysSickleave + ": "),
AppText( AppText(
item.sickLeaveDays ?? item.noOfDays.toString(), item.sickLeaveDays.toString() ?? item.noOfDays.toString(),
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
], ],
@ -211,10 +211,11 @@ class AddSickLeavScreen extends StatelessWidget {
child: AppText( child: AppText(
AppDateUtils.getDayMonthYearDateFormatted( AppDateUtils.getDayMonthYearDateFormatted(
item.startDate.contains("/Date(") item.startDate.contains("/Date(")
? AppDateUtils.convertStringToDate(item.endDate) ? AppDateUtils.convertStringToDate(item.endDate ?? "")
.add(Duration(days: item.noOfDays)) .add(Duration(
: DateTime.parse(item.startDate) days: item.noOfDays ?? item.sickLeaveDays))
.add(Duration(days: item.noOfDays))), : DateTime.parse(item.startDate ?? "")
.add(Duration(days: item.noOfDays ?? ""))),
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
) )

Loading…
Cancel
Save