Merge branch 'roaa2.8_addnewmedicationservice' into 'development'
Roaa2.8 addnewmedicationservice See merge request Cloud_Solution/doctor_app_flutter!953merge-requests/957/merge
commit
63e94e0d7b
@ -0,0 +1,68 @@
|
||||
import 'package:doctor_app_flutter/config/config.dart';
|
||||
import 'package:doctor_app_flutter/core/service/base/base_service.dart';
|
||||
import '../../../../screens/patients/profile/pharmacy-intervention-model/accept_or_reject_req_model.dart';
|
||||
import '../../../../screens/patients/profile/pharmacy-intervention-model/intervention_medication_history_req_model.dart';
|
||||
import '../../../../screens/patients/profile/pharmacy-intervention-model/intervention_medication_history_res_model.dart';
|
||||
import '../../../../screens/patients/profile/pharmacy-intervention-model/new_medication_req_model.dart';
|
||||
import '../../../../screens/patients/profile/pharmacy-intervention-model/new_medication_res_model.dart';
|
||||
|
||||
|
||||
class InterventionMedicationService extends BaseService {
|
||||
|
||||
List<InterventionMedicationResModel> _allInterventionList = [];
|
||||
|
||||
List<InterventionMedicationHistoryResModel> _allInterventionHistoryList = [];
|
||||
|
||||
List<InterventionMedicationResModel> get allInterventionList =>
|
||||
_allInterventionList;
|
||||
|
||||
List<InterventionMedicationHistoryResModel> get allInterventionHistoryList =>
|
||||
_allInterventionHistoryList;
|
||||
|
||||
Future getInterventionMedication(
|
||||
{InterventionMedicationReqModel interventionMedicationReqModel}) async {
|
||||
hasError = false;
|
||||
await baseAppClient.post(GET_INTERVENTION_MEDICATION,
|
||||
onSuccess: (dynamic response, int statusCode) {
|
||||
_allInterventionList.clear();
|
||||
response['List_InterventionMedications'].forEach(
|
||||
(v) {
|
||||
_allInterventionList.add(InterventionMedicationResModel.fromJson(v));
|
||||
},
|
||||
);
|
||||
}, onFailure: (String error, int statusCode) {
|
||||
hasError = true;
|
||||
super.error = error;
|
||||
}, body: interventionMedicationReqModel.toJson());
|
||||
}
|
||||
|
||||
Future getInterventionMedicationHistory(
|
||||
{InterventionMedicationHistoryReqModel interventionMedicationHistoryReqModel}) async {
|
||||
hasError = false;
|
||||
await baseAppClient.post(GET_INTERVENTION_MEDICATION_HISTORY,
|
||||
onSuccess: (dynamic response, int statusCode) {
|
||||
_allInterventionHistoryList.clear();
|
||||
response['List_InterventionHistory'].forEach(
|
||||
(v) {
|
||||
_allInterventionHistoryList.add(InterventionMedicationHistoryResModel.fromJson(v));
|
||||
},
|
||||
);
|
||||
}, onFailure: (String error, int statusCode) {
|
||||
hasError = true;
|
||||
super.error = error;
|
||||
}, body: interventionMedicationHistoryReqModel.toJson());
|
||||
}
|
||||
|
||||
Future setAcceptedOrRejected(
|
||||
{AcceptOrRejectReqModel acceptOrRejectReqModel}) async {
|
||||
hasError = false;
|
||||
await baseAppClient.post(SET_ACCEPTED_OR_REJECTED,
|
||||
onSuccess: (dynamic response, int statusCode) {
|
||||
_allInterventionHistoryList.clear();
|
||||
|
||||
}, onFailure: (String error, int statusCode) {
|
||||
hasError = true;
|
||||
super.error = error;
|
||||
}, body: acceptOrRejectReqModel.toJson());
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,146 @@
|
||||
import 'package:doctor_app_flutter/core/enum/viewstate.dart';
|
||||
import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart';
|
||||
import 'package:doctor_app_flutter/locator.dart';
|
||||
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
|
||||
import '../../../models/dashboard/get_special_clinical_care_mapping_List_Respose_Model.dart';
|
||||
import '../../../screens/patients/profile/pharmacy-intervention-model/accept_or_reject_req_model.dart';
|
||||
import '../../../screens/patients/profile/pharmacy-intervention-model/intervention_medication_history_req_model.dart';
|
||||
import '../../../screens/patients/profile/pharmacy-intervention-model/intervention_medication_history_res_model.dart';
|
||||
import '../../../screens/patients/profile/pharmacy-intervention-model/new_medication_req_model.dart';
|
||||
import '../../../screens/patients/profile/pharmacy-intervention-model/new_medication_res_model.dart';
|
||||
import '../../../util/date-utils.dart';
|
||||
import '../../service/patient/profile/intervention_medication_service.dart';
|
||||
import '../../service/special_clinics/special_clinic_service.dart';
|
||||
|
||||
class InterventionMedicationViewModel extends BaseViewModel {
|
||||
SpecialClinicsService _specialClinicsService =
|
||||
locator<SpecialClinicsService>();
|
||||
|
||||
List<GetSpecialClinicalCareMappingListResponseModel>
|
||||
get specialClinicalCareMappingList =>
|
||||
_specialClinicsService.specialClinicalCareMappingList;
|
||||
|
||||
List<PatiantInformtion> filterData = [];
|
||||
|
||||
DateTime selectedFromDate;
|
||||
DateTime selectedToDate;
|
||||
|
||||
PatiantInformtion patient;
|
||||
bool hasError = false;
|
||||
InterventionMedicationService _interventionMedicationService =
|
||||
locator<InterventionMedicationService>();
|
||||
|
||||
List<InterventionMedicationResModel> get allInterventionList =>
|
||||
_interventionMedicationService.allInterventionList;
|
||||
|
||||
List<InterventionMedicationHistoryResModel> get allInterventionHistoryList =>
|
||||
_interventionMedicationService.allInterventionHistoryList;
|
||||
|
||||
Future getInterventionMedication({
|
||||
int projectId,
|
||||
int patientId,
|
||||
DateTime fromDate,
|
||||
DateTime toDate,
|
||||
}) async {
|
||||
InterventionMedicationReqModel interventionMedicationReqModel =
|
||||
InterventionMedicationReqModel(
|
||||
projectID: 15,
|
||||
//projectId,
|
||||
patientID: 79941,
|
||||
//patientId,
|
||||
fromDate: "\/Date(1488322922)\/",
|
||||
//AppDateUtils.convertDateToServerFormat(fromDate),
|
||||
toDate:
|
||||
"\/Date(1635886800000)\/", //AppDateUtils.convertDateToServerFormat(toDate),
|
||||
);
|
||||
hasError = false;
|
||||
setState(ViewState.Busy);
|
||||
await _interventionMedicationService.getInterventionMedication(
|
||||
interventionMedicationReqModel: interventionMedicationReqModel);
|
||||
if (_interventionMedicationService.hasError) {
|
||||
error = _interventionMedicationService.error;
|
||||
setState(ViewState.Error);
|
||||
} else {
|
||||
setState(ViewState.Idle);
|
||||
}
|
||||
}
|
||||
|
||||
Future getInterventionMedicationHistory(
|
||||
{int projectId,
|
||||
int patientId,
|
||||
int admissionNo,
|
||||
int prescriptionNo,
|
||||
int orderNo,
|
||||
bool isBusyLocal = false}) async {
|
||||
InterventionMedicationHistoryReqModel
|
||||
interventionMedicationHistoryReqModel =
|
||||
InterventionMedicationHistoryReqModel(
|
||||
projectID: 15,
|
||||
//projectId,
|
||||
patientID: 79941,
|
||||
//patientId,
|
||||
admissionNo: 2018013900,
|
||||
//admissionNo,
|
||||
prescriptionNo: 2045165,
|
||||
//prescriptionNo,
|
||||
orderNo: 1171570, //orderNo,
|
||||
);
|
||||
hasError = false;
|
||||
if (isBusyLocal)
|
||||
setState(ViewState.Busy);
|
||||
else
|
||||
setState(ViewState.Busy);
|
||||
await _interventionMedicationService.getInterventionMedicationHistory(
|
||||
interventionMedicationHistoryReqModel:
|
||||
interventionMedicationHistoryReqModel);
|
||||
if (_interventionMedicationService.hasError) {
|
||||
error = _interventionMedicationService.error;
|
||||
if (isBusyLocal)
|
||||
setState(ViewState.ErrorLocal);
|
||||
else
|
||||
setState(ViewState.Error);
|
||||
} else {
|
||||
setState(ViewState.Idle);
|
||||
}
|
||||
}
|
||||
|
||||
Future setAcceptedOrRejected({
|
||||
String remarks,
|
||||
int memberId,
|
||||
int projectId,
|
||||
int patientID,
|
||||
int admissionNo,
|
||||
int prescriptionNo,
|
||||
int orderNo,
|
||||
int interventionStatus,
|
||||
}) async {
|
||||
AcceptOrRejectReqModel acceptOrRejectReqModel = AcceptOrRejectReqModel(
|
||||
projectID: 15,
|
||||
//projectId,
|
||||
patientID: 79941,
|
||||
//patientID,
|
||||
admissionNo: 2018013900,
|
||||
//admissionNo,
|
||||
prescriptionNo: 2045165,
|
||||
//prescriptionNo,
|
||||
orderNo: 1171570,
|
||||
//orderNo,
|
||||
accessLevel: 4,
|
||||
lineItemNo: 1,
|
||||
remarks: remarks,
|
||||
memberID: 2804,
|
||||
//memberId,
|
||||
interventionStatus: interventionStatus,
|
||||
);
|
||||
hasError = false;
|
||||
setState(ViewState.BusyLocal);
|
||||
await _interventionMedicationService.setAcceptedOrRejected(
|
||||
acceptOrRejectReqModel: acceptOrRejectReqModel);
|
||||
if (_interventionMedicationService.hasError) {
|
||||
error = _interventionMedicationService.error;
|
||||
setState(ViewState.ErrorLocal);
|
||||
} else {
|
||||
setState(ViewState.Idle);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,45 @@
|
||||
import 'package:doctor_app_flutter/core/service/patient/out_patient_service.dart';
|
||||
import 'package:doctor_app_flutter/core/service/patient/patientInPatientService.dart';
|
||||
import 'package:doctor_app_flutter/core/service/special_clinics/special_clinic_service.dart';
|
||||
import 'package:doctor_app_flutter/models/dashboard/get_special_clinical_care_mapping_List_Respose_Model.dart';
|
||||
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
|
||||
import '../../../locator.dart';
|
||||
import '../base_view_model.dart';
|
||||
|
||||
|
||||
|
||||
class PharmacyInterventionViewModel extends BaseViewModel {
|
||||
OutPatientService _outPatientService = locator<OutPatientService>();
|
||||
SpecialClinicsService _specialClinicsService =
|
||||
locator<SpecialClinicsService>();
|
||||
|
||||
List<PatiantInformtion> get patientList => _outPatientService.patientList;
|
||||
|
||||
List<GetSpecialClinicalCareMappingListResponseModel>
|
||||
get specialClinicalCareMappingList =>
|
||||
_specialClinicsService.specialClinicalCareMappingList;
|
||||
|
||||
List<PatiantInformtion> filterData = [];
|
||||
|
||||
DateTime selectedFromDate;
|
||||
DateTime selectedToDate;
|
||||
|
||||
int firstSubsetIndex = 0;
|
||||
int inPatientPageSize = 20;
|
||||
int lastSubsetIndex = 20;
|
||||
|
||||
List<String> InpatientClinicList = [];
|
||||
|
||||
|
||||
PatientInPatientService _inPatientService =
|
||||
locator<PatientInPatientService>();
|
||||
|
||||
List<PatiantInformtion> get inPatientList => _inPatientService.inPatientList;
|
||||
|
||||
List<PatiantInformtion> get myIinPatientList =>
|
||||
_inPatientService.myInPatientList;
|
||||
|
||||
List<PatiantInformtion> filteredInPatientItems = List();
|
||||
List<PatiantInformtion> filteredMyInPatientItems = List();
|
||||
|
||||
}
|
||||
@ -0,0 +1,61 @@
|
||||
class AcceptOrRejectReqModel {
|
||||
int patientID;
|
||||
int projectID;
|
||||
int admissionNo;
|
||||
int prescriptionNo;
|
||||
int orderNo;
|
||||
String remarks;
|
||||
int memberID;
|
||||
int accessLevel;
|
||||
int languageID;
|
||||
int lineItemNo;
|
||||
bool patientOutSA;
|
||||
int interventionStatus;
|
||||
|
||||
AcceptOrRejectReqModel(
|
||||
{this.patientID,
|
||||
this.projectID,
|
||||
this.admissionNo,
|
||||
this.prescriptionNo,
|
||||
this.orderNo,
|
||||
this.remarks,
|
||||
this.memberID,
|
||||
this.accessLevel,
|
||||
this.languageID,
|
||||
this.lineItemNo,
|
||||
this.patientOutSA,
|
||||
this.interventionStatus,
|
||||
});
|
||||
|
||||
AcceptOrRejectReqModel.fromJson(Map<String, dynamic> json) {
|
||||
patientID = json['PatientID'];
|
||||
projectID = json['ProjectID'];
|
||||
admissionNo = json['AdmissionNo'];
|
||||
prescriptionNo = json['PrescriptionNo'];
|
||||
orderNo = json['OrderNo'];
|
||||
remarks = json['Remarks'];
|
||||
memberID = json['MemberID'];
|
||||
accessLevel = json['AccessLevel'];
|
||||
languageID = json['LanguageID'];
|
||||
lineItemNo = json['LineItemNo'];
|
||||
patientOutSA = json['PatientOutSA'];
|
||||
interventionStatus = json['InterventionStatus'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['PatientID'] = this.patientID;
|
||||
data['ProjectID'] = this.projectID;
|
||||
data['AdmissionNo'] = this.admissionNo;
|
||||
data['PrescriptionNo'] = this.prescriptionNo;
|
||||
data['OrderNo'] = this.orderNo;
|
||||
data['Remarks'] = this.remarks;
|
||||
data['MemberID'] = this.memberID;
|
||||
data['AccessLevel'] = this.accessLevel;
|
||||
data['LanguageID'] = this.languageID;
|
||||
data['LineItemNo'] = this.lineItemNo;
|
||||
data['PatientOutSA'] = this.patientOutSA;
|
||||
data['InterventionStatus'] = this.interventionStatus;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,4 @@
|
||||
class AcceptOrRejectResModel {
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,32 @@
|
||||
class InterventionMedicationHistoryReqModel {
|
||||
int projectID;
|
||||
int patientID;
|
||||
int admissionNo;
|
||||
int orderNo;
|
||||
int prescriptionNo;
|
||||
|
||||
InterventionMedicationHistoryReqModel(
|
||||
{this.projectID,
|
||||
this.patientID,
|
||||
this.admissionNo,
|
||||
this.orderNo,
|
||||
this.prescriptionNo});
|
||||
|
||||
InterventionMedicationHistoryReqModel.fromJson(Map<String, dynamic> json) {
|
||||
projectID = json['ProjectID'];
|
||||
patientID = json['PatientID'];
|
||||
admissionNo = json['AdmissionNo'];
|
||||
orderNo = json['OrderNo'];
|
||||
prescriptionNo = json['PrescriptionNo'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['ProjectID'] = this.projectID;
|
||||
data['PatientID'] = this.patientID;
|
||||
data['AdmissionNo'] = this.admissionNo;
|
||||
data['OrderNo'] = this.orderNo;
|
||||
data['PrescriptionNo'] = this.prescriptionNo;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,96 @@
|
||||
class InterventionMedicationHistoryResModel {
|
||||
String setupId;
|
||||
String projectId;
|
||||
int patientId;
|
||||
int admissionNo;
|
||||
int prescriptionId;
|
||||
int orderNo;
|
||||
int id;
|
||||
int interventionId;
|
||||
Null intervention;
|
||||
String remark;
|
||||
int commentedBy;
|
||||
bool isDoctor;
|
||||
bool isActive;
|
||||
int createdBy;
|
||||
String createdByName;
|
||||
String createdByNameN;
|
||||
String createdOn;
|
||||
Null editedBy;
|
||||
Null editedByName;
|
||||
Null editedByNameN;
|
||||
Null editedOn;
|
||||
|
||||
InterventionMedicationHistoryResModel(
|
||||
{this.setupId,
|
||||
this.projectId,
|
||||
this.patientId,
|
||||
this.admissionNo,
|
||||
this.prescriptionId,
|
||||
this.orderNo,
|
||||
this.id,
|
||||
this.interventionId,
|
||||
this.intervention,
|
||||
this.remark,
|
||||
this.commentedBy,
|
||||
this.isDoctor,
|
||||
this.isActive,
|
||||
this.createdBy,
|
||||
this.createdByName,
|
||||
this.createdByNameN,
|
||||
this.createdOn,
|
||||
this.editedBy,
|
||||
this.editedByName,
|
||||
this.editedByNameN,
|
||||
this.editedOn});
|
||||
|
||||
InterventionMedicationHistoryResModel.fromJson(Map<String, dynamic> json) {
|
||||
setupId = json['SetupId'];
|
||||
projectId = json['ProjectId'];
|
||||
patientId = json['PatientId'];
|
||||
admissionNo = json['AdmissionNo'];
|
||||
prescriptionId = json['PrescriptionId'];
|
||||
orderNo = json['OrderNo'];
|
||||
id = json['Id'];
|
||||
interventionId = json['InterventionId'];
|
||||
intervention = json['Intervention'];
|
||||
remark = json['Remark'];
|
||||
commentedBy = json['CommentedBy'];
|
||||
isDoctor = json['IsDoctor'];
|
||||
isActive = json['IsActive'];
|
||||
createdBy = json['CreatedBy'];
|
||||
createdByName = json['CreatedByName'];
|
||||
createdByNameN = json['CreatedByNameN'];
|
||||
createdOn = json['CreatedOn'];
|
||||
editedBy = json['EditedBy'];
|
||||
editedByName = json['EditedByName'];
|
||||
editedByNameN = json['EditedByNameN'];
|
||||
editedOn = json['EditedOn'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['SetupId'] = this.setupId;
|
||||
data['ProjectId'] = this.projectId;
|
||||
data['PatientId'] = this.patientId;
|
||||
data['AdmissionNo'] = this.admissionNo;
|
||||
data['PrescriptionId'] = this.prescriptionId;
|
||||
data['OrderNo'] = this.orderNo;
|
||||
data['Id'] = this.id;
|
||||
data['InterventionId'] = this.interventionId;
|
||||
data['Intervention'] = this.intervention;
|
||||
data['Remark'] = this.remark;
|
||||
data['CommentedBy'] = this.commentedBy;
|
||||
data['IsDoctor'] = this.isDoctor;
|
||||
data['IsActive'] = this.isActive;
|
||||
data['CreatedBy'] = this.createdBy;
|
||||
data['CreatedByName'] = this.createdByName;
|
||||
data['CreatedByNameN'] = this.createdByNameN;
|
||||
data['CreatedOn'] = this.createdOn;
|
||||
data['EditedBy'] = this.editedBy;
|
||||
data['EditedByName'] = this.editedByName;
|
||||
data['EditedByNameN'] = this.editedByNameN;
|
||||
data['EditedOn'] = this.editedOn;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,25 @@
|
||||
class InterventionMedicationReqModel {
|
||||
int projectID;
|
||||
int patientID;
|
||||
String fromDate;
|
||||
String toDate;
|
||||
|
||||
InterventionMedicationReqModel(
|
||||
{this.projectID, this.patientID, this.fromDate, this.toDate});
|
||||
|
||||
InterventionMedicationReqModel.fromJson(Map<String, dynamic> json) {
|
||||
projectID = json['ProjectID'];
|
||||
patientID = json['PatientID'];
|
||||
fromDate = json['FromDate'];
|
||||
toDate = json['ToDate'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['ProjectID'] = this.projectID;
|
||||
data['PatientID'] = this.patientID;
|
||||
data['FromDate'] = this.fromDate;
|
||||
data['ToDate'] = this.toDate;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,100 @@
|
||||
class InterventionMedicationResModel {
|
||||
String cS;
|
||||
String iHR;
|
||||
String setupID;
|
||||
int projectID;
|
||||
int accessLevel;
|
||||
int patientID;
|
||||
String patientName;
|
||||
String description;
|
||||
int admissionNo;
|
||||
int orderNo;
|
||||
int prescriptionNo;
|
||||
int lineItemNo;
|
||||
int itemID;
|
||||
String medication;
|
||||
String doctorComments;
|
||||
String startDatetime;
|
||||
String stopDatetime;
|
||||
int status;
|
||||
int createdBy;
|
||||
int authorizedby;
|
||||
Null pharmacyRemarks;
|
||||
String statusDescription;
|
||||
|
||||
InterventionMedicationResModel(
|
||||
{this.cS,
|
||||
this.iHR,
|
||||
this.setupID,
|
||||
this.projectID,
|
||||
this.accessLevel,
|
||||
this.patientID,
|
||||
this.patientName,
|
||||
this.description,
|
||||
this.admissionNo,
|
||||
this.orderNo,
|
||||
this.prescriptionNo,
|
||||
this.lineItemNo,
|
||||
this.itemID,
|
||||
this.medication,
|
||||
this.doctorComments,
|
||||
this.startDatetime,
|
||||
this.stopDatetime,
|
||||
this.status,
|
||||
this.createdBy,
|
||||
this.authorizedby,
|
||||
this.pharmacyRemarks,
|
||||
this.statusDescription});
|
||||
|
||||
InterventionMedicationResModel.fromJson(Map<String, dynamic> json) {
|
||||
cS = json['CS'];
|
||||
iHR = json['IHR'];
|
||||
setupID = json['SetupID'];
|
||||
projectID = json['ProjectID'];
|
||||
accessLevel = json['AccessLevel'];
|
||||
patientID = json['PatientID'];
|
||||
patientName = json['PatientName'];
|
||||
description = json['Description'];
|
||||
admissionNo = json['AdmissionNo'];
|
||||
orderNo = json['OrderNo'];
|
||||
prescriptionNo = json['PrescriptionNo'];
|
||||
lineItemNo = json['LineItemNo'];
|
||||
itemID = json['ItemID'];
|
||||
medication = json['Medication'];
|
||||
doctorComments = json['DoctorComments'];
|
||||
startDatetime = json['StartDatetime'];
|
||||
stopDatetime = json['StopDatetime'];
|
||||
status = json['Status'];
|
||||
createdBy = json['CreatedBy'];
|
||||
authorizedby = json['Authorizedby'];
|
||||
pharmacyRemarks = json['PharmacyRemarks'];
|
||||
statusDescription = json['StatusDescription'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['CS'] = this.cS;
|
||||
data['IHR'] = this.iHR;
|
||||
data['SetupID'] = this.setupID;
|
||||
data['ProjectID'] = this.projectID;
|
||||
data['AccessLevel'] = this.accessLevel;
|
||||
data['PatientID'] = this.patientID;
|
||||
data['PatientName'] = this.patientName;
|
||||
data['Description'] = this.description;
|
||||
data['AdmissionNo'] = this.admissionNo;
|
||||
data['OrderNo'] = this.orderNo;
|
||||
data['PrescriptionNo'] = this.prescriptionNo;
|
||||
data['LineItemNo'] = this.lineItemNo;
|
||||
data['ItemID'] = this.itemID;
|
||||
data['Medication'] = this.medication;
|
||||
data['DoctorComments'] = this.doctorComments;
|
||||
data['StartDatetime'] = this.startDatetime;
|
||||
data['StopDatetime'] = this.stopDatetime;
|
||||
data['Status'] = this.status;
|
||||
data['CreatedBy'] = this.createdBy;
|
||||
data['Authorizedby'] = this.authorizedby;
|
||||
data['PharmacyRemarks'] = this.pharmacyRemarks;
|
||||
data['StatusDescription'] = this.statusDescription;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,267 @@
|
||||
import 'package:doctor_app_flutter/core/viewModel/authentication_view_model.dart';
|
||||
import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart';
|
||||
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
|
||||
import 'package:doctor_app_flutter/screens/base/base_view.dart';
|
||||
import 'package:doctor_app_flutter/util/date-utils.dart';
|
||||
import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart';
|
||||
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
|
||||
import 'package:doctor_app_flutter/widgets/patients/profile/app_bar/patient-profile-app-bar.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/card_with_bg_widget.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/errors/error_message.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import '../../../../core/viewModel/profile/intervention_medication_view_model.dart';
|
||||
import '../../../../widgets/transitions/fade_page.dart';
|
||||
import 'intervention_medication_history_screen.dart';
|
||||
|
||||
DrAppSharedPreferances sharedPref = new DrAppSharedPreferances();
|
||||
|
||||
class InterventionMedicationScreen extends StatefulWidget {
|
||||
final PatiantInformtion patient;
|
||||
final InterventionMedicationViewModel previousModel;
|
||||
const InterventionMedicationScreen(this.patient, {Key key, this.previousModel}) : super(key: key);
|
||||
|
||||
@override
|
||||
_InterventionMedicationScreenState createState() =>
|
||||
_InterventionMedicationScreenState();
|
||||
}
|
||||
|
||||
class _InterventionMedicationScreenState
|
||||
extends State<InterventionMedicationScreen> {
|
||||
bool isDischargedPatient = false;
|
||||
AuthenticationViewModel authenticationViewModel;
|
||||
ProjectViewModel projectViewModel;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
authenticationViewModel = Provider.of(context);
|
||||
projectViewModel = Provider.of(context);
|
||||
|
||||
return BaseView<InterventionMedicationViewModel>(
|
||||
onModelReady: (model) => model.getInterventionMedication(
|
||||
patientId: widget.patient.patientId,
|
||||
//admissionNo: int.parse(widget.patient.admissionNo),
|
||||
fromDate: widget.previousModel.selectedFromDate,
|
||||
toDate: widget.previousModel.selectedToDate,
|
||||
),
|
||||
|
||||
builder: (_, model, w) => AppScaffold(
|
||||
baseViewModel: model,
|
||||
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
|
||||
appBar: PatientProfileAppBar(
|
||||
widget.patient,
|
||||
isInpatient: true,
|
||||
),
|
||||
body: model.allInterventionList == null ||
|
||||
model.allInterventionList.length == 0
|
||||
? Center(
|
||||
child: ErrorMessage(
|
||||
error: TranslationBase.of(context).noDataAvailable,
|
||||
),
|
||||
)
|
||||
: Container(
|
||||
color: Colors.grey[200],
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: Container(
|
||||
child: ListView.builder(
|
||||
itemCount: model.allInterventionList.length,
|
||||
itemBuilder: (BuildContext ctxt, int index) {
|
||||
return InkWell(
|
||||
child: FractionallySizedBox(
|
||||
widthFactor: 0.95,
|
||||
child: CardWithBgWidget(
|
||||
hasBorder: false,
|
||||
bgColor: Colors.transparent,
|
||||
widget: Column(
|
||||
children: [
|
||||
Column(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment
|
||||
.spaceBetween,
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
Container(
|
||||
width: MediaQuery.of(context)
|
||||
.size
|
||||
.width *
|
||||
0.60,
|
||||
child: Column(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment
|
||||
.start,
|
||||
children: [
|
||||
Row(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment
|
||||
.start,
|
||||
children: [
|
||||
AppText(
|
||||
model
|
||||
.allInterventionList[
|
||||
index]
|
||||
.cS,
|
||||
fontWeight:
|
||||
FontWeight.w600,
|
||||
fontSize: 14,
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Column(
|
||||
children: [
|
||||
Row(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment
|
||||
.start,
|
||||
children: [
|
||||
AppText(
|
||||
AppDateUtils.getDayMonthYearDateFormatted(
|
||||
AppDateUtils.convertStringToDate(model
|
||||
.allInterventionList[
|
||||
index]
|
||||
.startDatetime),
|
||||
isArabic:
|
||||
projectViewModel
|
||||
.isArabic,
|
||||
isMonthShort:
|
||||
true),
|
||||
fontWeight:
|
||||
FontWeight.w600,
|
||||
fontSize: 14,
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 8,
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.start,
|
||||
children: [
|
||||
AppText(
|
||||
'Description: ',
|
||||
fontSize: 12,
|
||||
),
|
||||
Expanded(
|
||||
child: AppText(
|
||||
model
|
||||
.allInterventionList[
|
||||
index]
|
||||
.description,
|
||||
fontSize: 12,
|
||||
isCopyable: true,
|
||||
),
|
||||
),
|
||||
]),
|
||||
SizedBox(
|
||||
height: 8,
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.start,
|
||||
children: [
|
||||
AppText(
|
||||
'Medication: ',
|
||||
fontSize: 12,
|
||||
),
|
||||
Expanded(
|
||||
child: AppText(
|
||||
model
|
||||
.allInterventionList[
|
||||
index]
|
||||
.medication,
|
||||
fontSize: 12,
|
||||
isCopyable: true,
|
||||
),
|
||||
),
|
||||
]),
|
||||
SizedBox(
|
||||
height: 8,
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.start,
|
||||
children: [
|
||||
AppText(
|
||||
'Doctor Comments: ',
|
||||
fontSize: 12,
|
||||
),
|
||||
Expanded(
|
||||
child: AppText(
|
||||
model
|
||||
.allInterventionList[
|
||||
index]
|
||||
.doctorComments,
|
||||
fontSize: 12,
|
||||
isCopyable: true,
|
||||
),
|
||||
),
|
||||
]),
|
||||
SizedBox(
|
||||
height: 8,
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.start,
|
||||
children: [
|
||||
AppText(
|
||||
'Status Description: ',
|
||||
fontSize: 12,
|
||||
),
|
||||
Expanded(
|
||||
child: AppText(
|
||||
model
|
||||
.allInterventionList[
|
||||
index]
|
||||
.statusDescription,
|
||||
fontSize: 12,
|
||||
isCopyable: true,
|
||||
),
|
||||
),
|
||||
]),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
onTap: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
FadePage(
|
||||
page: InterventionMedicationHistoryScreen(widget.patient, model.allInterventionList[index]),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,354 @@
|
||||
import 'package:doctor_app_flutter/core/enum/viewstate.dart';
|
||||
import 'package:doctor_app_flutter/core/viewModel/authentication_view_model.dart';
|
||||
import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart';
|
||||
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
|
||||
import 'package:doctor_app_flutter/screens/base/base_view.dart';
|
||||
import 'package:doctor_app_flutter/screens/patients/profile/pharmacy-intervention-model/new_medication_res_model.dart';
|
||||
import 'package:doctor_app_flutter/util/date-utils.dart';
|
||||
import 'package:doctor_app_flutter/util/dr_app_shared_pref.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/profile/app_bar/patient-profile-app-bar.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/card_with_bg_widget.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/errors/error_message.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import '../../../../config/config.dart';
|
||||
import '../../../../core/viewModel/profile/intervention_medication_view_model.dart';
|
||||
|
||||
|
||||
DrAppSharedPreferances sharedPref = new DrAppSharedPreferances();
|
||||
|
||||
class InterventionMedicationHistoryScreen extends StatefulWidget {
|
||||
final PatiantInformtion patient;
|
||||
final InterventionMedicationResModel interventionMedication;
|
||||
const InterventionMedicationHistoryScreen(this.patient, this.interventionMedication, {Key key}) : super(key: key);
|
||||
|
||||
@override
|
||||
_InterventionMedicationHistoryScreenState createState() => _InterventionMedicationHistoryScreenState();
|
||||
}
|
||||
|
||||
class _InterventionMedicationHistoryScreenState extends State<InterventionMedicationHistoryScreen> {
|
||||
bool isDischargedPatient = false;
|
||||
AuthenticationViewModel authenticationViewModel;
|
||||
ProjectViewModel projectViewModel;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
authenticationViewModel = Provider.of(context);
|
||||
projectViewModel = Provider.of(context);
|
||||
|
||||
return BaseView<InterventionMedicationViewModel>(
|
||||
onModelReady: (model) => model.getInterventionMedicationHistory(
|
||||
patientId: widget.patient.patientId,
|
||||
projectId: widget.interventionMedication.projectID,
|
||||
admissionNo: widget.interventionMedication.admissionNo,
|
||||
prescriptionNo: widget.interventionMedication.prescriptionNo,
|
||||
orderNo: widget.interventionMedication.orderNo,
|
||||
),
|
||||
builder: (_, model, w) => AppScaffold(
|
||||
baseViewModel: model,
|
||||
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
|
||||
appBar: PatientProfileAppBar(
|
||||
widget.patient,
|
||||
isInpatient: true,
|
||||
),
|
||||
body: model.allInterventionHistoryList == null ||
|
||||
model.allInterventionHistoryList.length == 0
|
||||
? Center(
|
||||
child: ErrorMessage(
|
||||
error: TranslationBase.of(context).noDataAvailable,
|
||||
),
|
||||
)
|
||||
: Container(
|
||||
color: Colors.grey[200],
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: Container(
|
||||
child: ListView.builder(
|
||||
itemCount: model.allInterventionHistoryList.length,
|
||||
itemBuilder: (BuildContext ctxt, int index) {
|
||||
return FractionallySizedBox(
|
||||
widthFactor: 0.95,
|
||||
child: CardWithBgWidget(
|
||||
hasBorder: false,
|
||||
bgColor: Colors.transparent,
|
||||
widget: Column(
|
||||
children: [
|
||||
Column(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceBetween,
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
Container(
|
||||
width: MediaQuery.of(context)
|
||||
.size
|
||||
.width *
|
||||
0.60,
|
||||
child: Column(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment
|
||||
.start,
|
||||
children: [
|
||||
AppText(
|
||||
model
|
||||
.allInterventionHistoryList[
|
||||
index].setupId,
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 14,
|
||||
),
|
||||
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Column(
|
||||
children: [
|
||||
Row(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment
|
||||
.start,
|
||||
children: [
|
||||
AppText(
|
||||
AppDateUtils.getDayMonthYearDateFormatted(
|
||||
AppDateUtils.convertStringToDate(
|
||||
model
|
||||
.allInterventionHistoryList[
|
||||
index].createdOn)
|
||||
,isArabic:
|
||||
projectViewModel
|
||||
.isArabic,
|
||||
isMonthShort: true),
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 14,
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 8,
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.start,
|
||||
children: [
|
||||
AppText(
|
||||
'Remark: ',
|
||||
fontSize: 12,
|
||||
),
|
||||
Expanded(
|
||||
child: AppText(
|
||||
model
|
||||
.allInterventionHistoryList[
|
||||
index]
|
||||
.remark,
|
||||
fontSize: 12,
|
||||
isCopyable: true,
|
||||
),
|
||||
),
|
||||
]),
|
||||
SizedBox(
|
||||
height: 8,
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.start,
|
||||
children: [
|
||||
AppText(
|
||||
'Created By Name: ',
|
||||
fontSize: 12,
|
||||
),
|
||||
Expanded(
|
||||
child: AppText(
|
||||
model
|
||||
.allInterventionHistoryList[
|
||||
index]
|
||||
.createdByName,
|
||||
fontSize: 12,
|
||||
isCopyable: true,
|
||||
),
|
||||
),
|
||||
]),
|
||||
SizedBox(
|
||||
height: 8,
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.start,
|
||||
children: [
|
||||
AppText(
|
||||
'SetUp ID: ',
|
||||
fontSize: 12,
|
||||
),
|
||||
Expanded(
|
||||
child: AppText(
|
||||
model
|
||||
.allInterventionHistoryList[
|
||||
index]
|
||||
.setupId,
|
||||
fontSize: 12,
|
||||
isCopyable: true,
|
||||
),
|
||||
),
|
||||
]),
|
||||
SizedBox(
|
||||
height: 8,
|
||||
),
|
||||
Row(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.end,
|
||||
children: [
|
||||
InkWell(
|
||||
onTap: () async {
|
||||
|
||||
GifLoaderDialogUtils.showMyDialog(context);
|
||||
await model.setAcceptedOrRejected(
|
||||
remarks: "",
|
||||
memberId: model.allInterventionHistoryList[index].commentedBy,
|
||||
prescriptionNo: model.allInterventionHistoryList[index].prescriptionId,
|
||||
patientID: model.allInterventionHistoryList[index].patientId,
|
||||
orderNo: model.allInterventionHistoryList[index].orderNo,
|
||||
admissionNo: model.allInterventionHistoryList[index].admissionNo,
|
||||
interventionStatus: 1,
|
||||
);
|
||||
if(model.state == ViewState.ErrorLocal) {
|
||||
GifLoaderDialogUtils.hideDialog(context);
|
||||
|
||||
Helpers.showErrorToast(model.error);
|
||||
} else {
|
||||
await model.getInterventionMedicationHistory(patientId: widget.patient.patientId,
|
||||
projectId: widget.interventionMedication.projectID,
|
||||
admissionNo: widget.interventionMedication.admissionNo,
|
||||
prescriptionNo: widget.interventionMedication.prescriptionNo,
|
||||
orderNo: widget.interventionMedication.orderNo,);
|
||||
GifLoaderDialogUtils.hideDialog(context);
|
||||
DrAppToastMsg.showSuccesToast(
|
||||
"Has been Successfully accepted");
|
||||
}
|
||||
},
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: AppGlobal.appGreenColor,
|
||||
borderRadius:
|
||||
BorderRadius.circular(10),
|
||||
),
|
||||
// color:Colors.red[600],
|
||||
|
||||
child: Row(
|
||||
children: [
|
||||
|
||||
SizedBox(
|
||||
width: 2,
|
||||
),
|
||||
AppText(
|
||||
TranslationBase.of(context)
|
||||
.accept,
|
||||
fontSize: 10,
|
||||
color: Colors.white,
|
||||
),
|
||||
],
|
||||
),
|
||||
padding: EdgeInsets.all(6),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
InkWell(
|
||||
onTap: () async {
|
||||
|
||||
GifLoaderDialogUtils.showMyDialog(context);
|
||||
await model.setAcceptedOrRejected(
|
||||
remarks: "",
|
||||
memberId: model.allInterventionHistoryList[index].commentedBy,
|
||||
prescriptionNo: model.allInterventionHistoryList[index].prescriptionId,
|
||||
patientID: model.allInterventionHistoryList[index].patientId,
|
||||
orderNo: model.allInterventionHistoryList[index].orderNo,
|
||||
admissionNo: model.allInterventionHistoryList[index].admissionNo,
|
||||
interventionStatus: 2
|
||||
);
|
||||
if(model.state == ViewState.ErrorLocal) {
|
||||
GifLoaderDialogUtils.hideDialog(context);
|
||||
|
||||
Helpers.showErrorToast(model.error);
|
||||
} else {
|
||||
await model.getInterventionMedicationHistory(patientId: widget.patient.patientId,
|
||||
projectId: widget.interventionMedication.projectID,
|
||||
admissionNo: widget.interventionMedication.admissionNo,
|
||||
prescriptionNo: widget.interventionMedication.prescriptionNo,
|
||||
orderNo: widget.interventionMedication.orderNo,);
|
||||
GifLoaderDialogUtils.hideDialog(context);
|
||||
|
||||
DrAppToastMsg.showSuccesToast(
|
||||
"Has been Successfully Rejected");
|
||||
}
|
||||
},
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: AppGlobal.appRedColor,
|
||||
borderRadius:
|
||||
BorderRadius.circular(10),
|
||||
),
|
||||
// color:Colors.red[600],
|
||||
|
||||
child: Row(
|
||||
children: [
|
||||
|
||||
SizedBox(
|
||||
width: 2,
|
||||
),
|
||||
AppText(
|
||||
TranslationBase.of(context)
|
||||
.reject,
|
||||
fontSize: 10,
|
||||
color: Colors.white,
|
||||
),
|
||||
],
|
||||
),
|
||||
padding: EdgeInsets.all(6),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,262 @@
|
||||
import 'package:doctor_app_flutter/core/enum/filter_type.dart';
|
||||
import 'package:doctor_app_flutter/screens/patients/profile/soap_update/shared_soap_widgets/bottom_sheet_title.dart';
|
||||
import 'package:doctor_app_flutter/util/date-utils.dart';
|
||||
import 'package:doctor_app_flutter/util/helpers.dart';
|
||||
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hexcolor/hexcolor.dart';
|
||||
import '../../../../core/viewModel/profile/intervention_medication_view_model.dart';
|
||||
import '../../../../models/patient/patiant_info_model.dart';
|
||||
import '../../../base/base_view.dart';
|
||||
import 'intervention_medication.dart';
|
||||
|
||||
class PharmacyInterventionScreen extends StatefulWidget {
|
||||
final OutPatientFilterType outPatientFilterType;
|
||||
|
||||
|
||||
const PharmacyInterventionScreen({
|
||||
Key key,
|
||||
this.outPatientFilterType,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
_PharmacyInterventionScreenState createState() =>
|
||||
_PharmacyInterventionScreenState();
|
||||
}
|
||||
|
||||
class _PharmacyInterventionScreenState
|
||||
extends State<PharmacyInterventionScreen> {
|
||||
@override
|
||||
void initState() {
|
||||
// TODO: implement initState
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final routeArgs = ModalRoute.of(context).settings.arguments as Map;
|
||||
PatiantInformtion patient = routeArgs['patient'];
|
||||
return BaseView<InterventionMedicationViewModel>(
|
||||
builder: (_, model, w) => AppScaffold(
|
||||
isShowAppBar: false,
|
||||
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
|
||||
body: SingleChildScrollView(
|
||||
child: Container(
|
||||
height: MediaQuery.of(context).size.height * 1.0,
|
||||
child: Padding(
|
||||
padding: EdgeInsets.all(0.0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
BottomSheetTitle(
|
||||
title: (OutPatientFilterType.Previous ==
|
||||
widget.outPatientFilterType)
|
||||
? ""
|
||||
: " Pharmacy Intervention",
|
||||
),
|
||||
SizedBox(
|
||||
height: 10.0,
|
||||
),
|
||||
Center(
|
||||
child: FractionallySizedBox(
|
||||
widthFactor: 0.9,
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
color: Colors.white,
|
||||
child: InkWell(
|
||||
onTap: () => selectDate(
|
||||
context,
|
||||
model,
|
||||
firstDate: DateTime(
|
||||
DateTime.now().year - 20,
|
||||
DateTime.now().month,
|
||||
DateTime.now().day),
|
||||
lastDate: DateTime(
|
||||
DateTime.now().year,
|
||||
DateTime.now().month,
|
||||
DateTime.now().day + 100),
|
||||
selectedDate: DateTime(
|
||||
DateTime.now().year,
|
||||
DateTime.now().month,
|
||||
DateTime.now().day),
|
||||
),
|
||||
child: TextField(
|
||||
decoration: textFieldSelectorDecoration(
|
||||
TranslationBase.of(context).fromDate,
|
||||
model.selectedFromDate != null
|
||||
? "${AppDateUtils.convertStringToDateFormat(model.selectedFromDate.toString(), "yyyy-MM-dd")}"
|
||||
: null,
|
||||
true,
|
||||
suffixIcon: Icon(
|
||||
Icons.calendar_today,
|
||||
color: Colors.black,
|
||||
)),
|
||||
enabled: false,
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Container(
|
||||
color: Colors.white,
|
||||
child: InkWell(
|
||||
onTap: () => selectDate(
|
||||
context,
|
||||
model,
|
||||
isFromDate: false,
|
||||
firstDate: DateTime(
|
||||
DateTime.now().year - 20,
|
||||
DateTime.now().month,
|
||||
DateTime.now().day),
|
||||
lastDate: DateTime(
|
||||
DateTime.now().year,
|
||||
DateTime.now().month,
|
||||
DateTime.now().day + 100),
|
||||
selectedDate: DateTime(
|
||||
DateTime.now().year,
|
||||
DateTime.now().month,
|
||||
DateTime.now().day),
|
||||
),
|
||||
child: TextField(
|
||||
decoration: textFieldSelectorDecoration(
|
||||
TranslationBase.of(context).toDate,
|
||||
model.selectedToDate != null
|
||||
? "${AppDateUtils.convertStringToDateFormat(model.selectedToDate.toString(), "yyyy-MM-dd")}"
|
||||
: null,
|
||||
true,
|
||||
suffixIcon: Icon(
|
||||
Icons.calendar_today,
|
||||
color: Colors.black,
|
||||
)),
|
||||
enabled: false,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
bottomSheet: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.all(
|
||||
Radius.circular(0.0),
|
||||
),
|
||||
border: Border.all(color: HexColor('#707070'), width: 0),
|
||||
),
|
||||
height: MediaQuery.of(context).size.height * 0.1,
|
||||
width: double.infinity,
|
||||
child: Column(
|
||||
children: [
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Container(
|
||||
child: FractionallySizedBox(
|
||||
widthFactor: .80,
|
||||
child: Center(
|
||||
child: AppButton(
|
||||
title: TranslationBase.of(context).search,
|
||||
padding: 5,
|
||||
color: Color(0xFF359846),
|
||||
onPressed: () async {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) =>
|
||||
InterventionMedicationScreen(patient,previousModel: model,)),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
],
|
||||
),
|
||||
)));
|
||||
}
|
||||
|
||||
selectDate(BuildContext context, InterventionMedicationViewModel model,
|
||||
{bool isFromDate = true,
|
||||
DateTime firstDate,
|
||||
lastDate,
|
||||
selectedDate}) async {
|
||||
Helpers.hideKeyboard(context);
|
||||
final DateTime picked = await showDatePicker(
|
||||
context: context,
|
||||
initialDate: selectedDate,
|
||||
firstDate: firstDate,
|
||||
lastDate: lastDate,
|
||||
initialEntryMode: DatePickerEntryMode.calendar,
|
||||
);
|
||||
if (picked != null) {
|
||||
if (isFromDate) {
|
||||
setState(() {
|
||||
model.selectedFromDate = picked;
|
||||
var date = picked.add(Duration(days: 1));
|
||||
if (date.isBefore(lastDate)) {
|
||||
model.selectedToDate = date;
|
||||
} else
|
||||
model.selectedToDate = lastDate;
|
||||
});
|
||||
} else {
|
||||
setState(() {
|
||||
model.selectedToDate = 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(0xFFEFEFEF), width: 2.0),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
disabledBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: Color(0xFFEFEFEF), width: 2.0),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
hintText: selectedText != null ? selectedText : hintText,
|
||||
suffixIcon: isDropDown
|
||||
? suffixIcon != null
|
||||
? suffixIcon
|
||||
: Icon(
|
||||
Icons.keyboard_arrow_down_sharp,
|
||||
color: Color(0xff2E303A),
|
||||
)
|
||||
: null,
|
||||
hintStyle: TextStyle(
|
||||
fontSize: 13,
|
||||
color: Color(0xff2E303A),
|
||||
fontFamily: 'Poppins',
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
labelText: selectedText != null ? '$hintText\n$selectedText' : null,
|
||||
labelStyle: TextStyle(
|
||||
fontSize: 13,
|
||||
color: Color(0xff2E303A),
|
||||
fontFamily: 'Poppins',
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue