Merge branch 'development' of https://gitlab.com/Cloud_Solution/doctor_app_flutter into sultan
commit
426aa03aa5
Binary file not shown.
|
After Width: | Height: | Size: 348 KiB |
@ -0,0 +1,64 @@
|
||||
class InsuranceApprovalInPatientRequestModel {
|
||||
int patientID;
|
||||
int patientTypeID;
|
||||
int eXuldAPPNO;
|
||||
int projectID;
|
||||
int languageID;
|
||||
String stamp;
|
||||
String iPAdress;
|
||||
double versionID;
|
||||
int channel;
|
||||
String tokenID;
|
||||
String sessionID;
|
||||
bool isLoginForDoctorApp;
|
||||
bool patientOutSA;
|
||||
|
||||
InsuranceApprovalInPatientRequestModel(
|
||||
{this.patientID,
|
||||
this.patientTypeID,
|
||||
this.eXuldAPPNO,
|
||||
this.projectID,
|
||||
this.languageID,
|
||||
this.stamp,
|
||||
this.iPAdress,
|
||||
this.versionID,
|
||||
this.channel,
|
||||
this.tokenID,
|
||||
this.sessionID,
|
||||
this.isLoginForDoctorApp,
|
||||
this.patientOutSA});
|
||||
|
||||
InsuranceApprovalInPatientRequestModel.fromJson(Map<String, dynamic> json) {
|
||||
patientID = json['PatientID'];
|
||||
patientTypeID = json['PatientTypeID'];
|
||||
eXuldAPPNO = json['EXuldAPPNO'];
|
||||
projectID = json['ProjectID'];
|
||||
languageID = json['LanguageID'];
|
||||
stamp = json['stamp'];
|
||||
iPAdress = json['IPAdress'];
|
||||
versionID = json['VersionID'];
|
||||
channel = json['Channel'];
|
||||
tokenID = json['TokenID'];
|
||||
sessionID = json['SessionID'];
|
||||
isLoginForDoctorApp = json['IsLoginForDoctorApp'];
|
||||
patientOutSA = json['PatientOutSA'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['PatientID'] = this.patientID;
|
||||
data['PatientTypeID'] = this.patientTypeID;
|
||||
data['EXuldAPPNO'] = this.eXuldAPPNO;
|
||||
data['ProjectID'] = this.projectID;
|
||||
data['LanguageID'] = this.languageID;
|
||||
data['stamp'] = this.stamp;
|
||||
data['IPAdress'] = this.iPAdress;
|
||||
data['VersionID'] = this.versionID;
|
||||
data['Channel'] = this.channel;
|
||||
data['TokenID'] = this.tokenID;
|
||||
data['SessionID'] = this.sessionID;
|
||||
data['IsLoginForDoctorApp'] = this.isLoginForDoctorApp;
|
||||
data['PatientOutSA'] = this.patientOutSA;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,273 @@
|
||||
class InsuranceApprovalInPatientModel {
|
||||
String setupID;
|
||||
int projectID;
|
||||
int approvalNo;
|
||||
int status;
|
||||
String approvalDate;
|
||||
int patientType;
|
||||
int patientID;
|
||||
int companyID;
|
||||
bool subCategoryID;
|
||||
int doctorID;
|
||||
int clinicID;
|
||||
int approvalType;
|
||||
int inpatientApprovalSubType;
|
||||
dynamic isApprovalOnGross;
|
||||
String companyApprovalNo;
|
||||
dynamic progNoteOrderNo;
|
||||
String submitOn;
|
||||
String receiptOn;
|
||||
String expiryDate;
|
||||
int admissionNo;
|
||||
int admissionRequestNo;
|
||||
String approvalStatusDescption;
|
||||
dynamic approvalStatusDescptionN;
|
||||
dynamic remarks;
|
||||
List<ApporvalDetails> apporvalDetails;
|
||||
String clinicName;
|
||||
dynamic companyName;
|
||||
String doctorName;
|
||||
String projectName;
|
||||
int totaUnUsedCount;
|
||||
int unUsedCount;
|
||||
|
||||
InsuranceApprovalInPatientModel(
|
||||
{this.setupID,
|
||||
this.projectID,
|
||||
this.approvalNo,
|
||||
this.status,
|
||||
this.approvalDate,
|
||||
this.patientType,
|
||||
this.patientID,
|
||||
this.companyID,
|
||||
this.subCategoryID,
|
||||
this.doctorID,
|
||||
this.clinicID,
|
||||
this.approvalType,
|
||||
this.inpatientApprovalSubType,
|
||||
this.isApprovalOnGross,
|
||||
this.companyApprovalNo,
|
||||
this.progNoteOrderNo,
|
||||
this.submitOn,
|
||||
this.receiptOn,
|
||||
this.expiryDate,
|
||||
this.admissionNo,
|
||||
this.admissionRequestNo,
|
||||
this.approvalStatusDescption,
|
||||
this.approvalStatusDescptionN,
|
||||
this.remarks,
|
||||
this.apporvalDetails,
|
||||
this.clinicName,
|
||||
this.companyName,
|
||||
this.doctorName,
|
||||
this.projectName,
|
||||
this.totaUnUsedCount,
|
||||
this.unUsedCount});
|
||||
|
||||
InsuranceApprovalInPatientModel.fromJson(Map<String, dynamic> json) {
|
||||
setupID = json['SetupID'];
|
||||
projectID = json['ProjectID'];
|
||||
approvalNo = json['ApprovalNo'];
|
||||
status = json['Status'];
|
||||
approvalDate = json['ApprovalDate'];
|
||||
patientType = json['PatientType'];
|
||||
patientID = json['PatientID'];
|
||||
companyID = json['CompanyID'];
|
||||
subCategoryID = json['SubCategoryID'];
|
||||
doctorID = json['DoctorID'];
|
||||
clinicID = json['ClinicID'];
|
||||
approvalType = json['ApprovalType'];
|
||||
inpatientApprovalSubType = json['InpatientApprovalSubType'];
|
||||
isApprovalOnGross = json['IsApprovalOnGross'];
|
||||
companyApprovalNo = json['CompanyApprovalNo'];
|
||||
progNoteOrderNo = json['ProgNoteOrderNo'];
|
||||
submitOn = json['SubmitOn'];
|
||||
receiptOn = json['ReceiptOn'];
|
||||
expiryDate = json['ExpiryDate'];
|
||||
admissionNo = json['AdmissionNo'];
|
||||
admissionRequestNo = json['AdmissionRequestNo'];
|
||||
approvalStatusDescption = json['ApprovalStatusDescption'];
|
||||
approvalStatusDescptionN = json['ApprovalStatusDescptionN'];
|
||||
remarks = json['Remarks'];
|
||||
if (json['ApporvalDetails'] != null) {
|
||||
apporvalDetails = new List<ApporvalDetails>();
|
||||
json['ApporvalDetails'].forEach((v) {
|
||||
apporvalDetails.add(new ApporvalDetails.fromJson(v));
|
||||
});
|
||||
}
|
||||
clinicName = json['ClinicName'];
|
||||
companyName = json['CompanyName'];
|
||||
doctorName = json['DoctorName'];
|
||||
projectName = json['ProjectName'];
|
||||
totaUnUsedCount = json['TotaUnUsedCount'];
|
||||
unUsedCount = json['UnUsedCount'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['SetupID'] = this.setupID;
|
||||
data['ProjectID'] = this.projectID;
|
||||
data['ApprovalNo'] = this.approvalNo;
|
||||
data['Status'] = this.status;
|
||||
data['ApprovalDate'] = this.approvalDate;
|
||||
data['PatientType'] = this.patientType;
|
||||
data['PatientID'] = this.patientID;
|
||||
data['CompanyID'] = this.companyID;
|
||||
data['SubCategoryID'] = this.subCategoryID;
|
||||
data['DoctorID'] = this.doctorID;
|
||||
data['ClinicID'] = this.clinicID;
|
||||
data['ApprovalType'] = this.approvalType;
|
||||
data['InpatientApprovalSubType'] = this.inpatientApprovalSubType;
|
||||
data['IsApprovalOnGross'] = this.isApprovalOnGross;
|
||||
data['CompanyApprovalNo'] = this.companyApprovalNo;
|
||||
data['ProgNoteOrderNo'] = this.progNoteOrderNo;
|
||||
data['SubmitOn'] = this.submitOn;
|
||||
data['ReceiptOn'] = this.receiptOn;
|
||||
data['ExpiryDate'] = this.expiryDate;
|
||||
data['AdmissionNo'] = this.admissionNo;
|
||||
data['AdmissionRequestNo'] = this.admissionRequestNo;
|
||||
data['ApprovalStatusDescption'] = this.approvalStatusDescption;
|
||||
data['ApprovalStatusDescptionN'] = this.approvalStatusDescptionN;
|
||||
data['Remarks'] = this.remarks;
|
||||
if (this.apporvalDetails != null) {
|
||||
data['ApporvalDetails'] =
|
||||
this.apporvalDetails.map((v) => v.toJson()).toList();
|
||||
}
|
||||
data['ClinicName'] = this.clinicName;
|
||||
data['CompanyName'] = this.companyName;
|
||||
data['DoctorName'] = this.doctorName;
|
||||
data['ProjectName'] = this.projectName;
|
||||
data['TotaUnUsedCount'] = this.totaUnUsedCount;
|
||||
data['UnUsedCount'] = this.unUsedCount;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class ApporvalDetails {
|
||||
Null setupID;
|
||||
Null projectID;
|
||||
int approvalNo;
|
||||
Null lineItemNo;
|
||||
Null orderType;
|
||||
Null procedureID;
|
||||
Null toothNo;
|
||||
Null price;
|
||||
Null approvedAmount;
|
||||
Null unapprovedPatientShare;
|
||||
Null waivedAmount;
|
||||
Null discountType;
|
||||
Null discountValue;
|
||||
Null shareType;
|
||||
Null patientShareTypeValue;
|
||||
Null companyShareTypeValue;
|
||||
Null patientShare;
|
||||
Null companyShare;
|
||||
Null deductableAmount;
|
||||
String disapprovedRemarks;
|
||||
Null progNoteOrderNo;
|
||||
Null progNoteLineItemNo;
|
||||
Null invoiceTransactionType;
|
||||
Null invoiceNo;
|
||||
String procedureName;
|
||||
String procedureNameN;
|
||||
String status;
|
||||
Null isInvoiced;
|
||||
String isInvoicedDesc;
|
||||
|
||||
ApporvalDetails(
|
||||
{this.setupID,
|
||||
this.projectID,
|
||||
this.approvalNo,
|
||||
this.lineItemNo,
|
||||
this.orderType,
|
||||
this.procedureID,
|
||||
this.toothNo,
|
||||
this.price,
|
||||
this.approvedAmount,
|
||||
this.unapprovedPatientShare,
|
||||
this.waivedAmount,
|
||||
this.discountType,
|
||||
this.discountValue,
|
||||
this.shareType,
|
||||
this.patientShareTypeValue,
|
||||
this.companyShareTypeValue,
|
||||
this.patientShare,
|
||||
this.companyShare,
|
||||
this.deductableAmount,
|
||||
this.disapprovedRemarks,
|
||||
this.progNoteOrderNo,
|
||||
this.progNoteLineItemNo,
|
||||
this.invoiceTransactionType,
|
||||
this.invoiceNo,
|
||||
this.procedureName,
|
||||
this.procedureNameN,
|
||||
this.status,
|
||||
this.isInvoiced,
|
||||
this.isInvoicedDesc});
|
||||
|
||||
ApporvalDetails.fromJson(Map<String, dynamic> json) {
|
||||
setupID = json['SetupID'];
|
||||
projectID = json['ProjectID'];
|
||||
approvalNo = json['ApprovalNo'];
|
||||
lineItemNo = json['LineItemNo'];
|
||||
orderType = json['OrderType'];
|
||||
procedureID = json['ProcedureID'];
|
||||
toothNo = json['ToothNo'];
|
||||
price = json['Price'];
|
||||
approvedAmount = json['ApprovedAmount'];
|
||||
unapprovedPatientShare = json['UnapprovedPatientShare'];
|
||||
waivedAmount = json['WaivedAmount'];
|
||||
discountType = json['DiscountType'];
|
||||
discountValue = json['DiscountValue'];
|
||||
shareType = json['ShareType'];
|
||||
patientShareTypeValue = json['PatientShareTypeValue'];
|
||||
companyShareTypeValue = json['CompanyShareTypeValue'];
|
||||
patientShare = json['PatientShare'];
|
||||
companyShare = json['CompanyShare'];
|
||||
deductableAmount = json['DeductableAmount'];
|
||||
disapprovedRemarks = json['DisapprovedRemarks'];
|
||||
progNoteOrderNo = json['ProgNoteOrderNo'];
|
||||
progNoteLineItemNo = json['ProgNoteLineItemNo'];
|
||||
invoiceTransactionType = json['InvoiceTransactionType'];
|
||||
invoiceNo = json['InvoiceNo'];
|
||||
procedureName = json['ProcedureName'];
|
||||
procedureNameN = json['ProcedureNameN'];
|
||||
status = json['Status'];
|
||||
isInvoiced = json['IsInvoiced'];
|
||||
isInvoicedDesc = json['IsInvoicedDesc'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['SetupID'] = this.setupID;
|
||||
data['ProjectID'] = this.projectID;
|
||||
data['ApprovalNo'] = this.approvalNo;
|
||||
data['LineItemNo'] = this.lineItemNo;
|
||||
data['OrderType'] = this.orderType;
|
||||
data['ProcedureID'] = this.procedureID;
|
||||
data['ToothNo'] = this.toothNo;
|
||||
data['Price'] = this.price;
|
||||
data['ApprovedAmount'] = this.approvedAmount;
|
||||
data['UnapprovedPatientShare'] = this.unapprovedPatientShare;
|
||||
data['WaivedAmount'] = this.waivedAmount;
|
||||
data['DiscountType'] = this.discountType;
|
||||
data['DiscountValue'] = this.discountValue;
|
||||
data['ShareType'] = this.shareType;
|
||||
data['PatientShareTypeValue'] = this.patientShareTypeValue;
|
||||
data['CompanyShareTypeValue'] = this.companyShareTypeValue;
|
||||
data['PatientShare'] = this.patientShare;
|
||||
data['CompanyShare'] = this.companyShare;
|
||||
data['DeductableAmount'] = this.deductableAmount;
|
||||
data['DisapprovedRemarks'] = this.disapprovedRemarks;
|
||||
data['ProgNoteOrderNo'] = this.progNoteOrderNo;
|
||||
data['ProgNoteLineItemNo'] = this.progNoteLineItemNo;
|
||||
data['InvoiceTransactionType'] = this.invoiceTransactionType;
|
||||
data['InvoiceNo'] = this.invoiceNo;
|
||||
data['ProcedureName'] = this.procedureName;
|
||||
data['ProcedureNameN'] = this.procedureNameN;
|
||||
data['Status'] = this.status;
|
||||
data['IsInvoiced'] = this.isInvoiced;
|
||||
data['IsInvoicedDesc'] = this.isInvoicedDesc;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,48 @@
|
||||
import 'package:doctor_app_flutter/config/config.dart';
|
||||
import 'package:doctor_app_flutter/core/service/base/base_service.dart';
|
||||
|
||||
class ReferralService extends BaseService {
|
||||
|
||||
//TODO Jammal
|
||||
Future referralPatient(
|
||||
{String admissionNo,
|
||||
String roomID,
|
||||
String referralClinic,
|
||||
String referralDoctor,
|
||||
String patientID,
|
||||
String patientTypeID,
|
||||
String referringClinic,
|
||||
String referringDoctorRemarks,
|
||||
String priority,String frequency,String extension}) async {
|
||||
await getDoctorProfile();
|
||||
hasError = false;
|
||||
Map<String, dynamic> body = Map();
|
||||
body['ProjectID'] = doctorProfile.projectID;
|
||||
body['AdmissionNo'] = admissionNo;
|
||||
body['RoomID'] = roomID;
|
||||
body['ReferralClinic'] = referralClinic;
|
||||
body['ReferralDoctor'] = referralDoctor;
|
||||
body['CreatedBy'] = doctorProfile.doctorID;
|
||||
body['EditedBy'] = doctorProfile.doctorID;
|
||||
body['PatientID'] = patientID;
|
||||
body['PatientTypeID'] = patientTypeID;
|
||||
body['ReferringClinic'] = referringClinic;
|
||||
body['ReferringDoctor'] = doctorProfile.doctorID;
|
||||
body['ReferringDoctorRemarks'] = referringDoctorRemarks;
|
||||
body['Priority'] = priority;
|
||||
body['Frequency'] = frequency;
|
||||
body['Extension'] = extension;
|
||||
|
||||
await baseAppClient.post(
|
||||
REFER_TO_DOCTOR,
|
||||
onSuccess: (dynamic response, int statusCode) {
|
||||
|
||||
},
|
||||
onFailure: (String error, int statusCode) {
|
||||
hasError = true;
|
||||
super.error = error;
|
||||
},
|
||||
body: body,
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -1,31 +1,45 @@
|
||||
import 'package:doctor_app_flutter/core/enum/viewstate.dart';
|
||||
import 'package:doctor_app_flutter/core/model/insurance_approval.dart';
|
||||
import 'package:doctor_app_flutter/core/model/insurance_approval_in_patient_model.dart';
|
||||
import 'package:doctor_app_flutter/core/service/InsuranceCardService.dart';
|
||||
import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart';
|
||||
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
|
||||
|
||||
import '../../locator.dart';
|
||||
|
||||
class InsuranceViewModel extends BaseViewModel{
|
||||
|
||||
class InsuranceViewModel extends BaseViewModel {
|
||||
InsuranceCardService _insuranceCardService = locator<InsuranceCardService>();
|
||||
|
||||
|
||||
List<InsuranceApprovalModel> get insuranceApproval =>
|
||||
_insuranceCardService.insuranceApproval;
|
||||
List<InsuranceApprovalInPatientModel> get insuranceApprovalInPatient =>
|
||||
_insuranceCardService.insuranceApprovalInPatient;
|
||||
|
||||
Future getInsuranceApproval(PatiantInformtion patient,{int appointmentNo, int projectId}) async {
|
||||
Future getInsuranceApproval(PatiantInformtion patient,
|
||||
{int appointmentNo, int projectId}) async {
|
||||
error = "";
|
||||
setState(ViewState.Busy);
|
||||
if (appointmentNo != null)
|
||||
await _insuranceCardService.getInsuranceApproval(patient,
|
||||
appointmentNo: appointmentNo,projectId: projectId);
|
||||
appointmentNo: appointmentNo, projectId: projectId);
|
||||
else
|
||||
await _insuranceCardService.getInsuranceApproval(patient);
|
||||
if (_insuranceCardService.hasError) {
|
||||
error = "No Insurance Approval Found";
|
||||
setState(ViewState.Error);
|
||||
setState(ViewState.Error);
|
||||
} else
|
||||
setState(ViewState.Idle);
|
||||
}
|
||||
|
||||
Future getInsuranceInPatient({int mrn}) async {
|
||||
//hasError = false;
|
||||
//_insuranceCardService.clearInsuranceCard();
|
||||
setState(ViewState.Busy);
|
||||
await _insuranceCardService.getInsuranceApprovalInPatient(mrn: mrn);
|
||||
if (_insuranceCardService.hasError) {
|
||||
error = _insuranceCardService.error;
|
||||
setState(ViewState.ErrorLocal);
|
||||
} else
|
||||
setState(ViewState.Idle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,406 +0,0 @@
|
||||
import 'package:doctor_app_flutter/config/config.dart';
|
||||
import 'package:doctor_app_flutter/core/viewModel/patient_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/dr_app_toast_msg.dart';
|
||||
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/dialogs/dailog-list-select.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/errors/dr_app_embedded_error.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/rounded_container_widget.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:hexcolor/hexcolor.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
|
||||
import '../../../config/size_config.dart';
|
||||
import '../../../util/dr_app_shared_pref.dart';
|
||||
import '../../../util/extenstions.dart';
|
||||
import '../../../widgets/shared/app_scaffold_widget.dart';
|
||||
import '../../../widgets/shared/app_texts_widget.dart';
|
||||
|
||||
DrAppSharedPreferances sharedPref = new DrAppSharedPreferances();
|
||||
|
||||
/*
|
||||
*@author: ibrahim albitar
|
||||
*@Date:4/6/2020
|
||||
*@param:
|
||||
*@return:
|
||||
*@desc:
|
||||
*/
|
||||
|
||||
class ReferPatientScreen extends StatefulWidget {
|
||||
@override
|
||||
_ReferPatientState createState() => _ReferPatientState();
|
||||
}
|
||||
|
||||
class _ReferPatientState extends State<ReferPatientScreen> {
|
||||
dynamic _selectedClinic;
|
||||
dynamic _selectedDoctor;
|
||||
final _extController = TextEditingController();
|
||||
int _activePriority = 1;
|
||||
dynamic _selectedFrequency;
|
||||
final _remarksController = TextEditingController();
|
||||
bool isValid;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final screenSize = MediaQuery.of(context).size;
|
||||
|
||||
return BaseView<PatientViewModel>(
|
||||
onModelReady: (model) => model.getClinicsList(),
|
||||
builder: (_, model, w) => AppScaffold(
|
||||
baseViewModel: model,
|
||||
appBarTitle: TranslationBase.of(context).referralPatient,
|
||||
body: model.clinicsList == null
|
||||
? DrAppEmbeddedError(error: 'Something Wrong!')
|
||||
: SingleChildScrollView(
|
||||
child: Container(
|
||||
margin: EdgeInsets.symmetric(vertical: 16, horizontal: 16),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Container(
|
||||
height: screenSize.height * 0.070,
|
||||
child: InkWell(
|
||||
onTap: model.clinicsList != null &&
|
||||
model.clinicsList.length > 0
|
||||
? () {
|
||||
ListSelectDialog dialog = ListSelectDialog(
|
||||
list: model.clinicsList,
|
||||
attributeName: 'ClinicDescription',
|
||||
attributeValueId: 'ClinicID',
|
||||
okText: TranslationBase.of(context).ok,
|
||||
okFunction: (selectedValue) {
|
||||
setState(() {
|
||||
_selectedDoctor = null;
|
||||
_selectedClinic = selectedValue;
|
||||
model.getDoctorsList(
|
||||
_selectedClinic['ClinicID']);
|
||||
});
|
||||
},
|
||||
);
|
||||
showDialog(
|
||||
barrierDismissible: false,
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return dialog;
|
||||
},
|
||||
);
|
||||
}
|
||||
: null,
|
||||
child: TextField(
|
||||
decoration: textFieldSelectorDecoration(
|
||||
TranslationBase.of(context).clinicSelect,
|
||||
_selectedClinic != null
|
||||
? _selectedClinic['ClinicDescription']
|
||||
: null,
|
||||
true),
|
||||
enabled: false,
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Container(
|
||||
height: screenSize.height * 0.070,
|
||||
child: InkWell(
|
||||
onTap: model.doctorsList != null &&
|
||||
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;
|
||||
},
|
||||
);
|
||||
}
|
||||
: null,
|
||||
child: TextField(
|
||||
decoration: textFieldSelectorDecoration(
|
||||
TranslationBase.of(context).doctorSelect,
|
||||
_selectedDoctor != null
|
||||
? _selectedDoctor['DoctorName']
|
||||
: null,
|
||||
true),
|
||||
enabled: false,
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Container(
|
||||
height: screenSize.height * 0.070,
|
||||
child: TextField(
|
||||
decoration: textFieldSelectorDecoration(
|
||||
TranslationBase.of(context).ext, null, false),
|
||||
enabled: true,
|
||||
controller: _extController,
|
||||
inputFormatters: [
|
||||
FilteringTextInputFormatter.allow(
|
||||
RegExp(ONLY_NUMBERS))
|
||||
],
|
||||
keyboardType: TextInputType.number,
|
||||
)),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
priorityBar(context, screenSize),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
AppText(
|
||||
"${TranslationBase.of(context).referralFrequency} ${getPriority()}",
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 16,
|
||||
),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
Container(
|
||||
height: screenSize.height * 0.070,
|
||||
child: InkWell(
|
||||
onTap: model.referralFrequencyList != null &&
|
||||
model.referralFrequencyList.length > 0
|
||||
? () {
|
||||
ListSelectDialog dialog = ListSelectDialog(
|
||||
list: model.referralFrequencyList,
|
||||
attributeName: 'Description',
|
||||
attributeValueId: 'ParameterCode',
|
||||
okText: TranslationBase.of(context).ok,
|
||||
okFunction: (selectedValue) {
|
||||
setState(() {
|
||||
_selectedFrequency = selectedValue;
|
||||
});
|
||||
},
|
||||
);
|
||||
showDialog(
|
||||
barrierDismissible: false,
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return dialog;
|
||||
},
|
||||
);
|
||||
}
|
||||
: null,
|
||||
child: TextField(
|
||||
decoration: textFieldSelectorDecoration(
|
||||
TranslationBase.of(context)
|
||||
.selectReferralFrequency,
|
||||
_selectedFrequency != null
|
||||
? _selectedFrequency['Description']
|
||||
: null,
|
||||
true),
|
||||
enabled: false,
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Container(
|
||||
child: TextField(
|
||||
decoration: textFieldSelectorDecoration(
|
||||
TranslationBase.of(context).clinicDetailsandRemarks,
|
||||
null,
|
||||
false),
|
||||
enabled: true,
|
||||
controller: _remarksController,
|
||||
inputFormatters: [
|
||||
FilteringTextInputFormatter.allow(
|
||||
RegExp(ONLY_LETTERS))
|
||||
],
|
||||
keyboardType: TextInputType.text,
|
||||
minLines: 4,
|
||||
maxLines: 6,
|
||||
)),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Container(
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
AppText(
|
||||
TranslationBase.of(context).pleaseFill,
|
||||
color: HexColor("#B8382B"),
|
||||
fontWeight: FontWeight.bold,
|
||||
margin: 10,
|
||||
visibility: isValid == null ? false : !isValid,
|
||||
),
|
||||
// TODO replace AppButton with secondary button and add loading
|
||||
AppButton(
|
||||
title: TranslationBase.of(context).send,
|
||||
color: HexColor("#B8382B"),
|
||||
onPressed: () => {referToDoctor(context, model)},
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget priorityBar(BuildContext _context, Size screenSize) {
|
||||
List<String> _priorities = [
|
||||
TranslationBase.of(context).veryUrgent.toUpperCase(),
|
||||
TranslationBase.of(context).urgent.toUpperCase(),
|
||||
TranslationBase.of(context).routine.toUpperCase(),
|
||||
];
|
||||
return Container(
|
||||
height: screenSize.height * 0.070,
|
||||
decoration:
|
||||
containerBorderDecoration(Color(0Xffffffff), Color(0xFFCCCCCC)),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: _priorities.map((item) {
|
||||
bool _isActive = _priorities[_activePriority] == item ? true : false;
|
||||
return Expanded(
|
||||
child: InkWell(
|
||||
child: Center(
|
||||
child: Container(
|
||||
height: screenSize.height * 0.070,
|
||||
decoration: containerBorderDecoration(
|
||||
_isActive ? HexColor("#B8382B") : Colors.white,
|
||||
_isActive ? HexColor("#B8382B") : Colors.white),
|
||||
child: Center(
|
||||
child: Text(
|
||||
item,
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: _isActive
|
||||
? Colors.white
|
||||
: Colors.black, //Colors.black,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
)),
|
||||
),
|
||||
onTap: () {
|
||||
print(_priorities.indexOf(item));
|
||||
setState(() {
|
||||
_activePriority = _priorities.indexOf(item);
|
||||
});
|
||||
},
|
||||
),
|
||||
);
|
||||
}).toList(),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
String getPriority() {
|
||||
DateTime date = DateTime.now();
|
||||
switch (_activePriority) {
|
||||
case 0:
|
||||
date = date.add(new Duration(hours: 3));
|
||||
break;
|
||||
case 1:
|
||||
date = date.add(new Duration(hours: 6));
|
||||
break;
|
||||
case 2:
|
||||
date = date.add(new Duration(days: 1));
|
||||
break;
|
||||
}
|
||||
var format = DateFormat('yyyy/mm/dd HH:mm a');
|
||||
var time = format.format(date);
|
||||
print(time);
|
||||
return time;
|
||||
}
|
||||
|
||||
referToDoctor(BuildContext context, PatientViewModel model) async {
|
||||
if (!validation()) {
|
||||
return;
|
||||
}
|
||||
|
||||
final routeArgs = ModalRoute.of(context).settings.arguments as Map;
|
||||
PatiantInformtion patient = routeArgs['patient'];
|
||||
|
||||
try {
|
||||
await model.referToDoctor(
|
||||
extension: _extController.value.text,
|
||||
admissionNo: int.parse(patient.admissionNo),
|
||||
referringDoctorRemarks: _remarksController.value.text,
|
||||
frequency: _selectedFrequency['ParameterCode'].toString(),
|
||||
patientID: patient.patientId,
|
||||
patientTypeID: patient.patientType,
|
||||
priority: (_activePriority + 1).toString(),
|
||||
roomID: patient.roomId,
|
||||
selectedClinicID: _selectedClinic['ClinicID'].toString(),
|
||||
selectedDoctorID: _selectedDoctor['DoctorID'].toString(),
|
||||
projectID: patient.projectId);
|
||||
// TODO: Add Translation
|
||||
DrAppToastMsg.showSuccesToast('Reply Successfully');
|
||||
Navigator.pop(context);
|
||||
} catch (e) {
|
||||
DrAppToastMsg.showErrorToast(e);
|
||||
}
|
||||
}
|
||||
|
||||
bool validation() {
|
||||
setState(() {
|
||||
isValid = !_extController.value.text.isNullOrEmpty() &&
|
||||
!_remarksController.value.text.isNullOrEmpty() &&
|
||||
_selectedClinic != null &&
|
||||
_selectedDoctor != null &&
|
||||
_selectedFrequency != null;
|
||||
});
|
||||
return isValid;
|
||||
}
|
||||
|
||||
InputDecoration textFieldSelectorDecoration(
|
||||
String hintText, String selectedText, bool isDropDown) {
|
||||
return InputDecoration(
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
disabledBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
hintText: selectedText != null ? selectedText : hintText,
|
||||
suffixIcon: isDropDown ? Icon(Icons.arrow_drop_down) : null,
|
||||
hintStyle: TextStyle(
|
||||
fontSize: 14,
|
||||
color: Colors.grey.shade600,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
BoxDecoration containerBorderDecoration(
|
||||
Color containerColor, Color borderColor) {
|
||||
return BoxDecoration(
|
||||
color: containerColor,
|
||||
shape: BoxShape.rectangle,
|
||||
borderRadius: BorderRadius.all(Radius.circular(6)),
|
||||
border: Border.fromBorderSide(BorderSide(
|
||||
color: borderColor,
|
||||
width: 2.0,
|
||||
)),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,563 @@
|
||||
import 'package:doctor_app_flutter/config/config.dart';
|
||||
import 'package:doctor_app_flutter/config/size_config.dart';
|
||||
import 'package:doctor_app_flutter/core/enum/viewstate.dart';
|
||||
import 'package:doctor_app_flutter/core/viewModel/patient-referral-viewmodel.dart';
|
||||
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
|
||||
import 'package:doctor_app_flutter/screens/base/base_view.dart';
|
||||
import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart';
|
||||
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
|
||||
import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-header-new-design-app-bar.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/dialogs/dailog-list-select.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
|
||||
class PatientMakeInPatientReferralScreen extends StatefulWidget {
|
||||
@override
|
||||
_PatientMakeInPatientReferralScreenState createState() =>
|
||||
_PatientMakeInPatientReferralScreenState();
|
||||
}
|
||||
|
||||
class _PatientMakeInPatientReferralScreenState
|
||||
extends State<PatientMakeInPatientReferralScreen> {
|
||||
PatiantInformtion patient;
|
||||
List<dynamic> referToList;
|
||||
dynamic _referTo;
|
||||
dynamic _selectedBranch;
|
||||
dynamic _selectedClinic;
|
||||
dynamic _selectedDoctor;
|
||||
dynamic _selectedFrequency;
|
||||
final _remarksController = TextEditingController();
|
||||
final _extController = TextEditingController();
|
||||
int _activePriority = 1;
|
||||
String appointmentDate;
|
||||
|
||||
String branchError;
|
||||
String hospitalError;
|
||||
String clinicError;
|
||||
String doctorError;
|
||||
String frequencyError;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final routeArgs = ModalRoute.of(context).settings.arguments as Map;
|
||||
patient = routeArgs['patient'];
|
||||
String patientType = routeArgs['patientType'];
|
||||
String arrivalType = routeArgs['arrivalType'];
|
||||
|
||||
referToList = List();
|
||||
dynamic sameBranch = {
|
||||
"id": 1,
|
||||
"name": TranslationBase.of(context).sameBranch
|
||||
};
|
||||
dynamic otherBranch = {
|
||||
"id": 2,
|
||||
"name": TranslationBase.of(context).otherBranch
|
||||
};
|
||||
referToList.add(sameBranch);
|
||||
referToList.add(otherBranch);
|
||||
|
||||
final screenSize = MediaQuery.of(context).size;
|
||||
|
||||
return BaseView<PatientReferralViewModel>(
|
||||
onModelReady: (model) => model.getReferralFrequencyList(),
|
||||
builder: (_, model, w) => AppScaffold(
|
||||
baseViewModel: model,
|
||||
appBarTitle: TranslationBase.of(context).referPatient,
|
||||
isShowAppBar: true,
|
||||
appBar: PatientProfileHeaderNewDesignAppBar(
|
||||
patient, patientType, arrivalType),
|
||||
body: SingleChildScrollView(
|
||||
child: Container(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Container(
|
||||
margin: EdgeInsets.all(16.0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
AppText(
|
||||
"${TranslationBase.of(context).refer}",
|
||||
fontFamily: 'Poppins',
|
||||
fontSize: SizeConfig.textMultiplier * 1.6,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
AppText(
|
||||
"${TranslationBase.of(context).patient}",
|
||||
fontFamily: 'Poppins',
|
||||
fontSize: SizeConfig.textMultiplier * 3,
|
||||
fontWeight: FontWeight.bold,
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
Container(
|
||||
margin: EdgeInsets.symmetric(vertical: 0, horizontal: 16),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
AppTextFieldCustom(
|
||||
height: screenSize.height * 0.075,
|
||||
hintText: TranslationBase.of(context).branch,
|
||||
dropDownText:
|
||||
_referTo != null ? _referTo['name'] : null,
|
||||
enabled: false,
|
||||
isTextFieldHasSuffix: true,
|
||||
validationError: branchError,
|
||||
onClick: referToList != null
|
||||
? () {
|
||||
ListSelectDialog dialog = ListSelectDialog(
|
||||
list: referToList,
|
||||
attributeName: 'name',
|
||||
attributeValueId: 'id',
|
||||
okText: TranslationBase.of(context).ok,
|
||||
okFunction: (selectedValue) {
|
||||
setState(() {
|
||||
_referTo = selectedValue;
|
||||
_selectedBranch = null;
|
||||
_selectedClinic = null;
|
||||
_selectedDoctor = null;
|
||||
model
|
||||
.getDoctorBranch()
|
||||
.then((value) async {
|
||||
_selectedBranch = value;
|
||||
if (_referTo['id'] == 1) {
|
||||
GifLoaderDialogUtils.showMyDialog(
|
||||
context);
|
||||
await model
|
||||
.getClinics(_selectedBranch[
|
||||
'facilityId'])
|
||||
.then((_) =>
|
||||
GifLoaderDialogUtils
|
||||
.hideDialog(context));
|
||||
if (model.state ==
|
||||
ViewState.ErrorLocal) {
|
||||
DrAppToastMsg.showErrorToast(
|
||||
model.error);
|
||||
}
|
||||
} else {
|
||||
_selectedBranch = null;
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
);
|
||||
showDialog(
|
||||
barrierDismissible: false,
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return dialog;
|
||||
},
|
||||
);
|
||||
}
|
||||
: null,
|
||||
),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
AppTextFieldCustom(
|
||||
height: screenSize.height * 0.075,
|
||||
hintText: TranslationBase.of(context).hospital,
|
||||
dropDownText: _selectedBranch != null
|
||||
? _selectedBranch['facilityName']
|
||||
: null,
|
||||
enabled: false,
|
||||
isTextFieldHasSuffix: true,
|
||||
validationError: hospitalError,
|
||||
onClick: model.branchesList != null &&
|
||||
model.branchesList.length > 0 &&
|
||||
_referTo != null &&
|
||||
_referTo['id'] == 2
|
||||
? () {
|
||||
ListSelectDialog dialog = ListSelectDialog(
|
||||
list: model.branchesList,
|
||||
attributeName: 'facilityName',
|
||||
attributeValueId: 'facilityId',
|
||||
okText: TranslationBase.of(context).ok,
|
||||
okFunction: (selectedValue) {
|
||||
setState(() async {
|
||||
_selectedBranch = selectedValue;
|
||||
_selectedClinic = null;
|
||||
_selectedDoctor = null;
|
||||
GifLoaderDialogUtils.showMyDialog(
|
||||
context);
|
||||
await model
|
||||
.getClinics(
|
||||
_selectedBranch['facilityId'])
|
||||
.then((_) => GifLoaderDialogUtils
|
||||
.hideDialog(context));
|
||||
if (model.state ==
|
||||
ViewState.ErrorLocal) {
|
||||
DrAppToastMsg.showErrorToast(
|
||||
model.error);
|
||||
}
|
||||
});
|
||||
},
|
||||
);
|
||||
showDialog(
|
||||
barrierDismissible: false,
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return dialog;
|
||||
},
|
||||
);
|
||||
}
|
||||
: null,
|
||||
),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
AppTextFieldCustom(
|
||||
height: screenSize.height * 0.075,
|
||||
hintText: TranslationBase.of(context).clinic,
|
||||
dropDownText: _selectedClinic != null
|
||||
? _selectedClinic['ClinicDescription']
|
||||
: null,
|
||||
enabled: false,
|
||||
isTextFieldHasSuffix: true,
|
||||
validationError: clinicError,
|
||||
onClick: _selectedBranch != null &&
|
||||
model.clinicsList != null &&
|
||||
model.clinicsList.length > 0
|
||||
? () {
|
||||
ListSelectDialog dialog = ListSelectDialog(
|
||||
list: model.clinicsList,
|
||||
attributeName: 'ClinicDescription',
|
||||
attributeValueId: 'ClinicID',
|
||||
usingSearch: true,
|
||||
hintSearchText:
|
||||
TranslationBase.of(context)
|
||||
.clinicSearch,
|
||||
okText: TranslationBase.of(context).ok,
|
||||
okFunction: (selectedValue) {
|
||||
setState(() async {
|
||||
_selectedDoctor = null;
|
||||
_selectedClinic = selectedValue;
|
||||
GifLoaderDialogUtils.showMyDialog(
|
||||
context);
|
||||
await model
|
||||
.getClinicDoctors(
|
||||
patient,
|
||||
_selectedClinic['ClinicID'],
|
||||
_selectedBranch['facilityId'])
|
||||
.then((_) => GifLoaderDialogUtils
|
||||
.hideDialog(context));
|
||||
if (model.state ==
|
||||
ViewState.ErrorLocal) {
|
||||
DrAppToastMsg.showErrorToast(
|
||||
model.error);
|
||||
}
|
||||
});
|
||||
},
|
||||
);
|
||||
showDialog(
|
||||
barrierDismissible: false,
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return dialog;
|
||||
},
|
||||
);
|
||||
}
|
||||
: null,
|
||||
),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
AppTextFieldCustom(
|
||||
height: screenSize.height * 0.075,
|
||||
hintText: TranslationBase.of(context).doctor,
|
||||
dropDownText: _selectedDoctor != null
|
||||
? _selectedDoctor['Name']
|
||||
: null,
|
||||
enabled: false,
|
||||
isTextFieldHasSuffix: true,
|
||||
validationError: doctorError,
|
||||
onClick: _selectedClinic != null &&
|
||||
model.doctorsList != null &&
|
||||
model.doctorsList.length > 0
|
||||
? () {
|
||||
ListSelectDialog dialog = ListSelectDialog(
|
||||
list: model.doctorsList,
|
||||
attributeName: 'Name',
|
||||
attributeValueId: 'DoctorID',
|
||||
usingSearch: true,
|
||||
hintSearchText:
|
||||
TranslationBase.of(context)
|
||||
.doctorSearch,
|
||||
okText: TranslationBase.of(context).ok,
|
||||
okFunction: (selectedValue) {
|
||||
setState(() {
|
||||
_selectedDoctor = selectedValue;
|
||||
});
|
||||
},
|
||||
);
|
||||
showDialog(
|
||||
barrierDismissible: false,
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return dialog;
|
||||
},
|
||||
);
|
||||
}
|
||||
: () {
|
||||
if (_selectedClinic == null) {
|
||||
DrAppToastMsg.showErrorToast(
|
||||
"You need to select a clinic first");
|
||||
} else if (model.doctorsList == null ||
|
||||
model.doctorsList.length == 0) {
|
||||
DrAppToastMsg.showErrorToast(
|
||||
"There is no doctors for this clinic");
|
||||
}
|
||||
},
|
||||
),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
AppText(
|
||||
"${TranslationBase.of(context).priority}",
|
||||
fontFamily: 'Poppins',
|
||||
fontSize: SizeConfig.textMultiplier * 2.0,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
SizedBox(
|
||||
height: 4,
|
||||
),
|
||||
priorityBar(context, screenSize),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
AppText(
|
||||
"${TranslationBase.of(context).replayBefore}: ${getPriority()}",
|
||||
fontWeight: FontWeight.normal,
|
||||
fontSize: SizeConfig.textMultiplier * 1.9,
|
||||
),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
AppTextFieldCustom(
|
||||
height: screenSize.height * 0.075,
|
||||
hintText:
|
||||
TranslationBase.of(context).referralFrequency,
|
||||
dropDownText: _selectedFrequency != null
|
||||
? _selectedFrequency['Description']
|
||||
: null,
|
||||
enabled: false,
|
||||
isTextFieldHasSuffix: true,
|
||||
validationError: frequencyError,
|
||||
onClick: () {
|
||||
ListSelectDialog dialog = ListSelectDialog(
|
||||
list: model.referralFrequencyList,
|
||||
attributeName: 'Description',
|
||||
attributeValueId: 'ParameterCode',
|
||||
usingSearch: true,
|
||||
hintSearchText: TranslationBase.of(context)
|
||||
.selectReferralFrequency,
|
||||
okText: TranslationBase.of(context).ok,
|
||||
okFunction: (selectedValue) {
|
||||
setState(() {
|
||||
_selectedFrequency = selectedValue;
|
||||
});
|
||||
},
|
||||
);
|
||||
showDialog(
|
||||
barrierDismissible: false,
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return dialog;
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
AppTextFieldCustom(
|
||||
hintText: TranslationBase.of(context).ext,
|
||||
controller: _extController,
|
||||
inputType: TextInputType.number,
|
||||
inputFormatters: [
|
||||
FilteringTextInputFormatter.allow(
|
||||
RegExp(ONLY_NUMBERS))
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
AppTextFieldCustom(
|
||||
hintText:
|
||||
TranslationBase.of(context).dietTypeRemarks,
|
||||
controller: _remarksController,
|
||||
inputType: TextInputType.multiline,
|
||||
minLines: 4,
|
||||
maxLines: 6,
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
Container(
|
||||
margin: EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||
child: AppButton(
|
||||
title: TranslationBase.of(context).refer,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: Color(0XFF359846),
|
||||
onPressed: () {
|
||||
setState(() {
|
||||
if (_referTo == null) {
|
||||
branchError =
|
||||
TranslationBase.of(context).fieldRequired;
|
||||
} else {
|
||||
branchError = null;
|
||||
}
|
||||
if (_selectedBranch == null) {
|
||||
hospitalError =
|
||||
TranslationBase.of(context).fieldRequired;
|
||||
} else {
|
||||
hospitalError = null;
|
||||
}
|
||||
if (_selectedClinic == null) {
|
||||
clinicError =
|
||||
TranslationBase.of(context).fieldRequired;
|
||||
} else {
|
||||
clinicError = null;
|
||||
}
|
||||
if (_selectedDoctor == null) {
|
||||
doctorError =
|
||||
TranslationBase.of(context).fieldRequired;
|
||||
} else {
|
||||
doctorError = null;
|
||||
}
|
||||
if (_selectedFrequency == null) {
|
||||
frequencyError =
|
||||
TranslationBase.of(context).fieldRequired;
|
||||
} else {
|
||||
frequencyError = null;
|
||||
}
|
||||
});
|
||||
if (_selectedFrequency == null ||
|
||||
_selectedBranch == null ||
|
||||
_selectedClinic == null ||
|
||||
_selectedDoctor == null ||
|
||||
_remarksController.text == null ||
|
||||
_extController.text == null) return;
|
||||
model
|
||||
.makeInPatientReferral(
|
||||
patient: patient,
|
||||
projectID: _selectedBranch['facilityId'],
|
||||
clinicID: _selectedClinic['ClinicID'],
|
||||
doctorID: _selectedDoctor['DoctorID'],
|
||||
frequencyCode: _selectedFrequency['ParameterCode'],
|
||||
ext: _extController.text,
|
||||
remarks: _remarksController.text,
|
||||
priority: _activePriority,
|
||||
referralDate: appointmentDate
|
||||
)
|
||||
.then((_) {
|
||||
DrAppToastMsg.showSuccesToast(
|
||||
TranslationBase.of(context).referralSuccessMsg);
|
||||
Navigator.pop(context);
|
||||
});
|
||||
},
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget priorityBar(BuildContext _context, Size screenSize) {
|
||||
List<String> _priorities = [
|
||||
TranslationBase.of(context).veryUrgent.toUpperCase(),
|
||||
TranslationBase.of(context).urgent.toUpperCase(),
|
||||
TranslationBase.of(context).routine.toUpperCase(),
|
||||
];
|
||||
return Container(
|
||||
height: screenSize.height * 0.070,
|
||||
decoration:
|
||||
containerBorderDecoration(Color(0Xffffffff), Color(0xFFCCCCCC)),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: _priorities.map((item) {
|
||||
bool _isActive = _priorities[_activePriority] == item ? true : false;
|
||||
return Expanded(
|
||||
child: InkWell(
|
||||
child: Center(
|
||||
child: Container(
|
||||
height: screenSize.height * 0.070,
|
||||
decoration: containerBorderDecoration(
|
||||
_isActive ? Color(0XFFB8382B) : Colors.white,
|
||||
_isActive ? Color(0XFFB8382B) : Colors.white),
|
||||
child: Center(
|
||||
child: Text(
|
||||
item,
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: _isActive
|
||||
? Colors.white
|
||||
: Colors.black, //Colors.black,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
)),
|
||||
),
|
||||
onTap: () {
|
||||
print(_priorities.indexOf(item));
|
||||
setState(() {
|
||||
_activePriority = _priorities.indexOf(item);
|
||||
});
|
||||
},
|
||||
),
|
||||
);
|
||||
}).toList(),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
String getPriority() {
|
||||
DateTime date = DateTime.now();
|
||||
switch (_activePriority) {
|
||||
case 0:
|
||||
date = date.add(new Duration(hours: 3));
|
||||
break;
|
||||
case 1:
|
||||
date = date.add(new Duration(hours: 6));
|
||||
break;
|
||||
case 2:
|
||||
date = date.add(new Duration(days: 1));
|
||||
break;
|
||||
}
|
||||
var format = DateFormat('yyyy/mm/dd HH:mm a');
|
||||
var time = format.format(date);
|
||||
print(time);
|
||||
|
||||
appointmentDate = time;
|
||||
return time;
|
||||
}
|
||||
|
||||
BoxDecoration containerBorderDecoration(
|
||||
Color containerColor, Color borderColor) {
|
||||
return BoxDecoration(
|
||||
color: containerColor,
|
||||
shape: BoxShape.rectangle,
|
||||
borderRadius: BorderRadius.all(Radius.circular(6)),
|
||||
border: Border.fromBorderSide(BorderSide(
|
||||
color: borderColor,
|
||||
width: 2.0,
|
||||
)),
|
||||
);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue