Merge branch 'new_prescreption' into 'development'

New prescreption

See merge request Cloud_Solution/doctor_app_flutter!968
merge-requests/969/head
Elham Ali 4 years ago
commit f4c7be6cc2

@ -310,7 +310,7 @@
"${BUILT_PRODUCTS_DIR}/speech_to_text/speech_to_text.framework",
"${BUILT_PRODUCTS_DIR}/sqflite/sqflite.framework",
"${BUILT_PRODUCTS_DIR}/url_launcher_ios/url_launcher_ios.framework",
"${BUILT_PRODUCTS_DIR}/video_player/video_player.framework",
"${BUILT_PRODUCTS_DIR}/video_player_avfoundation/video_player_avfoundation.framework",
"${BUILT_PRODUCTS_DIR}/wakelock/wakelock.framework",
"${BUILT_PRODUCTS_DIR}/webview_flutter_wkwebview/webview_flutter_wkwebview.framework",
);
@ -352,7 +352,7 @@
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/speech_to_text.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/sqflite.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/url_launcher_ios.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/video_player.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/video_player_avfoundation.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/wakelock.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/webview_flutter_wkwebview.framework",
);

@ -1129,4 +1129,11 @@ const Map<String, Map<String, String>> localizedValues = {
"VTE_Type": {"en": "VTE Type", "ar": "VTE Type"},
"pharmacology": {"en": "Pharmacology", "ar": "علم العقاقير"},
"reasonsThrombo": {"en": "Reasons Thrombo", "ar": "أسباب ثرومبو"},
"youDoNotHaveFavoritePrescription": {"en": "You Don't Have Favorite Prescription", "ar": "ليس لديك وصفة طبية مفضلة"},
"pleaseSelectItem": {"en": "please Select Item", "ar": "الرجاء اختيار عنصر"},
"searchFavoriteTemplate": {"en": "search Favorites Template", "ar": "البحث في قالب المفضلة"},
"sorryNoMatch": {"en": "Sorry No Match", "ar": "عذرا لا يوجد تطابق"},
"thousandIsTheMAXForTheStrength": {"en": "1000 Is The MAX For The Strength", "ar": "ألف هو القيمة الأعلى"},
"strengthCanNotBeZero": {"en": "Strength Can't Be Zero", "ar": "القوة لا يمكن أن تكون صفر "},
"old": {"en": "Old", "ar":"القديمه"},
};

@ -0,0 +1,145 @@
class PrescriptionEntityModel {
dynamic appointmentNo;
dynamic clinicName;
dynamic createdBy;
dynamic createdOn;
dynamic doctorName;
dynamic doseDailyQuantity;
dynamic doseDailyUnitID;
dynamic doseDetail;
dynamic doseDurationDays;
dynamic doseTimingID;
dynamic episodeID;
dynamic frequencyID;
dynamic icdCode10ID;
dynamic indication;
dynamic isDispensed;
dynamic isMedicineCovered;
dynamic isSIG;
dynamic medicationName;
dynamic medicationPrice;
dynamic medicineCode;
dynamic orderTypeDescription;
dynamic qty;
dynamic quantity;
dynamic remarks;
dynamic routeID;
dynamic startDate;
dynamic status;
dynamic stopDate;
dynamic uom;
dynamic pharmacistRemarks;
dynamic pharmacyInervention;
dynamic refill;
dynamic mediSpanGPICode;
PrescriptionEntityModel(
{this.appointmentNo,
this.clinicName,
this.createdBy,
this.createdOn,
this.doctorName,
this.doseDailyQuantity,
this.doseDailyUnitID,
this.doseDetail,
this.doseDurationDays,
this.doseTimingID,
this.episodeID,
this.frequencyID,
this.icdCode10ID,
this.indication,
this.isDispensed,
this.isMedicineCovered,
this.isSIG,
this.medicationName,
this.medicationPrice,
this.medicineCode,
this.orderTypeDescription,
this.qty,
this.quantity,
this.remarks,
this.routeID,
this.startDate,
this.status,
this.stopDate,
this.uom,
this.pharmacistRemarks,
this.mediSpanGPICode,
this.pharmacyInervention,
this.refill});
PrescriptionEntityModel.fromJson(Map<String, dynamic> json) {
appointmentNo = json['appointmentNo'];
clinicName = json['clinicName'];
createdBy = json['createdBy'];
createdOn = json['createdOn'];
doctorName = json['doctorName'];
doseDailyQuantity = json['doseDailyQuantity'];
doseDailyUnitID = json['doseDailyUnitID'];
doseDetail = json['doseDetail'];
doseDurationDays = json['doseDurationDays'];
doseTimingID = json['doseTimingID'];
episodeID = json['episodeID'];
frequencyID = json['frequencyID'];
icdCode10ID = json['icdCode10ID'];
indication = json['indication'];
isDispensed = json['isDispensed'];
isMedicineCovered = json['isMedicineCovered'];
isSIG = json['isSIG'];
medicationName = json['medicationName'];
medicationPrice = json['medicationPrice'];
medicineCode = json['medicineCode'];
orderTypeDescription = json['orderTypeDescription'];
qty = json['qty'];
quantity = json['quantity'];
remarks = json['remarks'];
routeID = json['routeID'];
startDate = json['startDate'];
status = json['status'];
stopDate = json['stopDate'];
uom = json['uom'];
pharmacistRemarks = json['pharmacistRemarks'];
mediSpanGPICode = json['mediSpanGPICode'];
refill = json['refill'];
pharmacyInervention = json['interventionID'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['appointmentNo'] = this.appointmentNo;
data['clinicName'] = this.clinicName;
data['createdBy'] = this.createdBy;
data['createdOn'] = this.createdOn;
data['doctorName'] = this.doctorName;
data['doseDailyQuantity'] = this.doseDailyQuantity;
data['doseDailyUnitID'] = this.doseDailyUnitID;
data['doseDetail'] = this.doseDetail;
data['doseDurationDays'] = this.doseDurationDays;
data['doseTimingID'] = this.doseTimingID;
data['episodeID'] = this.episodeID;
data['frequencyID'] = this.frequencyID;
data['icdCode10ID'] = this.icdCode10ID;
data['indication'] = this.indication;
data['isDispensed'] = this.isDispensed;
data['isMedicineCovered'] = this.isMedicineCovered;
data['isSIG'] = this.isSIG;
data['medicationName'] = this.medicationName;
data['medicationPrice'] = this.medicationPrice;
data['medicineCode'] = this.medicineCode;
data['orderTypeDescription'] = this.orderTypeDescription;
data['qty'] = this.qty;
data['quantity'] = this.quantity;
data['remarks'] = this.remarks;
data['routeID'] = this.routeID;
data['startDate'] = this.startDate;
data['status'] = this.status;
data['stopDate'] = this.stopDate;
data['uom'] = this.uom;
data['pharmacistRemarks'] = this.pharmacistRemarks;
data['mediSpanGPICode'] = this.mediSpanGPICode;
data['refill'] = this.refill;
data['interventionID'] = this.pharmacyInervention;
return data;
}
}

@ -1,5 +1,7 @@
import 'package:doctor_app_flutter/core/model/Prescriptions/prescription_entity_model.dart';
class PrescriptionModel {
List<EntityList> entityList;
List<PrescriptionEntityModel> entityList;
dynamic rowcount;
dynamic statusMessage;
@ -7,9 +9,9 @@ class PrescriptionModel {
PrescriptionModel.fromJson(Map<String, dynamic> json) {
if (json['entityList'] != null) {
entityList = new List<EntityList>();
entityList = new List<PrescriptionEntityModel>();
json['entityList'].forEach((v) {
entityList.add(new EntityList.fromJson(v));
entityList.add(new PrescriptionEntityModel.fromJson(v));
});
}
rowcount = json['rowcount'];
@ -26,149 +28,3 @@ class PrescriptionModel {
return data;
}
}
class EntityList {
dynamic appointmentNo;
dynamic clinicName;
dynamic createdBy;
dynamic createdOn;
dynamic doctorName;
dynamic doseDailyQuantity;
dynamic doseDailyUnitID;
dynamic doseDetail;
dynamic doseDurationDays;
dynamic doseTimingID;
dynamic episodeID;
dynamic frequencyID;
dynamic icdCode10ID;
dynamic indication;
dynamic isDispensed;
dynamic isMedicineCovered;
dynamic isSIG;
dynamic medicationName;
dynamic medicationPrice;
dynamic medicineCode;
dynamic orderTypeDescription;
dynamic qty;
dynamic quantity;
dynamic remarks;
dynamic routeID;
dynamic startDate;
dynamic status;
dynamic stopDate;
dynamic uom;
dynamic pharmacistRemarks;
dynamic pharmacyInervention;
dynamic refill;
dynamic mediSpanGPICode;
EntityList(
{this.appointmentNo,
this.clinicName,
this.createdBy,
this.createdOn,
this.doctorName,
this.doseDailyQuantity,
this.doseDailyUnitID,
this.doseDetail,
this.doseDurationDays,
this.doseTimingID,
this.episodeID,
this.frequencyID,
this.icdCode10ID,
this.indication,
this.isDispensed,
this.isMedicineCovered,
this.isSIG,
this.medicationName,
this.medicationPrice,
this.medicineCode,
this.orderTypeDescription,
this.qty,
this.quantity,
this.remarks,
this.routeID,
this.startDate,
this.status,
this.stopDate,
this.uom,
this.pharmacistRemarks,
this.mediSpanGPICode,
this.pharmacyInervention,
this.refill});
EntityList.fromJson(Map<String, dynamic> json) {
appointmentNo = json['appointmentNo'];
clinicName = json['clinicName'];
createdBy = json['createdBy'];
createdOn = json['createdOn'];
doctorName = json['doctorName'];
doseDailyQuantity = json['doseDailyQuantity'];
doseDailyUnitID = json['doseDailyUnitID'];
doseDetail = json['doseDetail'];
doseDurationDays = json['doseDurationDays'];
doseTimingID = json['doseTimingID'];
episodeID = json['episodeID'];
frequencyID = json['frequencyID'];
icdCode10ID = json['icdCode10ID'];
indication = json['indication'];
isDispensed = json['isDispensed'];
isMedicineCovered = json['isMedicineCovered'];
isSIG = json['isSIG'];
medicationName = json['medicationName'];
medicationPrice = json['medicationPrice'];
medicineCode = json['medicineCode'];
orderTypeDescription = json['orderTypeDescription'];
qty = json['qty'];
quantity = json['quantity'];
remarks = json['remarks'];
routeID = json['routeID'];
startDate = json['startDate'];
status = json['status'];
stopDate = json['stopDate'];
uom = json['uom'];
pharmacistRemarks = json['pharmacistRemarks'];
mediSpanGPICode = json['mediSpanGPICode'];
refill = json['refill'];
pharmacyInervention = json['interventionID'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['appointmentNo'] = this.appointmentNo;
data['clinicName'] = this.clinicName;
data['createdBy'] = this.createdBy;
data['createdOn'] = this.createdOn;
data['doctorName'] = this.doctorName;
data['doseDailyQuantity'] = this.doseDailyQuantity;
data['doseDailyUnitID'] = this.doseDailyUnitID;
data['doseDetail'] = this.doseDetail;
data['doseDurationDays'] = this.doseDurationDays;
data['doseTimingID'] = this.doseTimingID;
data['episodeID'] = this.episodeID;
data['frequencyID'] = this.frequencyID;
data['icdCode10ID'] = this.icdCode10ID;
data['indication'] = this.indication;
data['isDispensed'] = this.isDispensed;
data['isMedicineCovered'] = this.isMedicineCovered;
data['isSIG'] = this.isSIG;
data['medicationName'] = this.medicationName;
data['medicationPrice'] = this.medicationPrice;
data['medicineCode'] = this.medicineCode;
data['orderTypeDescription'] = this.orderTypeDescription;
data['qty'] = this.qty;
data['quantity'] = this.quantity;
data['remarks'] = this.remarks;
data['routeID'] = this.routeID;
data['startDate'] = this.startDate;
data['status'] = this.status;
data['stopDate'] = this.stopDate;
data['uom'] = this.uom;
data['pharmacistRemarks'] = this.pharmacistRemarks;
data['mediSpanGPICode'] = this.mediSpanGPICode;
data['refill'] = this.refill;
data['interventionID'] = this.pharmacyInervention;
return data;
}
}

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

@ -16,7 +16,6 @@ class PrescriptionResModel {
String name;
int episodeID;
int actualDoctorRate;
int admission;
int clinicID;
String companyName;
String despensedStatus;
@ -51,7 +50,6 @@ class PrescriptionResModel {
this.name,
this.episodeID,
this.actualDoctorRate,
this.admission,
this.clinicID,
this.companyName,
this.despensedStatus,
@ -86,7 +84,6 @@ class PrescriptionResModel {
name = json['Name'];
episodeID = json['EpisodeID'];
actualDoctorRate = json['ActualDoctorRate'];
admission = json['Admission'];
clinicID = json['ClinicID'];
companyName = json['CompanyName'];
despensedStatus = json['Despensed_Status'];
@ -123,7 +120,6 @@ class PrescriptionResModel {
data['Name'] = this.name;
data['EpisodeID'] = this.episodeID;
data['ActualDoctorRate'] = this.actualDoctorRate;
data['Admission'] = this.admission;
data['ClinicID'] = this.clinicID;
data['CompanyName'] = this.companyName;
data['Despensed_Status'] = this.despensedStatus;

@ -9,10 +9,7 @@ class MedicalFileService extends BaseService {
List<MedicalFileModel> get medicalFileList => _medicalFileList;
MedicalFileRequestModel _fileRequestModel = MedicalFileRequestModel(
//patientMRN: 1231755,
vidaAuthTokenID:
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMDAyIiwianRpIjoiNDM1MGNjZTYtYzc3MS00YjBiLThiNDItMGZhY2IzYzgxMjQ4IiwiZW1haWwiOiIiLCJpZCI6IjEwMDIiLCJOYW1lIjoiVEVNUCAtIERPQ1RPUiIsIkVtcGxveWVlSWQiOiI0NzA5IiwiRmFjaWxpdHlHcm91cElkIjoiMDEwMjY2IiwiRmFjaWxpdHlJZCI6IjE1IiwiUGhhcmFtY3lGYWNpbGl0eUlkIjoiNTUiLCJJU19QSEFSTUFDWV9DT05ORUNURUQiOiJUcnVlIiwiRG9jdG9ySWQiOiI0NzA5IiwiU0VTU0lPTklEIjoiMjE1OTYwNTQiLCJDbGluaWNJZCI6IjEiLCJyb2xlIjpbIkRPQ1RPUlMiLCJIRUFEIERPQ1RPUlMiLCJBRE1JTklTVFJBVE9SUyIsIlJFQ0VQVElPTklTVCIsIkVSIE5VUlNFIiwiRVIgUkVDRVBUSU9OSVNUIiwiUEhBUk1BQ1kgQUNDT1VOVCBTVEFGRiIsIlBIQVJNQUNZIE5VUlNFIiwiSU5QQVRJRU5UIFBIQVJNQUNJU1QiLCJBRE1JU1NJT04gU1RBRkYiLCJBUFBST1ZBTCBTVEFGRiIsIkNPTlNFTlQgIiwiTUVESUNBTCBSRVBPUlQgLSBTSUNLIExFQVZFIE1BTkFHRVIiXSwibmJmIjoxNjA5MjI1MjMwLCJleHAiOjE2MTAwODkyMzAsImlhdCI6MTYwOTIyNTIzMH0.rs7lTBQ1ON4PbR11PBkOyjf818DdeMKuqz2IrCJMYQU",
);
);
Future getMedicalFile({int mrn}) async {
_fileRequestModel = MedicalFileRequestModel(patientMRN: mrn);

@ -1,7 +1,19 @@
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/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/perscription_pharmacy.dart';
import 'package:doctor_app_flutter/core/model/Prescriptions/post_prescrition_req_model.dart';
import 'package:doctor_app_flutter/core/model/Prescriptions/prescription_entity_model.dart';
import 'package:doctor_app_flutter/core/model/Prescriptions/prescription_in_patient.dart';
import 'package:doctor_app_flutter/core/model/Prescriptions/prescription_model.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_req_model.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/calculate_box_request_model.dart';
import 'package:doctor_app_flutter/core/model/search_drug/get_medication_response_model.dart';
import 'package:doctor_app_flutter/core/model/search_drug/item_by_medicine_request_model.dart';
@ -14,11 +26,17 @@ import 'package:doctor_app_flutter/core/model/SOAP/GetAssessmentResModel.dart';
import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/core/model/patient/vital_sign/patient-vital-sign-data.dart';
import 'package:doctor_app_flutter/util/date-utils.dart';
import 'package:flutter/cupertino.dart';
class PrescriptionService extends LookupService {
List<PrescriptionModel> _prescriptionList = List();
List<PrescriptionModel> get prescriptionList => _prescriptionList;
List<PrescriptionEntityModel> _prescriptionListNew = List();
List<PrescriptionEntityModel> get prescriptionListNew => _prescriptionListNew;
List<SearchDrugModel> _drugsList = List();
List<SearchDrugModel> get drugsList => _drugsList;
@ -37,7 +55,6 @@ class PrescriptionService extends LookupService {
ItemByMedicineRequestModel _itemByMedicineRequestModel =
ItemByMedicineRequestModel();
SearchDrugRequestModel _drugRequestModel = SearchDrugRequestModel(
//search: ["Acetaminophen"],
search: ["Amoxicillin"],
);
@ -81,16 +98,23 @@ class PrescriptionService extends LookupService {
}, body: getAssessmentReqModel.toJson());
}
Future getPrescription({int mrn}) async {
Future getPrescriptionListNew({int mrn, int appNo }) async {
_prescriptionReqModel = PrescriptionReqModel(
patientMRN: mrn,
appNo:appNo
);
hasError = false;
_prescriptionList.clear();
_prescriptionListNew.clear();
await baseAppClient.post(GET_PRESCRIPTION_LIST,
onSuccess: (dynamic response, int statusCode) {
_prescriptionList
.add(PrescriptionModel.fromJson(response['PrescriptionList']));
if(response['PrescriptionList']!=null){
response['PrescriptionList']["entityList"].forEach((prescriptions) {
_prescriptionListNew.add(PrescriptionEntityModel.fromJson(prescriptions));
});
}
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
@ -167,56 +191,6 @@ class PrescriptionService extends LookupService {
List<GetAllergiesResModel> allergy,
PatiantInformtion patient,
List<dynamic> prescription) async {
// Map<String, dynamic> request = {
// "Prescription": {
// "objPatientInfo": {"Gender": "Male", "Age": "21/06/1967"},
// "objVitalSign": {"Height": "180", "Weight": "37"},
// "objPrescriptionItems": [
// {
// "DrugId": "83-20-00-30-20-03-03",
// "DrugName": "WARFARIN 1 MG TAB 28'S (N)",
// "Dose": "1",
// "DoseType": "04",
// "Unit": "actuation(s)",
// "FrequencyType": "1/3/Day",
// "Duration": "3/Day",
// "IsScreen": "true"
// },
// {
// "DrugId": "64-20-00-10-00-03-15",
// "DrugName": "PANADOL 500 MG TAB 24'S(DIS)",
// "Dose": "1",
// "DoseType": "04",
// "Unit": "MG",
// "FrequencyType": "3/1/Day",
// "Duration": "4/Day",
// "RouteID": "24",
// "IsScreen": "true"
// }
// ],
// "objAllergies": {
// "Allergy": {
// "objProperties": {"Id": "26", "Name": "phenoxymethylpenicillin"}
// }
// },
// "objDiagnosis": {
// "Diagnosis": {
// "objProperties": {"Id": "A01.1", "Name": "Paratyphoid fever A"}
// }
// },
// "IsDoctor": "false",
// "IsPharmacist": "false"
// },
// "IPAdress": "10.10.10.10",
// "Channel": 9,
// "LanguageID": 2,
// "VersionID": 5.3,
// "SessionID": "BlUSkYymTt",
// "IsLoginForDoctorApp": true,
// "PatientOutSA": 0,
// "TokenID": "@dm!n",
// "OutSA": true
// };
Map<String, dynamic> request = {
"Prescription": {
"objPatientInfo": {
@ -286,4 +260,186 @@ class PrescriptionService extends LookupService {
});
return lstAssessmentsObj;
}
List<Prescriptions> prescriptionsList = List();
List<GetMedicationForInPatientModel> medicationForInPatient = List();
List<PrescriptionsOrder> prescriptionsOrderList = List();
List<PrescriotionInPatient> prescriptionInPatientList = List();
GetMedicationForInPatientRequestModel _getMedicationForInPatientRequestModel =
GetMedicationForInPatientRequestModel();
Future getPrescriptions(PatiantInformtion patient) async {
hasError = false;
Map<String, dynamic> body = Map();
body['isDentalAllowedBackend'] = false;
await baseAppClient.postPatient(PRESCRIPTIONS, patient: patient,
onSuccess: (dynamic response, int statusCode) {
prescriptionsList.clear();
response['PatientPrescriptionList'].forEach((prescriptions) {
prescriptionsList.add(Prescriptions.fromJson(prescriptions));
});
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, body: body);
}
RequestPrescriptionReport _requestPrescriptionReport =
RequestPrescriptionReport(
appointmentNo: 0, isDentalAllowedBackend: false);
List<PrescriptionReport> prescriptionReportList = List();
Future getPrescriptionReport(
{Prescriptions prescriptions,
@required PatiantInformtion patient}) async {
hasError = false;
_requestPrescriptionReport.dischargeNo = prescriptions.dischargeNo;
_requestPrescriptionReport.projectID = prescriptions.projectID;
_requestPrescriptionReport.clinicID = prescriptions.clinicID;
_requestPrescriptionReport.setupID = prescriptions.setupID;
_requestPrescriptionReport.episodeID = prescriptions.episodeID;
_requestPrescriptionReport.appointmentNo = prescriptions.appointmentNo;
await baseAppClient.postPatient(
prescriptions.isInOutPatient
? GET_PRESCRIPTION_REPORT_ENH
: GET_PRESCRIPTION_REPORT_NEW,
patient: patient, onSuccess: (dynamic response, int statusCode) {
prescriptionReportList.clear();
prescriptionReportEnhList.clear();
if (prescriptions.isInOutPatient) {
response['ListPRM'].forEach((prescriptions) {
prescriptionReportList
.add(PrescriptionReport.fromJson(prescriptions));
prescriptionReportEnhList
.add(PrescriptionReportEnh.fromJson(prescriptions));
});
} else {
response['INP_GetPrescriptionReport_List'].forEach((prescriptions) {
prescriptionReportList
.add(PrescriptionReport.fromJson(prescriptions));
});
}
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, body: _requestPrescriptionReport.toJson());
}
RequestGetListPharmacyForPrescriptions
requestGetListPharmacyForPrescriptions =
RequestGetListPharmacyForPrescriptions(
latitude: 0,
longitude: 0,
isDentalAllowedBackend: false,
);
List<PharmacyPrescriptions> pharmacyPrescriptionsList = List();
RequestPrescriptionReportEnh _requestPrescriptionReportEnh =
RequestPrescriptionReportEnh(
isDentalAllowedBackend: false,
);
List<PrescriptionReportEnh> prescriptionReportEnhList = List();
Future getPrescriptionReportEnh(
{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) {
if (prescriptionsOrder.appointmentNo == "0") {
if (element.dischargeNo == int.parse(prescriptionsOrder.dischargeID)) {
_requestPrescriptionReportEnh.appointmentNo = element.appointmentNo;
_requestPrescriptionReportEnh.clinicID = element.clinicID;
_requestPrescriptionReportEnh.projectID = element.projectID;
_requestPrescriptionReportEnh.episodeID = element.episodeID;
_requestPrescriptionReportEnh.setupID = element.setupID;
_requestPrescriptionReportEnh.dischargeNo = element.dischargeNo;
isInPatient = element.isInOutPatient;
}
} else {
if (int.parse(prescriptionsOrder.appointmentNo) ==
element.appointmentNo) {
_requestPrescriptionReportEnh.appointmentNo = element.appointmentNo;
_requestPrescriptionReportEnh.clinicID = element.clinicID;
_requestPrescriptionReportEnh.projectID = element.projectID;
_requestPrescriptionReportEnh.episodeID = element.episodeID;
_requestPrescriptionReportEnh.setupID = element.setupID;
_requestPrescriptionReportEnh.dischargeNo = element.dischargeNo;
isInPatient = element.isInOutPatient;
///call inpGetPrescriptionReport
}
}
});
hasError = false;
await baseAppClient.postPatient(
isInPatient ? GET_PRESCRIPTION_REPORT_ENH : GET_PRESCRIPTION_REPORT_NEW,
patient: patient, onSuccess: (dynamic response, int statusCode) {
prescriptionReportEnhList.clear();
if (isInPatient) {
response['ListPRM'].forEach((prescriptions) {
prescriptionReportEnhList
.add(PrescriptionReportEnh.fromJson(prescriptions));
});
} else {
response['INP_GetPrescriptionReport_List'].forEach((prescriptions) {
PrescriptionReportEnh reportEnh =
PrescriptionReportEnh.fromJson(prescriptions);
reportEnh.itemDescription = prescriptions['ItemDescriptionN'];
prescriptionReportEnhList.add(reportEnh);
});
}
}, onFailure: (String error, int statusCode) {
hasError = true;
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);
}
Future getMedicationForInPatient(PatiantInformtion patient) async {
hasError = false;
_getMedicationForInPatientRequestModel =
GetMedicationForInPatientRequestModel(
isDentalAllowedBackend: false,
admissionNo: int.parse(patient.admissionNo),
tokenID: "@dm!n",
projectID: patient.projectId,
);
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());
}
}

@ -1,238 +0,0 @@
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/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/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/patient/patiant_info_model.dart';
import 'package:flutter/cupertino.dart';
import '../../base/base_service.dart';
class PrescriptionsService extends BaseService {
List<Prescriptions> prescriptionsList = List();
List<GetMedicationForInPatientModel> medicationForInPatient = List();
List<PrescriptionsOrder> prescriptionsOrderList = List();
List<PrescriotionInPatient> prescriptionInPatientList = List();
InPatientPrescriptionRequestModel _inPatientPrescriptionRequestModel =
InPatientPrescriptionRequestModel();
GetMedicationForInPatientRequestModel _getMedicationForInPatientRequestModel =
GetMedicationForInPatientRequestModel();
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,
onSuccess: (dynamic response, int statusCode) {
prescriptionsList.clear();
response['PatientPrescriptionList'].forEach((prescriptions) {
prescriptionsList.add(Prescriptions.fromJson(prescriptions));
});
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, body: body);
}
RequestPrescriptionReport _requestPrescriptionReport =
RequestPrescriptionReport(
appointmentNo: 0, isDentalAllowedBackend: false);
List<PrescriptionReport> prescriptionReportList = List();
Future getPrescriptionReport(
{Prescriptions prescriptions,
@required PatiantInformtion patient}) async {
hasError = false;
_requestPrescriptionReport.dischargeNo = prescriptions.dischargeNo;
_requestPrescriptionReport.projectID = prescriptions.projectID;
_requestPrescriptionReport.clinicID = prescriptions.clinicID;
_requestPrescriptionReport.setupID = prescriptions.setupID;
_requestPrescriptionReport.episodeID = prescriptions.episodeID;
_requestPrescriptionReport.appointmentNo = prescriptions.appointmentNo;
await baseAppClient.postPatient(
prescriptions.isInOutPatient
? GET_PRESCRIPTION_REPORT_ENH
: GET_PRESCRIPTION_REPORT_NEW,
patient: patient, onSuccess: (dynamic response, int statusCode) {
prescriptionReportList.clear();
prescriptionReportEnhList.clear();
if (prescriptions.isInOutPatient) {
response['ListPRM'].forEach((prescriptions) {
prescriptionReportList
.add(PrescriptionReport.fromJson(prescriptions));
prescriptionReportEnhList
.add(PrescriptionReportEnh.fromJson(prescriptions));
});
} else {
response['INP_GetPrescriptionReport_List'].forEach((prescriptions) {
prescriptionReportList
.add(PrescriptionReport.fromJson(prescriptions));
});
}
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, body: _requestPrescriptionReport.toJson());
}
RequestGetListPharmacyForPrescriptions
requestGetListPharmacyForPrescriptions =
RequestGetListPharmacyForPrescriptions(
latitude: 0,
longitude: 0,
isDentalAllowedBackend: false,
);
List<PharmacyPrescriptions> pharmacyPrescriptionsList = List();
Future getListPharmacyForPrescriptions(
{int itemId, @required PatiantInformtion patient}) async {
hasError = false;
requestGetListPharmacyForPrescriptions.itemID = itemId;
await baseAppClient.postPatient(GET_PHARMACY_LIST, patient: patient,
onSuccess: (dynamic response, int statusCode) {
pharmacyPrescriptionsList.clear();
response['PharmList'].forEach((prescriptions) {
pharmacyPrescriptionsList
.add(PharmacyPrescriptions.fromJson(prescriptions));
});
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, body: requestGetListPharmacyForPrescriptions.toJson());
}
RequestPrescriptionReportEnh _requestPrescriptionReportEnh =
RequestPrescriptionReportEnh(
isDentalAllowedBackend: false,
);
List<PrescriptionReportEnh> prescriptionReportEnhList = List();
Future getPrescriptionReportEnh(
{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) {
if (prescriptionsOrder.appointmentNo == "0") {
if (element.dischargeNo == int.parse(prescriptionsOrder.dischargeID)) {
_requestPrescriptionReportEnh.appointmentNo = element.appointmentNo;
_requestPrescriptionReportEnh.clinicID = element.clinicID;
_requestPrescriptionReportEnh.projectID = element.projectID;
_requestPrescriptionReportEnh.episodeID = element.episodeID;
_requestPrescriptionReportEnh.setupID = element.setupID;
_requestPrescriptionReportEnh.dischargeNo = element.dischargeNo;
isInPatient = element.isInOutPatient;
}
} else {
if (int.parse(prescriptionsOrder.appointmentNo) ==
element.appointmentNo) {
_requestPrescriptionReportEnh.appointmentNo = element.appointmentNo;
_requestPrescriptionReportEnh.clinicID = element.clinicID;
_requestPrescriptionReportEnh.projectID = element.projectID;
_requestPrescriptionReportEnh.episodeID = element.episodeID;
_requestPrescriptionReportEnh.setupID = element.setupID;
_requestPrescriptionReportEnh.dischargeNo = element.dischargeNo;
isInPatient = element.isInOutPatient;
///call inpGetPrescriptionReport
}
}
});
hasError = false;
await baseAppClient.postPatient(
isInPatient ? GET_PRESCRIPTION_REPORT_ENH : GET_PRESCRIPTION_REPORT_NEW,
patient: patient, onSuccess: (dynamic response, int statusCode) {
prescriptionReportEnhList.clear();
if (isInPatient) {
response['ListPRM'].forEach((prescriptions) {
prescriptionReportEnhList
.add(PrescriptionReportEnh.fromJson(prescriptions));
});
} else {
response['INP_GetPrescriptionReport_List'].forEach((prescriptions) {
PrescriptionReportEnh reportEnh =
PrescriptionReportEnh.fromJson(prescriptions);
reportEnh.itemDescription = prescriptions['ItemDescriptionN'];
prescriptionReportEnhList.add(reportEnh);
});
}
}, onFailure: (String error, int statusCode) {
hasError = true;
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);
}
Future getMedicationForInPatient(PatiantInformtion patient) async {
hasError = false;
_getMedicationForInPatientRequestModel =
GetMedicationForInPatientRequestModel(
isDentalAllowedBackend: false,
admissionNo: int.parse(patient.admissionNo),
tokenID: "@dm!n",
projectID: patient.projectId,
);
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());
}
}

@ -43,15 +43,6 @@ class ProcedureService extends BaseService {
ProcedureTempleteDetailsRequestModel();
GetProcedureReqModel _getProcedureReqModel = GetProcedureReqModel(
// clinicId: 17,
// pageSize: 10,
// pageIndex: 1,
// //patientMRN: 3120725,
// //categoryId: null,
// vidaAuthTokenID:
// "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxNDg1IiwianRpIjoiZjQ4YTk0OTQtYTczZS00MDI3LWI2MjgtNzc4MjAwMzUyYWEzIiwiZW1haWwiOiJNb2hhbWVkLlJlc3dhbkBjbG91ZHNvbHV0aW9uLXNhLmNvbSIsImlkIjoiMTQ4NSIsIk5hbWUiOiJTSEFLRVJBIFBBUlZFRU4gKFVTRUQgQlkgRVNFUlZJQ0VTKSIsIkVtcGxveWVlSWQiOiIxNDg1IiwiRmFjaWxpdHlHcm91cElkIjoiMDEwMjY2IiwiRmFjaWxpdHlJZCI6IjE1IiwiUGhhcmFtY3lGYWNpbGl0eUlkIjoiNTUiLCJJU19QSEFSTUFDWV9DT05ORUNURUQiOiJUcnVlIiwiRG9jdG9ySWQiOiIxNDg1IiwiU0VTU0lPTklEIjoiMjE1ODUyMTAiLCJDbGluaWNJZCI6IjMiLCJyb2xlIjoiRE9DVE9SUyIsIm5iZiI6MTYwODM2NDU2OCwiZXhwIjoxNjA5MjI4NTY4LCJpYXQiOjE2MDgzNjQ1Njh9.YLbvq5nxPn8o9ZYkcbc5YAX7Jy23Mm0s33oRmE8GHDI",
//
// search: ["lab"],
);
GetProcedureReqModel _getProcedureCategoriseReqModel = GetProcedureReqModel(
@ -59,20 +50,16 @@ class ProcedureService extends BaseService {
pageSize: 100,
pageIndex: 1,
patientMRN: 0,
//categoryId: null,
vidaAuthTokenID:
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxNDg1IiwianRpIjoiZjQ4YTk0OTQtYTczZS00MDI3LWI2MjgtNzc4MjAwMzUyYWEzIiwiZW1haWwiOiJNb2hhbWVkLlJlc3dhbkBjbG91ZHNvbHV0aW9uLXNhLmNvbSIsImlkIjoiMTQ4NSIsIk5hbWUiOiJTSEFLRVJBIFBBUlZFRU4gKFVTRUQgQlkgRVNFUlZJQ0VTKSIsIkVtcGxveWVlSWQiOiIxNDg1IiwiRmFjaWxpdHlHcm91cElkIjoiMDEwMjY2IiwiRmFjaWxpdHlJZCI6IjE1IiwiUGhhcmFtY3lGYWNpbGl0eUlkIjoiNTUiLCJJU19QSEFSTUFDWV9DT05ORUNURUQiOiJUcnVlIiwiRG9jdG9ySWQiOiIxNDg1IiwiU0VTU0lPTklEIjoiMjE1ODUyMTAiLCJDbGluaWNJZCI6IjMiLCJyb2xlIjoiRE9DVE9SUyIsIm5iZiI6MTYwODM2NDU2OCwiZXhwIjoxNjA5MjI4NTY4LCJpYXQiOjE2MDgzNjQ1Njh9.YLbvq5nxPn8o9ZYkcbc5YAX7Jy23Mm0s33oRmE8GHDI",
//search: ["DENTAL"],
);
Future getProcedureTemplate(
{int doctorId, int projectId, int clinicId, String categoryID}) async {
{int doctorId, int projectId, int clinicId, String categoryID, bool isLocalBusy}) async {
_procedureTempleteRequestModel = ProcedureTempleteRequestModel(
// tokenID: "@dm!n",
patientID: 0,
searchType: 1,
);
hasError = false;
await baseAppClient.post(GET_TEMPLETE_LIST /*GET_PROCEDURE_TEMPLETE*/,

@ -1,5 +1,6 @@
import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart';
import 'package:doctor_app_flutter/core/enum/viewstate.dart';
import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/core/model/procedure/procedure_template_details_model.dart';
import 'package:doctor_app_flutter/core/model/search_drug/get_medication_response_model.dart';
import 'package:doctor_app_flutter/core/service/patient_medical_file/prescription/medicine_service.dart';
@ -7,8 +8,15 @@ import 'package:doctor_app_flutter/core/service/patient_medical_file/prescriptio
import 'package:doctor_app_flutter/core/service/patient_medical_file/procedure/procedure_service.dart';
import 'package:doctor_app_flutter/core/model/SOAP/GetAssessmentReqModel.dart';
import 'package:doctor_app_flutter/core/model/SOAP/GetAssessmentResModel.dart';
import 'package:doctor_app_flutter/core/viewModel/prescription/prescription_view_model.dart';
import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_container.dart';
import 'package:flutter/cupertino.dart';
import '../../locator.dart';
import '../../util/dr_app_toast_msg.dart';
import '../../util/helpers.dart';
import '../../widgets/shared/loader/gif_loader_dialog_utils.dart';
import '../model/Prescriptions/post_prescrition_req_model.dart';
import '../model/Prescriptions/prescription_model.dart';
import 'base_view_model.dart';
class MedicineViewModel extends BaseViewModel {
@ -17,6 +25,7 @@ class MedicineViewModel extends BaseViewModel {
ProcedureService _procedureService = locator<ProcedureService>();
PrescriptionService _prescriptionService = locator<PrescriptionService>();
List<ProcedureTempleteDetailsModel> get procedureTemplate =>
_procedureService.templateList;
List<ProcedureTempleteDetailsModelList> templateList = List();
@ -56,18 +65,22 @@ class MedicineViewModel extends BaseViewModel {
List<dynamic> get itemMedicineListUnit =>
_prescriptionService.itemMedicineListUnit;
Future getItem({int itemID}) async {
//hasError = false;
//_insuranceCardService.clearInsuranceCard();
setState(ViewState.Busy);
Future getItem({int itemID, bool isLocalBusy = false}) async {
if (isLocalBusy) {
setState(ViewState.BusyLocal);
} else {
setState(ViewState.Busy);
}
await _prescriptionService.getItem(itemID: itemID);
if (_prescriptionService.hasError) {
error = _prescriptionService.error;
setState(ViewState.Error);
setState(ViewState.ErrorLocal);
} else
setState(ViewState.Idle);
}
setTemplateListDependOnId() {
procedureTemplate.forEach((element) {
List<ProcedureTempleteDetailsModelList> templateListData = templateList
@ -90,31 +103,133 @@ class MedicineViewModel extends BaseViewModel {
print(templateList.length.toString());
}
Future getProcedureTemplate({String categoryID}) async {
hasError = false;
setState(ViewState.Busy);
await _procedureService.getProcedureTemplate(categoryID: categoryID);
if (_procedureService.hasError) {
error = _procedureService.error;
setState(ViewState.ErrorLocal);
getPrescriptionForDrug(
List<PrescriptionModel> prescriptionList,
MedicineViewModel model,
) {
var prescriptionDetails = [];
if (prescriptionList.length > 0) {
prescriptionList[0].entityList.forEach((element) {
if (element.mediSpanGPICode != null) {
prescriptionDetails.add({
'DrugId': element.mediSpanGPICode,
'DrugName': element.medicationName,
'Dose': element.doseDailyQuantity,
'DoseType': element.doseDailyUnitID,
'Unit': element.uom,
'FrequencyType': element.frequencyID,
'Duration': element.doseDurationDays,
'RouteID': element.routeID,
'IsScreen': element.isSIG
});
}
});
}
return prescriptionDetails;
}
postPrescription(
{String duration,
String doseTimeIn,
String dose,
String drugId,
String strength,
String route,
String frequency,
String indication,
String instruction,
PrescriptionViewModel model,
DateTime doseTime,
String doseUnit,
String icdCode,
PatiantInformtion patient,
String patientType,
bool isLocalBusy = false,
BuildContext context, PrescriptionRequestModel prescriptionRequestModel}) async {
if (isLocalBusy) {
setState(ViewState.BusyLocal);
} else {
setState(ViewState.Busy);
}
PostPrescriptionReqModel postProcedureReqModel =
new PostPrescriptionReqModel();
List<PrescriptionRequestModel> prescriptionList = List();
postProcedureReqModel.appointmentNo = patient.appointmentNo;
postProcedureReqModel.clinicID = patient.clinicId;
postProcedureReqModel.episodeID = patient.episodeNo;
postProcedureReqModel.patientMRN = patient.patientMRN;
prescriptionList.add(PrescriptionRequestModel(
covered: true,
dose: double.parse(dose),
itemId: drugId.isEmpty ? 1 : int.parse(drugId),
doseUnitId: int.parse(doseUnit),
route: route.isEmpty ? 1 : int.parse(route),
frequency: frequency.isEmpty ? 1 : int.parse(frequency),
remarks: instruction,
approvalRequired: true,
icdcode10Id: icdCode.toString(),
doseTime: doseTimeIn.isEmpty ? 1 : int.parse(doseTimeIn),
duration: duration.isEmpty ? 1 : int.parse(duration),
doseStartDate: doseTime.toIso8601String()));
postProcedureReqModel.prescriptionRequestModel = prescriptionList;
await _prescriptionService.postPrescription(postProcedureReqModel);
if (_prescriptionService.hasError) {
error = _prescriptionService.error;
if (isLocalBusy) {
setState(ViewState.ErrorLocal);
} else {
setState(ViewState.Error);
}
} else {
setTemplateListDependOnId();
setState(ViewState.Idle);
// TODO Elham* to investigate why we are calling that
setTemplateListDependOnId();
}
}
Future getPrescription({int mrn}) async {
//hasError = false;
//_insuranceCardService.clearInsuranceCard();
setState(ViewState.Busy);
await _prescriptionService.getPrescription(mrn: mrn);
Future getAssessmentList ({PatiantInformtion patientInfo, bool isLocalBusy = false}) async {
if (isLocalBusy) {
setState(ViewState.BusyLocal);
} else {
setState(ViewState.Busy);
}
GetAssessmentReqModel getAssessmentReqModel = GetAssessmentReqModel(
patientMRN: patientInfo.patientMRN,
episodeID: patientInfo.episodeNo.toString(),
editedBy: '',
doctorID: '',
appointmentNo: patientInfo.appointmentNo);
if (medicationStrengthList.length == 0) {
await getMedicationStrength(isLocalBusy: true);
}
if (medicationDurationList.length == 0) {
await getMedicationDuration(isLocalBusy: true);
}
if (medicationDoseTimeList.length == 0) {
await getMedicationDoseTime(isLocalBusy: true);
}
await getPatientAssessment(getAssessmentReqModel, isLocalBusy: true);
if (_prescriptionService.hasError) {
error = _prescriptionService.error;
setState(ViewState.ErrorLocal);
} else
if (isLocalBusy) {
setState(ViewState.ErrorLocal);
} else {
setState(ViewState.Error);
}
} else {
setState(ViewState.Idle);
}
}
Future getMedicineItem(String itemName) async {
setState(ViewState.Busy);
await _medicineService.getMedicineItem(itemName);
@ -125,35 +240,93 @@ class MedicineViewModel extends BaseViewModel {
setState(ViewState.Idle);
}
Future getMedicationList({String drug}) async {
setState(ViewState.Busy);
getMedicationList(
{String drug, bool isLocalBusy = false}) async {
if (isLocalBusy) {
setState(ViewState.BusyLocal);
} else {
setState(ViewState.Busy);
}
await getDoctorProfile(isGetProfile: true);
await _prescriptionService.getMedicationList(drug: drug);
if (_prescriptionService.hasError) {
error = _prescriptionService.error;
setState(ViewState.Error);
} else
if (isLocalBusy) {
setState(ViewState.ErrorLocal);
} else {
setState(ViewState.Error);
}
} else {
setState(ViewState.Idle);
}
}
Future getPatientAssessment(
GetAssessmentReqModel getAssessmentReqModel) async {
setState(ViewState.Busy);
GetAssessmentReqModel getAssessmentReqModel ,{bool isLocalBusy = false}) async {
if (isLocalBusy) {
setState(ViewState.BusyLocal);
} else {
setState(ViewState.Busy);
}
await _prescriptionService.getPatientAssessment(getAssessmentReqModel);
if (_prescriptionService.hasError) {
error = _prescriptionService.error;
setState(ViewState.Error);
setState(ViewState.ErrorLocal);
} else
setState(ViewState.Idle);
}
Future getMedicationStrength() async {
setState(ViewState.Busy);
Future onInitiateAllPrescription({
PrescriptionViewModel model,
PatiantInformtion patient,
ProcedureTempleteDetailsModel groupProcedures,
BuildContext context,
bool isLocalBusy = true
}
) async {
if (isLocalBusy) {
setState(ViewState.BusyLocal);
} else {
setState(ViewState.Busy);
}
model.getItem(
itemID: int.parse(
groupProcedures.aliasN.replaceAll("item code ;", "")));
GetAssessmentReqModel getAssessmentReqModel = GetAssessmentReqModel(
patientMRN: patient.patientMRN,
episodeID: patient.episodeNo.toString(),
editedBy: '',
doctorID: '',
appointmentNo: patient.appointmentNo);
if (medicationStrengthList.length == 0) {
await getMedicationStrength();
}
if (medicationDurationList.length == 0) {
await getMedicationDuration();
}
if (medicationDoseTimeList.length == 0) {
await getMedicationDoseTime();
}
await getPatientAssessment(getAssessmentReqModel);
}
Future getMedicationStrength({bool isLocalBusy = false}) async {
if (isLocalBusy) {
setState(ViewState.BusyLocal);
} else {
setState(ViewState.Busy);
}
await _prescriptionService
.getMasterLookup(MasterKeysService.MedicationStrength);
if (_prescriptionService.hasError) {
error = _prescriptionService.error;
setState(ViewState.Error);
} else
if (isLocalBusy) {
setState(ViewState.ErrorLocal);
} else {
setState(ViewState.Error);
}} else
setState(ViewState.Idle);
}
@ -179,9 +352,12 @@ class MedicineViewModel extends BaseViewModel {
setState(ViewState.Idle);
}
Future getMedicationDoseTime() async {
setState(ViewState.Busy);
await _prescriptionService
Future getMedicationDoseTime({bool isLocalBusy = false}) async {
if (isLocalBusy) {
setState(ViewState.BusyLocal);
} else {
setState(ViewState.Busy);
} await _prescriptionService
.getMasterLookup(MasterKeysService.MedicationDoseTime);
if (_prescriptionService.hasError) {
error = _prescriptionService.error;
@ -201,13 +377,17 @@ class MedicineViewModel extends BaseViewModel {
setState(ViewState.Idle);
}
Future getMedicationDuration() async {
setState(ViewState.Busy);
Future getMedicationDuration({bool isLocalBusy = false}) async {
if (isLocalBusy) {
setState(ViewState.BusyLocal);
} else {
setState(ViewState.Busy);
}
await _prescriptionService
.getMasterLookup(MasterKeysService.MedicationDuration);
if (_prescriptionService.hasError) {
error = _prescriptionService.error;
setState(ViewState.Error);
setState(ViewState.ErrorLocal);
} else
setState(ViewState.Idle);
}

@ -18,6 +18,8 @@ import 'package:doctor_app_flutter/core/model/patient/prescription/prescription_
import 'package:doctor_app_flutter/core/model/patient/prescription/prescription_res_model.dart';
import 'package:doctor_app_flutter/core/model/patient/radiology/radiology_res_model.dart';
import 'package:doctor_app_flutter/core/model/patient/vital_sign/vital_sign_res_model.dart';
import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart';
import 'package:flutter/cupertino.dart';
import '../../locator.dart';
import 'base_view_model.dart';
@ -101,16 +103,6 @@ class PatientViewModel extends BaseViewModel {
setState(ViewState.Idle);
}
Future getOutPatientPrescriptions(patient) async {
setState(ViewState.Busy);
await _patientService.getOutPatientPrescriptions(patient);
if (_patientService.hasError) {
error = _patientService.error;
setState(ViewState.Error);
} else
setState(ViewState.Idle);
}
Future getInPatientPrescriptions(patient) async {
setState(ViewState.Busy);
await _patientService.getInPatientPrescriptions(patient);

@ -4,86 +4,57 @@ 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/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_entity_model.dart';
import 'package:doctor_app_flutter/core/model/Prescriptions/prescription_model.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/search_drug/get_medication_response_model.dart';
import 'package:doctor_app_flutter/core/service/patient_medical_file/prescription/prescription_service.dart';
import 'package:doctor_app_flutter/core/service/patient_medical_file/prescription/prescriptions_service.dart';
import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart';
import 'package:doctor_app_flutter/locator.dart';
import 'package:doctor_app_flutter/core/model/SOAP/GetAllergiesResModel.dart';
import 'package:doctor_app_flutter/core/model/SOAP/GetAssessmentResModel.dart';
import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/core/model/patient/vital_sign/patient-vital-sign-data.dart';
import 'package:doctor_app_flutter/core/service/patient_medical_file/prescription/prescription_service.dart';
import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart';
import 'package:doctor_app_flutter/locator.dart';
import 'package:flutter/cupertino.dart';
class PrescriptionViewModel extends BaseViewModel {
FilterType filterType = FilterType.Clinic;
bool hasError = false;
PrescriptionService _prescriptionService = locator<PrescriptionService>();
List<GetMedicationResponseModel> get allMedicationList =>
_prescriptionService.allMedicationList;
List<GetMedicationForInPatientModel> get medicationForInPatient =>
_prescriptionsService.medicationForInPatient;
_prescriptionService.medicationForInPatient;
List<PrescriptionModel> get prescriptionList =>
_prescriptionService.prescriptionList;
List<dynamic> get drugsList => _prescriptionService.doctorsList;
//List<dynamic> get allMedicationList => _prescriptionService.allMedicationList;
List<dynamic> get drugToDrug => _prescriptionService.drugToDrugList;
List<dynamic> get itemMedicineList => _prescriptionService.itemMedicineList;
PrescriptionsService _prescriptionsService = locator<PrescriptionsService>();
List<PrescriptionsList> _prescriptionsOrderListClinic = List();
List<PrescriptionsList> _prescriptionsOrderListHospital = List();
List<PrescriptionEntityModel> get prescriptionListNew =>
_prescriptionService.prescriptionListNew;
List<PrescriptionReport> get prescriptionReportList =>
_prescriptionsService.prescriptionReportList;
List<Prescriptions> get prescriptionsList =>
_prescriptionsService.prescriptionsList;
_prescriptionService.prescriptionReportList;
List<PharmacyPrescriptions> get pharmacyPrescriptionsList =>
_prescriptionsService.pharmacyPrescriptionsList;
_prescriptionService.pharmacyPrescriptionsList;
List<PrescriptionReportEnh> get prescriptionReportEnhList =>
_prescriptionsService.prescriptionReportEnhList;
_prescriptionService.prescriptionReportEnhList;
List<PrescriptionsList> get prescriptionsOrderList =>
filterType == FilterType.Clinic
? _prescriptionsOrderListClinic
: _prescriptionsOrderListHospital;
List<PrescriotionInPatient> get inPatientPrescription =>
_prescriptionsService.prescriptionInPatientList;
getPrescriptionsInPatient(PatiantInformtion patient) async {
setState(ViewState.Busy);
error = "";
await _prescriptionsService.getPrescriptionInPatient(
mrn: patient.patientId, adn: patient.admissionNo);
if (_prescriptionsService.hasError) {
error = "No Prescription Found";
setState(ViewState.Error);
} else {
_filterList();
await _getPrescriptionsOrders();
List<dynamic> get drugToDrug => _prescriptionService.drugToDrugList;
List<PrescriptionsList> _prescriptionsOrderListClinic = List();
List<PrescriptionsList> _prescriptionsOrderListHospital = List();
setState(ViewState.Idle);
}
}
List<Prescriptions> get prescriptionsList =>
_prescriptionService.prescriptionsList;
Future getItem({int itemID}) async {
hasError = false;
//_insuranceCardService.clearInsuranceCard();
setState(ViewState.BusyLocal);
await _prescriptionService.getItem(itemID: itemID);
if (_prescriptionService.hasError) {
@ -93,11 +64,11 @@ class PrescriptionViewModel extends BaseViewModel {
setState(ViewState.Idle);
}
Future getPrescription({int mrn}) async {
Future getPrescriptionListNew({int mrn,int appNo, bool isLocalBusy = false}) async {
hasError = false;
//_insuranceCardService.clearInsuranceCard();
setState(ViewState.Busy);
await _prescriptionService.getPrescription(mrn: mrn);
if(isLocalBusy)
setState(ViewState.BusyLocal); else setState(ViewState.Busy);
await _prescriptionService.getPrescriptionListNew(mrn: mrn, appNo:appNo );
if (_prescriptionService.hasError) {
error = _prescriptionService.error;
setState(ViewState.ErrorLocal);
@ -108,54 +79,17 @@ class PrescriptionViewModel extends BaseViewModel {
Future postPrescription(
PostPrescriptionReqModel postProcedureReqModel, int mrn) async {
hasError = false;
//_insuranceCardService.clearInsuranceCard();
setState(ViewState.Busy);
setState(ViewState.BusyLocal);
await _prescriptionService.postPrescription(postProcedureReqModel);
if (_prescriptionService.hasError) {
error = _prescriptionService.error;
setState(ViewState.ErrorLocal);
} else {
await getPrescription(mrn: mrn);
await getPrescriptionListNew(mrn: mrn);
setState(ViewState.Idle);
}
}
Future getMedicationList({String drug}) async {
setState(ViewState.Busy);
await _prescriptionService.getMedicationList(drug: drug);
if (_prescriptionService.hasError) {
error = _prescriptionService.error;
setState(ViewState.Error);
} else
setState(ViewState.Idle);
}
Future updatePrescription(
PostPrescriptionReqModel updatePrescriptionReqModel, int mrn) async {
hasError = false;
//_insuranceCardService.clearInsuranceCard();
setState(ViewState.Busy);
await _prescriptionService.updatePrescription(updatePrescriptionReqModel);
if (_prescriptionService.hasError) {
error = _prescriptionService.error;
setState(ViewState.ErrorLocal);
} else {
await getPrescription(mrn: mrn);
setState(ViewState.Idle);
}
}
Future getDrugs({String drugName}) async {
hasError = false;
//_insuranceCardService.clearInsuranceCard();
setState(ViewState.BusyLocal);
await _prescriptionService.getDrugs(drugName: drugName);
if (_prescriptionService.hasError) {
error = _prescriptionService.error;
setState(ViewState.ErrorLocal);
} else
setState(ViewState.Idle);
}
Future getDrugToDrug(
VitalSignData vital,
@ -164,7 +98,7 @@ class PrescriptionViewModel extends BaseViewModel {
PatiantInformtion patient,
List<dynamic> prescription) async {
hasError = false;
setState(ViewState.Busy);
setState(ViewState.BusyLocal);
await _prescriptionService.getDrugToDrug(
vital, lstAssessments, allergy, patient, prescription);
if (_prescriptionService.hasError) {
@ -174,40 +108,9 @@ class PrescriptionViewModel extends BaseViewModel {
setState(ViewState.Idle);
}
setFilterType(FilterType filterType) {
this.filterType = filterType;
notifyListeners();
}
getPrescriptionReport(
{Prescriptions prescriptions,
@required PatiantInformtion patient}) async {
setState(ViewState.Busy);
await _prescriptionsService.getPrescriptionReport(
prescriptions: prescriptions, patient: patient);
if (_prescriptionsService.hasError) {
error = _prescriptionsService.error;
setState(ViewState.ErrorLocal);
} else {
setState(ViewState.Idle);
}
}
getListPharmacyForPrescriptions(
{int itemId, @required PatiantInformtion patient}) async {
setState(ViewState.Busy);
await _prescriptionsService.getListPharmacyForPrescriptions(
itemId: itemId, patient: patient);
if (_prescriptionsService.hasError) {
error = _prescriptionsService.error;
setState(ViewState.Error);
} else {
setState(ViewState.Idle);
}
}
void _filterList() {
_prescriptionsService.prescriptionsList.forEach((element) {
_prescriptionService.prescriptionsList.forEach((element) {
/// PrescriptionsList list sort clinic
List<PrescriptionsList> prescriptionsByClinic =
_prescriptionsOrderListClinic
@ -245,39 +148,28 @@ class PrescriptionViewModel extends BaseViewModel {
});
}
getPrescriptionReportEnh(
{PrescriptionsOrder prescriptionsOrder,
@required PatiantInformtion patient}) async {
setState(ViewState.Busy);
await _prescriptionsService.getPrescriptionReportEnh(
prescriptionsOrder: prescriptionsOrder, patient: patient);
if (_prescriptionsService.hasError) {
error = _prescriptionsService.error;
setState(ViewState.Error);
} else {
setState(ViewState.Idle);
}
}
_getPrescriptionsOrders() async {
await _prescriptionsService.getPrescriptionsOrders();
if (_prescriptionsService.hasError) {
error = _prescriptionsService.error;
await _prescriptionService.getPrescriptionsOrders();
if (_prescriptionService.hasError) {
error = _prescriptionService.error;
setState(ViewState.ErrorLocal);
} else {
setState(ViewState.Idle);
}
}
getPrescriptions(PatiantInformtion patient, {String patientType}) async {
setState(ViewState.Busy);
await _prescriptionsService.getPrescriptions(patient);
if (_prescriptionsService.hasError) {
error = _prescriptionsService.error;
if (patientType == "7")
getPrescriptions(PatiantInformtion patient, {String patientType, bool isLocalBusy = true}) async {
if(isLocalBusy)
setState(ViewState.BusyLocal);
else setState(ViewState.Busy);
await _prescriptionService.getPrescriptions(patient);
if (_prescriptionService.hasError) {
error = _prescriptionService.error;
if (isLocalBusy)
setState(ViewState.ErrorLocal);
else
setState(ViewState.ErrorLocal);
setState(ViewState.Error);
} else {
_filterList();
await _getPrescriptionsOrders();
@ -288,9 +180,23 @@ class PrescriptionViewModel extends BaseViewModel {
getMedicationForInPatient(PatiantInformtion patient) async {
setState(ViewState.Busy);
await _prescriptionsService.getMedicationForInPatient(patient);
if (_prescriptionsService.hasError) {
error = _prescriptionsService.error;
await _prescriptionService.getMedicationForInPatient(patient);
if (_prescriptionService.hasError) {
error = _prescriptionService.error;
setState(ViewState.Error);
} else {
setState(ViewState.Idle);
}
}
getPrescriptionReport(
{Prescriptions prescriptions,
@required PatiantInformtion patient}) async {
setState(ViewState.Busy);
await _prescriptionService.getPrescriptionReport(
prescriptions: prescriptions, patient: patient);
if (_prescriptionService.hasError) {
error = _prescriptionService.error;
setState(ViewState.ErrorLocal);
} else {
setState(ViewState.Idle);

@ -1,163 +0,0 @@
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/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/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/service/patient_medical_file/prescription/prescriptions_service.dart';
import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart';
import 'package:flutter/material.dart';
import '../../locator.dart';
import 'base_view_model.dart';
class PrescriptionsViewModel extends BaseViewModel {
FilterType filterType = FilterType.Clinic;
PrescriptionsService _prescriptionsService = locator<PrescriptionsService>();
List<PrescriptionsList> _prescriptionsOrderListClinic = List();
List<PrescriptionsList> _prescriptionsOrderListHospital = List();
List<PrescriptionReport> get prescriptionReportList =>
_prescriptionsService.prescriptionReportList;
List<Prescriptions> get prescriptionsList =>
_prescriptionsService.prescriptionsList;
List<PharmacyPrescriptions> get pharmacyPrescriptionsList =>
_prescriptionsService.pharmacyPrescriptionsList;
List<PrescriptionReportEnh> get prescriptionReportEnhList =>
_prescriptionsService.prescriptionReportEnhList;
List<PrescriptionsList> get prescriptionsOrderList =>
filterType == FilterType.Clinic
? _prescriptionsOrderListClinic
: _prescriptionsOrderListHospital;
List<GetMedicationForInPatientModel> get medicationForInPatient =>
_prescriptionsService.medicationForInPatient;
List<PrescriptionsList> _medicationForInPatient = List();
getPrescriptions(PatiantInformtion patient) async {
setState(ViewState.Busy);
await _prescriptionsService.getPrescriptions(patient);
if (_prescriptionsService.hasError) {
error = _prescriptionsService.error;
setState(ViewState.Error);
} else {
_filterList();
await _getPrescriptionsOrders();
setState(ViewState.Idle);
}
}
_getPrescriptionsOrders() async {
await _prescriptionsService.getPrescriptionsOrders();
if (_prescriptionsService.hasError) {
error = _prescriptionsService.error;
setState(ViewState.ErrorLocal);
} else {
setState(ViewState.Idle);
}
}
void _filterList() {
_prescriptionsService.prescriptionsList.forEach((element) {
/// PrescriptionsList list sort clinic
List<PrescriptionsList> prescriptionsByClinic =
_prescriptionsOrderListClinic
.where((elementClinic) =>
elementClinic.filterName == element.clinicDescription)
.toList();
if (prescriptionsByClinic.length != 0) {
_prescriptionsOrderListClinic[
_prescriptionsOrderListClinic.indexOf(prescriptionsByClinic[0])]
.prescriptionsList
.add(element);
} else {
_prescriptionsOrderListClinic.add(PrescriptionsList(
filterName: element.clinicDescription, prescriptions: element));
}
/// PrescriptionsList list sort via hospital
List<PrescriptionsList> prescriptionsByHospital =
_prescriptionsOrderListHospital
.where(
(elementClinic) => elementClinic.filterName == element.name,
)
.toList();
if (prescriptionsByHospital.length != 0) {
_prescriptionsOrderListHospital[_prescriptionsOrderListHospital
.indexOf(prescriptionsByHospital[0])]
.prescriptionsList
.add(element);
} else {
_prescriptionsOrderListHospital.add(PrescriptionsList(
filterName: element.name, prescriptions: element));
}
});
}
setFilterType(FilterType filterType) {
this.filterType = filterType;
notifyListeners();
}
getPrescriptionReport(
{Prescriptions prescriptions,
@required PatiantInformtion patient}) async {
setState(ViewState.Busy);
await _prescriptionsService.getPrescriptionReport(
prescriptions: prescriptions, patient: patient);
if (_prescriptionsService.hasError) {
error = _prescriptionsService.error;
setState(ViewState.ErrorLocal);
} else {
setState(ViewState.Idle);
}
}
getListPharmacyForPrescriptions(
{int itemId, @required PatiantInformtion patient}) async {
setState(ViewState.Busy);
await _prescriptionsService.getListPharmacyForPrescriptions(
itemId: itemId, patient: patient);
if (_prescriptionsService.hasError) {
error = _prescriptionsService.error;
setState(ViewState.Error);
} else {
setState(ViewState.Idle);
}
}
getPrescriptionReportEnh(
{PrescriptionsOrder prescriptionsOrder,
@required PatiantInformtion patient}) async {
setState(ViewState.Busy);
await _prescriptionsService.getPrescriptionReportEnh(
prescriptionsOrder: prescriptionsOrder, patient: patient);
if (_prescriptionsService.hasError) {
error = _prescriptionsService.error;
setState(ViewState.Error);
} else {
setState(ViewState.Idle);
}
}
getMedicationForInPatient(PatiantInformtion patient) async {
await _prescriptionsService.getMedicationForInPatient(patient);
if (_prescriptionsService.hasError) {
error = _prescriptionsService.error;
setState(ViewState.ErrorLocal);
} else {
setState(ViewState.Idle);
}
}
}

@ -6,8 +6,7 @@ import 'package:doctor_app_flutter/core/model/labs/patient_lab_orders.dart';
import 'package:doctor_app_flutter/core/model/labs/patient_lab_special_result.dart';
import 'package:doctor_app_flutter/core/model/procedure/ControlsModel.dart';
import 'package:doctor_app_flutter/core/model/procedure/categories_procedure.dart';
import 'package:doctor_app_flutter/core/model/procedure/categories_procedure.dart'
as cpe;
import 'package:doctor_app_flutter/core/model/procedure/categories_procedure.dart' as cpe;
import 'package:doctor_app_flutter/core/model/procedure/get_ordered_procedure_model.dart';
import 'package:doctor_app_flutter/core/model/procedure/post_procedure_req_model.dart';
import 'package:doctor_app_flutter/core/model/procedure/procedure_template_details_model.dart';
@ -25,6 +24,7 @@ import 'package:doctor_app_flutter/screens/procedures/ProcedureType.dart';
import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart';
import 'package:doctor_app_flutter/util/helpers.dart';
import 'package:flutter/cupertino.dart';
import '../../widgets/shared/loader/gif_loader_dialog_utils.dart';
class ProcedureViewModel extends BaseViewModel {
//TODO Hussam clean it
@ -117,17 +117,19 @@ class ProcedureViewModel extends BaseViewModel {
setState(ViewState.Idle);
}
Future getProcedureTemplate({String categoryID}) async {
hasError = false;
setState(ViewState.Busy);
await _procedureService.getProcedureTemplate(categoryID: categoryID);
Future getProcedureTemplate({String categoryID, bool isLocalBusy = false, BuildContext context}) async {
if (isLocalBusy) {
setState(ViewState.BusyLocal);
} else {
setState(ViewState.Busy);
}
await _procedureService.getProcedureTemplate(categoryID: categoryID, isLocalBusy: false);
if (_procedureService.hasError) {
error = _procedureService.error;
setState(ViewState.ErrorLocal);
} else {
} else
setTemplateListDependOnId();
setState(ViewState.Idle);
}
}
setTemplateListDependOnId() {

@ -7,7 +7,7 @@ import 'package:doctor_app_flutter/core/viewModel/hospitals_view_model.dart';
import 'package:doctor_app_flutter/core/viewModel/medical_file_view_model.dart';
import 'package:doctor_app_flutter/core/viewModel/patient_view_model.dart';
import 'package:doctor_app_flutter/core/viewModel/pednding_orders_view_model.dart';
import 'package:doctor_app_flutter/core/viewModel/prescription_view_model.dart';
import 'package:doctor_app_flutter/core/viewModel/prescription/prescription_view_model.dart';
import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.dart';
import 'package:doctor_app_flutter/core/viewModel/profile/discharge_summary_view_model.dart';
import 'package:doctor_app_flutter/core/viewModel/profile/operation_report_view_model.dart';
@ -42,7 +42,6 @@ import 'core/service/patient_medical_file/medical_report/PatientMedicalReportSer
import 'core/service/patient_medical_file/medical_report/medical_file_service.dart';
import 'core/service/patient_medical_file/prescription/medicine_service.dart';
import 'core/service/patient_medical_file/prescription/prescription_service.dart';
import 'core/service/patient_medical_file/prescription/prescriptions_service.dart';
import 'core/service/patient_medical_file/procedure/procedure_service.dart';
import 'core/service/patient_medical_file/radiology/radiology_service.dart';
import 'core/service/patient_medical_file/sick_leave/sickleave_service.dart';
@ -65,7 +64,6 @@ import 'core/viewModel/patient-admission-request-viewmodel.dart';
import 'core/viewModel/patient-referral-viewmodel.dart';
import 'core/viewModel/patient-ucaf-viewmodel.dart';
import 'core/viewModel/patient-vital-sign-viewmodel.dart';
import 'core/viewModel/prescriptions_view_model.dart';
import 'core/viewModel/profile/intervention_medication_view_model.dart';
import 'core/viewModel/profile/vte_assessment_view_model.dart';
import 'core/viewModel/radiology_view_model.dart';
@ -97,7 +95,6 @@ void setupLocator() {
locator.registerLazySingleton(() => LabsService());
locator.registerLazySingleton(() => InsuranceCardService());
locator.registerLazySingleton(() => RadiologyService());
locator.registerLazySingleton(() => PrescriptionsService());
locator.registerLazySingleton(() => ReferralService());
locator.registerLazySingleton(() => MyReferralInPatientService());
locator.registerLazySingleton(() => DischargedPatientService());
@ -138,7 +135,6 @@ void setupLocator() {
locator.registerFactory(() => LabsViewModel());
locator.registerFactory(() => InsuranceViewModel());
locator.registerFactory(() => RadiologyViewModel());
locator.registerFactory(() => PrescriptionsViewModel());
locator.registerFactory(() => DischargedPatientViewModel());
locator.registerFactory(() => PatientSearchViewModel());
locator.registerFactory(() => HospitalViewModel());

@ -24,7 +24,8 @@ import 'package:doctor_app_flutter/screens/patients/profile/radiology/radiology_
import 'package:doctor_app_flutter/screens/patients/profile/referral/refer-patient-screen-in-patient.dart';
import 'package:doctor_app_flutter/screens/patients/profile/soap_update/update_soap_index.dart';
import 'package:doctor_app_flutter/screens/patients/profile/vte_assessment/vte_assessment_screen.dart';
import 'package:doctor_app_flutter/screens/prescription/prescriptions_page.dart';
import 'package:doctor_app_flutter/screens/prescription/new_prescriptions_page.dart';
import 'package:doctor_app_flutter/screens/prescription/old_prescriptions_page.dart';
import 'package:doctor_app_flutter/screens/procedures/procedure_screen.dart';
import './screens/auth/login_screen.dart';
@ -70,6 +71,7 @@ const String PATIENT_UCAF_REQUEST = 'patients/ucaf';
const String PATIENT_UCAF_DETAIL = 'patients/ucaf/detail';
const String PATIENT_ECG = 'patients/ecg';
const String IN_PATIENT_PRESCRIPTIONS_DETAILS = 'patients/prescription-details';
const String ORDER_PRESCRIPTION_OLD = 'prescription/prescription_old';
const String ORDER_PRESCRIPTION_NEW = 'prescription/prescription_new';
const String ORDER_PROCEDURE = 'procedure/procedure';
const String ADD_SICKLEAVE = 'add-sickleave';
@ -123,7 +125,8 @@ var routes = {
),
IN_PATIENT_PRESCRIPTIONS_DETAILS: (_) => InpatientPrescriptionDetailsScreen(),
ADD_SICKLEAVE: (_) => PatientSickLeaveScreen(),
ORDER_PRESCRIPTION_NEW: (_) => PrescriptionsPage(),
ORDER_PRESCRIPTION_OLD: (_) => OldPrescriptionsPage(),
ORDER_PRESCRIPTION_NEW: (_) => NewPrescriptionsPage(),
ORDER_PROCEDURE: (_) => ProcedureScreen(),
MY_REFERRAL_DETAIL: (_) => MyReferralDetailScreen(),
PATIENT_UCAF_REQUEST: (_) => UCAFPagerScreen(),

@ -5,7 +5,7 @@ import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:doctor_app_flutter/util/tab_helper.dart';
import 'all_doctor_questions.dart';
import 'not_replaied_Doctor_Questions.dart';
@ -72,7 +72,7 @@ class _DoctorReplyScreenState extends State<DoctorReplyScreen>
preferredSize: Size.fromHeight(
MediaQuery.of(context).size.height * 0.070),
child: Container(
color: Helpers.getBgTabColor(),
color: TabHelper.getBgTabColor(),
child: TabBar(
isScrollable: false,
controller: _tabController,
@ -136,8 +136,8 @@ Widget tabWidget(
return Center(
child: Container(
height: Helpers.getTabHeight(context),
decoration: Helpers.getBoxTabsBoxDecoration(
height: TabHelper.getTabHeight(context),
decoration: TabHelper.getBoxTabsBoxDecoration(
isActive: isActive,
isFirst: isFirst,
isMiddle: isMiddle,
@ -146,9 +146,9 @@ Widget tabWidget(
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Helpers.getTabText(title: title, isActive: isActive),
TabHelper.getTabText(title: title, isActive: isActive),
if (counter != -1)
Helpers.getTabCounter(isActive: isActive, counter: counter)
TabHelper.getTabCounter(isActive: isActive, counter: counter)
],
),
),

@ -7,7 +7,7 @@ import 'package:doctor_app_flutter/core/model/livecare/session_status_model.dart
import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/screens/base/base_view.dart';
import 'package:doctor_app_flutter/screens/live_care/live-care_transfer_to_admin.dart';
import 'package:doctor_app_flutter/screens/patients/profile/profile_screen/PatientProfileCardModel.dart';
import 'package:doctor_app_flutter/screens/patients/profile/profile_screen/patient_profile_card_model.dart';
import 'package:doctor_app_flutter/util/VideoChannel.dart';
import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart';
import 'package:doctor_app_flutter/util/helpers.dart';

@ -32,7 +32,7 @@ class LivaCareTransferToAdmin extends StatefulWidget {
class _LivaCareTransferToAdminState extends State<LivaCareTransferToAdmin> {
stt.SpeechToText speech = stt.SpeechToText();
var reconizedWord;
var recognizedWord;
var event = RobotProvider();
ProjectViewModel projectViewModel;
@ -168,7 +168,7 @@ class _LivaCareTransferToAdminState extends State<LivaCareTransferToAdmin> {
}
void statusListener(String status) {
reconizedWord = status == 'listening' ? 'Lisening...' : 'Sorry....';
recognizedWord = status == 'listening' ? 'Listening...' : 'Sorry....';
}
void requestPermissions() async {
@ -178,14 +178,14 @@ class _LivaCareTransferToAdminState extends State<LivaCareTransferToAdmin> {
}
void resultListener(result) {
reconizedWord = result.recognizedWords;
event.setValue({"searchText": reconizedWord});
recognizedWord = result.recognizedWords;
event.setValue({"searchText": recognizedWord});
if (result.finalResult == true) {
setState(() {
SpeechToText.closeAlertDialog(context);
speech.stop();
noteController.text += reconizedWord + '\n';
noteController.text += recognizedWord + '\n';
});
} else {
print(result.finalResult);

@ -1,13 +1,10 @@
import 'dart:math';
import 'package:autocomplete_textfield/autocomplete_textfield.dart';
import 'package:doctor_app_flutter/config/config.dart';
import 'package:doctor_app_flutter/config/size_config.dart';
import 'package:doctor_app_flutter/core/model/search_drug/get_medication_response_model.dart';
import 'package:doctor_app_flutter/core/viewModel/medicine_view_model.dart';
import 'package:doctor_app_flutter/screens/base/base_view.dart';
import 'package:doctor_app_flutter/screens/medicine/pharmacies_list_screen.dart';
import 'package:doctor_app_flutter/screens/patients/patient_search/patient_search_header.dart';
import 'package:doctor_app_flutter/screens/patients/profile/soap_update/shared_soap_widgets/bottom_sheet_title.dart';
import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart';
import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart';
@ -21,7 +18,6 @@ import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils
import 'package:doctor_app_flutter/widgets/shared/text_fields/app_text_field_custom_serach.dart';
import 'package:flutter/material.dart';
import 'package:hexcolor/hexcolor.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:speech_to_text/speech_recognition_error.dart';
import 'package:speech_to_text/speech_recognition_result.dart';
import 'package:speech_to_text/speech_to_text.dart';
@ -45,44 +41,29 @@ class _MedicineSearchState extends State<MedicineSearchScreen> {
Helpers helpers = new Helpers();
bool _hasSpeech = false;
String _currentLocaleId = "";
bool _isInit = true;
final SpeechToText speech = SpeechToText();
String lastStatus = '';
GetMedicationResponseModel _selectedMedication;
GlobalKey key =
new GlobalKey<AutoCompleteTextFieldState<GetMedicationResponseModel>>();
// String lastWords;
List<LocaleName> _localeNames = [];
String lastError;
double level = 0.0;
double minSoundLevel = 50000;
double maxSoundLevel = -50000;
String reconizedWord;
String recognizedWord;
@override
void didChangeDependencies() {
super.didChangeDependencies();
}
void requestPermissions() async {
Map<Permission, PermissionStatus> statuses = await [
Permission.microphone,
].request();
}
Future<void> initSpeechState() async {
bool hasSpeech = await speech.initialize(
onError: errorListener, onStatus: statusListener);
// if (hasSpeech) {
// _localeNames = await speech.locales();
// var systemLocale = await speech.systemLocale();
_currentLocaleId = TranslationBase.of(context).locale.languageCode == 'en'
? 'en-GB'
: 'ar-SA'; // systemLocale.localeId;
// }
if (!mounted) return;
setState(() {
@ -101,7 +82,6 @@ class _MedicineSearchState extends State<MedicineSearchScreen> {
appBar: BottomSheetTitle(
title: TranslationBase.of(context).searchMedicine,
),
//appBarTitle: TranslationBase.of(context).searchMedicine + "6",
body: SingleChildScrollView(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
@ -153,7 +133,6 @@ class _MedicineSearchState extends State<MedicineSearchScreen> {
child: ListView.builder(
padding: const EdgeInsets.only(top: 20),
scrollDirection: Axis.vertical,
// shrinkWrap: true,
itemCount: model.pharmacyItemsList == null
? 0
: model.pharmacyItemsList.length,
@ -208,9 +187,7 @@ class _MedicineSearchState extends State<MedicineSearchScreen> {
fontWeight: FontWeight.w700,
title: TranslationBase.of(context).search,
onPressed: () async {
// onSubmitSearch();
await searchMedicine(context, model);
},
color: AppGlobal.appRedColor,
),
@ -232,7 +209,6 @@ class _MedicineSearchState extends State<MedicineSearchScreen> {
FocusScope.of(context).unfocus();
if (myController.text.isNullOrEmpty()) {
Helpers.showErrorToast(TranslationBase.of(context).typeMedicineName);
//"Type Medicine Name")
return;
}
if (myController.text.length < 3) {
@ -247,7 +223,6 @@ class _MedicineSearchState extends State<MedicineSearchScreen> {
}
startVoiceSearch() {
// lastWords = "";
lastError = "";
speech.listen(
onResult: resultListener,
@ -263,18 +238,15 @@ class _MedicineSearchState extends State<MedicineSearchScreen> {
void resultListener(SpeechRecognitionResult result) {
setState(() {
// lastWords = "${result.recognizedWords} - ${result.finalResult}";
reconizedWord = result.recognizedWords;
recognizedWord = result.recognizedWords;
lastStatus = '';
myController.text = reconizedWord;
myController.text = recognizedWord;
Future.delayed(const Duration(seconds: 2), () {
// searchMedicine(context);
});
});
}
void errorListener(SpeechRecognitionError error) {
// print("Received error status: $error, listening: ${speech.isListening}");
setState(() {
lastError = "${error.errorMsg} - ${error.permanent}";
});
@ -282,23 +254,15 @@ class _MedicineSearchState extends State<MedicineSearchScreen> {
void statusListener(String status) {
// print(
// "Received listener status: $status, listening: ${speech.isListening}");
setState(() {
lastStatus = status;
});
}
// _switchLang(selectedVal) {
// setState(() {
// _currentLocaleId = selectedVal;
// });
// print(selectedVal);
// }
void soundLevelListener(double level) {
minSoundLevel = min(minSoundLevel, level);
maxSoundLevel = max(maxSoundLevel, level);
// print("sound level $level: $minSoundLevel - $maxSoundLevel ");
setState(() {
this.level = level;
});

@ -14,6 +14,7 @@ import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import '../../../util/tab_helper.dart';
import '../DischargedPatientPage.dart';
import 'in_patient_list_page.dart';
@ -123,7 +124,7 @@ class _InPatientScreenState extends State<InPatientScreen>
color: Colors.white),
child: Container(
margin: EdgeInsets.only(top: 9),
color: Helpers.getBgTabColor(),
color: TabHelper.getBgTabColor(),
child: TabBar(
isScrollable: false,
controller: _tabController,
@ -214,8 +215,8 @@ class _InPatientScreenState extends State<InPatientScreen>
return Center(
child: Container(
height: Helpers.getTabHeight(context),
decoration: Helpers.getBoxTabsBoxDecoration(
height: TabHelper.getTabHeight(context),
decoration: TabHelper.getBoxTabsBoxDecoration(
isActive: isActive,
isFirst: isFirst,
isMiddle: isMiddle,
@ -224,9 +225,9 @@ class _InPatientScreenState extends State<InPatientScreen>
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Helpers.getTabText(title: title, isActive: isActive),
TabHelper.getTabText(title: title, isActive: isActive),
if (counter != -1)
Helpers.getTabCounter(isActive: isActive, counter: counter)
TabHelper.getTabCounter(isActive: isActive, counter: counter)
],
),
),

@ -14,6 +14,8 @@ import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import '../../config/config.dart';
class InsuranceApprovalsDetails extends StatefulWidget {
PatiantInformtion patient;
int indexInsurance;
@ -106,7 +108,7 @@ class _InsuranceApprovalsDetailsState extends State<InsuranceApprovalsDetails> {
"Approved" ||
"${model.insuranceApprovalInPatient[indexInsurance].approvalStatusDescption}" ==
"تمت الموافقة"
? Color(0xff359846)
? AppGlobal.appGreenColor
: Color(0xffD02127)
: Color(0xffD02127),
letterSpacing: -0.4,
@ -484,7 +486,7 @@ class _InsuranceApprovalsDetailsState extends State<InsuranceApprovalsDetails> {
null
? "${model.insuranceApproval[indexInsurance].approvalStatusDescption}" ==
"Approved"
? Color(0xff359846)
? AppGlobal.appGreenColor
: Color(0xffD02127)
: Color(0xffD02127),
),

@ -12,6 +12,8 @@ import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils
import 'package:flutter/material.dart';
import 'package:hexcolor/hexcolor.dart';
import '../../../config/config.dart';
class FilterDatePage extends StatefulWidget {
final OutPatientFilterType outPatientFilterType;
final PatientSearchViewModel patientSearchViewModel;
@ -144,7 +146,7 @@ class _FilterDatePageState extends State<FilterDatePage> {
child: AppButton(
title: TranslationBase.of(context).search,
padding: 10,
color: Color(0xFF359846),
color: AppGlobal.appGreenColor,
onPressed: () async {
if (widget.patientSearchViewModel.selectedFromDate ==
null ||

@ -21,6 +21,7 @@ import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:provider/provider.dart';
import '../../../util/tab_helper.dart';
import 'filter_date_page.dart';
// ignore: must_be_immutable
@ -102,8 +103,8 @@ class _OutPatientsScreenState extends State<OutPatientsScreen> {
children: [
Container(
// color: Colors.red,
height: Helpers.getTabHeight(context),
color: Helpers.getBgTabColor(),
height: TabHelper.getTabHeight(context),
color: TabHelper.getBgTabColor(),
child: Row(
mainAxisSize: MainAxisSize.max,
crossAxisAlignment: CrossAxisAlignment.center,
@ -138,7 +139,7 @@ class _OutPatientsScreenState extends State<OutPatientsScreen> {
child: Center(
child: Container(
height: screenSize.height * 0.070,
decoration: Helpers.getBoxTabsBoxDecoration(
decoration: TabHelper.getBoxTabsBoxDecoration(
isActive: _isActive,
isFirst: _times.indexOf(item) == 0,
isLast:
@ -150,12 +151,12 @@ class _OutPatientsScreenState extends State<OutPatientsScreen> {
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Helpers.getTabText(
TabHelper.getTabText(
title: item, isActive: _isActive),
_isActive &&
_activeLocation != 0 &&
model.state == ViewState.Idle
? Helpers.getTabCounter(
? TabHelper.getTabCounter(
isActive: _isActive,
counter: model.filterData.length)
: Container(),

@ -2,6 +2,7 @@ import 'package:doctor_app_flutter/config/config.dart';
import 'package:doctor_app_flutter/config/size_config.dart';
import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart';
import 'package:doctor_app_flutter/core/enum/viewstate.dart';
import 'package:doctor_app_flutter/core/model/Prescriptions/prescription_entity_model.dart';
import 'package:doctor_app_flutter/core/model/Prescriptions/prescription_model.dart';
import 'package:doctor_app_flutter/core/viewModel/patient-ucaf-viewmodel.dart';
import 'package:doctor_app_flutter/core/model/SOAP/GetAssessmentResModel.dart';
@ -339,7 +340,7 @@ class DiagnosisWidget extends StatelessWidget {
class MedicationWidget extends StatelessWidget {
final UcafViewModel model;
final EntityList prescription;
final PrescriptionEntityModel prescription;
MedicationWidget(this.model, this.prescription);

@ -3,14 +3,8 @@ import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
import 'package:flutter/material.dart';
/// *
/// By Mousa Zaid Mousa Abuzaid
/// At 13/4/2021
import '../../../../config/config.dart';
/*
All hex value from 100% to 0% alpha: used in line 122
https://gist.github.com/lopspower/03fb1cc0ac9f32ef38f4
*/
class PageStepperWidget extends StatelessWidget {
final int stepsCount;
@ -102,14 +96,14 @@ class StepWidget extends StatelessWidget {
? Color(0xFFCC9B14)
: status == StepStatus.Locked
? Color(0xFFE3E3E3)
: Color(0xFF359846),
: AppGlobal.appGreenColor,
shape: BoxShape.circle,
border: Border.all(
color: status == StepStatus.InProgress
? Color(0xFFCC9B14)
: status == StepStatus.Locked
? Color(0xFFE3E3E3)
: Color(0xFF359846),
: AppGlobal.appGreenColor,
width: 1),
),
child: Center(
@ -127,7 +121,7 @@ class StepWidget extends StatelessWidget {
width: dividerWidth,
height: 2,
color: status == StepStatus.Completed
? Color(0xFF359846)
? AppGlobal.appGreenColor
: Color(0xFFCCCCCC),
),
],
@ -178,7 +172,7 @@ class StepWidget extends StatelessWidget {
? Color(0xFFCC9B14)
: status == StepStatus.Locked
? Color(0xFF969696)
: Color(0xFF359846),
: AppGlobal.appGreenColor,
),
)
],

@ -13,6 +13,8 @@ import 'package:flutter/material.dart';
import 'package:html_editor_enhanced/html_editor.dart';
import 'package:permission_handler/permission_handler.dart';
import '../../../../config/config.dart';
class AddVerifyMedicalReport extends StatefulWidget {
final PatiantInformtion patient;
final String patientType;
@ -157,7 +159,7 @@ class _AddVerifyMedicalReportState extends State<AddVerifyMedicalReport> {
title: widget.status == MedicalReportStatus.ADD
? TranslationBase.of(context).add
: TranslationBase.of(context).verify,
color: Color(0xff359846),
color: AppGlobal.appGreenColor,
fontWeight: FontWeight.w700,
onPressed: () async {
txtOfMedicalReport =

@ -51,7 +51,7 @@ class _UpdateNoteOrderState extends State<UpdateNoteOrder> {
int selectedType;
bool isSubmitted = false;
stt.SpeechToText speech = stt.SpeechToText();
var reconizedWord;
var recognizedWord;
var event = RobotProvider();
ProjectViewModel projectViewModel;
@ -201,7 +201,7 @@ class _UpdateNoteOrderState extends State<UpdateNoteOrder> {
? TranslationBase.of(context).noteUpdate
: TranslationBase.of(context).noteAdd) +
TranslationBase.of(context).progressNote,
color: Color(0xff359846),
color: AppGlobal.appGreenColor,
// disabled: progressNoteController.text.isEmpty,
fontWeight: FontWeight.w700,
onPressed: () async {
@ -296,7 +296,7 @@ class _UpdateNoteOrderState extends State<UpdateNoteOrder> {
}
void statusListener(String status) {
reconizedWord = status == 'listening' ? 'Lisening...' : 'Sorry....';
recognizedWord = status == 'listening' ? 'Listening...' : 'Sorry....';
}
void requestPermissions() async {
@ -306,14 +306,14 @@ class _UpdateNoteOrderState extends State<UpdateNoteOrder> {
}
void resultListener(result) {
reconizedWord = result.recognizedWords;
event.setValue({"searchText": reconizedWord});
recognizedWord = result.recognizedWords;
event.setValue({"searchText": recognizedWord});
if (result.finalResult == true) {
setState(() {
SpeechToText.closeAlertDialog(context);
speech.stop();
progressNoteController.text += reconizedWord + '\n';
progressNoteController.text += recognizedWord + '\n';
});
} else {
print(result.finalResult);

@ -20,6 +20,8 @@ import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:speech_to_text/speech_to_text.dart' as stt;
import '../../../../config/config.dart';
class UpdateOperationReport extends StatefulWidget {
final GetReservationsResponseModel reservation;
@ -45,7 +47,7 @@ class _UpdateOperationReportState extends State<UpdateOperationReport> {
int selectedType;
bool isSubmitted = false;
stt.SpeechToText speech = stt.SpeechToText();
var reconizedWord;
var recognizedWord;
var event = RobotProvider();
ProjectViewModel projectViewModel;
@ -532,7 +534,7 @@ class _UpdateOperationReportState extends State<UpdateOperationReport> {
: TranslationBase.of(context).noteAdd) +
" " +
TranslationBase.of(context).operationReports,
color: Color(0xff359846),
color: AppGlobal.appGreenColor,
// disabled: operationReportsController.text.isEmpty,
fontWeight: FontWeight.w700,
onPressed: () async {

@ -9,6 +9,7 @@ import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dar
import 'package:flutter/material.dart';
import 'package:hexcolor/hexcolor.dart';
import '../../../../config/config.dart';
import '../../../../core/viewModel/profile/intervention_medication_view_model.dart';
import '../../../base/base_view.dart';
import 'intervention_medication.dart';
@ -163,7 +164,7 @@ class _PharmacyInterventionScreenState
child: AppButton(
title: TranslationBase.of(context).search,
padding: 5,
color: Color(0xFF359846),
color: AppGlobal.appGreenColor,
onPressed: () async {
Navigator.push(
context,

@ -1,5 +1,5 @@
import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/screens/patients/profile/profile_screen/PatientProfileCardModel.dart';
import 'package:doctor_app_flutter/screens/patients/profile/profile_screen/patient_profile_card_model.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/patients/profile/PatientProfileButton.dart';
import 'package:flutter/material.dart';
@ -58,12 +58,19 @@ class ProfileGridForInPatient extends StatelessWidget {
RADIOLOGY_PATIENT,
'assets/images/svgs/profile_screen/Radiology.svg',
isInPatient: isInpatient),
PatientProfileCardModel(
TranslationBase.of(context).patient,
TranslationBase.of(context).prescription + ' (${TranslationBase.of(context).old})',
ORDER_PRESCRIPTION_OLD,
'assets/images/svgs/profile_screen/order prescription.svg',
isInPatient: isInpatient),
PatientProfileCardModel(
TranslationBase.of(context).patient,
TranslationBase.of(context).prescription,
ORDER_PRESCRIPTION_NEW,
'assets/images/svgs/profile_screen/order prescription.svg',
isInPatient: isInpatient),
PatientProfileCardModel(
TranslationBase.of(context).progress,
TranslationBase.of(context).note,

@ -1,5 +1,5 @@
import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/screens/patients/profile/profile_screen/PatientProfileCardModel.dart';
import 'package:doctor_app_flutter/screens/patients/profile/profile_screen/patient_profile_card_model.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/patients/profile/PatientProfileButton.dart';
import 'package:flutter/material.dart';
@ -58,6 +58,12 @@ class ProfileGridForOther extends StatelessWidget {
isInPatient: isInpatient),
PatientProfileCardModel(
TranslationBase.of(context).orders,
TranslationBase.of(context).prescription + ' (${TranslationBase.of(context).old})',
ORDER_PRESCRIPTION_OLD,
'assets/images/svgs/profile_screen/order prescription.svg',
isInPatient: isInpatient),
PatientProfileCardModel(
TranslationBase.of(context).patient,
TranslationBase.of(context).prescription,
ORDER_PRESCRIPTION_NEW,
'assets/images/svgs/profile_screen/order prescription.svg',

@ -1,5 +1,5 @@
import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/screens/patients/profile/profile_screen/PatientProfileCardModel.dart';
import 'package:doctor_app_flutter/screens/patients/profile/profile_screen/patient_profile_card_model.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/patients/profile/PatientProfileButton.dart';
import 'package:flutter/material.dart';
@ -55,6 +55,12 @@ class ProfileGridForSearch extends StatelessWidget {
isInPatient: isInpatient),
PatientProfileCardModel(
TranslationBase.of(context).orders,
TranslationBase.of(context).prescription + ' (${TranslationBase.of(context).old})',
ORDER_PRESCRIPTION_OLD,
'assets/images/svgs/profile_screen/order prescription.svg',
isInPatient: isInpatient),
PatientProfileCardModel(
TranslationBase.of(context).patient,
TranslationBase.of(context).prescription,
ORDER_PRESCRIPTION_NEW,
'assets/images/svgs/profile_screen/order prescription.svg',

@ -46,7 +46,7 @@ class _AddReplayOnReferralPatientState
int replay = 1;
int reject = 2;
stt.SpeechToText speech = stt.SpeechToText();
var reconizedWord;
var recognizedWord;
var event = RobotProvider();
TextEditingController replayOnReferralController = TextEditingController();
@ -248,7 +248,7 @@ class _AddReplayOnReferralPatientState
void errorListener(SpeechRecognitionError error) {}
void statusListener(String status) {
reconizedWord = status == 'listening' ? 'Lisening...' : 'Sorry....';
recognizedWord = status == 'listening' ? 'Listening...' : 'Sorry....';
}
void requestPermissions() async {
@ -258,13 +258,13 @@ class _AddReplayOnReferralPatientState
}
void resultListener(result) {
reconizedWord = result.recognizedWords;
event.setValue({"searchText": reconizedWord});
recognizedWord = result.recognizedWords;
event.setValue({"searchText": recognizedWord});
if (result.finalResult == true) {
setState(() {
SpeechToText.closeAlertDialog(context);
replayOnReferralController.text += reconizedWord + '\n';
replayOnReferralController.text += recognizedWord + '\n';
});
}
}

@ -10,6 +10,7 @@ import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import '../../../../util/tab_helper.dart';
import '../../ReferralDischargedPatientPage.dart';
import 'my-referral-inpatient-screen.dart';
@ -60,8 +61,8 @@ class _PatientReferralScreen extends State<PatientReferralScreen>
Size.fromHeight(MediaQuery.of(context).size.height * 0.070),
child: Center(
child: Container(
height: Helpers.getTabHeight(context),
color: Helpers.getBgTabColor(),
height: TabHelper.getTabHeight(context),
color: TabHelper.getBgTabColor(),
child: Center(
child: TabBar(
isScrollable: false,
@ -75,36 +76,36 @@ class _PatientReferralScreen extends State<PatientReferralScreen>
unselectedLabelColor: Colors.grey[800],
tabs: [
Container(
decoration: Helpers.getBoxTabsBoxDecoration(
decoration: TabHelper.getBoxTabsBoxDecoration(
isActive: index == 0,
isFirst: true,
projectViewModel: projectsProvider),
child: Center(
child: Helpers.getTabText(
child: TabHelper.getTabText(
title: TranslationBase.of(context)
.myReferredPatient,
isActive: index == 0)),
),
Center(
child: Container(
decoration: Helpers.getBoxTabsBoxDecoration(
decoration: TabHelper.getBoxTabsBoxDecoration(
isActive: index == 1,
isMiddle: true,
projectViewModel: projectsProvider),
child: Center(
child: Helpers.getTabText(
child: TabHelper.getTabText(
title: TranslationBase.of(context).referral,
isActive: index == 1)),
),
),
Center(
child: Container(
decoration: Helpers.getBoxTabsBoxDecoration(
decoration: TabHelper.getBoxTabsBoxDecoration(
isActive: index == 2,
isLast: true,
projectViewModel: projectsProvider),
child: Center(
child: Helpers.getTabText(
child: TabHelper.getTabText(
title: TranslationBase.of(context).discharged,
isActive: index == 2),
),

@ -49,7 +49,7 @@ class _PatientMakeInPatientReferralScreenState
String doctorError;
String frequencyError;
stt.SpeechToText speech = stt.SpeechToText();
var reconizedWord;
var recognizedWord;
var event = RobotProvider();
@override
@ -88,7 +88,7 @@ class _PatientMakeInPatientReferralScreenState
}
void statusListener(String status) {
reconizedWord = status == 'listening' ? 'Lisening...' : 'Sorry....';
recognizedWord = status == 'listening' ? 'Listening...' : 'Sorry....';
}
void requestPermissions() async {
@ -98,14 +98,14 @@ class _PatientMakeInPatientReferralScreenState
}
void resultListener(result) {
reconizedWord = result.recognizedWords;
event.setValue({"searchText": reconizedWord});
recognizedWord = result.recognizedWords;
event.setValue({"searchText": recognizedWord});
if (result.finalResult == true) {
setState(() {
SpeechToText.closeAlertDialog(context);
speech.stop();
_remarksController.text += reconizedWord + '\n';
_remarksController.text += recognizedWord + '\n';
});
} else {
print(result.finalResult);
@ -515,7 +515,7 @@ class _PatientMakeInPatientReferralScreenState
child: AppButton(
title: TranslationBase.of(context).refer,
fontWeight: FontWeight.w700,
color: Color(0XFF359846),
color: AppGlobal.appGreenColor,
onPressed: () async {
setState(() {
if (_referTo == null) {

@ -3,6 +3,8 @@ import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dar
import 'package:flutter/material.dart';
import 'package:hexcolor/hexcolor.dart';
import '../../../../../config/config.dart';
class BottomSheetDialogButton extends StatelessWidget {
final Function onTap;
final String label;
@ -33,7 +35,7 @@ class BottomSheetDialogButton extends StatelessWidget {
child: Center(
child: AppButton(
title: label,
color: Color(0xFF359846),
color: AppGlobal.appGreenColor,
onPressed: onTap,
),
),

@ -4,6 +4,8 @@ import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
import 'package:flutter/material.dart';
import 'package:hexcolor/hexcolor.dart';
import '../../../../../../config/config.dart';
class StatusLabel extends StatelessWidget {
const StatusLabel({
Key key,
@ -43,7 +45,7 @@ class StatusLabel extends StatelessWidget {
color: stepId == selectedStepId
? Color(0xFFCC9B14)
: stepId < selectedStepId
? Color(0xFF359846)
? AppGlobal.appGreenColor
: Color(0xFF969696),
),
),

@ -7,6 +7,7 @@ import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:provider/provider.dart';
import '../../../../../../config/config.dart';
import 'Step_details_widget.dart';
class StepsWidget extends StatelessWidget {
@ -85,7 +86,7 @@ class StepsWidget extends StatelessWidget {
color: index == 0
? Color(0xFFCC9B14)
: index > 0
? Color(0xFF359846)
? AppGlobal.appGreenColor
: Color(0xFFCCCCCC),
),
child: Center(
@ -137,7 +138,7 @@ class StepsWidget extends StatelessWidget {
color: index == 1
? Color(0xFFCC9B14)
: index > 1
? Color(0xFF359846)
? AppGlobal.appGreenColor
: Color(0xFFCCCCCC),
),
child: Center(
@ -192,7 +193,7 @@ class StepsWidget extends StatelessWidget {
color: index == 2
? Color(0xFFCC9B14)
: index > 2
? Color(0xFF359846)
? AppGlobal.appGreenColor
: Color(0xFFCCCCCC),
),
child: Center(
@ -245,7 +246,7 @@ class StepsWidget extends StatelessWidget {
color: index == 3
? Color(0xFFCC9B14)
: index > 3
? Color(0xFF359846)
? AppGlobal.appGreenColor
: Color(0xFFCCCCCC),
),
child: Center(
@ -323,7 +324,7 @@ class StepsWidget extends StatelessWidget {
color: index == 0
? Color(0xFFCC9B14)
: index > 0
? Color(0xFF359846)
? AppGlobal.appGreenColor
: Color(0xFFCCCCCC),
),
child: Center(
@ -375,7 +376,7 @@ class StepsWidget extends StatelessWidget {
color: index == 1
? Color(0xFFCC9B14)
: index > 1
? Color(0xFF359846)
? AppGlobal.appGreenColor
: Color(0xFFCCCCCC),
),
child: Center(

@ -158,8 +158,8 @@ class _RegisterPatientPageState extends State<RegisterPatientPage>
hasBorder: true,
vPadding: 12,
hPadding: 8,
borderColor: Color(0xFF359846),
color: Color(0xFF359846),
borderColor: AppGlobal.appGreenColor,
color: AppGlobal.appGreenColor,
fontColor: Colors.white,
onPressed: () {},
),

@ -0,0 +1,146 @@
import 'package:doctor_app_flutter/config/size_config.dart';
import 'package:doctor_app_flutter/core/enum/viewstate.dart';
import 'package:doctor_app_flutter/core/model/Prescriptions/prescription_model.dart';
import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/core/model/search_drug/get_medication_response_model.dart';
import 'package:doctor_app_flutter/core/viewModel/medicine_view_model.dart';
import 'package:doctor_app_flutter/core/viewModel/prescription/prescription_view_model.dart';
import 'package:doctor_app_flutter/screens/patients/profile/soap_update/shared_soap_widgets/bottom_sheet_dialog_button.dart';
import 'package:doctor_app_flutter/screens/patients/profile/soap_update/shared_soap_widgets/bottom_sheet_title.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/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'drug_to_drug.dart';
class AddDrugWidget extends StatefulWidget {
final PatiantInformtion patient;
final List<PrescriptionModel> prescriptionList;
final MedicineViewModel medicineModel;
final PrescriptionViewModel modelPrescription;
final dynamic units;
final dynamic route;
final dynamic frequency;
final dynamic duration;
final dynamic doseTime;
final dynamic uom;
final dynamic x;
final GetMedicationResponseModel selectedMedication;
final String strength;
final String indication;
final String instruction;
final DateTime selectedDate;
const AddDrugWidget(
{Key key,
this.patient,
this.prescriptionList,
this.medicineModel,
this.modelPrescription,
this.units,
this.route,
this.frequency,
this.duration,
this.doseTime,
this.uom,
this.x,
this.selectedMedication,
this.strength,
this.indication,
this.instruction,
this.selectedDate})
: super(key: key);
@override
_AddDrugWidgetState createState() => _AddDrugWidgetState();
}
class _AddDrugWidgetState extends State<AddDrugWidget> {
@override
Widget build(BuildContext context) {
return AppScaffold(
baseViewModel: widget.medicineModel,
appBar:
BottomSheetTitle(title: TranslationBase.of(context).addMedication),
body: Container(
height: SizeConfig.realScreenHeight * .8,
width: SizeConfig.realScreenWidth,
child: SingleChildScrollView(
child: Column(
children: [
DrugToDrug(
widget.patient,
widget.medicineModel.getPrescriptionForDrug(
widget.prescriptionList, widget.medicineModel),
widget.medicineModel.patientAssessmentList),
],
)),
),
bottomSheet: widget.medicineModel.state == ViewState.BusyLocal ||
widget.medicineModel.state == ViewState.Busy
? Container(
height: 0,
)
: BottomSheetDialogButton(
label: TranslationBase.of(context).addMedication,
onTap: () async {
GifLoaderDialogUtils.showMyDialog(context);
await widget.medicineModel.postPrescription(
isLocalBusy: true,
icdCode: widget.medicineModel.patientAssessmentList.isNotEmpty
? widget.medicineModel.patientAssessmentList[0]
.icdCode10ID.isEmpty
? "test"
: widget.medicineModel.patientAssessmentList[0]
.icdCode10ID
.toString()
: "test",
dose: widget.strength,
doseUnit:
widget.medicineModel.itemMedicineListUnit.length == 1
? widget.medicineModel
.itemMedicineListUnit[0]['parameterCode']
.toString()
: widget.units['parameterCode'].toString(),
patient: widget.patient,
doseTimeIn: widget.doseTime['id'].toString(),
model: widget.modelPrescription,
duration: widget.duration['id'].toString(),
frequency: widget.medicineModel.itemMedicineList.length == 1
? widget
.medicineModel.itemMedicineList[0]['parameterCode']
.toString()
: widget.frequency['parameterCode'].toString(),
route: widget.medicineModel.itemMedicineListRoute.length == 1
? widget.medicineModel
.itemMedicineListRoute[0]['parameterCode']
.toString()
: widget.route['parameterCode'].toString(),
drugId: widget.selectedMedication.itemId.toString(),
strength: widget.strength,
indication: widget.indication,
instruction: widget.instruction,
doseTime: widget.selectedDate,
);
if (widget.medicineModel.state == ViewState.ErrorLocal) {
GifLoaderDialogUtils.hideDialog(context);
Helpers.showErrorToast(widget.medicineModel.error);
} else if (widget.modelPrescription.state == ViewState.Idle) {
await widget.modelPrescription.getPrescriptionListNew(
appNo: widget.patient.appointmentNo,
mrn: widget.patient.patientMRN,
isLocalBusy: true);
GifLoaderDialogUtils.hideDialog(context);
DrAppToastMsg.showSuccesToast(
TranslationBase.of(context).medicationHasBeenAdded);
Navigator.of(context).pop();
Navigator.of(context).pop();
}
},
),
);
}
}

@ -4,13 +4,14 @@ import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart';
import 'package:doctor_app_flutter/core/enum/viewstate.dart';
import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart';
import 'package:doctor_app_flutter/core/viewModel/patient-vital-sign-viewmodel.dart';
import 'package:doctor_app_flutter/core/viewModel/prescription_view_model.dart';
import 'package:doctor_app_flutter/core/viewModel/prescription/prescription_view_model.dart';
import 'package:doctor_app_flutter/core/model/SOAP/GeneralGetReqForSOAP.dart';
import 'package:doctor_app_flutter/core/model/SOAP/GetAssessmentResModel.dart';
import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/screens/base/base_view.dart';
import 'package:doctor_app_flutter/screens/medicine/medicine_search_screen.dart';
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_container.dart';
import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart';
import 'package:flutter/material.dart';
@ -38,8 +39,8 @@ class _DrugToDrug extends State<DrugToDrug> {
];
VitalSignsViewModel model = new VitalSignsViewModel();
SOAPViewModel model2 = new SOAPViewModel();
VitalSignsViewModel vitalSignsViewModel = new VitalSignsViewModel();
SOAPViewModel soapViewModel = new SOAPViewModel();
@override
void initState() {
@ -52,18 +53,18 @@ class _DrugToDrug extends State<DrugToDrug> {
Widget build(BuildContext context) {
return isLoaded == true
? BaseView<PrescriptionViewModel>(
onModelReady: (model3) => model3.getDrugToDrug(
model.patientVitalSigns,
onModelReady: (prescriptionViewModel) => prescriptionViewModel.getDrugToDrug(
vitalSignsViewModel.patientVitalSigns,
widget.listAssessment,
model2.patientAllergiesList,
soapViewModel.patientAllergiesList,
widget.patient,
widget.prescription),
builder: (BuildContext context, PrescriptionViewModel model3,
builder: (BuildContext context, PrescriptionViewModel prescriptionViewModel,
Widget child) =>
NetworkBaseView(
baseViewModel: model3,
baseViewModel: prescriptionViewModel,
child: Container(
height: SizeConfig.realScreenHeight * .4,
height: SizeConfig.realScreenHeight * .9,
child: new ListView.builder(
itemCount: expandableList.length,
itemBuilder: (context, i) {
@ -73,7 +74,7 @@ class _DrugToDrug extends State<DrugToDrug> {
' ' +
'(' +
getDrugInfo(expandableList[i]['level'],
model3)
prescriptionViewModel)
.length
.toString() +
')',
@ -81,7 +82,7 @@ class _DrugToDrug extends State<DrugToDrug> {
fontWeight: FontWeight.bold,
),
children: getDrugInfo(
expandableList[i]['level'], model3)
expandableList[i]['level'], prescriptionViewModel)
.map((item) {
return Container(
padding: EdgeInsets.all(10),
@ -93,10 +94,8 @@ class _DrugToDrug extends State<DrugToDrug> {
}))))
: Container(
height: SizeConfig.realScreenHeight * .45,
child: Center(
child: CircularProgressIndicator(
valueColor: AlwaysStoppedAnimation<Color>(Colors.black),
)));
child: GifLoaderContainer()
);
}
getTypeID() async {
@ -117,19 +116,18 @@ class _DrugToDrug extends State<DrugToDrug> {
widget.patient.appointmentNo,
doctorID: '',
editedBy: '');
/// TODO Elham* rename model to meaning full not just modle with number
await model.getPatientVitalSign(widget.patient);
await model2.getPatientAllergy(generalGetReqForSOAP);
await model2.getMasterLookup(MasterKeysService.DiagnosisType);
if (model.state == ViewState.Idle && model2.state == ViewState.Idle) {
await vitalSignsViewModel.getPatientVitalSign(widget.patient);
await soapViewModel.getPatientAllergy(generalGetReqForSOAP);
await soapViewModel.getMasterLookup(MasterKeysService.DiagnosisType);
if (vitalSignsViewModel.state == ViewState.Idle && soapViewModel.state == ViewState.Idle) {
setState(() {
isLoaded = true;
});
}
}
List<dynamic> getDrugInfo(level, model3) {
return model3.drugToDrug.where((i) => i['Severity'] == level).toList();
List<dynamic> getDrugInfo(level, prescriptionViewModel) {
return prescriptionViewModel.drugToDrug.where((i) => i['Severity'] == level).toList();
}
}

@ -0,0 +1,171 @@
import 'package:autocomplete_textfield/autocomplete_textfield.dart';
import 'package:doctor_app_flutter/core/model/Prescriptions/prescription_model.dart';
import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/core/model/search_drug/get_medication_response_model.dart';
import 'package:doctor_app_flutter/core/provider/robot_provider.dart';
import 'package:doctor_app_flutter/core/viewModel/medicine_view_model.dart';
import 'package:doctor_app_flutter/core/viewModel/prescription/prescription_view_model.dart';
import 'package:doctor_app_flutter/screens/base/base_view.dart';
import 'package:doctor_app_flutter/screens/prescription/add_prescription/prescription_form_widget.dart';
import 'package:doctor_app_flutter/screens/prescription/add_prescription/search_preescription_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart';
import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart';
import 'package:flutter/material.dart';
import 'package:speech_to_text/speech_to_text.dart' as stt;
class AddPrescription extends StatefulWidget {
final PrescriptionViewModel prescriptionViewModel;
final PatiantInformtion patient;
final List<PrescriptionModel> prescriptionList;
AddPrescription(
this.prescriptionViewModel, this.patient, this.prescriptionList);
@override
_AddPrescriptionState createState() => _AddPrescriptionState();
}
class _AddPrescriptionState extends State<AddPrescription> {
String routeError;
String frequencyError;
String doseTimeError;
String durationError;
String unitError;
String strengthError;
int selectedType;
bool visibilitySearch = true;
TextEditingController strengthController = TextEditingController();
TextEditingController unitController = TextEditingController();
TextEditingController indicationController = TextEditingController();
TextEditingController instructionController = TextEditingController();
bool visibilityPrescriptionForm = false;
final myController = TextEditingController();
DateTime selectedDate;
int strengthChar;
GetMedicationResponseModel _selectedMedication;
MedicineViewModel medicineViewModel;
GlobalKey key =
new GlobalKey<AutoCompleteTextFieldState<GetMedicationResponseModel>>();
TextEditingController drugIdController = TextEditingController();
TextEditingController doseController = TextEditingController();
final searchController = TextEditingController();
stt.SpeechToText speech = stt.SpeechToText();
var event = RobotProvider();
var recognizedWord;
final GlobalKey<FormState> formKey = GlobalKey<FormState>();
final double spaceBetweenTextFields = 12;
dynamic route;
dynamic frequency;
dynamic duration;
dynamic doseTime;
dynamic indication;
dynamic units;
dynamic uom;
dynamic box;
dynamic x;
PatiantInformtion patient;
@override
Widget build(BuildContext context) {
return BaseView<MedicineViewModel>(
builder: (
BuildContext context,
MedicineViewModel model,
Widget child,
) =>
NetworkBaseView(
baseViewModel: model,
child: GestureDetector(
onTap: () {
FocusScope.of(context).requestFocus(new FocusNode());
},
child: DraggableScrollableSheet(
initialChildSize: 0.98,
maxChildSize: 0.98,
minChildSize: 0.9,
builder:
(BuildContext context, ScrollController scrollController) {
return SingleChildScrollView(
child: Container(
height: MediaQuery.of(context).size.height * 1.65,
color: Color(0xffF8F8F8),
child: Padding(
padding: EdgeInsets.symmetric(
horizontal: 12.0, vertical: 10.0),
child: Column(
children: [
Column(
children: [
SizedBox(
height: 60,
),
],
),
SizedBox(
height: spaceBetweenTextFields,
),
Container(
child: Column(
children: [
Visibility(
visible: visibilitySearch,
child: SearchPrescriptionWidget(
spaceBetweenTextFields:
spaceBetweenTextFields,
medicineViewModel: model,
prescriptionViewModel:
widget.prescriptionViewModel,
onItemSelected:
(GetMedicationResponseModel
medication) async {
setState(() {
visibilitySearch = !visibilitySearch;
_selectedMedication = medication;
});
GifLoaderDialogUtils.showMyDialog(context);
await model.getAssessmentList(patientInfo: widget.patient, isLocalBusy: true);
GifLoaderDialogUtils.hideDialog(context);
},
),
),
Visibility(
visible: !visibilitySearch,
child: Container(
child: Column(
children: [
PrescriptionFormWidget(
patient: widget.patient,
prescriptionViewModel:
widget.prescriptionViewModel,
medicineViewModel: model,
prescriptionList:
widget.prescriptionList,
selectedMedication: _selectedMedication,
),
],
),
),
),
],
),
),
],
),
),
),
);
}),
),
),
);
}
}

@ -0,0 +1,547 @@
import 'package:autocomplete_textfield/autocomplete_textfield.dart';
import 'package:doctor_app_flutter/config/config.dart';
import 'package:doctor_app_flutter/config/size_config.dart';
import 'package:doctor_app_flutter/core/model/Prescriptions/prescription_model.dart';
import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/core/model/search_drug/get_medication_response_model.dart';
import 'package:doctor_app_flutter/core/provider/robot_provider.dart';
import 'package:doctor_app_flutter/core/service/AnalyticsService.dart';
import 'package:doctor_app_flutter/core/viewModel/medicine_view_model.dart';
import 'package:doctor_app_flutter/core/viewModel/prescription/prescription_view_model.dart';
import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart';
import 'package:doctor_app_flutter/locator.dart';
import 'package:doctor_app_flutter/screens/prescription/prescription_text_filed.dart';
import 'package:doctor_app_flutter/util/date-utils.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/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/shared/TextFields.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:doctor_app_flutter/widgets/shared/speech-text-popup.dart';
import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:hexcolor/hexcolor.dart';
import 'package:speech_to_text/speech_recognition_error.dart';
import 'package:speech_to_text/speech_to_text.dart' as stt;
import '../../../widgets/transitions/slide_up_page.dart';
import 'add_drug/add_drug_widget.dart';
class PrescriptionFormWidget extends StatefulWidget {
final PatiantInformtion patient;
final List<PrescriptionModel> prescriptionList;
final PrescriptionViewModel prescriptionViewModel;
final MedicineViewModel medicineViewModel;
final GetMedicationResponseModel selectedMedication;
const PrescriptionFormWidget(
{Key key,
this.patient,
this.prescriptionList,
this.prescriptionViewModel,
this.medicineViewModel,
this.selectedMedication});
@override
_PrescriptionFormWidgetState createState() => _PrescriptionFormWidgetState();
}
class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
String routeError;
String frequencyError;
String doseTimeError;
String durationError;
String unitError;
String strengthError;
int selectedType;
TextEditingController strengthController = TextEditingController();
TextEditingController unitController = TextEditingController();
TextEditingController indicationController = TextEditingController();
TextEditingController instructionController = TextEditingController();
bool visibilityPrescriptionForm = false;
bool visibilitySearch = true;
final myController = TextEditingController();
DateTime selectedDate;
int strengthChar;
GlobalKey key =
new GlobalKey<AutoCompleteTextFieldState<GetMedicationResponseModel>>();
TextEditingController drugIdController = TextEditingController();
TextEditingController doseController = TextEditingController();
final searchController = TextEditingController();
stt.SpeechToText speech = stt.SpeechToText();
var event = RobotProvider();
var recognizedWord;
final GlobalKey<FormState> formKey = GlobalKey<FormState>();
final double spaceBetweenTextFields = 12;
dynamic route;
dynamic frequency;
dynamic duration;
dynamic doseTime;
dynamic units;
dynamic uom;
dynamic box;
dynamic x;
setSelectedType(int val) {
setState(() {
selectedType = val;
});
}
onVoiceText() async {
new SpeechToText(context: context).showAlertDialog(context);
var lang = TranslationBase.of(AppGlobal.CONTEX).locale.languageCode;
bool available = await speech.initialize(
onStatus: statusListener, onError: errorListener);
if (available) {
speech.listen(
onResult: resultListener,
listenMode: stt.ListenMode.confirmation,
localeId: lang == 'en' ? 'en-US' : 'ar-SA',
);
} else {
print("The user has denied the use of speech recognition.");
}
}
void errorListener(SpeechRecognitionError error) {
event.setValue({"searchText": 'null'});
print(error);
}
void statusListener(String status) {
recognizedWord = status == 'listening' ? 'Listening...' : 'Sorry....';
}
void resultListener(result) {
recognizedWord = result.recognizedWords;
event.setValue({"searchText": recognizedWord});
if (result.finalResult == true) {
setState(() {
SpeechToText.closeAlertDialog(context);
speech.stop();
instructionController.text += recognizedWord + '\n';
});
} else {
print(result.finalResult);
}
}
Future<void> initSpeechState() async {
bool hasSpeech = await speech.initialize(
onError: errorListener, onStatus: statusListener);
print(hasSpeech);
if (!mounted) return;
}
@override
Widget build(BuildContext context) {
final screenSize = MediaQuery.of(context).size;
return Form(
key: formKey,
child: Column(
children: [
AppText(
widget.selectedMedication?.description ?? "",
fontWeight: FontWeight.w600,
),
SizedBox(
height: 15.0,
),
Container(
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
SizedBox(
width: 6,
),
AppText(
TranslationBase.of(context).orderType,
fontWeight: FontWeight.w500,
),
SizedBox(
width: 18,
),
Radio(
activeColor: AppGlobal.appRedColor,
value: 1,
groupValue: selectedType,
onChanged: (value) {
setSelectedType(value);
},
),
Text(TranslationBase.of(context).regular),
],
),
),
Row(
children: [
Container(
width: MediaQuery.of(context).size.width * 0.35,
child: AppTextFieldCustom(
validationError: strengthError,
hintText: TranslationBase.of(context).strength,
isTextFieldHasSuffix: false,
enabled: true,
controller: strengthController,
onChanged: (String value) {
setState(() {
strengthChar = value.length;
});
if (strengthChar >= 5) {
DrAppToastMsg.showErrorToast(
TranslationBase.of(context)
.only5DigitsAllowedForStrength,
);
}
},
inputType: TextInputType.numberWithOptions(
decimal: true,
),
),
),
SizedBox(
width: 5.0,
),
PrescriptionTextFiled(
width: MediaQuery.of(context).size.width * 0.510,
element:
widget.medicineViewModel.itemMedicineListUnit.length == 1
? widget.medicineViewModel.itemMedicineListUnit[0]
: units,
elementError: unitError,
keyName: 'description',
keyId: 'parameterCode',
hintText: TranslationBase.of(context).unit,
elementList: widget.medicineViewModel.itemMedicineListUnit,
okFunction: (selectedValue) {
setState(() {
units = selectedValue;
units['isDefault'] = true;
});
},
),
],
),
SizedBox(height: spaceBetweenTextFields),
PrescriptionTextFiled(
elementList: widget.medicineViewModel.itemMedicineListRoute,
element: widget.medicineViewModel.itemMedicineListRoute.length == 1
? route = widget.medicineViewModel.itemMedicineListRoute[0]
: route,
elementError: routeError,
keyId: 'parameterCode',
keyName: 'description',
okFunction: (selectedValue) {
setState(() {
route = selectedValue;
route['isDefault'] = true;
});
},
hintText: TranslationBase.of(context).route,
),
SizedBox(height: spaceBetweenTextFields),
PrescriptionTextFiled(
hintText: TranslationBase.of(context).frequency,
elementError: frequencyError,
// element: frequency,
element: widget.medicineViewModel.itemMedicineListRoute.length == 1
? frequency = widget.medicineViewModel.itemMedicineListRoute[0]
: frequency,
elementList: widget.medicineViewModel.itemMedicineList,
keyId: 'parameterCode',
keyName: 'description',
okFunction: (selectedValue) {
setState(() {
frequency = selectedValue;
frequency['isDefault'] = true;
if (widget.selectedMedication != null &&
duration != null &&
frequency != null &&
strengthController.text != null) {
widget.medicineViewModel.getBoxQuantity(
freq: frequency['parameterCode'],
duration: duration['id'],
itemCode: widget.selectedMedication.itemId,
strength: double.parse(strengthController.text));
return;
}
});
}),
SizedBox(height: spaceBetweenTextFields),
PrescriptionTextFiled(
hintText: TranslationBase.of(context).doseTime,
elementError: doseTimeError,
element: doseTime,
elementList: widget.medicineViewModel.medicationDoseTimeList,
keyId: 'id',
keyName: 'nameEn',
okFunction: (selectedValue) {
setState(() {
doseTime = selectedValue;
});
}),
SizedBox(height: spaceBetweenTextFields),
if (widget.medicineViewModel.patientAssessmentList.isNotEmpty)
Container(
height: screenSize.height * 0.070,
width: double.infinity,
color: Colors.white,
child: Row(
children: [
Container(
width: MediaQuery.of(context).size.width * 0.29,
child: AppTextFieldCustom(
hintText: widget
.medicineViewModel.patientAssessmentList[0].icdCode10ID
.toString(),
enabled: true,
),
),
Container(
width: MediaQuery.of(context).size.width * 0.57,
color: Colors.white,
child: AppTextFieldCustom(
maxLines: 5,
hintText: widget
.medicineViewModel.patientAssessmentList[0].asciiDesc
.toString(),
enabled: true,
),
),
],
),
),
SizedBox(height: spaceBetweenTextFields), Container(
color: Colors.transparent,
child: InkWell(
onTap: () => selectDate(context, widget.prescriptionViewModel),
child: AppTextFieldCustom(
validationError: strengthError,
hintText: TranslationBase.of(context).date,
isTextFieldHasSuffix: true,
suffixIcon: IconButton(
icon: Icon(
Icons.calendar_today,
color: Colors.black,
),
),
dropDownText: selectedDate != null
? "${AppDateUtils.convertStringToDateFormat(selectedDate.toString(), "yyyy-MM-dd")}"
: null,
enabled: false,
),
),
),
SizedBox(height: spaceBetweenTextFields),
PrescriptionTextFiled(
element: duration,
elementError: durationError,
hintText: TranslationBase.of(context).duration,
elementList: widget.medicineViewModel.medicationDurationList,
keyName: 'nameEn',
keyId: 'id',
okFunction: (selectedValue) {
setState(() {
duration = selectedValue;
if (widget.selectedMedication != null &&
duration != null &&
frequency != null &&
strengthController.text != null) {
box = widget.medicineViewModel.boxQuintity;
return;
}
});
},
),
SizedBox(height: spaceBetweenTextFields),
Container(
color: Colors.white,
child: AppTextFieldCustom(
hintText: "UOM",
isTextFieldHasSuffix: false,
dropDownText: uom != null ? uom : null,
enabled: false,
),
),
SizedBox(height: spaceBetweenTextFields),
Container(
color: Colors.white,
child: AppTextFieldCustom(
hintText: TranslationBase.of(context).boxQuantity,
isTextFieldHasSuffix: false,
dropDownText: box != null
? widget.medicineViewModel.boxQuintity.toString()
: null,
enabled: false,
),
),
SizedBox(height: spaceBetweenTextFields),
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(6.0)),
border: Border.all(width: 1.0, color: HexColor("#CCCCCC"))),
child: Stack(
children: [
TextFields(
maxLines: 6,
minLines: 4,
hintText: TranslationBase.of(context).instruction,
controller: instructionController,
),
Positioned(
top: 0,
right: 15,
child: IconButton(
icon: Icon(
DoctorApp.speechtotext,
color: Colors.black,
size: 35,
),
onPressed: () {
initSpeechState().then((value) => {onVoiceText()});
},
),
),
],
),
),
SizedBox(height: spaceBetweenTextFields),
Container(
margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5),
child: Wrap(
alignment: WrapAlignment.center,
children: <Widget>[
AppButton(
color: Color(0xff359846),
title: TranslationBase.of(context).addMedication,
fontWeight: FontWeight.w600,
onPressed: () async {
addMedicationButton(widget.medicineViewModel);
},
),
],
),
),
],
),
);
}
selectDate(BuildContext context, PrescriptionViewModel model) async {
Helpers.hideKeyboard(context);
DateTime selectedDate;
selectedDate = DateTime.now();
final DateTime picked = await showDatePicker(
context: context,
initialDate: selectedDate,
firstDate: DateTime.now(),
lastDate: DateTime(2040),
initialEntryMode: DatePickerEntryMode.calendar,
);
if (picked != null && picked != selectedDate) {
setState(() {
this.selectedDate = picked;
});
}
}
addMedicationButton(MedicineViewModel model) async {
await locator<AnalyticsService>().logEvent(
eventCategory: "Add Prescription Form",
eventAction: "Add Prescription",
);
if (duration != null &&
doseTime != null &&
frequency != null &&
selectedDate != null &&
strengthController.text != "") {
if (widget.selectedMedication.isNarcotic == true) {
DrAppToastMsg.showErrorToast(TranslationBase.of(context)
.narcoticMedicineCanOnlyBePrescribedFromVida);
Navigator.pop(context);
return;
}
if (double.parse(strengthController.text) > 1000.0) {
DrAppToastMsg.showErrorToast(TranslationBase.of(context).thousandIsTheMAXForTheStrength);
return;
}
if (double.parse(strengthController.text) < 0.0) {
DrAppToastMsg.showErrorToast(TranslationBase.of(context).strengthCanNotBeZero);
return;
}
if (formKey.currentState.validate()) {
Navigator.push(
context,
SlideUpPageRoute(
widget: AddDrugWidget(
patient: widget.patient,
medicineModel: widget.medicineViewModel,
modelPrescription: widget.prescriptionViewModel,
prescriptionList: widget.prescriptionList,
route: route,
doseTime: doseTime,
duration: duration,
frequency: frequency,
units: units,
uom: uom,
x: x,
selectedMedication: widget.selectedMedication,
strength: strengthController.text,
indication: indicationController.text,
instruction: instructionController.text,
selectedDate: selectedDate,
),
),
);
// Navigator.pop(context);
// openDrugToDrug(model, prescriptionViewModel);
}
} else {
setState(() {
if (duration == null) {
durationError = TranslationBase.of(context).fieldRequired;
} else {
durationError = null;
}
if (doseTime == null) {
doseTimeError = TranslationBase.of(context).fieldRequired;
} else {
doseTimeError = null;
}
if (route == null) {
routeError = TranslationBase.of(context).fieldRequired;
} else {
routeError = null;
}
if (frequency == null) {
frequencyError = TranslationBase.of(context).fieldRequired;
} else {
frequencyError = null;
}
if (units == null) {
unitError = TranslationBase.of(context).fieldRequired;
} else {
unitError = null;
}
if (strengthController.text == "") {
strengthError = TranslationBase.of(context).fieldRequired;
} else {
strengthError = null;
}
});
}
formKey.currentState.save();
}
}

@ -0,0 +1,137 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:hexcolor/hexcolor.dart';
import '../../../config/config.dart';
import '../../../core/model/search_drug/get_medication_response_model.dart';
import '../../../core/viewModel/medicine_view_model.dart';
import '../../../core/viewModel/prescription/prescription_view_model.dart';
import '../../../util/helpers.dart';
import '../../../util/translations_delegate_base.dart';
import '../../../widgets/medicine/medicine_item_widget.dart';
import '../../../widgets/shared/buttons/app_buttons_widget.dart';
import '../../../widgets/shared/loader/gif_loader_dialog_utils.dart';
import '../../../widgets/shared/network_base_view.dart';
import '../../../widgets/shared/text_fields/app_text_form_field.dart';
import '../../base/base_view.dart';
final myController = TextEditingController();
class SearchPrescriptionWidget extends StatelessWidget {
final double spaceBetweenTextFields;
final MedicineViewModel medicineViewModel;
final PrescriptionViewModel prescriptionViewModel;
final Function(GetMedicationResponseModel) onItemSelected;
const SearchPrescriptionWidget(
{Key key,
this.spaceBetweenTextFields,
this.medicineViewModel,
this.prescriptionViewModel,
this.onItemSelected})
: super(key: key);
@override
Widget build(BuildContext context) {
return BaseView<MedicineViewModel>(
onModelReady: (model) async {},
builder: (
BuildContext context,
MedicineViewModel model,
Widget child,
) =>
NetworkBaseView(
baseViewModel: model,
child: Column(
children: [
FractionallySizedBox(
widthFactor: 0.9,
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(6.0)),
border: Border.all(width: 1.0, color: HexColor("#CCCCCC"))),
padding: EdgeInsets.all(10),
child: AppTextFormField(
borderColor: Colors.white,
hintText: TranslationBase.of(context).searchMedicineNameHere,
controller: myController,
onSaved: (value) {},
onFieldSubmitted: (value) {
searchMedicine(context, model);
},
inputFormatter: ONLY_LETTERS,
),
),
),
SizedBox(
height: 15.0,
),
Container(
child: Column(
children: [
FractionallySizedBox(
widthFactor: 0.8,
child: Container(
child: Wrap(
alignment: WrapAlignment.center,
children: <Widget>[
AppButton(
title: TranslationBase.of(context).search,
onPressed: () async {
await searchMedicine(
context,
model,
);
},
),
],
),
),
),
if (myController.text != '')
Container(
height: MediaQuery.of(context).size.height * 0.5,
child: ListView.builder(
padding: const EdgeInsets.only(top: 20),
scrollDirection: Axis.vertical,
itemCount: model.allMedicationList == null
? 0
: model.allMedicationList.length,
itemBuilder: (BuildContext context, int index) {
return InkWell(
child: MedicineItemWidget(
label:
model.allMedicationList[index].description),
onTap: () async {
GifLoaderDialogUtils.showMyDialog(context);
await model.getItem(itemID: model.allMedicationList[index].itemId, isLocalBusy: true);
GifLoaderDialogUtils.hideDialog(context);
onItemSelected(model.allMedicationList[index]);
// uom = _selectedMedication.uom;
},
);
},
),
),
],
),
),
SizedBox(
height: spaceBetweenTextFields,
),
],
),
),
);
}
searchMedicine(context, MedicineViewModel model) async {
FocusScope.of(context).unfocus();
if (myController.text.length < 3) {
Helpers.showErrorToast(TranslationBase.of(context).moreThan3Letter);
return;
}
GifLoaderDialogUtils.showMyDialog(context);
await model.getMedicationList(drug: myController.text, isLocalBusy: true);
GifLoaderDialogUtils.hideDialog(context);
}
}

File diff suppressed because it is too large Load Diff

@ -0,0 +1,180 @@
import 'package:doctor_app_flutter/config/size_config.dart';
import 'package:doctor_app_flutter/core/viewModel/prescription/prescription_view_model.dart';
import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/screens/base/base_view.dart';
import 'package:doctor_app_flutter/screens/prescription/prescriptions_items/prescription_items_in_patient.dart';
import 'package:doctor_app_flutter/screens/prescription/prescriptions_items/prescription_items_out_patient.dart';
import 'package:doctor_app_flutter/screens/procedures/ProcedureType.dart';
import 'package:doctor_app_flutter/screens/procedures/base_add_procedure_tab_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/patient_service_title.dart';
import 'package:doctor_app_flutter/widgets/patients/profile/add-order/addNewOrder.dart';
import 'package:doctor_app_flutter/widgets/patients/profile/app_bar/patient-profile-app-bar.dart';
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/card_with_bg_widget.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/CusomRow.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/slide_up_page.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import '../../util/helpers.dart';
import '../../widgets/shared/errors/error_message.dart';
class NewPrescriptionsPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
final routeArgs = ModalRoute.of(context).settings.arguments as Map;
PatiantInformtion patient = routeArgs['patient'];
bool isInpatient = routeArgs['isInpatient'];
bool isFromLiveCare = routeArgs['isFromLiveCare'];
return BaseView<PrescriptionViewModel>(
onModelReady: (model) async {
model.getPrescriptionListNew(
mrn: patient.patientMRN, appNo: patient.appointmentNo);
},
builder: (_, model, w) => AppScaffold(
baseViewModel: model,
isShowAppBar: true,
backgroundColor: Colors.grey[100],
appBar: PatientProfileAppBar(
patient,
isInpatient: isInpatient,
),
body: FractionallySizedBox(
widthFactor: 1.0,
child: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
SizedBox(
height: 12,
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
ServiceTitle(
title: TranslationBase.of(context).orders,
subTitle: TranslationBase.of(context).prescriptions,
),
],
),
),
if ((patient.patientStatusType != null &&
patient.patientStatusType == 43) ||
(isFromLiveCare && patient.appointmentNo != null))
AddNewOrder(
onTap: () {
Navigator.push(
context,
SlideUpPageRoute(
widget: BaseAddProcedureTabPage(
patient: patient,
prescriptionModel: model,
procedureType: ProcedureType.PRESCRIPTION,
),
settingRoute: 'AddProcedureTabPage'),
);
},
label: TranslationBase.of(context)
.applyForNewPrescriptionsOrder,
),
Center(
child: FractionallySizedBox(
widthFactor: 0.92,
child: ListView.builder(
physics: BouncingScrollPhysics(),
itemCount: model.prescriptionListNew.length,
shrinkWrap: true,
itemBuilder: (BuildContext ctxt, int index) {
return InkWell(
child: CardWithBgWidget(
bgColor: Colors.transparent,
widget: Column(
children: [
CustomRow(
label: "",
value: Helpers.convertToTitleCase(model
.prescriptionListNew[index]
.medicationName),
valueSize: SizeConfig
.getTextMultiplierBasedOnWidth() *
3.5,
),
SizedBox(
height: 10,
),
CustomRow(
label: "Doctor Name :",
value: model
.prescriptionListNew[index].doctorName,
),
CustomRow(
label: "Order Type Description :",
value: model.prescriptionListNew[index]
.orderTypeDescription,
),
CustomRow(
label: "status :",
value:
model.prescriptionListNew[index].status,
),
CustomRow(
label: "indication :",
value: model
.prescriptionListNew[index].indication,
),
CustomRow(
label: "doseDetail :",
value: model
.prescriptionListNew[index].doseDetail,
),
CustomRow(
label: "quantity :",
value: model
.prescriptionListNew[index].quantity
.toString(),
),CustomRow(
label: "start Date :",
value: model
.prescriptionListNew[index].startDate
.toString(),
),CustomRow(
label: "stop Date :",
value: model
.prescriptionListNew[index].stopDate
.toString(),
),
if(model
.prescriptionListNew[index].remarks != null&& model
.prescriptionListNew[index].remarks!= "")
CustomRow(
label: "Remark :",
value: model
.prescriptionListNew[index].remarks
.toString(),
),
],
),
),);
}),
),
),
if (model.prescriptionListNew.isEmpty &&
patient.patientStatusType != 43)
Center(
child: ErrorMessage(
error: TranslationBase.of(context).noPrescriptionsFound,
))
],
),
),
)),
);
}
}

@ -0,0 +1,234 @@
import 'package:doctor_app_flutter/config/size_config.dart';
import 'package:doctor_app_flutter/core/viewModel/prescription/prescription_view_model.dart';
import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/screens/base/base_view.dart';
import 'package:doctor_app_flutter/screens/prescription/prescriptions_items/prescription_items_in_patient.dart';
import 'package:doctor_app_flutter/screens/prescription/prescriptions_items/prescription_items_out_patient.dart';
import 'package:doctor_app_flutter/screens/procedures/ProcedureType.dart';
import 'package:doctor_app_flutter/screens/procedures/base_add_procedure_tab_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/patient_service_title.dart';
import 'package:doctor_app_flutter/widgets/patients/profile/add-order/addNewOrder.dart';
import 'package:doctor_app_flutter/widgets/patients/profile/app_bar/patient-profile-app-bar.dart';
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/card_with_bg_widget.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/CusomRow.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/slide_up_page.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import '../../util/helpers.dart';
import '../../widgets/shared/errors/error_message.dart';
class OldPrescriptionsPage extends StatelessWidget {
@override
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'];
bool isInpatient = routeArgs['isInpatient'];
bool isFromLiveCare = routeArgs['isFromLiveCare'];
return BaseView<PrescriptionViewModel>(
onModelReady: (model) async {
patient.admissionNo == null
? model.getPrescriptions(patient,
patientType: patientType, isLocalBusy: false)
: model.getMedicationForInPatient(patient);
},
builder: (_, model, w) => AppScaffold(
baseViewModel: model,
isShowAppBar: true,
backgroundColor: Colors.grey[100],
appBar: PatientProfileAppBar(
patient,
isInpatient: isInpatient,
),
body: patient.admissionNo == null
? FractionallySizedBox(
widthFactor: 1.0,
child: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
SizedBox(
height: 12,
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
ServiceTitle(
title: TranslationBase.of(context).orders,
subTitle: TranslationBase.of(context)
.prescriptions + "(${TranslationBase.of(context)
.old }) ",
),
],
),
),
ListView.builder(
physics: BouncingScrollPhysics(),
itemCount: model.prescriptionsList.length,
shrinkWrap: true,
itemBuilder: (BuildContext ctxt, int index) {
return InkWell(
onTap: () => Navigator.push(
context,
FadePage(
page: PrescriptionItemsPage(
prescriptions: model
.prescriptionsList[index],
patient: patient,
arrivalType: arrivalType,
),
),
),
child: Column(
children: [
DoctorCard(
doctorName:
Helpers.convertToTitleCase(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: ErrorMessage(
error: TranslationBase.of(context)
.noPrescriptionsFound,
))
],
),
),
)
: Center(
child: FractionallySizedBox(
widthFactor: 0.9,
child: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
SizedBox(
height: 12,
),
ServiceTitle(
title: TranslationBase.of(context).orders,
subTitle: TranslationBase.of(context)
.prescriptions + "(${TranslationBase.of(context)
.old }) ",
),
model.medicationForInPatient.length == 0?
Center(
child: ErrorMessage(
error: TranslationBase.of(context)
.noPrescriptionsFound,
)): ListView.builder(
scrollDirection: Axis.vertical,
physics: NeverScrollableScrollPhysics(),
shrinkWrap: true,
itemCount: model.medicationForInPatient.length,
itemBuilder: (context, index) {
//model.medicationForInPatient.length,
return InkWell(
child: CardWithBgWidget(
bgColor: Colors.transparent,
widget: Column(
children: [
CustomRow(
label: "",
value: Helpers.convertToTitleCase(model
.medicationForInPatient[index]
.pHRItemDescription),
valueSize: SizeConfig
.getTextMultiplierBasedOnWidth() *
3.5,
),
SizedBox(
height: 10,
),
CustomRow(
label: "Doctor Name :",
value: Helpers.convertToTitleCase(model
.medicationForInPatient[index]
.doctorName
.toString()),
),
CustomRow(
label: "Status :",
value: Helpers.convertToTitleCase(model
.medicationForInPatient[index]
.statusDescription
.toString()),
),
CustomRow(
label: "dose :",
value: Helpers.convertToTitleCase(model
.medicationForInPatient[index]
.dose
.toString()),
), CustomRow(
label: "comments :",
value: Helpers.convertToTitleCase(model
.medicationForInPatient[index]
.comments
.toString()),
),
],
),
),
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,
),
),
),
),
);
}),
],
),
),
),
)));
}
}

@ -8,7 +8,7 @@ import 'package:doctor_app_flutter/core/model/procedure/procedure_template_detai
import 'package:doctor_app_flutter/core/model/search_drug/get_medication_response_model.dart';
import 'package:doctor_app_flutter/core/provider/robot_provider.dart';
import 'package:doctor_app_flutter/core/viewModel/medicine_view_model.dart';
import 'package:doctor_app_flutter/core/viewModel/prescription_view_model.dart';
import 'package:doctor_app_flutter/core/viewModel/prescription/prescription_view_model.dart';
import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart';
import 'package:doctor_app_flutter/core/model/SOAP/GetAssessmentReqModel.dart';
import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart';
@ -97,7 +97,7 @@ class _PrescriptionCheckOutScreenState
Helpers.showErrorToast(model.error);
} else if (model.state == ViewState.Idle) {
model.getPrescriptions(patient);
DrAppToastMsg.showSuccesToast('Medication has been added');
DrAppToastMsg.showSuccesToast(TranslationBase.of(context).medicationHasBeenAdded);
}
}
@ -114,8 +114,8 @@ class _PrescriptionCheckOutScreenState
TextEditingController indicationController = TextEditingController();
TextEditingController instructionController = TextEditingController();
bool visbiltyPrescriptionForm = true;
bool visbiltySearch = true;
bool visibilityPrescriptionForm = true;
bool visibilitySearch = true;
final myController = TextEditingController();
DateTime selectedDate;
@ -129,10 +129,10 @@ class _PrescriptionCheckOutScreenState
final searchController = TextEditingController();
stt.SpeechToText speech = stt.SpeechToText();
var event = RobotProvider();
var reconizedWord;
var recognizedWord;
final GlobalKey<FormState> formKey = GlobalKey<FormState>();
final double spaceBetweenTextFileds = 12;
final double spaceBetweenTextFields = 12;
dynamic route;
dynamic frequency;
dynamic duration;
@ -179,7 +179,7 @@ class _PrescriptionCheckOutScreenState
}
void statusListener(String status) {
reconizedWord = status == 'listening' ? 'Lisening...' : 'Sorry....';
recognizedWord = status == 'listening' ? 'Listening...' : 'Sorry....';
}
void requestPermissions() async {
@ -189,14 +189,14 @@ class _PrescriptionCheckOutScreenState
}
void resultListener(result) {
reconizedWord = result.recognizedWords;
event.setValue({"searchText": reconizedWord});
recognizedWord = result.recognizedWords;
event.setValue({"searchText": recognizedWord});
if (result.finalResult == true) {
setState(() {
SpeechToText.closeAlertDialog(context);
speech.stop();
instructionController.text += reconizedWord + '\n';
instructionController.text += recognizedWord + '\n';
});
} else {
print(result.finalResult);
@ -221,6 +221,7 @@ class _PrescriptionCheckOutScreenState
final screenSize = MediaQuery.of(context).size;
return BaseView<MedicineViewModel>(
onModelReady: (model) async {
// TODO Elham* move this logic to the model
model.getItem(
itemID: int.parse(
widget.groupProcedures.aliasN.replaceAll("item code ;", "")));
@ -299,7 +300,7 @@ class _PrescriptionCheckOutScreenState
],
),
SizedBox(
height: spaceBetweenTextFileds,
height: spaceBetweenTextFields,
),
Container(
child: Form(
@ -316,10 +317,10 @@ class _PrescriptionCheckOutScreenState
),
),
SizedBox(
height: spaceBetweenTextFileds,
height: spaceBetweenTextFields,
),
Visibility(
visible: visbiltyPrescriptionForm,
visible: visibilityPrescriptionForm,
child: Container(
child: Column(
children: [
@ -337,7 +338,7 @@ class _PrescriptionCheckOutScreenState
fontWeight: FontWeight.w600,
),
Radio(
activeColor: Color(0xFFB9382C),
activeColor: AppGlobal.appRedColor,
value: 1,
groupValue: selectedType,
onChanged: (value) {
@ -349,7 +350,7 @@ class _PrescriptionCheckOutScreenState
],
),
),
SizedBox(height: spaceBetweenTextFileds),
SizedBox(height: spaceBetweenTextFields),
Container(
width: double.infinity,
child: Row(
@ -362,7 +363,7 @@ class _PrescriptionCheckOutScreenState
child: AppTextFieldCustom(
height: 40,
validationError: strengthError,
hintText: 'Strength',
hintText: TranslationBase.of(context).strength,
isTextFieldHasSuffix: false,
enabled: true,
controller: strengthController,
@ -410,7 +411,7 @@ class _PrescriptionCheckOutScreenState
],
),
),
SizedBox(height: spaceBetweenTextFileds),
SizedBox(height: spaceBetweenTextFields),
PrescriptionTextFiled(
elementList:
model.itemMedicineListRoute,
@ -427,7 +428,7 @@ class _PrescriptionCheckOutScreenState
hintText:
TranslationBase.of(context).route,
),
SizedBox(height: spaceBetweenTextFileds),
SizedBox(height: spaceBetweenTextFields),
PrescriptionTextFiled(
hintText: TranslationBase.of(context)
.frequency,
@ -460,7 +461,7 @@ class _PrescriptionCheckOutScreenState
}
});
}),
SizedBox(height: spaceBetweenTextFileds),
SizedBox(height: spaceBetweenTextFields),
PrescriptionTextFiled(
hintText: TranslationBase.of(context)
.doseTime,
@ -475,7 +476,7 @@ class _PrescriptionCheckOutScreenState
doseTime = selectedValue;
});
}),
SizedBox(height: spaceBetweenTextFileds),
SizedBox(height: spaceBetweenTextFields),
if (model
.patientAssessmentList.isNotEmpty)
Container(
@ -533,7 +534,7 @@ class _PrescriptionCheckOutScreenState
],
),
),
SizedBox(height: spaceBetweenTextFileds),
SizedBox(height: spaceBetweenTextFields),
Container(
height: screenSize.height * 0.070,
color: Colors.white,
@ -556,7 +557,7 @@ class _PrescriptionCheckOutScreenState
),
),
),
SizedBox(height: spaceBetweenTextFileds),
SizedBox(height: spaceBetweenTextFields),
PrescriptionTextFiled(
element: duration,
elementError: durationError,
@ -590,9 +591,9 @@ class _PrescriptionCheckOutScreenState
});
},
),
SizedBox(height: spaceBetweenTextFileds),
SizedBox(height: spaceBetweenTextFileds),
SizedBox(height: spaceBetweenTextFileds),
SizedBox(height: spaceBetweenTextFields),
SizedBox(height: spaceBetweenTextFields),
SizedBox(height: spaceBetweenTextFields),
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.all(
@ -630,7 +631,7 @@ class _PrescriptionCheckOutScreenState
],
),
),
SizedBox(height: spaceBetweenTextFileds),
SizedBox(height: spaceBetweenTextFields),
Container(
margin: EdgeInsets.all(
SizeConfig.widthMultiplier * 5),
@ -638,7 +639,7 @@ class _PrescriptionCheckOutScreenState
alignment: WrapAlignment.center,
children: <Widget>[
AppButton(
color: Color(0xff359846),
color: AppGlobal.appGreenColor,
title: TranslationBase.of(context)
.addMedication,
fontWeight: FontWeight.w600,
@ -651,19 +652,12 @@ class _PrescriptionCheckOutScreenState
selectedDate != null &&
strengthController.text !=
"") {
// if (_selectedMedication.isNarcotic == true) {
// DrAppToastMsg.showErrorToast(TranslationBase.of(context)
// .narcoticMedicineCanOnlyBePrescribedFromVida);
// Navigator.pop(context);
// return;
// }
if (double.parse(
strengthController
.text) >
1000.0) {
DrAppToastMsg.showErrorToast(
"1000 is the MAX for the strength");
TranslationBase.of(context).thousandIsTheMAXForTheStrength,);
return;
}
if (double.parse(
@ -671,14 +665,12 @@ class _PrescriptionCheckOutScreenState
.text) <
0.0) {
DrAppToastMsg.showErrorToast(
"strength can't be zero");
TranslationBase.of(context).strengthCanNotBeZero,);
return;
}
if (formKey.currentState
.validate()) {
Navigator.pop(context);
// openDrugToDrug(model);
{
postPrescription(
icdCode: model
@ -696,13 +688,6 @@ class _PrescriptionCheckOutScreenState
.icdCode10ID
.toString()
: "test",
// icdCode: model
// .patientAssessmentList
// .map((value) => value
// .icdCode10ID
// .trim())
// .toList()
// .join(' '),
dose: strengthController
.text,
doseUnit: model

@ -1,168 +0,0 @@
import 'package:doctor_app_flutter/core/model/Prescriptions/prescription_report.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.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:flutter/cupertino.dart';
import 'package:flutter/material.dart';
class PrescriptionDetailsPage extends StatelessWidget {
final PrescriptionReport prescriptionReport;
PrescriptionDetailsPage({Key key, this.prescriptionReport});
@override
Widget build(BuildContext context) {
return AppScaffold(
isShowAppBar: true,
appBarTitle: TranslationBase.of(context).prescriptions,
body: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Container(
width: double.infinity,
margin: EdgeInsets.only(top: 10, left: 10, right: 10),
padding: EdgeInsets.all(8.0),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(
Radius.circular(10.0),
),
border: Border.all(color: Colors.grey[200], width: 0.5),
),
child: Row(
children: <Widget>[
ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(5)),
child: Image.network(
prescriptionReport.imageSRCUrl,
fit: BoxFit.cover,
width: 60,
height: 70,
),
),
Expanded(
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Center(
child: AppText(
prescriptionReport.itemDescription.isNotEmpty
? prescriptionReport.itemDescription
: prescriptionReport.itemDescriptionN),
),
),
)
],
),
),
Container(
color: Colors.white,
margin: EdgeInsets.only(top: 10, left: 10, right: 10),
child: Table(
border: TableBorder.symmetric(
inside: BorderSide(width: 0.5),
outside: BorderSide(width: 0.5)),
children: [
TableRow(
children: [
Container(
color: Colors.white,
height: 30,
width: double.infinity,
child: Center(
child: AppText(
TranslationBase.of(context).route,
fontSize: 14,
))),
Container(
color: Colors.white,
height: 30,
width: double.infinity,
child: Center(
child: AppText(
TranslationBase.of(context).frequency,
fontSize: 14,
))),
Container(
color: Colors.white,
width: double.infinity,
padding: EdgeInsets.symmetric(horizontal: 4),
child: Center(
child: AppText(
"${TranslationBase.of(context).dailyDoses}",
fontSize: 14,
))),
Container(
color: Colors.white,
height: 30,
width: double.infinity,
child: Center(
child: AppText(
TranslationBase.of(context).duration,
fontSize: 14,
))),
],
),
TableRow(
children: [
Container(
color: Colors.white,
height: 50,
width: double.infinity,
child:
Center(child: Text(prescriptionReport.routeN))),
Container(
color: Colors.white,
height: 50,
width: double.infinity,
child: Center(
child:
Text(prescriptionReport.frequencyN ?? ''))),
Container(
color: Colors.white,
height: 50,
width: double.infinity,
child: Center(
child: Text(
'${prescriptionReport.doseDailyQuantity}'))),
Container(
color: Colors.white,
height: 50,
width: double.infinity,
child:
Center(child: Text('${prescriptionReport.days}')))
],
),
],
),
),
Container(
margin: EdgeInsets.only(top: 10, left: 10, right: 10),
width: double.infinity,
color: Colors.white,
padding: EdgeInsets.all(5),
child: Center(
child: Column(
children: <Widget>[
AppText(TranslationBase.of(context).notes),
SizedBox(
height: 5,
),
Divider(
height: 0.5,
color: Colors.grey[300],
),
SizedBox(
height: 5,
),
AppText(prescriptionReport.remarks ?? ''),
],
),
),
)
],
),
),
);
}
}

@ -1,235 +0,0 @@
import 'package:doctor_app_flutter/core/model/Prescriptions/get_medication_for_inpatient_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/model/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/screens/base/base_view.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/app_bar/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:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
class PrescriptionItemsInPatientPage extends StatelessWidget {
final GetMedicationForInPatientModel 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.medicationForInPatient.length == 0) {
await model.getMedicationForInPatient(patient);
}
},
builder: (_, model, widget) => AppScaffold(
isShowAppBar: true,
backgroundColor: Colors.grey[100],
baseViewModel: model,
appBar: PatientProfileAppBar(patient),
body: SingleChildScrollView(
child: Container(
child: Column(
children: [
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(
prescriptions.pHRItemDescription,
bold: true,
),
),
SizedBox(
height: 12,
),
Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
SizedBox(
width: 18,
),
SizedBox(
width: 10,
),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
AppText(
TranslationBase.of(context).direction,
color: Colors.grey,
),
Expanded(
child: AppText(" " +
prescriptions
.directionDescription
.toString() ??
'')),
],
),
Row(
children: [
AppText(
TranslationBase.of(context).route,
color: Colors.grey,
),
AppText(" " +
prescriptions.routeDescription
.toString() ??
''),
],
),
Row(
children: [
AppText(
TranslationBase.of(context).refill,
color: Colors.grey,
),
Expanded(
child: AppText(" " +
prescriptions
.refillDescription
.toString() ??
'')),
],
),
Row(
children: [
AppText(
TranslationBase.of(context).startDate,
color: Colors.grey,
),
Expanded(
child: AppText(
'${AppDateUtils.getDayMonthYearDateFormatted(startOn, isArabic: projectViewModel.isArabic)}',
color: Colors.black,
fontWeight: FontWeight.w600,
fontSize: 14,
),
),
],
),
Row(
children: [
AppText(
TranslationBase.of(context).stopDate,
color: Colors.grey,
),
Expanded(
child: AppText(
'${AppDateUtils.getDayMonthYearDateFormatted(stopOn, isArabic: projectViewModel.isArabic)}',
color: Colors.black,
fontWeight: FontWeight.w600,
fontSize: 14,
),
),
],
),
Row(
children: [
AppText(
'UOM',
color: Colors.grey,
),
AppText(" " +
prescriptions.uomDescription
.toString() ??
''),
],
),
Row(
children: [
AppText(
TranslationBase.of(context).dailyDoses,
color: Colors.grey,
),
AppText(
" " + prescriptions.dose.toString() ??
''),
],
),
Row(
children: [
AppText(
TranslationBase.of(context).status,
color: Colors.grey,
),
AppText(" " +
prescriptions.statusDescription
.toString() ??
''),
],
),
Row(
children: [
AppText(
TranslationBase.of(context).processed,
color: Colors.grey,
),
AppText(" " +
prescriptions.doctorName
.toString() ??
''),
],
),
// Row(
// children: [
// AppText(
// TranslationBase.of(context).num,
// color: Colors.grey,
// ),
// AppText(" " + prescriptions.dose.toString() ?? ''),
// ],
// ),
SizedBox(
height: 12,
),
AppText(prescriptions.comments ?? ''),
],
),
)
],
)
],
),
),
),
],
),
),
),
),
);
}
}

@ -1,373 +0,0 @@
import 'package:doctor_app_flutter/core/model/Prescriptions/Prescriptions.dart';
import 'package:doctor_app_flutter/core/viewModel/prescriptions_view_model.dart';
import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/screens/base/base_view.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/app_bar/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/dialogs/ShowImageDialog.dart';
import 'package:eva_icons_flutter/eva_icons_flutter.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
class PrescriptionItemsPage extends StatelessWidget {
final Prescriptions prescriptions;
final PatiantInformtion patient;
final String patientType;
final String arrivalType;
PrescriptionItemsPage(
{Key key,
this.prescriptions,
this.patient,
this.patientType,
this.arrivalType});
@override
Widget build(BuildContext context) {
return BaseView<PrescriptionsViewModel>(
onModelReady: (model) => model.getPrescriptionReport(
prescriptions: prescriptions, patient: patient),
builder: (_, model, widget) => AppScaffold(
isShowAppBar: true,
backgroundColor: Colors.grey[100],
baseViewModel: model,
appBar: PatientProfileAppBar(
patient,
clinic: prescriptions.clinicDescription,
branch: prescriptions.name,
isPrescriptions: true,
appointmentDate: AppDateUtils.getDateTimeFromServerFormat(
prescriptions.appointmentDate),
doctorName: prescriptions.doctorName,
profileUrl: prescriptions.doctorImageURL,
isAppointmentHeader: true,
),
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,
builder: (ctx) =>
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
...List.generate(
model.prescriptionReportEnhList.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.prescriptionReportEnhList[index]
.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,
builder: (ctx) => ShowImageDialog(
imageUrl: model
.prescriptionReportEnhList[
index]
.imageSRCUrl,
));
},
child: Stack(
children: [
Padding(
padding: const EdgeInsets.all(8.0),
child: Image.network(
model
.prescriptionReportEnhList[
index]
.imageSRCUrl,
fit: BoxFit.cover,
),
),
Positioned(
top: 10,
right: 10,
child: Icon(
EvaIcons.search,
color: Colors.grey,
size: 35,
))
],
),
),
),
SizedBox(
width: 10,
),
Expanded(
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Row(
children: [
AppText(
TranslationBase.of(context).route,
color: Colors.grey,
),
Expanded(
child: AppText(" " +
model
.prescriptionReportEnhList[
index]
.route ??
'')),
],
),
Row(
children: [
AppText(
TranslationBase.of(context)
.frequency,
color: Colors.grey,
),
AppText(" " +
model
.prescriptionReportEnhList[
index]
.frequency ??
''),
],
),
Row(
children: [
AppText(
TranslationBase.of(context)
.dailyDoses,
color: Colors.grey,
),
AppText(" " +
model
.prescriptionReportEnhList[
index]
.doseDailyQuantity
.toString() ??
''),
],
),
Row(
children: [
AppText(
TranslationBase.of(context)
.duration,
color: Colors.grey,
),
AppText(" " +
model
.prescriptionReportList[
index]
.days
.toString() ??
''),
],
),
SizedBox(
height: 12,
),
AppText(model
.prescriptionReportEnhList[index]
.remarks ??
''),
],
),
)
],
)
],
),
),
),
),
],
),
),
),
),
);
}
}

@ -1,168 +0,0 @@
import 'package:doctor_app_flutter/config/config.dart';
import 'package:doctor_app_flutter/config/size_config.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:doctor_app_flutter/widgets/shared/text_fields/app_text_form_field.dart';
import 'package:flutter/material.dart';
import 'package:hexcolor/hexcolor.dart';
void prescriptionWarning(context) {
showModalBottomSheet(
context: context,
isScrollControlled: true,
builder: (BuildContext bc) {
return SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.all(12.0),
child: Container(
height: 600,
child: Column(
children: [
...List.generate(
5,
(index) => Container(
child: ExpansionTile(
title: AppText('Prescription warning and alerts(0)'),
children: [
Column(
mainAxisAlignment: MainAxisAlignment.start,
children: [
AppText(
'DOSESCREENINGRESULTFORETCETC',
color: Color(0XFFB8382C),
)
],
)
],
),
),
),
SizedBox(
height: 10.0,
),
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(6.0)),
border:
Border.all(width: 1.0, color: HexColor("#CCCCCC"))),
child: AppTextFormField(
labelText: 'Remarks',
borderColor: Colors.white,
textInputType: TextInputType.number,
inputFormatter: ONLY_NUMBERS,
),
),
SizedBox(
height: 95.0,
),
Container(
margin: EdgeInsets.all(SizeConfig.widthMultiplier * 2),
child: Wrap(
alignment: WrapAlignment.center,
children: <Widget>[
AppButton(
title: 'CONTINUE',
onPressed: () {
Navigator.pop(context);
authorizationForm(context);
},
),
],
),
),
Container(
margin: EdgeInsets.all(SizeConfig.widthMultiplier * 2),
child: Wrap(
alignment: WrapAlignment.center,
children: <Widget>[
AppButton(
color: Colors.white,
title: 'remove',
fontColor: Colors.red,
onPressed: () {
Navigator.pop(context);
prescriptionWarning(context);
},
),
],
),
),
],
),
),
));
});
}
void authorizationForm(context) {
showModalBottomSheet(
context: context,
isScrollControlled: true,
builder: (BuildContext bc) {
return Container(
height: 500,
child: Form(
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 20.0, vertical: 10.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
AppText(
'Prescription authorization'.toUpperCase(),
fontWeight: FontWeight.w900,
),
SizedBox(
height: 30.0,
),
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(6.0)),
border: Border.all(
width: 1.0, color: HexColor("#CCCCCC"))),
child: AppTextFormField(
labelText: 'Auth ID',
borderColor: Colors.white,
textInputType: TextInputType.number,
inputFormatter: ONLY_NUMBERS,
),
),
SizedBox(
height: 12.0,
),
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(6.0)),
border: Border.all(
width: 1.0, color: HexColor("#CCCCCC"))),
child: AppTextFormField(
labelText: 'Password',
borderColor: Colors.white,
textInputType: TextInputType.text,
inputFormatter: ONLY_LETTERS,
obscureText: true,
),
),
SizedBox(
height: 190.0,
),
Container(
margin: EdgeInsets.all(SizeConfig.widthMultiplier * 2),
child: Wrap(
alignment: WrapAlignment.center,
children: <Widget>[
AppButton(
title: 'CONTINUE',
onPressed: () {
Navigator.pop(context);
authorizationForm(context);
},
),
],
),
),
],
),
),
));
});
}

@ -0,0 +1,157 @@
import 'package:doctor_app_flutter/core/viewModel/prescription/prescription_view_model.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/user-guid/CusomRow.dart';
import 'package:eva_icons_flutter/eva_icons_flutter.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import '../../../widgets/shared/dialogs/ShowImageDialog.dart';
class PrescriptionItemsWidget extends StatelessWidget {
final String itemDescription;
final String route;
final String frequency;
final int dailyDoses;
final String imageSRCUrl;
final String remarks;
final int days;
final PrescriptionViewModel prescriptionViewModel;
PrescriptionItemsWidget(
{this.itemDescription,
this.route,
this.frequency,
this.dailyDoses,
this.imageSRCUrl,
this.remarks,
this.days, this.prescriptionViewModel,
});
@override
Widget build(BuildContext context) {
return Column(
children: [
...List.generate(
// TODO Elham* List.generate to list.builder
prescriptionViewModel.prescriptionReportEnhList.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(
prescriptionViewModel.prescriptionReportEnhList[index].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,
builder: (ctx) => ShowImageDialog(
imageUrl: prescriptionViewModel.prescriptionReportEnhList[index].imageSRCUrl,
));
},
child: Stack(
children: [
Padding(
padding: const EdgeInsets.all(8.0),
child: Image.network(
prescriptionViewModel.prescriptionReportEnhList[index].imageSRCUrl,
fit: BoxFit.cover,
),
),
Positioned(
top: 10,
right: 10,
child: Icon(
EvaIcons.search,
color: Colors.grey,
size: 35,
))
],
),
),
),
SizedBox(
width: 10,
),
Expanded(
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
CustomRow(
label: TranslationBase.of(context).route + ' : ',
value: " " + prescriptionViewModel.prescriptionReportEnhList[index].route ?? '',
labelSize: 13,
valueSize: 13,
),
CustomRow(
label: TranslationBase.of(context).frequency + ' : ',
value: " " + prescriptionViewModel.prescriptionReportEnhList[index].frequency ?? '',
labelSize: 13,
valueSize: 13,
),
CustomRow(
label: TranslationBase.of(context).dailyDoses + ' : ',
value: " " + prescriptionViewModel.prescriptionReportEnhList[index].doseDailyQuantity.toString() ?? '',
labelSize: 13,
valueSize: 13,
),
CustomRow(
label: TranslationBase.of(context).duration + ' : ',
value: " " + prescriptionViewModel.prescriptionReportList[index].days.toString() ?? '',
labelSize: 13,
valueSize: 13,
),
SizedBox(
height: 12,
),
CustomRow(
label: '',
value: prescriptionViewModel.prescriptionReportList[index].remarks ?? '',
valueSize: 14,
),
],
),
)
],
)
],
),
),
),
),
],
);
}
}

@ -0,0 +1,187 @@
import 'package:doctor_app_flutter/core/model/Prescriptions/get_medication_for_inpatient_model.dart';
import 'package:doctor_app_flutter/core/viewModel/prescription/prescription_view_model.dart';
import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart';
import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/screens/base/base_view.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/app_bar/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/user-guid/CusomRow.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
class PrescriptionItemsInPatientPage extends StatelessWidget {
final GetMedicationForInPatientModel 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.medicationForInPatient.length == 0) {
await model.getMedicationForInPatient(patient);
}
},
builder: (_, model, widget) => AppScaffold(
isShowAppBar: true,
backgroundColor: Colors.grey[100],
baseViewModel: model,
appBar: PatientProfileAppBar(patient),
body: SingleChildScrollView(
child: Container(
child: Column(
children: [
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(
prescriptions.pHRItemDescription,
bold: true,
),
),
SizedBox(
height: 12,
),
Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
SizedBox(
width: 18,
),
SizedBox(
width: 10,
),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
CustomRow(
label: TranslationBase.of(context).direction + ' :',
value: " " + prescriptions.directionDescription.toString() ?? '',
isCopyable: false,
isExpanded: false,
valueSize: 13,
labelSize: 13,
),
CustomRow(
label: TranslationBase.of(context).route + ' :',
value: " " + prescriptions.routeDescription ?? '',
isCopyable: false,
isExpanded: false,
valueSize: 13,
labelSize: 13,
),
CustomRow(
label: TranslationBase.of(context).refill + ' :',
value: " " + prescriptions.refillDescription ?? '',
isCopyable: false,
isExpanded: false,
valueSize: 13,
labelSize: 13,
),
CustomRow(
label: TranslationBase.of(context).startDate + ' :',
value: " " + AppDateUtils.getDayMonthYearDateFormatted(startOn, isArabic: projectViewModel.isArabic) ?? '',
isCopyable: false,
isExpanded: false,
valueSize: 13,
labelSize: 13,
),
CustomRow(
label: TranslationBase.of(context).stopDate + ' :',
value: " " + AppDateUtils.getDayMonthYearDateFormatted(stopOn, isArabic: projectViewModel.isArabic) ?? '',
isCopyable: false,
isExpanded: false,
valueSize: 13,
labelSize: 13,
),
CustomRow(
label: 'UOM' + ' :',
value: " " + prescriptions.uomDescription.toString() ?? '',
isCopyable: false,
isExpanded: false,
valueSize: 13,
labelSize: 13,
),
CustomRow(
label: TranslationBase.of(context).dailyDoses,
value: " " + prescriptions.dose.toString() ?? '',
isCopyable: false,
isExpanded: false,
valueSize: 13,
labelSize: 13,
),
CustomRow(
label: TranslationBase.of(context).status,
value: " " + prescriptions.statusDescription.toString() ?? '',
isCopyable: false,
isExpanded: false,
valueSize: 13,
labelSize: 13,
),
CustomRow(
label: TranslationBase.of(context).processed,
value: " " + prescriptions.doctorName.toString() ?? '',
isCopyable: false,
isExpanded: false,
valueSize: 13,
labelSize: 13,
),
SizedBox(
height: 12,
),
CustomRow(
label: '',
value: prescriptions.comments ?? '',
isCopyable: false,
isExpanded: false,
valueSize: 13,
labelSize: 13,
),
],
),
)
],
)
],
),
),
),
],
),
),
),
),
);
}
}

@ -0,0 +1,74 @@
import 'package:doctor_app_flutter/core/model/Prescriptions/Prescriptions.dart';
import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/core/viewModel/prescription/prescription_view_model.dart';
import 'package:doctor_app_flutter/screens/base/base_view.dart';
import 'package:doctor_app_flutter/screens/prescription/prescriptions_items/preacription_items_widget.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/app_bar/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/dialogs/ShowImageDialog.dart';
import 'package:eva_icons_flutter/eva_icons_flutter.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
class PrescriptionItemsPage extends StatelessWidget {
final Prescriptions prescriptions;
final PatiantInformtion patient;
final String arrivalType;
PrescriptionItemsPage(
{Key key,
this.prescriptions,
this.patient,
this.arrivalType});
@override
Widget build(BuildContext context) {
return BaseView<PrescriptionViewModel>(
onModelReady: (model) => model.getPrescriptionReport(
prescriptions: prescriptions, patient: patient),
builder: (_, model, widget) => AppScaffold(
isShowAppBar: true,
backgroundColor: Colors.grey[100],
baseViewModel: model,
appBar: PatientProfileAppBar(
patient,
clinic: prescriptions.clinicDescription,
branch: prescriptions.name,
isPrescriptions: true,
appointmentDate: AppDateUtils.getDateTimeFromServerFormat(
prescriptions.appointmentDate),
doctorName: prescriptions.doctorName,
profileUrl: prescriptions.doctorImageURL,
isAppointmentHeader: true,
),
body: SingleChildScrollView(
child: Container(
child: Column(
children: [
ListView.builder(
scrollDirection: Axis.vertical,
physics: NeverScrollableScrollPhysics(),
shrinkWrap: true,
itemCount: model.prescriptionReportEnhList.length,
itemBuilder: (context, index) => PrescriptionItemsWidget(
frequency: model.prescriptionReportEnhList[index].frequency,
itemDescription: model.prescriptionReportEnhList[index].itemDescription,
days: model.prescriptionReportEnhList[index].days,
route: model.prescriptionReportEnhList[index].route,
dailyDoses: model.prescriptionReportEnhList[index].doseDailyQuantity,
imageSRCUrl: model.prescriptionReportEnhList[index].imageSRCUrl,
remarks: model.prescriptionReportEnhList[index].remarks,
prescriptionViewModel: model,
),
),
],
),
),
),
),
);
}
}

@ -1,218 +0,0 @@
import 'package:doctor_app_flutter/core/viewModel/prescription_view_model.dart';
import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/screens/base/base_view.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/screens/procedures/ProcedureType.dart';
import 'package:doctor_app_flutter/screens/procedures/base_add_procedure_tab_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/patient_service_title.dart';
import 'package:doctor_app_flutter/widgets/patients/profile/add-order/addNewOrder.dart';
import 'package:doctor_app_flutter/widgets/patients/profile/app_bar/patient-profile-app-bar.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/network_base_view.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/slide_up_page.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import '../../widgets/shared/errors/error_message.dart';
class PrescriptionsPage extends StatelessWidget {
@override
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'];
bool isInpatient = routeArgs['isInpatient'];
bool isFromLiveCare = routeArgs['isFromLiveCare'];
bool isSelectInpatient = routeArgs['isSelectInpatient'];
return BaseView<PrescriptionViewModel>(
onModelReady: (model) => patient.admissionNo == null
? model.getPrescriptions(patient, patientType: patientType)
: model.getMedicationForInPatient(patient),
builder: (_, model, w) => AppScaffold(
baseViewModel: model,
isShowAppBar: true,
backgroundColor: Colors.grey[100],
appBar: PatientProfileAppBar(
patient,
isInpatient: isInpatient,
),
body: patient.admissionNo == null
? 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: [
ServiceTitle(
title: TranslationBase.of(context).orders,
subTitle:
TranslationBase.of(context).prescriptions,
),
],
),
),
if (patient.patientStatusType != null &&
patient.patientStatusType == 43)
Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
ServiceTitle(
title: TranslationBase.of(context).orders,
subTitle:
TranslationBase.of(context).prescriptions,
),
],
),
),
if ((patient.patientStatusType != null &&
patient.patientStatusType == 43) ||
(isFromLiveCare && patient.appointmentNo != null))
AddNewOrder(
onTap: () {
Navigator.push(
context,
SlideUpPageRoute(
widget: BaseAddProcedureTabPage(
patient: patient,
prescriptionModel: model,
procedureType: ProcedureType.PRESCRIPTION,
),
settingRoute: '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,
),
),
),
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: ErrorMessage(
error: TranslationBase.of(context)
.noPrescriptionsFound,
))
],
),
)
: NetworkBaseView(
baseViewModel: model,
child: FractionallySizedBox(
widthFactor: 1.0,
child: ListView(
physics: BouncingScrollPhysics(),
children: <Widget>[
ListView.builder(
scrollDirection: Axis.vertical,
physics: NeverScrollableScrollPhysics(),
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]
.doctorName
.toString(),
));
}),
if (model.medicationForInPatient.length == 0)
Center(
child: ErrorMessage(
error: TranslationBase.of(context)
.noPrescriptionsFound,
))
],
),
),
)));
}
}

@ -1,991 +0,0 @@
import 'package:autocomplete_textfield/autocomplete_textfield.dart';
import 'package:doctor_app_flutter/config/size_config.dart';
import 'package:doctor_app_flutter/core/enum/viewstate.dart';
import 'package:doctor_app_flutter/core/model/Prescriptions/post_prescrition_req_model.dart';
import 'package:doctor_app_flutter/core/model/search_drug/get_medication_response_model.dart';
import 'package:doctor_app_flutter/core/viewModel/medicine_view_model.dart';
import 'package:doctor_app_flutter/core/viewModel/prescription_view_model.dart';
import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/screens/base/base_view.dart';
import 'package:doctor_app_flutter/util/date-utils.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/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/shared/TextFields.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:doctor_app_flutter/widgets/shared/dialogs/dailog-list-select.dart';
import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:hexcolor/hexcolor.dart';
class UpdatePrescriptionForm extends StatefulWidget {
final String drugName;
final String doseStreangth;
final int drugId;
final String remarks;
final PatiantInformtion patient;
final String duration;
final String route;
final String dose;
final String doseUnit;
final String enteredRemarks;
final String startDate;
final String frequency;
final String drugNameGeneric;
final String uom;
final int box;
final PrescriptionViewModel model;
UpdatePrescriptionForm(
{this.drugName,
this.doseStreangth,
this.drugId,
this.remarks,
this.patient,
this.duration,
this.route,
this.dose,
this.startDate,
this.doseUnit,
this.enteredRemarks,
this.frequency,
this.model,
this.drugNameGeneric,
this.uom,
this.box});
@override
_UpdatePrescriptionFormState createState() => _UpdatePrescriptionFormState();
}
class _UpdatePrescriptionFormState extends State<UpdatePrescriptionForm> {
TextEditingController strengthController = TextEditingController();
TextEditingController remarksController = TextEditingController();
int testNum = 0;
int strengthChar;
PatiantInformtion patient;
/// TODO Elham* add type
dynamic route;
dynamic doseTime;
dynamic frequencyUpdate;
dynamic updatedDuration;
dynamic units;
GetMedicationResponseModel newSelectedMedication;
GlobalKey key =
new GlobalKey<AutoCompleteTextFieldState<GetMedicationResponseModel>>();
List<dynamic> indicationList;
dynamic indication;
DateTime selectedDate;
@override
void initState() {
super.initState();
strengthController.text = widget.doseStreangth;
remarksController.text = widget.remarks;
indicationList = List();
/// TODO Elham* create model and try to have them form service and add translation
dynamic indication1 = {"id": 545, "name": "Gingival Hyperplasia"};
dynamic indication2 = {"id": 546, "name": "Mild Drowsiness"};
dynamic indication3 = {"id": 547, "name": "Hypertrichosis"};
dynamic indication4 = {"id": 548, "name": "Mild Dizziness"};
dynamic indication5 = {"id": 549, "name": "Enlargement of Facial Features"};
dynamic indication6 = {
"id": 550,
"name": "Phenytoin Hypersensitivity Syndrome"
};
dynamic indication7 = {"id": 551, "name": "Asterixis"};
dynamic indication8 = {"id": 552, "name": "Bullous Dermatitis"};
dynamic indication9 = {"id": 554, "name": "Purpuric Dermatitis"};
dynamic indication10 = {"id": 555, "name": "Systemic Lupus Erythematosus"};
indicationList.add(indication1);
indicationList.add(indication2);
indicationList.add(indication3);
indicationList.add(indication4);
indicationList.add(indication5);
indicationList.add(indication6);
indicationList.add(indication7);
indicationList.add(indication8);
indicationList.add(indication9);
indicationList.add(indication10);
}
/// TODO Elham* Add Translation
@override
Widget build(BuildContext context) {
final screenSize = MediaQuery.of(context).size;
return StatefulBuilder(builder:
(BuildContext context, StateSetter setState /*You can rename this!*/) {
return BaseView<MedicineViewModel>(
onModelReady: (model) async {
/// TODO Elham* Move this to view model and remove unused data
await model.getMedicationList();
await model.getMedicationStrength();
await model.getMedicationDuration();
await model.getMedicationRoute();
await model.getMedicationFrequency();
await model.getMedicationDoseTime();
await model.getItem(itemID: widget.drugId);
//await model.getMedicationIndications();
route = model.getLookupByIdFilter(
model.itemMedicineListRoute, widget.route);
doseTime =
model.getLookupById(model.medicationDoseTimeList, widget.dose);
updatedDuration = model.getLookupById(
model.medicationDurationList, widget.duration);
units = model.getLookupByIdFilter(
model.itemMedicineListUnit, widget.doseUnit);
frequencyUpdate = model.getLookupById(
model.medicationFrequencyList, widget.frequency);
},
builder:
(BuildContext context, MedicineViewModel model, Widget child) =>
NetworkBaseView(
baseViewModel: model,
child: GestureDetector(
onTap: () {
FocusScope.of(context).requestFocus(new FocusNode());
},
child: DraggableScrollableSheet(
initialChildSize: 0.98,
maxChildSize: 0.99,
minChildSize: 0.6,
builder:
(BuildContext context, ScrollController scrollController) {
return SingleChildScrollView(
child: Container(
height: MediaQuery.of(context).size.height * 1.5,
child: Form(
child: Padding(
padding: EdgeInsets.symmetric(
horizontal: 20.0, vertical: 12.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
AppText(
widget.drugName.toUpperCase(),
fontWeight: FontWeight.w900,
),
SizedBox(
height: 10.0,
),
Column(
children: [
Container(
height:
MediaQuery.of(context).size.height *
0.060,
width: double.infinity,
child: Row(
children: [
Container(
width: MediaQuery.of(context)
.size
.width *
0.4900,
height: MediaQuery.of(context)
.size
.height *
0.55,
child: TextFields(
inputFormatters: [
LengthLimitingTextInputFormatter(
5),
// WhitelistingTextInputFormatter
// .digitsOnly
],
hintText: widget.doseStreangth,
fontSize: 15.0,
controller: strengthController,
keyboardType: TextInputType
.numberWithOptions(
decimal: true,
),
onChanged: (String value) {
setState(() {
strengthChar = value.length;
});
if (strengthChar >= 5) {
DrAppToastMsg.showErrorToast(
"Only 5 Digits allowed for strength");
}
},
),
),
SizedBox(
width: 10.0,
),
Container(
width: MediaQuery.of(context)
.size
.width *
0.3700,
child: InkWell(
onTap:
model.itemMedicineListUnit !=
null
? () {
Helpers.hideKeyboard(
context);
ListSelectDialog
dialog =
ListSelectDialog(
list: model
.itemMedicineListUnit,
attributeName:
'description',
attributeValueId:
'parameterCode',
okText:
TranslationBase.of(
context)
.ok,
okFunction:
(selectedValue) {
setState(() {
units =
selectedValue;
});
},
);
showDialog(
barrierDismissible:
false,
context: context,
builder:
(BuildContext
context) {
return dialog;
},
);
}
: null,
child: TextField(
decoration:
textFieldSelectorDecoration(
'UNIT Type',
units != null
? units[
'description']
: null,
true),
enabled: false,
),
),
),
],
),
),
SizedBox(
height: 12,
),
Container(
height:
MediaQuery.of(context).size.height *
0.070,
child: InkWell(
onTap: model.itemMedicineListRoute !=
null
? () {
Helpers.hideKeyboard(context);
ListSelectDialog dialog =
ListSelectDialog(
list: model
.itemMedicineListRoute,
attributeName: 'description',
attributeValueId:
'parameterCode',
okText: TranslationBase.of(
context)
.ok,
okFunction: (selectedValue) {
setState(() {
route = selectedValue;
});
if (route == null) {
route = route['id'];
}
},
);
showDialog(
barrierDismissible: false,
context: context,
builder:
(BuildContext context) {
return dialog;
},
);
}
: null,
child: TextField(
decoration:
textFieldSelectorDecoration(
'Route',
route != null
? route['description']
: null,
true),
enabled: false,
),
),
),
SizedBox(
height: 12.0,
),
Container(
height:
MediaQuery.of(context).size.height *
0.070,
child: InkWell(
onTap: model.medicationDoseTimeList !=
null
? () {
Helpers.hideKeyboard(context);
ListSelectDialog dialog =
ListSelectDialog(
list: model
.medicationDoseTimeList,
attributeName: 'nameEn',
attributeValueId: 'id',
okText: TranslationBase.of(
context)
.ok,
okFunction: (selectedValue) {
setState(() {
doseTime = selectedValue;
});
},
);
showDialog(
barrierDismissible: false,
context: context,
builder:
(BuildContext context) {
return dialog;
},
);
}
: null,
child: TextField(
decoration:
textFieldSelectorDecoration(
TranslationBase.of(context)
.doseTime,
doseTime != null
? doseTime['nameEn']
: null,
true),
enabled: false,
),
),
),
SizedBox(
height: 12.0,
),
Container(
height:
MediaQuery.of(context).size.height *
0.070,
child: InkWell(
onTap: model.medicationFrequencyList !=
null
? () {
Helpers.hideKeyboard(context);
ListSelectDialog dialog =
ListSelectDialog(
list: model
.medicationFrequencyList,
attributeName: 'nameEn',
attributeValueId: 'id',
okText: TranslationBase.of(
context)
.ok,
okFunction: (selectedValue) {
setState(() {
frequencyUpdate =
selectedValue;
});
},
);
showDialog(
barrierDismissible: false,
context: context,
builder:
(BuildContext context) {
return dialog;
},
);
}
: null,
child: TextField(
decoration:
textFieldSelectorDecoration(
TranslationBase.of(context)
.frequency,
frequencyUpdate != null
? frequencyUpdate[
'nameEn']
: null,
true),
enabled: false,
),
),
),
SizedBox(
height: 12.0,
),
Container(
height:
MediaQuery.of(context).size.height *
0.070,
child: InkWell(
onTap: model.medicationDurationList !=
null
? () {
Helpers.hideKeyboard(context);
ListSelectDialog dialog =
ListSelectDialog(
list: model
.medicationDurationList,
attributeName: 'nameEn',
attributeValueId: 'id',
okText: TranslationBase.of(
context)
.ok,
okFunction: (selectedValue) {
setState(() {
updatedDuration =
selectedValue;
});
},
);
showDialog(
barrierDismissible: false,
context: context,
builder:
(BuildContext context) {
return dialog;
},
);
}
: null,
child: TextField(
decoration:
textFieldSelectorDecoration(
TranslationBase.of(context)
.duration,
updatedDuration != null
? updatedDuration[
'nameEn']
.toString()
: null,
true),
enabled: false,
),
),
),
SizedBox(
height: 12.0,
),
Container(
height: model.patientAssessmentList
.isNotEmpty
? screenSize.height * 0.070
: 0.0,
width: model.patientAssessmentList
.isNotEmpty
? double.infinity
: 0.0,
child: model.patientAssessmentList
.isNotEmpty
? Row(
children: [
Container(
width:
MediaQuery.of(context)
.size
.width *
0.29,
child: InkWell(
onTap:
indicationList != null
? () {
Helpers.hideKeyboard(
context);
}
: null,
child: TextField(
decoration: textFieldSelectorDecoration(
model.patientAssessmentList
.isNotEmpty
? model
.patientAssessmentList[
0]
.icdCode10ID
.toString()
: '',
indication != null
? indication[
'name']
: null,
true),
enabled: true,
readOnly: true,
),
),
),
Container(
width:
MediaQuery.of(context)
.size
.width *
0.61,
child: InkWell(
onTap:
indicationList != null
? () {
Helpers.hideKeyboard(
context);
}
: null,
child: TextField(
maxLines: 3,
decoration: textFieldSelectorDecoration(
model.patientAssessmentList
.isNotEmpty
? model
.patientAssessmentList[
0]
.asciiDesc
.toString()
: '',
indication != null
? indication[
'name']
: null,
true),
enabled: true,
readOnly: true,
),
),
),
],
)
: null),
SizedBox(
height: 12.0,
),
Container(
height: screenSize.height * 0.070,
child: InkWell(
onTap: () =>
selectDate(context, widget.model),
child: TextField(
decoration: Helpers
.textFieldSelectorDecoration(
AppDateUtils.getDateFormatted(
DateTime.parse(
widget.startDate)),
selectedDate != null
? "${AppDateUtils.convertStringToDateFormat(selectedDate.toString(), "yyyy-MM-dd")}"
: null,
true,
suffixIcon: Icon(
Icons.calendar_today,
color: Colors.black,
)),
enabled: false,
),
),
),
SizedBox(
height: 12.0,
),
Container(
height: screenSize.height * 0.070,
child: InkWell(
onTap: model.allMedicationList != null
? () {
Helpers.hideKeyboard(context);
ListSelectDialog dialog =
ListSelectDialog(
list: model.allMedicationList,
attributeName: 'nameEn',
attributeValueId: 'id',
okText: TranslationBase.of(
context)
.ok,
okFunction: (selectedValue) {
setState(() {
// duration = selectedValue;
});
},
);
showDialog(
barrierDismissible: false,
context: context,
builder:
(BuildContext context) {
return dialog;
},
);
}
: null,
child: TextField(
decoration:
textFieldSelectorDecoration(
"UOM",
widget.uom != null
? widget.uom
: null,
true),
// enabled: false,
readOnly: true,
),
),
),
Container(
height: screenSize.height * 0.070,
child: InkWell(
onTap: model.allMedicationList != null
? () {
Helpers.hideKeyboard(context);
ListSelectDialog dialog =
ListSelectDialog(
list: model.allMedicationList,
attributeName: 'nameEn',
attributeValueId: 'id',
okText: TranslationBase.of(
context)
.ok,
okFunction: (selectedValue) {
setState(() {
// duration = selectedValue;
});
},
);
showDialog(
barrierDismissible: false,
context: context,
builder:
(BuildContext context) {
return dialog;
},
);
}
: null,
child: TextField(
decoration:
textFieldSelectorDecoration(
'Box Quantity',
widget.box != null
? "Box Quantity: " +
widget.box.toString()
: null,
true),
// enabled: false,
readOnly: true,
),
),
),
SizedBox(
height: 12.0,
),
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.all(
Radius.circular(6.0)),
border: Border.all(
width: 1.0,
color: HexColor("#CCCCCC"))),
child: TextFields(
controller: remarksController,
maxLines: 7,
minLines: 4,
),
),
SizedBox(
height: 10.0,
),
SizedBox(
height:
MediaQuery.of(context).size.height *
0.08,
),
Container(
margin: EdgeInsets.all(
SizeConfig.widthMultiplier * 2),
child: Wrap(
alignment: WrapAlignment.center,
children: <Widget>[
AppButton(
title: 'update prescription'
.toUpperCase(),
onPressed: () {
/// TODO Elham* Move this to function
if (double.parse(
strengthController.text) >
1000.0) {
DrAppToastMsg.showErrorToast(
"1000 is the MAX for the strength");
return;
}
if (double.parse(
strengthController
.text) ==
0.0) {
DrAppToastMsg.showErrorToast(
"strength can't be zero");
return;
}
if (strengthController
.text.length >
4) {
DrAppToastMsg.showErrorToast(
"strength can't be more then 4 digits ");
return;
}
// if(units==null&& updatedDuration==null&&frequencyUpdate==null&&)
updatePrescription(
newStartDate: selectedDate,
newDoseStreangth:
strengthController
.text.isNotEmpty
? strengthController
.text
: widget
.doseStreangth,
newUnit: units != null
? units['parameterCode']
.toString()
: widget.doseUnit,
doseUnit: widget.doseUnit,
doseStreangth:
widget.doseStreangth,
duration: widget.duration,
startDate: widget.startDate,
doseId: widget.dose,
frequencyId: widget.frequency,
routeId: widget.route,
patient: widget.patient,
model: widget.model,
newDuration:
updatedDuration != null
? updatedDuration['id']
.toString()
: widget.duration,
drugId: widget.drugId,
remarks: remarksController
.text,
route: route != null
? route['parameterCode']
.toString()
: widget.route,
frequency:
frequencyUpdate != null
? frequencyUpdate[
'id']
.toString()
: widget.frequency,
dose: doseTime != null
? doseTime['id']
.toString()
: widget.dose,
enteredRemarks:
widget.enteredRemarks);
Navigator.pop(context);
},
),
],
),
),
],
),
],
),
),
)),
);
}),
),
),
);
});
}
selectDate(BuildContext context, PrescriptionViewModel model) async {
Helpers.hideKeyboard(context);
DateTime selectedDate;
selectedDate = DateTime.now();
final DateTime picked = await showDatePicker(
context: context,
initialDate: selectedDate,
firstDate: DateTime.now(),
lastDate: DateTime(2040),
initialEntryMode: DatePickerEntryMode.calendar,
);
if (picked != null && picked != selectedDate) {
setState(() {
this.selectedDate = picked;
});
}
}
// /// TODO Elham* Use it from the textfeild utils
InputDecoration textFieldSelectorDecoration(
String hintText, String selectedText, bool isDropDown,
{Icon suffixIcon}) {
return InputDecoration(
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0),
borderRadius: BorderRadius.circular(8),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0),
borderRadius: BorderRadius.circular(8),
),
disabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0),
borderRadius: BorderRadius.circular(8),
),
hintText: selectedText != null ? selectedText : hintText,
suffixIcon: isDropDown
? suffixIcon != null
? suffixIcon
: Icon(
Icons.arrow_drop_down,
color: Colors.black,
)
: null,
hintStyle: TextStyle(
fontSize: 14,
color: Colors.grey.shade600,
),
);
}
/// TODO Elham* Move this to view model and pass all data as model
updatePrescription(
{PrescriptionViewModel model,
int drugId,
String newDrugId,
String frequencyId,
String remarks,
String dose,
String doseId,
String frequency,
String route,
String routeId,
String startDate,
DateTime newStartDate,
String doseUnit,
String doseStreangth,
String newDoseStreangth,
String duration,
String newDuration,
String newUnit,
String enteredRemarks,
PatiantInformtion patient}) async {
//PrescriptionViewModel model = PrescriptionViewModel();
PostPrescriptionReqModel updatePrescriptionReqModel =
new PostPrescriptionReqModel();
List<PrescriptionRequestModel> sss = List();
updatePrescriptionReqModel.appointmentNo = patient.appointmentNo;
updatePrescriptionReqModel.clinicID = patient.clinicId;
updatePrescriptionReqModel.episodeID = patient.episodeNo;
updatePrescriptionReqModel.patientMRN = patient.patientMRN;
sss.add(PrescriptionRequestModel(
covered: true,
dose: newDoseStreangth.isNotEmpty
? double.parse(newDoseStreangth)
: double.parse(doseStreangth),
//frequency.isNotEmpty ? int.parse(dose) : 1,
itemId: drugId,
doseUnitId:
newUnit.isNotEmpty ? int.parse(newUnit) : int.parse(doseUnit),
route: route.isNotEmpty ? int.parse(route) : int.parse(routeId),
frequency: frequency.isNotEmpty
? int.parse(frequency)
: int.parse(frequencyId),
remarks: remarks.isEmpty ? enteredRemarks : remarks,
approvalRequired: true,
icdcode10Id: "test2",
doseTime: dose.isNotEmpty ? int.parse(dose) : int.parse(doseId),
duration: newDuration.isNotEmpty
? int.parse(newDuration)
: int.parse(duration),
doseStartDate:
newStartDate != null ? newStartDate.toIso8601String() : startDate));
updatePrescriptionReqModel.prescriptionRequestModel = sss;
//postProcedureReqModel.procedures = controlsProcedure;
await model.updatePrescription(
updatePrescriptionReqModel, patient.patientMRN);
if (model.state == ViewState.ErrorLocal) {
Helpers.showErrorToast(model.error);
} else if (model.state == ViewState.Idle) {
DrAppToastMsg.showSuccesToast('Medication has been updated');
}
}
}
void updatePrescriptionForm(
{context,
String drugName,
String drugNameGeneric,
int drugId,
String remarks,
PrescriptionViewModel model,
PatiantInformtion patient,
String rouat,
String frequency,
String dose,
String duration,
String doseStreangth,
String doseUnit,
String enteredRemarks,
String uom,
int box,
String startDate}) {
/// TODO Elham* remove unused code.
TextEditingController remarksController = TextEditingController();
TextEditingController doseController = TextEditingController();
TextEditingController frequencyController = TextEditingController();
TextEditingController routeController = TextEditingController();
showModalBottomSheet(
context: context,
isScrollControlled: true,
builder: (BuildContext context) {
return UpdatePrescriptionForm(
box: box,
uom: uom,
drugName: drugName,
patient: patient,
doseStreangth: doseStreangth,
remarks: remarks,
drugId: drugId,
enteredRemarks: enteredRemarks,
duration: duration,
dose: dose,
doseUnit: doseUnit,
frequency: frequency,
route: rouat,
startDate: startDate,
model: model,
drugNameGeneric: drugNameGeneric,
);
});
}

@ -1,4 +1,5 @@
import 'package:doctor_app_flutter/client/base_app_client.dart';
import 'package:doctor_app_flutter/config/config.dart';
import 'package:doctor_app_flutter/core/model/procedure/procedure_templateModel.dart';
import 'package:doctor_app_flutter/core/model/procedure/procedure_template_details_model.dart';
import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.dart';
@ -59,14 +60,16 @@ class _ExpansionProcedureState extends State<ExpansionProcedure> {
Radius.circular(5.0),
)),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Expanded(
child: Row(
children: [
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Icon(
Icons.folder,
size: 20,
color: Color(0xff575757),
color: AppGlobal.appTextColor,
),
Expanded(
child: Padding(
@ -78,10 +81,12 @@ class _ExpansionProcedureState extends State<ExpansionProcedure> {
widget.procedureTempleteModel.templateName
: "Prescription for " +
widget.procedureTempleteModel.templateName,
letterSpacing: -0.72,
fontSize: 16.0,
variant: "bodyText",
bold: true,
color: Color(0xff575757)),
color: AppGlobal.appTextColor,
fontWeight: FontWeight.w600,
),
),
),
],
@ -93,8 +98,8 @@ class _ExpansionProcedureState extends State<ExpansionProcedure> {
_isShowMore
? Icons.keyboard_arrow_up
: Icons.keyboard_arrow_down,
color: Colors.grey[800],
size: 22,
color: AppGlobal.appTextColor,
size: 28,
),
)
],

@ -1,6 +1,6 @@
import 'package:doctor_app_flutter/config/size_config.dart';
import 'package:doctor_app_flutter/core/model/procedure/procedure_template_details_model.dart';
import 'package:doctor_app_flutter/core/viewModel/prescription_view_model.dart';
import 'package:doctor_app_flutter/core/viewModel/prescription/prescription_view_model.dart';
import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.dart';
import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/screens/base/base_view.dart';
@ -11,22 +11,21 @@ import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.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:doctor_app_flutter/widgets/shared/network_base_view.dart';
import 'package:doctor_app_flutter/widgets/shared/errors/error_message.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import '../patients/profile/soap_update/shared_soap_widgets/bottom_sheet_dialog_button.dart';
import 'ProcedureType.dart';
class AddFavouriteProcedure extends StatefulWidget {
final ProcedureViewModel model;
final ProcedureViewModel previousProcedureViewModel;
final PrescriptionViewModel prescriptionModel;
final PatiantInformtion patient;
final ProcedureType procedureType;
AddFavouriteProcedure({
Key key,
this.model,
this.previousProcedureViewModel,
this.prescriptionModel,
this.patient,
@required this.procedureType,
@ -47,112 +46,91 @@ class _AddFavouriteProcedureState extends State<AddFavouriteProcedure> {
@override
Widget build(BuildContext context) {
return BaseView<ProcedureViewModel>(
onModelReady: (model) => model.getProcedureTemplate(
categoryID: widget.procedureType.getCategoryId()),
builder: (BuildContext context, ProcedureViewModel model, Widget child) =>
builder: (BuildContext context, ProcedureViewModel model_,
Widget child) =>
AppScaffold(
isShowAppBar: false,
baseViewModel: model,
body: Column(
children: [
Container(
height: MediaQuery.of(context).size.height * 0.070,
),
(model.templateList.length != 0)
? Expanded(
child: EntityListCheckboxSearchFavProceduresWidget(
isProcedure:
!(widget.procedureType == ProcedureType.PRESCRIPTION),
model: model,
removeFavProcedure: (item) {
setState(() {
entityList.remove(item);
});
},
addFavProcedure: (history) {
setState(() {
entityList.add(history);
});
},
isEntityFavListSelected: (master) =>
isEntityListSelected(master),
groupProcedures: groupProcedures,
selectProcedures: (selectedProcedure) {
setState(() {
groupProcedures = selectedProcedure;
});
},
),
)
: Container(
child: Padding(
padding: EdgeInsets.symmetric(vertical: 50.0),
child: AppText('You Don\'t have favorite prescription'),
),
),
],
),
bottomSheet: Container(
margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5),
child: Wrap(
alignment: WrapAlignment.center,
children: <Widget>[
AppButton(
title: widget.procedureType.getAddButtonTitle(context) ??
TranslationBase.of(context).addSelectedProcedures,
color: Color(0xff359846),
disabled: model.templateList.length == 0 ? true : false,
fontWeight: FontWeight.w700,
onPressed: () {
if (widget.procedureType == ProcedureType.PRESCRIPTION) {
if (groupProcedures == null) {
DrAppToastMsg.showErrorToast(
'Please Select item ',
);
return;
}
isShowAppBar: false,
baseViewModel: model,
body: Column(children: [
(widget.previousProcedureViewModel.templateList.length != 0)
? Expanded(
child: EntityListCheckboxSearchFavProceduresWidget(
isProcedure: !(widget.procedureType ==
ProcedureType.PRESCRIPTION),
model: widget.previousProcedureViewModel,
removeFavProcedure: (item) {
setState(() {
entityList.remove(item);
});
},
addFavProcedure: (history) {
setState(() {
entityList.add(history);
});
},
isEntityFavListSelected: (master) =>
isEntityListSelected(master),
groupProcedures: groupProcedures,
selectProcedures: (selectedProcedure) {
setState(() {
groupProcedures = selectedProcedure;
});
},
),
)
: ErrorMessage(
error: TranslationBase.of(context)
.youDoNotHaveFavoritePrescription,
),
]),
bottomSheet: BottomSheetDialogButton(
label: widget.procedureType.getAddButtonTitle(context) ??
TranslationBase.of(context).addSelectedProcedures,
onTap: () async {
if (widget.procedureType == ProcedureType.PRESCRIPTION) {
if (groupProcedures == null) {
DrAppToastMsg.showErrorToast(
TranslationBase.of(context).pleaseSelectItem,
);
return;
}
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => PrescriptionCheckOutScreen(
patient: widget.patient,
model: widget.prescriptionModel,
groupProcedures: groupProcedures,
),
settings: RouteSettings(
name: 'PrescriptionCheckOutScreen')),
);
} else {
if (entityList.isEmpty == true) {
DrAppToastMsg.showErrorToast(
TranslationBase.of(context)
.fillTheMandatoryProcedureDetails,
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => PrescriptionCheckOutScreen(
patient: widget.patient,
model: widget.prescriptionModel,
groupProcedures: groupProcedures,
),
settings: RouteSettings(
name: 'PrescriptionCheckOutScreen')),
);
} else {
if (entityList.isEmpty == true) {
DrAppToastMsg.showErrorToast(
TranslationBase.of(context)
.fillTheMandatoryProcedureDetails,
);
return;
}
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => ProcedureCheckOutScreen(
items: entityList,
model: model,
patient: widget.patient,
addButtonTitle: widget.procedureType
.getAddButtonTitle(context),
toolbarTitle: widget.procedureType
.getToolbarLabel(context),
),
settings:
RouteSettings(name: 'ProcedureCheckOutScreen')),
);
return;
}
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => ProcedureCheckOutScreen(
items: entityList,
model: model,
patient: widget.patient,
addButtonTitle: widget.procedureType
.getAddButtonTitle(context),
toolbarTitle: widget.procedureType
.getToolbarLabel(context),
),
settings:
RouteSettings(name: 'ProcedureCheckOutScreen')),
);
}
},
),
],
),
),
),
})),
);
}

@ -12,6 +12,7 @@ import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart';
import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart';
import 'package:flutter/material.dart';
import '../../config/config.dart';
import 'ProcedureType.dart';
import 'entity_list_checkbox_search_widget.dart';
@ -183,7 +184,7 @@ class _AddProcedurePageState extends State<AddProcedurePage> {
AppButton(
title: procedureType.getAddButtonTitle(context),
fontWeight: FontWeight.w700,
color: Color(0xff359846),
color: AppGlobal.appGreenColor,
onPressed: () async {
if (entityList.isEmpty == true) {
DrAppToastMsg.showErrorToast(

@ -1,15 +1,15 @@
import 'package:doctor_app_flutter/config/size_config.dart';
import 'package:doctor_app_flutter/core/viewModel/prescription_view_model.dart';
import 'package:doctor_app_flutter/core/viewModel/prescription/prescription_view_model.dart';
import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.dart';
import 'package:doctor_app_flutter/core/model/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/patients/profile/soap_update/shared_soap_widgets/bottom_sheet_title.dart';
import 'package:doctor_app_flutter/screens/prescription/add_prescription/add_prescription.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/network_base_view.dart';
import 'package:doctor_app_flutter/widgets/shared/text_fields/text_fields_utils.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import '../../core/viewModel/project_view_model.dart';
import '../../util/tab_helper.dart';
import 'ProcedureType.dart';
import 'add-favourite-procedure.dart';
import 'add-procedure-page.dart';
@ -68,172 +68,117 @@ class _BaseAddProcedureTabPageState extends State<BaseAddProcedureTabPage>
final screenSize = MediaQuery.of(context).size;
return BaseView<ProcedureViewModel>(
onModelReady: (model) async {
await model.getProcedureTemplate(categoryID: widget.procedureType.getCategoryId());
},
builder: (BuildContext context, ProcedureViewModel model, Widget child) =>
AppScaffold(
isShowAppBar: false,
body: NetworkBaseView(
baseViewModel: model,
child: DraggableScrollableSheet(
minChildSize: 0.90,
initialChildSize: 0.95,
maxChildSize: 1.0,
builder:
(BuildContext context, ScrollController scrollController) {
return Container(
height: MediaQuery.of(context).size.height * 1.25,
child: Padding(
padding: EdgeInsets.all(12.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
AppText(
procedureType.getToolbarLabel(context),
fontWeight: FontWeight.w700,
fontSize: 20,
),
InkWell(
child: Icon(
Icons.close,
size: 24.0,
),
onTap: () {
Navigator.pop(context);
},
)
]),
SizedBox(
height: MediaQuery.of(context).size.height * 0.04,
),
Expanded(
child: Scaffold(
extendBodyBehindAppBar: true,
appBar: PreferredSize(
preferredSize: Size.fromHeight(
MediaQuery.of(context).size.height * 0.070),
child: Container(
height:
MediaQuery.of(context).size.height * 0.070,
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
color: Theme.of(context).dividerColor,
width: 0.5), //width: 0.7
),
color: Colors.white),
child: Center(
child: TabBar(
isScrollable: false,
controller: _tabController,
indicatorColor: Colors.transparent,
indicatorWeight: 1.0,
indicatorSize: TabBarIndicatorSize.tab,
labelColor: Theme.of(context).primaryColor,
labelPadding: EdgeInsets.only(
top: 0, left: 0, right: 0, bottom: 0),
unselectedLabelColor: Colors.grey[800],
tabs: [
tabWidget(
screenSize,
_activeTab == 0,
procedureType
.getFavouriteTabName(context),
),
tabWidget(
screenSize,
_activeTab == 1,
procedureType.getAllLabelName(context),
),
],
),
),
),
),
body: Column(
children: [
Expanded(
child: TabBarView(
physics: BouncingScrollPhysics(),
controller: _tabController,
children: [
AddFavouriteProcedure(
model: this.model,
prescriptionModel:
widget.prescriptionModel,
patient: patient,
procedureType: procedureType,
),
if (widget.procedureType ==
ProcedureType.PRESCRIPTION)
PrescriptionFormWidget(
widget.prescriptionModel,
widget.patient,
widget.prescriptionModel
.prescriptionList)
else
AddProcedurePage(
model: this.model,
patient: patient,
procedureType: procedureType,
),
],
),
),
],
),
baseViewModel: model,
isShowAppBar: true,
appBar: BottomSheetTitle(title: procedureType.getToolbarLabel(context),),
body: NetworkBaseView(
baseViewModel: model,
child: Expanded(
child: Scaffold(
extendBodyBehindAppBar: true,
appBar: PreferredSize(
preferredSize: Size.fromHeight(
MediaQuery.of(context).size.height * 0.070),
child: TabBar(
isScrollable: false,
controller: _tabController,
indicatorColor: Colors.transparent,
indicatorWeight: 1.0,
indicatorSize: TabBarIndicatorSize.tab,
labelColor: Theme.of(context).primaryColor,
labelPadding: EdgeInsets.only(
top: 0, left: 0, right: 0, bottom: 0),
unselectedLabelColor: Colors.grey[800],
tabs: [
tabWidget(
screenSize,
_activeTab == 0,
procedureType
.getFavouriteTabName(context),
isFirst: true,context: context
),
tabWidget(
screenSize,
_activeTab == 1,
procedureType.getAllLabelName(context),
isLast: true,context: context
),
],
),
),
body: Column(
children: [
Expanded(
child: TabBarView(
physics: BouncingScrollPhysics(),
controller: _tabController,
children: [
AddFavouriteProcedure(
previousProcedureViewModel: model,
prescriptionModel:
widget.prescriptionModel,
patient: patient,
procedureType: procedureType,
),
),
],
if (widget.procedureType ==
ProcedureType.PRESCRIPTION)
AddPrescription(
widget.prescriptionModel,
widget.patient,
widget.prescriptionModel.prescriptionList,
)
else
AddProcedurePage(
model: this.model,
patient: patient,
procedureType: procedureType,
),
],
),
),
),
);
}),
],
),
),
)
),
),
);
}
Widget tabWidget(Size screenSize, bool isActive, String title,
{int counter = -1}) {
Widget tabWidget(
Size screenSize,
bool isActive,
String title, {
int counter = -1,
bool isFirst = false,
bool isMiddle = false,
bool isLast = false,
context,
}) {
ProjectViewModel projectViewModel = Provider.of(context);
return Center(
child: Container(
height: screenSize.height * 0.070,
decoration: TextFieldsUtils.containerBorderDecoration(
isActive ? Color(0xFFD02127) : Color(0xFFEAEAEA),
isActive ? Color(0xFFD02127) : Color(0xFFEAEAEA),
borderRadius: 4,
borderWidth: 0),
height: TabHelper.getTabHeight(context),
decoration: TabHelper.getBoxTabsBoxDecoration(
isActive: isActive,
isFirst: isFirst,
isMiddle: isMiddle,
isLast: isLast,
projectViewModel: projectViewModel),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
AppText(
title,
fontSize: SizeConfig.textMultiplier * 1.5,
color: isActive ? Colors.white : Color(0xFF2B353E),
fontWeight: FontWeight.w700,
),
TabHelper.getTabText(title: title, isActive: isActive),
if (counter != -1)
Container(
margin: EdgeInsets.all(4),
width: 15,
height: 15,
decoration: BoxDecoration(
color: isActive ? Colors.white : Color(0xFFD02127),
shape: BoxShape.circle,
),
child: Center(
child: FittedBox(
child: AppText(
"$counter",
fontSize: SizeConfig.textMultiplier * 1.5,
color: !isActive ? Colors.white : Color(0xFFD02127),
fontWeight: FontWeight.w700,
),
),
),
),
TabHelper.getTabCounter(isActive: isActive, counter: counter)
],
),
),

@ -9,6 +9,8 @@ import 'package:eva_icons_flutter/eva_icons_flutter.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import '../../config/config.dart';
class EntityListCheckboxSearchWidget extends StatefulWidget {
final ProcedureViewModel model;
final Function addSelectedHistories;
@ -229,7 +231,7 @@ class _EntityListCheckboxSearchWidgetState
: Center(
child: Container(
child: AppText("Sorry , No Match",
color: Color(0xFFB9382C)),
color: AppGlobal.appRedColor),
),
)
],

@ -1,13 +1,14 @@
import 'package:doctor_app_flutter/core/model/procedure/procedure_templateModel.dart';
import 'package:doctor_app_flutter/core/model/procedure/procedure_template_details_model.dart';
import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.dart';
import 'package:doctor_app_flutter/widgets/shared/TextFields.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart';
import 'package:eva_icons_flutter/eva_icons_flutter.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import '../../config/config.dart';
import '../../widgets/shared/text_fields/app_text_field_custom_serach.dart';
import 'ExpansionProcedure.dart';
class EntityListCheckboxSearchFavProceduresWidget extends StatefulWidget {
@ -74,66 +75,71 @@ class _EntityListCheckboxSearchFavProceduresWidgetState
}
TextEditingController remarksController = TextEditingController();
TextEditingController patientFileInfoController = TextEditingController();
@override
Widget build(BuildContext context) {
return Container(
child: Column(
children: [
NetworkBaseView(
baseViewModel: widget.model,
child: Container(
height: MediaQuery.of(context).size.height * 0.60,
child: Center(
child: Container(
margin: EdgeInsets.only(top: 15),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),
color: Colors.white),
child: ListView(
children: [
TextFields(
hintText: 'Search Favourite templates',
suffixIcon: EvaIcons.search,
suffixIconColor: Color(0xff2B353E),
onChanged: (value) {
filterSearchResults(value);
},
hasBorder: false,
),
SizedBox(
height: 15,
),
widget.model.templateList.length != 0
? Column(
children:
widget.model.templateList.map((historyInfo) {
return ExpansionProcedure(
procedureTempleteModel: historyInfo,
model: widget.model,
removeFavProcedure: widget.removeFavProcedure,
addFavProcedure: widget.addFavProcedure,
selectProcedures: widget.selectProcedures,
isEntityListSelected:
widget.isEntityListSelected,
isEntityFavListSelected:
widget.isEntityFavListSelected,
isProcedure: widget.isProcedure,
groupProcedures: widget.groupProcedures);
}).toList(),
)
: Center(
child: Container(
child: AppText("Sorry , No Match",
color: Color(0xFFB9382C)),
),
)
return SingleChildScrollView(
child: NetworkBaseView(
baseViewModel: widget.model,
child: Container(
height: MediaQuery.of(context).size.height * 0.90,
child: Center(
child: Container(
margin: EdgeInsets.only(top: 15),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),
color: Colors.white),
child: ListView(
children: [
AppTextFieldCustomSearch(
searchController: patientFileInfoController,
onChangeFun: (value) {
filterSearchResults(value);
},
marginTop: 5,
inputFormatters: [
FilteringTextInputFormatter.allow(
RegExp(ONLY_LETTERS))
],
inputType: TextInputType.text,
hintText: TranslationBase.of(context).searchFavoriteTemplate,
// validationError: TranslationBase.of(context).emptyMessage
// : null,
),
SizedBox(
height: 15,
),
)),
widget.model.templateList.length != 0
? Column(
children:
widget.model.templateList.map((historyInfo) {
return ExpansionProcedure(
procedureTempleteModel: historyInfo,
model: widget.model,
removeFavProcedure: widget.removeFavProcedure,
addFavProcedure: widget.addFavProcedure,
selectProcedures: widget.selectProcedures,
isEntityListSelected:
widget.isEntityListSelected,
isEntityFavListSelected:
widget.isEntityFavListSelected,
isProcedure: widget.isProcedure,
groupProcedures: widget.groupProcedures);
}).toList(),
)
: Center(
child: Container(
child: AppText(
TranslationBase.of(context).sorryNoMatch,
color: AppGlobal.appRedColor),
),
)
],
),
),
],
)),
),
),
);
}

@ -14,6 +14,8 @@ import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dar
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import '../../config/config.dart';
class ProcedureCheckOutScreen extends StatefulWidget {
final List<ProcedureTempleteDetailsModel> items;
final ProcedureViewModel model;
@ -214,7 +216,7 @@ class _ProcedureCheckOutScreenState extends State<ProcedureCheckOutScreen> {
AppButton(
title: widget.addButtonTitle ??
TranslationBase.of(context).addSelectedProcedures,
color: Color(0xff359846),
color: AppGlobal.appGreenColor,
fontWeight: FontWeight.w700,
onPressed: () async {
List<EntityList> entityList = List();

@ -247,7 +247,7 @@ class _UpdateProcedureWidgetState extends State<UpdateProcedureWidget> {
children: [
AppText(TranslationBase.of(context).orderType),
Radio(
activeColor: Color(0xFFB9382C),
activeColor: AppGlobal.appRedColor,
value: 0,
groupValue: selectedType,
onChanged: (value) {
@ -256,7 +256,7 @@ class _UpdateProcedureWidgetState extends State<UpdateProcedureWidget> {
),
Text('routine'),
Radio(
activeColor: Color(0xFFB9382C),
activeColor: AppGlobal.appRedColor,
groupValue: selectedType,
value: 1,
onChanged: (value) {
@ -297,7 +297,7 @@ class _UpdateProcedureWidgetState extends State<UpdateProcedureWidget> {
//alignment: WrapAlignment.center,
children: <Widget>[
AppButton(
color: Color(0xff359846),
color: AppGlobal.appGreenColor,
title: TranslationBase.of(context)
.updateProcedure
.toUpperCase(),

@ -327,107 +327,7 @@ class Helpers {
return kpi;
}
static getBoxTabsBoxDecoration(
{bool isFirst = false,
bool isMiddle = false,
bool isLast = false,
bool isActive = false,
double radius = 6.0,
ProjectViewModel projectViewModel}) {
return BoxDecoration(
color: isActive ? AppGlobal.appRedColor : Color(0xFFEAEAEA),
shape: BoxShape.rectangle,
borderRadius: BorderRadius.only(
topRight: projectViewModel.isArabic
? Radius.circular(isActive
? isLast || isMiddle
? radius
: 0
: 0)
: Radius.circular(isActive
? isFirst || isMiddle
? radius
: 0
: 0),
topLeft: projectViewModel.isArabic
? Radius.circular(isActive
? isFirst || isMiddle
? radius
: 0
: 0)
: Radius.circular(isActive
? isLast || isMiddle
? radius
: 0
: 0),
bottomRight: projectViewModel.isArabic
? Radius.circular(isActive
? isLast || isMiddle
? radius
: 0
: 0)
: Radius.circular(isActive
? isFirst || isMiddle
? radius
: 0
: 0),
bottomLeft: projectViewModel.isArabic
? Radius.circular(isActive
? isFirst || isMiddle
? radius
: 0
: 0)
: Radius.circular(isActive
? isLast || isMiddle
? radius
: 0
: 0)),
);
}
static getBgTabColor() {
return Color(0xFFEAEAEA);
}
static getTabText({
String title,
bool isActive = false,
}) {
return AppText(
title,
fontSize: SizeConfig.textMultiplier * 1.8,
color: isActive ? Colors.white : AppGlobal.appTextColor,
letterSpacing: -0.48,
fontWeight: FontWeight.w600,
);
}
static getTabHeight(BuildContext context) {
final screenSize = MediaQuery.of(context).size;
return screenSize.height * 0.07;
}
static getTabCounter({bool isActive: false, int counter}) {
return Container(
margin: EdgeInsets.all(4),
width: 15,
height: 15,
decoration: BoxDecoration(
color: isActive ? Colors.white : AppGlobal.appRedColor,
shape: BoxShape.circle,
),
child: Center(
child: FittedBox(
child: AppText(
"$counter",
fontSize: SizeConfig.textMultiplier * 1.5,
color: !isActive ? Colors.white : AppGlobal.appRedColor,
fontWeight: FontWeight.w700,
),
),
),
);
}
static String convertToTitleCase(String text) {
if (text == null) {

@ -0,0 +1,113 @@
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import '../config/config.dart';
import '../config/size_config.dart';
import '../core/viewModel/project_view_model.dart';
import '../widgets/shared/app_texts_widget.dart';
class TabHelper {
static getBoxTabsBoxDecoration(
{bool isFirst = false,
bool isMiddle = false,
bool isLast = false,
bool isActive = false,
double radius = 6.0,
ProjectViewModel projectViewModel}) {
return BoxDecoration(
color: isActive ? AppGlobal.appRedColor : Color(0xFFEAEAEA),
shape: BoxShape.rectangle,
borderRadius: BorderRadius.only(
topRight: projectViewModel.isArabic
? Radius.circular(isActive
? isLast || isMiddle
? radius
: 0
: 0)
: Radius.circular(isActive
? isFirst || isMiddle
? radius
: 0
: 0),
topLeft: projectViewModel.isArabic
? Radius.circular(isActive
? isFirst || isMiddle
? radius
: 0
: 0)
: Radius.circular(isActive
? isLast || isMiddle
? radius
: 0
: 0),
bottomRight: projectViewModel.isArabic
? Radius.circular(isActive
? isLast || isMiddle
? radius
: 0
: 0)
: Radius.circular(isActive
? isFirst || isMiddle
? radius
: 0
: 0),
bottomLeft: projectViewModel.isArabic
? Radius.circular(isActive
? isFirst || isMiddle
? radius
: 0
: 0)
: Radius.circular(isActive
? isLast || isMiddle
? radius
: 0
: 0)),
);
}
static getBgTabColor() {
return Color(0xFFEAEAEA);
}
static getTabText({
String title,
bool isActive = false,
}) {
return AppText(
title,
fontSize: SizeConfig.textMultiplier * 1.8,
color: isActive ? Colors.white : AppGlobal.appTextColor,
letterSpacing: -0.48,
fontWeight: FontWeight.w600,
);
}
static getTabHeight(BuildContext context) {
final screenSize = MediaQuery.of(context).size;
return screenSize.height * 0.07;
}
static getTabCounter({bool isActive: false, int counter}) {
return Container(
margin: EdgeInsets.all(4),
width: 15,
height: 15,
decoration: BoxDecoration(
color: isActive ? Colors.white : AppGlobal.appRedColor,
shape: BoxShape.circle,
),
child: Center(
child: FittedBox(
child: AppText(
"$counter",
fontSize: SizeConfig.textMultiplier * 1.5,
color: !isActive ? Colors.white : AppGlobal.appRedColor,
fontWeight: FontWeight.w700,
),
),
),
);
}
}

@ -13,13 +13,11 @@ class TranslationBase {
return Localizations.of<TranslationBase>(context, TranslationBase);
}
String get dashboardScreenToolbarTitle =>
localizedValues['dashboardScreenToolbarTitle'][locale.languageCode];
String get dashboardScreenToolbarTitle => localizedValues['dashboardScreenToolbarTitle'][locale.languageCode];
String get settings => localizedValues['settings'][locale.languageCode];
String get areYouSureYouWantTo =>
localizedValues['areYouSureYouWantTo'][locale.languageCode];
String get areYouSureYouWantTo => localizedValues['areYouSureYouWantTo'][locale.languageCode];
String get language => localizedValues['language'][locale.languageCode];
@ -37,48 +35,37 @@ class TranslationBase {
String get mobileNo => localizedValues['mobileNo'][locale.languageCode];
String get replySuccessfully =>
localizedValues['replySuccessfully'][locale.languageCode];
String get replySuccessfully => localizedValues['replySuccessfully'][locale.languageCode];
String get messagesScreenToolbarTitle =>
localizedValues['messagesScreenToolbarTitle'][locale.languageCode];
String get messagesScreenToolbarTitle => localizedValues['messagesScreenToolbarTitle'][locale.languageCode];
String get mySchedule => localizedValues['mySchedule'][locale.languageCode];
String get errorNoSchedule =>
localizedValues['errorNoSchedule'][locale.languageCode];
String get errorNoSchedule => localizedValues['errorNoSchedule'][locale.languageCode];
String get verify => localizedValues['verify'][locale.languageCode];
String get referralDoctor =>
localizedValues['referralDoctor'][locale.languageCode];
String get referralDoctor => localizedValues['referralDoctor'][locale.languageCode];
String get referringClinic =>
localizedValues['referringClinic'][locale.languageCode];
String get referringClinic => localizedValues['referringClinic'][locale.languageCode];
String get frequency => localizedValues['frequency'][locale.languageCode];
String get priority => localizedValues['priority'][locale.languageCode];
String get maxResponseTime =>
localizedValues['maxResponseTime'][locale.languageCode];
String get maxResponseTime => localizedValues['maxResponseTime'][locale.languageCode];
String get clinicDetailsandRemarks =>
localizedValues['clinicDetailsandRemarks'][locale.languageCode];
String get clinicDetailsandRemarks => localizedValues['clinicDetailsandRemarks'][locale.languageCode];
String get answerSuggestions =>
localizedValues['answerSuggestions'][locale.languageCode];
String get answerSuggestions => localizedValues['answerSuggestions'][locale.languageCode];
String get outPatients => localizedValues['outPatients'][locale.languageCode];
String get searchPatient =>
localizedValues['searchPatient'][locale.languageCode];
String get searchPatient => localizedValues['searchPatient'][locale.languageCode];
String get searchPatientDashBoard =>
localizedValues['searchPatientDashBoard'][locale.languageCode];
String get searchPatientDashBoard => localizedValues['searchPatientDashBoard'][locale.languageCode];
String get searchPatientName =>
localizedValues['searchPatient-name'][locale.languageCode];
String get searchPatientName => localizedValues['searchPatient-name'][locale.languageCode];
String get searchAbout => localizedValues['searchAbout'][locale.languageCode];
@ -88,11 +75,9 @@ class TranslationBase {
String get labResult => localizedValues['labResult'][locale.languageCode];
String get todayStatistics =>
localizedValues['todayStatistics'][locale.languageCode];
String get todayStatistics => localizedValues['todayStatistics'][locale.languageCode];
String get familyMedicine =>
localizedValues['familyMedicine'][locale.languageCode];
String get familyMedicine => localizedValues['familyMedicine'][locale.languageCode];
String get arrived => localizedValues['arrived'][locale.languageCode];
@ -112,36 +97,27 @@ class TranslationBase {
String get myInPatient => localizedValues['myInPatient'][locale.languageCode];
String get myInPatientTitle =>
localizedValues['myInPatientTitle'][locale.languageCode];
String get myInPatientTitle => localizedValues['myInPatientTitle'][locale.languageCode];
String get inPatientLabel =>
localizedValues['inPatientLabel'][locale.languageCode];
String get inPatientLabel => localizedValues['inPatientLabel'][locale.languageCode];
String get inPatientAll =>
localizedValues['inPatientAll'][locale.languageCode];
String get inPatientAll => localizedValues['inPatientAll'][locale.languageCode];
String get operations => localizedValues['operations'][locale.languageCode];
String get patientServices =>
localizedValues['patientServices'][locale.languageCode];
String get patientServices => localizedValues['patientServices'][locale.languageCode];
String get searchMedicine =>
localizedValues['searchMedicine'][locale.languageCode];
String get searchMedicine => localizedValues['searchMedicine'][locale.languageCode];
String get searchMedicineDashboard =>
localizedValues['searchMedicineDashboard'][locale.languageCode];
String get searchMedicineDashboard => localizedValues['searchMedicineDashboard'][locale.languageCode];
String get myReferralPatient =>
localizedValues['myReferralPatient'][locale.languageCode];
String get myReferralPatient => localizedValues['myReferralPatient'][locale.languageCode];
String get referPatient =>
localizedValues['referPatient'][locale.languageCode];
String get referPatient => localizedValues['referPatient'][locale.languageCode];
String get myReferral => localizedValues['myReferral'][locale.languageCode];
String get myReferredPatient =>
localizedValues['myReferredPatient'][locale.languageCode];
String get myReferredPatient => localizedValues['myReferredPatient'][locale.languageCode];
String get referredPatient =>
localizedValues['referredPatient'][locale.languageCode];
@ -150,18 +126,15 @@ class TranslationBase {
String get firstName => localizedValues['firstName'][locale.languageCode];
String get firstNameInAr =>
localizedValues['firstNameInAr'][locale.languageCode];
String get firstNameInAr => localizedValues['firstNameInAr'][locale.languageCode];
String get middleName => localizedValues['middleName'][locale.languageCode];
String get middleNameInAr =>
localizedValues['middleNameInAr'][locale.languageCode];
String get middleNameInAr => localizedValues['middleNameInAr'][locale.languageCode];
String get lastName => localizedValues['lastName'][locale.languageCode];
String get lastNameInAr =>
localizedValues['lastNameInAr'][locale.languageCode];
String get lastNameInAr => localizedValues['lastNameInAr'][locale.languageCode];
String get phoneNumber => localizedValues['phoneNumber'][locale.languageCode];
@ -171,23 +144,19 @@ class TranslationBase {
String get search => localizedValues['search'][locale.languageCode];
String get onlyArrivedPatient =>
localizedValues['onlyArrivedPatient'][locale.languageCode];
String get onlyArrivedPatient => localizedValues['onlyArrivedPatient'][locale.languageCode];
String get searchMedicineNameHere =>
localizedValues['searchMedicineNameHere'][locale.languageCode];
String get searchMedicineNameHere => localizedValues['searchMedicineNameHere'][locale.languageCode];
String get youCanFind => localizedValues['youCanFind'][locale.languageCode];
String get medicineSearchResult =>
localizedValues['medicineSearchResult'][locale.languageCode];
String get medicineSearchResult => localizedValues['medicineSearchResult'][locale.languageCode];
String get qr => localizedValues['qr'][locale.languageCode];
String get reader => localizedValues['reader'][locale.languageCode];
String get startScanning =>
localizedValues['startScanning'][locale.languageCode];
String get startScanning => localizedValues['startScanning'][locale.languageCode];
String get scanQrCode => localizedValues['scanQrCode'][locale.languageCode];
@ -199,21 +168,17 @@ class TranslationBase {
String get clinic => localizedValues['clinic'][locale.languageCode];
String get clinicSelect =>
localizedValues['clinicSelect'][locale.languageCode];
String get clinicSelect => localizedValues['clinicSelect'][locale.languageCode];
String get doctorSelect =>
localizedValues['doctorSelect'][locale.languageCode];
String get doctorSelect => localizedValues['doctorSelect'][locale.languageCode];
String get hospital => localizedValues['hospital'][locale.languageCode];
String get speciality => localizedValues['speciality'][locale.languageCode];
String get errorMessage =>
localizedValues['errorMessage'][locale.languageCode];
String get errorMessage => localizedValues['errorMessage'][locale.languageCode];
String get patientProfile =>
localizedValues['patientProfile'][locale.languageCode];
String get patientProfile => localizedValues['patientProfile'][locale.languageCode];
String get vitalSign => localizedValues['vitalSign'][locale.languageCode];
@ -229,18 +194,15 @@ class TranslationBase {
String get medicines => localizedValues['medicines'][locale.languageCode];
String get prescription =>
localizedValues['prescription'][locale.languageCode];
String get prescription => localizedValues['prescription'][locale.languageCode];
String get insuranceApprovals =>
localizedValues['insuranceApprovals'][locale.languageCode];
String get insuranceApprovals => localizedValues['insuranceApprovals'][locale.languageCode];
String get insurance => localizedValues['insurance'][locale.languageCode];
String get approvals => localizedValues['approvals'][locale.languageCode];
String get bodyMeasurements =>
localizedValues['bodyMeasurements'][locale.languageCode];
String get bodyMeasurements => localizedValues['bodyMeasurements'][locale.languageCode];
String get temperature => localizedValues['temperature'][locale.languageCode];
@ -248,34 +210,27 @@ class TranslationBase {
String get respiration => localizedValues['respiration'][locale.languageCode];
String get bloodPressure =>
localizedValues['bloodPressure'][locale.languageCode];
String get bloodPressure => localizedValues['bloodPressure'][locale.languageCode];
String get oxygenation => localizedValues['oxygenation'][locale.languageCode];
String get painScale => localizedValues['painScale'][locale.languageCode];
String get errorNoVitalSign =>
localizedValues['errorNoVitalSign'][locale.languageCode];
String get errorNoVitalSign => localizedValues['errorNoVitalSign'][locale.languageCode];
String get labOrders => localizedValues['labOrders'][locale.languageCode];
String get errorNoLabOrders =>
localizedValues['errorNoLabOrders'][locale.languageCode];
String get errorNoLabOrders => localizedValues['errorNoLabOrders'][locale.languageCode];
String get answerThePatient =>
localizedValues['answerThePatient'][locale.languageCode];
String get answerThePatient => localizedValues['answerThePatient'][locale.languageCode];
String get pleaseEnterAnswer =>
localizedValues['pleaseEnterAnswer'][locale.languageCode];
String get pleaseEnterAnswer => localizedValues['pleaseEnterAnswer'][locale.languageCode];
String get replay => localizedValues['replay'][locale.languageCode];
String get progressNote =>
localizedValues['progressNote'][locale.languageCode];
String get progressNote => localizedValues['progressNote'][locale.languageCode];
String get operationReports =>
localizedValues['operationReports'][locale.languageCode];
String get operationReports => localizedValues['operationReports'][locale.languageCode];
String get reports => localizedValues['reports'][locale.languageCode];
@ -287,15 +242,13 @@ class TranslationBase {
String get searchNote => localizedValues['searchNote'][locale.languageCode];
String get errorNoProgressNote =>
localizedValues['errorNoProgressNote'][locale.languageCode];
String get errorNoProgressNote => localizedValues['errorNoProgressNote'][locale.languageCode];
String get invoiceNo => localizedValues['invoiceNo:'][locale.languageCode];
String get orderNo => localizedValues['orderNo'][locale.languageCode];
String get generalResult =>
localizedValues['generalResult'][locale.languageCode];
String get generalResult => localizedValues['generalResult'][locale.languageCode];
String get description => localizedValues['description'][locale.languageCode];
@ -305,30 +258,23 @@ class TranslationBase {
String get enterId => localizedValues['enterId'][locale.languageCode];
String get pleaseEnterYourID =>
localizedValues['pleaseEnterYourID'][locale.languageCode];
String get pleaseEnterYourID => localizedValues['pleaseEnterYourID'][locale.languageCode];
String get enterPassword =>
localizedValues['enterPassword'][locale.languageCode];
String get enterPassword => localizedValues['enterPassword'][locale.languageCode];
String get pleaseEnterPassword =>
localizedValues['pleaseEnterPassword'][locale.languageCode];
String get pleaseEnterPassword => localizedValues['pleaseEnterPassword'][locale.languageCode];
String get selectYourProject =>
localizedValues['selectYourProject'][locale.languageCode];
String get selectYourProject => localizedValues['selectYourProject'][locale.languageCode];
String get pleaseEnterYourProject =>
localizedValues['pleaseEnterYourProject'][locale.languageCode];
String get pleaseEnterYourProject => localizedValues['pleaseEnterYourProject'][locale.languageCode];
String get login => localizedValues['login'][locale.languageCode];
String get drSulaimanAlHabib =>
localizedValues['drSulaimanAlHabib'][locale.languageCode];
String get drSulaimanAlHabib => localizedValues['drSulaimanAlHabib'][locale.languageCode];
String get welcomeTo => localizedValues['welcomeTo'][locale.languageCode];
String get welcomeBackTo =>
localizedValues['welcomeBackTo'][locale.languageCode];
String get welcomeBackTo => localizedValues['welcomeBackTo'][locale.languageCode];
String get home => localizedValues['home'][locale.languageCode];
@ -344,23 +290,19 @@ class TranslationBase {
String get whatsAppBy => localizedValues['whatsAppBy'][locale.languageCode];
String get pleaseChoose =>
localizedValues['pleaseChoose'][locale.languageCode];
String get pleaseChoose => localizedValues['pleaseChoose'][locale.languageCode];
String get choose => localizedValues['choose'][locale.languageCode];
String get verification =>
localizedValues['verification'][locale.languageCode];
String get verification => localizedValues['verification'][locale.languageCode];
String get firstStep => localizedValues['firstStep'][locale.languageCode];
String get yourAccount =>
localizedValues['yourAccount!'][locale.languageCode];
String get yourAccount => localizedValues['yourAccount!'][locale.languageCode];
String get verify1 => localizedValues['verify1'][locale.languageCode];
String get youWillReceiveA =>
localizedValues['youWillReceiveA'][locale.languageCode];
String get youWillReceiveA => localizedValues['youWillReceiveA'][locale.languageCode];
String get loginCode => localizedValues['loginCode'][locale.languageCode];
@ -1742,19 +1684,33 @@ class TranslationBase {
String get chart => localizedValues['chart'][locale.languageCode];
String get investigation =>
localizedValues['investigation'][locale.languageCode];
String get investigation => localizedValues['investigation'][locale.languageCode];
String get conditionOnDischarge =>
localizedValues['conditionOnDischarge'][locale.languageCode];
String get conditionOnDischarge => localizedValues['conditionOnDischarge'][locale.languageCode];
String get planedProcedure =>
localizedValues['planedProcedure'][locale.languageCode];
String get planedProcedure => localizedValues['planedProcedure'][locale.languageCode];
String get moreDetails => localizedValues['moreDetails'][locale.languageCode];
String get VTE_Type => localizedValues['VTE_Type'][locale.languageCode];
String get pharmacology => localizedValues['pharmacology'][locale.languageCode];
String get reasonsThrombo => localizedValues['reasonsThrombo'][locale.languageCode];
String get youDoNotHaveFavoritePrescription => localizedValues['youDoNotHaveFavoritePrescription'][locale.languageCode];
String get pleaseSelectItem => localizedValues['pleaseSelectItem'][locale.languageCode];
String get searchFavoriteTemplate => localizedValues['searchFavoriteTemplate'][locale.languageCode];
String get sorryNoMatch => localizedValues['sorryNoMatch'][locale.languageCode];
String get thousandIsTheMAXForTheStrength => localizedValues['thousandIsTheMAXForTheStrength'][locale.languageCode];
String get strengthCanNotBeZero => localizedValues['strengthCanNotBeZero'][locale.languageCode];
String get old => localizedValues['old'][locale.languageCode];
}
class TranslationBaseDelegate extends LocalizationsDelegate<TranslationBase> {

@ -1,166 +0,0 @@
import 'package:doctor_app_flutter/config/config.dart';
import 'package:doctor_app_flutter/core/model/patient/patient_model.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/shared/text_fields/app_text_form_field.dart';
import 'package:doctor_app_flutter/widgets/shared/user-guid/custom_validation_error.dart';
import 'package:flutter/material.dart';
import 'package:hexcolor/hexcolor.dart';
import 'package:intl/intl.dart';
class DynamicElements extends StatefulWidget {
final PatientModel _patientSearchFormValues;
final bool isFormSubmitted;
DynamicElements(this._patientSearchFormValues, this.isFormSubmitted);
@override
_DynamicElementsState createState() => _DynamicElementsState();
}
class _DynamicElementsState extends State<DynamicElements> {
TextEditingController _toDateController = new TextEditingController();
TextEditingController _fromDateController = new TextEditingController();
void _presentDatePicker(id) {
showDatePicker(
context: context,
initialDate: DateTime.now(),
firstDate: DateTime(2019),
lastDate: DateTime.now(),
).then((pickedDate) {
if (pickedDate == null) {
return;
}
setState(() {
print(id);
var selectedDate = DateFormat.yMd().format(pickedDate);
if (id == '_selectedFromDate') {
// _fromDateController.text = selectedDate;
selectedDate = pickedDate.year.toString() +
"-" +
pickedDate.month.toString().padLeft(2, '0') +
"-" +
pickedDate.day.toString().padLeft(2, '0');
_fromDateController.text = selectedDate;
} else {
selectedDate = pickedDate.year.toString() +
"-" +
pickedDate.month.toString().padLeft(2, '0') +
"-" +
pickedDate.day.toString().padLeft(2, '0');
_toDateController.text = selectedDate;
// _toDateController.text = selectedDate;
}
});
});
}
@override
Widget build(BuildContext context) {
final screenSize = MediaQuery.of(context).size;
InputDecoration textFieldSelectorDecoration(
{String hintText,
String selectedText,
bool isDropDown,
IconData icon}) {
return InputDecoration(
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0),
borderRadius: BorderRadius.circular(8),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0),
borderRadius: BorderRadius.circular(8),
),
disabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0),
borderRadius: BorderRadius.circular(8),
),
hintText: selectedText != null ? selectedText : hintText,
suffixIcon: isDropDown ? Icon(icon ?? Icons.arrow_drop_down) : null,
hintStyle: TextStyle(
fontSize: 14,
color: Colors.grey.shade600,
),
);
}
return LayoutBuilder(
builder: (ctx, constraints) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
SizedBox(
height: 10,
),
SizedBox(
height: 10,
),
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(6.0)),
border: Border.all(width: 1.0, color: HexColor("#CCCCCC"))),
padding: EdgeInsets.all(10),
child: AppTextFormField(
borderColor: Colors.white,
onTap: () => _presentDatePicker('_selectedFromDate'),
hintText: TranslationBase.of(context).fromDate,
controller: _fromDateController,
inputFormatter: ONLY_DATE,
onSaved: (value) {
if (_fromDateController.text.toString().trim().isEmpty) {
widget._patientSearchFormValues.From = "0";
} else {
widget._patientSearchFormValues.From =
_fromDateController.text.replaceAll("/", "-");
}
},
readOnly: true,
)),
SizedBox(
height: 5,
),
if (widget._patientSearchFormValues.From == "0" &&
widget.isFormSubmitted)
CustomValidationError(),
SizedBox(
height: 10,
),
Container(
decoration: BoxDecoration(
border: Border.all(width: 1.0, color: HexColor("#CCCCCC")),
borderRadius: BorderRadius.all(Radius.circular(6.0))),
padding: EdgeInsets.all(10),
child: AppTextFormField(
readOnly: true,
borderColor: Colors.white,
hintText: TranslationBase.of(context).toDate,
controller: _toDateController,
onTap: () {
_presentDatePicker('_selectedToDate');
},
inputFormatter: ONLY_DATE,
onSaved: (value) {
if (_toDateController.text.toString().trim().isEmpty) {
widget._patientSearchFormValues.To = "0";
} else {
widget._patientSearchFormValues.To =
_toDateController.text.replaceAll("/", "-");
}
},
)),
if (widget._patientSearchFormValues.To == "0" &&
widget.isFormSubmitted)
CustomValidationError(),
SizedBox(
height: 10,
),
],
);
},
);
}
}

@ -102,7 +102,7 @@ class ProfileMedicalInfoWidget extends StatelessWidget {
patient: patient,
patientType: patientType,
arrivalType: arrivalType,
route: ORDER_PRESCRIPTION_NEW,
route: ORDER_PRESCRIPTION_OLD,
nameLine1: TranslationBase.of(context).orders,
nameLine2: TranslationBase.of(context).prescription,
icon: 'assets/images/svgs/profile_screen/order prescription.svg'),

@ -70,6 +70,15 @@ class ProfileMedicalInfoWidgetInPatient extends StatelessWidget {
nameLine1: TranslationBase.of(context).radiology,
nameLine2: TranslationBase.of(context).result,
icon: 'assets/images/svgs/profile_screen/health summary.svg'),
PatientProfileButton(
key: key,
patient: patient,
patientType: patientType,
arrivalType: arrivalType,
route: ORDER_PRESCRIPTION_OLD,
nameLine1: TranslationBase.of(context).patient,
nameLine2:TranslationBase.of(context).prescription + ' (${TranslationBase.of(context).old})',
icon: 'assets/images/svgs/profile_screen/order prescription.svg'),
PatientProfileButton(
key: key,
patient: patient,

@ -114,7 +114,7 @@ class ProfileMedicalInfoWidgetSearch extends StatelessWidget {
patient: patient,
patientType: patientType,
arrivalType: arrivalType,
route: ORDER_PRESCRIPTION_NEW,
route: ORDER_PRESCRIPTION_OLD,
nameLine1: TranslationBase.of(context).orders,
nameLine2: TranslationBase.of(context).prescription,
icon:

@ -2,6 +2,8 @@ import 'package:doctor_app_flutter/util/helpers.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:flutter/material.dart';
import '../../../config/config.dart';
class ListSelectDialog extends StatefulWidget {
final List<dynamic> list;
final String attributeName;
@ -44,7 +46,6 @@ class _ListSelectDialogState extends State<ListSelectDialog> {
}
showAlertDialog(BuildContext context) {
// set up the buttons
Widget cancelButton = FlatButton(
child: Text(TranslationBase.of(context).cancel),
onPressed: () {
@ -56,9 +57,7 @@ class _ListSelectDialogState extends State<ListSelectDialog> {
Navigator.of(context).pop();
this.widget.okFunction(widget.selectedValue);
});
// set up the AlertDialog
AlertDialog alert = AlertDialog(
// title: Text(widget.title),
content: createDialogList(),
actions: [
cancelButton,
@ -104,7 +103,7 @@ class _ListSelectDialogState extends State<ListSelectDialog> {
.selectedValue[widget.attributeValueId]
.toString(),
value: item[widget.attributeValueId].toString(),
activeColor: Colors.blue.shade700,
activeColor: AppGlobal.appRedColor,
selected: item[widget.attributeValueId]
.toString() ==
widget.selectedValue[widget.attributeValueId]

@ -3,11 +3,14 @@ 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:doctor_app_flutter/widgets/shared/user-guid/CusomRow.dart';
import 'package:eva_icons_flutter/eva_icons_flutter.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import '../../config/size_config.dart';
class DoctorCard extends StatelessWidget {
final String doctorName;
final String branch;
@ -140,43 +143,22 @@ class DoctorCard extends StatelessWidget {
],
),
if (clinic != null)
Row(
crossAxisAlignment:
CrossAxisAlignment.start,
children: <Widget>[
AppText(
TranslationBase.of(context).clinic +
": ",
color: Colors.grey[500],
fontSize: 14,
),
Expanded(
child: AppText(
clinic,
fontSize: 14,
),
)
],
CustomRow(
label: TranslationBase.of(context).clinic +
": ",
value: clinic,
valueSize: 13,
labelSize: 13,
),
if (branch != null)
Row(
crossAxisAlignment:
CrossAxisAlignment.start,
children: <Widget>[
AppText(
TranslationBase.of(context).branch +
": ",
fontSize: 14,
color: Colors.grey[500],
),
Expanded(
child: AppText(
branch,
fontSize: 14,
),
)
],
)
CustomRow(
label: TranslationBase.of(context).branch +
": ",
value: branch,
valueSize: 13,
labelSize: 13,
),
]),
),
),

@ -9,6 +9,8 @@ import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import '../../config/config.dart';
class DoctorCardInsurance extends StatelessWidget {
final String doctorName;
final String approvalNo;
@ -63,7 +65,7 @@ class DoctorCardInsurance extends StatelessWidget {
),
color: approvalStatus == "Approved" ||
approvalStatus == "تمت الموافقة"
? Color(0xff359846)
? AppGlobal.appGreenColor
: Color(0xffD02127),
),
),
@ -84,7 +86,7 @@ class DoctorCardInsurance extends StatelessWidget {
"$approvalStatus",
color: approvalStatus == "Approved" ||
approvalStatus == "تمت الموافقة"
? Color(0xff359846)
? AppGlobal.appGreenColor
: Color(0xffD02127),
letterSpacing: -0.4,
fontSize:

@ -18,7 +18,7 @@ class AppTextFieldCustomSearch extends StatelessWidget {
this.inputFormatters,
this.searchController,
this.onFieldSubmitted,
this.hintText,
this.hintText, this.height,
});
final TextEditingController searchController;
@ -34,6 +34,8 @@ class AppTextFieldCustomSearch extends StatelessWidget {
final TextInputType inputType;
final List<TextInputFormatter> inputFormatters;
final double height;
@override
Widget build(BuildContext context) {
@ -43,6 +45,7 @@ class AppTextFieldCustomSearch extends StatelessWidget {
child: Stack(
children: [
AppTextFieldCustom(
height: height??0,
hintText:
hintText ?? TranslationBase.of(context).searchPatientName,
isTextFieldHasSuffix: true,

@ -134,7 +134,7 @@ class _HtmlRichEditorState extends State<HtmlRichEditor> {
}
void statusListener(String status) {
recognizedWord = status == 'listening' ? 'Lisening...' : 'Sorry....';
recognizedWord = status == 'listening' ? 'Listening...' : 'Sorry....';
}
void requestPermissions() async {

@ -1,237 +0,0 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:hexcolor/hexcolor.dart';
class NumberTextInputFormatter extends TextInputFormatter {
@override
TextEditingValue formatEditUpdate(
TextEditingValue oldValue, TextEditingValue newValue) {
final int newTextLength = newValue.text.length;
int selectionIndex = newValue.selection.end;
int usedSubstringIndex = 0;
final StringBuffer newText = StringBuffer();
if (newTextLength >= 1) {
newText.write('(');
if (newValue.selection.end >= 1) selectionIndex++;
}
if (newTextLength >= 4) {
newText.write(newValue.text.substring(0, usedSubstringIndex = 3) + ') ');
if (newValue.selection.end >= 3) selectionIndex += 2;
}
if (newTextLength >= 7) {
newText.write(newValue.text.substring(3, usedSubstringIndex = 6) + '-');
if (newValue.selection.end >= 6) selectionIndex++;
}
if (newTextLength >= 11) {
newText.write(newValue.text.substring(6, usedSubstringIndex = 10) + ' ');
if (newValue.selection.end >= 10) selectionIndex++;
}
// Dump the rest.
if (newTextLength >= usedSubstringIndex)
newText.write(newValue.text.substring(usedSubstringIndex));
return TextEditingValue(
text: newText.toString(),
selection: TextSelection.collapsed(offset: selectionIndex),
);
}
}
final _mobileFormatter = NumberTextInputFormatter();
class NewTextFields extends StatefulWidget {
NewTextFields(
{Key key,
this.type,
this.hintText,
this.suffixIcon,
this.autoFocus,
this.onChanged,
this.initialValue,
this.minLines,
this.maxLines,
this.inputFormatters,
this.padding,
this.focus = false,
this.maxLengthEnforced = true,
this.suffixIconColor,
this.inputAction,
this.onSubmit,
this.keepPadding = true,
this.textCapitalization = TextCapitalization.none,
this.controller,
this.keyboardType,
this.validator,
this.borderOnlyError = false,
this.onSaved,
this.onSuffixTap,
this.readOnly: false,
this.maxLength,
this.prefixIcon,
this.bare = false,
this.onTap,
this.fontSize = 15.0,
this.fontWeight = FontWeight.w500,
this.autoValidate = false,
this.hintColor,
this.isEnabled = true})
: super(key: key);
final String hintText;
// final String initialValue;
final String type;
final bool autoFocus;
final IconData suffixIcon;
final Color suffixIconColor;
final Icon prefixIcon;
final VoidCallback onTap;
final TextEditingController controller;
final TextInputType keyboardType;
final FormFieldValidator validator;
final Function onSaved;
final Function onSuffixTap;
final Function onChanged;
final Function onSubmit;
final bool readOnly;
final int maxLength;
final int minLines;
final int maxLines;
final bool maxLengthEnforced;
final bool bare;
final bool isEnabled;
final TextInputAction inputAction;
final double fontSize;
final FontWeight fontWeight;
final bool keepPadding;
final TextCapitalization textCapitalization;
final List<TextInputFormatter> inputFormatters;
final bool autoValidate;
final EdgeInsets padding;
final bool focus;
final bool borderOnlyError;
final Color hintColor;
final String initialValue;
@override
_NewTextFieldsState createState() => _NewTextFieldsState();
}
class _NewTextFieldsState extends State<NewTextFields> {
final FocusNode _focusNode = FocusNode();
bool focus = false;
bool view = false;
@override
void initState() {
super.initState();
_focusNode.addListener(() {
setState(() {
focus = _focusNode.hasFocus;
});
});
}
@override
void didUpdateWidget(NewTextFields oldWidget) {
if (widget.focus) _focusNode.requestFocus();
super.didUpdateWidget(oldWidget);
}
@override
void dispose() {
_focusNode.dispose();
super.dispose();
}
bool _determineReadOnly() {
if (widget.readOnly != null && widget.readOnly) {
_focusNode.unfocus();
return true;
} else {
return false;
}
}
@override
Widget build(BuildContext context) {
return AnimatedContainer(
duration: Duration(milliseconds: 300),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12),
border: Border.all(color: HexColor('#707070'), width: 0.30),
color: Colors.white),
child: Container(
margin: EdgeInsets.only(top: 8),
padding: EdgeInsets.only(top: 8),
child: TextFormField(
enabled: widget.isEnabled,
initialValue: widget.initialValue,
keyboardAppearance: Theme.of(context).brightness,
scrollPhysics: BouncingScrollPhysics(),
// autovalidate: widget.autoValidate,
textCapitalization: widget.textCapitalization,
onFieldSubmitted: widget.inputAction == TextInputAction.next
? (widget.onSubmit != null
? widget.onSubmit
: (val) {
_focusNode.nextFocus();
})
: widget.onSubmit,
textInputAction: widget.inputAction,
minLines: widget.minLines ?? 1,
maxLines: widget.maxLines ?? 1,
maxLengthEnforced: widget.maxLengthEnforced,
onChanged: widget.onChanged,
focusNode: _focusNode,
maxLength: widget.maxLength ?? null,
controller: widget.controller,
keyboardType: widget.keyboardType,
readOnly: _determineReadOnly(),
obscureText: widget.type == "password" && !view ? true : false,
autofocus: widget.autoFocus ?? false,
validator: widget.validator,
onSaved: widget.onSaved,
style: Theme.of(context).textTheme.bodyText1.copyWith(
fontSize: widget.fontSize,
fontWeight: widget.fontWeight,
color: Color(0xFF575757),
fontFamily: 'Poppins'),
inputFormatters: widget.keyboardType == TextInputType.phone
? <TextInputFormatter>[
// WhitelistingTextInputFormatter.digitsOnly,
_mobileFormatter,
]
: widget.inputFormatters,
decoration: InputDecoration(
labelText: widget.hintText,
labelStyle: TextStyle(
color: Color(0xFF2E303A),
fontSize: 15,
fontWeight: FontWeight.w700),
errorBorder: OutlineInputBorder(
borderSide: BorderSide(
color: Theme.of(context).errorColor.withOpacity(0.5),
width: 1.0),
borderRadius: BorderRadius.circular(12.0)),
focusedErrorBorder: OutlineInputBorder(
borderSide: BorderSide(
color: Theme.of(context).errorColor.withOpacity(0.5),
width: 1.0),
borderRadius: BorderRadius.circular(8.0)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.white, width: 1.0),
borderRadius: BorderRadius.circular(12)),
disabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.white, width: 1.0),
borderRadius: BorderRadius.circular(12)),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.white, width: 1.0),
borderRadius: BorderRadius.circular(12),
),
),
),
),
);
}
}

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save