diff --git a/lib/client/base_app_client.dart b/lib/client/base_app_client.dart index 83923ea7..3a39c5e9 100644 --- a/lib/client/base_app_client.dart +++ b/lib/client/base_app_client.dart @@ -42,6 +42,8 @@ class BaseAppClient { DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile); if (body['DoctorID'] == null) body['DoctorID'] = doctorProfile?.doctorID; + if (body['DoctorID'] == "") + body['DoctorID'] = null; body['EditedBy'] = doctorProfile?.doctorID; if (body['ProjectID'] == null) { body['ProjectID'] = doctorProfile?.projectID; diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 254bca19..3048a39d 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -521,4 +521,19 @@ const Map> localizedValues = { }, 'fromTime': {'en': "From Time", 'ar': "من وقت"}, 'toTime': {'en': "To Time", 'ar': "الى وقت"}, + 'diagnoseType': {'en': "Diagnose Type", 'ar': "نوع التشخيص"}, + 'condition': {'en': "Condition", 'ar': "الحالة"}, + 'id': {'en': "ID", 'ar': "بطاقة هوية"}, + 'quantity': {'en': "Quantity", 'ar': "الكمية"}, + 'codeNo': {'en': "Code #", 'ar': "# الرمز"}, + 'covered': {'en': "Covered", 'ar': "مغطى"}, + 'approvalRequired': {'en': "Approval Required", 'ar': "الموافقة مطلوبة"}, + 'uncoveredByDoctor': { + 'en': "Uncovered By Doctor", + 'ar': "غير مغطى من قبل الدكتور" + }, + 'chiefComplaintEmptyMsg': { + 'en': "There is no Chief Complaint", + 'ar': "ليس هناك شكوى رئيس" + }, }; diff --git a/lib/core/model/medical_file_model.dart b/lib/core/model/medical_file_model.dart index 0496d0eb..4e9d8f3e 100644 --- a/lib/core/model/medical_file_model.dart +++ b/lib/core/model/medical_file_model.dart @@ -1,9 +1,8 @@ class MedicalFileModel { List entityList; - int rowcount; - Null statusMessage; + dynamic statusMessage; - MedicalFileModel({this.entityList, this.rowcount, this.statusMessage}); + MedicalFileModel({this.entityList, this.statusMessage}); MedicalFileModel.fromJson(Map json) { if (json['entityList'] != null) { @@ -12,7 +11,6 @@ class MedicalFileModel { entityList.add(new EntityList.fromJson(v)); }); } - rowcount = json['rowcount']; statusMessage = json['statusMessage']; } @@ -21,57 +19,17 @@ class MedicalFileModel { if (this.entityList != null) { data['entityList'] = this.entityList.map((v) => v.toJson()).toList(); } - data['rowcount'] = this.rowcount; data['statusMessage'] = this.statusMessage; return data; } } class EntityList { - List admissions; - ClinicalSummary clinicalSummary; - List doctorWisePatientEpisodes; - List procedures; - List lstAllEpisodes; List timelines; - EntityList( - {this.admissions, - this.clinicalSummary, - this.doctorWisePatientEpisodes, - this.procedures, - this.lstAllEpisodes, - this.timelines}); + EntityList({this.timelines}); EntityList.fromJson(Map json) { - if (json['Admissions'] != null) { - admissions = new List(); - json['Admissions'].forEach((v) { - admissions.add(new Admissions.fromJson(v)); - }); - } - clinicalSummary = json['ClinicalSummary'] != null - ? new ClinicalSummary.fromJson(json['ClinicalSummary']) - : null; - if (json['DoctorWisePatientEpisodes'] != null) { - doctorWisePatientEpisodes = new List(); - json['DoctorWisePatientEpisodes'].forEach((v) { - doctorWisePatientEpisodes - .add(new DoctorWisePatientEpisodes.fromJson(v)); - }); - } - if (json['Procedures'] != null) { - procedures = new List(); - json['Procedures'].forEach((v) { - procedures.add(new Procedures.fromJson(v)); - }); - } - if (json['lstAllEpisodes'] != null) { - lstAllEpisodes = new List(); - json['lstAllEpisodes'].forEach((v) { - lstAllEpisodes.add(new LstAllEpisodes.fromJson(v)); - }); - } if (json['Timelines'] != null) { timelines = new List(); json['Timelines'].forEach((v) { @@ -82,23 +40,6 @@ class EntityList { Map toJson() { final Map data = new Map(); - if (this.admissions != null) { - data['Admissions'] = this.admissions.map((v) => v.toJson()).toList(); - } - if (this.clinicalSummary != null) { - data['ClinicalSummary'] = this.clinicalSummary.toJson(); - } - if (this.doctorWisePatientEpisodes != null) { - data['DoctorWisePatientEpisodes'] = - this.doctorWisePatientEpisodes.map((v) => v.toJson()).toList(); - } - if (this.procedures != null) { - data['Procedures'] = this.procedures.map((v) => v.toJson()).toList(); - } - if (this.lstAllEpisodes != null) { - data['lstAllEpisodes'] = - this.lstAllEpisodes.map((v) => v.toJson()).toList(); - } if (this.timelines != null) { data['Timelines'] = this.timelines.map((v) => v.toJson()).toList(); } @@ -106,89 +47,45 @@ class EntityList { } } -class Admissions { - String admissionDate; - int admissionNo; - String clinic; - String doctor; - int projectID; - String projectName; - String setupID; - List lstDischargeDiag; - - Admissions( - {this.admissionDate, - this.admissionNo, - this.clinic, - this.doctor, - this.projectID, - this.projectName, - this.setupID, - this.lstDischargeDiag}); - - Admissions.fromJson(Map json) { - admissionDate = json['AdmissionDate']; - admissionNo = json['AdmissionNo']; - clinic = json['Clinic']; - doctor = json['Doctor']; - projectID = json['ProjectID']; - projectName = json['ProjectName']; - setupID = json['SetupID']; - if (json['lstDischargeDiag'] != null) { - lstDischargeDiag = new List(); - json['lstDischargeDiag'].forEach((v) { - lstDischargeDiag.add(new LstDischargeDiag.fromJson(v)); - }); - } - } - - Map toJson() { - final Map data = new Map(); - data['AdmissionDate'] = this.admissionDate; - data['AdmissionNo'] = this.admissionNo; - data['Clinic'] = this.clinic; - data['Doctor'] = this.doctor; - data['ProjectID'] = this.projectID; - data['ProjectName'] = this.projectName; - data['SetupID'] = this.setupID; - if (this.lstDischargeDiag != null) { - data['lstDischargeDiag'] = - this.lstDischargeDiag.map((v) => v.toJson()).toList(); - } - return data; - } -} - -class LstDischargeDiag { - int admissionNo; - String codeID; - String description; - int dischargeNo; +class Timelines { + int clinicId; + String clinicName; + String date; + int doctorId; + String doctorImage; + String doctorName; + int encounterNumber; + String encounterType; int projectID; String projectName; - String remarks; String setupID; List timeLineEvents; - LstDischargeDiag( - {this.admissionNo, - this.codeID, - this.description, - this.dischargeNo, + Timelines( + {this.clinicId, + this.clinicName, + this.date, + this.doctorId, + this.doctorImage, + this.doctorName, + this.encounterNumber, + this.encounterType, this.projectID, this.projectName, - this.remarks, this.setupID, this.timeLineEvents}); - LstDischargeDiag.fromJson(Map json) { - admissionNo = json['AdmissionNo']; - codeID = json['CodeID']; - description = json['Description']; - dischargeNo = json['DischargeNo']; + Timelines.fromJson(Map json) { + clinicId = json['ClinicId']; + clinicName = json['ClinicName']; + date = json['Date']; + doctorId = json['DoctorId']; + doctorImage = json['DoctorImage']; + doctorName = json['DoctorName']; + encounterNumber = json['EncounterNumber']; + encounterType = json['EncounterType']; projectID = json['ProjectID']; projectName = json['ProjectName']; - remarks = json['Remarks']; setupID = json['SetupID']; if (json['TimeLineEvents'] != null) { timeLineEvents = new List(); @@ -200,13 +97,16 @@ class LstDischargeDiag { Map toJson() { final Map data = new Map(); - data['AdmissionNo'] = this.admissionNo; - data['CodeID'] = this.codeID; - data['Description'] = this.description; - data['DischargeNo'] = this.dischargeNo; + data['ClinicId'] = this.clinicId; + data['ClinicName'] = this.clinicName; + data['Date'] = this.date; + data['DoctorId'] = this.doctorId; + data['DoctorImage'] = this.doctorImage; + data['DoctorName'] = this.doctorName; + data['EncounterNumber'] = this.encounterNumber; + data['EncounterType'] = this.encounterType; data['ProjectID'] = this.projectID; data['ProjectName'] = this.projectName; - data['Remarks'] = this.remarks; data['SetupID'] = this.setupID; if (this.timeLineEvents != null) { data['TimeLineEvents'] = @@ -219,659 +119,32 @@ class LstDischargeDiag { class TimeLineEvents { List admissions; String colorClass; - List consulations; - String disPlayName; - Null doctorName; - ERData eRData; - int eventId; - String fullName; - String iconClass; - bool isDisabled; - List labOrders; - List radReports; - String toolTip; + List consulations; - TimeLineEvents( - {this.admissions, - this.colorClass, - this.consulations, - this.disPlayName, - this.doctorName, - this.eRData, - this.eventId, - this.fullName, - this.iconClass, - this.isDisabled, - this.labOrders, - this.radReports, - this.toolTip}); + TimeLineEvents({this.admissions, this.colorClass, this.consulations}); TimeLineEvents.fromJson(Map json) { - // if (json['Admissions'] != null) { - // admissions = new List(); - // json['Admissions'].forEach((v) { - // admissions.add(new Null.fromJson(v)); - // }); - // } - // colorClass = json['ColorClass']; - // if (json['Consulations'] != null) { - // consulations = new List(); - // json['Consulations'].forEach((v) { - // consulations.add(new Null.fromJson(v)); - // }); - // } - disPlayName = json['DisPlayName']; - doctorName = json['DoctorName']; - eRData = - json['ERData'] != null ? new ERData.fromJson(json['ERData']) : null; - eventId = json['EventId']; - fullName = json['FullName']; - iconClass = json['IconClass']; - isDisabled = json['IsDisabled']; - // if (json['LabOrders'] != null) { - // labOrders = new List(); - // json['LabOrders'].forEach((v) { - // labOrders.add(new Null.fromJson(v)); - // }); - // } - // if (json['RadReports'] != null) { - // radReports = new List(); - // json['RadReports'].forEach((v) { - // radReports.add(new Null.fromJson(v)); - // }); - // } - toolTip = json['ToolTip']; - } - - Map toJson() { - final Map data = new Map(); - // if (this.admissions != null) { - // data['Admissions'] = this.admissions.map((v) => v.toJson()).toList(); - // } - // data['ColorClass'] = this.colorClass; - // if (this.consulations != null) { - // data['Consulations'] = this.consulations.map((v) => v.toJson()).toList(); - // } - data['DisPlayName'] = this.disPlayName; - data['DoctorName'] = this.doctorName; - if (this.eRData != null) { - data['ERData'] = this.eRData.toJson(); - } - data['EventId'] = this.eventId; - data['FullName'] = this.fullName; - data['IconClass'] = this.iconClass; - data['IsDisabled'] = this.isDisabled; - // if (this.labOrders != null) { - // data['LabOrders'] = this.labOrders.map((v) => v.toJson()).toList(); - // } - // if (this.radReports != null) { - // data['RadReports'] = this.radReports.map((v) => v.toJson()).toList(); - // } - data['ToolTip'] = this.toolTip; - return data; - } -} - -class ERData { - List admissions; - List consulations; - List labOrders; - List radReports; - List lstErDischargeSummary; - - ERData( - {this.admissions, - this.consulations, - this.labOrders, - this.radReports, - this.lstErDischargeSummary}); - - ERData.fromJson(Map json) { - // if (json['Admissions'] != null) { - // admissions = new List(); - // json['Admissions'].forEach((v) { - // admissions.add(new Null.fromJson(v)); - // }); - // } - // if (json['Consulations'] != null) { - // consulations = new List(); - // json['Consulations'].forEach((v) { - // consulations.add(new Null.fromJson(v)); - // }); - // } - // if (json['LabOrders'] != null) { - // labOrders = new List(); - // json['LabOrders'].forEach((v) { - // labOrders.add(new Null.fromJson(v)); - // }); - // } - // if (json['RadReports'] != null) { - // radReports = new List(); - // json['RadReports'].forEach((v) { - // radReports.add(new Null.fromJson(v)); - // }); - // } - // if (json['lstErDischargeSummary'] != null) { - // lstErDischargeSummary = new List(); - // json['lstErDischargeSummary'].forEach((v) { - // lstErDischargeSummary.add(new Null.fromJson(v)); - // }); - // } - } - - Map toJson() { - final Map data = new Map(); - // if (this.admissions != null) { - // data['Admissions'] = this.admissions.map((v) => v.toJson()).toList(); - // } - // if (this.consulations != null) { - // data['Consulations'] = this.consulations.map((v) => v.toJson()).toList(); - // } - // if (this.labOrders != null) { - // data['LabOrders'] = this.labOrders.map((v) => v.toJson()).toList(); - // } - // if (this.radReports != null) { - // data['RadReports'] = this.radReports.map((v) => v.toJson()).toList(); - // } - // if (this.lstErDischargeSummary != null) { - // data['lstErDischargeSummary'] = - // this.lstErDischargeSummary.map((v) => v.toJson()).toList(); - // } - return data; - } -} - -class ClinicalSummary { - List labAbnormalResults; - List lstAllergy; - List lstComplaintsDetail; - List lstDiagnosis; - List lstEncounterHistory; - List lstMedication; - List lstPastHistory; - - ClinicalSummary( - {this.labAbnormalResults, - this.lstAllergy, - this.lstComplaintsDetail, - this.lstDiagnosis, - this.lstEncounterHistory, - this.lstMedication, - this.lstPastHistory}); - - ClinicalSummary.fromJson(Map json) { - if (json['LabAbnormalResults'] != null) { - labAbnormalResults = new List(); - json['LabAbnormalResults'].forEach((v) { - labAbnormalResults.add(new LabAbnormalResults.fromJson(v)); - }); - } - if (json['lstAllergy'] != null) { - lstAllergy = new List(); - json['lstAllergy'].forEach((v) { - lstAllergy.add(new LstAllergy.fromJson(v)); - }); - } - if (json['lstComplaintsDetail'] != null) { - lstComplaintsDetail = new List(); - json['lstComplaintsDetail'].forEach((v) { - lstComplaintsDetail.add(new LstComplaintsDetail.fromJson(v)); - }); - } - if (json['lstDiagnosis'] != null) { - lstDiagnosis = new List(); - json['lstDiagnosis'].forEach((v) { - lstDiagnosis.add(new LstDiagnosis.fromJson(v)); - }); - } - if (json['lstEncounterHistory'] != null) { - lstEncounterHistory = new List(); - json['lstEncounterHistory'].forEach((v) { - lstEncounterHistory.add(new LstEncounterHistory.fromJson(v)); - }); - } - if (json['lstMedication'] != null) { - lstMedication = new List(); - json['lstMedication'].forEach((v) { - lstMedication.add(new LstMedication.fromJson(v)); + colorClass = json['ColorClass']; + if (json['Consulations'] != null) { + consulations = new List(); + json['Consulations'].forEach((v) { + consulations.add(new Consulations.fromJson(v)); }); } - if (json['lstPastHistory'] != null) { - lstPastHistory = new List(); - json['lstPastHistory'].forEach((v) { - lstPastHistory.add(new LstPastHistory.fromJson(v)); - }); - } - } - - Map toJson() { - final Map data = new Map(); - if (this.labAbnormalResults != null) { - data['LabAbnormalResults'] = - this.labAbnormalResults.map((v) => v.toJson()).toList(); - } - if (this.lstAllergy != null) { - data['lstAllergy'] = this.lstAllergy.map((v) => v.toJson()).toList(); - } - if (this.lstComplaintsDetail != null) { - data['lstComplaintsDetail'] = - this.lstComplaintsDetail.map((v) => v.toJson()).toList(); - } - if (this.lstDiagnosis != null) { - data['lstDiagnosis'] = this.lstDiagnosis.map((v) => v.toJson()).toList(); - } - if (this.lstEncounterHistory != null) { - data['lstEncounterHistory'] = - this.lstEncounterHistory.map((v) => v.toJson()).toList(); - } - if (this.lstMedication != null) { - data['lstMedication'] = - this.lstMedication.map((v) => v.toJson()).toList(); - } - if (this.lstPastHistory != null) { - data['lstPastHistory'] = - this.lstPastHistory.map((v) => v.toJson()).toList(); - } - return data; - } -} - -class LabAbnormalResults { - String createdOn; - String description; - bool isPackage; - int orderNo; - int packageID; - String packageName; - int projectID; - String projectName; - String referenceRange; - double referenceRangeLow; - double referenceRangeHigh; - String resultCriticalFlag; - String resultValue; - String resultValueFlag; - String setupID; - String testCode; - int testID; - String verifiedOn; - bool isAbnormal; - bool isCritical; - String unit; - - LabAbnormalResults( - {this.createdOn, - this.description, - this.isPackage, - this.orderNo, - this.packageID, - this.packageName, - this.projectID, - this.projectName, - this.referenceRange, - this.referenceRangeLow, - this.referenceRangeHigh, - this.resultCriticalFlag, - this.resultValue, - this.resultValueFlag, - this.setupID, - this.testCode, - this.testID, - this.verifiedOn, - this.isAbnormal, - this.isCritical, - this.unit}); - - LabAbnormalResults.fromJson(Map json) { - createdOn = json['CreatedOn']; - description = json['Description']; - isPackage = json['IsPackage']; - orderNo = json['OrderNo']; - packageID = json['PackageID']; - packageName = json['PackageName']; - projectID = json['ProjectID']; - projectName = json['ProjectName']; - referenceRange = json['ReferenceRange']; - referenceRangeLow = json['ReferenceRange_Low']; - referenceRangeHigh = json['ReferenceRange_high']; - resultCriticalFlag = json['ResultCriticalFlag']; - resultValue = json['ResultValue']; - resultValueFlag = json['ResultValueFlag']; - setupID = json['SetupID']; - testCode = json['TestCode']; - testID = json['TestID']; - verifiedOn = json['VerifiedOn']; - isAbnormal = json['isAbnormal']; - isCritical = json['isCritical']; - unit = json['unit']; - } - - Map toJson() { - final Map data = new Map(); - data['CreatedOn'] = this.createdOn; - data['Description'] = this.description; - data['IsPackage'] = this.isPackage; - data['OrderNo'] = this.orderNo; - data['PackageID'] = this.packageID; - data['PackageName'] = this.packageName; - data['ProjectID'] = this.projectID; - data['ProjectName'] = this.projectName; - data['ReferenceRange'] = this.referenceRange; - data['ReferenceRange_Low'] = this.referenceRangeLow; - data['ReferenceRange_high'] = this.referenceRangeHigh; - data['ResultCriticalFlag'] = this.resultCriticalFlag; - data['ResultValue'] = this.resultValue; - data['ResultValueFlag'] = this.resultValueFlag; - data['SetupID'] = this.setupID; - data['TestCode'] = this.testCode; - data['TestID'] = this.testID; - data['VerifiedOn'] = this.verifiedOn; - data['isAbnormal'] = this.isAbnormal; - data['isCritical'] = this.isCritical; - data['unit'] = this.unit; - return data; - } -} - -class LstAllergy { - String allergy; - int projectID; - String projectName; - String setupID; - - LstAllergy({this.allergy, this.projectID, this.projectName, this.setupID}); - - LstAllergy.fromJson(Map json) { - allergy = json['Allergy']; - projectID = json['ProjectID']; - projectName = json['ProjectName']; - setupID = json['SetupID']; } Map toJson() { final Map data = new Map(); - data['Allergy'] = this.allergy; - data['ProjectID'] = this.projectID; - data['ProjectName'] = this.projectName; - data['SetupID'] = this.setupID; - return data; - } -} - -class LstComplaintsDetail { - String cCDate; - String createdBy; - String plainChiefComplaint; - int projectID; - String projectName; - String setupID; - String rtfChiefComplaint; - - LstComplaintsDetail( - {this.cCDate, - this.createdBy, - this.plainChiefComplaint, - this.projectID, - this.projectName, - this.setupID, - this.rtfChiefComplaint}); - - LstComplaintsDetail.fromJson(Map json) { - cCDate = json['CCDate']; - createdBy = json['CreatedBy']; - plainChiefComplaint = json['PlainChiefComplaint']; - projectID = json['ProjectID']; - projectName = json['ProjectName']; - setupID = json['SetupID']; - rtfChiefComplaint = json['rtfChiefComplaint']; - } - - Map toJson() { - final Map data = new Map(); - data['CCDate'] = this.cCDate; - data['CreatedBy'] = this.createdBy; - data['PlainChiefComplaint'] = this.plainChiefComplaint; - data['ProjectID'] = this.projectID; - data['ProjectName'] = this.projectName; - data['SetupID'] = this.setupID; - data['rtfChiefComplaint'] = this.rtfChiefComplaint; - return data; - } -} - -class LstDiagnosis { - String diagnosis; - int projectID; - String projectName; - String setupID; - String state; - String status; - - LstDiagnosis( - {this.diagnosis, - this.projectID, - this.projectName, - this.setupID, - this.state, - this.status}); - LstDiagnosis.fromJson(Map json) { - diagnosis = json['Diagnosis']; - projectID = json['ProjectID']; - projectName = json['ProjectName']; - setupID = json['SetupID']; - state = json['State']; - status = json['Status']; - } - - Map toJson() { - final Map data = new Map(); - data['Diagnosis'] = this.diagnosis; - data['ProjectID'] = this.projectID; - data['ProjectName'] = this.projectName; - data['SetupID'] = this.setupID; - data['State'] = this.state; - data['Status'] = this.status; - return data; - } -} - -class LstEncounterHistory { - String clinician; - String date; - String encounterType; - int projectID; - String projectName; - String reason; - String setupID; - String speciality; - String type; - - LstEncounterHistory( - {this.clinician, - this.date, - this.encounterType, - this.projectID, - this.projectName, - this.reason, - this.setupID, - this.speciality, - this.type}); - - LstEncounterHistory.fromJson(Map json) { - clinician = json['Clinician']; - date = json['Date']; - encounterType = json['EncounterType']; - projectID = json['ProjectID']; - projectName = json['ProjectName']; - reason = json['Reason']; - setupID = json['SetupID']; - speciality = json['Speciality']; - type = json['Type']; - } - - Map toJson() { - final Map data = new Map(); - data['Clinician'] = this.clinician; - data['Date'] = this.date; - data['EncounterType'] = this.encounterType; - data['ProjectID'] = this.projectID; - data['ProjectName'] = this.projectName; - data['Reason'] = this.reason; - data['SetupID'] = this.setupID; - data['Speciality'] = this.speciality; - data['Type'] = this.type; - return data; - } -} - -class LstMedication { - String date; - int doseDurationDays; - String lastFilled; - String medication; - String prescription; - int projectID; - String projectName; - String setupID; - String icon; - - LstMedication( - {this.date, - this.doseDurationDays, - this.lastFilled, - this.medication, - this.prescription, - this.projectID, - this.projectName, - this.setupID, - this.icon}); - - LstMedication.fromJson(Map json) { - date = json['Date']; - doseDurationDays = json['DoseDurationDays']; - lastFilled = json['LastFilled']; - medication = json['Medication']; - prescription = json['Prescription']; - projectID = json['ProjectID']; - projectName = json['ProjectName']; - setupID = json['SetupID']; - icon = json['icon']; - } - - Map toJson() { - final Map data = new Map(); - data['Date'] = this.date; - data['DoseDurationDays'] = this.doseDurationDays; - data['LastFilled'] = this.lastFilled; - data['Medication'] = this.medication; - data['Prescription'] = this.prescription; - data['ProjectID'] = this.projectID; - data['ProjectName'] = this.projectName; - data['SetupID'] = this.setupID; - data['icon'] = this.icon; - return data; - } -} - -class LstPastHistory { - String history; - String historyType; - String historyTypeID; - String historyTypeName; - int projectID; - String projectName; - String remarks; - String setupID; - - LstPastHistory( - {this.history, - this.historyType, - this.historyTypeID, - this.historyTypeName, - this.projectID, - this.projectName, - this.remarks, - this.setupID}); - - LstPastHistory.fromJson(Map json) { - history = json['History']; - historyType = json['HistoryType']; - historyTypeID = json['HistoryTypeID']; - historyTypeName = json['HistoryTypeName']; - projectID = json['ProjectID']; - projectName = json['ProjectName']; - remarks = json['Remarks']; - setupID = json['SetupID']; - } - - Map toJson() { - final Map data = new Map(); - data['History'] = this.history; - data['HistoryType'] = this.historyType; - data['HistoryTypeID'] = this.historyTypeID; - data['HistoryTypeName'] = this.historyTypeName; - data['ProjectID'] = this.projectID; - data['ProjectName'] = this.projectName; - data['Remarks'] = this.remarks; - data['SetupID'] = this.setupID; - return data; - } -} - -class DoctorWisePatientEpisodes { - String clinicName; - String lastVisitDate; - int projectID; - String projectName; - String setupID; - int doctorID; - String doctorName; - List lstEpisodes; - - DoctorWisePatientEpisodes( - {this.clinicName, - this.lastVisitDate, - this.projectID, - this.projectName, - this.setupID, - this.doctorID, - this.doctorName, - this.lstEpisodes}); - - DoctorWisePatientEpisodes.fromJson(Map json) { - clinicName = json['ClinicName']; - lastVisitDate = json['LastVisitDate']; - projectID = json['ProjectID']; - projectName = json['ProjectName']; - setupID = json['SetupID']; - doctorID = json['doctorID']; - doctorName = json['doctorName']; - if (json['lstEpisodes'] != null) { - lstEpisodes = new List(); - json['lstEpisodes'].forEach((v) { - lstEpisodes.add(new LstEpisodes.fromJson(v)); - }); - } - } - - Map toJson() { - final Map data = new Map(); - data['ClinicName'] = this.clinicName; - data['LastVisitDate'] = this.lastVisitDate; - data['ProjectID'] = this.projectID; - data['ProjectName'] = this.projectName; - data['SetupID'] = this.setupID; - data['doctorID'] = this.doctorID; - data['doctorName'] = this.doctorName; - if (this.lstEpisodes != null) { - data['lstEpisodes'] = this.lstEpisodes.map((v) => v.toJson()).toList(); + data['ColorClass'] = this.colorClass; + if (this.consulations != null) { + data['Consulations'] = this.consulations.map((v) => v.toJson()).toList(); } return data; } } -class LstEpisodes { +class Consulations { int admissionNo; String appointmentDate; int appointmentNo; @@ -894,8 +167,10 @@ class LstEpisodes { String dispalyName; List lstAssessments; List lstPhysicalExam; + List lstProcedure; + List lstMedicalHistory; - LstEpisodes( + Consulations( {this.admissionNo, this.appointmentDate, this.appointmentNo, @@ -917,9 +192,11 @@ class LstEpisodes { this.visitType, this.dispalyName, this.lstAssessments, - this.lstPhysicalExam}); + this.lstPhysicalExam, + this.lstProcedure, + this.lstMedicalHistory}); - LstEpisodes.fromJson(Map json) { + Consulations.fromJson(Map json) { admissionNo = json['AdmissionNo']; appointmentDate = json['AppointmentDate']; appointmentNo = json['AppointmentNo']; @@ -952,6 +229,18 @@ class LstEpisodes { lstPhysicalExam.add(new LstPhysicalExam.fromJson(v)); }); } + if (json['lstProcedure'] != null) { + lstProcedure = new List(); + json['lstProcedure'].forEach((v) { + lstProcedure.add(new LstProcedure.fromJson(v)); + }); + } + if (json['lstMedicalHistory'] != null) { + lstMedicalHistory = new List(); + json['lstMedicalHistory'].forEach((v) { + lstMedicalHistory.add(new LstMedicalHistory.fromJson(v)); + }); + } } Map toJson() { @@ -984,6 +273,13 @@ class LstEpisodes { data['lstPhysicalExam'] = this.lstPhysicalExam.map((v) => v.toJson()).toList(); } + if (this.lstProcedure != null) { + data['lstProcedure'] = this.lstProcedure.map((v) => v.toJson()).toList(); + } + if (this.lstMedicalHistory != null) { + data['lstMedicalHistory'] = + this.lstMedicalHistory.map((v) => v.toJson()).toList(); + } return data; } } @@ -1118,7 +414,7 @@ class LstPhysicalExam { } } -class Procedures { +class LstProcedure { int appointmentNo; int episodeID; String orderDate; @@ -1131,7 +427,7 @@ class Procedures { String setupID; String dispalyName; - Procedures( + LstProcedure( {this.appointmentNo, this.episodeID, this.orderDate, @@ -1144,7 +440,7 @@ class Procedures { this.setupID, this.dispalyName}); - Procedures.fromJson(Map json) { + LstProcedure.fromJson(Map json) { appointmentNo = json['AppointmentNo']; episodeID = json['EpisodeID']; orderDate = json['OrderDate']; @@ -1175,245 +471,59 @@ class Procedures { } } -class LstAllEpisodes { - int admissionNo; - String appointmentDate; +class LstMedicalHistory { int appointmentNo; - String appointmentType; - String clinicID; - String clinicName; - int doctorID; - String doctorName; - String endTime; - String episodeDate; + String checked; int episodeID; + String history; int patientID; + String patientType; int projectID; String projectName; String remarks; String setupID; - String startTime; - String visitFor; - String visitType; String dispalyName; - List lstAssessments; - List lstCheifComplaint; - List lstMedicalHistory; - List lstMedicine; - List lstPhysicalExam; - List lstProcedure; - List lstTreatmentPlan; - List lstVitalSign; - LstAllEpisodes( - {this.admissionNo, - this.appointmentDate, - this.appointmentNo, - this.appointmentType, - this.clinicID, - this.clinicName, - this.doctorID, - this.doctorName, - this.endTime, - this.episodeDate, + LstMedicalHistory( + {this.appointmentNo, + this.checked, this.episodeID, + this.history, this.patientID, + this.patientType, this.projectID, this.projectName, this.remarks, this.setupID, - this.startTime, - this.visitFor, - this.visitType, - this.dispalyName, - this.lstAssessments, - this.lstCheifComplaint, - this.lstMedicalHistory, - this.lstMedicine, - this.lstPhysicalExam, - this.lstProcedure, - this.lstTreatmentPlan, - this.lstVitalSign}); + this.dispalyName}); - LstAllEpisodes.fromJson(Map json) { - admissionNo = json['AdmissionNo']; - appointmentDate = json['AppointmentDate']; + LstMedicalHistory.fromJson(Map json) { appointmentNo = json['AppointmentNo']; - appointmentType = json['AppointmentType']; - clinicID = json['ClinicID']; - clinicName = json['ClinicName']; - doctorID = json['DoctorID']; - doctorName = json['DoctorName']; - endTime = json['EndTime']; - episodeDate = json['EpisodeDate']; + checked = json['Checked']; episodeID = json['EpisodeID']; + history = json['History']; patientID = json['PatientID']; + patientType = json['PatientType']; projectID = json['ProjectID']; projectName = json['ProjectName']; remarks = json['Remarks']; setupID = json['SetupID']; - startTime = json['StartTime']; - visitFor = json['VisitFor']; - visitType = json['VisitType']; dispalyName = json['dispalyName']; - // if (json['lstAssessments'] != null) { - // lstAssessments = new List(); - // json['lstAssessments'].forEach((v) { - // lstAssessments.add(new Null.fromJson(v)); - // }); - // } - // if (json['lstCheifComplaint'] != null) { - // lstCheifComplaint = new List(); - // json['lstCheifComplaint'].forEach((v) { - // lstCheifComplaint.add(new Null.fromJson(v)); - // }); - // } - // if (json['lstMedicalHistory'] != null) { - // lstMedicalHistory = new List(); - // json['lstMedicalHistory'].forEach((v) { - // lstMedicalHistory.add(new Null.fromJson(v)); - // }); - // } - // if (json['lstMedicine'] != null) { - // lstMedicine = new List(); - // json['lstMedicine'].forEach((v) { - // lstMedicine.add(new Null.fromJson(v)); - // }); - // } - // if (json['lstPhysicalExam'] != null) { - // lstPhysicalExam = new List(); - // json['lstPhysicalExam'].forEach((v) { - // lstPhysicalExam.add(new Null.fromJson(v)); - // }); - // } - // if (json['lstProcedure'] != null) { - // lstProcedure = new List(); - // json['lstProcedure'].forEach((v) { - // lstProcedure.add(new Null.fromJson(v)); - // }); - // } - // if (json['lstTreatmentPlan'] != null) { - // lstTreatmentPlan = new List(); - // json['lstTreatmentPlan'].forEach((v) { - // lstTreatmentPlan.add(new Null.fromJson(v)); - // }); - // } - // if (json['lstVitalSign'] != null) { - // lstVitalSign = new List(); - // json['lstVitalSign'].forEach((v) { - // lstVitalSign.add(new Null.fromJson(v)); - // }); - // } } Map toJson() { final Map data = new Map(); - data['AdmissionNo'] = this.admissionNo; - data['AppointmentDate'] = this.appointmentDate; data['AppointmentNo'] = this.appointmentNo; - data['AppointmentType'] = this.appointmentType; - data['ClinicID'] = this.clinicID; - data['ClinicName'] = this.clinicName; - data['DoctorID'] = this.doctorID; - data['DoctorName'] = this.doctorName; - data['EndTime'] = this.endTime; - data['EpisodeDate'] = this.episodeDate; + data['Checked'] = this.checked; data['EpisodeID'] = this.episodeID; + data['History'] = this.history; data['PatientID'] = this.patientID; + data['PatientType'] = this.patientType; data['ProjectID'] = this.projectID; data['ProjectName'] = this.projectName; data['Remarks'] = this.remarks; data['SetupID'] = this.setupID; - data['StartTime'] = this.startTime; - data['VisitFor'] = this.visitFor; - data['VisitType'] = this.visitType; data['dispalyName'] = this.dispalyName; - // if (this.lstAssessments != null) { - // data['lstAssessments'] = - // this.lstAssessments.map((v) => v.toJson()).toList(); - // } - // if (this.lstCheifComplaint != null) { - // data['lstCheifComplaint'] = - // this.lstCheifComplaint.map((v) => v.toJson()).toList(); - // } - // if (this.lstMedicalHistory != null) { - // data['lstMedicalHistory'] = - // this.lstMedicalHistory.map((v) => v.toJson()).toList(); - // } - // if (this.lstMedicine != null) { - // data['lstMedicine'] = this.lstMedicine.map((v) => v.toJson()).toList(); - // } - // if (this.lstPhysicalExam != null) { - // data['lstPhysicalExam'] = - // this.lstPhysicalExam.map((v) => v.toJson()).toList(); - // } - // if (this.lstProcedure != null) { - // data['lstProcedure'] = this.lstProcedure.map((v) => v.toJson()).toList(); - // } - // if (this.lstTreatmentPlan != null) { - // data['lstTreatmentPlan'] = - // this.lstTreatmentPlan.map((v) => v.toJson()).toList(); - // } - // if (this.lstVitalSign != null) { - // data['lstVitalSign'] = this.lstVitalSign.map((v) => v.toJson()).toList(); - // } - return data; - } -} - -class Timelines { - int clinicId; - String clinicName; - String date; - int doctorId; - String doctorImage; - String doctorName; - int encounterNumber; - String encounterType; - int projectID; - String projectName; - String setupID; - - Timelines( - {this.clinicId, - this.clinicName, - this.date, - this.doctorId, - this.doctorImage, - this.doctorName, - this.encounterNumber, - this.encounterType, - this.projectID, - this.projectName, - this.setupID}); - - Timelines.fromJson(Map json) { - clinicId = json['ClinicId']; - clinicName = json['ClinicName']; - date = json['Date']; - doctorId = json['DoctorId']; - doctorImage = json['DoctorImage']; - doctorName = json['DoctorName']; - encounterNumber = json['EncounterNumber']; - encounterType = json['EncounterType']; - projectID = json['ProjectID']; - projectName = json['ProjectName']; - setupID = json['SetupID']; - } - - Map toJson() { - final Map data = new Map(); - data['ClinicId'] = this.clinicId; - data['ClinicName'] = this.clinicName; - data['Date'] = this.date; - data['DoctorId'] = this.doctorId; - data['DoctorImage'] = this.doctorImage; - data['DoctorName'] = this.doctorName; - data['EncounterNumber'] = this.encounterNumber; - data['EncounterType'] = this.encounterType; - data['ProjectID'] = this.projectID; - data['ProjectName'] = this.projectName; - data['SetupID'] = this.setupID; return data; } } diff --git a/lib/core/service/medical_file_service.dart b/lib/core/service/medical_file_service.dart index 0f6af46a..f1ab6dcd 100644 --- a/lib/core/service/medical_file_service.dart +++ b/lib/core/service/medical_file_service.dart @@ -9,12 +9,13 @@ class MedicalFileService extends BaseService { List get medicalFileList => _medicalFileList; MedicalFileRequestModel _fileRequestModel = MedicalFileRequestModel( - patientMRN: 1231755, + //patientMRN: 1231755, vidaAuthTokenID: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMDAyIiwianRpIjoiNDM1MGNjZTYtYzc3MS00YjBiLThiNDItMGZhY2IzYzgxMjQ4IiwiZW1haWwiOiIiLCJpZCI6IjEwMDIiLCJOYW1lIjoiVEVNUCAtIERPQ1RPUiIsIkVtcGxveWVlSWQiOiI0NzA5IiwiRmFjaWxpdHlHcm91cElkIjoiMDEwMjY2IiwiRmFjaWxpdHlJZCI6IjE1IiwiUGhhcmFtY3lGYWNpbGl0eUlkIjoiNTUiLCJJU19QSEFSTUFDWV9DT05ORUNURUQiOiJUcnVlIiwiRG9jdG9ySWQiOiI0NzA5IiwiU0VTU0lPTklEIjoiMjE1OTYwNTQiLCJDbGluaWNJZCI6IjEiLCJyb2xlIjpbIkRPQ1RPUlMiLCJIRUFEIERPQ1RPUlMiLCJBRE1JTklTVFJBVE9SUyIsIlJFQ0VQVElPTklTVCIsIkVSIE5VUlNFIiwiRVIgUkVDRVBUSU9OSVNUIiwiUEhBUk1BQ1kgQUNDT1VOVCBTVEFGRiIsIlBIQVJNQUNZIE5VUlNFIiwiSU5QQVRJRU5UIFBIQVJNQUNJU1QiLCJBRE1JU1NJT04gU1RBRkYiLCJBUFBST1ZBTCBTVEFGRiIsIkNPTlNFTlQgIiwiTUVESUNBTCBSRVBPUlQgLSBTSUNLIExFQVZFIE1BTkFHRVIiXSwibmJmIjoxNjA5MjI1MjMwLCJleHAiOjE2MTAwODkyMzAsImlhdCI6MTYwOTIyNTIzMH0.rs7lTBQ1ON4PbR11PBkOyjf818DdeMKuqz2IrCJMYQU", ); - Future getMedicalFile() async { + Future getMedicalFile({int mrn}) async { + _fileRequestModel = MedicalFileRequestModel(patientMRN: mrn); hasError = false; _medicalFileList.clear(); await baseAppClient.post(GET_MEDICAL_FILE, diff --git a/lib/core/service/patient-ucaf-service.dart b/lib/core/service/patient-ucaf-service.dart index e776720c..06fbce41 100644 --- a/lib/core/service/patient-ucaf-service.dart +++ b/lib/core/service/patient-ucaf-service.dart @@ -1,5 +1,58 @@ +import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/core/service/base/base_service.dart'; +import 'package:doctor_app_flutter/models/SOAP/ChiefComplaint/GetChiefComplaintReqModel.dart'; +import 'package:doctor_app_flutter/models/SOAP/ChiefComplaint/GetChiefComplaintResModel.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/models/patient/vital_sign/patient-vital-sign-data.dart'; class UcafService extends BaseService { + List patientChiefComplaintList = []; + VitalSignData patientVitalSigns; + + Future getPatientChiefComplaint(PatiantInformtion patient) async { + hasError = false; + Map body = Map(); + body['PatientMRN'] = patient.patientMRN; + body['AppointmentNo'] = patient.appointmentNo; + body['EpisodeID'] = patient.episodeNo; + body['DoctorID'] = ""; + + await baseAppClient.post (GET_CHIEF_COMPLAINT, + onSuccess: (dynamic response, int statusCode) { + print("Success"); + patientChiefComplaintList.clear(); + response['List_ChiefComplaint']['entityList'].forEach((v) { + patientChiefComplaintList.add(GetChiefComplaintResModel.fromJson(v)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } + + Future getPatientVitalSign(PatiantInformtion patient) async { + patientVitalSigns = null; + hasError = false; + Map body = Map(); + body['PatientMRN'] = patient.patientMRN; + body['AppointmentNo'] = patient.appointmentNo; + body['EpisodeID'] = patient.episodeNo; + + await baseAppClient.post( + GET_PATIENT_VITAL_SIGN_DATA, + onSuccess: (dynamic response, int statusCode) { + if(response['VitalSignsList'] != null){ + if(response['VitalSignsList']['entityList'] != null && (response['VitalSignsList']['entityList'] as List).length > 0){ + patientVitalSigns = VitalSignData.fromJson(response['VitalSignsList']['entityList'][0]); + } + } + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error.toString(); + }, + body: body, + ); + } } \ No newline at end of file diff --git a/lib/core/service/patient-vital-signs-service.dart b/lib/core/service/patient-vital-signs-service.dart index 31c8721d..8d0cfc31 100644 --- a/lib/core/service/patient-vital-signs-service.dart +++ b/lib/core/service/patient-vital-signs-service.dart @@ -11,43 +11,8 @@ class VitalSignsService extends BaseService{ List patientVitalSignOrderdSubList = []; VitalSignData patientVitalSigns; - /*Future getPatientVitalSign(patient) async { - hasError = false; - await baseAppClient.post( - GET_PATIENT_VITAL_SIGN, - onSuccess: (dynamic response, int statusCode) { - patientVitalSignList = []; - response['List_DoctorPatientVitalSign'].forEach((v) { - patientVitalSignList.add(new VitalSignResModel.fromJson(v)); - }); - - if (patientVitalSignList.length > 0) { - List patientVitalSignOrderdSubListTemp = []; - patientVitalSignOrderdSubListTemp = patientVitalSignList; - patientVitalSignOrderdSubListTemp - .sort((VitalSignResModel a, VitalSignResModel b) { - return b.vitalSignDate.microsecondsSinceEpoch - - a.vitalSignDate.microsecondsSinceEpoch; - }); - patientVitalSignOrderdSubList.clear(); - int length = patientVitalSignOrderdSubListTemp.length >= 20 - ? 20 - : patientVitalSignOrderdSubListTemp.length; - for (int x = 0; x < length; x++) { - patientVitalSignOrderdSubList - .add(patientVitalSignOrderdSubListTemp[x]); - } - } - }, - onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }, - body: patient, - ); - } // Vit*/ - Future getPatientVitalSign(PatiantInformtion patient) async { + patientVitalSigns = null; hasError = false; Map body = Map(); body['PatientMRN'] = patient.patientMRN; @@ -59,7 +24,7 @@ class VitalSignsService extends BaseService{ onSuccess: (dynamic response, int statusCode) { if(response['VitalSignsList'] != null){ if(response['VitalSignsList']['entityList'] != null && (response['VitalSignsList']['entityList'] as List).length > 0){ - patientVitalSigns = VitalSignData.fromJson(response['VitalSignsList']['entityList']['0']); + patientVitalSigns = VitalSignData.fromJson(response['VitalSignsList']['entityList'][0]); } } }, diff --git a/lib/core/service/prescription_service.dart b/lib/core/service/prescription_service.dart index 3ccdc23c..aa881cbb 100644 --- a/lib/core/service/prescription_service.dart +++ b/lib/core/service/prescription_service.dart @@ -11,6 +11,8 @@ class PrescriptionService extends BaseService { List get prescriptionList => _prescriptionList; List _drugsList = List(); List get drugsList => _drugsList; + List doctorsList = []; + List specialityList = []; PrescriptionReqModel _prescriptionReqModel = PrescriptionReqModel( patientMRN: 3120877, @@ -26,7 +28,8 @@ class PrescriptionService extends BaseService { PostPrescriptionReqModel _postPrescriptionReqModel = PostPrescriptionReqModel(); - Future getPrescription() async { + Future getPrescription({int mrn}) async { + _prescriptionReqModel = PrescriptionReqModel(patientMRN: 3120877); hasError = false; _prescriptionList.clear(); await baseAppClient.post(GET_PRESCRIPTION_LIST, @@ -41,10 +44,11 @@ class PrescriptionService extends BaseService { Future getDrugs() async { hasError = false; - _drugsList.clear(); + await baseAppClient.post(SEARCH_DRUG, onSuccess: (dynamic response, int statusCode) { - _drugsList.add(SearchDrugModel.fromJson(response['MedicationList'])); + doctorsList = []; + doctorsList = response['MedicationList']['entityList']; }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; diff --git a/lib/core/viewModel/medical_file_view_model.dart b/lib/core/viewModel/medical_file_view_model.dart index 0ef21095..67760908 100644 --- a/lib/core/viewModel/medical_file_view_model.dart +++ b/lib/core/viewModel/medical_file_view_model.dart @@ -12,11 +12,11 @@ class MedicalFileViewModel extends BaseViewModel { List get medicalFileList => _medicalFileService.medicalFileList; - Future getMedicalFile() async { + Future getMedicalFile({int mrn}) async { hasError = false; //_insuranceCardService.clearInsuranceCard(); setState(ViewState.Busy); - await _medicalFileService.getMedicalFile(); + await _medicalFileService.getMedicalFile(mrn: mrn); if (_medicalFileService.hasError) { error = _medicalFileService.error; setState(ViewState.ErrorLocal); diff --git a/lib/core/viewModel/patient-ucaf-viewmodel.dart b/lib/core/viewModel/patient-ucaf-viewmodel.dart index cf11854b..c120e2ab 100644 --- a/lib/core/viewModel/patient-ucaf-viewmodel.dart +++ b/lib/core/viewModel/patient-ucaf-viewmodel.dart @@ -1,9 +1,30 @@ +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/service/patient-ucaf-service.dart'; import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/ChiefComplaint/GetChiefComplaintResModel.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/models/patient/vital_sign/patient-vital-sign-data.dart'; import '../../locator.dart'; class UcafViewModel extends BaseViewModel { UcafService _ucafService = locator(); + + List get patientChiefComplaintList => _ucafService.patientChiefComplaintList; + VitalSignData get patientVitalSigns => _ucafService.patientVitalSigns; + + Future getUCAFData(PatiantInformtion patient) async { + setState(ViewState.Busy); + await _ucafService.getPatientVitalSign(patient); + await _ucafService.getPatientChiefComplaint(patient); + + if (_ucafService.hasError) { + error = _ucafService.error; + setState(ViewState.Error); + } else { + setState(ViewState.Idle); + } + } + } \ No newline at end of file diff --git a/lib/core/viewModel/patient-vital-sign-viewmodel.dart b/lib/core/viewModel/patient-vital-sign-viewmodel.dart index f53def7b..4282141c 100644 --- a/lib/core/viewModel/patient-vital-sign-viewmodel.dart +++ b/lib/core/viewModel/patient-vital-sign-viewmodel.dart @@ -95,7 +95,7 @@ class VitalSignsViewModel extends BaseViewModel { ); } - String getBMI(double bodyMassIndex) { + String getBMI(var bodyMassIndex) { if (bodyMassIndex <= 18.5) { return "Underweight"; } else if (bodyMassIndex <= 25.0) { diff --git a/lib/core/viewModel/prescription_view_model.dart b/lib/core/viewModel/prescription_view_model.dart index e5fa9a0f..3380d8c2 100644 --- a/lib/core/viewModel/prescription_view_model.dart +++ b/lib/core/viewModel/prescription_view_model.dart @@ -12,13 +12,13 @@ class PrescriptionViewModel extends BaseViewModel { List get prescriptionList => _prescriptionService.prescriptionList; - List get drugsList => _prescriptionService.drugsList; + List get drugsList => _prescriptionService.doctorsList; - Future getPrescription() async { + Future getPrescription({int mrn}) async { hasError = false; //_insuranceCardService.clearInsuranceCard(); setState(ViewState.Busy); - await _prescriptionService.getPrescription(); + await _prescriptionService.getPrescription(mrn: mrn); if (_prescriptionService.hasError) { error = _prescriptionService.error; setState(ViewState.ErrorLocal); @@ -27,7 +27,7 @@ class PrescriptionViewModel extends BaseViewModel { } Future postPrescription( - PostPrescriptionReqModel postProcedureReqModel) async { + PostPrescriptionReqModel postProcedureReqModel, int mrn) async { hasError = false; //_insuranceCardService.clearInsuranceCard(); setState(ViewState.Busy); @@ -36,13 +36,13 @@ class PrescriptionViewModel extends BaseViewModel { error = _prescriptionService.error; setState(ViewState.ErrorLocal); } else { - await getPrescription(); + await getPrescription(mrn: mrn); setState(ViewState.Idle); } } Future updatePrescription( - PostPrescriptionReqModel updatePrescriptionReqModel) async { + PostPrescriptionReqModel updatePrescriptionReqModel, int mrn) async { hasError = false; //_insuranceCardService.clearInsuranceCard(); setState(ViewState.Busy); @@ -51,7 +51,7 @@ class PrescriptionViewModel extends BaseViewModel { error = _prescriptionService.error; setState(ViewState.ErrorLocal); } else { - await getPrescription(); + await getPrescription(mrn: mrn); setState(ViewState.Idle); } } diff --git a/lib/models/patient/vital_sign/patient-vital-sign-data.dart b/lib/models/patient/vital_sign/patient-vital-sign-data.dart index 5d20e017..c5e503c2 100644 --- a/lib/models/patient/vital_sign/patient-vital-sign-data.dart +++ b/lib/models/patient/vital_sign/patient-vital-sign-data.dart @@ -5,7 +5,7 @@ class VitalSignData { int bloodPressureHigher; int bloodPressureLower; int bloodPressurePatientPosition; - double bodyMassIndex; + var bodyMassIndex; int fio2; int headCircumCm; int heightCm; diff --git a/lib/screens/medical-file/medical_file_details.dart b/lib/screens/medical-file/medical_file_details.dart index 4f966781..c916842c 100644 --- a/lib/screens/medical-file/medical_file_details.dart +++ b/lib/screens/medical-file/medical_file_details.dart @@ -8,6 +8,7 @@ import 'package:doctor_app_flutter/widgets/shared/Text.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/expandable-widget-header-body.dart'; +import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; import 'package:eva_icons_flutter/eva_icons_flutter.dart'; import 'package:flutter/material.dart'; @@ -16,21 +17,42 @@ class MedicalFileDetails extends StatefulWidget { String firstName; String lastName; String gender; - MedicalFileDetails({this.age, this.firstName, this.lastName, this.gender}); + int encounterNumber; + int pp; + + MedicalFileDetails( + {this.age, + this.firstName, + this.lastName, + this.gender, + this.encounterNumber, + this.pp}); @override _MedicalFileDetailsState createState() => _MedicalFileDetailsState( - firstName: firstName, age: age, lastName: lastName, gender: gender); + firstName: firstName, + age: age, + lastName: lastName, + gender: gender, + encounterNumber: encounterNumber, + pp: pp); } class _MedicalFileDetailsState extends State { + int encounterNumber; String age; String firstName; String lastName; String gender; + int pp; _MedicalFileDetailsState( - {this.age, this.firstName, this.lastName, this.gender}); + {this.age, + this.firstName, + this.lastName, + this.gender, + this.encounterNumber, + this.pp}); bool isPhysicalExam = false; bool isProcedureExpand = false; bool isHistoryExpand = false; @@ -39,386 +61,689 @@ class _MedicalFileDetailsState extends State { @override Widget build(BuildContext context) { return BaseView( - //onModelReady: (model) => model.getMedicalFile(), + onModelReady: (model) => model.getMedicalFile(mrn: pp), builder: (BuildContext context, MedicalFileViewModel model, Widget child) => AppScaffold( isShowAppBar: true, appBarTitle: 'medical file'.toUpperCase(), - body: SingleChildScrollView( - child: Container( - child: Column( - children: [ - Padding( - padding: EdgeInsets.all(8.0), - child: Row( - children: [ - AvatarWidget( - Icon( - gender == "Male" - ? DoctorApp.male - : DoctorApp.female_icon, - size: 70, - color: Colors.white, - ), - ), - SizedBox( - width: 20, - ), - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - firstName + ' ' + lastName, - color: Colors.black, - fontWeight: FontWeight.bold, + body: NetworkBaseView( + baseViewModel: model, + child: SingleChildScrollView( + child: Container( + child: Column( + children: [ + Padding( + padding: EdgeInsets.all(8.0), + child: Row( + children: [ + AvatarWidget( + Icon( + gender == "Male" + ? DoctorApp.male + : DoctorApp.female_icon, + size: 70, + color: Colors.white, ), - Row( - children: [ - AppText( - TranslationBase.of(context).age2, - color: Colors.black, - fontWeight: FontWeight.bold, - ), - SizedBox( - width: 5.0, - ), - AppText( - age, - color: Colors.black, - fontWeight: FontWeight.normal, - ), - ], - ), - ], - ) - ], - ), - ), - Divider( - height: 1.0, - thickness: 1.0, - color: Colors.grey, - ), - Padding( - padding: EdgeInsets.all(10.0), - child: Container( - child: Column( - children: [ - Row( - children: [ - AppText( - 'Visit Date : ', - fontWeight: FontWeight.w700, - ), - AppText( - '23/12/2020', - ), - SizedBox(width: 35.0), - AppText( - 'Appt Date : ', - fontWeight: FontWeight.w700, - ), - AppText( - '23/12/2020', - ), - ], ), - Row( - children: [ - AppText( - 'Doctor : '.toUpperCase(), - fontWeight: FontWeight.w700, - ), - AppText( - 'Muhammad assad'.toUpperCase(), - fontWeight: FontWeight.w700, - ), - ], - ), - Row( - children: [ - AppText( - 'Clinic : ', - fontWeight: FontWeight.w700, - ), - AppText( - 'Gastroenterology', - ), - ], + SizedBox( + width: 20, ), - Row( + Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ AppText( - 'Episode Number : ', - fontWeight: FontWeight.w700, + firstName + ' ' + lastName, + color: Colors.black, + fontWeight: FontWeight.bold, ), - AppText( - '200012334', + Row( + children: [ + AppText( + TranslationBase.of(context).age2, + color: Colors.black, + fontWeight: FontWeight.bold, + ), + SizedBox( + width: 5.0, + ), + AppText( + age, + color: Colors.black, + fontWeight: FontWeight.normal, + ), + ], ), ], - ), - SizedBox(height: 15.0), - Divider( - height: 1.0, - thickness: 1.0, - color: Colors.grey.shade400, - ), - SizedBox(height: 25.0), - HeaderBodyExpandableNotifier( - headerWidget: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Row( - children: [ - Texts( - 'History of present illness' - .toUpperCase(), - variant: - isHistoryExpand ? "bodyText" : '', - bold: isHistoryExpand ? true : false, - color: Colors.black), - ], - ), - InkWell( - onTap: () { - setState(() { - isHistoryExpand = !isHistoryExpand; - }); - }, - child: Icon(isHistoryExpand - ? EvaIcons.minus - : EvaIcons.plus)) - ], - ), - bodyWidget: Column( - children: [ - Texts( - 'Ms J. K. is an 83 year old retired nurse with a long history of hypertension that was previously well controlled on diuretic therapy. She was first admitted to CPMC in 1995 when she presented with a complaint of intermittent midsternal chest pain.') - ], - ), - isExpand: isHistoryExpand, - ), - SizedBox( - height: 30, - ), - Container( - width: double.infinity, - height: 1, - color: Color(0xffCCCCCC), - ), - SizedBox( - height: 30, - ), - HeaderBodyExpandableNotifier( - headerWidget: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, + ) + ], + ), + ), + Divider( + height: 1.0, + thickness: 1.0, + color: Colors.grey, + ), + Padding( + padding: EdgeInsets.all(10.0), + child: Container( + child: Column( + children: [ + Row( children: [ - Row( - children: [ - Texts('assessment'.toUpperCase(), - variant: - isAssessmentExpand ? "bodyText" : '', - bold: isAssessmentExpand ? true : false, - color: Colors.black), - ], + AppText( + 'Visit Date : ', + fontWeight: FontWeight.w700, ), - InkWell( - onTap: () { - setState(() { - isAssessmentExpand = !isAssessmentExpand; - }); - }, - child: Icon(isAssessmentExpand - ? EvaIcons.minus - : EvaIcons.plus)) + if (model.medicalFileList.length != 0) + AppText(model + .medicalFileList[0] + .entityList[0] + .timelines[encounterNumber] + .timeLineEvents[0] + .consulations[0] + .appointmentDate + .toString()), + SizedBox(width: 35.0), + // AppText( + // 'Appt Date : ', + // fontWeight: FontWeight.w700, + // ), + // AppText( + // '23/12/2020', + // ), ], ), - bodyWidget: Column( - children: [ - Texts('ssss'), - ], - ), - isExpand: isAssessmentExpand, - ), - SizedBox( - height: 30, - ), - Container( - width: double.infinity, - height: 1, - color: Color(0xffCCCCCC), - ), - SizedBox( - height: 30, - ), - HeaderBodyExpandableNotifier( - headerWidget: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, + Row( children: [ - Row( - children: [ - Texts('Test / procedures'.toUpperCase(), - variant: - isProcedureExpand ? "bodyText" : '', - bold: isProcedureExpand ? true : false, - color: Colors.black), - ], + AppText( + 'Doctor : '.toUpperCase(), + fontWeight: FontWeight.w700, ), - InkWell( - onTap: () { - setState(() { - isProcedureExpand = !isProcedureExpand; - }); - }, - child: Icon(isProcedureExpand - ? EvaIcons.minus - : EvaIcons.plus)) + if (model.medicalFileList.length != 0) + AppText( + model + .medicalFileList[0] + .entityList[0] + .timelines[encounterNumber] + .timeLineEvents[0] + .consulations[0] + .doctorName + .toUpperCase(), + fontWeight: FontWeight.w700, + ), ], ), - bodyWidget: Column( - children: [ - SizedBox( - height: 20.0, - ), - Row( - children: [ - AppText( - 'Exam Type : ', - fontWeight: FontWeight.w700, - ), - AppText( - '59', - ), - ], - ), - Row( - children: [ - AppText( - 'ABDOMEN', - fontWeight: FontWeight.w700, - ), - ], - ), - Row( - children: [ - AppText( - 'Abnormal: ', - fontWeight: FontWeight.w700, - ), - AppText( - 'no', - ), - ], - ), - SizedBox(height: 15.0), - Row( - children: [ + if (model.medicalFileList.length != 0) + Row( + children: [ + AppText( + 'Clinic : ', + fontWeight: FontWeight.w700, + ), + if (model.medicalFileList.length != 0) AppText( - 'Some short remark about the allergy', - fontWeight: FontWeight.w300, + model + .medicalFileList[0] + .entityList[0] + .timelines[encounterNumber] + .timeLineEvents[0] + .consulations[0] + .clinicName, ), - ], - ), - ], - ), - isExpand: isProcedureExpand, - ), - SizedBox( - height: 30, - ), - Container( - width: double.infinity, - height: 1, - color: Color(0xffCCCCCC), - ), - SizedBox( - height: 30, - ), - HeaderBodyExpandableNotifier( - headerWidget: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, + ], + ), + Row( children: [ - Row( - children: [ - Texts('physical exam'.toUpperCase(), - variant: isPhysicalExam ? "bodyText" : '', - bold: isPhysicalExam ? true : false, - color: Colors.black), - ], + AppText( + 'Episode Number : ', + fontWeight: FontWeight.w700, ), - InkWell( - onTap: () { - setState(() { - isPhysicalExam = !isPhysicalExam; - }); - }, - child: Icon(isPhysicalExam - ? EvaIcons.minus - : EvaIcons.plus)) + if (model.medicalFileList.length != 0) + AppText( + model + .medicalFileList[0] + .entityList[0] + .timelines[encounterNumber] + .timeLineEvents[0] + .consulations[0] + .episodeID + .toString(), + ), ], ), - bodyWidget: Column( - children: [ - SizedBox( - height: 20.0, - ), - Row( + SizedBox(height: 15.0), + Divider( + height: 1.0, + thickness: 1.0, + color: Colors.grey.shade400, + ), + SizedBox(height: 25.0), + if (model.medicalFileList.length != 0) + HeaderBodyExpandableNotifier( + headerWidget: Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, children: [ - AppText( - 'Exam Type : ', - fontWeight: FontWeight.w700, - ), - AppText( - '59', + Row( + children: [ + Texts( + 'History of present illness' + .toUpperCase(), + variant: + isHistoryExpand ? "bodyText" : '', + bold: isHistoryExpand ? true : false, + color: Colors.black), + ], ), + InkWell( + onTap: () { + setState(() { + isHistoryExpand = !isHistoryExpand; + }); + }, + child: Icon(isHistoryExpand + ? EvaIcons.minus + : EvaIcons.plus)) ], ), - Row( + bodyWidget: ListView.builder( + //physics: , + scrollDirection: Axis.vertical, + shrinkWrap: true, + itemCount: model + .medicalFileList[0] + .entityList[0] + .timelines[encounterNumber] + .timeLineEvents[0] + .consulations[0] + .lstMedicalHistory + .length, + itemBuilder: (BuildContext ctxt, int index) { + return Padding( + padding: EdgeInsets.all(8.0), + child: Container( + child: Column( + mainAxisAlignment: + MainAxisAlignment.center, + children: [ + Row( + children: [ + Expanded( + child: AppText( + model + .medicalFileList[0] + .entityList[0] + .timelines[ + encounterNumber] + .timeLineEvents[0] + .consulations[0] + .lstMedicalHistory[ + index] + .history + .trim(), + ), + ), + SizedBox(width: 35.0), + ], + ), + ], + ), + ), + ); + }), + isExpand: isHistoryExpand, + ), + SizedBox( + height: 30, + ), + Container( + width: double.infinity, + height: 1, + color: Color(0xffCCCCCC), + ), + SizedBox( + height: 30, + ), + if (model.medicalFileList.length != 0) + HeaderBodyExpandableNotifier( + headerWidget: Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, children: [ - AppText( - 'ABDOMEN', - fontWeight: FontWeight.w700, + Row( + children: [ + Texts('assessment'.toUpperCase(), + variant: isAssessmentExpand + ? "bodyText" + : '', + bold: + isAssessmentExpand ? true : false, + color: Colors.black), + ], ), + InkWell( + onTap: () { + setState(() { + isAssessmentExpand = + !isAssessmentExpand; + }); + }, + child: Icon(isAssessmentExpand + ? EvaIcons.minus + : EvaIcons.plus)) ], ), - Row( + bodyWidget: ListView.builder( + //physics: , + scrollDirection: Axis.vertical, + shrinkWrap: true, + itemCount: model + .medicalFileList[0] + .entityList[0] + .timelines[encounterNumber] + .timeLineEvents[0] + .consulations[0] + .lstAssessments + .length, + itemBuilder: (BuildContext ctxt, int index) { + return Padding( + padding: EdgeInsets.all(8.0), + child: Container( + child: Column( + mainAxisAlignment: + MainAxisAlignment.center, + children: [ + Row( + children: [ + AppText( + 'ICD', + fontWeight: FontWeight.w700, + ), + AppText( + model + .medicalFileList[0] + .entityList[0] + .timelines[ + encounterNumber] + .timeLineEvents[0] + .consulations[0] + .lstAssessments[index] + .iCD10 + .trim(), + ), + SizedBox(width: 35.0), + AppText( + 'Condition: ', + fontWeight: FontWeight.w700, + ), + AppText( + model + .medicalFileList[0] + .entityList[0] + .timelines[ + encounterNumber] + .timeLineEvents[0] + .consulations[0] + .lstAssessments[index] + .condition + .trim(), + ), + ], + ), + Row( + children: [ + AppText( + model + .medicalFileList[0] + .entityList[0] + .timelines[ + encounterNumber] + .timeLineEvents[0] + .consulations[0] + .lstAssessments[index] + .description, + fontWeight: FontWeight.w700, + ) + ], + ), + Row( + children: [ + AppText( + 'Type: ', + fontWeight: FontWeight.w700, + ), + AppText(model + .medicalFileList[0] + .entityList[0] + .timelines[encounterNumber] + .timeLineEvents[0] + .consulations[0] + .lstAssessments[index] + .type), + ], + ), + SizedBox( + height: 15.0, + ), + AppText( + model + .medicalFileList[0] + .entityList[0] + .timelines[encounterNumber] + .timeLineEvents[0] + .consulations[0] + .lstAssessments[index] + .remarks + .trim(), + ), + Divider( + height: 1, + color: Colors.grey, + thickness: 1.0, + ), + SizedBox( + height: 8.0, + ), + ], + ), + ), + ); + }), + isExpand: isAssessmentExpand, + ), + SizedBox( + height: 30, + ), + Container( + width: double.infinity, + height: 1, + color: Color(0xffCCCCCC), + ), + SizedBox( + height: 30, + ), + if (model.medicalFileList.length != 0) + HeaderBodyExpandableNotifier( + headerWidget: Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, children: [ - AppText( - 'Abnormal: ', - fontWeight: FontWeight.w700, - ), - AppText( - 'no', + Row( + children: [ + Texts('Test / procedures'.toUpperCase(), + variant: isProcedureExpand + ? "bodyText" + : '', + bold: + isProcedureExpand ? true : false, + color: Colors.black), + ], ), + InkWell( + onTap: () { + setState(() { + isProcedureExpand = + !isProcedureExpand; + }); + }, + child: Icon(isProcedureExpand + ? EvaIcons.minus + : EvaIcons.plus)) ], ), - SizedBox(height: 15.0), - Row( + bodyWidget: ListView.builder( + //physics: , + scrollDirection: Axis.vertical, + shrinkWrap: true, + itemCount: model + .medicalFileList[0] + .entityList[0] + .timelines[encounterNumber] + .timeLineEvents[0] + .consulations[0] + .lstProcedure + .length, + itemBuilder: (BuildContext ctxt, int index) { + return Padding( + padding: EdgeInsets.all(8.0), + child: Container( + child: Column( + mainAxisAlignment: + MainAxisAlignment.center, + children: [ + Row( + children: [ + AppText( + 'Procedure ID: ', + fontWeight: FontWeight.w700, + ), + AppText( + model + .medicalFileList[0] + .entityList[0] + .timelines[ + encounterNumber] + .timeLineEvents[0] + .consulations[0] + .lstProcedure[index] + .procedureId + .trim(), + ), + SizedBox(width: 35.0), + AppText( + 'Order Date: ', + fontWeight: FontWeight.w700, + ), + // AppText( + // model + // .medicalFileList[0] + // .entityList[0] + // .timelines[0] + // .timeLineEvents[0] + // .consulations[0] + // .lstProcedure[index] + // .orderDate + // .trim(), + // ), + ], + ), + Row( + children: [ + AppText( + model + .medicalFileList[0] + .entityList[0] + .timelines[ + encounterNumber] + .timeLineEvents[0] + .consulations[0] + .lstProcedure[index] + .procName, + fontWeight: FontWeight.w700, + ) + ], + ), + Row( + children: [ + AppText( + 'CPT Code : ', + fontWeight: FontWeight.w700, + ), + AppText(model + .medicalFileList[0] + .entityList[0] + .timelines[encounterNumber] + .timeLineEvents[0] + .consulations[0] + .lstProcedure[index] + .patientID + .toString()), + ], + ), + SizedBox( + height: 15.0, + ), + Divider( + height: 1, + color: Colors.grey, + thickness: 1.0, + ), + SizedBox( + height: 8.0, + ), + ], + ), + ), + ); + }), + isExpand: isProcedureExpand, + ), + SizedBox( + height: 30, + ), + Container( + width: double.infinity, + height: 1, + color: Color(0xffCCCCCC), + ), + SizedBox( + height: 30, + ), + if (model.medicalFileList.length != 0) + HeaderBodyExpandableNotifier( + headerWidget: Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, children: [ - AppText( - 'Some short remark about the allergy', - fontWeight: FontWeight.w300, + Row( + children: [ + Texts('physical exam'.toUpperCase(), + variant: + isPhysicalExam ? "bodyText" : '', + bold: isPhysicalExam ? true : false, + color: Colors.black), + ], ), + InkWell( + onTap: () { + setState(() { + isPhysicalExam = !isPhysicalExam; + }); + }, + child: Icon(isPhysicalExam + ? EvaIcons.minus + : EvaIcons.plus)) ], ), - ], + bodyWidget: ListView.builder( + //physics: , + scrollDirection: Axis.vertical, + shrinkWrap: true, + itemCount: model + .medicalFileList[0] + .entityList[0] + .timelines[encounterNumber] + .timeLineEvents[0] + .consulations[0] + .lstPhysicalExam + .length, + itemBuilder: (BuildContext ctxt, int index) { + return Padding( + padding: EdgeInsets.all(8.0), + child: Container( + child: Column( + children: [ + Row( + children: [ + AppText( + 'Exam Type: ', + fontWeight: FontWeight.w700, + ), + AppText(model + .medicalFileList[0] + .entityList[0] + .timelines[encounterNumber] + .timeLineEvents[0] + .consulations[0] + .lstPhysicalExam[index] + .examType), + ], + ), + Row( + children: [ + AppText( + model + .medicalFileList[0] + .entityList[0] + .timelines[ + encounterNumber] + .timeLineEvents[0] + .consulations[0] + .lstPhysicalExam[index] + .examDesc, + fontWeight: FontWeight.w700, + ) + ], + ), + Row( + children: [ + AppText( + 'Abnormal: ', + fontWeight: FontWeight.w700, + ), + AppText(model + .medicalFileList[0] + .entityList[0] + .timelines[encounterNumber] + .timeLineEvents[0] + .consulations[0] + .lstPhysicalExam[index] + .abnormal), + ], + ), + SizedBox( + height: 15.0, + ), + AppText( + model + .medicalFileList[0] + .entityList[0] + .timelines[encounterNumber] + .timeLineEvents[0] + .consulations[0] + .lstPhysicalExam[index] + .remarks, + ), + Divider( + height: 1, + color: Colors.grey, + thickness: 1.0, + ), + SizedBox( + height: 8.0, + ), + ], + ), + ), + ); + }), + isExpand: isPhysicalExam, + ), + SizedBox( + height: 30, ), - isExpand: isPhysicalExam, - ), - SizedBox( - height: 30, - ), - Container( - width: double.infinity, - height: 1, - color: Color(0xffCCCCCC), - ), - ], + Container( + width: double.infinity, + height: 1, + color: Color(0xffCCCCCC), + ), + ], + ), ), ), - ), - ], + ], + ), ), ), ), diff --git a/lib/screens/medical-file/medical_file_page.dart b/lib/screens/medical-file/medical_file_page.dart index 44fee1be..ad693f47 100644 --- a/lib/screens/medical-file/medical_file_page.dart +++ b/lib/screens/medical-file/medical_file_page.dart @@ -22,7 +22,7 @@ class _MedicalFilePageState extends State { final routeArgs = ModalRoute.of(context).settings.arguments as Map; patient = routeArgs['patient']; return BaseView( - onModelReady: (model) => model.getMedicalFile(), + onModelReady: (model) => model.getMedicalFile(mrn: patient.patientMRN), builder: (BuildContext context, MedicalFileViewModel model, Widget child) => AppScaffold( @@ -30,140 +30,147 @@ class _MedicalFilePageState extends State { appBarTitle: 'medical Report'.toUpperCase(), body: NetworkBaseView( baseViewModel: model, - child: Container( - child: Column( - children: [ - Padding( - padding: EdgeInsets.all(8.0), - child: Row( - children: [ - AvatarWidget( - Icon( - patient.genderDescription == "Male" - ? DoctorApp.male - : DoctorApp.female_icon, - size: 70, - color: Colors.white, - ), - ), - SizedBox( - width: 20, - ), - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - patient.firstName + ' ' + patient.lastName, - color: Colors.black, - fontWeight: FontWeight.bold, - ), - Row( - children: [ - AppText( - TranslationBase.of(context).fileNo, - color: Colors.black, - fontWeight: FontWeight.bold, - ), - SizedBox( - width: 5.0, - ), - AppText( - patient.age.toString(), - color: Colors.black, - fontWeight: FontWeight.normal, - ), - ], - ), - AppText( - "ALLERGIC TO: FOOD, ASPIRIN", - color: Color(0xFFB9382C), - fontWeight: FontWeight.bold, + child: SingleChildScrollView( + child: Container( + child: Column( + children: [ + Padding( + padding: EdgeInsets.all(8.0), + child: Row( + children: [ + AvatarWidget( + Icon( + patient.genderDescription == "Male" + ? DoctorApp.male + : DoctorApp.female_icon, + size: 70, + color: Colors.white, ), - ], - ) - ], - ), - ), - Divider( - height: 1.0, - thickness: 1.0, - color: Colors.grey, - ), - ListView.builder( - scrollDirection: Axis.vertical, - shrinkWrap: true, - itemCount: 2, - itemBuilder: (BuildContext ctxt, int index) { - return Padding( - padding: EdgeInsets.symmetric( - horizontal: 12.0, vertical: 8.0), - child: InkWell( - child: Container( - child: Column( + ), + SizedBox( + width: 20, + ), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + patient.firstName + ' ' + patient.lastName, + color: Colors.black, + fontWeight: FontWeight.bold, + ), + Row( children: [ - Row( - children: [ - AppText( - 'Branch : ', - fontWeight: FontWeight.w700, - ), - AppText( - model.medicalFileList[0].entityList[0] - .admissions[index].projectName, - ), - ], + AppText( + TranslationBase.of(context).fileNo, + color: Colors.black, + fontWeight: FontWeight.bold, ), - Row( - children: [ - AppText( - 'Doctor : '.toUpperCase(), - fontWeight: FontWeight.w700, - ), - AppText( - model.medicalFileList[0].entityList[0] - .admissions[index].doctor - .toUpperCase(), - fontWeight: FontWeight.w700, - ), - ], + SizedBox( + width: 5.0, + ), + AppText( + patient.age.toString(), + color: Colors.black, + fontWeight: FontWeight.normal, ), - Row( + ], + ), + AppText( + "ALLERGIC TO: FOOD, ASPIRIN", + color: Color(0xFFB9382C), + fontWeight: FontWeight.bold, + ), + ], + ) + ], + ), + ), + Divider( + height: 1.0, + thickness: 1.0, + color: Colors.grey, + ), + if (model.medicalFileList.length != 0) + ListView.builder( + //physics: , + scrollDirection: Axis.vertical, + shrinkWrap: true, + itemCount: model + .medicalFileList[0].entityList[0].timelines.length, + itemBuilder: (BuildContext ctxt, int index) { + return Padding( + padding: EdgeInsets.symmetric( + horizontal: 12.0, vertical: 8.0), + child: InkWell( + child: Container( + child: Column( children: [ - AppText( - 'Clinic : ', - fontWeight: FontWeight.w700, + Row( + children: [ + AppText( + 'Branch : ', + fontWeight: FontWeight.w700, + ), + AppText(model + .medicalFileList[0] + .entityList[0] + .timelines[index] + .projectName), + ], ), - AppText( - model.medicalFileList[0].entityList[0] - .admissions[index].clinic, + Row( + children: [ + AppText( + 'Doctor : '.toUpperCase(), + fontWeight: FontWeight.w700, + ), + AppText( + model.medicalFileList[0].entityList[0] + .timelines[index].doctorName, + fontWeight: FontWeight.w700, + ), + ], ), + Row( + children: [ + AppText( + 'Clinic : ', + fontWeight: FontWeight.w700, + ), + AppText( + model.medicalFileList[0].entityList[0] + .timelines[index].clinicName, + ), + ], + ), + SizedBox(height: 10.0), + Divider( + height: 1.0, + thickness: 1.0, + color: Colors.grey.shade400, + ) ], ), - SizedBox(height: 10.0), - Divider( - height: 1.0, - thickness: 1.0, - color: Colors.grey.shade400, - ) - ], + ), + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => MedicalFileDetails( + age: patient.age, + firstName: patient.firstName, + lastName: patient.lastName, + gender: patient.genderDescription, + encounterNumber: index, + pp: patient.patientMRN, + )), + ); + }, ), - ), - onTap: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => MedicalFileDetails( - age: patient.age, - firstName: patient.firstName, - lastName: patient.lastName, - gender: patient.genderDescription, - )), - ); - }, - ), - ); - }) - ], + ); + }) + ], + ), ), ), ), diff --git a/lib/screens/patients/profile/UCAF/UCAF-detail-screen.dart b/lib/screens/patients/profile/UCAF/UCAF-detail-screen.dart index 302b77a8..f9c2470a 100644 --- a/lib/screens/patients/profile/UCAF/UCAF-detail-screen.dart +++ b/lib/screens/patients/profile/UCAF/UCAF-detail-screen.dart @@ -1,3 +1,4 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/core/viewModel/patient-ucaf-viewmodel.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; @@ -5,6 +6,7 @@ import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/PatientHeaderWidgetNoAvatar.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/material.dart'; import 'package:hexcolor/hexcolor.dart'; @@ -14,7 +16,6 @@ class UcafDetailScreen extends StatefulWidget { } class _UcafDetailScreenState extends State { - int _activeTap = 0; @override @@ -45,7 +46,7 @@ class _UcafDetailScreenState extends State { SizedBox( height: 16, ), - getSelectedTreatmentStepItem(context), + ...getSelectedTreatmentStepItem(context), ], ), ), @@ -64,8 +65,8 @@ class _UcafDetailScreenState extends State { ]; return Container( height: screenSize.height * 0.070, - decoration: - Helpers.containerBorderDecoration(Color(0Xffffffff), Color(0xFFCCCCCC)), + decoration: Helpers.containerBorderDecoration( + Color(0Xffffffff), Color(0xFFCCCCCC)), child: Row( mainAxisSize: MainAxisSize.max, crossAxisAlignment: CrossAxisAlignment.center, @@ -105,8 +106,296 @@ class _UcafDetailScreenState extends State { ); } - Widget getSelectedTreatmentStepItem(BuildContext _context) { - return Container(); + List getSelectedTreatmentStepItem(BuildContext _context) { + switch (_activeTap) { + case 0: + return [...List.generate(2, (index) => DiagnosisWidget()).toList()]; + case 1: + return [...List.generate(2, (index) => MedicationWidget()).toList()]; + case 2: + return [...List.generate(2, (index) => ProceduresWidget()).toList()]; + default: + return [ + Container(), + ]; + } + } +} + +class DiagnosisWidget extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + AppText( + "${TranslationBase.of(context).diagnoseType}: ", + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + AppText( + "Preliminary Diagnosis", + fontWeight: FontWeight.normal, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + ], + ), + SizedBox( + height: 4, + ), + Row( + children: [ + Expanded( + child: AppText( + "B34.2 | CORONA VIRUS INFECTION, UNSPECIFIED SITE", + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + ), + ], + ), + SizedBox( + height: 4, + ), + Row( + children: [ + AppText( + "${TranslationBase.of(context).condition}: ", + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + AppText( + "174.00 Same", + fontWeight: FontWeight.normal, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + ], + ), + SizedBox( + height: 16, + ), + const Divider( + color: Color(0xffCCCCCC), + height: 1, + thickness: 1, + indent: 0, + endIndent: 0, + ), + SizedBox( + height: 16, + ), + ], + ); + } +} + +class MedicationWidget extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + AppText( + "${TranslationBase.of(context).id}: ", + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + AppText( + "6", + fontWeight: FontWeight.normal, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + SizedBox( + width: 16, + ), + AppText( + "${TranslationBase.of(context).price}: ", + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + AppText( + "35.6", + fontWeight: FontWeight.normal, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + SizedBox( + width: 16, + ), + AppText( + "${TranslationBase.of(context).quantity}: ", + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + AppText( + "3", + fontWeight: FontWeight.normal, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + ], + ), + SizedBox( + height: 4, + ), + Row( + children: [ + Expanded( + child: AppText( + "EVE SKIN CREAM WITH HONEY -170GM", + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + ), + ], + ), + SizedBox( + height: 4, + ), + Row( + children: [ + Expanded( + child: AppText( + "Every other day for 5 days", + fontWeight: FontWeight.normal, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + ), + ], + ), + SizedBox( + height: 16, + ), + const Divider( + color: Color(0xffCCCCCC), + height: 1, + thickness: 1, + indent: 0, + endIndent: 0, + ), + SizedBox( + height: 16, + ), + ], + ); } +} + +class ProceduresWidget extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Column( + children: [ + Row( + children: [ + AppText( + "${TranslationBase.of(context).codeNo}: ", + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + AppText( + "019054846", + fontWeight: FontWeight.normal, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + Expanded( + child: Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + AppText( + "${TranslationBase.of(context).quantity}: ", + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + AppText( + "1", + fontWeight: FontWeight.normal, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + ], + ), + ), + ], + ), + SizedBox( + height: 4, + ), + Row( + children: [ + Expanded( + child: AppText( + "SCAN - RENAL MASS PROTOCOL", + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + ), + ], + ), + SizedBox( + height: 4, + ), + Row( + children: [ + AppText( + "${TranslationBase.of(context).covered}: ", + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + AppText( + "Yes", + fontWeight: FontWeight.normal, + color: Colors.green, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + SizedBox( + width: 16, + ), + AppText( + "${TranslationBase.of(context).approvalRequired}: ", + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + AppText( + "Yes", + fontWeight: FontWeight.normal, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + ], + ), + SizedBox( + height: 4, + ), + Row( + children: [ + AppText( + "${TranslationBase.of(context).uncoveredByDoctor}: ", + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + AppText( + "Yes", + fontWeight: FontWeight.normal, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + ], + ), + SizedBox( + height: 16, + ), + const Divider( + color: Color(0xffCCCCCC), + height: 1, + thickness: 1, + indent: 0, + endIndent: 0, + ), + SizedBox( + height: 16, + ), + ], + ); + } } diff --git a/lib/screens/patients/profile/UCAF/UCAF-input-screen.dart b/lib/screens/patients/profile/UCAF/UCAF-input-screen.dart index e0c2f9a7..0116ce46 100644 --- a/lib/screens/patients/profile/UCAF/UCAF-input-screen.dart +++ b/lib/screens/patients/profile/UCAF/UCAF-input-screen.dart @@ -14,6 +14,7 @@ import 'package:flutter/services.dart'; import 'package:hexcolor/hexcolor.dart'; import '../../../../routes.dart'; +import '../../../QR_reader_screen.dart'; class UCAFInputScreen extends StatefulWidget { @override @@ -55,312 +56,338 @@ class _UCAFInputScreenState extends State { final screenSize = MediaQuery.of(context).size; return BaseView( + onModelReady: (model) => model.getUCAFData(patient), builder: (_, model, w) => AppScaffold( baseViewModel: model, appBarTitle: TranslationBase.of(context).ucaf, - body: SingleChildScrollView( - child: Column( - children: [ - PatientHeaderWidgetNoAvatar(patient), - Container( - margin: EdgeInsets.symmetric(vertical: 16, horizontal: 16), + body: model.patientVitalSigns != null && + model.patientChiefComplaintList != null && + model.patientChiefComplaintList.length > 0 + ? SingleChildScrollView( child: Column( - crossAxisAlignment: CrossAxisAlignment.start, children: [ - CheckboxListTile( - title: AppText( - TranslationBase.of(context).inPatient, - fontWeight: FontWeight.bold, - fontSize: SizeConfig.textMultiplier * 2.1, - ), - value: _inPatient, - onChanged: (newValue) { - setState(() { - _inPatient = newValue; - }); - }, - controlAffinity: ListTileControlAffinity.leading, - contentPadding: EdgeInsets.all(0), - ), - CheckboxListTile( - title: AppText( - TranslationBase.of(context).emergencyCase, - fontWeight: FontWeight.bold, - fontSize: SizeConfig.textMultiplier * 2.1, - ), - value: _emergencyCase, - onChanged: (newValue) { - setState(() { - _emergencyCase = newValue; - }); - }, - controlAffinity: ListTileControlAffinity.leading, - contentPadding: EdgeInsets.all(0), - ), + PatientHeaderWidgetNoAvatar(patient), Container( - height: screenSize.height * 0.070, - child: TextField( - decoration: Helpers.textFieldSelectorDecoration( - TranslationBase.of(context).durationOfIllness, - null, - false), - enabled: true, - controller: _durationOfIllnessController, - inputFormatters: [ - FilteringTextInputFormatter.allow( - RegExp(ONLY_NUMBERS)) - ], - keyboardType: TextInputType.number, - )), - SizedBox( - height: 10, - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Row( - children: [ - AppText( - "BP (H/L)", - fontSize: SizeConfig.textMultiplier * 1.8, - color: Colors.black, - fontWeight: FontWeight.w700, - ), - SizedBox( - width: 8, - ), - AppText( - "120/80", - fontSize: SizeConfig.textMultiplier * 2, - color: Colors.grey.shade800, - fontWeight: FontWeight.normal, - ), - ], - ), - Row( - children: [ - AppText( - "${TranslationBase.of(context).temperature}", - fontSize: SizeConfig.textMultiplier * 1.8, - color: Colors.black, - fontWeight: FontWeight.w700, - ), - SizedBox( - width: 8, - ), - AppText( - "37.5(C), 98.6(F)", - fontSize: SizeConfig.textMultiplier * 2, - color: Colors.grey.shade800, - fontWeight: FontWeight.normal, - ), - ], - ), - ], - ), - SizedBox( - height: 4, - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Row( - children: [ - AppText( - "${TranslationBase.of(context).pulseBeats} :", - fontSize: SizeConfig.textMultiplier * 1.8, - color: Colors.black, - fontWeight: FontWeight.w700, - ), - SizedBox( - width: 8, + margin: + EdgeInsets.symmetric(vertical: 16, horizontal: 16), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + CheckboxListTile( + title: AppText( + TranslationBase.of(context).inPatient, + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.1, ), - AppText( - "80", - fontSize: SizeConfig.textMultiplier * 2, - color: Colors.grey.shade800, - fontWeight: FontWeight.normal, + value: _inPatient, + onChanged: (newValue) { + setState(() { + _inPatient = newValue; + }); + }, + controlAffinity: ListTileControlAffinity.leading, + contentPadding: EdgeInsets.all(0), + ), + CheckboxListTile( + title: AppText( + TranslationBase.of(context).emergencyCase, + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.1, ), - ], - ), - ], - ), - SizedBox( - height: 16, - ), - AppText( - TranslationBase.of(context).chiefComplaintsAndSymptoms, - fontWeight: FontWeight.bold, - fontSize: SizeConfig.textMultiplier * 2.5, - ), - SizedBox( - height: 8, - ), - AppText( - TranslationBase.of(context) - .patientFeelsPainInHisBackAndCough, - fontWeight: FontWeight.normal, - fontSize: SizeConfig.textMultiplier * 2.0, - ), - SizedBox( - height: 8, - ), - Container( - child: TextField( - decoration: Helpers.textFieldSelectorDecoration( - TranslationBase.of(context).additionalTextComplaints, - null, - false), - enabled: true, - controller: _additionalComplaintsController, - keyboardType: TextInputType.text, - minLines: 4, - maxLines: 6, - )), - SizedBox( - height: 16, - ), - AppText( - TranslationBase.of(context).otherConditions, - fontWeight: FontWeight.bold, - fontSize: SizeConfig.textMultiplier * 2.0, - ), - ...List.generate( - conditionsData.length, - (index) => CheckboxListTile( - title: AppText( - conditionsData[index]['name'], - fontWeight: FontWeight.bold, - fontSize: SizeConfig.textMultiplier * 2.1, + value: _emergencyCase, + onChanged: (newValue) { + setState(() { + _emergencyCase = newValue; + }); + }, + controlAffinity: ListTileControlAffinity.leading, + contentPadding: EdgeInsets.all(0), + ), + Container( + height: screenSize.height * 0.070, + child: TextField( + decoration: Helpers.textFieldSelectorDecoration( + TranslationBase.of(context) + .durationOfIllness, + null, + false), + enabled: true, + controller: _durationOfIllnessController, + inputFormatters: [ + FilteringTextInputFormatter.allow( + RegExp(ONLY_NUMBERS)) + ], + keyboardType: TextInputType.number, + )), + SizedBox( + height: 10, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + AppText( + "BP (H/L)", + fontSize: SizeConfig.textMultiplier * 1.8, + color: Colors.black, + fontWeight: FontWeight.w700, + ), + SizedBox( + width: 8, + ), + AppText( + "${model.patientVitalSigns.bloodPressureHigher}/${model.patientVitalSigns.bloodPressureLower}", + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.grey.shade800, + fontWeight: FontWeight.normal, + ), + ], ), - value: conditionsData[index]['isChecked'], - onChanged: (newValue) { - setState(() { - conditionsData[index]['isChecked'] = newValue; - }); - }, - controlAffinity: ListTileControlAffinity.leading, - contentPadding: EdgeInsets.all(0), - )), - SizedBox( - height: 8, - ), - Container( - height: screenSize.height * 0.070, - child: TextField( - decoration: Helpers.textFieldSelectorDecoration( - TranslationBase.of(context).other, - null, - false), - enabled: true, - controller: _otherController, - keyboardType: TextInputType.text, - )), - SizedBox( - height: 8, - ), - Container( - height: screenSize.height * 0.070, - child: TextField( - decoration: Helpers.textFieldSelectorDecoration( - TranslationBase.of(context).how, - null, - false), - enabled: true, - controller: _howController, - keyboardType: TextInputType.text, - )), - SizedBox( - height: 8, - ), - Row( - children: [ - Expanded( - child: Container( + Row( + children: [ + AppText( + "${TranslationBase.of(context).temperature}", + fontSize: SizeConfig.textMultiplier * 1.8, + color: Colors.black, + fontWeight: FontWeight.w700, + ), + SizedBox( + width: 8, + ), + AppText( + "${model.patientVitalSigns.temperatureCelcius}(C), ${model.patientVitalSigns.temperatureCelcius * (9 / 5) + 32}(F)", + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.grey.shade800, + fontWeight: FontWeight.normal, + ), + ], + ), + ], + ), + SizedBox( + height: 4, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + AppText( + "${TranslationBase.of(context).pulseBeats} :", + fontSize: SizeConfig.textMultiplier * 1.8, + color: Colors.black, + fontWeight: FontWeight.w700, + ), + SizedBox( + width: 8, + ), + AppText( + "${model.patientVitalSigns.pulseBeatPerMinute}", + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.grey.shade800, + fontWeight: FontWeight.normal, + ), + ], + ), + ], + ), + SizedBox( + height: 16, + ), + AppText( + TranslationBase.of(context) + .chiefComplaintsAndSymptoms, + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.5, + ), + SizedBox( + height: 8, + ), + AppText( + TranslationBase.of(context) + .patientFeelsPainInHisBackAndCough, + fontWeight: FontWeight.normal, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + SizedBox( + height: 8, + ), + Container( + child: TextField( + decoration: Helpers.textFieldSelectorDecoration( + TranslationBase.of(context) + .additionalTextComplaints, + helpers.parseHtmlString(model + .patientChiefComplaintList[0] + .chiefComplaint), + false), + enabled: false, + controller: _additionalComplaintsController, + keyboardType: TextInputType.text, + /*minLines: 4, + maxLines: 6,*/ + )), + SizedBox( + height: 16, + ), + AppText( + TranslationBase.of(context).otherConditions, + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + ...List.generate( + conditionsData.length, + (index) => CheckboxListTile( + title: AppText( + conditionsData[index]['name'], + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.1, + ), + value: conditionsData[index]['isChecked'], + onChanged: (newValue) { + setState(() { + conditionsData[index]['isChecked'] = + newValue; + }); + }, + controlAffinity: + ListTileControlAffinity.leading, + contentPadding: EdgeInsets.all(0), + )), + SizedBox( + height: 8, + ), + Container( height: screenSize.height * 0.070, child: TextField( decoration: Helpers.textFieldSelectorDecoration( - TranslationBase.of(context).when, + TranslationBase.of(context).other, null, false), enabled: true, - controller: _whenController, + controller: _otherController, keyboardType: TextInputType.text, )), - ), - SizedBox( - width: 4, - ), - Expanded( - child: Container( + SizedBox( + height: 8, + ), + Container( height: screenSize.height * 0.070, child: TextField( decoration: Helpers.textFieldSelectorDecoration( - TranslationBase.of(context).where, + TranslationBase.of(context).how, null, false), enabled: true, - controller: _whereController, + controller: _howController, keyboardType: TextInputType.text, )), - ), - ], - ), - SizedBox( - height: 8, - ), - Container( - child: TextField( - decoration: Helpers.textFieldSelectorDecoration( - TranslationBase.of(context).specifyPossibleLineManagement, - null, - false), - enabled: true, - controller: _managementsLineController, - keyboardType: TextInputType.text, - minLines: 4, - maxLines: 6, - )), - SizedBox( - height: 16, - ), - AppText( - TranslationBase.of(context) - .significantSigns, - fontWeight: FontWeight.bold, - fontSize: SizeConfig.textMultiplier * 2.0, - ), - SizedBox( - height: 8, - ), - Container( - child: TextField( - decoration: Helpers.textFieldSelectorDecoration( - TranslationBase.of(context).backAbdomen, - null, - false), - enabled: true, - controller: _signsController, - keyboardType: TextInputType.text, - minLines: 4, - maxLines: 6, - )), - SizedBox( - height: 16, - ), - AppButton( - title: TranslationBase.of(context).next, - color: HexColor("#B8382B"), - onPressed: (){ - Navigator.of(context).pushNamed(PATIENT_UCAF_DETAIL, arguments: {'patient': patient}); - }, + SizedBox( + height: 8, + ), + Row( + children: [ + Expanded( + child: Container( + height: screenSize.height * 0.070, + child: TextField( + decoration: + Helpers.textFieldSelectorDecoration( + TranslationBase.of(context).when, + null, + false), + enabled: true, + controller: _whenController, + keyboardType: TextInputType.text, + )), + ), + SizedBox( + width: 4, + ), + Expanded( + child: Container( + height: screenSize.height * 0.070, + child: TextField( + decoration: + Helpers.textFieldSelectorDecoration( + TranslationBase.of(context).where, + null, + false), + enabled: true, + controller: _whereController, + keyboardType: TextInputType.text, + )), + ), + ], + ), + SizedBox( + height: 8, + ), + Container( + child: TextField( + decoration: Helpers.textFieldSelectorDecoration( + TranslationBase.of(context) + .specifyPossibleLineManagement, + null, + false), + enabled: true, + controller: _managementsLineController, + keyboardType: TextInputType.text, + minLines: 4, + maxLines: 6, + )), + SizedBox( + height: 16, + ), + AppText( + TranslationBase.of(context).significantSigns, + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + SizedBox( + height: 8, + ), + Container( + child: TextField( + decoration: Helpers.textFieldSelectorDecoration( + TranslationBase.of(context).backAbdomen, + null, + false), + enabled: true, + controller: _signsController, + keyboardType: TextInputType.text, + )), + SizedBox( + height: 16, + ), + AppButton( + title: TranslationBase.of(context).next, + color: HexColor("#B8382B"), + onPressed: () { + Navigator.of(context).pushNamed( + PATIENT_UCAF_DETAIL, + arguments: {'patient': patient}); + }, + ), + ], + ), ), ], ), + ) + : Container( + child: Center( + child: AppText( + model.patientVitalSigns == null + ? TranslationBase.of(context).vitalSignEmptyMsg + : TranslationBase.of(context).chiefComplaintEmptyMsg, + fontWeight: FontWeight.normal, + color: HexColor("#B8382B"), + fontSize: SizeConfig.textMultiplier * 2.5, + ), + ), ), - ], - ), - ), ), ); } diff --git a/lib/screens/patients/profile/admission-request/admission-request-detail-screen.dart b/lib/screens/patients/profile/admission-request/admission-request-detail-screen.dart index 9a474779..7ccc3ade 100644 --- a/lib/screens/patients/profile/admission-request/admission-request-detail-screen.dart +++ b/lib/screens/patients/profile/admission-request/admission-request-detail-screen.dart @@ -124,7 +124,10 @@ class _AdmissionRequestDetailScreenState ListSelectDialog dialog = ListSelectDialog( list: model.speciality, - attributeName: model.selectedLanguage == 'ar' ? 'nameAr' :'nameEn' , + attributeName: + model.selectedLanguage == 'ar' + ? 'nameAr' + : 'nameEn', attributeValueId: 'id', okText: TranslationBase.of(context) @@ -149,7 +152,12 @@ class _AdmissionRequestDetailScreenState TranslationBase.of(context) .speciality, _selectedSpeciality != null - ? model.selectedLanguage == 'ar' ? _selectedSpeciality['nameAr'] : _selectedSpeciality['nameEn'] + ? model.selectedLanguage == + 'ar' + ? _selectedSpeciality[ + 'nameAr'] + : _selectedSpeciality[ + 'nameEn'] : null, true), enabled: false, @@ -163,36 +171,42 @@ class _AdmissionRequestDetailScreenState height: screenSize.height * 0.070, child: InkWell( onTap: model.doctorsList != null && - model.doctorsList.length > 0 + model.doctorsList.length > 0 ? () { - ListSelectDialog dialog = - ListSelectDialog( - list: model.doctorsList, - attributeName: 'DoctorName', - attributeValueId: 'DoctorID', - okText: TranslationBase.of(context).ok, - okFunction: (selectedValue) { - setState(() { - _selectedDoctor = selectedValue; - }); - }, - ); - showDialog( - barrierDismissible: false, - context: context, - builder: (BuildContext context) { - return dialog; - }, - ); - } + ListSelectDialog dialog = + ListSelectDialog( + list: model.doctorsList, + attributeName: 'DoctorName', + attributeValueId: 'DoctorID', + okText: + TranslationBase.of(context) + .ok, + okFunction: (selectedValue) { + setState(() { + _selectedDoctor = + selectedValue; + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; + }, + ); + } : null, child: TextField( - decoration: Helpers.textFieldSelectorDecoration( - TranslationBase.of(context).doctor, - _selectedDoctor != null - ? _selectedDoctor['DoctorName'] - : null, - true), + decoration: + Helpers.textFieldSelectorDecoration( + TranslationBase.of(context) + .doctor, + _selectedDoctor != null + ? _selectedDoctor[ + 'DoctorName'] + : null, + true), enabled: false, ), ), @@ -202,23 +216,22 @@ class _AdmissionRequestDetailScreenState ), Container( height: screenSize.height * 0.070, - decoration: - Helpers.containerBorderDecoration( - Color(0xFFEEEEEE), - Color(0xFFCCCCCC), + decoration: Helpers.containerBorderDecoration( + Color(0xFFEEEEEE), Color(0xFFCCCCCC), borderWidth: 0.0), child: InkWell( onTap: () => null, child: TextField( decoration: - Helpers.textFieldSelectorDecoration( - TranslationBase.of(context).referringDate, - null, - true, - suffixIcon: Icon( - Icons.calendar_today, - color: Color(0xFFCCCCCC), - )), + Helpers.textFieldSelectorDecoration( + TranslationBase.of(context) + .referringDate, + null, + true, + suffixIcon: Icon( + Icons.calendar_today, + color: Color(0xFFCCCCCC), + )), enabled: false, ), ), @@ -228,17 +241,19 @@ class _AdmissionRequestDetailScreenState ), Container( decoration: - Helpers.containerBorderDecoration( - Color(0xFFEEEEEE), - Color(0xFFCCCCCC), - borderWidth: 0.0), + Helpers.containerBorderDecoration( + Color(0xFFEEEEEE), + Color(0xFFCCCCCC), + borderWidth: 0.0), height: screenSize.height * 0.070, child: TextField( decoration: - Helpers.textFieldSelectorDecoration( - TranslationBase.of(context).referringDoctor, - null, - true, dropDownColor: Color(0xFFCCCCCC)), + Helpers.textFieldSelectorDecoration( + TranslationBase.of(context) + .referringDoctor, + null, + true, + dropDownColor: Color(0xFFCCCCCC)), enabled: false, // controller: _remarksController, keyboardType: TextInputType.text, @@ -255,8 +270,10 @@ class _AdmissionRequestDetailScreenState child: AppButton( title: TranslationBase.of(context).next, color: HexColor("#B8382B"), - onPressed: (){ - Navigator.of(context).pushNamed(PATIENT_ADMISSION_REQUEST_2, arguments: {'patient': patient}); + onPressed: () { + Navigator.of(context).pushNamed( + PATIENT_ADMISSION_REQUEST_2, + arguments: {'patient': patient}); }, ), ), diff --git a/lib/screens/patients/profile/admission-request/admission-request_second-screen.dart b/lib/screens/patients/profile/admission-request/admission-request_second-screen.dart index 52995ab4..3c1e06dc 100644 --- a/lib/screens/patients/profile/admission-request/admission-request_second-screen.dart +++ b/lib/screens/patients/profile/admission-request/admission-request_second-screen.dart @@ -139,13 +139,13 @@ class _AdmissionRequestSecondScreenState _emergencyAdmission = newValue; }); }, - controlAffinity: ListTileControlAffinity.leading, + controlAffinity: + ListTileControlAffinity.leading, contentPadding: EdgeInsets.all(0), ), CheckboxListTile( title: AppText( - TranslationBase.of(context) - .patientPregnant, + TranslationBase.of(context).patientPregnant, fontWeight: FontWeight.normal, fontSize: SizeConfig.textMultiplier * 2.1, ), @@ -155,28 +155,32 @@ class _AdmissionRequestSecondScreenState _patientPregnant = newValue; }); }, - controlAffinity: ListTileControlAffinity.leading, + controlAffinity: + ListTileControlAffinity.leading, contentPadding: EdgeInsets.all(0), ), Container( child: TextField( - decoration: Helpers.textFieldSelectorDecoration( - TranslationBase.of(context).treatmentLine, + decoration: + Helpers.textFieldSelectorDecoration( + TranslationBase.of(context) + .treatmentLine, null, false), - enabled: true, - controller: _treatmentLineController, - keyboardType: TextInputType.text, - minLines: 4, - maxLines: 6, - )), + enabled: true, + controller: _treatmentLineController, + keyboardType: TextInputType.text, + minLines: 4, + maxLines: 6, + )), SizedBox( height: 10, ), Container( height: screenSize.height * 0.070, child: InkWell( - onTap: /*model.doctorsList != null && + onTap: + /*model.doctorsList != null && model.doctorsList.length > 0 ? () { ListSelectDialog dialog = @@ -199,14 +203,17 @@ class _AdmissionRequestSecondScreenState }, ); } - :*/ null, + :*/ + null, child: TextField( - decoration: Helpers.textFieldSelectorDecoration( - TranslationBase.of(context).ward, - /* _selectedWard != null + decoration: + Helpers.textFieldSelectorDecoration( + TranslationBase.of(context).ward, + /* _selectedWard != null ? _selectedWard['DoctorName'] - :*/ null, - true), + :*/ + null, + true), enabled: false, ), ), @@ -224,13 +231,15 @@ class _AdmissionRequestSecondScreenState _preAnesthesiaReferred = newValue; }); }, - controlAffinity: ListTileControlAffinity.leading, + controlAffinity: + ListTileControlAffinity.leading, contentPadding: EdgeInsets.all(0), ), Container( height: screenSize.height * 0.070, child: InkWell( - onTap: /*model.doctorsList != null && + onTap: + /*model.doctorsList != null && model.doctorsList.length > 0 ? () { ListSelectDialog dialog = @@ -253,14 +262,18 @@ class _AdmissionRequestSecondScreenState }, ); } - :*/ null, + :*/ + null, child: TextField( - decoration: Helpers.textFieldSelectorDecoration( - TranslationBase.of(context).admissionType, - /* _admissionType != null + decoration: + Helpers.textFieldSelectorDecoration( + TranslationBase.of(context) + .admissionType, + /* _admissionType != null ? _admissionType['DoctorName'] - :*/ null, - true), + :*/ + null, + true), enabled: false, ), ), @@ -271,7 +284,8 @@ class _AdmissionRequestSecondScreenState Container( height: screenSize.height * 0.070, child: InkWell( - onTap: /*model.doctorsList != null && + onTap: + /*model.doctorsList != null && model.doctorsList.length > 0 ? () { ListSelectDialog dialog = @@ -294,14 +308,18 @@ class _AdmissionRequestSecondScreenState }, ); } - :*/ null, + :*/ + null, child: TextField( - decoration: Helpers.textFieldSelectorDecoration( - TranslationBase.of(context).diagnosis, - /* _admissionType != null + decoration: + Helpers.textFieldSelectorDecoration( + TranslationBase.of(context) + .diagnosis, + /* _admissionType != null ? _admissionType['DoctorName'] - :*/ null, - true), + :*/ + null, + true), enabled: false, ), ), @@ -311,23 +329,26 @@ class _AdmissionRequestSecondScreenState ), Container( child: TextField( - decoration: Helpers.textFieldSelectorDecoration( - TranslationBase.of(context).preOperativeOrders, + decoration: + Helpers.textFieldSelectorDecoration( + TranslationBase.of(context) + .preOperativeOrders, null, false), - enabled: true, - controller: _preOperativeOrdersController, - keyboardType: TextInputType.text, - minLines: 4, - maxLines: 6, - )), + enabled: true, + controller: _preOperativeOrdersController, + keyboardType: TextInputType.text, + minLines: 4, + maxLines: 6, + )), SizedBox( height: 10, ), Container( height: screenSize.height * 0.070, child: InkWell( - onTap: /*model.doctorsList != null && + onTap: + /*model.doctorsList != null && model.doctorsList.length > 0 ? () { ListSelectDialog dialog = @@ -350,14 +371,18 @@ class _AdmissionRequestSecondScreenState }, ); } - :*/ null, + :*/ + null, child: TextField( - decoration: Helpers.textFieldSelectorDecoration( - TranslationBase.of(context).allergies, - /* _admissionType != null + decoration: + Helpers.textFieldSelectorDecoration( + TranslationBase.of(context) + .allergies, + /* _admissionType != null ? _admissionType['DoctorName'] - :*/ null, - true), + :*/ + null, + true), enabled: false, ), ), @@ -374,8 +399,10 @@ class _AdmissionRequestSecondScreenState child: AppButton( title: TranslationBase.of(context).next, color: HexColor("#B8382B"), - onPressed: (){ - Navigator.of(context).pushNamed(PATIENT_ADMISSION_REQUEST_3, arguments: {'patient': patient}); + onPressed: () { + Navigator.of(context).pushNamed( + PATIENT_ADMISSION_REQUEST_3, + arguments: {'patient': patient}); }, ), ), diff --git a/lib/screens/patients/profile/vital_sign/vital-signs-screen.dart b/lib/screens/patients/profile/vital_sign/vital-signs-screen.dart index c66555c1..a53a3619 100644 --- a/lib/screens/patients/profile/vital_sign/vital-signs-screen.dart +++ b/lib/screens/patients/profile/vital_sign/vital-signs-screen.dart @@ -415,43 +415,57 @@ class _TemperatureWidgetState extends State { Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Row( - children: [ - AppText( - "${TranslationBase.of(context).temperature} (C):", - fontSize: SizeConfig.textMultiplier * 1.8, - color: Colors.black, - fontWeight: FontWeight.w700, - ), - SizedBox( - width: 8, - ), - AppText( - "${widget.vitalSign.temperatureCelcius}", - fontSize: SizeConfig.textMultiplier * 2, - color: Colors.grey.shade800, - fontWeight: FontWeight.normal, - ), - ], + Expanded( + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: AppText( + "${TranslationBase.of(context).temperature} (C):", + fontSize: SizeConfig.textMultiplier * 1.8, + color: Colors.black, + fontWeight: FontWeight.w700, + ), + ), + SizedBox( + width: 8, + ), + Expanded( + child: AppText( + "${widget.vitalSign.temperatureCelcius}", + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.grey.shade800, + fontWeight: FontWeight.normal, + ), + ), + ], + ), ), - Row( - children: [ - AppText( - "${TranslationBase.of(context).temperature} (F):", - fontSize: SizeConfig.textMultiplier * 1.8, - color: Colors.black, - fontWeight: FontWeight.w700, - ), - SizedBox( - width: 8, - ), - AppText( - "${widget.vitalSign.temperatureCelcius * (9 / 5) + 32}", - fontSize: SizeConfig.textMultiplier * 2, - color: Colors.grey.shade800, - fontWeight: FontWeight.normal, - ), - ], + Expanded( + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: AppText( + "${TranslationBase.of(context).temperature} (F):", + fontSize: SizeConfig.textMultiplier * 1.8, + color: Colors.black, + fontWeight: FontWeight.w700, + ), + ), + SizedBox( + width: 8, + ), + Expanded( + child: AppText( + "${widget.vitalSign.temperatureCelcius * (9 / 5) + 32}", + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.grey.shade800, + fontWeight: FontWeight.normal, + ), + ), + ], + ), ), ], ), @@ -534,44 +548,59 @@ class _PulseWidgetState extends State { children: [ Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, children: [ - Row( - children: [ - AppText( - "${TranslationBase.of(context).pulseBeats}", - fontSize: SizeConfig.textMultiplier * 1.8, - color: Colors.black, - fontWeight: FontWeight.w700, - ), - SizedBox( - width: 8, - ), - AppText( - "${widget.vitalSign.pulseBeatPerMinute}", - fontSize: SizeConfig.textMultiplier * 2, - color: Colors.grey.shade800, - fontWeight: FontWeight.normal, - ), - ], + Expanded( + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: AppText( + "${TranslationBase.of(context).pulseBeats}", + fontSize: SizeConfig.textMultiplier * 1.8, + color: Colors.black, + fontWeight: FontWeight.w700, + ), + ), + SizedBox( + width: 8, + ), + Expanded( + child: AppText( + "${widget.vitalSign.pulseBeatPerMinute}", + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.grey.shade800, + fontWeight: FontWeight.normal, + ), + ), + ], + ), ), - Row( - children: [ - AppText( - "${TranslationBase.of(context).rhythm}", - fontSize: SizeConfig.textMultiplier * 1.8, - color: Colors.black, - fontWeight: FontWeight.w700, - ), - SizedBox( - width: 8, - ), - AppText( - "${widget.vitalSign.pulseRhythm}", - fontSize: SizeConfig.textMultiplier * 2, - color: Colors.grey.shade800, - fontWeight: FontWeight.normal, - ), - ], + Expanded( + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: AppText( + "${TranslationBase.of(context).rhythm}", + fontSize: SizeConfig.textMultiplier * 1.8, + color: Colors.black, + fontWeight: FontWeight.w700, + ), + ), + SizedBox( + width: 8, + ), + Expanded( + child: AppText( + "${widget.vitalSign.pulseRhythm}", + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.grey.shade800, + fontWeight: FontWeight.normal, + ), + ), + ], + ), ), ], ), @@ -628,43 +657,57 @@ class _RespirationWidgetState extends State { Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Row( - children: [ - AppText( - "${TranslationBase.of(context).respBeats}", - fontSize: SizeConfig.textMultiplier * 1.8, - color: Colors.black, - fontWeight: FontWeight.w700, - ), - SizedBox( - width: 8, - ), - AppText( - "${widget.vitalSign.respirationBeatPerMinute}", - fontSize: SizeConfig.textMultiplier * 2, - color: Colors.grey.shade800, - fontWeight: FontWeight.normal, - ), - ], + Expanded( + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: AppText( + "${TranslationBase.of(context).respBeats}", + fontSize: SizeConfig.textMultiplier * 1.8, + color: Colors.black, + fontWeight: FontWeight.w700, + ), + ), + SizedBox( + width: 8, + ), + Expanded( + child: AppText( + "${widget.vitalSign.respirationBeatPerMinute}", + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.grey.shade800, + fontWeight: FontWeight.normal, + ), + ), + ], + ), ), - Row( - children: [ - AppText( - "${TranslationBase.of(context).patternOfRespiration}", - fontSize: SizeConfig.textMultiplier * 1.8, - color: Colors.black, - fontWeight: FontWeight.w700, - ), - SizedBox( - width: 8, - ), - AppText( - "${widget.vitalSign.respirationPattern}", - fontSize: SizeConfig.textMultiplier * 2, - color: Colors.grey.shade800, - fontWeight: FontWeight.normal, - ), - ], + Expanded( + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: AppText( + "${TranslationBase.of(context).patternOfRespiration}", + fontSize: SizeConfig.textMultiplier * 1.8, + color: Colors.black, + fontWeight: FontWeight.w700, + ), + ), + SizedBox( + width: 8, + ), + Expanded( + child: AppText( + "${widget.vitalSign.respirationPattern}", + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.grey.shade800, + fontWeight: FontWeight.normal, + ), + ), + ], + ), ), ], ), @@ -721,43 +764,57 @@ class _BloodPressureWidgetState extends State { Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Row( - children: [ - AppText( - "${TranslationBase.of(context).bloodPressureDiastoleAndSystole}", - fontSize: SizeConfig.textMultiplier * 1.8, - color: Colors.black, - fontWeight: FontWeight.w700, - ), - SizedBox( - width: 8, - ), - AppText( - "${widget.vitalSign.bloodPressureHigher}, ${widget.vitalSign.bloodPressureLower}", - fontSize: SizeConfig.textMultiplier * 2, - color: Colors.grey.shade800, - fontWeight: FontWeight.normal, - ), - ], + Expanded( + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: AppText( + "${TranslationBase.of(context).bloodPressureDiastoleAndSystole}", + fontSize: SizeConfig.textMultiplier * 1.8, + color: Colors.black, + fontWeight: FontWeight.w700, + ), + ), + SizedBox( + width: 8, + ), + Expanded( + child: AppText( + "${widget.vitalSign.bloodPressureHigher}, ${widget.vitalSign.bloodPressureLower}", + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.grey.shade800, + fontWeight: FontWeight.normal, + ), + ), + ], + ), ), - Row( - children: [ - AppText( - "${TranslationBase.of(context).cuffLocation}", - fontSize: SizeConfig.textMultiplier * 1.8, - color: Colors.black, - fontWeight: FontWeight.w700, - ), - SizedBox( - width: 8, - ), - AppText( - "${widget.vitalSign.bloodPressureCuffLocation}", - fontSize: SizeConfig.textMultiplier * 2, - color: Colors.grey.shade800, - fontWeight: FontWeight.normal, - ), - ], + Expanded( + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: AppText( + "${TranslationBase.of(context).cuffLocation}", + fontSize: SizeConfig.textMultiplier * 1.8, + color: Colors.black, + fontWeight: FontWeight.w700, + ), + ), + SizedBox( + width: 8, + ), + Expanded( + child: AppText( + "${widget.vitalSign.bloodPressureCuffLocation}", + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.grey.shade800, + fontWeight: FontWeight.normal, + ), + ), + ], + ), ), ], ), @@ -766,44 +823,54 @@ class _BloodPressureWidgetState extends State { ), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, children: [ - Row( - children: [ - AppText( - "${TranslationBase.of(context).patientPosition}", - fontSize: SizeConfig.textMultiplier * 1.8, - color: Colors.black, - fontWeight: FontWeight.w700, - ), - SizedBox( - width: 8, - ), - AppText( - "${widget.vitalSign.bloodPressurePatientPosition}", - fontSize: SizeConfig.textMultiplier * 2, - color: Colors.grey.shade800, - fontWeight: FontWeight.normal, - ), - ], + Expanded( + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: AppText( + "${TranslationBase.of(context).patientPosition}", + fontSize: SizeConfig.textMultiplier * 1.8, + color: Colors.black, + fontWeight: FontWeight.w700, + ), + ), + SizedBox( + width: 8, + ), + Expanded( + child: AppText( + "${widget.vitalSign.bloodPressurePatientPosition}", + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.grey.shade800, + fontWeight: FontWeight.normal, + ), + ), + ], + ), ), - Row( - children: [ - AppText( - "${TranslationBase.of(context).cuffSize}", - fontSize: SizeConfig.textMultiplier * 1.8, - color: Colors.black, - fontWeight: FontWeight.w700, - ), - SizedBox( - width: 8, - ), - AppText( - "${widget.vitalSign.bloodPressureCuffSize}", - fontSize: SizeConfig.textMultiplier * 2, - color: Colors.grey.shade800, - fontWeight: FontWeight.normal, - ), - ], + Expanded( + child: Row( + children: [ + AppText( + "${TranslationBase.of(context).cuffSize}", + fontSize: SizeConfig.textMultiplier * 1.8, + color: Colors.black, + fontWeight: FontWeight.w700, + ), + SizedBox( + width: 8, + ), + AppText( + "${widget.vitalSign.bloodPressureCuffSize}", + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.grey.shade800, + fontWeight: FontWeight.normal, + ), + ], + ), ), ], ), @@ -953,43 +1020,47 @@ class _PainScaleWidgetState extends State { Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Row( - children: [ - AppText( - "${TranslationBase.of(context).painScale}", - fontSize: SizeConfig.textMultiplier * 1.8, - color: Colors.black, - fontWeight: FontWeight.w700, - ), - SizedBox( - width: 8, - ), - AppText( - "${widget.vitalSign.painScore}", - fontSize: SizeConfig.textMultiplier * 2, - color: Colors.grey.shade800, - fontWeight: FontWeight.normal, - ), - ], + Expanded( + child: Row( + children: [ + AppText( + "${TranslationBase.of(context).painScale}", + fontSize: SizeConfig.textMultiplier * 1.8, + color: Colors.black, + fontWeight: FontWeight.w700, + ), + SizedBox( + width: 8, + ), + AppText( + "${widget.vitalSign.painScore}", + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.grey.shade800, + fontWeight: FontWeight.normal, + ), + ], + ), ), - Row( - children: [ - AppText( - "${TranslationBase.of(context).painManagement}", - fontSize: SizeConfig.textMultiplier * 1.8, - color: Colors.black, - fontWeight: FontWeight.w700, - ), - SizedBox( - width: 8, - ), - AppText( - "${widget.vitalSign.isPainManagementDone}", - fontSize: SizeConfig.textMultiplier * 2, - color: Colors.grey.shade800, - fontWeight: FontWeight.normal, - ), - ], + Expanded( + child: Row( + children: [ + AppText( + "${TranslationBase.of(context).painManagement}", + fontSize: SizeConfig.textMultiplier * 1.8, + color: Colors.black, + fontWeight: FontWeight.w700, + ), + SizedBox( + width: 8, + ), + AppText( + "${widget.vitalSign.isPainManagementDone}", + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.grey.shade800, + fontWeight: FontWeight.normal, + ), + ], + ), ), ], ), diff --git a/lib/screens/prescription/add_prescription_form.dart b/lib/screens/prescription/add_prescription_form.dart index 6d1d7cf3..f39499e1 100644 --- a/lib/screens/prescription/add_prescription_form.dart +++ b/lib/screens/prescription/add_prescription_form.dart @@ -5,360 +5,38 @@ import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/model/post_prescrition_req_model.dart'; import 'package:doctor_app_flutter/core/viewModel/prescription_view_model.dart'; import 'package:doctor_app_flutter/models/livecare/transfer_to_admin.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/prescription/prescription_screen.dart'; import 'package:doctor_app_flutter/screens/prescription/prescription_warnings.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/patients/dynamic_elements.dart'; import 'package:doctor_app_flutter/widgets/shared/TextFields.dart'; import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_text_form_field.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_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/material.dart'; import 'package:hexcolor/hexcolor.dart'; +import 'package:intl/intl.dart'; -void addPrescriptionForm(context, PrescriptionViewModel model) { - TextEditingController durationController = TextEditingController(); - TextEditingController strengthController = TextEditingController(); - TextEditingController routeController = TextEditingController(); - TextEditingController frequencyController = TextEditingController(); - TextEditingController indicationController = TextEditingController(); - TextEditingController instructions = TextEditingController(); - - TextEditingController drugIdController = TextEditingController(); - TextEditingController doseController = TextEditingController(); - final GlobalKey formKey = GlobalKey(); - final double spaceBetweenTextFileds = 12; - +addPrescriptionForm( + context, PrescriptionViewModel model, PatiantInformtion patient) { showModalBottomSheet( isScrollControlled: true, context: context, builder: (BuildContext bc) { - return //BaseView( - //onModelReady: (model) => model.getDrugs(), - //builder: (BuildContext context, PrescriptionViewModel model, - //Widget child) => - DraggableScrollableSheet( - initialChildSize: 0.90, - maxChildSize: 0.90, - minChildSize: 0.9, - builder: - (BuildContext context, ScrollController scrollController) { - return SingleChildScrollView( - child: Container( - height: 980, - child: Padding( - padding: EdgeInsets.symmetric( - horizontal: 12.0, vertical: 10.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - //mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - AppText( - TranslationBase.of(context) - .medicines - .toUpperCase(), - fontWeight: FontWeight.w900, - ), - SizedBox( - height: spaceBetweenTextFileds, - ), - Container( - child: Form( - key: formKey, - child: Column( - //mainAxisAlignment: MainAxisAlignment.end, - children: [ - Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.all( - Radius.circular(6.0)), - border: Border.all( - width: 1.0, - color: HexColor("#CCCCCC"))), - child: TextFields( - hintText: TranslationBase.of(context) - .searchMedicine, - controller: drugIdController, - keyboardType: TextInputType.number, - validator: (value) { - if (value.isEmpty) - return TranslationBase.of(context) - .emptyMessage; - else - return null; - }), - ), - SizedBox( - height: spaceBetweenTextFileds, - ), - Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.all( - Radius.circular(6.0)), - border: Border.all( - width: 1.0, - color: HexColor("#CCCCCC"))), - child: TextFields( - hintText: TranslationBase.of(context) - .orderType, - ), - ), - SizedBox(height: spaceBetweenTextFileds), - Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.all( - Radius.circular(6.0)), - border: Border.all( - width: 1.0, - color: HexColor("#CCCCCC"))), - child: TextFields( - hintText: TranslationBase.of(context) - .strength, - keyboardType: TextInputType.number, - controller: strengthController, - validator: (value) { - if (value.isEmpty) - return TranslationBase.of(context) - .emptyMessage; - else - return null; - }, - ), - ), - SizedBox(height: spaceBetweenTextFileds), - Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.all( - Radius.circular(6.0)), - border: Border.all( - width: 1.0, - color: HexColor("#CCCCCC"))), - child: TextFields( - hintText: - TranslationBase.of(context).route, - controller: routeController, - keyboardType: TextInputType.number, - validator: (value) { - if (value.isEmpty) - return TranslationBase.of(context) - .emptyMessage; - else - return null; - }, - ), - ), - SizedBox(height: spaceBetweenTextFileds), - Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.all( - Radius.circular(6.0)), - border: Border.all( - width: 1.0, - color: HexColor("#CCCCCC"))), - child: TextFields( - hintText: TranslationBase.of(context) - .frequency, - controller: frequencyController, - keyboardType: TextInputType.number, - validator: (value) { - if (value.isEmpty) - return TranslationBase.of(context) - .emptyMessage; - else - return null; - }, - ), - ), - SizedBox(height: spaceBetweenTextFileds), - Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.all( - Radius.circular(6.0)), - border: Border.all( - width: 1.0, - color: HexColor("#CCCCCC"))), - child: TextFields( - hintText: TranslationBase.of(context) - .doseTime, - controller: doseController, - keyboardType: TextInputType.number, - validator: (value) { - if (value.isEmpty) - return TranslationBase.of(context) - .emptyMessage; - else - return null; - }, - ), - ), - SizedBox(height: spaceBetweenTextFileds), - Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.all( - Radius.circular(6.0)), - border: Border.all( - width: 1.0, - color: HexColor("#CCCCCC"))), - child: TextFields( - hintText: TranslationBase.of(context) - .indication, - controller: indicationController, - keyboardType: TextInputType.number, - validator: (value) { - if (value.isEmpty) - return TranslationBase.of(context) - .emptyMessage; - else - return null; - }, - ), - ), - SizedBox(height: spaceBetweenTextFileds), - Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.all( - Radius.circular(6.0)), - border: Border.all( - width: 1.0, - color: HexColor("#CCCCCC"))), - child: TextFields( - hintText: TranslationBase.of(context) - .fromDate, - keyboardType: TextInputType.datetime, - validator: (value) { - if (value.isEmpty) - return TranslationBase.of(context) - .emptyMessage; - else - return null; - }, - ), - ), - SizedBox(height: spaceBetweenTextFileds), - Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.all( - Radius.circular(6.0)), - border: Border.all( - width: 1.0, - color: HexColor("#CCCCCC"))), - child: TextFields( - hintText: TranslationBase.of(context) - .duration, - // borderColor: Colors.white, - keyboardType: TextInputType.number, - controller: durationController, - validator: (value) { - if (value.isEmpty) - return TranslationBase.of(context) - .emptyMessage; - else - return null; - }), - ), - SizedBox(height: spaceBetweenTextFileds), - Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.all( - Radius.circular(6.0)), - border: Border.all( - width: 1.0, - color: HexColor("#CCCCCC"))), - child: TextFields( - hintText: TranslationBase.of(context) - .instruction, - controller: indicationController, - keyboardType: TextInputType.number, - validator: (value) { - if (value.isEmpty) - return TranslationBase.of(context) - .emptyMessage; - else - return null; - }, - ), - ), - SizedBox(height: spaceBetweenTextFileds), - Container( - margin: EdgeInsets.all( - SizeConfig.widthMultiplier * 5), - child: Wrap( - alignment: WrapAlignment.center, - children: [ - AppButton( - title: TranslationBase.of(context) - .addMedication, - onPressed: () { - formKey.currentState.save(); - - if (formKey.currentState - .validate()) { - postProcedure( - model: model, - duration: - durationController.text, - dose: doseController.text, - frequency: - frequencyController.text, - route: routeController.text, - drugId: drugIdController.text, - strength: - strengthController.text, - indication: - indicationController.text, - instruction: - indicationController.text, - ); - Navigator.pop(context); - } - { - // Navigator.push( - // context, - // MaterialPageRoute( - // builder: (context) => - // NewPrescriptionScreen()), - // ); - } - }, - ), - ], - ), - ), - ], - ), - ), - ), - ], - ), - ), - ), - ); - }); - //); + return PrescriptionFormWidget(model, patient); }); } -// openAllergiesList(BuildContext context) { -// showModalBottomSheet( -// backgroundColor: Colors.white, -// isScrollControlled: true, -// context: context, -// builder: (context) { -// return AddAllergies( -// addAllergiesFun: (MySelectedAllergy mySelectedAllergy) { -// setState(() { -// widget.myAllergiesList.add(mySelectedAllergy); -// Navigator.of(context).pop(); -// }); -// }, -// ); -// }); -// } - postProcedure( {String duration, + String doseTimeIn, String dose, String drugId, String strength, @@ -366,7 +44,9 @@ postProcedure( String frequency, String indication, String instruction, - PrescriptionViewModel model}) async { + PrescriptionViewModel model, + DateTime doseTime, + PatiantInformtion patient}) async { PostPrescriptionReqModel postProcedureReqModel = new PostPrescriptionReqModel(); List sss = List(); @@ -379,7 +59,7 @@ postProcedure( "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMDAyIiwianRpIjoiOGFjNDRjZGQtOWE0Mi00M2YxLWE2YTQtMWQ4NzBmZmYwNTUyIiwiZW1haWwiOiIiLCJpZCI6IjEwMDIiLCJOYW1lIjoiVEVNUCAtIERPQ1RPUiIsIkVtcGxveWVlSWQiOiI0NzA5IiwiRmFjaWxpdHlHcm91cElkIjoiMDEwMjY2IiwiRmFjaWxpdHlJZCI6IjE1IiwiUGhhcmFtY3lGYWNpbGl0eUlkIjoiNTUiLCJJU19QSEFSTUFDWV9DT05ORUNURUQiOiJUcnVlIiwiRG9jdG9ySWQiOiI0NzA5IiwiU0VTU0lPTklEIjoiMjE1OTU2NDkiLCJDbGluaWNJZCI6IjEiLCJyb2xlIjpbIkRPQ1RPUlMiLCJIRUFEIERPQ1RPUlMiLCJBRE1JTklTVFJBVE9SUyIsIlJFQ0VQVElPTklTVCIsIkVSIE5VUlNFIiwiRVIgUkVDRVBUSU9OSVNUIiwiUEhBUk1BQ1kgQUNDT1VOVCBTVEFGRiIsIlBIQVJNQUNZIE5VUlNFIiwiSU5QQVRJRU5UIFBIQVJNQUNJU1QiLCJBRE1JU1NJT04gU1RBRkYiLCJBUFBST1ZBTCBTVEFGRiIsIkNPTlNFTlQgIiwiTUVESUNBTCBSRVBPUlQgLSBTSUNLIExFQVZFIE1BTkFHRVIiXSwibmJmIjoxNjA4NzM2NjY5LCJleHAiOjE2MDk2MDA2NjksImlhdCI6MTYwODczNjY2OX0.9EDgYrbe5fQA2CvgLdFT4s_PL7hD5R_Qggfpv4lDtUY"; sss.add(PrescriptionRequestModel( covered: true, - dose: int.parse(dose), + dose: 1, itemId: int.parse(drugId), doseUnitId: 1, route: int.parse(route), @@ -387,13 +67,13 @@ postProcedure( remarks: instruction, approvalRequired: true, icdcode10Id: "test2", - doseTime: 1, + doseTime: int.parse(doseTimeIn), duration: int.parse(duration), - doseStartDate: "2020-12-20T13:07:41.769Z")); + doseStartDate: doseTime.toIso8601String())); postProcedureReqModel.prescriptionRequestModel = sss; //postProcedureReqModel.procedures = controlsProcedure; - await model.postPrescription(postProcedureReqModel); + await model.postPrescription(postProcedureReqModel, patient.patientMRN); if (model.state == ViewState.ErrorLocal) { helpers.showErrorToast(model.error); @@ -401,3 +81,665 @@ postProcedure( DrAppToastMsg.showSuccesToast('Medication has been added'); } } + +class PrescriptionFormWidget extends StatefulWidget { + final PrescriptionViewModel model; + PatiantInformtion patient; + PrescriptionFormWidget(this.model, this.patient); + + @override + _PrescriptionFormWidgetState createState() => _PrescriptionFormWidgetState(); +} + +class _PrescriptionFormWidgetState extends State { + TextEditingController durationController = TextEditingController(); + TextEditingController strengthController = TextEditingController(); + TextEditingController routeController = TextEditingController(); + TextEditingController frequencyController = TextEditingController(); + TextEditingController indicationController = TextEditingController(); + TextEditingController instructionController = TextEditingController(); + DateTime selectedDate; + dynamic selectedDrug; + + TextEditingController drugIdController = TextEditingController(); + TextEditingController doseController = TextEditingController(); + final GlobalKey formKey = GlobalKey(); + final double spaceBetweenTextFileds = 12; + List referToList; + dynamic type; + dynamic strength; + dynamic route; + dynamic frequency; + dynamic duration; + dynamic doseTime; + + List strengthList; + List routeList; + List frequencyList; + List durationList; + List doseTimeList; + //PatiantInformtion patient; + dynamic _strength; + dynamic _selectedBranch; + @override + void initState() { + super.initState(); + referToList = List(); + strengthList = List(); + routeList = List(); + frequencyList = List(); + durationList = List(); + doseTimeList = List(); + + dynamic regularOrder = {"id": 1, "name": "regular Order"}; + dynamic urgentOrder = {"id": 2, "name": "urgent Order"}; + dynamic strength1 = {"id": 1, "name": "1"}; + dynamic strength2 = {"id": 2, "name": "2"}; + dynamic strength3 = {"id": 3, "name": "3"}; + dynamic route1 = {"id": 7, "name": "By Mouth"}; + dynamic route2 = {"id": 10, "name": "Inhale by Mouth"}; + dynamic route3 = {"id": 15, "name": "for INJECTION"}; + dynamic route4 = {"id": 17, "name": "Drops"}; + dynamic route5 = {"id": 18, "name": "Rub On"}; + dynamic route6 = {"id": 20, "name": "Spary"}; + dynamic route7 = {"id": 27, "name": "In Both EYES"}; + dynamic route8 = {"id": 28, "name": "In Both Ears"}; + dynamic route9 = {"id": 32, "name": "Intramuscular"}; + dynamic frequency1 = {"id": 1, "name": "2 Times a day"}; + dynamic frequency2 = {"id": 2, "name": "3 Times a day"}; + dynamic frequency3 = {"id": 3, "name": "4 Times a day"}; + dynamic frequency4 = {"id": 8, "name": "As Needed"}; + dynamic frequency5 = {"id": 9, "name": "Bed Time"}; + dynamic frequency6 = {"id": 11, "name": "Every Other Day"}; + dynamic frequency7 = {"id": 29, "name": "Every Eight Hours"}; + dynamic frequency8 = {"id": 34, "name": "As Directed"}; + dynamic duration1 = {"id": 1, "name": "For 1 Day"}; + dynamic duration2 = {"id": 2, "name": "For 2 Days"}; + dynamic duration3 = {"id": 3, "name": "For 3 Days"}; + dynamic duration4 = {"id": 4, "name": "For 4 Days"}; + dynamic duration5 = {"id": 5, "name": "For 5 Days"}; + dynamic duration6 = {"id": 6, "name": "For 6 Days"}; + dynamic duration7 = {"id": 7, "name": "For 7 Days"}; + dynamic duration8 = {"id": 8, "name": "For 8 Days"}; + dynamic duration9 = {"id": 9, "name": "For 9 Days"}; + dynamic duration10 = {"id": 10, "name": "For 10 Days"}; + dynamic duration11 = {"id": 14, "name": "For 14 Days"}; + dynamic doseTime1 = {"id": 1, "name": "Before Meals"}; + dynamic doseTime2 = {"id": 2, "name": "After Meals"}; + dynamic doseTime3 = {"id": 3, "name": "With Meals"}; + dynamic doseTime4 = {"id": 4, "name": "In The Morning"}; + dynamic doseTime5 = {"id": 5, "name": "In the Evening"}; + dynamic doseTime6 = {"id": 6, "name": "After Supper"}; + dynamic doseTime7 = {"id": 7, "name": "With Supper"}; + dynamic doseTime8 = {"id": 8, "name": "Before Breakfast"}; + dynamic doseTime9 = {"id": 9, "name": "In the Afternoon"}; + dynamic doseTime10 = {"id": 10, "name": "While wake"}; + dynamic doseTime11 = {"id": 12, "name": "Any Time"}; + dynamic doseTime12 = {"id": 21, "name": "Bed Time"}; + + doseTimeList.add(doseTime1); + doseTimeList.add(doseTime2); + doseTimeList.add(doseTime3); + doseTimeList.add(doseTime4); + doseTimeList.add(doseTime5); + doseTimeList.add(doseTime6); + doseTimeList.add(doseTime7); + doseTimeList.add(doseTime8); + doseTimeList.add(doseTime9); + doseTimeList.add(doseTime10); + doseTimeList.add(doseTime11); + doseTimeList.add(doseTime12); + frequencyList.add(frequency1); + frequencyList.add(frequency2); + frequencyList.add(frequency3); + frequencyList.add(frequency4); + frequencyList.add(frequency5); + frequencyList.add(frequency6); + frequencyList.add(frequency7); + frequencyList.add(frequency8); + routeList.add(route1); + routeList.add(route2); + routeList.add(route3); + routeList.add(route4); + routeList.add(route5); + routeList.add(route6); + routeList.add(route7); + routeList.add(route8); + routeList.add(route9); + strengthList.add(strength1); + strengthList.add(strength2); + strengthList.add(strength3); + durationList.add(duration1); + durationList.add(duration2); + durationList.add(duration3); + durationList.add(duration4); + durationList.add(duration5); + durationList.add(duration6); + durationList.add(duration7); + durationList.add(duration8); + durationList.add(duration9); + durationList.add(duration10); + durationList.add(duration11); + referToList.add(regularOrder); + referToList.add(urgentOrder); + } + + @override + Widget build(BuildContext context) { + final screenSize = MediaQuery.of(context).size; + // final routeArgs = ModalRoute.of(context).settings.arguments as Map; + // patient = routeArgs['patient']; + + return BaseView( + onModelReady: (model) => model.getDrugs(), + builder: (BuildContext context, PrescriptionViewModel model, + Widget child) => + DraggableScrollableSheet( + initialChildSize: 0.90, + maxChildSize: 0.90, + minChildSize: 0.9, + builder: + (BuildContext context, ScrollController scrollController) { + return SingleChildScrollView( + child: Container( + height: 980, + child: Padding( + padding: EdgeInsets.symmetric( + horizontal: 12.0, vertical: 10.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + //mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + AppText( + TranslationBase.of(context).medicines.toUpperCase(), + fontWeight: FontWeight.w900, + ), + SizedBox( + height: spaceBetweenTextFileds, + ), + Container( + child: Form( + key: formKey, + child: Column( + //mainAxisAlignment: MainAxisAlignment.end, + children: [ + Container( + height: screenSize.height * 0.070, + child: InkWell( + onTap: model.drugsList != null && + model.drugsList.length > 0 + ? () { + ListSelectDialog dialog = + ListSelectDialog( + list: model.drugsList, + attributeName: 'GenericName', + attributeValueId: 'ItemId', + okText: + TranslationBase.of(context) + .ok, + okFunction: (selectedValue) { + setState(() { + selectedDrug = + selectedValue; + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: + (BuildContext context) { + return dialog; + }, + ); + } + : null, + child: TextField( + decoration: textFieldSelectorDecoration( + TranslationBase.of(context).search, + selectedDrug != null + ? selectedDrug['GenericName'] + : null, + true), + enabled: false, + ), + ), + ), + SizedBox( + height: spaceBetweenTextFileds, + ), + Container( + height: screenSize.height * 0.070, + child: InkWell( + onTap: referToList != null + ? () { + ListSelectDialog dialog = + ListSelectDialog( + list: referToList, + attributeName: 'name', + attributeValueId: 'id', + okText: + TranslationBase.of(context) + .ok, + okFunction: (selectedValue) { + setState(() { + type = selectedValue; + _selectedBranch = null; + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: + (BuildContext context) { + return dialog; + }, + ); + } + : null, + child: TextField( + decoration: textFieldSelectorDecoration( + TranslationBase.of(context) + .orderType, + type != null ? type['name'] : null, + true), + enabled: false, + ), + ), + ), + SizedBox(height: spaceBetweenTextFileds), + Container( + height: screenSize.height * 0.070, + child: InkWell( + onTap: strengthList != null + ? () { + ListSelectDialog dialog = + ListSelectDialog( + list: strengthList, + attributeName: 'name', + attributeValueId: 'id', + okText: + TranslationBase.of(context) + .ok, + okFunction: (selectedValue) { + setState(() { + strength = selectedValue; + _selectedBranch = null; + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: + (BuildContext context) { + return dialog; + }, + ); + } + : null, + child: TextField( + decoration: textFieldSelectorDecoration( + TranslationBase.of(context) + .strength, + strength != null + ? strength['name'] + : null, + true), + enabled: false, + ), + ), + ), + SizedBox(height: spaceBetweenTextFileds), + Container( + height: screenSize.height * 0.070, + child: InkWell( + onTap: routeList != null + ? () { + ListSelectDialog dialog = + ListSelectDialog( + list: routeList, + attributeName: 'name', + attributeValueId: 'id', + okText: + TranslationBase.of(context) + .ok, + okFunction: (selectedValue) { + setState(() { + route = selectedValue; + _selectedBranch = null; + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: + (BuildContext context) { + return dialog; + }, + ); + } + : null, + child: TextField( + decoration: textFieldSelectorDecoration( + TranslationBase.of(context).route, + route != null + ? route['name'] + : null, + true), + enabled: false, + ), + ), + ), + SizedBox(height: spaceBetweenTextFileds), + Container( + height: screenSize.height * 0.070, + child: InkWell( + onTap: frequencyList != null + ? () { + ListSelectDialog dialog = + ListSelectDialog( + list: frequencyList, + attributeName: 'name', + attributeValueId: 'id', + okText: + TranslationBase.of(context) + .ok, + okFunction: (selectedValue) { + setState(() { + frequency = selectedValue; + _selectedBranch = null; + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: + (BuildContext context) { + return dialog; + }, + ); + } + : null, + child: TextField( + decoration: textFieldSelectorDecoration( + TranslationBase.of(context) + .frequency, + frequency != null + ? frequency['name'] + : null, + true), + enabled: false, + ), + ), + ), + SizedBox(height: spaceBetweenTextFileds), + Container( + height: screenSize.height * 0.070, + child: InkWell( + onTap: doseTimeList != null + ? () { + ListSelectDialog dialog = + ListSelectDialog( + list: doseTimeList, + attributeName: 'name', + attributeValueId: 'id', + okText: + TranslationBase.of(context) + .ok, + okFunction: (selectedValue) { + setState(() { + doseTime = selectedValue; + _selectedBranch = null; + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: + (BuildContext context) { + return dialog; + }, + ); + } + : null, + child: TextField( + decoration: textFieldSelectorDecoration( + TranslationBase.of(context) + .doseTime, + doseTime != null + ? doseTime['name'] + : null, + true), + enabled: false, + ), + ), + ), + SizedBox(height: spaceBetweenTextFileds), + Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(6.0)), + border: Border.all( + width: 1.0, + color: HexColor("#CCCCCC"))), + child: TextFields( + hintText: TranslationBase.of(context) + .indication, + controller: indicationController, + keyboardType: TextInputType.number, + validator: (value) { + if (value.isEmpty) + return TranslationBase.of(context) + .emptyMessage; + else + return null; + }, + ), + ), + SizedBox(height: spaceBetweenTextFileds), + Container( + height: screenSize.height * 0.070, + child: InkWell( + onTap: () => + selectDate(context, widget.model), + child: TextField( + decoration: + Helpers.textFieldSelectorDecoration( + TranslationBase.of(context) + .date, + selectedDate != null + ? "${DateUtils.convertStringToDateFormat(selectedDate.toString(), "yyyy-MM-dd")}" + : null, + true, + suffixIcon: Icon( + Icons.calendar_today, + color: Colors.black, + )), + enabled: false, + ), + ), + ), + SizedBox(height: spaceBetweenTextFileds), + Container( + height: screenSize.height * 0.070, + child: InkWell( + onTap: durationList != null + ? () { + ListSelectDialog dialog = + ListSelectDialog( + list: durationList, + attributeName: 'name', + attributeValueId: 'id', + okText: + TranslationBase.of(context) + .ok, + okFunction: (selectedValue) { + setState(() { + duration = selectedValue; + _selectedBranch = null; + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: + (BuildContext context) { + return dialog; + }, + ); + } + : null, + child: TextField( + decoration: textFieldSelectorDecoration( + TranslationBase.of(context) + .duration, + duration != null + ? duration['name'] + : null, + true), + enabled: false, + ), + ), + ), + SizedBox(height: spaceBetweenTextFileds), + Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(6.0)), + border: Border.all( + width: 1.0, + color: HexColor("#CCCCCC"))), + child: TextFields( + maxLines: 6, + minLines: 4, + hintText: TranslationBase.of(context) + .instruction, + controller: instructionController, + //keyboardType: TextInputType.number, + validator: (value) { + if (value.isEmpty) + return TranslationBase.of(context) + .emptyMessage; + else + return null; + }, + ), + ), + SizedBox(height: spaceBetweenTextFileds), + Container( + margin: EdgeInsets.all( + SizeConfig.widthMultiplier * 5), + child: Wrap( + alignment: WrapAlignment.center, + children: [ + AppButton( + title: TranslationBase.of(context) + .addMedication, + onPressed: () { + formKey.currentState.save(); + + if (formKey.currentState + .validate()) { + postProcedure( + patient: widget.patient, + doseTimeIn: + doseTime['id'].toString(), + model: widget.model, + duration: + duration['id'].toString(), + frequency: frequency['id'] + .toString(), + route: route['id'].toString(), + drugId: selectedDrug['ItemId'] + .toString(), + strength: + strength['id'].toString(), + indication: + indicationController.text, + instruction: + instructionController + .text, + doseTime: selectedDate); + Navigator.pop(context); + } + { + // Navigator.push( + // context, + // MaterialPageRoute( + // builder: (context) => + // NewPrescriptionScreen()), + // ); + } + }, + ), + ], + ), + ), + ], + ), + ), + ), + ], + ), + ), + ), + ); + }), + ); + } + + selectDate(BuildContext context, PrescriptionViewModel model) async { + DateTime selectedDate; + selectedDate = DateTime.now().add(Duration(hours: 10)); + final DateTime picked = await showDatePicker( + context: context, + initialDate: selectedDate, + firstDate: DateTime.now().add(Duration(hours: 15)), + lastDate: DateTime(2040), + initialEntryMode: DatePickerEntryMode.calendar, + ); + if (picked != null && picked != selectedDate) { + setState(() { + this.selectedDate = picked; + }); + } + } + + 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, + ), + ); + } +} diff --git a/lib/screens/prescription/prescription_screen.dart b/lib/screens/prescription/prescription_screen.dart index 06a6a218..142f3a98 100644 --- a/lib/screens/prescription/prescription_screen.dart +++ b/lib/screens/prescription/prescription_screen.dart @@ -33,452 +33,535 @@ class _NewPrescriptionScreenState extends State { @override Widget build(BuildContext context) { + final screenSize = MediaQuery.of(context).size; final routeArgs = ModalRoute.of(context).settings.arguments as Map; patient = routeArgs['patient']; return BaseView( - onModelReady: (model) => model.getPrescription(), - builder: (BuildContext context, PrescriptionViewModel model, - Widget child) => - AppScaffold( - isShowAppBar: true, - appBarTitle: TranslationBase.of(context).prescription, - body: NetworkBaseView( - baseViewModel: model, - child: SingleChildScrollView( - child: Container( - child: Column( - children: [ - Padding( - padding: EdgeInsets.all(8.0), - child: Row( - children: [ - AvatarWidget( - Icon( - patient.genderDescription == "Male" - ? DoctorApp.male - : DoctorApp.female_icon, - size: 70, - color: Colors.white, - ), - ), - SizedBox( - width: 20, - ), - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - patient.firstName + ' ' + patient.lastName, - color: Colors.black, - fontWeight: FontWeight.bold, - ), - if (model.prescriptionList.length > 0) - Row( - children: [ - AppText( - TranslationBase.of(context).age2, - color: Colors.black, - fontWeight: FontWeight.bold, - ), - SizedBox( - width: 5.0, - ), - AppText( - patient.age.toString(), - color: Colors.black, - fontWeight: FontWeight.normal, - ), - ], + onModelReady: (model) => model.getPrescription(mrn: patient.patientMRN), + builder: + (BuildContext context, PrescriptionViewModel model, Widget child) => + AppScaffold( + isShowAppBar: true, + appBarTitle: TranslationBase.of(context).prescription, + body: NetworkBaseView( + baseViewModel: model, + child: SingleChildScrollView( + child: Container( + child: Column( + children: [ + Padding( + padding: EdgeInsets.all(8.0), + child: Row( + children: [ + AvatarWidget( + Icon( + patient.genderDescription == "Male" + ? DoctorApp.male + : DoctorApp.female_icon, + size: 70, + color: Colors.white, ), - AppText( - "ALLERGIC TO: FOOD, ASPIRIN", - color: Color(0xFFB9382C), - fontWeight: FontWeight.bold, ), - ], - ) - ], - ), - ), - Divider( - height: 1.0, - thickness: 1.0, - color: Colors.grey, - ), - if (model.prescriptionList.length != 0) - SizedBox( - height: model.prescriptionList[0].rowcount == 0 - ? 200.0 - : 10.0), - //model.prescriptionList == null - if (model.prescriptionList.length != 0) - model.prescriptionList[0].rowcount == 0 - ? Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: - CrossAxisAlignment.stretch, - children: [ - InkWell( - onTap: () { - addPrescriptionForm(context, model); - //model.postPrescription(); - }, - child: CircleAvatar( - radius: 65, - backgroundColor: Color(0XFFB8382C), - child: CircleAvatar( - radius: 60, - backgroundColor: Colors.white, - child: Icon( - Icons.add, + SizedBox( + width: 20, + ), + Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + AppText( + patient.firstName + + ' ' + + patient.lastName, + color: Colors.black, + fontWeight: FontWeight.bold, + ), + //if (model.prescriptionList.length > 0) + Row( + children: [ + AppText( + TranslationBase.of(context).age2, color: Colors.black, - size: 45.0, + fontWeight: FontWeight.bold, ), - ), + SizedBox( + width: 5.0, + ), + AppText( + patient.age.toString(), + color: Colors.black, + fontWeight: FontWeight.normal, + ), + ], ), - ), - SizedBox( - height: 15.0, - ), - Row( - mainAxisAlignment: - MainAxisAlignment.center, - children: [ - AppText( - TranslationBase.of(context) - .noPrescriptionListed, - color: Colors.black, - fontWeight: FontWeight.w900, - ), - ], - ), - Row( - mainAxisAlignment: - MainAxisAlignment.center, - children: [ - AppText( - TranslationBase.of(context).addNow, - color: Color(0XFFB8382C), - fontWeight: FontWeight.w900, - ), - ], - ), - ], - ) - : Padding( - padding: EdgeInsets.all(14.0), - child: NetworkBaseView( - baseViewModel: model, - child: Column( - mainAxisAlignment: - MainAxisAlignment.start, - children: [ - InkWell( - child: Container( - height: 50.0, - width: 450.0, - decoration: BoxDecoration( - border: Border.all( - color: Colors.grey), - borderRadius: - BorderRadius.circular(10.0), - ), - child: Padding( - padding: EdgeInsets.all(8.0), - child: Row( - mainAxisAlignment: - MainAxisAlignment - .spaceBetween, - children: [ - AppText( - ' Add more medication', - fontWeight: FontWeight.w100, - fontSize: 12.5, - ), - Icon( - Icons.add, - color: Color(0XFFB8382C), - ) - ], + AppText( + "ALLERGIC TO: FOOD, ASPIRIN", + color: Color(0xFFB9382C), + fontWeight: FontWeight.bold, + ), + ], + ) + ], + ), + ), + Divider( + height: 1.0, + thickness: 1.0, + color: Colors.grey, + ), + (model.prescriptionList.length != 0) + ? SizedBox( + height: + model.prescriptionList[0].rowcount == 0 + ? 200.0 + : 10.0) + : SizedBox(height: 200.0), + //model.prescriptionList == null + (model.prescriptionList.length != 0) + ? model.prescriptionList[0].rowcount == 0 + ? Column( + mainAxisAlignment: + MainAxisAlignment.center, + crossAxisAlignment: + CrossAxisAlignment.stretch, + children: [ + InkWell( + onTap: () { + addPrescriptionForm( + context, model, patient); + //model.postPrescription(); + }, + child: CircleAvatar( + radius: 65, + backgroundColor: + Color(0XFFB8382C), + child: CircleAvatar( + radius: 60, + backgroundColor: Colors.white, + child: Icon( + Icons.add, + color: Colors.black, + size: 45.0, + ), ), ), ), - onTap: () { - addPrescriptionForm(context, model); - //model.postPrescription(); - }, - ), - SizedBox( - height: 15.0, - ), - ...List.generate( - model.prescriptionList[0].rowcount, - (index) => Container( - //height: 240, - child: Column( - children: [ - Row( - mainAxisAlignment: - MainAxisAlignment - .spaceBetween, - // crossAxisAlignment: - // CrossAxisAlignment.start, - children: [ - Container( - height: - MediaQuery.of(context) - .size - .height * - 0.23, - width: - MediaQuery.of(context) - .size - .width * - 0.09, - child: Column( - children: [ - AppText( - '8\nDEC', - color: Colors.green, - ) - ], - ), + SizedBox( + height: 15.0, + ), + Row( + mainAxisAlignment: + MainAxisAlignment.center, + children: [ + AppText( + TranslationBase.of(context) + .noPrescriptionListed, + color: Colors.black, + fontWeight: FontWeight.w900, + ), + ], + ), + Row( + mainAxisAlignment: + MainAxisAlignment.center, + children: [ + AppText( + TranslationBase.of(context) + .addNow, + color: Color(0XFFB8382C), + fontWeight: FontWeight.w900, + ), + ], + ), + ], + ) + : Padding( + padding: EdgeInsets.all(14.0), + child: NetworkBaseView( + baseViewModel: model, + child: Column( + mainAxisAlignment: + MainAxisAlignment.start, + children: [ + InkWell( + child: Container( + height: 50.0, + width: 450.0, + decoration: BoxDecoration( + border: Border.all( + color: Colors.grey), + borderRadius: + BorderRadius.circular( + 10.0), + ), + child: Padding( + padding: + EdgeInsets.all(8.0), + child: Row( + mainAxisAlignment: + MainAxisAlignment + .spaceBetween, + children: [ + AppText( + ' Add more medication', + fontWeight: + FontWeight.w100, + fontSize: 12.5, + ), + Icon( + Icons.add, + color: + Color(0XFFB8382C), + ) + ], ), - Container( - height: - MediaQuery.of(context) - .size - .height * - 0.282, - width: - MediaQuery.of(context) - .size - .width * - 0.77, - child: Column( + ), + ), + onTap: () { + addPrescriptionForm( + context, model, patient); + //model.postPrescription(); + }, + ), + SizedBox( + height: 15.0, + ), + ...List.generate( + model.prescriptionList[0] + .rowcount, + (index) => Container( + //height: 240, + child: Column( + children: [ + Row( + mainAxisAlignment: + MainAxisAlignment + .spaceBetween, + // crossAxisAlignment: + // CrossAxisAlignment.start, children: [ - Row( - children: [ - AppText( - 'Start Date:', - fontWeight: - FontWeight - .w700, - fontSize: 14.0, - ), - Expanded( - child: AppText( - model - .prescriptionList[ - 0] - .entityList[ - index] - .startDate, - fontSize: - 12.0, + Container( + height: MediaQuery.of( + context) + .size + .height * + 0.23, + width: MediaQuery.of( + context) + .size + .width * + 0.09, + child: Column( + children: [ + AppText( + '8\nDEC', + color: Colors + .green, + ) + ], + ), + ), + Container( + height: MediaQuery.of( + context) + .size + .height * + 0.282, + width: MediaQuery.of( + context) + .size + .width * + 0.77, + child: Column( + children: [ + Row( + children: [ + AppText( + 'Start Date:', + fontWeight: + FontWeight + .w700, + fontSize: + 14.0, + ), + Expanded( + child: + AppText( + model + .prescriptionList[0] + .entityList[index] + .startDate, + fontSize: + 12.0, + ), + ), + SizedBox( + width: + 6.0, + ), + AppText( + 'Order Type:', + fontWeight: + FontWeight + .w700, + fontSize: + 14.0, + ), + Expanded( + child: + AppText( + model + .prescriptionList[0] + .entityList[index] + .orderTypeDescription, + fontSize: + 13.0, + ), + ), + ], ), - ), - SizedBox( - width: 6.0, - ), - AppText( - 'Order Type:', - fontWeight: - FontWeight - .w700, - fontSize: 14.0, - ), - Expanded( - child: AppText( - model - .prescriptionList[ - 0] - .entityList[ - index] - .orderTypeDescription, - fontSize: - 13.0, + SizedBox( + height: 5.5, ), - ), - ], - ), - SizedBox( - height: 5.5, - ), - Row( - children: [ - Container( - child: Expanded( - child: - AppText( - model - .prescriptionList[ - 0] - .entityList[ - index] - .medicationName, - fontWeight: - FontWeight - .w700, - fontSize: - 15.0, - ), + Row( + children: [ + Container( + child: + Expanded( + child: + AppText( + model + .prescriptionList[0] + .entityList[index] + .medicationName, + fontWeight: + FontWeight.w700, + fontSize: + 15.0, + ), + ), + ) + ], ), - ) - ], - ), - SizedBox( - height: 5.5, - ), - Row( - children: [ - Expanded( - child: AppText( - model - .prescriptionList[ - 0] - .entityList[ - index] - .doseDetail, - fontSize: - 15.0, + SizedBox( + height: 5.5, ), - ) - ], - ), - SizedBox( - height: 3.0, - ), - Row( - children: [ - AppText( - 'Indication: ', - fontWeight: - FontWeight - .w700, - fontSize: 17.0, - ), - Expanded( - child: AppText( - model - .prescriptionList[ - 0] - .entityList[ - index] - .indication, - fontSize: - 15.0), - ) - ], - ), - SizedBox( - height: 18.0, - ), - Row( - children: [ - Expanded( - child: AppText( - model - .prescriptionList[ - 0] - .entityList[ - index] - .doctorName, - fontWeight: - FontWeight - .w700, + Row( + children: [ + Expanded( + child: + AppText( + model + .prescriptionList[0] + .entityList[index] + .doseDetail, + fontSize: + 15.0, + ), + ) + ], ), - ) - ], - ), - Row( - children: [ - Expanded( - child: AppText( - model - .prescriptionList[ - 0] - .entityList[ - index] - .remarks, - fontSize: - 14.0, + SizedBox( + height: 3.0, + ), + Row( + children: [ + AppText( + 'Indication: ', + fontWeight: + FontWeight + .w700, + fontSize: + 17.0, + ), + Expanded( + child: AppText( + model + .prescriptionList[0] + .entityList[index] + .indication, + fontSize: 15.0), + ) + ], + ), + SizedBox( + height: 18.0, + ), + Row( + children: [ + Expanded( + child: + AppText( + model + .prescriptionList[0] + .entityList[index] + .doctorName, + fontWeight: + FontWeight.w700, + ), + ) + ], + ), + Row( + children: [ + Expanded( + child: + AppText( + model + .prescriptionList[0] + .entityList[index] + .remarks, + fontSize: + 14.0, + ), + ), + ], + ), + SizedBox( + height: 10.0, ), - ), - ], - ), - SizedBox( - height: 10.0, - ), - Divider( - height: 0, - thickness: 1.0, - color: Colors.grey, + Divider( + height: 0, + thickness: + 1.0, + color: Colors + .grey, + ), + // SizedBox( + // height: 40, + // ), + ], + ), ), - // SizedBox( - // height: 40, - // ), - ], - ), - ), - Container( - height: - MediaQuery.of(context) - .size - .height * - 0.05, - width: - MediaQuery.of(context) - .size - .width * - 0.06, - child: Column( - children: [ - InkWell( - child: Icon( - Icons.edit), - onTap: () { - updatePrescriptionForm( - context, - model - .prescriptionList[ - 0] - .entityList[ - index] - .medicationName, - model - .prescriptionList[ - 0] - .entityList[ - index] - .medicineCode, - model, - ); - //model.postPrescription(); - }, + Container( + height: MediaQuery.of( + context) + .size + .height * + 0.05, + width: MediaQuery.of( + context) + .size + .width * + 0.06, + child: Column( + children: [ + InkWell( + child: Icon( + Icons + .edit), + onTap: () { + updatePrescriptionForm( + context, + model + .prescriptionList[ + 0] + .entityList[ + index] + .medicationName, + model + .prescriptionList[ + 0] + .entityList[ + index] + .medicineCode, + model, + ); + //model.postPrescription(); + }, + ), + ], + ), ), ], ), - ), - ], + ], + ), ), - ], + ), + ], + ), + ), + ) + : Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: + CrossAxisAlignment.stretch, + children: [ + InkWell( + onTap: () { + addPrescriptionForm( + context, model, patient); + //model.postPrescription(); + }, + child: CircleAvatar( + radius: 65, + backgroundColor: Color(0XFFB8382C), + child: CircleAvatar( + radius: 60, + backgroundColor: Colors.white, + child: Icon( + Icons.add, + color: Colors.black, + size: 45.0, ), ), ), - ], - ), - ), - ) - ], + ), + SizedBox( + height: 15.0, + ), + Row( + mainAxisAlignment: + MainAxisAlignment.center, + children: [ + AppText( + TranslationBase.of(context) + .noPrescriptionListed, + color: Colors.black, + fontWeight: FontWeight.w900, + ), + ], + ), + Row( + mainAxisAlignment: + MainAxisAlignment.center, + children: [ + AppText( + TranslationBase.of(context).addNow, + color: Color(0XFFB8382C), + fontWeight: FontWeight.w900, + ), + ], + ), + ], + ) + ], + ), + ), ), - ), - ), - )), + )), ); } + selectDate(BuildContext context, PrescriptionViewModel model) async { + DateTime selectedDate; + selectedDate = DateTime.now(); + final DateTime picked = await showDatePicker( + context: context, + initialDate: selectedDate, + firstDate: DateTime.now().add(Duration(hours: 2)), + lastDate: DateTime(2040), + initialEntryMode: DatePickerEntryMode.calendar, + ); + if (picked != null && picked != selectedDate) { + setState(() { + selectedDate = picked; + }); + } + } + void updatePrescriptionForm( context, String drugName, int drugId, PrescriptionViewModel model) { TextEditingController remarksController = TextEditingController(); @@ -637,7 +720,8 @@ class _NewPrescriptionScreenState extends State { updatePrescriptionReqModel.prescriptionRequestModel = sss; //postProcedureReqModel.procedures = controlsProcedure; - await model.updatePrescription(updatePrescriptionReqModel); + await model.updatePrescription( + updatePrescriptionReqModel, patient.patientMRN); if (model.state == ViewState.ErrorLocal) { helpers.showErrorToast(model.error); diff --git a/lib/screens/procedures/procedure_screen.dart b/lib/screens/procedures/procedure_screen.dart index c0afe663..a6b9791b 100644 --- a/lib/screens/procedures/procedure_screen.dart +++ b/lib/screens/procedures/procedure_screen.dart @@ -509,7 +509,7 @@ class _AddSelectedProcedureState extends State { baseViewModel: widget.model, child: SingleChildScrollView( child: Container( - height: 790, + height: 810, child: Padding( padding: EdgeInsets.all(12.0), child: Column( @@ -566,7 +566,7 @@ class _AddSelectedProcedureState extends State { maxLines: 5, ), SizedBox( - height: 80.0, + height: 50.0, ), Container( margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5), diff --git a/lib/util/translations_delegate_base.dart b/lib/util/translations_delegate_base.dart index ec34bf4c..b167b48e 100644 --- a/lib/util/translations_delegate_base.dart +++ b/lib/util/translations_delegate_base.dart @@ -544,6 +544,15 @@ class TranslationBase { localizedValues['referralEmptyMsg'][locale.languageCode]; String get referralSuccessMsg => localizedValues['referralSuccessMsg'][locale.languageCode]; + String get diagnoseType => localizedValues['diagnoseType'][locale.languageCode]; + String get condition => localizedValues['condition'][locale.languageCode]; + String get id => localizedValues['id'][locale.languageCode]; + String get quantity => localizedValues['quantity'][locale.languageCode]; + String get codeNo => localizedValues['codeNo'][locale.languageCode]; + String get covered => localizedValues['covered'][locale.languageCode]; + String get approvalRequired => localizedValues['approvalRequired'][locale.languageCode]; + String get uncoveredByDoctor => localizedValues['uncoveredByDoctor'][locale.languageCode]; + String get chiefComplaintEmptyMsg => localizedValues['chiefComplaintEmptyMsg'][locale.languageCode]; } class TranslationBaseDelegate extends LocalizationsDelegate { diff --git a/lib/widgets/shared/dialogs/dailog-list-select.dart b/lib/widgets/shared/dialogs/dailog-list-select.dart index 9e17d53b..68dce5a4 100644 --- a/lib/widgets/shared/dialogs/dailog-list-select.dart +++ b/lib/widgets/shared/dialogs/dailog-list-select.dart @@ -66,10 +66,13 @@ class _ListSelectDialogState extends State { ...widget.list .map((item) => RadioListTile( title: Text("${item[widget.attributeName].toString()}"), - groupValue: widget.selectedValue[widget.attributeValueId].toString(), + groupValue: widget.selectedValue[widget.attributeValueId] + .toString(), value: item[widget.attributeValueId].toString(), activeColor: Colors.blue.shade700, - selected: item[widget.attributeValueId].toString() == widget.selectedValue[widget.attributeValueId].toString(), + selected: item[widget.attributeValueId].toString() == + widget.selectedValue[widget.attributeValueId] + .toString(), onChanged: (val) { setState(() { widget.selectedValue = item; diff --git a/pubspec.lock b/pubspec.lock index 67028733..7f1d8c1d 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -461,7 +461,7 @@ packages: name: js url: "https://pub.dartlang.org" source: hosted - version: "0.6.2" + version: "0.6.3-nullsafety.1" json_annotation: dependency: transitive description: