flutter vervion 2 migration

flutter_vervion_2
hussam al-habibeh 5 years ago
parent 9b3c0af555
commit 110a1983c7

@ -39,7 +39,7 @@ android {
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.hmg.hmgDr"
minSdkVersion 18
minSdkVersion 21
targetSdkVersion 30
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName

@ -6,7 +6,7 @@ buildscript {
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.0'
classpath 'com.android.tools.build:gradle:4.0.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.2'
}

@ -1,6 +1,6 @@
#Fri Jun 23 08:50:38 CEST 2017
#Sun Jun 13 08:51:58 EEST 2021
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip

@ -0,0 +1 @@
include ':app'

@ -10,12 +10,11 @@ import 'package:url_launcher/url_launcher.dart';
import 'widgets/shared/buttons/secondary_button.dart';
class UpdatePage extends StatelessWidget {
final String message;
final String androidLink;
final String iosLink;
final String? message;
final String? androidLink;
final String? iosLink;
const UpdatePage({Key key, this.message, this.androidLink, this.iosLink})
: super(key: key);
const UpdatePage({Key? key, this.message, this.androidLink, this.iosLink}) : super(key: key);
@override
Widget build(BuildContext context) {
@ -30,18 +29,27 @@ class UpdatePage extends StatelessWidget {
children: [
Image.asset(
'assets/images/update_rocket_image.png',
width: double.maxFinite,fit: BoxFit.fill,
width: double.maxFinite,
fit: BoxFit.fill,
),
Image.asset('assets/images/HMG_logo.png'),
SizedBox(height: 8,),
SizedBox(
height: 8,
),
AppText(
TranslationBase.of(context).updateTheApp.toUpperCase(),fontSize: 17,
TranslationBase.of(context).updateTheApp!.toUpperCase(),
fontSize: 17,
fontWeight: FontWeight.w600,
),
SizedBox(height: 12,),
SizedBox(
height: 12,
),
Padding(
padding: const EdgeInsets.all(8.0),
child: AppText(message??"Update the app",fontSize: 12,),
child: AppText(
message ?? "Update the app",
fontSize: 12,
),
)
],
),
@ -52,14 +60,14 @@ class UpdatePage extends StatelessWidget {
// padding: const EdgeInsets.all(8.0),
margin: EdgeInsets.all(15),
child: SecondaryButton(
color: Colors.red[800],
color: Colors.red[800]!,
onTap: () {
if (Platform.isIOS)
launch(iosLink);
launch(iosLink!);
else
launch(androidLink);
launch(androidLink!);
},
label: TranslationBase.of(context).updateNow.toUpperCase(),
label: TranslationBase.of(context).updateNow!.toUpperCase(),
),
),
),

@ -5,14 +5,14 @@ class SizeConfig {
static double _blockWidth = 0;
static double _blockHeight = 0;
static double ? realScreenWidth;
static double ? realScreenHeight;
static double ? screenWidth;
static double ? screenHeight;
static double ? textMultiplier;
static double ? imageSizeMultiplier;
static double ? heightMultiplier;
static double ? widthMultiplier;
static late double realScreenWidth;
static late double realScreenHeight;
static late double screenWidth;
static late double screenHeight;
static late double textMultiplier;
static late double imageSizeMultiplier;
static late double heightMultiplier;
static late double widthMultiplier;
static bool isPortrait = true;
static bool isMobilePortrait = false;
@ -22,7 +22,6 @@ class SizeConfig {
realScreenHeight = constraints.maxHeight;
realScreenWidth = constraints.maxWidth;
if (constraints.maxWidth <= MAX_SMALL_SCREEN) {
isMobile = true;
}
@ -45,7 +44,7 @@ class SizeConfig {
}
_blockWidth = (screenWidth! / 100);
_blockHeight = (screenHeight! / 100)!;
textMultiplier = _blockHeight;
imageSizeMultiplier = _blockWidth;
heightMultiplier = _blockHeight;

@ -1,5 +1,5 @@
class AdmissionRequest {
late int patientMRN;
late int? patientMRN;
late int? admitToClinic;
late bool? isPregnant;
late int pregnancyWeeks;
@ -42,7 +42,7 @@ class AdmissionRequest {
late int? admissionRequestNo;
AdmissionRequest(
{required this.patientMRN,
{this.patientMRN,
this.admitToClinic,
this.isPregnant,
this.pregnancyWeeks = 0,
@ -110,8 +110,7 @@ class AdmissionRequest {
dietType = json['dietType'];
dietRemarks = json['dietRemarks'];
isPhysicalActivityModification = json['isPhysicalActivityModification'];
physicalActivityModificationComments =
json['physicalActivityModificationComments'];
physicalActivityModificationComments = json['physicalActivityModificationComments'];
orStatus = json['orStatus'];
mainLineOfTreatment = json['mainLineOfTreatment'];
estimatedCost = json['estimatedCost'];
@ -164,16 +163,13 @@ class AdmissionRequest {
data['transportComments'] = this.transportComments;
data['isPhysioAppointmentNeeded'] = this.isPhysioAppointmentNeeded;
data['physioAppointmentComments'] = this.physioAppointmentComments;
data['isOPDFollowupAppointmentNeeded'] =
this.isOPDFollowupAppointmentNeeded;
data['isOPDFollowupAppointmentNeeded'] = this.isOPDFollowupAppointmentNeeded;
data['opdFollowUpComments'] = this.opdFollowUpComments;
data['isDietType'] = this.isDietType;
data['dietType'] = this.dietType;
data['dietRemarks'] = this.dietRemarks;
data['isPhysicalActivityModification'] =
this.isPhysicalActivityModification;
data['physicalActivityModificationComments'] =
this.physicalActivityModificationComments;
data['isPhysicalActivityModification'] = this.isPhysicalActivityModification;
data['physicalActivityModificationComments'] = this.physicalActivityModificationComments;
data['orStatus'] = this.orStatus;
data['mainLineOfTreatment'] = this.mainLineOfTreatment;
data['estimatedCost'] = this.estimatedCost;
@ -189,8 +185,7 @@ class AdmissionRequest {
// this.admissionRequestDiagnoses.map((v) => v.toJson()).toList();
}
if (this.admissionRequestProcedures != null) {
data['admissionRequestProcedures'] =
this.admissionRequestProcedures!.map((v) => v.toJson()).toList();
data['admissionRequestProcedures'] = this.admissionRequestProcedures!.map((v) => v.toJson()).toList();
}
data['appointmentNo'] = this.appointmentNo;
data['episodeID'] = this.episodeID;

@ -146,7 +146,7 @@ class SickLeaveService extends BaseService {
_getReScheduleLeave.sort((a, b) {
var adate = a.dateTimeFrom; //before -> var adate = a.date;
var bdate = b.dateTimeFrom; //var bdate = b.date;
return -adate.compareTo(bdate);
return -adate!.compareTo(bdate!);
});
},
onFailure: (String error, int statusCode) {

@ -6,11 +6,9 @@ import '../../locator.dart';
import 'base_view_model.dart';
class DischargedPatientViewModel extends BaseViewModel {
DischargedPatientService _dischargedPatientService =
locator<DischargedPatientService>();
DischargedPatientService _dischargedPatientService = locator<DischargedPatientService>();
List<PatiantInformtion> get myDischargedPatient =>
_dischargedPatientService.myDischargedPatients;
List<PatiantInformtion> get myDischargedPatient => _dischargedPatientService.myDischargedPatients;
List<PatiantInformtion> filterData = [];
@ -19,9 +17,9 @@ class DischargedPatientViewModel extends BaseViewModel {
if (strExist) {
filterData = [];
for (var i = 0; i < myDischargedPatient.length; i++) {
String firstName = myDischargedPatient[i].firstName.toUpperCase();
String lastName = myDischargedPatient[i].lastName.toUpperCase();
String mobile = myDischargedPatient[i].mobileNumber.toUpperCase();
String firstName = myDischargedPatient[i].firstName!.toUpperCase();
String lastName = myDischargedPatient[i].lastName!.toUpperCase();
String mobile = myDischargedPatient[i].mobileNumber!.toUpperCase();
String patientID = myDischargedPatient[i].patientId.toString();
if (firstName.contains(str.toUpperCase()) ||

@ -14,8 +14,7 @@ import '../../locator.dart';
class LiveCarePatientViewModel extends BaseViewModel {
List<PatiantInformtion> filterData = [];
LiveCarePatientServices _liveCarePatientServices =
locator<LiveCarePatientServices>();
LiveCarePatientServices _liveCarePatientServices = locator<LiveCarePatientServices>();
StartCallRes get startCallRes => _liveCarePatientServices.startCallRes;
@ -28,12 +27,9 @@ class LiveCarePatientViewModel extends BaseViewModel {
setState(ViewState.BusyLocal);
}
PendingPatientERForDoctorAppRequestModel
pendingPatientERForDoctorAppRequestModel =
PendingPatientERForDoctorAppRequestModel(
sErServiceID: _dashboardService.sServiceID, outSA: false);
await _liveCarePatientServices.getPendingPatientERForDoctorApp(
pendingPatientERForDoctorAppRequestModel);
PendingPatientERForDoctorAppRequestModel pendingPatientERForDoctorAppRequestModel =
PendingPatientERForDoctorAppRequestModel(sErServiceID: _dashboardService.sServiceID, outSA: false);
await _liveCarePatientServices.getPendingPatientERForDoctorApp(pendingPatientERForDoctorAppRequestModel);
if (_liveCarePatientServices.hasError) {
error = _liveCarePatientServices.error!;
@ -120,16 +116,11 @@ class LiveCarePatientViewModel extends BaseViewModel {
if (strExist) {
filterData = [];
for (var i = 0; i < _liveCarePatientServices.patientList.length; i++) {
String fullName =
_liveCarePatientServices.patientList[i].fullName.toUpperCase();
String patientID =
_liveCarePatientServices.patientList[i].patientId.toString();
String mobile =
_liveCarePatientServices.patientList[i].mobileNumber.toUpperCase();
if (fullName.contains(str.toUpperCase()) ||
patientID.contains(str) ||
mobile.contains(str)) {
String fullName = _liveCarePatientServices.patientList[i].fullName!.toUpperCase();
String patientID = _liveCarePatientServices.patientList[i].patientId.toString();
String mobile = _liveCarePatientServices.patientList[i].mobileNumber!.toUpperCase();
if (fullName.contains(str.toUpperCase()) || patientID.contains(str) || mobile.contains(str)) {
filterData.add(_liveCarePatientServices.patientList[i]);
}
}

@ -8,17 +8,13 @@ import '../../locator.dart';
class PatientMuseViewModel extends BaseViewModel {
PatientMuseService _patientMuseService = locator<PatientMuseService>();
List<PatientMuseResultsModel> get patientMuseResultsModelList =>
_patientMuseService.patientMuseResultsModelList;
List<PatientMuseResultsModel> get patientMuseResultsModelList => _patientMuseService.patientMuseResultsModelList;
getECGPatient({int patientType, int patientOutSA, int patientID}) async {
getECGPatient({int? patientType, int? patientOutSA, int? patientID}) async {
setState(ViewState.Busy);
await _patientMuseService.getECGPatient(
patientID: patientID,
patientOutSA: patientOutSA,
patientType: patientType);
await _patientMuseService.getECGPatient(patientID: patientID, patientOutSA: patientOutSA, patientType: patientType);
if (_patientMuseService.hasError) {
error = _patientMuseService.error;
error = _patientMuseService.error!;
setState(ViewState.Error);
} else
setState(ViewState.Idle);

@ -17,22 +17,18 @@ class PatientSearchViewModel extends BaseViewModel {
List<PatiantInformtion> filterData = [];
DateTime selectedFromDate;
DateTime selectedToDate;
DateTime? selectedFromDate;
DateTime? selectedToDate;
searchData(String str) {
var strExist = str.length > 0 ? true : false;
if (strExist) {
filterData = [];
for (var i = 0; i < _outPatientService.patientList.length; i++) {
String firstName =
_outPatientService.patientList[i].firstName.toUpperCase();
String lastName =
_outPatientService.patientList[i].lastName.toUpperCase();
String mobile =
_outPatientService.patientList[i].mobileNumber.toUpperCase();
String patientID =
_outPatientService.patientList[i].patientId.toString();
String firstName = _outPatientService.patientList[i].firstName!.toUpperCase();
String lastName = _outPatientService.patientList[i].lastName!.toUpperCase();
String mobile = _outPatientService.patientList[i].mobileNumber!.toUpperCase();
String patientID = _outPatientService.patientList[i].patientId.toString();
if (firstName.contains(str.toUpperCase()) ||
lastName.contains(str.toUpperCase()) ||
@ -48,18 +44,17 @@ class PatientSearchViewModel extends BaseViewModel {
}
}
getOutPatient(PatientSearchRequestModel patientSearchRequestModel,
{bool isLocalBusy = false}) async {
getOutPatient(PatientSearchRequestModel patientSearchRequestModel, {bool isLocalBusy = false}) async {
if (isLocalBusy) {
setState(ViewState.BusyLocal);
} else {
setState(ViewState.Busy);
}
await getDoctorProfile(isGetProfile: true);
patientSearchRequestModel.doctorID = doctorProfile.doctorID;
patientSearchRequestModel.doctorID = doctorProfile!.doctorID;
await _outPatientService.getOutPatient(patientSearchRequestModel);
if (_outPatientService.hasError) {
error = _outPatientService.error;
error = _outPatientService.error!;
if (isLocalBusy) {
setState(ViewState.ErrorLocal);
} else {
@ -71,13 +66,11 @@ class PatientSearchViewModel extends BaseViewModel {
}
}
getPatientFileInformation(PatientSearchRequestModel patientSearchRequestModel,
{bool isLocalBusy = false}) async {
getPatientFileInformation(PatientSearchRequestModel patientSearchRequestModel, {bool isLocalBusy = false}) async {
setState(ViewState.Busy);
await _outPatientService
.getPatientFileInformation(patientSearchRequestModel);
await _outPatientService.getPatientFileInformation(patientSearchRequestModel);
if (_outPatientService.hasError) {
error = _outPatientService.error;
error = _outPatientService.error!;
setState(ViewState.Error);
} else {
filterData = _outPatientService.patientList;
@ -87,41 +80,31 @@ class PatientSearchViewModel extends BaseViewModel {
getPatientBasedOnDate(
{item,
PatientSearchRequestModel patientSearchRequestModel,
PatientType selectedPatientType,
bool isSearchWithKeyInfo,
OutPatientFilterType outPatientFilterType}) async {
PatientSearchRequestModel? patientSearchRequestModel,
PatientType? selectedPatientType,
bool? isSearchWithKeyInfo,
OutPatientFilterType? outPatientFilterType}) async {
String dateTo;
String dateFrom;
if (OutPatientFilterType.Previous == outPatientFilterType) {
selectedFromDate = DateTime(
DateTime.now().year, DateTime.now().month - 1, DateTime.now().day);
selectedToDate = DateTime(
DateTime.now().year, DateTime.now().month, DateTime.now().day - 1);
dateTo = AppDateUtils.convertDateToFormat(selectedToDate, 'yyyy-MM-dd');
dateFrom = AppDateUtils.convertDateToFormat(selectedFromDate, 'yyyy-MM-dd');
selectedFromDate = DateTime(DateTime.now().year, DateTime.now().month - 1, DateTime.now().day);
selectedToDate = DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day - 1);
dateTo = AppDateUtils.convertDateToFormat(selectedToDate!, 'yyyy-MM-dd');
dateFrom = AppDateUtils.convertDateToFormat(selectedFromDate!, 'yyyy-MM-dd');
} else if (OutPatientFilterType.NextWeek == outPatientFilterType) {
dateTo = AppDateUtils.convertDateToFormat(
DateTime(DateTime.now().year, DateTime.now().month,
DateTime.now().day + 6),
'yyyy-MM-dd');
DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day + 6), 'yyyy-MM-dd');
dateFrom = AppDateUtils.convertDateToFormat(
DateTime(DateTime.now().year, DateTime.now().month,
DateTime.now().day + 1),
'yyyy-MM-dd');
DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day + 1), 'yyyy-MM-dd');
} else {
dateFrom = AppDateUtils.convertDateToFormat(
DateTime(
DateTime.now().year, DateTime.now().month, DateTime.now().day),
'yyyy-MM-dd');
DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day), 'yyyy-MM-dd');
dateTo = AppDateUtils.convertDateToFormat(
DateTime(
DateTime.now().year, DateTime.now().month, DateTime.now().day),
'yyyy-MM-dd');
DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day), 'yyyy-MM-dd');
}
PatientSearchRequestModel currentModel = PatientSearchRequestModel();
currentModel.patientID = patientSearchRequestModel.patientID;
currentModel.patientID = patientSearchRequestModel!.patientID;
currentModel.firstName = patientSearchRequestModel.firstName;
currentModel.lastName = patientSearchRequestModel.lastName;
currentModel.middleName = patientSearchRequestModel.middleName;
@ -132,25 +115,21 @@ class PatientSearchViewModel extends BaseViewModel {
filterData = _outPatientService.patientList;
}
PatientInPatientService _inPatientService =
locator<PatientInPatientService>();
PatientInPatientService _inPatientService = locator<PatientInPatientService>();
List<PatiantInformtion> get inPatientList => _inPatientService.inPatientList;
List<PatiantInformtion> get myIinPatientList =>
_inPatientService.myInPatientList;
List<PatiantInformtion> get myIinPatientList => _inPatientService.myInPatientList;
List<PatiantInformtion> filteredInPatientItems = List();
List<PatiantInformtion> filteredInPatientItems = [];
Future getInPatientList(PatientSearchRequestModel requestModel,
{bool isMyInpatient = false}) async {
Future getInPatientList(PatientSearchRequestModel requestModel, {bool isMyInpatient = false}) async {
await getDoctorProfile();
setState(ViewState.Busy);
if (inPatientList.length == 0)
await _inPatientService.getInPatientList(requestModel, false);
if (inPatientList.length == 0) await _inPatientService.getInPatientList(requestModel, false);
if (_inPatientService.hasError) {
error = _inPatientService.error;
error = _inPatientService.error!;
setState(ViewState.Error);
} else {
// setDefaultInPatientList();
@ -176,9 +155,9 @@ class PatientSearchViewModel extends BaseViewModel {
if (strExist) {
filteredInPatientItems = [];
for (var i = 0; i < inPatientList.length; i++) {
String firstName = inPatientList[i].firstName.toUpperCase();
String lastName = inPatientList[i].lastName.toUpperCase();
String mobile = inPatientList[i].mobileNumber.toUpperCase();
String firstName = inPatientList[i].firstName!.toUpperCase();
String lastName = inPatientList[i].lastName!.toUpperCase();
String mobile = inPatientList[i].mobileNumber!.toUpperCase();
String patientID = inPatientList[i].patientId.toString();
if (firstName.contains(query.toUpperCase()) ||

@ -37,80 +37,67 @@ class SOAPViewModel extends BaseViewModel {
List<MasterKeyModel> get allergiesList => _SOAPService.allergiesList;
List<MasterKeyModel> get allergySeverityList =>
_SOAPService.allergySeverityList;
List<MasterKeyModel> get allergySeverityList => _SOAPService.allergySeverityList;
List<MasterKeyModel> get historyFamilyList => _SOAPService.historyFamilyList;
List<MasterKeyModel> get historyMedicalList =>
_SOAPService.historyMedicalList;
List<MasterKeyModel> get historyMedicalList => _SOAPService.historyMedicalList;
List<MasterKeyModel> get historySportList => _SOAPService.historySportList;
List<MasterKeyModel> get historySocialList => _SOAPService.historySocialList;
List<MasterKeyModel> get historySurgicalList =>
_SOAPService.historySurgicalList;
List<MasterKeyModel> get historySurgicalList => _SOAPService.historySurgicalList;
List<MasterKeyModel> get mergeHistorySurgicalWithHistorySportList =>
[...historySurgicalList, ...historySportList];
List<MasterKeyModel> get mergeHistorySurgicalWithHistorySportList => [...historySurgicalList, ...historySportList];
List<MasterKeyModel> get physicalExaminationList =>
_SOAPService.physicalExaminationList;
List<MasterKeyModel> get physicalExaminationList => _SOAPService.physicalExaminationList;
List<MasterKeyModel> get listOfDiagnosisType =>
_SOAPService.listOfDiagnosisType;
List<MasterKeyModel> get listOfDiagnosisType => _SOAPService.listOfDiagnosisType;
List<MasterKeyModel> get listOfDiagnosisCondition =>
_SOAPService.listOfDiagnosisCondition;
List<MasterKeyModel> get listOfDiagnosisCondition => _SOAPService.listOfDiagnosisCondition;
List<MasterKeyModel> get listOfICD10 => _SOAPService.listOfICD10;
List<GetChiefComplaintResModel> get patientChiefComplaintList =>
_SOAPService.patientChiefComplaintList;
List<GetChiefComplaintResModel> get patientChiefComplaintList => _SOAPService.patientChiefComplaintList;
List<GetAllergiesResModel> get patientAllergiesList =>
_SOAPService.patientAllergiesList;
List<GetAllergiesResModel> get patientAllergiesList => _SOAPService.patientAllergiesList;
List<GetHistoryResModel> get patientHistoryList =>
_SOAPService.patientHistoryList;
List<GetHistoryResModel> get patientHistoryList => _SOAPService.patientHistoryList;
List<GetPhysicalExamResModel> get patientPhysicalExamList =>
_SOAPService.patientPhysicalExamList;
List<GetPhysicalExamResModel> get patientPhysicalExamList => _SOAPService.patientPhysicalExamList;
List<GetPatientProgressNoteResModel> get patientProgressNoteList =>
_SOAPService.patientProgressNoteList;
List<GetPatientProgressNoteResModel> get patientProgressNoteList => _SOAPService.patientProgressNoteList;
List<GetAssessmentResModel> get patientAssessmentList =>
_SOAPService.patientAssessmentList;
int get episodeID => _SOAPService.episodeID;
List<GetAssessmentResModel> get patientAssessmentList => _SOAPService.patientAssessmentList;
int? get episodeID => _SOAPService.episodeID;
get medicationStrengthList => _SOAPService.medicationStrengthListWithModel;
get medicationDoseTimeList => _SOAPService.medicationDoseTimeListWithModel;
get medicationRouteList => _SOAPService.medicationRouteListWithModel;
get medicationFrequencyList => _SOAPService.medicationFrequencyListWithModel;
List<GetMedicationResponseModel> get allMedicationList =>
_prescriptionService.allMedicationList;
List<GetMedicationResponseModel> get allMedicationList => _prescriptionService.allMedicationList;
Future getAllergies(GetAllergiesRequestModel getAllergiesRequestModel) async {
setState(ViewState.Busy);
await _SOAPService.getAllergies(getAllergiesRequestModel);
if (_SOAPService.hasError) {
error = _SOAPService.error;
error = _SOAPService.error!;
setState(ViewState.Error);
} else
setState(ViewState.Idle);
}
Future getMasterLookup(MasterKeysService masterKeys,
{bool isBusyLocal = false}) async {
Future getMasterLookup(MasterKeysService masterKeys, {bool isBusyLocal = false}) async {
if (isBusyLocal) {
setState(ViewState.Busy);
} else
setState(ViewState.Busy);
await _SOAPService.getMasterLookup(masterKeys);
if (_SOAPService.hasError) {
error = _SOAPService.error;
error = _SOAPService.error!;
setState(ViewState.Error);
} else
setState(ViewState.Idle);
@ -120,7 +107,8 @@ class SOAPViewModel extends BaseViewModel {
setState(ViewState.BusyLocal);
await _SOAPService.postEpisode(postEpisodeReqModel);
if (_SOAPService.hasError) {
error = _SOAPService.error;
error = _SOAPService.error!;
setState(ViewState.ErrorLocal);
} else
setState(ViewState.Idle);
@ -130,62 +118,63 @@ class SOAPViewModel extends BaseViewModel {
setState(ViewState.BusyLocal);
await _SOAPService.postAllergy(postAllergyRequestModel);
if (_SOAPService.hasError) {
error = _SOAPService.error;
error = _SOAPService.error!;
setState(ViewState.ErrorLocal);
} else
setState(ViewState.Idle);
}
Future postHistories(
PostHistoriesRequestModel postHistoriesRequestModel) async {
Future postHistories(PostHistoriesRequestModel postHistoriesRequestModel) async {
setState(ViewState.BusyLocal);
await _SOAPService.postHistories(postHistoriesRequestModel);
if (_SOAPService.hasError) {
error = _SOAPService.error;
error = _SOAPService.error!;
setState(ViewState.ErrorLocal);
} else
setState(ViewState.Idle);
}
Future postChiefComplaint(
PostChiefComplaintRequestModel postChiefComplaintRequestModel) async {
Future postChiefComplaint(PostChiefComplaintRequestModel postChiefComplaintRequestModel) async {
setState(ViewState.BusyLocal);
await _SOAPService.postChiefComplaint(postChiefComplaintRequestModel);
if (_SOAPService.hasError) {
error = _SOAPService.error;
error = _SOAPService.error!;
setState(ViewState.ErrorLocal);
} else
setState(ViewState.Idle);
}
Future postPhysicalExam(
PostPhysicalExamRequestModel postPhysicalExamRequestModel) async {
Future postPhysicalExam(PostPhysicalExamRequestModel postPhysicalExamRequestModel) async {
setState(ViewState.BusyLocal);
await _SOAPService.postPhysicalExam(postPhysicalExamRequestModel);
if (_SOAPService.hasError) {
error = _SOAPService.error;
error = _SOAPService.error!;
setState(ViewState.ErrorLocal);
} else
setState(ViewState.Idle);
}
Future postProgressNote(
PostProgressNoteRequestModel postProgressNoteRequestModel) async {
Future postProgressNote(PostProgressNoteRequestModel postProgressNoteRequestModel) async {
setState(ViewState.BusyLocal);
await _SOAPService.postProgressNote(postProgressNoteRequestModel);
if (_SOAPService.hasError) {
error = _SOAPService.error;
error = _SOAPService.error!;
setState(ViewState.ErrorLocal);
} else
setState(ViewState.Idle);
}
Future postAssessment(
PostAssessmentRequestModel postAssessmentRequestModel) async {
Future postAssessment(PostAssessmentRequestModel postAssessmentRequestModel) async {
setState(ViewState.BusyLocal);
await _SOAPService.postAssessment(postAssessmentRequestModel);
if (_SOAPService.hasError) {
error = _SOAPService.error;
error = _SOAPService.error!;
setState(ViewState.ErrorLocal);
} else
setState(ViewState.Idle);
@ -195,76 +184,77 @@ class SOAPViewModel extends BaseViewModel {
setState(ViewState.BusyLocal);
await _SOAPService.patchAllergy(patchAllergyRequestModel);
if (_SOAPService.hasError) {
error = _SOAPService.error;
error = _SOAPService.error!;
setState(ViewState.ErrorLocal);
} else
setState(ViewState.Idle);
}
Future patchHistories(
PostHistoriesRequestModel patchHistoriesRequestModel) async {
Future patchHistories(PostHistoriesRequestModel patchHistoriesRequestModel) async {
setState(ViewState.BusyLocal);
await _SOAPService.patchHistories(patchHistoriesRequestModel);
if (_SOAPService.hasError) {
error = _SOAPService.error;
error = _SOAPService.error!;
setState(ViewState.ErrorLocal);
} else
setState(ViewState.Idle);
}
Future patchChiefComplaint(
PostChiefComplaintRequestModel patchChiefComplaintRequestModel) async {
Future patchChiefComplaint(PostChiefComplaintRequestModel patchChiefComplaintRequestModel) async {
setState(ViewState.BusyLocal);
await _SOAPService.patchChiefComplaint(patchChiefComplaintRequestModel);
if (_SOAPService.hasError) {
error = _SOAPService.error;
error = _SOAPService.error!;
setState(ViewState.ErrorLocal);
} else
setState(ViewState.Idle);
}
Future patchPhysicalExam(
PostPhysicalExamRequestModel patchPhysicalExamRequestModel) async {
Future patchPhysicalExam(PostPhysicalExamRequestModel patchPhysicalExamRequestModel) async {
setState(ViewState.BusyLocal);
await _SOAPService.patchPhysicalExam(patchPhysicalExamRequestModel);
if (_SOAPService.hasError) {
error = _SOAPService.error;
error = _SOAPService.error!;
setState(ViewState.ErrorLocal);
} else
setState(ViewState.Idle);
}
Future patchProgressNote(
PostProgressNoteRequestModel patchProgressNoteRequestModel) async {
Future patchProgressNote(PostProgressNoteRequestModel patchProgressNoteRequestModel) async {
setState(ViewState.BusyLocal);
await _SOAPService.patchProgressNote(patchProgressNoteRequestModel);
if (_SOAPService.hasError) {
error = _SOAPService.error;
error = _SOAPService.error!;
setState(ViewState.ErrorLocal);
} else
setState(ViewState.Idle);
}
Future patchAssessment(
PatchAssessmentReqModel patchAssessmentRequestModel) async {
Future patchAssessment(PatchAssessmentReqModel patchAssessmentRequestModel) async {
setState(ViewState.BusyLocal);
await _SOAPService.patchAssessment(patchAssessmentRequestModel);
if (_SOAPService.hasError) {
error = _SOAPService.error;
error = _SOAPService.error!;
setState(ViewState.ErrorLocal);
} else
setState(ViewState.Idle);
}
Future getPatientAllergy(GeneralGetReqForSOAP generalGetReqForSOAP,
{isLocalBusy = false}) async {
Future getPatientAllergy(GeneralGetReqForSOAP generalGetReqForSOAP, {isLocalBusy = false}) async {
if (isLocalBusy) {
setState(ViewState.BusyLocal);
} else
setState(ViewState.Busy);
await _SOAPService.getPatientAllergy(generalGetReqForSOAP);
if (_SOAPService.hasError) {
error = _SOAPService.error;
error = _SOAPService.error!;
if (isLocalBusy) {
setState(ViewState.ErrorLocal);
} else
@ -276,69 +266,64 @@ class SOAPViewModel extends BaseViewModel {
String getAllergicNames(isArabic) {
String allergiesString = '';
patientAllergiesList.forEach((element) {
MasterKeyModel selectedAllergy = getOneMasterKey(
masterKeys: MasterKeysService.Allergies,
id: element.allergyDiseaseId,
typeId: element.allergyDiseaseType);
if (selectedAllergy != null && element.isChecked)
allergiesString +=
(isArabic ? selectedAllergy.nameAr : selectedAllergy.nameEn) +
' , ';
MasterKeyModel? selectedAllergy = getOneMasterKey(
masterKeys: MasterKeysService.Allergies, id: element.allergyDiseaseId, typeId: element.allergyDiseaseType);
if (selectedAllergy != null && element.isChecked!)
allergiesString += (isArabic ? selectedAllergy.nameAr : selectedAllergy.nameEn)! + ' , ';
});
return allergiesString;
}
Future getPatientHistories(GetHistoryReqModel getHistoryReqModel,
{bool isFirst = false}) async {
Future getPatientHistories(GetHistoryReqModel getHistoryReqModel, {bool isFirst = false}) async {
setState(ViewState.Busy);
await _SOAPService.getPatientHistories(getHistoryReqModel,
isFirst: isFirst);
await _SOAPService.getPatientHistories(getHistoryReqModel, isFirst: isFirst);
if (_SOAPService.hasError) {
error = _SOAPService.error;
error = _SOAPService.error!;
setState(ViewState.Error);
} else
setState(ViewState.Idle);
}
Future getPatientChiefComplaint(
GetChiefComplaintReqModel getChiefComplaintReqModel) async {
Future getPatientChiefComplaint(GetChiefComplaintReqModel getChiefComplaintReqModel) async {
setState(ViewState.Busy);
await _SOAPService.getPatientChiefComplaint(getChiefComplaintReqModel);
if (_SOAPService.hasError) {
error = _SOAPService.error;
error = _SOAPService.error!;
setState(ViewState.Error);
} else
setState(ViewState.Idle);
}
Future getPatientPhysicalExam(
GetPhysicalExamReqModel getPhysicalExamReqModel) async {
Future getPatientPhysicalExam(GetPhysicalExamReqModel getPhysicalExamReqModel) async {
setState(ViewState.Busy);
await _SOAPService.getPatientPhysicalExam(getPhysicalExamReqModel);
if (_SOAPService.hasError) {
error = _SOAPService.error;
error = _SOAPService.error!;
setState(ViewState.Error);
} else
setState(ViewState.Idle);
}
Future getPatientProgressNote(
GetGetProgressNoteReqModel getGetProgressNoteReqModel) async {
Future getPatientProgressNote(GetGetProgressNoteReqModel getGetProgressNoteReqModel) async {
setState(ViewState.Busy);
await _SOAPService.getPatientProgressNote(getGetProgressNoteReqModel);
if (_SOAPService.hasError) {
error = _SOAPService.error;
error = _SOAPService.error!;
setState(ViewState.Error);
} else
setState(ViewState.Idle);
}
Future getPatientAssessment(
GetAssessmentReqModel getAssessmentReqModel) async {
Future getPatientAssessment(GetAssessmentReqModel getAssessmentReqModel) async {
setState(ViewState.Busy);
await _SOAPService.getPatientAssessment(getAssessmentReqModel);
if (_SOAPService.hasError) {
error = _SOAPService.error;
error = _SOAPService.error!;
setState(ViewState.Error);
} else
setState(ViewState.Idle);
@ -348,20 +333,18 @@ class SOAPViewModel extends BaseViewModel {
setState(ViewState.Busy);
await _prescriptionService.getMedicationList();
if (_prescriptionService.hasError) {
error = _prescriptionService.error;
error = _prescriptionService.error!;
setState(ViewState.Error);
} else
setState(ViewState.Idle);
}
// ignore: missing_return
MasterKeyModel getOneMasterKey(
{@required MasterKeysService masterKeys, dynamic id, int typeId}) {
MasterKeyModel? getOneMasterKey({@required MasterKeysService? masterKeys, dynamic id, int? typeId}) {
switch (masterKeys) {
case MasterKeysService.Allergies:
List<MasterKeyModel> result = allergiesList.where((element) {
return element.id == id &&
element.typeId == masterKeys.getMasterKeyService();
return element.id == id && element.typeId == masterKeys!.getMasterKeyService();
}).toList();
if (result.isNotEmpty) {
return result.first;
@ -370,8 +353,7 @@ class SOAPViewModel extends BaseViewModel {
case MasterKeysService.HistoryFamily:
List<MasterKeyModel> result = historyFamilyList.where((element) {
return element.id == id &&
element.typeId == masterKeys.getMasterKeyService();
return element.id == id && element.typeId == masterKeys!.getMasterKeyService();
}).toList();
if (result.isNotEmpty) {
return result.first;
@ -379,8 +361,7 @@ class SOAPViewModel extends BaseViewModel {
break;
case MasterKeysService.HistoryMedical:
List<MasterKeyModel> result = historyMedicalList.where((element) {
return element.id == id &&
element.typeId == masterKeys.getMasterKeyService();
return element.id == id && element.typeId == masterKeys!.getMasterKeyService();
}).toList();
if (result.isNotEmpty) {
return result.first;
@ -388,8 +369,7 @@ class SOAPViewModel extends BaseViewModel {
break;
case MasterKeysService.HistorySocial:
List<MasterKeyModel> result = historySocialList.where((element) {
return element.id == id &&
element.typeId == masterKeys.getMasterKeyService();
return element.id == id && element.typeId == masterKeys!.getMasterKeyService();
}).toList();
if (result.isNotEmpty) {
return result.first;
@ -397,8 +377,7 @@ class SOAPViewModel extends BaseViewModel {
break;
case MasterKeysService.HistorySports:
List<MasterKeyModel> result = historySocialList.where((element) {
return element.id == id &&
element.typeId == masterKeys.getMasterKeyService();
return element.id == id && element.typeId == masterKeys!.getMasterKeyService();
}).toList();
if (result.isNotEmpty) {
return result.first;
@ -414,8 +393,7 @@ class SOAPViewModel extends BaseViewModel {
break;
case MasterKeysService.PhysicalExamination:
List<MasterKeyModel> result = physicalExaminationList.where((element) {
return element.id == id &&
element.typeId == masterKeys.getMasterKeyService();
return element.id == id && element.typeId == masterKeys!.getMasterKeyService();
}).toList();
if (result.isNotEmpty) {
return result.first;
@ -423,8 +401,7 @@ class SOAPViewModel extends BaseViewModel {
break;
case MasterKeysService.AllergySeverity:
List<MasterKeyModel> result = allergySeverityList.where((element) {
return element.id == id &&
element.typeId == masterKeys.getMasterKeyService();
return element.id == id && element.typeId == masterKeys!.getMasterKeyService();
}).toList();
if (result.isNotEmpty) {
return result.first;
@ -439,8 +416,7 @@ class SOAPViewModel extends BaseViewModel {
case MasterKeysService.DiagnosisType:
List<MasterKeyModel> result = listOfDiagnosisType.where((element) {
return element.id == id &&
element.typeId == masterKeys.getMasterKeyService();
return element.id == id && element.typeId == masterKeys!.getMasterKeyService();
}).toList();
if (result.isNotEmpty) {
return result.first;
@ -448,8 +424,7 @@ class SOAPViewModel extends BaseViewModel {
break;
case MasterKeysService.DiagnosisCondition:
List<MasterKeyModel> result = listOfDiagnosisCondition.where((element) {
return element.id == id &&
element.typeId == masterKeys.getMasterKeyService();
return element.id == id && element.typeId == masterKeys!.getMasterKeyService();
}).toList();
if (result.isNotEmpty) {
return result.first;

@ -47,20 +47,17 @@ class AuthenticationViewModel extends BaseViewModel {
List<DoctorProfileModel> get doctorProfilesList => _authService.doctorProfilesList;
SendActivationCodeForDoctorAppResponseModel
get activationCodeVerificationScreenRes =>
SendActivationCodeForDoctorAppResponseModel get activationCodeVerificationScreenRes =>
_authService.activationCodeVerificationScreenRes;
SendActivationCodeForDoctorAppResponseModel
get activationCodeForDoctorAppRes =>
SendActivationCodeForDoctorAppResponseModel get activationCodeForDoctorAppRes =>
_authService.activationCodeForDoctorAppRes;
CheckActivationCodeForDoctorAppResponseModel
get checkActivationCodeForDoctorAppRes =>
CheckActivationCodeForDoctorAppResponseModel get checkActivationCodeForDoctorAppRes =>
_authService.checkActivationCodeForDoctorAppRes;
late NewLoginInformationModel loggedUser;
late GetIMEIDetailsModel ? user;
late GetIMEIDetailsModel? user;
UserModel userInfo = UserModel();
final LocalAuthentication auth = LocalAuthentication();
@ -101,8 +98,7 @@ class AuthenticationViewModel extends BaseViewModel {
profileInfo['IMEI'] = DEVICE_TOKEN;
profileInfo['LogInTypeID'] = await sharedPref.getInt(OTP_TYPE);
profileInfo['BioMetricEnabled'] = true;
profileInfo['MobileNo'] =
loggedIn != null ? loggedIn['MobileNumber'] : user.mobile;
profileInfo['MobileNo'] = loggedIn != null ? loggedIn['MobileNumber'] : user.mobile;
InsertIMEIDetailsModel insertIMEIDetailsModel = InsertIMEIDetailsModel.fromJson(profileInfo);
insertIMEIDetailsModel.genderDescription = profileInfo['Gender_Description'];
insertIMEIDetailsModel.genderDescriptionN = profileInfo['Gender_DescriptionN'];
@ -110,13 +106,11 @@ class AuthenticationViewModel extends BaseViewModel {
insertIMEIDetailsModel.titleDescription = profileInfo['Title_Description'];
insertIMEIDetailsModel.titleDescriptionN = profileInfo['Title_DescriptionN'];
insertIMEIDetailsModel.projectID = await sharedPref.getInt(PROJECT_ID);
insertIMEIDetailsModel.doctorID = loggedIn != null
? loggedIn['List_MemberInformation'][0]['MemberID']
: user.doctorID;
insertIMEIDetailsModel.doctorID =
loggedIn != null ? loggedIn['List_MemberInformation'][0]['MemberID'] : user.doctorID;
insertIMEIDetailsModel.outSA = loggedIn != null ? loggedIn['PatientOutSA'] : user.outSA;
insertIMEIDetailsModel.vidaAuthTokenID = await sharedPref.getString(VIDA_AUTH_TOKEN_ID);
insertIMEIDetailsModel.vidaRefreshTokenID =
await sharedPref.getString(VIDA_REFRESH_TOKEN_ID);
insertIMEIDetailsModel.vidaRefreshTokenID = await sharedPref.getString(VIDA_REFRESH_TOKEN_ID);
insertIMEIDetailsModel.password = await sharedPref.getString(PASSWORD);
await _authService.insertDeviceImei(insertIMEIDetailsModel);
@ -127,7 +121,6 @@ class AuthenticationViewModel extends BaseViewModel {
setState(ViewState.Idle);
}
/// first step login
Future login(UserModel userInfo) async {
setState(ViewState.BusyLocal);
@ -136,7 +129,7 @@ class AuthenticationViewModel extends BaseViewModel {
error = _authService.error!;
setState(ViewState.ErrorLocal);
} else {
sharedPref.setInt(PROJECT_ID, userInfo.projectID);
sharedPref.setInt(PROJECT_ID, userInfo.projectID!);
loggedUser = loginInfo;
saveObjToString(LOGGED_IN_USER, loginInfo);
sharedPref.remove(LAST_LOGIN_USER);
@ -146,10 +139,9 @@ class AuthenticationViewModel extends BaseViewModel {
}
/// send activation code for for msg methods
Future sendActivationCodeVerificationScreen( AuthMethodTypes authMethodType) async {
Future sendActivationCodeVerificationScreen(AuthMethodTypes authMethodType) async {
setState(ViewState.BusyLocal);
ActivationCodeForVerificationScreenModel activationCodeModel =
ActivationCodeForVerificationScreenModel(
ActivationCodeForVerificationScreenModel activationCodeModel = ActivationCodeForVerificationScreenModel(
iMEI: user!.iMEI,
facilityId: user!.projectID,
memberID: user!.doctorID,
@ -168,7 +160,7 @@ class AuthenticationViewModel extends BaseViewModel {
}
/// send activation code for silent login
Future sendActivationCodeForDoctorApp({required AuthMethodTypes authMethodType, required String password }) async {
Future sendActivationCodeForDoctorApp({required AuthMethodTypes authMethodType, required String password}) async {
setState(ViewState.BusyLocal);
int projectID = await sharedPref.getInt(PROJECT_ID);
ActivationCodeModel activationCodeModel = ActivationCodeModel(
@ -186,19 +178,13 @@ class AuthenticationViewModel extends BaseViewModel {
setState(ViewState.Idle);
}
/// check activation code for sms and whats app
Future checkActivationCodeForDoctorApp({required String activationCode}) async {
setState(ViewState.BusyLocal);
CheckActivationCodeRequestModel checkActivationCodeForDoctorApp =
new CheckActivationCodeRequestModel(
zipCode:
loggedUser != null ? loggedUser.zipCode :user!.zipCode,
mobileNumber:
loggedUser != null ? loggedUser.mobileNumber : user!.mobile,
projectID: await sharedPref.getInt(PROJECT_ID) != null
? await sharedPref.getInt(PROJECT_ID)
: user!.projectID,
CheckActivationCodeRequestModel checkActivationCodeForDoctorApp = new CheckActivationCodeRequestModel(
zipCode: loggedUser != null ? loggedUser.zipCode : user!.zipCode,
mobileNumber: loggedUser != null ? loggedUser.mobileNumber : user!.mobile,
projectID: await sharedPref.getInt(PROJECT_ID) != null ? await sharedPref.getInt(PROJECT_ID) : user!.projectID,
logInTokenID: await sharedPref.getString(LOGIN_TOKEN_ID),
activationCode: activationCode ?? '0000',
oTPSendType: await sharedPref.getInt(OTP_TYPE),
@ -214,7 +200,7 @@ class AuthenticationViewModel extends BaseViewModel {
/// get list of Hospitals
Future getHospitalsList(memberID) async {
GetHospitalsRequestModel getHospitalsRequestModel =GetHospitalsRequestModel();
GetHospitalsRequestModel getHospitalsRequestModel = GetHospitalsRequestModel();
getHospitalsRequestModel.memberID = memberID;
await _hospitalsService.getHospitals(getHospitalsRequestModel);
if (_hospitalsService.hasError) {
@ -224,24 +210,17 @@ class AuthenticationViewModel extends BaseViewModel {
setState(ViewState.Idle);
}
/// get type name based on id.
getType(type, context) {
switch (type) {
case 1:
return TranslationBase
.of(context)
.verifySMS;
return TranslationBase.of(context).verifySMS;
break;
case 3:
return TranslationBase
.of(context)
.verifyFingerprint;
return TranslationBase.of(context).verifyFingerprint;
break;
case 4:
return TranslationBase
.of(context)
.verifyFaceID;
return TranslationBase.of(context).verifyFaceID;
break;
case 2:
return TranslationBase.of(context).verifyWhatsApp;
@ -253,15 +232,12 @@ class AuthenticationViewModel extends BaseViewModel {
}
/// add  token to shared preferences in case of send activation code is success
setDataAfterSendActivationSuccess(SendActivationCodeForDoctorAppResponseModel sendActivationCodeForDoctorAppResponseModel) {
print("VerificationCode : " +
sendActivationCodeForDoctorAppResponseModel.verificationCode!);
sharedPref.setString(VIDA_AUTH_TOKEN_ID,
sendActivationCodeForDoctorAppResponseModel.vidaAuthTokenID!);
sharedPref.setString(VIDA_REFRESH_TOKEN_ID,
sendActivationCodeForDoctorAppResponseModel.vidaRefreshTokenID!);
sharedPref.setString(LOGIN_TOKEN_ID,
sendActivationCodeForDoctorAppResponseModel.logInTokenID!);
setDataAfterSendActivationSuccess(
SendActivationCodeForDoctorAppResponseModel sendActivationCodeForDoctorAppResponseModel) {
print("VerificationCode : " + sendActivationCodeForDoctorAppResponseModel.verificationCode!);
sharedPref.setString(VIDA_AUTH_TOKEN_ID, sendActivationCodeForDoctorAppResponseModel.vidaAuthTokenID!);
sharedPref.setString(VIDA_REFRESH_TOKEN_ID, sendActivationCodeForDoctorAppResponseModel.vidaRefreshTokenID!);
sharedPref.setString(LOGIN_TOKEN_ID, sendActivationCodeForDoctorAppResponseModel.logInTokenID!);
}
saveObjToString(String key, value) async {
@ -300,7 +276,7 @@ class AuthenticationViewModel extends BaseViewModel {
license: true,
projectID: clinicInfo.projectID,
tokenID: '',
languageID: 2);//TODO change the lan
languageID: 2); //TODO change the lan
await _authService.getDoctorProfileBasedOnClinic(docInfo);
if (_authService.hasError) {
error = _authService.error!;
@ -313,27 +289,19 @@ class AuthenticationViewModel extends BaseViewModel {
/// add some logic in case of check activation code is success
onCheckActivationCodeSuccess() async {
sharedPref.setString(
TOKEN,
checkActivationCodeForDoctorAppRes.authenticationTokenID!);
sharedPref.setString(TOKEN, checkActivationCodeForDoctorAppRes.authenticationTokenID!);
if (checkActivationCodeForDoctorAppRes.listDoctorProfile != null &&
checkActivationCodeForDoctorAppRes.listDoctorProfile!
.isNotEmpty) {
localSetDoctorProfile(
checkActivationCodeForDoctorAppRes.listDoctorProfile![0]);
checkActivationCodeForDoctorAppRes.listDoctorProfile!.isNotEmpty) {
localSetDoctorProfile(checkActivationCodeForDoctorAppRes.listDoctorProfile![0]);
} else {
sharedPref.setObj(
CLINIC_NAME,
checkActivationCodeForDoctorAppRes.listDoctorsClinic);
ClinicModel clinic = ClinicModel.fromJson(
checkActivationCodeForDoctorAppRes.listDoctorsClinic![0]
.toJson());
sharedPref.setObj(CLINIC_NAME, checkActivationCodeForDoctorAppRes.listDoctorsClinic);
ClinicModel clinic = ClinicModel.fromJson(checkActivationCodeForDoctorAppRes.listDoctorsClinic![0].toJson());
await getDoctorProfileBasedOnClinic(clinic);
}
}
/// check specific biometric if it available or not
Future <bool> checkIfBiometricAvailable(BiometricType biometricType) async {
Future<bool> checkIfBiometricAvailable(BiometricType biometricType) async {
bool isAvailable = false;
await _getAvailableBiometrics();
for (var i = 0; i < _availableBiometrics.length; i++) {
@ -355,13 +323,13 @@ class AuthenticationViewModel extends BaseViewModel {
getDeviceInfoFromFirebase() async {
_firebaseMessaging.setAutoInitEnabled(true);
if (Platform.isIOS) {
await _firebaseMessaging.requestPermission(sound: true, badge: true, alert: true, provisional: true);
await _firebaseMessaging.requestPermission(sound: true, badge: true, alert: true, provisional: true);
}
try {
setState(ViewState.Busy);
} catch (e) {
Helpers.showErrorToast("fdfdfdfdf"+e.toString());
Helpers.showErrorToast("fdfdfdfdf" + e.toString());
}
var token = await _firebaseMessaging.getToken();
if (DEVICE_TOKEN == "") {
@ -373,9 +341,8 @@ class AuthenticationViewModel extends BaseViewModel {
setState(ViewState.ErrorLocal);
} else {
if (_authService.dashboardItemsList.length > 0) {
user =_authService.dashboardItemsList[0];
sharedPref.setObj(
LAST_LOGIN_USER, _authService.dashboardItemsList[0]);
user = _authService.dashboardItemsList[0];
sharedPref.setObj(LAST_LOGIN_USER, _authService.dashboardItemsList[0]);
this.unverified = true;
}
setState(ViewState.Idle);
@ -390,9 +357,9 @@ class AuthenticationViewModel extends BaseViewModel {
if (state == ViewState.Busy) {
app_status = APP_STATUS.LOADING;
} else {
if(this.doctorProfile !=null)
if (this.doctorProfile != null)
app_status = APP_STATUS.AUTHENTICATED;
else if (this.unverified) {
else if (this.unverified) {
app_status = APP_STATUS.UNVERIFIED;
} else if (this.isLogin) {
app_status = APP_STATUS.AUTHENTICATED;
@ -402,12 +369,13 @@ class AuthenticationViewModel extends BaseViewModel {
}
return app_status;
}
setAppStatus(APP_STATUS status){
setAppStatus(APP_STATUS status) {
this.app_status = status;
notifyListeners();
}
setUnverified(bool unverified,{bool isFromLogin = false}){
setUnverified(bool unverified, {bool isFromLogin = false}) {
this.unverified = unverified;
this.isFromLogin = isFromLogin;
notifyListeners();
@ -415,24 +383,21 @@ class AuthenticationViewModel extends BaseViewModel {
/// logout function
logout({bool isFromLogin = false}) async {
DEVICE_TOKEN = "";
String lang = await sharedPref.getString(APP_Language);
await Helpers.clearSharedPref();
doctorProfile = null;
sharedPref.setString(APP_Language, lang);
deleteUser();
await getDeviceInfoFromFirebase();
this.isFromLogin = isFromLogin;
app_status = APP_STATUS.UNAUTHENTICATED;
setState(ViewState.Idle);
DEVICE_TOKEN = "";
String lang = await sharedPref.getString(APP_Language);
await Helpers.clearSharedPref();
doctorProfile = null;
sharedPref.setString(APP_Language, lang);
deleteUser();
await getDeviceInfoFromFirebase();
this.isFromLogin = isFromLogin;
app_status = APP_STATUS.UNAUTHENTICATED;
setState(ViewState.Idle);
}
deleteUser(){
deleteUser() {
user = null;
unverified = false;
isLogin = false;
}
}

@ -15,23 +15,20 @@ class DashboardViewModel extends BaseViewModel {
final FirebaseMessaging _firebaseMessaging = FirebaseMessaging.instance;
DashboardService _dashboardService = locator<DashboardService>();
List<DashboardModel> get dashboardItemsList =>
_dashboardService.dashboardItemsList;
List<DashboardModel> get dashboardItemsList => _dashboardService.dashboardItemsList;
bool get hasVirtualClinic => _dashboardService.hasVirtualClinic;
String? get sServiceID => _dashboardService.sServiceID;
Future setFirebaseNotification(ProjectViewModel projectsProvider,
AuthenticationViewModel authProvider) async {
Future setFirebaseNotification(ProjectViewModel projectsProvider, AuthenticationViewModel authProvider) async {
setState(ViewState.Busy);
await projectsProvider.getDoctorClinicsList();
// _firebaseMessaging.setAutoInitEnabled(true);
_firebaseMessaging.requestPermission(sound: true, badge: true, alert: true, provisional: true);
_firebaseMessaging.getToken().then((String ?token) async {
_firebaseMessaging.getToken().then((String? token) async {
if (token != '') {
DEVICE_TOKEN = token!;
authProvider.insertDeviceImei();
@ -59,8 +56,7 @@ class DashboardViewModel extends BaseViewModel {
setState(ViewState.Idle);
}
Future changeClinic(
int clinicId, AuthenticationViewModel authProvider) async {
Future changeClinic(int clinicId, AuthenticationViewModel authProvider) async {
setState(ViewState.BusyLocal);
await getDoctorProfile();
ClinicModel clinicModel = ClinicModel(
@ -76,7 +72,7 @@ class DashboardViewModel extends BaseViewModel {
getPatientCount(DashboardModel inPatientCount) {
int value = 0;
inPatientCount.summaryoptions.forEach((result) => {value += result.value});
inPatientCount.summaryoptions!.forEach((result) => {value += result.value!});
return value.toString();
}

@ -105,9 +105,9 @@ class MedicineViewModel extends BaseViewModel {
setState(ViewState.Idle);
}
Future getMedicationList({required String drug}) async {
Future getMedicationList({String? drug}) async {
setState(ViewState.Busy);
await _prescriptionService.getMedicationList(drug: drug);
await _prescriptionService.getMedicationList(drug: drug!);
if (_prescriptionService.hasError) {
error = _prescriptionService.error!;
setState(ViewState.Error);
@ -185,7 +185,8 @@ class MedicineViewModel extends BaseViewModel {
setState(ViewState.Idle);
}
Future getBoxQuantity({required int itemCode, required int duration, required double strength, required int freq}) async {
Future getBoxQuantity(
{required int itemCode, required int duration, required double strength, required int freq}) async {
setState(ViewState.Busy);
await _prescriptionService.calculateBoxQuantity(
strength: strength, itemCode: itemCode, duration: duration, freq: freq);

@ -18,16 +18,13 @@ import 'package:flutter/cupertino.dart';
import '../../locator.dart';
class PatientReferralViewModel extends BaseViewModel {
PatientReferralService _referralPatientService =
locator<PatientReferralService>();
PatientReferralService _referralPatientService = locator<PatientReferralService>();
ReferralService _referralService = locator<ReferralService>();
MyReferralInPatientService _myReferralService =
locator<MyReferralInPatientService>();
MyReferralInPatientService _myReferralService = locator<MyReferralInPatientService>();
DischargedPatientService _dischargedPatientService =
locator<DischargedPatientService>();
DischargedPatientService _dischargedPatientService = locator<DischargedPatientService>();
List<DischargeReferralPatient> get myDischargeReferralPatient =>
_dischargedPatientService.myDischargeReferralPatients;
@ -35,28 +32,21 @@ class PatientReferralViewModel extends BaseViewModel {
List<dynamic> get clinicsList => _referralPatientService.clinicsList;
List<dynamic> get referralFrequencyList =>
_referralPatientService.frequencyList;
List<dynamic> get referralFrequencyList => _referralPatientService.frequencyList;
List<dynamic> doctorsList = [];
List<ClinicDoctor> get clinicDoctorsList =>
_referralPatientService.doctorsList;
List<ClinicDoctor> get clinicDoctorsList => _referralPatientService.doctorsList;
List<MyReferralPatientModel> get myReferralPatients =>
_myReferralService.myReferralPatients;
List<MyReferralPatientModel> get myReferralPatients => _myReferralService.myReferralPatients;
List<MyReferredPatientModel> get listMyReferredPatientModel =>
_referralPatientService.listMyReferredPatientModel;
List<MyReferredPatientModel> get listMyReferredPatientModel => _referralPatientService.listMyReferredPatientModel;
List<PendingReferral> get pendingReferral =>
_referralPatientService.pendingReferralList;
List<PendingReferral> get pendingReferral => _referralPatientService.pendingReferralList;
List<PendingReferral> get patientReferral =>
_referralPatientService.patientReferralList;
List<PendingReferral> get patientReferral => _referralPatientService.patientReferralList;
List<PatiantInformtion> get patientArrivalList =>
_referralPatientService.patientArrivalList;
List<PatiantInformtion> get patientArrivalList => _referralPatientService.patientArrivalList;
Future getPatientReferral(PatiantInformtion patient) async {
setState(ViewState.Busy);
@ -105,8 +95,7 @@ class PatientReferralViewModel extends BaseViewModel {
setState(ViewState.Idle);
}
Future getClinicDoctors(
PatiantInformtion patient, int clinicId, int branchId) async {
Future getClinicDoctors(PatiantInformtion patient, int clinicId, int branchId) async {
setState(ViewState.BusyLocal);
await _referralPatientService.getDoctorsList(patient, clinicId, branchId);
if (_referralPatientService.hasError) {
@ -124,10 +113,7 @@ class PatientReferralViewModel extends BaseViewModel {
Future<dynamic> getDoctorBranch() async {
DoctorProfileModel? doctorProfile = await getDoctorProfile();
if (doctorProfile != null) {
dynamic _selectedBranch = {
"facilityId": doctorProfile.projectID,
"facilityName": doctorProfile.projectName
};
dynamic _selectedBranch = {"facilityId": doctorProfile.projectID, "facilityName": doctorProfile.projectName};
return _selectedBranch;
}
return null;
@ -167,8 +153,7 @@ class PatientReferralViewModel extends BaseViewModel {
setState(ViewState.Idle);
}
Future replay(
String referredDoctorRemarks, MyReferralPatientModel referral) async {
Future replay(String referredDoctorRemarks, MyReferralPatientModel referral) async {
setState(ViewState.Busy);
await _myReferralService.replay(referredDoctorRemarks, referral);
if (_myReferralService.hasError) {
@ -178,8 +163,7 @@ class PatientReferralViewModel extends BaseViewModel {
getMyReferralPatientService();
}
Future responseReferral(
PendingReferral pendingReferral, bool isAccepted) async {
Future responseReferral(PendingReferral pendingReferral, bool isAccepted) async {
setState(ViewState.Busy);
await _referralPatientService.responseReferral(pendingReferral, isAccepted);
if (_referralPatientService.hasError) {
@ -189,11 +173,10 @@ class PatientReferralViewModel extends BaseViewModel {
setState(ViewState.Idle);
}
Future makeReferral(PatiantInformtion patient, String isoStringDate,
int projectID, int clinicID, int doctorID, String remarks) async {
Future makeReferral(PatiantInformtion patient, String isoStringDate, int projectID, int clinicID, int doctorID,
String remarks) async {
setState(ViewState.Busy);
await _referralPatientService.makeReferral(
patient, isoStringDate, projectID, clinicID, doctorID, remarks);
await _referralPatientService.makeReferral(patient, isoStringDate, projectID, clinicID, doctorID, remarks);
if (_referralPatientService.hasError) {
error = _referralPatientService.error!;
setState(ViewState.Error);
@ -233,12 +216,10 @@ class PatientReferralViewModel extends BaseViewModel {
}
}
Future getPatientDetails(
String fromDate, String toDate, int patientMrn, int appointmentNo) async {
Future getPatientDetails(String fromDate, String toDate, int patientMrn, int appointmentNo) async {
setState(ViewState.Busy);
await _referralPatientService.getPatientArrivalList(toDate,
fromDate: fromDate, patientMrn: patientMrn);
await _referralPatientService.getPatientArrivalList(toDate, fromDate: fromDate, patientMrn: patientMrn);
if (_referralPatientService.hasError) {
error = _referralPatientService.error!;
setState(ViewState.Error);
@ -257,8 +238,7 @@ class PatientReferralViewModel extends BaseViewModel {
setState(ViewState.Idle);
}
Future verifyReferralDoctorRemarks(
MyReferredPatientModel referredPatient) async {
Future verifyReferralDoctorRemarks(MyReferredPatientModel referredPatient) async {
setState(ViewState.Busy);
await _referralPatientService.verifyReferralDoctorRemarks(referredPatient);
if (_referralPatientService.hasError) {
@ -283,22 +263,21 @@ class PatientReferralViewModel extends BaseViewModel {
String getReferralStatusNameByCode(int statusCode, BuildContext context) {
switch (statusCode) {
case 1:
return TranslationBase.of(context).pending /*referralStatusHold*/;
return TranslationBase.of(context).pending ?? "" /*referralStatusHold*/;
case 2:
return TranslationBase.of(context).accepted /*referralStatusActive*/;
return TranslationBase.of(context).accepted ?? "" /*referralStatusActive*/;
case 4:
return TranslationBase.of(context).rejected /*referralStatusCancelled*/;
return TranslationBase.of(context).rejected ?? "" /*referralStatusCancelled*/;
case 46:
return TranslationBase.of(context).accepted /*referralStatusCompleted*/;
return TranslationBase.of(context).accepted ?? "" /*referralStatusCompleted*/;
case 63:
return TranslationBase.of(context).rejected /*referralStatusNotSeen*/;
return TranslationBase.of(context).rejected ?? "" /*referralStatusNotSeen*/;
default:
return "-";
}
}
PatiantInformtion getPatientFromReferral(
MyReferredPatientModel referredPatient) {
PatiantInformtion getPatientFromReferral(MyReferredPatientModel referredPatient) {
PatiantInformtion patient = PatiantInformtion();
patient.doctorId = referredPatient.doctorID;
patient.doctorName = referredPatient.doctorName;
@ -323,8 +302,7 @@ class PatientReferralViewModel extends BaseViewModel {
return patient;
}
PatiantInformtion getPatientFromReferralO(
MyReferralPatientModel referredPatient) {
PatiantInformtion getPatientFromReferralO(MyReferralPatientModel referredPatient) {
PatiantInformtion patient = PatiantInformtion();
patient.doctorId = referredPatient.doctorID!;
patient.doctorName = referredPatient.doctorName!;
@ -349,8 +327,7 @@ class PatientReferralViewModel extends BaseViewModel {
return patient;
}
PatiantInformtion getPatientFromDischargeReferralPatient(
DischargeReferralPatient referredPatient) {
PatiantInformtion getPatientFromDischargeReferralPatient(DischargeReferralPatient referredPatient) {
PatiantInformtion patient = PatiantInformtion();
patient.doctorId = referredPatient.doctorID!;
patient.doctorName = referredPatient.doctorName!;
@ -369,8 +346,7 @@ class PatientReferralViewModel extends BaseViewModel {
patient.roomId = referredPatient.roomID!;
patient.bedId = referredPatient.bedID!;
patient.nationalityName = referredPatient.nationalityName!;
patient.nationalityFlagURL =
''; // TODO from backend referredPatient.nationalityFlagURL;
patient.nationalityFlagURL = ''; // TODO from backend referredPatient.nationalityFlagURL;
patient.age = referredPatient.age;
patient.clinicDescription = referredPatient.clinicDescription!;
return patient;

@ -18,21 +18,17 @@ import '../../locator.dart';
class UcafViewModel extends BaseViewModel {
UcafService _ucafService = locator<UcafService>();
List<GetChiefComplaintResModel> get patientChiefComplaintList =>
_ucafService.patientChiefComplaintList;
List<GetChiefComplaintResModel> get patientChiefComplaintList => _ucafService.patientChiefComplaintList;
List<VitalSignHistory> get patientVitalSignsHistory =>
_ucafService.patientVitalSignsHistory;
List<VitalSignHistory> get patientVitalSignsHistory => _ucafService.patientVitalSignsHistory;
List<GetAssessmentResModel> get patientAssessmentList =>
_ucafService.patientAssessmentList;
List<GetAssessmentResModel> get patientAssessmentList => _ucafService.patientAssessmentList;
List<MasterKeyModel> get diagnosisTypes => _ucafService.listOfDiagnosisType;
List<MasterKeyModel> get diagnosisConditions =>
_ucafService.listOfDiagnosisCondition;
List<MasterKeyModel> get diagnosisConditions => _ucafService.listOfDiagnosisCondition;
PrescriptionModel get prescriptionList => _ucafService.prescriptionList;
PrescriptionModel? get prescriptionList => _ucafService.prescriptionList;
List<OrderProcedure> get orderProcedures => _ucafService.orderProcedureList;
@ -61,11 +57,9 @@ class UcafViewModel extends BaseViewModel {
String from;
String to;
from = AppDateUtils.convertDateToFormat(DateTime.now(), 'yyyy-MM-dd');
to = AppDateUtils.convertDateToFormat(DateTime.now(), 'yyyy-MM-dd');
from = AppDateUtils.convertDateToFormat(DateTime.now(), 'yyyy-MM-dd');
to = AppDateUtils.convertDateToFormat(DateTime.now(), 'yyyy-MM-dd');
// await _ucafService.getPatientVitalSignsHistory(patient, from, to);
await _ucafService.getInPatientVitalSignHistory(patient, false);
@ -85,22 +79,16 @@ class UcafViewModel extends BaseViewModel {
if (bodyMax == "0" || bodyMax == 'null') {
bodyMax = element.bodyMassIndex.toString();
}
if (temperatureCelcius == "0" ||
temperatureCelcius == 'null') {
if (temperatureCelcius == "0" || temperatureCelcius == 'null') {
temperatureCelcius = element.temperatureCelcius.toString();
}
if (hartRat == "0" || hartRat == null || hartRat == 'null') {
hartRat = element.pulseBeatPerMinute.toString();
}
if (respirationBeatPerMinute == "0" ||
respirationBeatPerMinute == null ||
respirationBeatPerMinute == 'null') {
respirationBeatPerMinute =
element.respirationBeatPerMinute.toString();
if (respirationBeatPerMinute == "0" || respirationBeatPerMinute == null || respirationBeatPerMinute == 'null') {
respirationBeatPerMinute = element.respirationBeatPerMinute.toString();
}
if (bloodPressure == "0 / 0" ||
bloodPressure == null ||
bloodPressure == 'null') {
if (bloodPressure == "0 / 0" || bloodPressure == null || bloodPressure == 'null') {
bloodPressure = element.bloodPressure.toString();
}
});
@ -119,8 +107,7 @@ class UcafViewModel extends BaseViewModel {
} else {
if (patientAssessmentList.isNotEmpty) {
if (diagnosisConditions.length == 0) {
await _ucafService
.getMasterLookup(MasterKeysService.DiagnosisCondition);
await _ucafService.getMasterLookup(MasterKeysService.DiagnosisCondition);
}
if (diagnosisTypes.length == 0) {
await _ucafService.getMasterLookup(MasterKeysService.DiagnosisType);
@ -162,13 +149,11 @@ class UcafViewModel extends BaseViewModel {
}
}
MasterKeyModel ? findMasterDataById(
{required MasterKeysService masterKeys, dynamic id}) {
MasterKeyModel? findMasterDataById({required MasterKeysService masterKeys, dynamic id}) {
switch (masterKeys) {
case MasterKeysService.DiagnosisCondition:
List<MasterKeyModel> result = diagnosisConditions.where((element) {
return element.id == id &&
element.typeId == masterKeys.getMasterKeyService();
return element.id == id && element.typeId == masterKeys.getMasterKeyService();
}).toList();
if (result.isNotEmpty) {
return result.first;
@ -176,8 +161,7 @@ class UcafViewModel extends BaseViewModel {
return null;
case MasterKeysService.DiagnosisType:
List<MasterKeyModel> result = diagnosisTypes.where((element) {
return element.id == id &&
element.typeId == masterKeys.getMasterKeyService();
return element.id == id && element.typeId == masterKeys.getMasterKeyService();
}).toList();
if (result.isNotEmpty) {
return result.first;
@ -192,7 +176,7 @@ class UcafViewModel extends BaseViewModel {
setState(ViewState.Busy);
await _ucafService.postUCAF(patient);
if (_ucafService.hasError) {
error = _ucafService.error;
error = _ucafService.error!;
setState(ViewState.ErrorLocal);
} else {
setState(ViewState.Idle); // but with empty list

@ -11,10 +11,9 @@ import '../../locator.dart';
class VitalSignsViewModel extends BaseViewModel {
VitalSignsService _vitalSignService = locator<VitalSignsService>();
VitalSignData get patientVitalSigns => _vitalSignService.patientVitalSigns;
VitalSignData? get patientVitalSigns => _vitalSignService.patientVitalSigns;
List<VitalSignHistory> get patientVitalSignsHistory =>
_vitalSignService.patientVitalSignsHistory;
List<VitalSignHistory> get patientVitalSignsHistory => _vitalSignService.patientVitalSignsHistory;
String heightCm = "0";
String weightKg = "0";
@ -42,8 +41,7 @@ class VitalSignsViewModel extends BaseViewModel {
}
}
Future getPatientVitalSignHistory(PatiantInformtion patient, String from,
String to, bool isInPatient) async {
Future getPatientVitalSignHistory(PatiantInformtion patient, String from, String to, bool isInPatient) async {
setState(ViewState.Busy);
if (from == null || from == "0") {
from = AppDateUtils.convertDateToFormat(DateTime.now(), 'yyyy-MM-dd');
@ -72,50 +70,29 @@ class VitalSignsViewModel extends BaseViewModel {
if (bodyMax == "0" || bodyMax == null || bodyMax == 'null') {
bodyMax = element.bodyMassIndex.toString();
}
if (temperatureCelcius == "0" ||
temperatureCelcius == null ||
temperatureCelcius == 'null') {
if (temperatureCelcius == "0" || temperatureCelcius == null || temperatureCelcius == 'null') {
temperatureCelcius = element.temperatureCelcius.toString();
}
if (hartRat == "0" || hartRat == null || hartRat == 'null') {
hartRat = element.pulseBeatPerMinute.toString();
}
if (respirationBeatPerMinute == "0" ||
respirationBeatPerMinute == null ||
respirationBeatPerMinute == 'null') {
respirationBeatPerMinute =
element.respirationBeatPerMinute.toString();
if (respirationBeatPerMinute == "0" || respirationBeatPerMinute == null || respirationBeatPerMinute == 'null') {
respirationBeatPerMinute = element.respirationBeatPerMinute.toString();
}
if (bloodPressure == "0 / 0" ||
bloodPressure == null ||
bloodPressure == 'null') {
if (bloodPressure == "0 / 0" || bloodPressure == null || bloodPressure == 'null') {
bloodPressure = element.bloodPressure.toString();
}
if (oxygenation == "0" ||
oxygenation == null ||
oxygenation == 'null') {
oxygenation =
"${element.sAO2.toString()}"; /* - ${element.fIO2.toString()}*/
if (oxygenation == "0" || oxygenation == null || oxygenation == 'null') {
oxygenation = "${element.sAO2.toString()}"; /* - ${element.fIO2.toString()}*/
}
if (painScore == null || painScore == "-") {
painScore = element.painScoreDesc.toString() != 'null'
? element.painScoreDesc.toString()
: "-";
painLocation = element.painLocation.toString() != 'null'
? element.painLocation.toString()
: "-";
painCharacter = element.painCharacter.toString() != 'null'
? element.painCharacter.toString()
: "-";
painDuration = element.painDuration.toString() != 'null'
? element.painDuration.toString()
: "-";
isPainDone = element.isPainManagementDone.toString() != 'null'
? element.isPainManagementDone.toString()
: "-";
painFrequency = element.painFrequency.toString() != 'null'
? element.painFrequency.toString()
: "-";
painScore = element.painScoreDesc.toString() != 'null' ? element.painScoreDesc.toString() : "-";
painLocation = element.painLocation.toString() != 'null' ? element.painLocation.toString() : "-";
painCharacter = element.painCharacter.toString() != 'null' ? element.painCharacter.toString() : "-";
painDuration = element.painDuration.toString() != 'null' ? element.painDuration.toString() : "-";
isPainDone =
element.isPainManagementDone.toString() != 'null' ? element.isPainManagementDone.toString() : "-";
painFrequency = element.painFrequency.toString() != 'null' ? element.painFrequency.toString() : "-";
}
});
setState(ViewState.Idle);

@ -26,11 +26,9 @@ class PrescriptionViewModel extends BaseViewModel {
FilterType filterType = FilterType.Clinic;
bool hasError = false;
PrescriptionService _prescriptionService = locator<PrescriptionService>();
List<GetMedicationResponseModel> get allMedicationList =>
_prescriptionService.allMedicationList;
List<GetMedicationResponseModel> get allMedicationList => _prescriptionService.allMedicationList;
List<PrescriptionModel> get prescriptionList =>
_prescriptionService.prescriptionList;
List<PrescriptionModel> get prescriptionList => _prescriptionService.prescriptionList;
List<dynamic> get drugsList => _prescriptionService.doctorsList;
//List<dynamic> get allMedicationList => _prescriptionService.allMedicationList;
List<dynamic> get drugToDrug => _prescriptionService.drugToDrugList;
@ -38,33 +36,25 @@ class PrescriptionViewModel extends BaseViewModel {
List<dynamic> get itemMedicineList => _prescriptionService.itemMedicineList;
PrescriptionsService _prescriptionsService = locator<PrescriptionsService>();
List<PrescriptionsList> _prescriptionsOrderListClinic = List();
List<PrescriptionsList> _prescriptionsOrderListHospital = List();
List<PrescriptionsList> _prescriptionsOrderListClinic = [];
List<PrescriptionsList> _prescriptionsOrderListHospital = [];
List<PrescriptionReport> get prescriptionReportList =>
_prescriptionsService.prescriptionReportList;
List<PrescriptionReport> get prescriptionReportList => _prescriptionsService.prescriptionReportList;
List<Prescriptions> get prescriptionsList =>
_prescriptionsService.prescriptionsList;
List<Prescriptions> get prescriptionsList => _prescriptionsService.prescriptionsList;
List<PharmacyPrescriptions> get pharmacyPrescriptionsList =>
_prescriptionsService.pharmacyPrescriptionsList;
List<PrescriptionReportEnh> get prescriptionReportEnhList =>
_prescriptionsService.prescriptionReportEnhList;
List<PharmacyPrescriptions> get pharmacyPrescriptionsList => _prescriptionsService.pharmacyPrescriptionsList;
List<PrescriptionReportEnh> get prescriptionReportEnhList => _prescriptionsService.prescriptionReportEnhList;
List<PrescriptionsList> get prescriptionsOrderList =>
filterType == FilterType.Clinic
? _prescriptionsOrderListClinic
: _prescriptionsOrderListHospital;
filterType == FilterType.Clinic ? _prescriptionsOrderListClinic : _prescriptionsOrderListHospital;
List<PrescriotionInPatient> get inPatientPrescription =>
_prescriptionsService.prescriptionInPatientList;
List<PrescriotionInPatient> get inPatientPrescription => _prescriptionsService.prescriptionInPatientList;
getPrescriptionsInPatient(PatiantInformtion patient) async {
setState(ViewState.Busy);
error = "";
await _prescriptionsService.getPrescriptionInPatient(
mrn: patient.patientId, adn: patient.admissionNo);
await _prescriptionsService.getPrescriptionInPatient(mrn: patient.patientId, adn: patient.admissionNo);
if (_prescriptionsService.hasError) {
error = "No Prescription Found";
setState(ViewState.Error);
@ -76,38 +66,37 @@ class PrescriptionViewModel extends BaseViewModel {
}
}
Future getItem({int itemID}) async {
Future getItem({int? itemID}) async {
hasError = false;
//_insuranceCardService.clearInsuranceCard();
setState(ViewState.BusyLocal);
await _prescriptionService.getItem(itemID: itemID);
if (_prescriptionService.hasError) {
error = _prescriptionService.error;
error = _prescriptionService.error!;
setState(ViewState.ErrorLocal);
} else
setState(ViewState.Idle);
}
Future getPrescription({int mrn}) async {
Future getPrescription({int? mrn}) async {
hasError = false;
//_insuranceCardService.clearInsuranceCard();
setState(ViewState.Busy);
await _prescriptionService.getPrescription(mrn: mrn);
if (_prescriptionService.hasError) {
error = _prescriptionService.error;
error = _prescriptionService.error!;
setState(ViewState.ErrorLocal);
} else
setState(ViewState.Idle);
}
Future postPrescription(
PostPrescriptionReqModel postProcedureReqModel, int mrn) async {
Future postPrescription(PostPrescriptionReqModel postProcedureReqModel, int mrn) async {
hasError = false;
//_insuranceCardService.clearInsuranceCard();
setState(ViewState.Busy);
await _prescriptionService.postPrescription(postProcedureReqModel);
if (_prescriptionService.hasError) {
error = _prescriptionService.error;
error = _prescriptionService.error!;
setState(ViewState.ErrorLocal);
} else {
await getPrescription(mrn: mrn);
@ -115,24 +104,23 @@ class PrescriptionViewModel extends BaseViewModel {
}
}
Future getMedicationList({String drug}) async {
Future getMedicationList({String? drug}) async {
setState(ViewState.Busy);
await _prescriptionService.getMedicationList(drug: drug);
await _prescriptionService.getMedicationList(drug: drug!);
if (_prescriptionService.hasError) {
error = _prescriptionService.error;
error = _prescriptionService.error!;
setState(ViewState.Error);
} else
setState(ViewState.Idle);
}
Future updatePrescription(
PostPrescriptionReqModel updatePrescriptionReqModel, int mrn) async {
Future updatePrescription(PostPrescriptionReqModel updatePrescriptionReqModel, int mrn) async {
hasError = false;
//_insuranceCardService.clearInsuranceCard();
setState(ViewState.Busy);
await _prescriptionService.updatePrescription(updatePrescriptionReqModel);
if (_prescriptionService.hasError) {
error = _prescriptionService.error;
error = _prescriptionService.error!;
setState(ViewState.ErrorLocal);
} else {
await getPrescription(mrn: mrn);
@ -140,30 +128,25 @@ class PrescriptionViewModel extends BaseViewModel {
}
}
Future getDrugs({String drugName}) async {
Future getDrugs({String? drugName}) async {
hasError = false;
//_insuranceCardService.clearInsuranceCard();
setState(ViewState.BusyLocal);
await _prescriptionService.getDrugs(drugName: drugName);
if (_prescriptionService.hasError) {
error = _prescriptionService.error;
error = _prescriptionService.error!;
setState(ViewState.ErrorLocal);
} else
setState(ViewState.Idle);
}
Future getDrugToDrug(
VitalSignData vital,
List<GetAssessmentResModel> lstAssessments,
List<GetAllergiesResModel> allergy,
PatiantInformtion patient,
List<dynamic> prescription) async {
Future getDrugToDrug(VitalSignData vital, List<GetAssessmentResModel> lstAssessments,
List<GetAllergiesResModel> allergy, PatiantInformtion patient, List<dynamic> prescription) async {
hasError = false;
setState(ViewState.Busy);
await _prescriptionService.getDrugToDrug(
vital, lstAssessments, allergy, patient, prescription);
await _prescriptionService.getDrugToDrug(vital, lstAssessments, allergy, patient, prescription);
if (_prescriptionService.hasError) {
error = _prescriptionService.error;
error = _prescriptionService.error!;
setState(ViewState.ErrorLocal);
} else
setState(ViewState.Idle);
@ -174,27 +157,22 @@ class PrescriptionViewModel extends BaseViewModel {
notifyListeners();
}
getPrescriptionReport(
{Prescriptions prescriptions,
@required PatiantInformtion patient}) async {
getPrescriptionReport({Prescriptions? prescriptions, @required PatiantInformtion? patient}) async {
setState(ViewState.Busy);
await _prescriptionsService.getPrescriptionReport(
prescriptions: prescriptions, patient: patient);
await _prescriptionsService.getPrescriptionReport(prescriptions: prescriptions, patient: patient);
if (_prescriptionsService.hasError) {
error = _prescriptionsService.error;
error = _prescriptionsService.error!;
setState(ViewState.ErrorLocal);
} else {
setState(ViewState.Idle);
}
}
getListPharmacyForPrescriptions(
{int itemId, @required PatiantInformtion patient}) async {
getListPharmacyForPrescriptions({int? itemId, @required PatiantInformtion? patient}) async {
setState(ViewState.Busy);
await _prescriptionsService.getListPharmacyForPrescriptions(
itemId: itemId, patient: patient);
await _prescriptionsService.getListPharmacyForPrescriptions(itemId: itemId, patient: patient);
if (_prescriptionsService.hasError) {
error = _prescriptionsService.error;
error = _prescriptionsService.error!;
setState(ViewState.Error);
} else {
setState(ViewState.Idle);
@ -204,50 +182,41 @@ class PrescriptionViewModel extends BaseViewModel {
void _filterList() {
_prescriptionsService.prescriptionsList.forEach((element) {
/// PrescriptionsList list sort clinic
List<PrescriptionsList> prescriptionsByClinic =
_prescriptionsOrderListClinic
.where((elementClinic) =>
elementClinic.filterName == element.clinicDescription)
.toList();
List<PrescriptionsList> prescriptionsByClinic = _prescriptionsOrderListClinic
.where((elementClinic) => elementClinic.filterName == element.clinicDescription)
.toList();
if (prescriptionsByClinic.length != 0) {
_prescriptionsOrderListClinic[
_prescriptionsOrderListClinic.indexOf(prescriptionsByClinic[0])]
_prescriptionsOrderListClinic[_prescriptionsOrderListClinic.indexOf(prescriptionsByClinic[0])]
.prescriptionsList
.add(element);
} else {
_prescriptionsOrderListClinic.add(PrescriptionsList(
filterName: element.clinicDescription, prescriptions: element));
_prescriptionsOrderListClinic
.add(PrescriptionsList(filterName: element.clinicDescription, prescriptions: element));
}
/// PrescriptionsList list sort via hospital
List<PrescriptionsList> prescriptionsByHospital =
_prescriptionsOrderListHospital
.where(
(elementClinic) => elementClinic.filterName == element.name,
)
.toList();
List<PrescriptionsList> prescriptionsByHospital = _prescriptionsOrderListHospital
.where(
(elementClinic) => elementClinic.filterName == element.name,
)
.toList();
if (prescriptionsByHospital.length != 0) {
_prescriptionsOrderListHospital[_prescriptionsOrderListHospital
.indexOf(prescriptionsByHospital[0])]
_prescriptionsOrderListHospital[_prescriptionsOrderListHospital.indexOf(prescriptionsByHospital[0])]
.prescriptionsList
.add(element);
} else {
_prescriptionsOrderListHospital.add(PrescriptionsList(
filterName: element.name, prescriptions: element));
_prescriptionsOrderListHospital.add(PrescriptionsList(filterName: element.name, prescriptions: element));
}
});
}
getPrescriptionReportEnh(
{PrescriptionsOrder prescriptionsOrder,
@required PatiantInformtion patient}) async {
getPrescriptionReportEnh({PrescriptionsOrder? prescriptionsOrder, @required PatiantInformtion? patient}) async {
setState(ViewState.Busy);
await _prescriptionsService.getPrescriptionReportEnh(
prescriptionsOrder: prescriptionsOrder, patient: patient);
await _prescriptionsService.getPrescriptionReportEnh(prescriptionsOrder: prescriptionsOrder, patient: patient);
if (_prescriptionsService.hasError) {
error = _prescriptionsService.error;
error = _prescriptionsService.error!;
setState(ViewState.Error);
} else {
setState(ViewState.Idle);
@ -257,18 +226,18 @@ class PrescriptionViewModel extends BaseViewModel {
_getPrescriptionsOrders() async {
await _prescriptionsService.getPrescriptionsOrders();
if (_prescriptionsService.hasError) {
error = _prescriptionsService.error;
error = _prescriptionsService.error!;
setState(ViewState.ErrorLocal);
} else {
setState(ViewState.Idle);
}
}
getPrescriptions(PatiantInformtion patient, {String patientType}) async {
getPrescriptions(PatiantInformtion patient, {String? patientType}) async {
setState(ViewState.Busy);
await _prescriptionsService.getPrescriptions(patient);
if (_prescriptionsService.hasError) {
error = _prescriptionsService.error;
error = _prescriptionsService.error!;
if (patientType == "7")
setState(ViewState.ErrorLocal);
else

@ -16,30 +16,24 @@ class PrescriptionsViewModel extends BaseViewModel {
FilterType filterType = FilterType.Clinic;
PrescriptionsService _prescriptionsService = locator<PrescriptionsService>();
List<PrescriptionsList> _prescriptionsOrderListClinic = List();
List<PrescriptionsList> _prescriptionsOrderListHospital = List();
List<PrescriptionsList> _prescriptionsOrderListClinic = [];
List<PrescriptionsList> _prescriptionsOrderListHospital = [];
List<PrescriptionReport> get prescriptionReportList =>
_prescriptionsService.prescriptionReportList;
List<PrescriptionReport> get prescriptionReportList => _prescriptionsService.prescriptionReportList;
List<Prescriptions> get prescriptionsList =>
_prescriptionsService.prescriptionsList;
List<Prescriptions> get prescriptionsList => _prescriptionsService.prescriptionsList;
List<PharmacyPrescriptions> get pharmacyPrescriptionsList =>
_prescriptionsService.pharmacyPrescriptionsList;
List<PrescriptionReportEnh> get prescriptionReportEnhList =>
_prescriptionsService.prescriptionReportEnhList;
List<PharmacyPrescriptions> get pharmacyPrescriptionsList => _prescriptionsService.pharmacyPrescriptionsList;
List<PrescriptionReportEnh> get prescriptionReportEnhList => _prescriptionsService.prescriptionReportEnhList;
List<PrescriptionsList> get prescriptionsOrderList =>
filterType == FilterType.Clinic
? _prescriptionsOrderListClinic
: _prescriptionsOrderListHospital;
filterType == FilterType.Clinic ? _prescriptionsOrderListClinic : _prescriptionsOrderListHospital;
getPrescriptions(PatiantInformtion patient) async {
setState(ViewState.Busy);
await _prescriptionsService.getPrescriptions(patient);
if (_prescriptionsService.hasError) {
error = _prescriptionsService.error;
error = _prescriptionsService.error!;
setState(ViewState.Error);
} else {
_filterList();
@ -52,7 +46,7 @@ class PrescriptionsViewModel extends BaseViewModel {
_getPrescriptionsOrders() async {
await _prescriptionsService.getPrescriptionsOrders();
if (_prescriptionsService.hasError) {
error = _prescriptionsService.error;
error = _prescriptionsService.error!;
setState(ViewState.ErrorLocal);
} else {
setState(ViewState.Idle);
@ -62,38 +56,32 @@ class PrescriptionsViewModel extends BaseViewModel {
void _filterList() {
_prescriptionsService.prescriptionsList.forEach((element) {
/// PrescriptionsList list sort clinic
List<PrescriptionsList> prescriptionsByClinic =
_prescriptionsOrderListClinic
.where((elementClinic) =>
elementClinic.filterName == element.clinicDescription)
.toList();
List<PrescriptionsList> prescriptionsByClinic = _prescriptionsOrderListClinic
.where((elementClinic) => elementClinic.filterName == element.clinicDescription)
.toList();
if (prescriptionsByClinic.length != 0) {
_prescriptionsOrderListClinic[
_prescriptionsOrderListClinic.indexOf(prescriptionsByClinic[0])]
_prescriptionsOrderListClinic[_prescriptionsOrderListClinic.indexOf(prescriptionsByClinic[0])]
.prescriptionsList
.add(element);
} else {
_prescriptionsOrderListClinic.add(PrescriptionsList(
filterName: element.clinicDescription, prescriptions: element));
_prescriptionsOrderListClinic
.add(PrescriptionsList(filterName: element.clinicDescription, prescriptions: element));
}
/// PrescriptionsList list sort via hospital
List<PrescriptionsList> prescriptionsByHospital =
_prescriptionsOrderListHospital
.where(
(elementClinic) => elementClinic.filterName == element.name,
)
.toList();
List<PrescriptionsList> prescriptionsByHospital = _prescriptionsOrderListHospital
.where(
(elementClinic) => elementClinic.filterName == element.name,
)
.toList();
if (prescriptionsByHospital.length != 0) {
_prescriptionsOrderListHospital[_prescriptionsOrderListHospital
.indexOf(prescriptionsByHospital[0])]
_prescriptionsOrderListHospital[_prescriptionsOrderListHospital.indexOf(prescriptionsByHospital[0])]
.prescriptionsList
.add(element);
} else {
_prescriptionsOrderListHospital.add(PrescriptionsList(
filterName: element.name, prescriptions: element));
_prescriptionsOrderListHospital.add(PrescriptionsList(filterName: element.name, prescriptions: element));
}
});
}
@ -103,41 +91,33 @@ class PrescriptionsViewModel extends BaseViewModel {
notifyListeners();
}
getPrescriptionReport(
{Prescriptions prescriptions,
@required PatiantInformtion patient}) async {
getPrescriptionReport({Prescriptions? prescriptions, @required PatiantInformtion? patient}) async {
setState(ViewState.Busy);
await _prescriptionsService.getPrescriptionReport(
prescriptions: prescriptions, patient: patient);
await _prescriptionsService.getPrescriptionReport(prescriptions: prescriptions, patient: patient);
if (_prescriptionsService.hasError) {
error = _prescriptionsService.error;
error = _prescriptionsService.error!;
setState(ViewState.ErrorLocal);
} else {
setState(ViewState.Idle);
}
}
getListPharmacyForPrescriptions(
{int itemId, @required PatiantInformtion patient}) async {
getListPharmacyForPrescriptions({int? itemId, @required PatiantInformtion? patient}) async {
setState(ViewState.Busy);
await _prescriptionsService.getListPharmacyForPrescriptions(
itemId: itemId, patient: patient);
await _prescriptionsService.getListPharmacyForPrescriptions(itemId: itemId, patient: patient);
if (_prescriptionsService.hasError) {
error = _prescriptionsService.error;
error = _prescriptionsService.error!;
setState(ViewState.Error);
} else {
setState(ViewState.Idle);
}
}
getPrescriptionReportEnh(
{PrescriptionsOrder prescriptionsOrder,
@required PatiantInformtion patient}) async {
getPrescriptionReportEnh({PrescriptionsOrder? prescriptionsOrder, @required PatiantInformtion? patient}) async {
setState(ViewState.Busy);
await _prescriptionsService.getPrescriptionReportEnh(
prescriptionsOrder: prescriptionsOrder, patient: patient);
await _prescriptionsService.getPrescriptionReportEnh(prescriptionsOrder: prescriptionsOrder, patient: patient);
if (_prescriptionsService.hasError) {
error = _prescriptionsService.error;
error = _prescriptionsService.error!;
setState(ViewState.Error);
} else {
setState(ViewState.Idle);

@ -37,8 +37,8 @@ class ProcedureViewModel extends BaseViewModel {
List<dynamic> get categoryList => _procedureService.categoryList;
RadiologyService _radiologyService = locator<RadiologyService>();
LabsService _labsService = locator<LabsService>();
List<FinalRadiologyList> _finalRadiologyListClinic = List();
List<FinalRadiologyList> _finalRadiologyListHospital = List();
List<FinalRadiologyList> _finalRadiologyListClinic = [];
List<FinalRadiologyList> _finalRadiologyListHospital = [];
List<FinalRadiologyList> get finalRadiologyList =>
filterType == FilterType.Clinic ? _finalRadiologyListClinic : _finalRadiologyListHospital;
@ -50,14 +50,14 @@ class ProcedureViewModel extends BaseViewModel {
List<LabOrderResult> get labOrdersResultsList => _labsService.labOrdersResultsList;
List<ProcedureTempleteDetailsModel> get procedureTemplate => _procedureService.templateList;
List<ProcedureTempleteDetailsModelList> templateList = List();
List<ProcedureTempleteDetailsModelList> templateList = [];
List<ProcedureTempleteDetailsModel> get procedureTemplateDetails => _procedureService.templateDetailsList;
List<PatientLabOrdersList> _patientLabOrdersListClinic = List();
List<PatientLabOrdersList> _patientLabOrdersListHospital = List();
List<PatientLabOrdersList> _patientLabOrdersListClinic = [];
List<PatientLabOrdersList> _patientLabOrdersListHospital = [];
Future getProcedure({int mrn, String patientType}) async {
Future getProcedure({int? mrn, String? patientType}) async {
hasError = false;
await getDoctorProfile();
@ -65,7 +65,7 @@ class ProcedureViewModel extends BaseViewModel {
setState(ViewState.Busy);
await _procedureService.getProcedure(mrn: mrn);
if (_procedureService.hasError) {
error = _procedureService.error;
error = _procedureService.error!;
if (patientType == "7")
setState(ViewState.ErrorLocal);
else
@ -74,13 +74,13 @@ class ProcedureViewModel extends BaseViewModel {
setState(ViewState.Idle);
}
Future getProcedureCategory({String categoryName, String categoryID, patientId}) async {
Future getProcedureCategory({String? categoryName, String? categoryID, patientId}) async {
hasError = false;
setState(ViewState.Busy);
await _procedureService.getProcedureCategory(
categoryName: categoryName, categoryID: categoryID, patientId: patientId);
if (_procedureService.hasError) {
error = _procedureService.error;
error = _procedureService.error!;
setState(ViewState.ErrorLocal);
} else
setState(ViewState.Idle);
@ -92,18 +92,18 @@ class ProcedureViewModel extends BaseViewModel {
setState(ViewState.Busy);
await _procedureService.getCategory();
if (_procedureService.hasError) {
error = _procedureService.error;
error = _procedureService.error!;
setState(ViewState.ErrorLocal);
} else
setState(ViewState.Idle);
}
Future getProcedureTemplate({String categoryID}) async {
Future getProcedureTemplate({String? categoryID}) async {
hasError = false;
setState(ViewState.Busy);
await _procedureService.getProcedureTemplate(categoryID: categoryID);
if (_procedureService.hasError) {
error = _procedureService.error;
error = _procedureService.error!;
setState(ViewState.ErrorLocal);
} else {
setTemplateListDependOnId();
@ -129,14 +129,14 @@ class ProcedureViewModel extends BaseViewModel {
int tempId = 0;
Future getProcedureTemplateDetails({int templateId}) async {
tempId = templateId;
Future getProcedureTemplateDetails({int? templateId}) async {
tempId = templateId!;
hasError = false;
//_insuranceCardService.clearInsuranceCard();
setState(ViewState.BusyLocal);
await _procedureService.getProcedureTemplateDetails(templateId: templateId);
if (_procedureService.hasError) {
error = _procedureService.error;
error = _procedureService.error!;
setState(ViewState.ErrorLocal);
} else
setState(ViewState.Idle);
@ -148,7 +148,7 @@ class ProcedureViewModel extends BaseViewModel {
setState(ViewState.Busy);
await _procedureService.postProcedure(postProcedureReqModel);
if (_procedureService.hasError) {
error = _procedureService.error;
error = _procedureService.error!;
setState(ViewState.ErrorLocal);
} else {
await getProcedure(mrn: mrn);
@ -162,31 +162,31 @@ class ProcedureViewModel extends BaseViewModel {
setState(ViewState.Busy);
await _procedureService.valadteProcedure(procedureValadteRequestModel);
if (_procedureService.hasError) {
error = _procedureService.error;
error = _procedureService.error!;
setState(ViewState.ErrorLocal);
} else {
setState(ViewState.Idle);
}
}
Future updateProcedure({UpdateProcedureRequestModel updateProcedureRequestModel, int mrn}) async {
Future updateProcedure({UpdateProcedureRequestModel? updateProcedureRequestModel, int? mrn}) async {
hasError = false;
//_insuranceCardService.clearInsuranceCard();
setState(ViewState.Busy);
await _procedureService.updateProcedure(updateProcedureRequestModel);
await _procedureService.updateProcedure(updateProcedureRequestModel!);
if (_procedureService.hasError) {
error = _procedureService.error;
error = _procedureService.error!;
setState(ViewState.ErrorLocal);
} else
setState(ViewState.Idle);
//await getProcedure(mrn: mrn);
}
void getPatientRadOrders(PatiantInformtion patient, {String patientType, bool isInPatient = false}) async {
void getPatientRadOrders(PatiantInformtion patient, {String? patientType, bool isInPatient = false}) async {
setState(ViewState.Busy);
await _radiologyService.getPatientRadOrders(patient, isInPatient: isInPatient);
if (_radiologyService.hasError) {
error = _radiologyService.error;
error = _radiologyService.error!;
if (patientType == "7")
setState(ViewState.ErrorLocal);
else
@ -228,12 +228,12 @@ class ProcedureViewModel extends BaseViewModel {
String get radImageURL => _radiologyService.url;
getRadImageURL({int invoiceNo, int lineItem, int projectId, @required PatiantInformtion patient}) async {
getRadImageURL({int? invoiceNo, int? lineItem, int? projectId, @required PatiantInformtion? patient}) async {
setState(ViewState.Busy);
await _radiologyService.getRadImageURL(
invoiceNo: invoiceNo, lineItem: lineItem, projectId: projectId, patient: patient);
if (_radiologyService.hasError) {
error = _radiologyService.error;
error = _radiologyService.error!;
setState(ViewState.Error);
} else
setState(ViewState.Idle);
@ -248,7 +248,7 @@ class ProcedureViewModel extends BaseViewModel {
List<LabResult> get labResultList => _labsService.labResultList;
List<LabResultList> labResultLists = List();
List<LabResultList> labResultLists = [];
List<LabResultList> get labResultListsCoustom {
return labResultLists;
@ -258,7 +258,7 @@ class ProcedureViewModel extends BaseViewModel {
setState(ViewState.Busy);
await _labsService.getPatientLabOrdersList(patient, isInpatient);
if (_labsService.hasError) {
error = _labsService.error;
error = _labsService.error!;
setState(ViewState.Error);
} else {
setState(ViewState.Idle);
@ -266,30 +266,30 @@ class ProcedureViewModel extends BaseViewModel {
}
getLaboratoryResult(
{String projectID, int clinicID, String invoiceNo, String orderNo, PatiantInformtion patient}) async {
{String? projectID, int? clinicID, String? invoiceNo, String? orderNo, PatiantInformtion? patient}) async {
setState(ViewState.Busy);
await _labsService.getLaboratoryResult(
invoiceNo: invoiceNo, orderNo: orderNo, projectID: projectID, clinicID: clinicID, patient: patient);
if (_labsService.hasError) {
error = _labsService.error;
error = _labsService.error!;
setState(ViewState.Error);
} else {
setState(ViewState.Idle);
}
}
getPatientLabOrdersResults({PatientLabOrders patientLabOrder, String procedure, PatiantInformtion patient}) async {
getPatientLabOrdersResults({PatientLabOrders? patientLabOrder, String? procedure, PatiantInformtion? patient}) async {
setState(ViewState.Busy);
await _labsService.getPatientLabOrdersResults(
patientLabOrder: patientLabOrder, procedure: procedure, patient: patient);
if (_labsService.hasError) {
error = _labsService.error;
error = _labsService.error!;
setState(ViewState.Error);
} else {
bool isShouldClear = false;
if (_labsService.labOrdersResultsList.length == 1) {
labOrdersResultsList.forEach((element) {
if (element.resultValue.contains('/') || element.resultValue.contains('*') || element.resultValue.isEmpty)
if (element.resultValue!.contains('/') || element.resultValue!.contains('*') || element.resultValue!.isEmpty)
isShouldClear = true;
});
}
@ -298,10 +298,10 @@ class ProcedureViewModel extends BaseViewModel {
}
}
sendLabReportEmail({PatientLabOrders patientLabOrder, String mes}) async {
sendLabReportEmail({PatientLabOrders? patientLabOrder, String? mes}) async {
await _labsService.sendLabReportEmail(patientLabOrder: patientLabOrder);
if (_labsService.hasError) {
error = _labsService.error;
error = _labsService.error!;
} else
DrAppToastMsg.showSuccesToast(mes);
}

@ -17,7 +17,7 @@ Helpers helpers = Helpers();
class ProjectViewModel with ChangeNotifier {
DrAppSharedPreferances sharedPref = DrAppSharedPreferances();
Locale _appLocale;
late Locale _appLocale;
String currentLanguage = 'ar';
bool _isArabic = false;
bool isInternetConnection = true;
@ -30,13 +30,11 @@ class ProjectViewModel with ChangeNotifier {
Locale get appLocal => _appLocale;
bool get isArabic => _isArabic;
StreamSubscription subscription;
late StreamSubscription subscription;
ProjectViewModel() {
loadSharedPrefLanguage();
subscription = Connectivity()
.onConnectivityChanged
.listen((ConnectivityResult result) {
subscription = Connectivity().onConnectivityChanged.listen((ConnectivityResult result) {
switch (result) {
case ConnectivityResult.wifi:
isInternetConnection = true;
@ -94,8 +92,7 @@ class ProjectViewModel with ChangeNotifier {
try {
dynamic localRes;
await baseAppClient.post(GET_CLINICS_FOR_DOCTOR,
onSuccess: (dynamic response, int statusCode) {
await baseAppClient.post(GET_CLINICS_FOR_DOCTOR, onSuccess: (dynamic response, int statusCode) {
doctorClinicsList = [];
response['List_DoctorsClinic'].forEach((v) {
doctorClinicsList.add(new ClinicModel.fromJson(v));
@ -115,7 +112,11 @@ class ProjectViewModel with ChangeNotifier {
void getProfile() async {
Map profile = await sharedPref.getObj(DOCTOR_PROFILE);
DoctorProfileModel doctorProfile = new DoctorProfileModel.fromJson(profile);
ClinicModel clinicModel = ClinicModel(doctorID:doctorProfile.doctorID,clinicID: doctorProfile.clinicID, projectID: doctorProfile.projectID,);
ClinicModel clinicModel = ClinicModel(
doctorID: doctorProfile.doctorID,
clinicID: doctorProfile.clinicID,
projectID: doctorProfile.projectID,
);
await Provider.of<AuthenticationViewModel>(AppGlobal.CONTEX, listen: false)
.getDoctorProfileBasedOnClinic(clinicModel);

@ -12,57 +12,46 @@ class RadiologyViewModel extends BaseViewModel {
FilterType filterType = FilterType.Clinic;
RadiologyService _radiologyService = locator<RadiologyService>();
List<FinalRadiologyList> _finalRadiologyListClinic = List();
List<FinalRadiologyList> _finalRadiologyListHospital = List();
List<FinalRadiologyList> _finalRadiologyListClinic = [];
List<FinalRadiologyList> _finalRadiologyListHospital = [];
List<FinalRadiologyList> get finalRadiologyList =>
filterType == FilterType.Clinic
? _finalRadiologyListClinic
: _finalRadiologyListHospital;
filterType == FilterType.Clinic ? _finalRadiologyListClinic : _finalRadiologyListHospital;
void getPatientRadOrders(PatiantInformtion patient,
{isInPatient = false}) async {
void getPatientRadOrders(PatiantInformtion patient, {isInPatient = false}) async {
setState(ViewState.Busy);
await _radiologyService.getPatientRadOrders(patient,
isInPatient: isInPatient);
await _radiologyService.getPatientRadOrders(patient, isInPatient: isInPatient);
if (_radiologyService.hasError) {
error = _radiologyService.error;
error = _radiologyService.error!;
setState(ViewState.Error);
} else {
_radiologyService.finalRadiologyList.forEach((element) {
List<FinalRadiologyList> finalRadiologyListClinic =
_finalRadiologyListClinic
.where((elementClinic) =>
elementClinic.filterName == element.clinicDescription)
.toList();
List<FinalRadiologyList> finalRadiologyListClinic = _finalRadiologyListClinic
.where((elementClinic) => elementClinic.filterName == element.clinicDescription)
.toList();
if (finalRadiologyListClinic.length != 0) {
_finalRadiologyListClinic[
finalRadiologyListClinic.indexOf(finalRadiologyListClinic[0])]
_finalRadiologyListClinic[finalRadiologyListClinic.indexOf(finalRadiologyListClinic[0])]
.finalRadiologyList
.add(element);
} else {
_finalRadiologyListClinic.add(FinalRadiologyList(
filterName: element.clinicDescription, finalRadiology: element));
_finalRadiologyListClinic
.add(FinalRadiologyList(filterName: element.clinicDescription, finalRadiology: element));
}
// FinalRadiologyList list sort via project
List<FinalRadiologyList> finalRadiologyListHospital =
_finalRadiologyListHospital
.where(
(elementClinic) =>
elementClinic.filterName == element.projectName,
)
.toList();
List<FinalRadiologyList> finalRadiologyListHospital = _finalRadiologyListHospital
.where(
(elementClinic) => elementClinic.filterName == element.projectName,
)
.toList();
if (finalRadiologyListHospital.length != 0) {
_finalRadiologyListHospital[finalRadiologyListHospital
.indexOf(finalRadiologyListHospital[0])]
_finalRadiologyListHospital[finalRadiologyListHospital.indexOf(finalRadiologyListHospital[0])]
.finalRadiologyList
.add(element);
} else {
_finalRadiologyListHospital.add(FinalRadiologyList(
filterName: element.projectName, finalRadiology: element));
_finalRadiologyListHospital.add(FinalRadiologyList(filterName: element.projectName, finalRadiology: element));
}
});
@ -72,19 +61,12 @@ class RadiologyViewModel extends BaseViewModel {
String get radImageURL => _radiologyService.url;
getRadImageURL(
{int invoiceNo,
int lineItem,
int projectId,
@required PatiantInformtion patient}) async {
getRadImageURL({int? invoiceNo, int? lineItem, int? projectId, @required PatiantInformtion? patient}) async {
setState(ViewState.Busy);
await _radiologyService.getRadImageURL(
invoiceNo: invoiceNo,
lineItem: lineItem,
projectId: projectId,
patient: patient);
invoiceNo: invoiceNo, lineItem: lineItem, projectId: projectId, patient: patient);
if (_radiologyService.hasError) {
error = _radiologyService.error;
error = _radiologyService.error!;
setState(ViewState.Error);
} else
setState(ViewState.Idle);

@ -6,28 +6,25 @@ import '../../locator.dart';
import 'base_view_model.dart';
class ReferralPatientViewModel extends BaseViewModel {
ReferralPatientService _referralPatientService =
locator<ReferralPatientService>();
ReferralPatientService _referralPatientService = locator<ReferralPatientService>();
List<MyReferralPatientModel> get listMyReferralPatientModel =>
_referralPatientService.listMyReferralPatientModel;
List<MyReferralPatientModel> get listMyReferralPatientModel => _referralPatientService.listMyReferralPatientModel;
Future getMyReferralPatient() async {
setState(ViewState.Busy);
await _referralPatientService.getMyReferralPatient();
if (_referralPatientService.hasError) {
error = _referralPatientService.error;
error = _referralPatientService.error!;
setState(ViewState.Error);
} else
setState(ViewState.Idle);
}
Future replay(
String referredDoctorRemarks, MyReferralPatientModel model) async {
Future replay(String referredDoctorRemarks, MyReferralPatientModel model) async {
setState(ViewState.BusyLocal);
await _referralPatientService.replay(referredDoctorRemarks, model);
if (_referralPatientService.hasError) {
error = _referralPatientService.error;
error = _referralPatientService.error!;
setState(ViewState.ErrorLocal);
} else
setState(ViewState.Idle);

@ -6,17 +6,15 @@ import '../../locator.dart';
import 'base_view_model.dart';
class ReferredPatientViewModel extends BaseViewModel {
ReferredPatientService _referralPatientService =
locator<ReferredPatientService>();
ReferredPatientService _referralPatientService = locator<ReferredPatientService>();
List<MyReferredPatientModel> get listMyReferredPatientModel =>
_referralPatientService.listMyReferredPatientModel;
List<MyReferredPatientModel> get listMyReferredPatientModel => _referralPatientService.listMyReferredPatientModel;
Future getMyReferredPatient() async {
setState(ViewState.Busy);
await _referralPatientService.getMyReferredPatient();
if (_referralPatientService.hasError) {
error = _referralPatientService.error;
error = _referralPatientService.error!;
setState(ViewState.Error);
} else
setState(ViewState.Idle);

@ -8,14 +8,13 @@ import 'base_view_model.dart';
class ScheduleViewModel extends BaseViewModel {
ScheduleService _scheduleService = locator<ScheduleService>();
List<ListDoctorWorkingHoursTable> get listDoctorWorkingHoursTable =>
_scheduleService.listDoctorWorkingHoursTable;
List<ListDoctorWorkingHoursTable> get listDoctorWorkingHoursTable => _scheduleService.listDoctorWorkingHoursTable;
Future getDoctorSchedule() async {
setState(ViewState.Busy);
await _scheduleService.getDoctorSchedule();
if (_scheduleService.hasError) {
error = _scheduleService.error;
error = _scheduleService.error!;
setState(ViewState.Error);
} else
setState(ViewState.Idle);

@ -21,7 +21,7 @@ class SickLeaveViewModel extends BaseViewModel {
setState(ViewState.Busy);
await _sickLeaveService.addSickLeave(addSickLeaveRequest);
if (_sickLeaveService.hasError) {
error = _sickLeaveService.error;
error = _sickLeaveService.error!;
setState(ViewState.Error);
} else
setState(ViewState.Idle);
@ -31,7 +31,7 @@ class SickLeaveViewModel extends BaseViewModel {
setState(ViewState.Busy);
await _sickLeaveService.extendSickLeave(extendSickLeaveRequest);
if (_sickLeaveService.hasError) {
error = _sickLeaveService.error;
error = _sickLeaveService.error!;
setState(ViewState.Error);
} else
setState(ViewState.Idle);
@ -41,7 +41,7 @@ class SickLeaveViewModel extends BaseViewModel {
setState(ViewState.Busy);
await _sickLeaveService.getStatistics(appoNo, patientMRN);
if (_sickLeaveService.hasError) {
error = _sickLeaveService.error;
error = _sickLeaveService.error!;
setState(ViewState.Error);
} else
setState(ViewState.Idle);
@ -51,7 +51,7 @@ class SickLeaveViewModel extends BaseViewModel {
setState(ViewState.Busy);
await _sickLeaveService.getSickLeave(patientMRN);
if (_sickLeaveService.hasError) {
error = _sickLeaveService.error;
error = _sickLeaveService.error!;
setState(ViewState.Error);
} else
setState(ViewState.Idle);
@ -61,7 +61,7 @@ class SickLeaveViewModel extends BaseViewModel {
setState(ViewState.Busy);
await _sickLeaveService.getSickLeavePatient(patientMRN);
if (_sickLeaveService.hasError) {
error = _sickLeaveService.error;
error = _sickLeaveService.error!;
setState(ViewState.ErrorLocal);
} else
setState(ViewState.Idle);
@ -71,7 +71,7 @@ class SickLeaveViewModel extends BaseViewModel {
setState(ViewState.Busy);
await _sickLeaveService.getRescheduleLeave();
if (_sickLeaveService.hasError) {
error = _sickLeaveService.error;
error = _sickLeaveService.error!;
setState(ViewState.Error);
} else
setState(ViewState.Idle);
@ -81,7 +81,7 @@ class SickLeaveViewModel extends BaseViewModel {
setState(ViewState.Busy);
await _sickLeaveService.getOffTime();
if (_sickLeaveService.hasError) {
error = _sickLeaveService.error;
error = _sickLeaveService.error!;
setState(ViewState.Error);
} else
setState(ViewState.Idle);
@ -91,7 +91,7 @@ class SickLeaveViewModel extends BaseViewModel {
setState(ViewState.Busy);
await _sickLeaveService.getReasonsByID(id: id);
if (_sickLeaveService.hasError) {
error = _sickLeaveService.error;
error = _sickLeaveService.error!;
setState(ViewState.Error);
} else
setState(ViewState.Idle);
@ -101,8 +101,8 @@ class SickLeaveViewModel extends BaseViewModel {
//setState(ViewState.Busy);
await _sickLeaveService.getCoveringDoctors();
if (_sickLeaveService.hasError) {
error = _sickLeaveService.error;
// setState(ViewState.Error);
error = _sickLeaveService.error!;
// setState(ViewState.Error);
}
//else
// setState(ViewState.Idle);
@ -113,7 +113,7 @@ class SickLeaveViewModel extends BaseViewModel {
await _sickLeaveService.addReschedule(request);
if (_sickLeaveService.hasError) {
error = _sickLeaveService.error;
error = _sickLeaveService.error!;
setState(ViewState.Error);
} else
setState(ViewState.Idle);
@ -123,7 +123,7 @@ class SickLeaveViewModel extends BaseViewModel {
setState(ViewState.Busy);
await _sickLeaveService.updateReschedule(request);
if (_sickLeaveService.hasError) {
error = _sickLeaveService.error;
error = _sickLeaveService.error!;
setState(ViewState.Error);
} else
setState(ViewState.Idle);

@ -5,7 +5,6 @@ import 'package:doctor_app_flutter/screens/qr_reader/QR_reader_screen.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/shared/app_drawer_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/bottom_nav_bar.dart';
import 'package:doctor_app_flutter/widgets/shared/user-guid/app_showcase_widget.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
@ -16,7 +15,7 @@ class LandingPage extends StatefulWidget {
class _LandingPageState extends State<LandingPage> {
int currentTab = 0;
PageController pageController;
late PageController pageController;
_changeCurrentTab(int tab) {
setState(() {
@ -39,14 +38,11 @@ class _LandingPageState extends State<LandingPage> {
elevation: 0,
backgroundColor: Colors.grey[100],
//textTheme: TextTheme(headline6: TextStyle(color: Colors.white)),
title: currentTab != 0
? Text(getText(currentTab).toUpperCase())
: SizedBox(),
title: currentTab != 0 ? Text(getText(currentTab).toUpperCase()) : SizedBox(),
leading: Builder(
builder: (BuildContext context) {
return IconButton(
icon: Image.asset('assets/images/menu.png',
height: 50, width: 50),
icon: Image.asset('assets/images/menu.png', height: 50, width: 50),
iconSize: 15,
color: Colors.black,
onPressed: () => Scaffold.of(context).openDrawer(),
@ -97,7 +93,7 @@ class MyAppbar extends StatelessWidget with PreferredSizeWidget {
@override
final Size preferredSize;
MyAppbar({Key key})
MyAppbar({Key? key})
: preferredSize = Size.fromHeight(0.0),
super(key: key);
@override

@ -34,7 +34,7 @@ class ListDoctorWorkingHoursTable {
}
class WorkingHours {
String from;
String to;
WorkingHours({required this.from, required this.to});
String? from;
String? to;
WorkingHours({this.from, this.to});
}

@ -26,7 +26,7 @@ class UserModel {
this.isLoginForDoctorApp,
this.patientOutSA});
UserModel.fromJson(Map<String?, dynamic> json) {
UserModel.fromJson(Map<String, dynamic> json) {
userID = json['UserID'];
password = json['Password'];
projectID = json['ProjectID'];

@ -16,14 +16,13 @@ import 'package:provider/provider.dart';
import '../../widgets/shared/app_scaffold_widget.dart';
class LoginScreen extends StatefulWidget {
@override
_LoginScreenState createState() => _LoginScreenState();
}
class _LoginScreenState extends State<LoginScreen> {
String platformImei;
late String platformImei;
bool allowCallApi = true;
//TODO change AppTextFormField to AppTextFormFieldCustom
@ -34,7 +33,7 @@ class _LoginScreenState extends State<LoginScreen> {
List<GetHospitalsResponseModel> projectsList = [];
FocusNode focusPass = FocusNode();
FocusNode focusProject = FocusNode();
AuthenticationViewModel authenticationViewModel;
late AuthenticationViewModel authenticationViewModel;
@override
Widget build(BuildContext context) {
@ -47,170 +46,117 @@ class _LoginScreenState extends State<LoginScreen> {
Container(
margin: EdgeInsetsDirectional.fromSTEB(30, 0, 30, 30),
alignment: Alignment.topLeft,
child: Column(
child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Column(
//TODO Use App Text rather than text
Container(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
//TODO Use App Text rather than text
Container(
child: Column(
crossAxisAlignment: CrossAxisAlignment
.start,
children: <Widget>[
Column(
crossAxisAlignment: CrossAxisAlignment
.start,
children: <Widget>[
SizedBox(
height: 30,
),
],
),
Column(
crossAxisAlignment: CrossAxisAlignment
.start, children: [
SizedBox(
height: 10,
),
Text(
TranslationBase
.of(context)
.welcomeTo,
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight
.w600,
fontFamily: 'Poppins'),
),
Text(
TranslationBase
.of(context)
.drSulaimanAlHabib,
style: TextStyle(
color:Color(0xFF2B353E),
fontWeight: FontWeight
.bold,
fontSize: SizeConfig
.isMobile
? 24
: SizeConfig
.realScreenWidth *
0.029,
fontFamily: 'Poppins'),
),
Text(
"Doctor App",
style: TextStyle(
fontSize:
SizeConfig.isMobile
? 16
: SizeConfig
.realScreenWidth *
0.030,
fontWeight: FontWeight
.w600,
color: Color(0xFFD02127)),
),
]),
],
)),
SizedBox(
height: 40,
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
SizedBox(
height: 30,
),
],
),
Form(
key: loginFormKey,
child: Column(
mainAxisAlignment: MainAxisAlignment
.spaceBetween,
children: <Widget>[
Container(
width: SizeConfig
.realScreenWidth * 0.90,
height: SizeConfig
.realScreenHeight * 0.65,
child:
Column(
crossAxisAlignment: CrossAxisAlignment
.start, children: [
buildSizedBox(),
AppTextFieldCustom(
hintText: TranslationBase.of(context).enterId,
hasBorder: true,
controller: userIdController,
onChanged: (value){
if (value != null)
setState(() {
authenticationViewModel.userInfo
.userID =
value
.trim();
});
},
),
buildSizedBox(),
AppTextFieldCustom(
hintText: TranslationBase.of(context).enterPassword,
hasBorder: true,
isSecure: true,
controller: passwordController,
onChanged: (value){
if (value != null)
setState(() {
authenticationViewModel.userInfo
.password =
value
.trim();
});
// if(allowCallApi) {
this.getProjects(
authenticationViewModel.userInfo
.userID);
// setState(() {
// allowCallApi = false;
// });
// }
},
onClick: (){
},
),
buildSizedBox(),
AppTextFieldCustom(
hintText: TranslationBase.of(context).selectYourProject,
hasBorder: true,
controller: projectIdController,
isTextFieldHasSuffix: true,
enabled: false,
onClick: (){
Helpers
.showCupertinoPicker(
context,
projectsList,
'facilityName',
onSelectProject,
authenticationViewModel);
},
),
buildSizedBox()
]),
),
],
Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
SizedBox(
height: 10,
),
Text(
TranslationBase.of(context).welcomeTo ?? "",
style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, fontFamily: 'Poppins'),
),
Text(
TranslationBase.of(context).drSulaimanAlHabib ?? "",
style: TextStyle(
color: Color(0xFF2B353E),
fontWeight: FontWeight.bold,
fontSize: SizeConfig.isMobile ? 24 : SizeConfig.realScreenWidth * 0.029,
fontFamily: 'Poppins'),
),
)
Text(
"Doctor App",
style: TextStyle(
fontSize: SizeConfig.isMobile ? 16 : SizeConfig.realScreenWidth * 0.030,
fontWeight: FontWeight.w600,
color: Color(0xFFD02127)),
),
]),
],
)),
SizedBox(
height: 40,
),
Form(
key: loginFormKey,
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Container(
width: SizeConfig.realScreenWidth * 0.90,
height: SizeConfig.realScreenHeight * 0.65,
child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
buildSizedBox(),
AppTextFieldCustom(
hintText: TranslationBase.of(context).enterId,
hasBorder: true,
controller: userIdController,
onChanged: (value) {
if (value != null)
setState(() {
authenticationViewModel.userInfo.userID = value.trim();
});
},
),
buildSizedBox(),
AppTextFieldCustom(
hintText: TranslationBase.of(context).enterPassword,
hasBorder: true,
isSecure: true,
controller: passwordController,
onChanged: (value) {
if (value != null)
setState(() {
authenticationViewModel.userInfo.password = value.trim();
});
// if(allowCallApi) {
this.getProjects(authenticationViewModel.userInfo.userID);
// setState(() {
// allowCallApi = false;
// });
// }
},
onClick: () {},
),
buildSizedBox(),
AppTextFieldCustom(
hintText: TranslationBase.of(context).selectYourProject,
hasBorder: true,
controller: projectIdController,
isTextFieldHasSuffix: true,
enabled: false,
onClick: () {
Helpers.showCupertinoPicker(
context, projectsList, 'facilityName', onSelectProject, authenticationViewModel);
},
),
buildSizedBox()
]),
),
],
),
)
]))
],
)
]))
]),
),
bottomSheet: Container(
height: 90,
width: double.infinity,
child: Center(
@ -220,26 +166,23 @@ class _LoginScreenState extends State<LoginScreen> {
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
AppButton(
title: TranslationBase
.of(context)
.login,
title: TranslationBase.of(context).login,
color: Color(0xFFD02127),
fontWeight: FontWeight.w700,
disabled: authenticationViewModel.userInfo
.userID == null ||
authenticationViewModel.userInfo
.password ==
null,
disabled: authenticationViewModel.userInfo.userID == null ||
authenticationViewModel.userInfo.password == null,
onPressed: () {
login(context);
},
),
SizedBox(height: 25,)
SizedBox(
height: 25,
)
],
),
),
),),
),
),
);
}
@ -249,9 +192,11 @@ class _LoginScreenState extends State<LoginScreen> {
);
}
login(context,) async {
if (loginFormKey.currentState.validate()) {
loginFormKey.currentState.save();
login(
context,
) async {
if (loginFormKey.currentState!.validate()) {
loginFormKey.currentState!.save();
GifLoaderDialogUtils.showMyDialog(context);
await authenticationViewModel.login(authenticationViewModel.userInfo);
if (authenticationViewModel.state == ViewState.ErrorLocal) {
@ -259,7 +204,7 @@ class _LoginScreenState extends State<LoginScreen> {
Helpers.showErrorToast(authenticationViewModel.error);
} else {
GifLoaderDialogUtils.hideDialog(context);
authenticationViewModel.setUnverified(true,isFromLogin: true);
authenticationViewModel.setUnverified(true, isFromLogin: true);
// Navigator.of(context).pushReplacement(
// MaterialPageRoute(
// builder: (BuildContext context) =>
@ -276,22 +221,23 @@ class _LoginScreenState extends State<LoginScreen> {
onSelectProject(index) {
setState(() {
authenticationViewModel.userInfo.projectID = projectsList[index].facilityId;
projectIdController.text = projectsList[index].facilityName;
projectIdController.text = projectsList[index].facilityName!;
});
primaryFocus.unfocus();
primaryFocus!.unfocus();
}
String memberID ="";
getProjects(memberID)async {
String memberID = "";
getProjects(memberID) async {
if (memberID != null && memberID != '') {
if (this.memberID !=memberID) {
if (this.memberID != memberID) {
this.memberID = memberID;
await authenticationViewModel.getHospitalsList(memberID);
if(authenticationViewModel.state == ViewState.Idle) {
if (authenticationViewModel.state == ViewState.Idle) {
projectsList = authenticationViewModel.hospitals;
setState(() {
authenticationViewModel.userInfo.projectID = projectsList[0].facilityId;
projectIdController.text = projectsList[0].facilityName;
projectIdController.text = projectsList[0].facilityName!;
});
}
}

@ -33,33 +33,29 @@ DrAppSharedPreferances sharedPref = new DrAppSharedPreferances();
Helpers helpers = Helpers();
class VerificationMethodsScreen extends StatefulWidget {
final password;
VerificationMethodsScreen({this.password, });
VerificationMethodsScreen({
this.password,
});
@override
_VerificationMethodsScreenState createState() => _VerificationMethodsScreenState();
}
class _VerificationMethodsScreenState extends State<VerificationMethodsScreen> {
ProjectViewModel projectsProvider;
late ProjectViewModel projectsProvider;
bool isMoreOption = false;
bool onlySMSBox = false;
AuthMethodTypes fingerPrintBefore;
AuthMethodTypes selectedOption;
AuthenticationViewModel authenticationViewModel;
late AuthMethodTypes fingerPrintBefore;
late AuthMethodTypes selectedOption;
late AuthenticationViewModel authenticationViewModel;
@override
Widget build(BuildContext context) {
projectsProvider = Provider.of<ProjectViewModel>(context);
authenticationViewModel = Provider.of<AuthenticationViewModel>(context);
return AppScaffold(
isShowAppBar: false,
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
@ -78,17 +74,17 @@ class _VerificationMethodsScreenState extends State<VerificationMethodsScreen> {
SizedBox(
height: 80,
),
if(authenticationViewModel.isFromLogin)
InkWell(
onTap: (){
authenticationViewModel.setUnverified(false,isFromLogin: false);
authenticationViewModel.setAppStatus(APP_STATUS.UNAUTHENTICATED);
},
child: Icon(Icons.arrow_back_ios,color: Color(0xFF2B353E),)
),
if (authenticationViewModel.isFromLogin)
InkWell(
onTap: () {
authenticationViewModel.setUnverified(false, isFromLogin: false);
authenticationViewModel.setAppStatus(APP_STATUS.UNAUTHENTICATED);
},
child: Icon(
Icons.arrow_back_ios,
color: Color(0xFF2B353E),
)),
Container(
child: Column(
children: <Widget>[
SizedBox(
@ -96,290 +92,226 @@ class _VerificationMethodsScreenState extends State<VerificationMethodsScreen> {
),
authenticationViewModel.user != null && isMoreOption == false
? Column(
mainAxisAlignment:
MainAxisAlignment.spaceEvenly,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
AppText(
TranslationBase.of(context).welcomeBack,
fontSize:12,
fontWeight: FontWeight.w700,
color: Color(0xFF2B353E),
),
AppText(
Helpers.capitalize(authenticationViewModel.user.doctorName),
fontSize: 24,
color: Color(0xFF2B353E),
fontWeight: FontWeight.bold,
),
SizedBox(
height: 20,
),
AppText(
TranslationBase.of(context).accountInfo ,
fontSize: 16,
color: Color(0xFF2E303A),
fontWeight: FontWeight.w600,
),
SizedBox(
height: 20,
),
Container(
padding: EdgeInsets.all(15),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(
Radius.circular(10),
),
border: Border.all(
color: HexColor('#707070'),
width: 0.1),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Column(
children: [
Text(
TranslationBase.of(context)
.lastLoginAt,
overflow:
TextOverflow.ellipsis,
style: TextStyle(
fontFamily: 'Poppins',
fontSize: 16,
color: Color(0xFF2E303A),
fontWeight: FontWeight.w700,),
AppText(
TranslationBase.of(context).welcomeBack,
fontSize: 12,
fontWeight: FontWeight.w700,
color: Color(0xFF2B353E),
),
AppText(
Helpers.capitalize(authenticationViewModel.user?.doctorName),
fontSize: 24,
color: Color(0xFF2B353E),
fontWeight: FontWeight.bold,
),
SizedBox(
height: 20,
),
AppText(
TranslationBase.of(context).accountInfo,
fontSize: 16,
color: Color(0xFF2E303A),
fontWeight: FontWeight.w600,
),
SizedBox(
height: 20,
),
Container(
padding: EdgeInsets.all(15),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(
Radius.circular(10),
),
border: Border.all(color: HexColor('#707070'), width: 0.1),
),
Row(
children: [
AppText(
TranslationBase
.of(context)
.verifyWith,
fontSize: 14,
color: Color(0xFF575757),
fontWeight: FontWeight.w600,
),
AppText(
authenticationViewModel.getType(
authenticationViewModel.user
.logInTypeID,
context),
fontSize: 14,
color: Color(0xFF2B353E),
fontWeight: FontWeight.w700,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Column(
children: [
Text(
TranslationBase.of(context).lastLoginAt!,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontFamily: 'Poppins',
fontSize: 16,
color: Color(0xFF2E303A),
fontWeight: FontWeight.w700,
),
),
Row(
children: [
AppText(
TranslationBase.of(context).verifyWith,
fontSize: 14,
color: Color(0xFF575757),
fontWeight: FontWeight.w600,
),
AppText(
authenticationViewModel.getType(
authenticationViewModel.user?.logInTypeID, context),
fontSize: 14,
color: Color(0xFF2B353E),
fontWeight: FontWeight.w700,
),
],
)
],
crossAxisAlignment: CrossAxisAlignment.start,
),
Column(
children: [
AppText(
authenticationViewModel.user?.editedOn != null
? AppDateUtils.getDayMonthYearDateFormatted(
AppDateUtils.convertStringToDate(
authenticationViewModel.user!.editedOn ?? ""))
: authenticationViewModel.user?.createdOn != null
? AppDateUtils.getDayMonthYearDateFormatted(
AppDateUtils.convertStringToDate(
authenticationViewModel.user!.createdOn ?? ""))
: '--',
textAlign: TextAlign.right,
fontSize: 13,
color: Color(0xFF2E303A),
fontWeight: FontWeight.w700,
),
AppText(
authenticationViewModel.user?.editedOn != null
? AppDateUtils.getHour(AppDateUtils.convertStringToDate(
authenticationViewModel!.user!.editedOn ?? ""))
: authenticationViewModel.user!.createdOn != null
? AppDateUtils.getHour(AppDateUtils.convertStringToDate(
authenticationViewModel.user!.createdOn ?? ""))
: '--',
textAlign: TextAlign.right,
fontSize: 14,
fontWeight: FontWeight.w600,
color: Color(0xFF575757),
)
],
crossAxisAlignment: CrossAxisAlignment.start,
)
],
)
],
crossAxisAlignment: CrossAxisAlignment.start,),
Column(children: [
AppText(
authenticationViewModel.user.editedOn !=
null
? AppDateUtils.getDayMonthYearDateFormatted(
AppDateUtils.convertStringToDate(
authenticationViewModel.user
.editedOn))
: authenticationViewModel.user.createdOn !=
null
? AppDateUtils.getDayMonthYearDateFormatted(
AppDateUtils.convertStringToDate(authenticationViewModel.user
.createdOn))
: '--',
textAlign:
TextAlign.right,
fontSize: 13,
color: Color(0xFF2E303A),
fontWeight: FontWeight.w700,
),
AppText(
authenticationViewModel.user.editedOn !=
null
? AppDateUtils.getHour(
AppDateUtils.convertStringToDate(
authenticationViewModel.user
.editedOn))
: authenticationViewModel.user.createdOn !=
null
? AppDateUtils.getHour(
AppDateUtils.convertStringToDate(authenticationViewModel.user
.createdOn))
: '--',
textAlign:
TextAlign.right,
fontSize: 14,
fontWeight: FontWeight.w600,
color: Color(0xFF575757),
)
],
crossAxisAlignment: CrossAxisAlignment.start,
),
SizedBox(
height: 20,
),
Row(
children: [
AppText(
"Please Verify",
fontSize: 16,
color: Color(0xFF2B353E),
fontWeight: FontWeight.w700,
),
],
)
],
),
),
SizedBox(
height: 20,
),
Row(
children: [
AppText(
"Please Verify",
fontSize: 16,
color: Color(0xFF2B353E),
fontWeight: FontWeight.w700,
),
],
)
],
)
)
: Column(
mainAxisAlignment:
MainAxisAlignment.spaceEvenly,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
this.onlySMSBox == false
? Container(
margin: EdgeInsets.only(bottom: 20, top: 30),
child: AppText(
TranslationBase.of(context)
.verifyLoginWith,
fontSize: 18,
color: Color(0xFF2E303A),
fontWeight: FontWeight.bold,
textAlign: TextAlign.left,
),
)
: AppText(
TranslationBase.of(context)
.verifyFingerprint2,
fontSize:
SizeConfig.textMultiplier * 2.5,
textAlign: TextAlign.start,
),
]),
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
this.onlySMSBox == false
? Container(
margin: EdgeInsets.only(bottom: 20, top: 30),
child: AppText(
TranslationBase.of(context).verifyLoginWith,
fontSize: 18,
color: Color(0xFF2E303A),
fontWeight: FontWeight.bold,
textAlign: TextAlign.left,
),
)
: AppText(
TranslationBase.of(context).verifyFingerprint2,
fontSize: SizeConfig.textMultiplier * 2.5,
textAlign: TextAlign.start,
),
]),
authenticationViewModel.user != null && isMoreOption == false
? Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Row(
mainAxisAlignment:
MainAxisAlignment.center,
children: <Widget>[
Expanded(
child: InkWell(
onTap: () =>
{
// TODO check this logic it seem it will create bug to us
authenticateUser(
AuthMethodTypes
.Fingerprint, true)
},
child: VerificationMethodsList(
authenticationViewModel:authenticationViewModel,
authMethodType: SelectedAuthMethodTypesService
.getMethodsTypeService(
authenticationViewModel.user
.logInTypeID),
authenticateUser:
(AuthMethodTypes
authMethodType,
isActive) =>
authenticateUser(
authMethodType,
isActive),
)),
),
Expanded(
child: VerificationMethodsList(
authenticationViewModel:authenticationViewModel,
authMethodType:
AuthMethodTypes.MoreOptions,
onShowMore: () {
setState(() {
isMoreOption = true;
});
},
))
]),
])
: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
onlySMSBox == false
? Row(
mainAxisAlignment:
MainAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Expanded(
child: VerificationMethodsList(
authenticationViewModel:authenticationViewModel,
authMethodType:
AuthMethodTypes.Fingerprint,
authenticateUser:
(AuthMethodTypes
authMethodType,
isActive) =>
authenticateUser(
authMethodType,
isActive),
)),
Expanded(
child: VerificationMethodsList(
authenticationViewModel:authenticationViewModel,
authMethodType:
AuthMethodTypes.FaceID,
authenticateUser:
(AuthMethodTypes
authMethodType,
isActive) =>
authenticateUser(
authMethodType,
isActive),
Row(mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[
Expanded(
child: InkWell(
onTap: () => {
// TODO check this logic it seem it will create bug to us
authenticateUser(AuthMethodTypes.Fingerprint, true)
},
child: VerificationMethodsList(
authenticationViewModel: authenticationViewModel,
authMethodType: SelectedAuthMethodTypesService.getMethodsTypeService(
authenticationViewModel.user!.logInTypeID!),
authenticateUser: (AuthMethodTypes authMethodType, isActive) =>
authenticateUser(authMethodType, isActive),
)),
),
Expanded(
child: VerificationMethodsList(
authenticationViewModel: authenticationViewModel,
authMethodType: AuthMethodTypes.MoreOptions,
onShowMore: () {
setState(() {
isMoreOption = true;
});
},
))
],
)
: SizedBox(),
Row(
mainAxisAlignment:
MainAxisAlignment.center,
]),
])
: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Expanded(
child: VerificationMethodsList(
authenticationViewModel:authenticationViewModel,
authMethodType: AuthMethodTypes
.SMS,
authenticateUser:
(
AuthMethodTypes authMethodType,
isActive) =>
authenticateUser(
authMethodType, isActive),
)),
Expanded(
child: VerificationMethodsList(
authenticationViewModel:authenticationViewModel,
authMethodType:
AuthMethodTypes.WhatsApp,
authenticateUser:
(
AuthMethodTypes authMethodType,
isActive) =>
authenticateUser(
authMethodType, isActive),
))
],
),
]),
onlySMSBox == false
? Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Expanded(
child: VerificationMethodsList(
authenticationViewModel: authenticationViewModel,
authMethodType: AuthMethodTypes.Fingerprint,
authenticateUser: (AuthMethodTypes authMethodType, isActive) =>
authenticateUser(authMethodType, isActive),
)),
Expanded(
child: VerificationMethodsList(
authenticationViewModel: authenticationViewModel,
authMethodType: AuthMethodTypes.FaceID,
authenticateUser: (AuthMethodTypes authMethodType, isActive) =>
authenticateUser(authMethodType, isActive),
))
],
)
: SizedBox(),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Expanded(
child: VerificationMethodsList(
authenticationViewModel: authenticationViewModel,
authMethodType: AuthMethodTypes.SMS,
authenticateUser: (AuthMethodTypes authMethodType, isActive) =>
authenticateUser(authMethodType, isActive),
)),
Expanded(
child: VerificationMethodsList(
authenticationViewModel: authenticationViewModel,
authMethodType: AuthMethodTypes.WhatsApp,
authenticateUser: (AuthMethodTypes authMethodType, isActive) =>
authenticateUser(authMethodType, isActive),
))
],
),
]),
// )
],
@ -391,56 +323,59 @@ class _VerificationMethodsScreenState extends State<VerificationMethodsScreen> {
),
),
),
bottomSheet: authenticationViewModel.user == null ? SizedBox(height: 0,) : Container(
height: 90,
width: double.infinity,
child: Center(
child: FractionallySizedBox(
widthFactor: 0.9,
child: Column(
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
SecondaryButton(
label: TranslationBase
.of(context)
.useAnotherAccount,
color: Color(0xFFD02127),
//fontWeight: FontWeight.w700,
onTap: () {
authenticationViewModel.deleteUser();
authenticationViewModel.setAppStatus(APP_STATUS.UNAUTHENTICATED);
// Navigator.pushAndRemoveUntil(
// AppGlobal.CONTEX,
// FadePage(
// page: RootPage(),
// ),
// (r) => false);
// Navigator.of(context).pushNamed(LOGIN);
},
bottomSheet: authenticationViewModel.user == null
? SizedBox(
height: 0,
)
: Container(
height: 90,
width: double.infinity,
child: Center(
child: FractionallySizedBox(
widthFactor: 0.9,
child: Column(
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
SecondaryButton(
label: TranslationBase.of(context).useAnotherAccount!,
color: Color(0xFFD02127),
//fontWeight: FontWeight.w700,
onTap: () {
authenticationViewModel.deleteUser();
authenticationViewModel.setAppStatus(APP_STATUS.UNAUTHENTICATED);
// Navigator.pushAndRemoveUntil(
// AppGlobal.CONTEX,
// FadePage(
// page: RootPage(),
// ),
// (r) => false);
// Navigator.of(context).pushNamed(LOGIN);
},
),
SizedBox(
height: 25,
)
],
),
),
SizedBox(height: 25,)
],
),
),
),
),),
);
}
sendActivationCodeByOtpNotificationType(
AuthMethodTypes authMethodType) async {
if (authMethodType == AuthMethodTypes.SMS ||
authMethodType == AuthMethodTypes.WhatsApp) {
sendActivationCodeByOtpNotificationType(AuthMethodTypes authMethodType) async {
if (authMethodType == AuthMethodTypes.SMS || authMethodType == AuthMethodTypes.WhatsApp) {
GifLoaderDialogUtils.showMyDialog(context);
await authenticationViewModel.sendActivationCodeForDoctorApp(authMethodType:authMethodType, password: authenticationViewModel.userInfo.password );
await authenticationViewModel.sendActivationCodeForDoctorApp(
authMethodType: authMethodType, password: authenticationViewModel.userInfo.password!);
if (authenticationViewModel.state == ViewState.ErrorLocal) {
Helpers.showErrorToast(authenticationViewModel.error);
GifLoaderDialogUtils.hideDialog(context);
} else {
authenticationViewModel.setDataAfterSendActivationSuccess(authenticationViewModel.activationCodeForDoctorAppRes);
sharedPref.setString(PASSWORD, authenticationViewModel.userInfo.password);
authenticationViewModel
.setDataAfterSendActivationSuccess(authenticationViewModel.activationCodeForDoctorAppRes);
sharedPref.setString(PASSWORD, authenticationViewModel.userInfo.password!);
GifLoaderDialogUtils.hideDialog(context);
this.startSMSService(authMethodType);
}
@ -454,16 +389,15 @@ class _VerificationMethodsScreenState extends State<VerificationMethodsScreen> {
sendActivationCodeVerificationScreen(AuthMethodTypes authMethodType) async {
GifLoaderDialogUtils.showMyDialog(context);
await authenticationViewModel
.sendActivationCodeVerificationScreen(authMethodType);
await authenticationViewModel.sendActivationCodeVerificationScreen(authMethodType);
if (authenticationViewModel.state == ViewState.ErrorLocal) {
GifLoaderDialogUtils.hideDialog(context);
Helpers.showErrorToast(authenticationViewModel.error);
} else {
authenticationViewModel.setDataAfterSendActivationSuccess(authenticationViewModel.activationCodeVerificationScreenRes);
if (authMethodType == AuthMethodTypes.SMS ||
authMethodType == AuthMethodTypes.WhatsApp) {
authenticationViewModel
.setDataAfterSendActivationSuccess(authenticationViewModel.activationCodeVerificationScreenRes);
if (authMethodType == AuthMethodTypes.SMS || authMethodType == AuthMethodTypes.WhatsApp) {
GifLoaderDialogUtils.hideDialog(context);
this.startSMSService(authMethodType);
} else {
@ -473,12 +407,10 @@ class _VerificationMethodsScreenState extends State<VerificationMethodsScreen> {
}
authenticateUser(AuthMethodTypes authMethodType, isActive) {
if (authMethodType == AuthMethodTypes.Fingerprint ||
authMethodType == AuthMethodTypes.FaceID) {
if (authMethodType == AuthMethodTypes.Fingerprint || authMethodType == AuthMethodTypes.FaceID) {
fingerPrintBefore = authMethodType;
}
this.selectedOption =
fingerPrintBefore != null ? fingerPrintBefore : authMethodType;
this.selectedOption = fingerPrintBefore != null ? fingerPrintBefore : authMethodType;
switch (authMethodType) {
case AuthMethodTypes.SMS:
@ -488,8 +420,7 @@ class _VerificationMethodsScreenState extends State<VerificationMethodsScreen> {
sendActivationCode(authMethodType);
break;
case AuthMethodTypes.Fingerprint:
this.loginWithFingerPrintOrFaceID(
AuthMethodTypes.Fingerprint, isActive);
this.loginWithFingerPrintOrFaceID(AuthMethodTypes.Fingerprint, isActive);
break;
case AuthMethodTypes.FaceID:
this.loginWithFingerPrintOrFaceID(AuthMethodTypes.FaceID, isActive);
@ -512,7 +443,9 @@ class _VerificationMethodsScreenState extends State<VerificationMethodsScreen> {
new SMSOTP(
context,
type,
authenticationViewModel.loggedUser != null ? authenticationViewModel.loggedUser.mobileNumber : authenticationViewModel.user.mobile,
authenticationViewModel.loggedUser != null
? authenticationViewModel.loggedUser.mobileNumber
: authenticationViewModel.user!.mobile,
(value) {
showDialog(
context: context,
@ -522,23 +455,21 @@ class _VerificationMethodsScreenState extends State<VerificationMethodsScreen> {
this.checkActivationCode(value: value);
},
() =>
{
() => {
print('Faild..'),
},
).displayDialog(context);
}
loginWithFingerPrintOrFaceID(AuthMethodTypes authMethodTypes,
isActive) async {
loginWithFingerPrintOrFaceID(AuthMethodTypes authMethodTypes, isActive) async {
if (isActive) {
await authenticationViewModel.showIOSAuthMessages();
if (!mounted) return;
if (authenticationViewModel.user != null &&
(SelectedAuthMethodTypesService.getMethodsTypeService(
authenticationViewModel.user.logInTypeID) ==
AuthMethodTypes.Fingerprint ||
SelectedAuthMethodTypesService.getMethodsTypeService(
authenticationViewModel.user.logInTypeID) == AuthMethodTypes.FaceID)) {
(SelectedAuthMethodTypesService.getMethodsTypeService(authenticationViewModel.user!.logInTypeID!) ==
AuthMethodTypes.Fingerprint ||
SelectedAuthMethodTypesService.getMethodsTypeService(authenticationViewModel.user!.logInTypeID!) ==
AuthMethodTypes.FaceID)) {
this.sendActivationCode(authMethodTypes);
} else {
setState(() {
@ -568,7 +499,4 @@ class _VerificationMethodsScreenState extends State<VerificationMethodsScreen> {
authenticationViewModel.setAppStatus(APP_STATUS.AUTHENTICATED);
}
}
}

@ -5,11 +5,11 @@ import 'package:provider/provider.dart';
import '../../locator.dart';
class BaseView<T extends BaseViewModel> extends StatefulWidget {
final Widget Function(BuildContext context, T model, Widget child) builder;
final Function(T) onModelReady;
final Widget Function(BuildContext context, T model, Widget? child) builder;
final Function(T)? onModelReady;
BaseView({
this.builder,
required this.builder,
this.onModelReady,
});
@ -18,14 +18,14 @@ class BaseView<T extends BaseViewModel> extends StatefulWidget {
}
class _BaseViewState<T extends BaseViewModel> extends State<BaseView<T>> {
T model = locator<T>();
T? model = locator<T>();
bool isLogin = false;
@override
void initState() {
if (widget.onModelReady != null) {
widget.onModelReady(model);
widget.onModelReady!(model!);
}
super.initState();
@ -34,7 +34,7 @@ class _BaseViewState<T extends BaseViewModel> extends State<BaseView<T>> {
@override
Widget build(BuildContext context) {
return ChangeNotifierProvider<T>.value(
value: model,
value: model!,
child: Consumer<T>(builder: widget.builder),
);
}

@ -12,13 +12,14 @@ import 'package:hexcolor/hexcolor.dart';
import 'package:url_launcher/url_launcher.dart';
class DoctorReplayChat extends StatelessWidget {
final ListGtMyPatientsQuestions reply;
TextEditingController msgController = TextEditingController();
final DoctorReplayViewModel previousModel;
DoctorReplayChat(
{Key key, this.reply, this.previousModel,
});
final DoctorReplayViewModel previousModel;
DoctorReplayChat({
Key? key,
required this.reply,
required this.previousModel,
});
@override
Widget build(BuildContext context) {
@ -37,33 +38,27 @@ class DoctorReplayChat extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
padding: EdgeInsets.only(
left: 0, right: 5, bottom: 5, top: 5),
padding: EdgeInsets.only(left: 0, right: 5, bottom: 5, top: 5),
decoration: BoxDecoration(
color: Colors.white,
),
height: 115,
child: Container(
padding: EdgeInsets.only(
left: 10, right: 10),
padding: EdgeInsets.only(left: 10, right: 10),
margin: EdgeInsets.only(top: 40),
child: Column(
children: [
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Expanded(
child: RichText(
text: TextSpan(
style: TextStyle(
fontSize: 1.6 *
SizeConfig.textMultiplier,
color: Colors.black),
fontSize: 1.6 * SizeConfig.textMultiplier, color: Colors.black),
children: <TextSpan>[
new TextSpan(
text: reply.patientName
.toString(),
text: reply.patientName.toString(),
style: TextStyle(
color: Color(0xFF2B353E),
fontWeight: FontWeight.bold,
@ -77,9 +72,7 @@ class DoctorReplayChat extends StatelessWidget {
onTap: () {
Navigator.pop(context);
},
child: Icon(FontAwesomeIcons.times,
size: 30,
color: Color(0xFF2B353E)))
child: Icon(FontAwesomeIcons.times, size: 30, color: Color(0xFF2B353E)))
],
),
],
@ -93,8 +86,9 @@ class DoctorReplayChat extends StatelessWidget {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(height: 30,),
SizedBox(
height: 30,
),
Container(
// color: Color(0xFF2B353E),
width: MediaQuery.of(context).size.width * 0.9,
@ -104,9 +98,7 @@ class DoctorReplayChat extends StatelessWidget {
borderRadius: BorderRadius.all(
Radius.circular(10.0),
),
border: Border.all(
color: HexColor('#707070') ,
width: 0.30),
border: Border.all(color: HexColor('#707070'), width: 0.30),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
@ -132,12 +124,13 @@ class DoctorReplayChat extends StatelessWidget {
),
),
Divider(),
SizedBox(width: 10,),
SizedBox(
width: 10,
),
Container(
width: MediaQuery.of(context).size.width * 0.35,
child: AppText(
reply.patientName
.toString(),
reply.patientName.toString(),
fontSize: 14,
fontFamily: 'Poppins',
color: Colors.white,
@ -149,7 +142,7 @@ class DoctorReplayChat extends StatelessWidget {
margin: EdgeInsets.symmetric(horizontal: 4),
child: InkWell(
onTap: () {
launch("tel://" +reply.mobileNumber);
launch("tel://" + reply.mobileNumber!);
},
child: Icon(
Icons.phone,
@ -161,18 +154,23 @@ class DoctorReplayChat extends StatelessWidget {
),
Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
AppText(
reply.createdOn !=null?AppDateUtils.getDayMonthYearDateFormatted(AppDateUtils.getDateTimeFromServerFormat(reply.createdOn)):AppDateUtils.getDayMonthYearDateFormatted(DateTime.now()),
fontWeight: FontWeight
.w600,
reply.createdOn != null
? AppDateUtils.getDayMonthYearDateFormatted(
AppDateUtils.getDateTimeFromServerFormat(
reply.createdOn ?? ""))
: AppDateUtils.getDayMonthYearDateFormatted(DateTime.now()),
fontWeight: FontWeight.w600,
color: Colors.white,
fontSize: 14,
),
AppText(
reply.createdOn !=null?AppDateUtils.getHour(AppDateUtils.getDateTimeFromServerFormat(reply.createdOn)):AppDateUtils.getHour(DateTime.now()),
fontSize: 14,
reply.createdOn != null
? AppDateUtils.getHour(AppDateUtils.getDateTimeFromServerFormat(
reply.createdOn ?? ""))
: AppDateUtils.getHour(DateTime.now()),
fontSize: 14,
fontFamily: 'Poppins',
color: Colors.white,
// fontSize: 18
@ -210,7 +208,9 @@ class DoctorReplayChat extends StatelessWidget {
],
),
),
SizedBox(height: 30,),
SizedBox(
height: 30,
),
],
),
),
@ -276,8 +276,6 @@ class DoctorReplayChat extends StatelessWidget {
// ),
// )
],
),
),
));

@ -16,10 +16,9 @@ import 'package:flutter/material.dart';
*@desc: Doctor Reply Screen display data from GtMyPatientsQuestions service
*/
class DoctorReplyScreen extends StatelessWidget {
final Function changeCurrentTab;
const DoctorReplyScreen({Key key, this.changeCurrentTab}) : super(key: key);
const DoctorReplyScreen({Key? key, required this.changeCurrentTab}) : super(key: key);
@override
Widget build(BuildContext context) {
@ -28,16 +27,16 @@ class DoctorReplyScreen extends StatelessWidget {
model.getDoctorReply();
},
builder: (_, model, w) => WillPopScope(
onWillPop: ()async{
onWillPop: () async {
changeCurrentTab();
return false;
},
child: AppScaffold(
baseViewModel: model,
appBarTitle: TranslationBase.of(context).replay2,
appBarTitle: TranslationBase.of(context).replay2!,
isShowAppBar: false,
body: model.listDoctorWorkingHoursTable.isEmpty
? DrAppEmbeddedError(error: TranslationBase.of(context).noItem)
? DrAppEmbeddedError(error: TranslationBase.of(context).noItem ?? "")
: Container(
padding: EdgeInsetsDirectional.fromSTEB(30, 0, 30, 0),
child: ListView(
@ -45,19 +44,17 @@ class DoctorReplyScreen extends StatelessWidget {
Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children:
model.listDoctorWorkingHoursTable.map((reply) {
children: model.listDoctorWorkingHoursTable.map((reply) {
return InkWell(
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (BuildContext context) =>
DoctorReplayChat(
reply: reply,
previousModel: model,
)));
},
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (BuildContext context) => DoctorReplayChat(
reply: reply,
previousModel: model,
)));
},
child: DoctorReplyWidget(reply: reply),
);
}).toList(),
@ -68,6 +65,5 @@ class DoctorReplyScreen extends StatelessWidget {
),
),
);
}
}

@ -21,7 +21,7 @@ class _MyReferralPatientState extends State<MyReferralPatient> {
onModelReady: (model) => model.getMyReferralPatient(),
builder: (_, model, w) => AppScaffold(
baseViewModel: model,
appBarTitle: TranslationBase.of(context).myReferralPatient,
appBarTitle: TranslationBase.of(context).myReferralPatient ?? "",
body: model.listMyReferralPatientModel.length == 0
? Center(
child: AppText(
@ -45,21 +45,18 @@ class _MyReferralPatientState extends State<MyReferralPatient> {
...List.generate(
model.listMyReferralPatientModel.length,
(index) => MyReferralPatientWidget(
myReferralPatientModel: model
.listMyReferralPatientModel[index],
myReferralPatientModel: model.listMyReferralPatientModel[index],
model: model,
expandClick: () {
setState(() {
if (widget.expandedItemIndex ==
index) {
if (widget.expandedItemIndex == index) {
widget.expandedItemIndex = -1;
} else {
widget.expandedItemIndex = index;
}
});
},
isExpand:
widget.expandedItemIndex == index,
isExpand: widget.expandedItemIndex == index,
),
)
],

@ -14,9 +14,8 @@ class PatientArrivalScreen extends StatefulWidget {
_PatientArrivalScreen createState() => _PatientArrivalScreen();
}
class _PatientArrivalScreen extends State<PatientArrivalScreen>
with SingleTickerProviderStateMixin {
TabController _tabController;
class _PatientArrivalScreen extends State<PatientArrivalScreen> with SingleTickerProviderStateMixin {
late TabController _tabController;
var _patientSearchFormValues = PatientModel(
FirstName: "0",
MiddleName: "0",
@ -24,10 +23,8 @@ class _PatientArrivalScreen extends State<PatientArrivalScreen>
PatientMobileNumber: "0",
PatientIdentificationID: "0",
PatientID: 0,
From: AppDateUtils.convertDateToFormat(DateTime.now(), 'yyyy-MM-dd')
.toString(),
To: AppDateUtils.convertDateToFormat(DateTime.now(), 'yyyy-MM-dd')
.toString(),
From: AppDateUtils.convertDateToFormat(DateTime.now(), 'yyyy-MM-dd').toString(),
To: AppDateUtils.convertDateToFormat(DateTime.now(), 'yyyy-MM-dd').toString(),
LanguageID: 2,
stamp: "2020-03-02T13:56:39.170Z",
IPAdress: "11.11.11.11",
@ -54,7 +51,7 @@ class _PatientArrivalScreen extends State<PatientArrivalScreen>
Widget build(BuildContext context) {
return AppScaffold(
isShowAppBar: true,
appBarTitle: TranslationBase.of(context).arrivalpatient,
appBarTitle: TranslationBase.of(context).arrivalpatient ?? "",
body: Scaffold(
extendBodyBehindAppBar: true,
appBar: PreferredSize(
@ -66,9 +63,7 @@ class _PatientArrivalScreen extends State<PatientArrivalScreen>
width: MediaQuery.of(context).size.width * 0.92, // 0.9,
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
color: Theme.of(context).dividerColor,
width: 0.9), //width: 0.7
bottom: BorderSide(color: Theme.of(context).dividerColor, width: 0.9), //width: 0.7
),
color: Colors.white),
child: Center(
@ -78,22 +73,19 @@ class _PatientArrivalScreen extends State<PatientArrivalScreen>
indicatorWeight: 5.0,
indicatorSize: TabBarIndicatorSize.tab,
labelColor: Theme.of(context).primaryColor,
labelPadding:
EdgeInsets.only(top: 4.0, left: 35.0, right: 35.0),
labelPadding: EdgeInsets.only(top: 4.0, left: 35.0, right: 35.0),
unselectedLabelColor: Colors.grey[800],
tabs: [
Container(
width: MediaQuery.of(context).size.width * 0.30,
child: Center(
child: AppText(
TranslationBase.of(context).arrivalpatient),
child: AppText(TranslationBase.of(context).arrivalpatient),
),
),
Container(
width: MediaQuery.of(context).size.width * 0.30,
child: Center(
child: AppText(
TranslationBase.of(context).rescheduleLeaves),
child: AppText(TranslationBase.of(context).rescheduleLeaves),
),
),
],

@ -27,9 +27,8 @@ class DashboardSliderItemWidget extends StatelessWidget {
height: 110,
child: ListView(
scrollDirection: Axis.horizontal,
children:
List.generate(item.summaryoptions.length, (int index) {
return GetActivityButton(item.summaryoptions[index]);
children: List.generate(item.summaryoptions!.length, (int index) {
return GetActivityButton(item.summaryoptions![index]);
})))
],
);

@ -45,8 +45,7 @@ class _DashboardSwipeWidgetState extends State<DashboardSwipeWidget> {
},
itemCount: 3,
// itemHeight: 300,
pagination: new SwiperCustomPagination(
builder: (BuildContext context, SwiperPluginConfig config) {
pagination: new SwiperCustomPagination(builder: (BuildContext context, SwiperPluginConfig config) {
return new Stack(
alignment: Alignment.bottomCenter,
children: [
@ -59,15 +58,9 @@ class _DashboardSwipeWidgetState extends State<DashboardSwipeWidget> {
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
config.activeIndex == 0
? SwiperRoundedPagination(true)
: SwiperRoundedPagination(false),
config.activeIndex == 1
? SwiperRoundedPagination(true)
: SwiperRoundedPagination(false),
config.activeIndex == 2
? SwiperRoundedPagination(true)
: SwiperRoundedPagination(false),
config.activeIndex == 0 ? SwiperRoundedPagination(true) : SwiperRoundedPagination(false),
config.activeIndex == 1 ? SwiperRoundedPagination(true) : SwiperRoundedPagination(false),
config.activeIndex == 2 ? SwiperRoundedPagination(true) : SwiperRoundedPagination(false),
],
),
),
@ -94,9 +87,7 @@ class _DashboardSwipeWidgetState extends State<DashboardSwipeWidget> {
shadowSpreadRadius: 3,
shadowDy: 1,
margin: EdgeInsets.only(top: 15, bottom: 15, left: 10, right: 10),
child: Padding(
padding: const EdgeInsets.all(5.0),
child: GetOutPatientStack(dashboardItemList[1])));
child: Padding(padding: const EdgeInsets.all(5.0), child: GetOutPatientStack(dashboardItemList[1])));
if (index == 0)
return RoundedContainer(
raduis: 16,
@ -106,9 +97,7 @@ class _DashboardSwipeWidgetState extends State<DashboardSwipeWidget> {
shadowSpreadRadius: 3,
shadowDy: 1,
margin: EdgeInsets.only(top: 15, bottom: 15, left: 10, right: 10),
child: Padding(
padding: const EdgeInsets.all(5.0),
child: GetOutPatientStack(dashboardItemList[0])));
child: Padding(padding: const EdgeInsets.all(5.0), child: GetOutPatientStack(dashboardItemList[0])));
if (index == 2)
return RoundedContainer(
raduis: 16,
@ -118,8 +107,7 @@ class _DashboardSwipeWidgetState extends State<DashboardSwipeWidget> {
shadowSpreadRadius: 3,
shadowDy: 1,
margin: EdgeInsets.only(top: 15, bottom: 15, left: 10, right: 10),
child:
Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
Expanded(
flex: 1,
child: Row(
@ -135,21 +123,17 @@ class _DashboardSwipeWidgetState extends State<DashboardSwipeWidget> {
Padding(
padding: EdgeInsets.all(8),
child: Column(
mainAxisAlignment:
MainAxisAlignment.center,
crossAxisAlignment:
CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
AppText(
TranslationBase.of(context)
.patients,
TranslationBase.of(context).patients,
fontSize: 12,
fontWeight: FontWeight.bold,
fontHeight: 0.5,
),
AppText(
TranslationBase.of(context)
.referral,
TranslationBase.of(context).referral,
fontSize: 22,
fontWeight: FontWeight.bold,
),
@ -162,34 +146,16 @@ class _DashboardSwipeWidgetState extends State<DashboardSwipeWidget> {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(
child: RowCounts(
dashboardItemList[2]
.summaryoptions[0]
.kPIParameter,
dashboardItemList[2]
.summaryoptions[0]
.value,
Colors.black),
child: RowCounts(dashboardItemList[2].summaryoptions![0].kPIParameter,
dashboardItemList[2].summaryoptions![0].value!, Colors.black),
),
Expanded(
child: RowCounts(
dashboardItemList[2]
.summaryoptions[1]
.kPIParameter,
dashboardItemList[2]
.summaryoptions[1]
.value,
Colors.grey),
child: RowCounts(dashboardItemList[2].summaryoptions![1].kPIParameter,
dashboardItemList[2].summaryoptions![1].value!, Colors.grey),
),
Expanded(
child: RowCounts(
dashboardItemList[2]
.summaryoptions[2]
.kPIParameter,
dashboardItemList[2]
.summaryoptions[2]
.value,
Colors.red),
child: RowCounts(dashboardItemList[2].summaryoptions![2].kPIParameter,
dashboardItemList[2].summaryoptions![2].value!, Colors.red),
),
],
),
@ -200,17 +166,13 @@ class _DashboardSwipeWidgetState extends State<DashboardSwipeWidget> {
Expanded(
flex: 3,
child: Stack(children: [
Container(
child: GaugeChart(
_createReferralData(widget.dashboardItemList))),
Container(child: GaugeChart(_createReferralData(widget.dashboardItemList))),
Positioned(
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
AppText(
widget.model
.getPatientCount(dashboardItemList[2])
.toString(),
widget.model.getPatientCount(dashboardItemList[2]).toString(),
fontSize: SizeConfig.textMultiplier * 3.0,
fontWeight: FontWeight.bold,
)
@ -227,21 +189,14 @@ class _DashboardSwipeWidgetState extends State<DashboardSwipeWidget> {
return Container();
}
static List<charts.Series<GaugeSegment, String>> _createReferralData(
List<DashboardModel> dashboardItemList) {
static List<charts.Series<GaugeSegment, String>> _createReferralData(List<DashboardModel> dashboardItemList) {
final data = [
new GaugeSegment(
dashboardItemList[2].summaryoptions[0].kPIParameter,
getValue(dashboardItemList[1].summaryoptions[0].value),
charts.MaterialPalette.black),
new GaugeSegment(
dashboardItemList[2].summaryoptions[1].kPIParameter,
getValue(dashboardItemList[1].summaryoptions[1].value),
charts.MaterialPalette.gray.shadeDefault),
new GaugeSegment(
dashboardItemList[2].summaryoptions[2].kPIParameter,
getValue(dashboardItemList[1].summaryoptions[2].value),
charts.MaterialPalette.red.shadeDefault),
new GaugeSegment(dashboardItemList[2].summaryoptions![0].kPIParameter!,
getValue(dashboardItemList[1].summaryoptions![0].value), charts.MaterialPalette.black),
new GaugeSegment(dashboardItemList[2].summaryoptions![1].kPIParameter!,
getValue(dashboardItemList[1].summaryoptions![1].value), charts.MaterialPalette.gray.shadeDefault),
new GaugeSegment(dashboardItemList[2].summaryoptions![2].kPIParameter!,
getValue(dashboardItemList[1].summaryoptions![2].value), charts.MaterialPalette.red.shadeDefault),
];
return [

@ -5,15 +5,15 @@ class HomePageCard extends StatelessWidget {
const HomePageCard(
{this.hasBorder = false,
this.imageName,
@required this.child,
this.onTap,
Key key,
this.color,
required this.child,
required this.onTap,
Key? key,
required this.color,
this.opacity = 0.4,
this.margin})
required this.margin})
: super(key: key);
final bool hasBorder;
final String imageName;
final String? imageName;
final Widget child;
final Function onTap;
final Color color;
@ -22,12 +22,10 @@ class HomePageCard extends StatelessWidget {
@override
Widget build(BuildContext context) {
return InkWell(
onTap: onTap,
onTap: onTap(),
child: Container(
width: 120,
height: MediaQuery.of(context).orientation == Orientation.portrait
? 100
: 200,
height: MediaQuery.of(context).orientation == Orientation.portrait ? 100 : 200,
margin: this.margin,
decoration: BoxDecoration(
color: !hasBorder
@ -43,8 +41,7 @@ class HomePageCard extends StatelessWidget {
? DecorationImage(
image: AssetImage('assets/images/dashboard/$imageName'),
fit: BoxFit.cover,
colorFilter: new ColorFilter.mode(
Colors.black.withOpacity(0.2), BlendMode.dstIn),
colorFilter: new ColorFilter.mode(Colors.black.withOpacity(0.2), BlendMode.dstIn),
)
: null,
),

@ -12,12 +12,12 @@ class HomePatientCard extends StatelessWidget {
final Function onTap;
HomePatientCard({
@required this.backgroundColor,
@required this.backgroundIconColor,
@required this.cardIcon,
@required this.text,
@required this.textColor,
@required this.onTap,
required this.backgroundColor,
required this.backgroundIconColor,
required this.cardIcon,
required this.text,
required this.textColor,
required this.onTap,
});
@override

@ -36,9 +36,9 @@ import 'package:sticky_headers/sticky_headers/widget.dart';
import '../../widgets/shared/app_texts_widget.dart';
class HomeScreen extends StatefulWidget {
HomeScreen({Key key, this.title}) : super(key: key);
HomeScreen({Key? key, this.title}) : super(key: key);
final String title;
final String? title;
final String iconURL = 'assets/images/dashboard_icon/';
@override
@ -47,14 +47,14 @@ class HomeScreen extends StatefulWidget {
class _HomeScreenState extends State<HomeScreen> {
bool isLoading = false;
ProjectViewModel projectsProvider;
late ProjectViewModel projectsProvider;
var _isInit = true;
DoctorProfileModel profile;
late DoctorProfileModel profile;
bool isExpanded = false;
bool isInpatient = false;
int sliderActiveIndex = 0;
var clinicId;
AuthenticationViewModel authenticationViewModel;
late AuthenticationViewModel authenticationViewModel;
int colorIndex = 0;
@override
@ -69,8 +69,7 @@ class _HomeScreenState extends State<HomeScreen> {
return BaseView<DashboardViewModel>(
onModelReady: (model) async {
await model.setFirebaseNotification(
projectsProvider, authenticationViewModel);
await model.setFirebaseNotification(projectsProvider, authenticationViewModel);
await model.getDashboard();
await model.getDoctorProfile(isGetProfile: true);
await model.checkDoctorHasLiveCare();
@ -86,8 +85,7 @@ class _HomeScreenState extends State<HomeScreen> {
padding: EdgeInsets.only(top: 10),
child: Stack(children: [
IconButton(
icon: Image.asset('assets/images/menu.png',
height: 50, width: 50),
icon: Image.asset('assets/images/menu.png', height: 50, width: 50),
iconSize: 18,
color: Colors.black,
onPressed: () => Scaffold.of(context).openDrawer(),
@ -99,8 +97,7 @@ class _HomeScreenState extends State<HomeScreen> {
children: [
Container(
width: MediaQuery.of(context).size.width * .6,
child: projectsProvider.doctorClinicsList.length >
0
child: projectsProvider.doctorClinicsList.length > 0
? Stack(
children: [
DropdownButtonHideUnderline(
@ -109,61 +106,36 @@ class _HomeScreenState extends State<HomeScreen> {
iconEnabledColor: Colors.black,
isExpanded: true,
value: clinicId == null
? projectsProvider
.doctorClinicsList[0].clinicID
? projectsProvider.doctorClinicsList[0].clinicID
: clinicId,
iconSize: 25,
elevation: 16,
selectedItemBuilder:
(BuildContext context) {
return projectsProvider
.doctorClinicsList
.map((item) {
selectedItemBuilder: (BuildContext context) {
return projectsProvider.doctorClinicsList.map((item) {
return Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment:
MainAxisAlignment.end,
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
Column(
mainAxisAlignment:
MainAxisAlignment
.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
padding:
EdgeInsets.all(2),
margin:
EdgeInsets.all(2),
decoration:
new BoxDecoration(
color:
Colors.red[800],
borderRadius:
BorderRadius
.circular(
20),
padding: EdgeInsets.all(2),
margin: EdgeInsets.all(2),
decoration: new BoxDecoration(
color: Colors.red[800],
borderRadius: BorderRadius.circular(20),
),
constraints:
BoxConstraints(
constraints: BoxConstraints(
minWidth: 20,
minHeight: 20,
),
child: Center(
child: AppText(
projectsProvider
.doctorClinicsList
.length
.toString(),
color:
Colors.white,
fontSize:
projectsProvider
.isArabic
? 10
: 11,
textAlign:
TextAlign
.center,
projectsProvider.doctorClinicsList.length.toString(),
color: Colors.white,
fontSize: projectsProvider.isArabic ? 10 : 11,
textAlign: TextAlign.center,
),
)),
],
@ -171,8 +143,7 @@ class _HomeScreenState extends State<HomeScreen> {
AppText(item.clinicName,
fontSize: 12,
color: Colors.black,
fontWeight:
FontWeight.bold,
fontWeight: FontWeight.bold,
textAlign: TextAlign.end),
],
);
@ -180,21 +151,14 @@ class _HomeScreenState extends State<HomeScreen> {
},
onChanged: (newValue) async {
clinicId = newValue;
GifLoaderDialogUtils.showMyDialog(
context);
await model.changeClinic(newValue,
authenticationViewModel);
GifLoaderDialogUtils.hideDialog(
context);
if (model.state ==
ViewState.ErrorLocal) {
DrAppToastMsg.showErrorToast(
model.error);
GifLoaderDialogUtils.showMyDialog(context);
await model.changeClinic(clinicId, authenticationViewModel);
GifLoaderDialogUtils.hideDialog(context);
if (model.state == ViewState.ErrorLocal) {
DrAppToastMsg.showErrorToast(model.error);
}
},
items: projectsProvider
.doctorClinicsList
.map((item) {
items: projectsProvider.doctorClinicsList.map((item) {
return DropdownMenuItem(
child: AppText(
item.clinicName,
@ -206,8 +170,7 @@ class _HomeScreenState extends State<HomeScreen> {
)),
],
)
: AppText(
TranslationBase.of(context).noClinic),
: AppText(TranslationBase.of(context).noClinic),
),
],
),
@ -233,21 +196,16 @@ class _HomeScreenState extends State<HomeScreen> {
? FractionallySizedBox(
widthFactor: 0.90,
child: Container(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
SizedBox(
height: 10,
),
sliderActiveIndex == 1
? DashboardSliderItemWidget(
model.dashboardItemsList[4])
: sliderActiveIndex == 0
? DashboardSliderItemWidget(
model.dashboardItemsList[3])
: DashboardSliderItemWidget(
model.dashboardItemsList[6]),
])))
child: Column(mainAxisAlignment: MainAxisAlignment.start, children: <Widget>[
SizedBox(
height: 10,
),
sliderActiveIndex == 1
? DashboardSliderItemWidget(model.dashboardItemsList[4])
: sliderActiveIndex == 0
? DashboardSliderItemWidget(model.dashboardItemsList[3])
: DashboardSliderItemWidget(model.dashboardItemsList[6]),
])))
: SizedBox(),
FractionallySizedBox(
// widthFactor: 0.90,
@ -289,11 +247,9 @@ class _HomeScreenState extends State<HomeScreen> {
),
Container(
height: 120,
child: ListView(
scrollDirection: Axis.horizontal,
children: [
...homePatientsCardsWidget(model),
])),
child: ListView(scrollDirection: Axis.horizontal, children: [
...homePatientsCardsWidget(model),
])),
SizedBox(
height: 20,
),
@ -313,20 +269,21 @@ class _HomeScreenState extends State<HomeScreen> {
List<Widget> homePatientsCardsWidget(DashboardViewModel model) {
colorIndex = 0;
List<Color> backgroundColors = List(3);
backgroundColors[0] = Color(0xffD02127);
backgroundColors[1] = Colors.grey[300];
backgroundColors[2] = Color(0xff2B353E);
List<Color> backgroundIconColors = List(3);
backgroundIconColors[0] = Colors.white12;
backgroundIconColors[1] = Colors.white38;
backgroundIconColors[2] = Colors.white10;
List<Color> textColors = List(3);
textColors[0] = Colors.white;
textColors[1] = Colors.black;
textColors[2] = Colors.white;
List<Color> backgroundColors = [];
backgroundColors.add(Color(0xffD02127));
backgroundColors.add(Colors.grey[300]!);
backgroundColors.add(Color(0xff2B353E));
List<Color> backgroundIconColors = [];
backgroundIconColors.add(Colors.white12);
backgroundIconColors.add(Colors.white38);
backgroundIconColors.add(Colors.white10);
List<HomePatientCard> patientCards = List();
List<Color> textColors = [];
textColors.add(Colors.white);
textColors.add(Colors.black);
textColors.add(Colors.white);
List<HomePatientCard> patientCards = [];
if (model.hasVirtualClinic) {
patientCards.add(HomePatientCard(
@ -334,8 +291,7 @@ class _HomeScreenState extends State<HomeScreen> {
backgroundIconColor: backgroundIconColors[colorIndex],
cardIcon: DoctorApp.livecare,
textColor: textColors[colorIndex],
text:
"${TranslationBase.of(context).liveCare}\n${TranslationBase.of(context).patients}",
text: "${TranslationBase.of(context).liveCare}\n${TranslationBase.of(context).patients}",
onTap: () {
Navigator.push(
context,
@ -353,7 +309,7 @@ class _HomeScreenState extends State<HomeScreen> {
backgroundIconColor: backgroundIconColors[colorIndex],
cardIcon: DoctorApp.inpatient,
textColor: textColors[colorIndex],
text: TranslationBase.of(context).myInPatient,
text: TranslationBase.of(context).myInPatient!,
onTap: () {
Navigator.push(
context,
@ -370,22 +326,17 @@ class _HomeScreenState extends State<HomeScreen> {
backgroundIconColor: backgroundIconColors[colorIndex],
cardIcon: DoctorApp.arrival_patients,
textColor: textColors[colorIndex],
text: TranslationBase.of(context).myOutPatient_2lines,
text: TranslationBase.of(context).myOutPatient_2lines!,
onTap: () {
String date = AppDateUtils.convertDateToFormat(
DateTime(
DateTime.now().year, DateTime.now().month, DateTime.now().day),
'yyyy-MM-dd');
DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day), 'yyyy-MM-dd');
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => OutPatientsScreen(
patientSearchRequestModel: PatientSearchRequestModel(
from: date,
to: date,
doctorID:
authenticationViewModel.doctorProfile.doctorID)),
from: date, to: date, doctorID: authenticationViewModel.doctorProfile!.doctorID)),
));
},
));
@ -396,14 +347,12 @@ class _HomeScreenState extends State<HomeScreen> {
backgroundIconColor: backgroundIconColors[colorIndex],
cardIcon: DoctorApp.referral_1,
textColor: textColors[colorIndex],
text: TranslationBase.of(context)
.myPatientsReferral,
text: TranslationBase.of(context).myPatientsReferral!,
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
PatientReferralScreen(),
builder: (context) => PatientReferralScreen(),
),
);
},
@ -415,14 +364,12 @@ class _HomeScreenState extends State<HomeScreen> {
backgroundIconColor: backgroundIconColors[colorIndex],
cardIcon: DoctorApp.search,
textColor: textColors[colorIndex],
text: TranslationBase.of(context)
.searchPatientDashBoard,
text: TranslationBase.of(context).searchPatientDashBoard!,
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
PatientSearchScreen(),
builder: (context) => PatientSearchScreen(),
));
},
));
@ -433,23 +380,18 @@ class _HomeScreenState extends State<HomeScreen> {
backgroundIconColor: backgroundIconColors[colorIndex],
cardIcon: DoctorApp.search_medicines,
textColor: textColors[colorIndex],
text: TranslationBase.of(context)
.searchMedicineDashboard,
text: TranslationBase.of(context).searchMedicineDashboard!,
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
MedicineSearchScreen(),
builder: (context) => MedicineSearchScreen(),
));
},
));
changeColorIndex();
return [
...List.generate(patientCards.length, (index) => patientCards[index])
.toList()
];
return [...List.generate(patientCards.length, (index) => patientCards[index]).toList()];
}
changeColorIndex() {

@ -24,7 +24,7 @@ import 'package:hexcolor/hexcolor.dart';
class EndCallScreen extends StatefulWidget {
final PatiantInformtion patient;
const EndCallScreen({Key key, this.patient}) : super(key: key);
const EndCallScreen({Key? key, required this.patient}) : super(key: key);
@override
_EndCallScreenState createState() => _EndCallScreenState();
@ -35,57 +35,61 @@ class _EndCallScreenState extends State<EndCallScreen> {
bool isDischargedPatient = false;
bool isSearchAndOut = false;
String patientType;
String arrivalType;
String from;
String to;
late String patientType;
late String arrivalType;
late String from;
late String to;
LiveCarePatientViewModel liveCareModel;
late LiveCarePatientViewModel liveCareModel;
@override
Widget build(BuildContext context) {
final List<PatientProfileCardModel> cardsList = [
PatientProfileCardModel(TranslationBase.of(context).resume,
TranslationBase.of(context).theCall, '', 'patient/vital_signs.png',
PatientProfileCardModel(
TranslationBase.of(context).resume!, TranslationBase.of(context).theCall!, '', 'patient/vital_signs.png',
isInPatient: isInpatient, onTap: () async {
GifLoaderDialogUtils.showMyDialog(context);
await liveCareModel
.startCall(isReCall: false, vCID: widget.patient.vcId)
.then((value) async{
await liveCareModel.startCall(isReCall: false, vCID: widget.patient.vcId!).then((value) async {
await liveCareModel.getDoctorProfile();
GifLoaderDialogUtils.hideDialog(context);
if (liveCareModel.state == ViewState.ErrorLocal) {
DrAppToastMsg.showErrorToast(liveCareModel.error);
}else
await VideoChannel.openVideoCallScreen(
kToken: liveCareModel.startCallRes.openTokenID,
kSessionId: liveCareModel.startCallRes.openSessionID,
kApiKey: '46209962',
vcId: widget.patient.vcId,
tokenID: await liveCareModel.getToken(),
generalId: GENERAL_ID,
doctorId: liveCareModel.doctorProfile.doctorID,
onFailure: (String error) {
DrAppToastMsg.showErrorToast(error);
},
onCallEnd: () async{
GifLoaderDialogUtils.showMyDialog(context);
GifLoaderDialogUtils.showMyDialog(context);
await liveCareModel.endCall(widget.patient.vcId, false,);
GifLoaderDialogUtils.hideDialog(context);
if (liveCareModel.state == ViewState.ErrorLocal) {
DrAppToastMsg.showErrorToast(liveCareModel.error);
}
},
onCallNotRespond: (SessionStatusModel sessionStatusModel) async{
GifLoaderDialogUtils.showMyDialog(context);
GifLoaderDialogUtils.showMyDialog(context);
await liveCareModel.endCall(widget.patient.vcId, sessionStatusModel.sessionStatus == 3,);
GifLoaderDialogUtils.hideDialog(context);
if (liveCareModel.state == ViewState.ErrorLocal) {
DrAppToastMsg.showErrorToast(liveCareModel.error);
}
});
} else
await VideoChannel.openVideoCallScreen(
kToken: liveCareModel.startCallRes.openTokenID,
kSessionId: liveCareModel.startCallRes.openSessionID,
kApiKey: '46209962',
vcId: widget.patient.vcId,
tokenID: await liveCareModel.getToken(),
generalId: GENERAL_ID,
doctorId: liveCareModel.doctorProfile!.doctorID,
onFailure: (String error) {
DrAppToastMsg.showErrorToast(error);
},
onCallEnd: () async {
GifLoaderDialogUtils.showMyDialog(context);
GifLoaderDialogUtils.showMyDialog(context);
await liveCareModel.endCall(
widget.patient.vcId!,
false,
);
GifLoaderDialogUtils.hideDialog(context);
if (liveCareModel.state == ViewState.ErrorLocal) {
DrAppToastMsg.showErrorToast(liveCareModel.error);
}
},
onCallNotRespond: (SessionStatusModel sessionStatusModel) async {
GifLoaderDialogUtils.showMyDialog(context);
GifLoaderDialogUtils.showMyDialog(context);
await liveCareModel.endCall(
widget.patient.vcId!,
sessionStatusModel.sessionStatus == 3,
);
GifLoaderDialogUtils.hideDialog(context);
if (liveCareModel.state == ViewState.ErrorLocal) {
DrAppToastMsg.showErrorToast(liveCareModel.error);
}
});
});
GifLoaderDialogUtils.hideDialog(context);
if (liveCareModel.state == ViewState.ErrorLocal) {
@ -93,17 +97,14 @@ class _EndCallScreenState extends State<EndCallScreen> {
}
}, isDartIcon: true, dartIcon: DoctorApp.call),
PatientProfileCardModel(
TranslationBase.of(context).endLC,
TranslationBase.of(context).consultation,
'',
'patient/vital_signs.png',
TranslationBase.of(context).endLC!, TranslationBase.of(context).consultation!, '', 'patient/vital_signs.png',
isInPatient: isInpatient, onTap: () {
Helpers.showConfirmationDialog(context,
"${TranslationBase.of(context).areYouSureYouWantTo} ${TranslationBase.of(context).endLC} ${TranslationBase.of(context).consultation} ?",
() async {
Navigator.of(context).pop();
GifLoaderDialogUtils.showMyDialog(context);
await liveCareModel.endCallWithCharge(widget.patient.vcId);
await liveCareModel.endCallWithCharge(widget.patient.vcId!);
GifLoaderDialogUtils.hideDialog(context);
if (liveCareModel.state == ViewState.ErrorLocal) {
DrAppToastMsg.showErrorToast(liveCareModel.error);
@ -113,10 +114,7 @@ class _EndCallScreenState extends State<EndCallScreen> {
}
});
}, isDartIcon: true, dartIcon: DoctorApp.end_consultaion),
PatientProfileCardModel(
TranslationBase.of(context).sendLC,
TranslationBase.of(context).instruction,
"",
PatientProfileCardModel(TranslationBase.of(context).sendLC!, TranslationBase.of(context).instruction!, "",
'patient/health_summary.png',
onTap: () {},
isInPatient: isInpatient,
@ -124,19 +122,11 @@ class _EndCallScreenState extends State<EndCallScreen> {
isDisable: true,
dartIcon: DoctorApp.send_instruction),
PatientProfileCardModel(
TranslationBase.of(context).transferTo,
TranslationBase.of(context).admin,
'',
'patient/health_summary.png', onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (BuildContext context) =>
LivaCareTransferToAdmin(patient: widget.patient)));
},
isInPatient: isInpatient,
isDartIcon: true,
dartIcon: DoctorApp.transfer_to_admin),
TranslationBase.of(context).transferTo!, TranslationBase.of(context).admin!, '', 'patient/health_summary.png',
onTap: () {
Navigator.push(context,
MaterialPageRoute(builder: (BuildContext context) => LivaCareTransferToAdmin(patient: widget.patient)));
}, isInPatient: isInpatient, isDartIcon: true, dartIcon: DoctorApp.transfer_to_admin),
];
return BaseView<LiveCarePatientViewModel>(
@ -145,14 +135,12 @@ class _EndCallScreenState extends State<EndCallScreen> {
},
builder: (_, model, w) => AppScaffold(
baseViewModel: model,
appBarTitle: TranslationBase.of(context).patientProfile,
appBarTitle: TranslationBase.of(context).patientProfile!,
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
isShowAppBar: true,
appBar: PatientProfileHeaderNewDesignAppBar(
widget.patient, arrivalType ?? '7', '1',
appBar: PatientProfileHeaderNewDesignAppBar(widget.patient, arrivalType ?? '7', '1',
isInpatient: isInpatient,
height: (widget.patient.patientStatusType != null &&
widget.patient.patientStatusType == 43)
height: (widget.patient.patientStatusType != null && widget.patient.patientStatusType == 43)
? 210
: isDischargedPatient
? 240
@ -167,8 +155,7 @@ class _EndCallScreenState extends State<EndCallScreen> {
child: ListView(
children: [
Padding(
padding:
const EdgeInsets.symmetric(vertical: 15.0, horizontal: 15),
padding: const EdgeInsets.symmetric(vertical: 15.0, horizontal: 15),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
@ -193,8 +180,7 @@ class _EndCallScreenState extends State<EndCallScreen> {
crossAxisCount: 3,
itemCount: cardsList.length,
staggeredTileBuilder: (int index) => StaggeredTile.fit(1),
itemBuilder: (BuildContext context, int index) =>
PatientProfileButton(
itemBuilder: (BuildContext context, int index) => PatientProfileButton(
patient: widget.patient,
patientType: patientType,
arrivalType: arrivalType,
@ -205,8 +191,7 @@ class _EndCallScreenState extends State<EndCallScreen> {
route: cardsList[index].route,
icon: cardsList[index].icon,
isInPatient: cardsList[index].isInPatient,
isDischargedPatient:
cardsList[index].isDischargedPatient,
isDischargedPatient: cardsList[index].isDischargedPatient,
isDisable: cardsList[index].isDisable,
onTap: cardsList[index].onTap,
isLoading: cardsList[index].isLoading,
@ -246,7 +231,7 @@ class _EndCallScreenState extends State<EndCallScreen> {
fontWeight: FontWeight.w700,
color: Colors.red[600],
title: "Close", //TranslationBase.of(context).close,
onPressed: () {
onPressed: () {
Navigator.of(context).pop();
},
),

@ -23,21 +23,20 @@ import 'package:speech_to_text/speech_to_text.dart' as stt;
class LivaCareTransferToAdmin extends StatefulWidget {
final PatiantInformtion patient;
const LivaCareTransferToAdmin({Key key, this.patient}) : super(key: key);
const LivaCareTransferToAdmin({Key? key, required this.patient}) : super(key: key);
@override
_LivaCareTransferToAdminState createState() =>
_LivaCareTransferToAdminState();
_LivaCareTransferToAdminState createState() => _LivaCareTransferToAdminState();
}
class _LivaCareTransferToAdminState extends State<LivaCareTransferToAdmin> {
stt.SpeechToText speech = stt.SpeechToText();
var reconizedWord;
var event = RobotProvider();
ProjectViewModel projectViewModel;
late ProjectViewModel projectViewModel;
TextEditingController noteController = TextEditingController();
String noteError;
late String noteError;
void initState() {
requestPermissions();
@ -59,8 +58,7 @@ class _LivaCareTransferToAdminState extends State<LivaCareTransferToAdmin> {
onModelReady: (model) {},
builder: (_, model, w) => AppScaffold(
baseViewModel: model,
appBarTitle:
"${TranslationBase.of(context).transferTo}${TranslationBase.of(context).admin}",
appBarTitle: "${TranslationBase.of(context).transferTo}${TranslationBase.of(context).admin}",
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
isShowAppBar: true,
body: Container(
@ -84,17 +82,13 @@ class _LivaCareTransferToAdminState extends State<LivaCareTransferToAdmin> {
),
Positioned(
top: -2, //MediaQuery.of(context).size.height * 0,
right: projectViewModel.isArabic
? MediaQuery.of(context).size.width * 0.75
: 15,
right: projectViewModel.isArabic ? MediaQuery.of(context).size.width * 0.75 : 15,
child: Column(
children: [
IconButton(
icon: Icon(DoctorApp.speechtotext,
color: Colors.black, size: 35),
icon: Icon(DoctorApp.speechtotext, color: Colors.black, size: 35),
onPressed: () {
initSpeechState()
.then((value) => {onVoiceText()});
initSpeechState().then((value) => {onVoiceText()});
},
),
],
@ -105,31 +99,30 @@ class _LivaCareTransferToAdminState extends State<LivaCareTransferToAdmin> {
),
),
ButtonBottomSheet(
title:
"${TranslationBase.of(context).transferTo}${TranslationBase.of(context).admin}",
title: "${TranslationBase.of(context).transferTo}${TranslationBase.of(context).admin}",
onPressed: () {
setState(() {
if (noteController.text.isEmpty) {
noteError = TranslationBase.of(context).emptyMessage;
noteError = TranslationBase.of(context).emptyMessage!;
} else {
noteError = null;
noteError = null!;
}
if (noteController.text.isNotEmpty) {
Helpers.showConfirmationDialog(context,
"${TranslationBase.of(context).areYouSureYouWantTo} ${TranslationBase.of(context).transferTo}${TranslationBase.of(context).admin} ?",
() async {
Navigator.of(context).pop();
GifLoaderDialogUtils.showMyDialog(context);
model.endCallWithCharge(widget.patient.vcId);
GifLoaderDialogUtils.hideDialog(context);
if (model.state == ViewState.ErrorLocal) {
DrAppToastMsg.showErrorToast(model.error);
} else {
Navigator.of(context).pop();
Navigator.of(context).pop();
Navigator.of(context).pop();
}
});
() async {
Navigator.of(context).pop();
GifLoaderDialogUtils.showMyDialog(context);
model.endCallWithCharge(widget.patient.vcId!);
GifLoaderDialogUtils.hideDialog(context);
if (model.state == ViewState.ErrorLocal) {
DrAppToastMsg.showErrorToast(model.error);
} else {
Navigator.of(context).pop();
Navigator.of(context).pop();
Navigator.of(context).pop();
}
});
}
});
},
@ -144,8 +137,7 @@ class _LivaCareTransferToAdminState extends State<LivaCareTransferToAdmin> {
onVoiceText() async {
new SpeechToText(context: context).showAlertDialog(context);
var lang = TranslationBase.of(AppGlobal.CONTEX).locale.languageCode;
bool available = await speech.initialize(
onStatus: statusListener, onError: errorListener);
bool available = await speech.initialize(onStatus: statusListener, onError: errorListener);
if (available) {
speech.listen(
onResult: resultListener,
@ -189,8 +181,7 @@ class _LivaCareTransferToAdminState extends State<LivaCareTransferToAdmin> {
}
Future<void> initSpeechState() async {
bool hasSpeech = await speech.initialize(
onError: errorListener, onStatus: statusListener);
bool hasSpeech = await speech.initialize(onError: errorListener, onStatus: statusListener);
print(hasSpeech);
if (!mounted) return;
}

@ -24,13 +24,13 @@ class LiveCarePatientScreen extends StatefulWidget {
class _LiveCarePatientScreenState extends State<LiveCarePatientScreen> {
final _controller = TextEditingController();
Timer timer;
LiveCarePatientViewModel _liveCareViewModel;
late Timer timer;
late LiveCarePatientViewModel _liveCareViewModel;
@override
void initState() {
super.initState();
timer = Timer.periodic(Duration(seconds: 10), (Timer t) {
if(_liveCareViewModel != null){
if (_liveCareViewModel != null) {
_liveCareViewModel.getPendingPatientERForDoctorApp(isFromTimer: true);
}
});
@ -38,7 +38,7 @@ class _LiveCarePatientScreenState extends State<LiveCarePatientScreen> {
@override
void dispose() {
_liveCareViewModel = null;
_liveCareViewModel = null!;
timer?.cancel();
super.dispose();
}
@ -49,7 +49,6 @@ class _LiveCarePatientScreenState extends State<LiveCarePatientScreen> {
onModelReady: (model) async {
_liveCareViewModel = model;
await model.getPendingPatientERForDoctorApp();
},
builder: (_, model, w) => AppScaffold(
baseViewModel: model,
@ -82,7 +81,9 @@ class _LiveCarePatientScreenState extends State<LiveCarePatientScreen> {
]),
),
),
SizedBox(height: 20,),
SizedBox(
height: 20,
),
Center(
child: FractionallySizedBox(
widthFactor: .9,
@ -90,44 +91,36 @@ class _LiveCarePatientScreenState extends State<LiveCarePatientScreen> {
width: double.maxFinite,
height: 75,
decoration: BoxDecoration(
borderRadius: BorderRadius.all(
Radius.circular(6.0)),
borderRadius: BorderRadius.all(Radius.circular(6.0)),
border: Border.all(
width: 1.0,
color: Color(0xffCCCCCC),
),
color: Colors.white),
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Padding(
padding: EdgeInsets.only(
left: 10, top: 10),
child: AppText(
TranslationBase.of(
context)
.searchPatientName,
fontSize: 13,
)),
AppTextFormField(
// focusNode: focusProject,
controller: _controller,
borderColor: Colors.white,
prefix: IconButton(
icon: Icon(
DoctorApp.filter_1,
color: Colors.black,
),
iconSize: 20,
padding:
EdgeInsets.only(
bottom: 30),
),
onChanged: (String str) {
model.searchData(str);
}),
])),
child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
Padding(
padding: EdgeInsets.only(left: 10, top: 10),
child: AppText(
TranslationBase.of(context).searchPatientName,
fontSize: 13,
)),
AppTextFormField(
// focusNode: focusProject,
controller: _controller,
borderColor: Colors.white,
prefix: IconButton(
onPressed: () {},
icon: Icon(
DoctorApp.filter_1,
color: Colors.black,
),
iconSize: 20,
padding: EdgeInsets.only(bottom: 30),
),
onChanged: (String str) {
model.searchData(str);
}),
])),
),
),
model.state == ViewState.Idle
@ -136,44 +129,44 @@ class _LiveCarePatientScreenState extends State<LiveCarePatientScreen> {
child: model.filterData.isEmpty
? Center(
child: ErrorMessage(
error: TranslationBase.of(context)
.youDontHaveAnyPatient,
error: TranslationBase.of(context).youDontHaveAnyPatient!,
),
)
: ListView.builder(
scrollDirection: Axis.vertical,
shrinkWrap: true,
itemCount: model.filterData.length,
itemBuilder: (BuildContext ctxt, int index) {
return Padding(
padding: EdgeInsets.all(8.0),
child: PatientCard(
patientInfo: model.filterData[index],
patientType: "0",
arrivalType: "0",
isFromSearch: false,
isInpatient: false,
isFromLiveCare:true,
onTap: () {
// TODO change the parameter to daynamic
Navigator.of(context).pushNamed(
PATIENTS_PROFILE,
arguments: {
"patient": model.filterData[index],
"patientType": "0",
"isSearch": false,
"isInpatient": false,
"arrivalType": "0",
"isSearchAndOut": false,
"isFromLiveCare":true,
});
},
// isFromSearch: widget.isSearch,
),
);
})),
) : Expanded(
child: AppLoaderWidget(containerColor: Colors.transparent,)),
itemCount: model.filterData.length,
itemBuilder: (BuildContext ctxt, int index) {
return Padding(
padding: EdgeInsets.all(8.0),
child: PatientCard(
patientInfo: model.filterData[index],
patientType: "0",
arrivalType: "0",
isFromSearch: false,
isInpatient: false,
isFromLiveCare: true,
onTap: () {
// TODO change the parameter to daynamic
Navigator.of(context).pushNamed(PATIENTS_PROFILE, arguments: {
"patient": model.filterData[index],
"patientType": "0",
"isSearch": false,
"isInpatient": false,
"arrivalType": "0",
"isSearchAndOut": false,
"isFromLiveCare": true,
});
},
// isFromSearch: widget.isSearch,
),
);
})),
)
: Expanded(
child: AppLoaderWidget(
containerColor: Colors.transparent,
)),
],
),
),

@ -21,7 +21,7 @@ DrAppSharedPreferances sharedPref = DrAppSharedPreferances();
class LiveCarePandingListScreen extends StatefulWidget {
// In the constructor, require a item id.
LiveCarePandingListScreen({Key key}) : super(key: key);
LiveCarePandingListScreen({Key? key}) : super(key: key);
@override
_LiveCarePandingListState createState() => _LiveCarePandingListState();
@ -31,7 +31,7 @@ class _LiveCarePandingListState extends State<LiveCarePandingListScreen> {
List<LiveCarePendingListResponse> _data = [];
Helpers helpers = new Helpers();
bool _isInit = true;
LiveCareViewModel _liveCareProvider;
late LiveCareViewModel _liveCareProvider;
@override
void didChangeDependencies() {
super.didChangeDependencies();
@ -45,7 +45,7 @@ class _LiveCarePandingListState extends State<LiveCarePandingListScreen> {
@override
Widget build(BuildContext context) {
return AppScaffold(
appBarTitle: TranslationBase.of(context).livecare,
appBarTitle: TranslationBase.of(context).livecare!,
body: Container(
child: ListView(scrollDirection: Axis.vertical,
@ -61,13 +61,11 @@ class _LiveCarePandingListState extends State<LiveCarePandingListScreen> {
? Center(
child: Text(
_liveCareProvider.errorMsg,
style: TextStyle(
color: Theme.of(context).errorColor),
style: TextStyle(color: Theme.of(context).errorColor),
),
)
: Column(
children: _liveCareProvider.liveCarePendingList
.map<Widget>((item) {
children: _liveCareProvider.liveCarePendingList.map<Widget>((item) {
return Container(
decoration: myBoxDecoration(),
child: InkWell(
@ -86,47 +84,28 @@ class _LiveCarePandingListState extends State<LiveCarePandingListScreen> {
Column(
children: <Widget>[
Container(
decoration:
BoxDecoration(
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment(
-1,
-1),
end: Alignment(
1, 1),
begin: Alignment(-1, -1),
end: Alignment(1, 1),
colors: [
Colors.grey[
100],
Colors.grey[
200],
Colors.grey[100]!,
Colors.grey[200]!,
]),
boxShadow: [
BoxShadow(
color: Color.fromRGBO(
0,
0,
0,
0.08),
offset: Offset(
0.0,
5.0),
blurRadius:
16.0)
color: Color.fromRGBO(0, 0, 0, 0.08),
offset: Offset(0.0, 5.0),
blurRadius: 16.0)
],
borderRadius:
BorderRadius.all(
Radius.circular(
50.0)),
borderRadius: BorderRadius.all(Radius.circular(50.0)),
),
width: 80,
height: 80,
child: Icon(
item.gender ==
"1"
? DoctorApp
.male
: DoctorApp
.female_icon,
item.gender == "1"
? DoctorApp.male
: DoctorApp.female_icon,
size: 80,
)),
],
@ -135,48 +114,28 @@ class _LiveCarePandingListState extends State<LiveCarePandingListScreen> {
width: 20,
),
Column(
crossAxisAlignment:
CrossAxisAlignment
.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
AppText(
item.patientName,
fontSize: 2.0 *
SizeConfig
.textMultiplier,
fontWeight:
FontWeight
.bold,
fontSize: 2.0 * SizeConfig.textMultiplier,
fontWeight: FontWeight.bold,
),
SizedBox(
height: 8,
),
AppText(
TranslationBase.of(
context)
.fileNo +
item.patientID
.toString(),
fontSize: 2.0 *
SizeConfig
.textMultiplier,
fontWeight:
FontWeight
.bold,
TranslationBase.of(context).fileNo! +
item.patientID.toString(),
fontSize: 2.0 * SizeConfig.textMultiplier,
fontWeight: FontWeight.bold,
),
AppText(
TranslationBase.of(
context)
.age +
TranslationBase.of(context).age! +
' ' +
item.age
.toString(),
fontSize: 2.0 *
SizeConfig
.textMultiplier,
fontWeight:
FontWeight
.bold,
item.age.toString(),
fontSize: 2.0 * SizeConfig.textMultiplier,
fontWeight: FontWeight.bold,
),
SizedBox(
height: 8,
@ -193,8 +152,7 @@ class _LiveCarePandingListState extends State<LiveCarePandingListScreen> {
Icons.video_call,
size: 40,
),
color: Colors
.green, //Colors.black,
color: Colors.green, //Colors.black,
onPressed: () => {
_isInit = true,
// sharedPref.setObj(
@ -255,9 +213,9 @@ class _LiveCarePandingListState extends State<LiveCarePandingListScreen> {
MyGlobals myGlobals = new MyGlobals();
class MyGlobals {
GlobalKey _scaffoldKey;
GlobalKey? _scaffoldKey;
MyGlobals() {
_scaffoldKey = GlobalKey();
}
GlobalKey get scaffoldKey => _scaffoldKey;
GlobalKey get scaffoldKey => _scaffoldKey!;
}

@ -18,7 +18,7 @@ class VideoCallPage extends StatefulWidget {
final PatiantInformtion patientData;
final listContext;
final LiveCarePatientViewModel model;
VideoCallPage({this.patientData, this.listContext, this.model});
VideoCallPage({required this.patientData, this.listContext, required this.model});
@override
_VideoCallPageState createState() => _VideoCallPageState();
@ -27,10 +27,10 @@ class VideoCallPage extends StatefulWidget {
DrAppSharedPreferances sharedPref = DrAppSharedPreferances();
class _VideoCallPageState extends State<VideoCallPage> {
Timer _timmerInstance;
late Timer _timmerInstance;
int _start = 0;
String _timmer = '';
LiveCareViewModel _liveCareProvider;
late LiveCareViewModel _liveCareProvider;
bool _isInit = true;
var _tokenData;
bool isTransfer = false;
@ -75,13 +75,13 @@ class _VideoCallPageState extends State<VideoCallPage> {
},
onCallEnd: () {
//TODO handling onCallEnd
WidgetsBinding.instance.addPostFrameCallback((_) {
WidgetsBinding.instance!.addPostFrameCallback((_) {
changeRoute(context);
});
},
onCallNotRespond: (SessionStatusModel sessionStatusModel) {
//TODO handling onCalNotRespondEnd
WidgetsBinding.instance.addPostFrameCallback((_) {
WidgetsBinding.instance!.addPostFrameCallback((_) {
changeRoute(context);
});
});
@ -96,8 +96,7 @@ class _VideoCallPageState extends State<VideoCallPage> {
});
connectOpenTok(result);
}).catchError((error) =>
{Helpers.showErrorToast(error), Navigator.of(context).pop()});
}).catchError((error) => {Helpers.showErrorToast(error), Navigator.of(context).pop()});
}
@override
@ -125,20 +124,14 @@ class _VideoCallPageState extends State<VideoCallPage> {
),
Text(
_start == 0 ? 'Dailing' : 'Connected',
style: TextStyle(
color: Colors.deepPurpleAccent,
fontWeight: FontWeight.w300,
fontSize: 15),
style: TextStyle(color: Colors.deepPurpleAccent, fontWeight: FontWeight.w300, fontSize: 15),
),
SizedBox(
height: MediaQuery.of(context).size.height * 0.02,
),
Text(
widget.patientData.fullName,
style: TextStyle(
color: Colors.deepPurpleAccent,
fontWeight: FontWeight.w900,
fontSize: 20),
widget.patientData.fullName!,
style: TextStyle(color: Colors.deepPurpleAccent, fontWeight: FontWeight.w900, fontSize: 20),
),
SizedBox(
height: MediaQuery.of(context).size.height * 0.02,
@ -146,10 +139,7 @@ class _VideoCallPageState extends State<VideoCallPage> {
Container(
child: Text(
_start == 0 ? 'Connecting...' : _timmer.toString(),
style: TextStyle(
color: Colors.deepPurpleAccent,
fontWeight: FontWeight.w300,
fontSize: 15),
style: TextStyle(color: Colors.deepPurpleAccent, fontWeight: FontWeight.w300, fontSize: 15),
)),
SizedBox(
height: MediaQuery.of(context).size.height * 0.02,
@ -196,8 +186,8 @@ class _VideoCallPageState extends State<VideoCallPage> {
_showAlert(BuildContext context) async {
await showDialog(
context: context,
builder: (dialogContex) => AlertDialog(content: StatefulBuilder(
builder: (BuildContext context, StateSetter setState) {
builder: (dialogContex) =>
AlertDialog(content: StatefulBuilder(builder: (BuildContext context, StateSetter setState) {
return Container(
height: MediaQuery.of(context).size.height * 0.7,
width: MediaQuery.of(context).size.width * .9,
@ -210,8 +200,7 @@ class _VideoCallPageState extends State<VideoCallPage> {
top: -40.0,
child: InkResponse(
onTap: () {
Navigator.of(context, rootNavigator: true)
.pop('dialog');
Navigator.of(context, rootNavigator: true).pop('dialog');
Navigator.of(context).pop();
},
child: CircleAvatar(
@ -229,8 +218,7 @@ class _VideoCallPageState extends State<VideoCallPage> {
padding: EdgeInsets.all(8.0),
child: RaisedButton(
onPressed: () => {endCall()},
child:
Text(TranslationBase.of(context).endcall),
child: Text(TranslationBase.of(context).endcall!),
color: Colors.red,
textColor: Colors.white,
)),
@ -238,8 +226,7 @@ class _VideoCallPageState extends State<VideoCallPage> {
padding: EdgeInsets.all(8.0),
child: RaisedButton(
onPressed: () => {resumeCall()},
child:
Text(TranslationBase.of(context).resumecall),
child: Text(TranslationBase.of(context).resumecall!),
color: Colors.green[900],
textColor: Colors.white,
),
@ -248,8 +235,7 @@ class _VideoCallPageState extends State<VideoCallPage> {
padding: EdgeInsets.all(8.0),
child: RaisedButton(
onPressed: () => {endCallWithCharge()},
child: Text(TranslationBase.of(context)
.endcallwithcharge),
child: Text(TranslationBase.of(context).endcallwithcharge!),
textColor: Colors.white,
),
),
@ -259,8 +245,7 @@ class _VideoCallPageState extends State<VideoCallPage> {
onPressed: () => {
setState(() => {isTransfer = true})
},
child: Text(
TranslationBase.of(context).transfertoadmin),
child: Text(TranslationBase.of(context).transfertoadmin!),
color: Colors.yellow[900],
),
),
@ -274,14 +259,11 @@ class _VideoCallPageState extends State<VideoCallPage> {
child: TextField(
maxLines: 3,
controller: notes,
decoration: InputDecoration.collapsed(
hintText:
"Enter your notes here"),
decoration: InputDecoration.collapsed(hintText: "Enter your notes here"),
)),
Center(
child: RaisedButton(
onPressed: () =>
{this.transferToAdmin(notes)},
onPressed: () => {this.transferToAdmin(notes)},
child: Text('Transfer'),
color: Colors.yellow[900],
))
@ -303,33 +285,24 @@ class _VideoCallPageState extends State<VideoCallPage> {
transferToAdmin(notes) {
closeRoute();
_liveCareProvider
.transfterToAdmin(widget.patientData, notes)
.then((result) {
_liveCareProvider.transfterToAdmin(widget.patientData, notes).then((result) {
connectOpenTok(result);
}).catchError((error) =>
{Helpers.showErrorToast(error), Navigator.of(context).pop()});
}).catchError((error) => {Helpers.showErrorToast(error), Navigator.of(context).pop()});
}
endCall() {
closeRoute();
_liveCareProvider
.endCall(widget.patientData, false, doctorprofile['DoctorID'])
.then((result) {
_liveCareProvider.endCall(widget.patientData, false, doctorprofile['DoctorID']).then((result) {
print(result);
}).catchError((error) =>
{Helpers.showErrorToast(error), Navigator.of(context).pop()});
}).catchError((error) => {Helpers.showErrorToast(error), Navigator.of(context).pop()});
}
endCallWithCharge() {
_liveCareProvider
.endCallWithCharge(widget.patientData.vcId, doctorprofile['DoctorID'])
.then((result) {
_liveCareProvider.endCallWithCharge(widget.patientData.vcId, doctorprofile['DoctorID']).then((result) {
closeRoute();
print('end callwith charge');
print(result);
}).catchError((error) =>
{Helpers.showErrorToast(error), Navigator.of(context).pop()});
}).catchError((error) => {Helpers.showErrorToast(error), Navigator.of(context).pop()});
}
closeRoute() {

@ -17,19 +17,17 @@ class HealthSummaryPage extends StatefulWidget {
}
class _HealthSummaryPageState extends State<HealthSummaryPage> {
PatiantInformtion patient;
late PatiantInformtion patient;
@override
Widget build(BuildContext context) {
final routeArgs = ModalRoute.of(context).settings.arguments as Map;
final routeArgs = ModalRoute.of(context)!.settings.arguments as Map;
patient = routeArgs['patient'];
String patientType = routeArgs['patientType'];
String arrivalType = routeArgs['arrivalType'];
bool isInpatient = routeArgs['isInpatient'];
return BaseView<MedicalFileViewModel>(
onModelReady: (model) => model.getMedicalFile(mrn: patient.patientId),
builder:
(BuildContext context, MedicalFileViewModel model, Widget child) =>
AppScaffold(
builder: (BuildContext context, MedicalFileViewModel model, Widget? child) => AppScaffold(
appBar: PatientProfileHeaderNewDesignAppBar(
patient,
patientType.toString() ?? "0",
@ -37,7 +35,7 @@ class _HealthSummaryPageState extends State<HealthSummaryPage> {
isInpatient: isInpatient,
),
isShowAppBar: true,
appBarTitle: TranslationBase.of(context).medicalReport.toUpperCase(),
appBarTitle: TranslationBase.of(context).medicalReport!.toUpperCase(),
body: NetworkBaseView(
baseViewModel: model,
child: SingleChildScrollView(
@ -45,8 +43,7 @@ class _HealthSummaryPageState extends State<HealthSummaryPage> {
child: Column(
children: [
Padding(
padding:
EdgeInsets.symmetric(horizontal: 12.0, vertical: 8.0),
padding: EdgeInsets.symmetric(horizontal: 12.0, vertical: 8.0),
child: Container(
child: Padding(
padding: const EdgeInsets.all(8.0),
@ -76,112 +73,65 @@ class _HealthSummaryPageState extends State<HealthSummaryPage> {
),
),
),
(model.medicalFileList != null &&
model.medicalFileList.length != 0)
(model.medicalFileList != null && model.medicalFileList.length != 0)
? ListView.builder(
//physics: ,
physics: NeverScrollableScrollPhysics(),
scrollDirection: Axis.vertical,
shrinkWrap: true,
itemCount: model.medicalFileList[0].entityList[0]
.timelines.length,
itemCount: model.medicalFileList[0].entityList![0].timelines!.length,
itemBuilder: (BuildContext ctxt, int index) {
return InkWell(
onTap: () {
if (model
.medicalFileList[0]
.entityList[0]
.timelines[index]
.timeLineEvents[0]
.consulations
.length !=
if (model.medicalFileList[0].entityList![0].timelines![index].timeLineEvents![0]
.consulations!.length !=
0)
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => MedicalFileDetails(
age: patient.age is String
? patient.age ?? ""
: "${patient.age}",
firstName: patient.firstName,
lastName: patient.lastName,
gender: patient.genderDescription,
age: patient.age is String ? patient.age ?? "" : "${patient.age}",
firstName: patient.firstName ?? "",
lastName: patient.lastName ?? "",
gender: patient.genderDescription ?? "",
encounterNumber: index,
pp: patient.patientId,
patient: patient,
doctorName: model
.medicalFileList[0]
.entityList[0]
.timelines[index]
.timeLineEvents[0]
.consulations
.isNotEmpty
? model
.medicalFileList[0]
.entityList[0]
.timelines[index]
.doctorName
doctorName: model.medicalFileList[0].entityList![0].timelines![index]
.timeLineEvents![0].consulations!.isNotEmpty
? model.medicalFileList[0].entityList![0].timelines![index].doctorName
: "",
clinicName: model
.medicalFileList[0]
.entityList[0]
.timelines[index]
.timeLineEvents[0]
.consulations
.isNotEmpty
? model
.medicalFileList[0]
.entityList[0]
.timelines[index]
.clinicName
clinicName: model.medicalFileList[0].entityList![0].timelines![index]
.timeLineEvents![0].consulations!.isNotEmpty
? model.medicalFileList[0].entityList![0].timelines![index].clinicName
: "",
doctorImage: model
.medicalFileList[0]
.entityList[0]
.timelines[index]
.timeLineEvents[0]
.consulations
.isNotEmpty
? model
.medicalFileList[0]
.entityList[0]
.timelines[index]
.doctorImage
doctorImage: model.medicalFileList[0].entityList![0].timelines![index]
.timeLineEvents![0].consulations!.isNotEmpty
? model.medicalFileList[0].entityList![0].timelines![index].doctorImage
: "",
episode: model.medicalFileList[0].entityList[0].timelines[index].timeLineEvents[0].consulations.isNotEmpty
? model.medicalFileList[0].entityList[0].timelines[index].timeLineEvents[0].consulations[0].episodeID.toString()
episode: model.medicalFileList[0].entityList![0].timelines![index]
.timeLineEvents![0].consulations!.isNotEmpty
? model.medicalFileList[0].entityList![0].timelines![index]
.timeLineEvents![0].consulations![0].episodeID
.toString()
: "",
vistDate: model.medicalFileList[0].entityList[0].timelines[index].date.toString())),
vistDate: model.medicalFileList[0].entityList![0].timelines![index].date
.toString())),
);
},
child: DoctorCard(
doctorName: model
.medicalFileList[0]
.entityList[0]
.timelines[index]
.doctorName,
clinic: model.medicalFileList[0].entityList[0]
.timelines[index].clinicName,
branch: model.medicalFileList[0].entityList[0]
.timelines[index].projectName,
profileUrl: model
.medicalFileList[0]
.entityList[0]
.timelines[index]
.doctorImage,
appointmentDate:
AppDateUtils.getDateTimeFromServerFormat(
model.medicalFileList[0].entityList[0]
.timelines[index].date,
doctorName:
model.medicalFileList[0].entityList![0].timelines![index].doctorName ?? "",
clinic: model.medicalFileList[0].entityList![0].timelines![index].clinicName ?? "",
branch: model.medicalFileList[0].entityList![0].timelines![index].projectName ?? "",
profileUrl:
model.medicalFileList[0].entityList![0].timelines![index].doctorImage ?? "",
appointmentDate: AppDateUtils.getDateTimeFromServerFormat(
model.medicalFileList[0].entityList![0].timelines![index].date ?? "",
),
isPrescriptions: true,
isShowEye: model
.medicalFileList[0]
.entityList[0]
.timelines[index]
.timeLineEvents[0]
.consulations
.length !=
isShowEye: model.medicalFileList[0].entityList![0].timelines![index]
.timeLineEvents![0].consulations!.length !=
0
? true
: false),
@ -197,8 +147,7 @@ class _HealthSummaryPageState extends State<HealthSummaryPage> {
Image.asset('assets/images/no-data.png'),
Padding(
padding: const EdgeInsets.all(8.0),
child: AppText(TranslationBase.of(context)
.noMedicalFileFound),
child: AppText(TranslationBase.of(context).noMedicalFileFound),
)
],
),

@ -21,24 +21,24 @@ class MedicalFileDetails extends StatefulWidget {
int encounterNumber;
int pp;
PatiantInformtion patient;
String clinicName;
String? clinicName;
String episode;
String doctorName;
String? doctorName;
String vistDate;
String doctorImage;
String? doctorImage;
MedicalFileDetails(
{this.age,
this.firstName,
this.lastName,
this.gender,
this.encounterNumber,
this.pp,
this.patient,
{required this.age,
required this.firstName,
required this.lastName,
required this.gender,
required this.encounterNumber,
required this.pp,
required this.patient,
this.doctorName,
this.vistDate,
required this.vistDate,
this.clinicName,
this.episode,
required this.episode,
this.doctorImage});
@override
@ -50,11 +50,11 @@ class MedicalFileDetails extends StatefulWidget {
encounterNumber: encounterNumber,
pp: pp,
patient: patient,
clinicName: clinicName,
doctorName: doctorName,
clinicName: clinicName!,
doctorName: doctorName!,
episode: episode,
vistDate: vistDate,
doctorImage: doctorImage,
doctorImage: doctorImage!,
);
}
@ -73,18 +73,18 @@ class _MedicalFileDetailsState extends State<MedicalFileDetails> {
String doctorImage;
_MedicalFileDetailsState(
{this.age,
this.firstName,
this.lastName,
this.gender,
this.encounterNumber,
this.pp,
this.patient,
this.doctorName,
this.vistDate,
this.clinicName,
this.episode,
this.doctorImage});
{required this.age,
required this.firstName,
required this.lastName,
required this.gender,
required this.encounterNumber,
required this.pp,
required this.patient,
required this.doctorName,
required this.vistDate,
required this.clinicName,
required this.episode,
required this.doctorImage});
bool isPhysicalExam = true;
bool isProcedureExpand = true;
bool isHistoryExpand = true;
@ -99,26 +99,23 @@ class _MedicalFileDetailsState extends State<MedicalFileDetails> {
model.getMedicalFile(mrn: pp);
}
},
builder:
(BuildContext context, MedicalFileViewModel model, Widget child) =>
AppScaffold(
builder: (BuildContext context, MedicalFileViewModel model, Widget? child) => AppScaffold(
appBar: PatientProfileHeaderWhitAppointmentAppBar(
patient: patient,
patientType: patient.patientType.toString() ?? "0",
arrivalType: patient.arrivedOn.toString() ?? 0,
arrivalType: patient.arrivedOn.toString()!,
doctorName: doctorName,
profileUrl: doctorImage,
clinic: clinicName,
isPrescriptions: true,
isMedicalFile: true,
episode: episode,
vistDate:
'${AppDateUtils.getDayMonthYearDateFormatted(AppDateUtils.getDateTimeFromServerFormat(
vistDate,
), isArabic: projectViewModel.isArabic)}',
vistDate: '${AppDateUtils.getDayMonthYearDateFormatted(AppDateUtils.getDateTimeFromServerFormat(
vistDate,
), isArabic: projectViewModel.isArabic)}',
),
isShowAppBar: true,
appBarTitle: TranslationBase.of(context).medicalReport.toUpperCase(),
appBarTitle: TranslationBase.of(context).medicalReport!.toUpperCase(),
body: NetworkBaseView(
baseViewModel: model,
child: SingleChildScrollView(
@ -127,13 +124,8 @@ class _MedicalFileDetailsState extends State<MedicalFileDetails> {
child: Column(
children: [
model.medicalFileList.length != 0 &&
model
.medicalFileList[0]
.entityList[0]
.timelines[encounterNumber]
.timeLineEvents[0]
.consulations
.length !=
model.medicalFileList[0].entityList![0].timelines![encounterNumber].timeLineEvents![0]
.consulations!.length !=
0
? Padding(
padding: EdgeInsets.all(10.0),
@ -142,109 +134,81 @@ class _MedicalFileDetailsState extends State<MedicalFileDetails> {
children: [
SizedBox(height: 25.0),
if (model.medicalFileList.length != 0 &&
model
.medicalFileList[0]
.entityList[0]
.timelines[encounterNumber]
.timeLineEvents[0]
.consulations
.length !=
model.medicalFileList[0].entityList![0].timelines![encounterNumber]
.timeLineEvents![0].consulations!.length !=
0)
Container(
width: double.infinity,
margin: EdgeInsets.only(
top: 10, left: 10, right: 10),
margin: EdgeInsets.only(top: 10, left: 10, right: 10),
padding: EdgeInsets.all(8.0),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(
Radius.circular(10.0),
),
border: Border.all(
color: Colors.grey[200],
width: 0.5),
border: Border.all(color: Colors.grey[200]!, width: 0.5),
),
child: Padding(
padding: const EdgeInsets.all(15.0),
child: HeaderBodyExpandableNotifier(
headerWidget: Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: [
AppText(
TranslationBase.of(
context)
.historyOfPresentIllness
TranslationBase.of(context)
.historyOfPresentIllness!
.toUpperCase(),
variant: isHistoryExpand
? "bodyText"
: '',
bold: isHistoryExpand
? true
: true,
variant: isHistoryExpand ? "bodyText" : '',
bold: isHistoryExpand ? true : true,
color: Colors.black),
],
),
InkWell(
onTap: () {
setState(() {
isHistoryExpand =
!isHistoryExpand;
isHistoryExpand = !isHistoryExpand;
});
},
child: Icon(isHistoryExpand
? EvaIcons.arrowUp
: EvaIcons.arrowDown))
child: Icon(isHistoryExpand ? EvaIcons.arrowUp : EvaIcons.arrowDown))
],
),
bodyWidget: ListView.builder(
physics:
NeverScrollableScrollPhysics(),
physics: NeverScrollableScrollPhysics(),
scrollDirection: Axis.vertical,
shrinkWrap: true,
itemCount: model
.medicalFileList[0]
.entityList[0]
.timelines[encounterNumber]
.timeLineEvents[0]
.consulations[0]
.lstCheifComplaint
.entityList![0]
.timelines![encounterNumber]
.timeLineEvents![0]
.consulations![0]
.lstCheifComplaint!
.length,
itemBuilder: (BuildContext ctxt,
int index) {
itemBuilder: (BuildContext ctxt, int index) {
return Padding(
padding: EdgeInsets.all(8.0),
child: Container(
child: Column(
mainAxisAlignment:
MainAxisAlignment
.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Row(
children: [
Expanded(
child: AppText(
model
.medicalFileList[
0]
.entityList[
0]
.timelines[
encounterNumber]
.timeLineEvents[
0]
.consulations[
0]
.lstCheifComplaint[
index]
.hOPI
.medicalFileList[0]
.entityList![0]
.timelines![encounterNumber]
.timeLineEvents![0]
.consulations![0]
.lstCheifComplaint![index]
.hOPI!
.trim(),
),
),
SizedBox(
width: 35.0),
SizedBox(width: 35.0),
],
),
],
@ -264,86 +228,62 @@ class _MedicalFileDetailsState extends State<MedicalFileDetails> {
height: 30,
),
if (model.medicalFileList.length != 0 &&
model
.medicalFileList[0]
.entityList[0]
.timelines[encounterNumber]
.timeLineEvents[0]
.consulations
.length !=
model.medicalFileList[0].entityList![0].timelines![encounterNumber]
.timeLineEvents![0].consulations!.length !=
0)
Container(
width: double.infinity,
margin: EdgeInsets.only(
top: 10, left: 10, right: 10),
margin: EdgeInsets.only(top: 10, left: 10, right: 10),
padding: EdgeInsets.all(8.0),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(
Radius.circular(10.0),
),
border: Border.all(
color: Colors.grey[200],
width: 0.5),
border: Border.all(color: Colors.grey[200]!, width: 0.5),
),
child: Padding(
padding: const EdgeInsets.all(15.0),
child: HeaderBodyExpandableNotifier(
headerWidget: Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: [
AppText(
TranslationBase.of(
context)
.assessment
.toUpperCase(),
variant:
isAssessmentExpand
? "bodyText"
: '',
bold: isAssessmentExpand
? true
: true,
AppText(TranslationBase.of(context).assessment!.toUpperCase(),
variant: isAssessmentExpand ? "bodyText" : '',
bold: isAssessmentExpand ? true : true,
color: Colors.black),
],
),
InkWell(
onTap: () {
setState(() {
isAssessmentExpand =
!isAssessmentExpand;
isAssessmentExpand = !isAssessmentExpand;
});
},
child: Icon(isAssessmentExpand
? EvaIcons.arrowUp
: EvaIcons.arrowDown))
child:
Icon(isAssessmentExpand ? EvaIcons.arrowUp : EvaIcons.arrowDown))
],
),
bodyWidget: ListView.builder(
physics:
NeverScrollableScrollPhysics(),
physics: NeverScrollableScrollPhysics(),
scrollDirection: Axis.vertical,
shrinkWrap: true,
itemCount: model
.medicalFileList[0]
.entityList[0]
.timelines[encounterNumber]
.timeLineEvents[0]
.consulations[0]
.lstAssessments
.entityList![0]
.timelines![encounterNumber]
.timeLineEvents![0]
.consulations![0]
.lstAssessments!
.length,
itemBuilder: (BuildContext ctxt,
int index) {
itemBuilder: (BuildContext ctxt, int index) {
return Padding(
padding: EdgeInsets.all(8.0),
child: Container(
child: Column(
mainAxisAlignment:
MainAxisAlignment
.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Row(
children: [
@ -353,58 +293,39 @@ class _MedicalFileDetailsState extends State<MedicalFileDetails> {
),
AppText(
model
.medicalFileList[
0]
.entityList[0]
.timelines[
encounterNumber]
.timeLineEvents[
0]
.consulations[
0]
.lstAssessments[
index]
.iCD10
.medicalFileList[0]
.entityList![0]
.timelines![encounterNumber]
.timeLineEvents![0]
.consulations![0]
.lstAssessments![index]
.iCD10!
.trim(),
fontSize: 13.5,
fontWeight:
FontWeight
.w700,
fontWeight: FontWeight.w700,
),
SizedBox(
width: 15.0),
SizedBox(width: 15.0),
],
),
Row(
children: [
AppText(
TranslationBase.of(
context)
.condition +
": ",
TranslationBase.of(context).condition! + ": ",
fontSize: 12.5,
),
Expanded(
child: AppText(
model
.medicalFileList[
0]
.entityList[
0]
.timelines[
encounterNumber]
.timeLineEvents[
0]
.consulations[
0]
.lstAssessments[
index]
.condition
.medicalFileList[0]
.entityList![0]
.timelines![encounterNumber]
.timeLineEvents![0]
.consulations![0]
.lstAssessments![index]
.condition!
.trim(),
fontSize: 13.0,
fontWeight:
FontWeight
.w700,
fontWeight: FontWeight.w700,
),
),
],
@ -414,22 +335,14 @@ class _MedicalFileDetailsState extends State<MedicalFileDetails> {
Expanded(
child: AppText(
model
.medicalFileList[
0]
.entityList[
0]
.timelines[
encounterNumber]
.timeLineEvents[
0]
.consulations[
0]
.lstAssessments[
index]
.medicalFileList[0]
.entityList![0]
.timelines![encounterNumber]
.timeLineEvents![0]
.consulations![0]
.lstAssessments![index]
.description,
fontWeight:
FontWeight
.w700,
fontWeight: FontWeight.w700,
fontSize: 15.0,
),
)
@ -438,32 +351,21 @@ class _MedicalFileDetailsState extends State<MedicalFileDetails> {
Row(
children: [
AppText(
TranslationBase.of(
context)
.type +
": ",
TranslationBase.of(context).type! + ": ",
fontSize: 15.5,
),
Expanded(
child: AppText(
model
.medicalFileList[
0]
.entityList[
0]
.timelines[
encounterNumber]
.timeLineEvents[
0]
.consulations[
0]
.lstAssessments[
index]
.medicalFileList[0]
.entityList![0]
.timelines![encounterNumber]
.timeLineEvents![0]
.consulations![0]
.lstAssessments![index]
.type,
fontSize: 16.0,
fontWeight:
FontWeight
.w700,
fontWeight: FontWeight.w700,
),
),
],
@ -473,16 +375,13 @@ class _MedicalFileDetailsState extends State<MedicalFileDetails> {
),
AppText(
model
.medicalFileList[
0]
.entityList[0]
.timelines[
encounterNumber]
.timeLineEvents[0]
.consulations[0]
.lstAssessments[
index]
.remarks
.medicalFileList[0]
.entityList![0]
.timelines![encounterNumber]
.timeLineEvents![0]
.consulations![0]
.lstAssessments![index]
.remarks!
.trim(),
),
Divider(
@ -507,85 +406,62 @@ class _MedicalFileDetailsState extends State<MedicalFileDetails> {
height: 30,
),
if (model.medicalFileList.length != 0 &&
model
.medicalFileList[0]
.entityList[0]
.timelines[encounterNumber]
.timeLineEvents[0]
.consulations
.length !=
model.medicalFileList[0].entityList![0].timelines![encounterNumber]
.timeLineEvents![0].consulations!.length !=
0)
Container(
width: double.infinity,
margin: EdgeInsets.only(
top: 10, left: 10, right: 10),
margin: EdgeInsets.only(top: 10, left: 10, right: 10),
padding: EdgeInsets.all(8.0),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(
Radius.circular(10.0),
),
border: Border.all(
color: Colors.grey[200],
width: 0.5),
border: Border.all(color: Colors.grey[200]!, width: 0.5),
),
child: Padding(
padding: const EdgeInsets.all(15.0),
child: HeaderBodyExpandableNotifier(
headerWidget: Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: [
AppText(
TranslationBase.of(
context)
.test
.toUpperCase(),
variant: isProcedureExpand
? "bodyText"
: '',
bold: isProcedureExpand
? true
: true,
AppText(TranslationBase.of(context).test!.toUpperCase(),
variant: isProcedureExpand ? "bodyText" : '',
bold: isProcedureExpand ? true : true,
color: Colors.black),
],
),
InkWell(
onTap: () {
setState(() {
isProcedureExpand =
!isProcedureExpand;
isProcedureExpand = !isProcedureExpand;
});
},
child: Icon(isProcedureExpand
? EvaIcons.arrowUp
: EvaIcons.arrowDown))
child:
Icon(isProcedureExpand ? EvaIcons.arrowUp : EvaIcons.arrowDown))
],
),
bodyWidget: ListView.builder(
physics:
NeverScrollableScrollPhysics(),
physics: NeverScrollableScrollPhysics(),
scrollDirection: Axis.vertical,
shrinkWrap: true,
itemCount: model
.medicalFileList[0]
.entityList[0]
.timelines[encounterNumber]
.timeLineEvents[0]
.consulations[0]
.lstProcedure
.entityList![0]
.timelines![encounterNumber]
.timeLineEvents![0]
.consulations![0]
.lstProcedure!
.length,
itemBuilder: (BuildContext ctxt,
int index) {
itemBuilder: (BuildContext ctxt, int index) {
return Padding(
padding: EdgeInsets.all(8.0),
child: Container(
child: Column(
mainAxisAlignment:
MainAxisAlignment
.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Row(
children: [
@ -596,63 +472,39 @@ class _MedicalFileDetailsState extends State<MedicalFileDetails> {
),
AppText(
model
.medicalFileList[
0]
.entityList[
0]
.timelines[
encounterNumber]
.timeLineEvents[
0]
.consulations[
0]
.lstProcedure[
index]
.procedureId
.medicalFileList[0]
.entityList![0]
.timelines![encounterNumber]
.timeLineEvents![0]
.consulations![0]
.lstProcedure![index]
.procedureId!
.trim(),
fontSize:
13.5,
fontWeight:
FontWeight
.w700,
fontSize: 13.5,
fontWeight: FontWeight.w700,
),
],
),
SizedBox(
width: 35.0),
SizedBox(width: 35.0),
Column(
children: [
AppText(
TranslationBase.of(
context)
.orderDate +
": ",
TranslationBase.of(context).orderDate! + ": ",
),
AppText(
AppDateUtils.getDateFormatted(
DateTime
.parse(
AppDateUtils.getDateFormatted(DateTime.parse(
model
.medicalFileList[
0]
.entityList[
0]
.timelines[
encounterNumber]
.timeLineEvents[
0]
.consulations[
0]
.lstProcedure[
index]
.orderDate
.medicalFileList[0]
.entityList![0]
.timelines![encounterNumber]
.timeLineEvents![0]
.consulations![0]
.lstProcedure![index]
.orderDate!
.trim(),
)),
fontSize:
13.5,
fontWeight:
FontWeight
.w700,
fontSize: 13.5,
fontWeight: FontWeight.w700,
),
],
),
@ -666,22 +518,14 @@ class _MedicalFileDetailsState extends State<MedicalFileDetails> {
Expanded(
child: AppText(
model
.medicalFileList[
0]
.entityList[
0]
.timelines[
encounterNumber]
.timeLineEvents[
0]
.consulations[
0]
.lstProcedure[
index]
.medicalFileList[0]
.entityList![0]
.timelines![encounterNumber]
.timeLineEvents![0]
.consulations![0]
.lstProcedure![index]
.procName,
fontWeight:
FontWeight
.w700,
fontWeight: FontWeight.w700,
),
)
],
@ -693,22 +537,15 @@ class _MedicalFileDetailsState extends State<MedicalFileDetails> {
),
AppText(
model
.medicalFileList[
0]
.entityList[0]
.timelines[
encounterNumber]
.timeLineEvents[
0]
.consulations[
0]
.lstProcedure[
index]
.medicalFileList[0]
.entityList![0]
.timelines![encounterNumber]
.timeLineEvents![0]
.consulations![0]
.lstProcedure![index]
.patientID
.toString(),
fontWeight:
FontWeight
.w700,
fontWeight: FontWeight.w700,
),
],
),
@ -737,78 +574,59 @@ class _MedicalFileDetailsState extends State<MedicalFileDetails> {
height: 30,
),
if (model.medicalFileList.length != 0 &&
model
.medicalFileList[0]
.entityList[0]
.timelines[encounterNumber]
.timeLineEvents[0]
.consulations
.length !=
model.medicalFileList[0].entityList![0].timelines![encounterNumber]
.timeLineEvents![0].consulations!.length !=
0)
Container(
width: double.infinity,
margin: EdgeInsets.only(
top: 10, left: 10, right: 10),
margin: EdgeInsets.only(top: 10, left: 10, right: 10),
padding: EdgeInsets.all(8.0),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(
Radius.circular(10.0),
),
border: Border.all(
color: Colors.grey[200],
width: 0.5),
border: Border.all(color: Colors.grey[200]!, width: 0.5),
),
child: Padding(
padding: const EdgeInsets.all(15.0),
child: HeaderBodyExpandableNotifier(
headerWidget: Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: [
AppText(
TranslationBase.of(
context)
.physicalSystemExamination
TranslationBase.of(context)
.physicalSystemExamination!
.toUpperCase(),
variant: isPhysicalExam
? "bodyText"
: '',
bold: isPhysicalExam
? true
: true,
variant: isPhysicalExam ? "bodyText" : '',
bold: isPhysicalExam ? true : true,
color: Colors.black),
],
),
InkWell(
onTap: () {
setState(() {
isPhysicalExam =
!isPhysicalExam;
isPhysicalExam = !isPhysicalExam;
});
},
child: Icon(isPhysicalExam
? EvaIcons.arrowUp
: EvaIcons.arrowDown))
child: Icon(isPhysicalExam ? EvaIcons.arrowUp : EvaIcons.arrowDown))
],
),
bodyWidget: ListView.builder(
physics:
NeverScrollableScrollPhysics(),
physics: NeverScrollableScrollPhysics(),
scrollDirection: Axis.vertical,
shrinkWrap: true,
itemCount: model
.medicalFileList[0]
.entityList[0]
.timelines[encounterNumber]
.timeLineEvents[0]
.consulations[0]
.lstPhysicalExam
.entityList![0]
.timelines![encounterNumber]
.timeLineEvents![0]
.consulations![0]
.lstPhysicalExam!
.length,
itemBuilder: (BuildContext ctxt,
int index) {
itemBuilder: (BuildContext ctxt, int index) {
return Padding(
padding: EdgeInsets.all(8.0),
child: Container(
@ -816,27 +634,17 @@ class _MedicalFileDetailsState extends State<MedicalFileDetails> {
children: [
Row(
children: [
AppText(TranslationBase.of(
context)
.examType +
": "),
AppText(TranslationBase.of(context).examType! + ": "),
AppText(
model
.medicalFileList[
0]
.entityList[0]
.timelines[
encounterNumber]
.timeLineEvents[
0]
.consulations[
0]
.lstPhysicalExam[
index]
.medicalFileList[0]
.entityList![0]
.timelines![encounterNumber]
.timeLineEvents![0]
.consulations![0]
.lstPhysicalExam![index]
.examDesc,
fontWeight:
FontWeight
.w700,
fontWeight: FontWeight.w700,
),
],
),
@ -844,47 +652,30 @@ class _MedicalFileDetailsState extends State<MedicalFileDetails> {
children: [
AppText(
model
.medicalFileList[
0]
.entityList[0]
.timelines[
encounterNumber]
.timeLineEvents[
0]
.consulations[
0]
.lstPhysicalExam[
index]
.medicalFileList[0]
.entityList![0]
.timelines![encounterNumber]
.timeLineEvents![0]
.consulations![0]
.lstPhysicalExam![index]
.examDesc,
fontWeight:
FontWeight
.w700,
fontWeight: FontWeight.w700,
)
],
),
Row(
children: [
AppText(TranslationBase.of(
context)
.abnormal +
": "),
AppText(TranslationBase.of(context).abnormal! + ": "),
AppText(
model
.medicalFileList[
0]
.entityList[0]
.timelines[
encounterNumber]
.timeLineEvents[
0]
.consulations[
0]
.lstPhysicalExam[
index]
.medicalFileList[0]
.entityList![0]
.timelines![encounterNumber]
.timeLineEvents![0]
.consulations![0]
.lstPhysicalExam![index]
.abnormal,
fontWeight:
FontWeight
.w700,
fontWeight: FontWeight.w700,
),
],
),
@ -893,15 +684,12 @@ class _MedicalFileDetailsState extends State<MedicalFileDetails> {
),
AppText(
model
.medicalFileList[
0]
.entityList[0]
.timelines[
encounterNumber]
.timeLineEvents[0]
.consulations[0]
.lstPhysicalExam[
index]
.medicalFileList[0]
.entityList![0]
.timelines![encounterNumber]
.timeLineEvents![0]
.consulations![0]
.lstPhysicalExam![index]
.remarks,
),
Divider(

@ -31,7 +31,7 @@ DrAppSharedPreferances sharedPref = DrAppSharedPreferances();
class MedicineSearchScreen extends StatefulWidget with DrAppToastMsg {
MedicineSearchScreen({this.changeLoadingState});
final Function changeLoadingState;
final Function? changeLoadingState;
@override
_MedicineSearchState createState() => _MedicineSearchState();
@ -46,17 +46,16 @@ class _MedicineSearchState extends State<MedicineSearchScreen> {
bool _isInit = true;
final SpeechToText speech = SpeechToText();
String lastStatus = '';
GetMedicationResponseModel _selectedMedication;
GlobalKey key =
new GlobalKey<AutoCompleteTextFieldState<GetMedicationResponseModel>>();
late GetMedicationResponseModel _selectedMedication;
GlobalKey key = new GlobalKey<AutoCompleteTextFieldState<GetMedicationResponseModel>>();
// String lastWords;
List<LocaleName> _localeNames = [];
String lastError;
late String lastError;
double level = 0.0;
double minSoundLevel = 50000;
double maxSoundLevel = -50000;
String reconizedWord;
late String reconizedWord;
@override
void didChangeDependencies() {
@ -70,15 +69,13 @@ class _MedicineSearchState extends State<MedicineSearchScreen> {
}
Future<void> initSpeechState() async {
bool hasSpeech = await speech.initialize(
onError: errorListener, onStatus: statusListener);
bool hasSpeech = await speech.initialize(onError: errorListener, onStatus: statusListener);
// if (hasSpeech) {
// _localeNames = await speech.locales();
// var systemLocale = await speech.systemLocale();
_currentLocaleId = TranslationBase.of(context).locale.languageCode == 'en'
? 'en-GB'
: 'ar-SA'; // systemLocale.localeId;
_currentLocaleId =
TranslationBase.of(context).locale.languageCode == 'en' ? 'en-GB' : 'ar-SA'; // systemLocale.localeId;
// }
if (!mounted) return;
@ -88,9 +85,7 @@ class _MedicineSearchState extends State<MedicineSearchScreen> {
});
}
InputDecoration textFieldSelectorDecoration(
String hintText, String selectedText, bool isDropDown,
{IconData icon}) {
InputDecoration textFieldSelectorDecoration(String hintText, String selectedText, bool isDropDown, {IconData? icon}) {
return InputDecoration(
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0),
@ -123,7 +118,7 @@ class _MedicineSearchState extends State<MedicineSearchScreen> {
return AppScaffold(
// baseViewModel: model,
isShowAppBar: true,
appBarTitle: TranslationBase.of(context).searchMedicine,
appBarTitle: TranslationBase.of(context).searchMedicine!,
body: SingleChildScrollView(
child: FractionallySizedBox(
widthFactor: 0.97,
@ -141,13 +136,11 @@ class _MedicineSearchState extends State<MedicineSearchScreen> {
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(6.0)),
border: Border.all(
width: 1.0, color: HexColor("#CCCCCC"))),
border: Border.all(width: 1.0, color: HexColor("#CCCCCC"))),
padding: EdgeInsets.all(10),
child: AppTextFormField(
borderColor: Colors.white,
hintText:
TranslationBase.of(context).searchMedicineNameHere,
hintText: TranslationBase.of(context).searchMedicineNameHere,
controller: myController,
onSaved: (value) {},
onFieldSubmitted: (value) {
@ -178,18 +171,15 @@ class _MedicineSearchState extends State<MedicineSearchScreen> {
),
),
Container(
margin:
EdgeInsets.only(left: SizeConfig.heightMultiplier * 2),
margin: EdgeInsets.only(left: SizeConfig.heightMultiplier * 2),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
AppText(
TranslationBase.of(context).youCanFind +
(myController.text != ''
? model.pharmacyItemsList.length.toString()
: '0') +
TranslationBase.of(context).youCanFind! +
(myController.text != '' ? model.pharmacyItemsList.length.toString() : '0') +
" " +
TranslationBase.of(context).itemsInSearch,
TranslationBase.of(context).itemsInSearch!,
fontWeight: FontWeight.bold,
),
],
@ -206,26 +196,20 @@ class _MedicineSearchState extends State<MedicineSearchScreen> {
scrollDirection: Axis.vertical,
// shrinkWrap: true,
itemCount: model.pharmacyItemsList == null
? 0
: model.pharmacyItemsList.length,
itemCount: model.pharmacyItemsList == null ? 0 : model.pharmacyItemsList.length,
itemBuilder: (BuildContext context, int index) {
return InkWell(
child: MedicineItemWidget(
label: model.pharmacyItemsList[index]
["ItemDescription"],
url: model.pharmacyItemsList[index]
["ImageSRCUrl"],
label: model.pharmacyItemsList[index]["ItemDescription"],
url: model.pharmacyItemsList[index]["ImageSRCUrl"],
),
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => PharmaciesListScreen(
itemID: model.pharmacyItemsList[index]
["ItemID"],
url: model.pharmacyItemsList[index]
["ImageSRCUrl"]),
itemID: model.pharmacyItemsList[index]["ItemID"],
url: model.pharmacyItemsList[index]["ImageSRCUrl"]),
),
);
},

@ -23,8 +23,7 @@ class PharmaciesListScreen extends StatefulWidget {
final String url;
PharmaciesListScreen({Key key, @required this.itemID, this.url})
: super(key: key);
PharmaciesListScreen({Key? key, required this.itemID, required this.url}) : super(key: key);
@override
_PharmaciesListState createState() => _PharmaciesListState();
@ -32,8 +31,7 @@ class PharmaciesListScreen extends StatefulWidget {
class _PharmaciesListState extends State<PharmaciesListScreen> {
Helpers helpers = new Helpers();
ProjectViewModel projectsProvider;
late ProjectViewModel projectsProvider;
@override
Widget build(BuildContext context) {
@ -42,7 +40,7 @@ class _PharmaciesListState extends State<PharmaciesListScreen> {
onModelReady: (model) => model.getPharmaciesList(widget.itemID),
builder: (_, model, w) => AppScaffold(
baseViewModel: model,
appBarTitle: TranslationBase.of(context).pharmaciesList,
appBarTitle: TranslationBase.of(context).pharmaciesList!,
body: Container(
height: SizeConfig.screenHeight,
child: ListView(
@ -52,71 +50,64 @@ class _PharmaciesListState extends State<PharmaciesListScreen> {
children: <Widget>[
model.pharmaciesList.length > 0
? RoundedContainer(
child: Row(
children: <Widget>[
Expanded(
flex: 1,
child: ClipRRect(
borderRadius:
BorderRadius.all(Radius.circular(7)),
child: widget.url != null
? Image.network(
widget.url,
height:
SizeConfig.imageSizeMultiplier *
21,
width:
SizeConfig.imageSizeMultiplier *
20,
fit: BoxFit.cover,
): Container(),
child: Row(
children: <Widget>[
Expanded(
flex: 1,
child: ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(7)),
child: widget.url != null
? Image.network(
widget.url,
height: SizeConfig.imageSizeMultiplier * 21,
width: SizeConfig.imageSizeMultiplier * 20,
fit: BoxFit.cover,
)
: Container(),
),
),
),
Expanded(
flex: 3,
child: Column(
mainAxisAlignment:
MainAxisAlignment.start,
crossAxisAlignment:
CrossAxisAlignment.stretch,
children: <Widget>[
AppText(
TranslationBase.of(context)
.description,
marginLeft: 10,
marginTop: 0,
marginRight: 10,
marginBottom: 2,
fontWeight: FontWeight.bold,
),
AppText(
model.pharmaciesList[0]["ItemDescription"],
marginLeft: 10,
marginTop: 0,
marginRight: 10,
marginBottom: 10,
),
AppText(
TranslationBase.of(context).price,
marginLeft: 10,
marginTop: 0,
marginRight: 10,
marginBottom: 2,
fontWeight: FontWeight.bold,
),
AppText(
model.pharmaciesList[0]["SellingPrice"]
.toString(),
marginLeft: 10,
marginTop: 0,
marginRight: 10,
marginBottom: 10,
),
],
),
)
],
)): Container(),
Expanded(
flex: 3,
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
AppText(
TranslationBase.of(context).description,
marginLeft: 10,
marginTop: 0,
marginRight: 10,
marginBottom: 2,
fontWeight: FontWeight.bold,
),
AppText(
model.pharmaciesList[0]["ItemDescription"],
marginLeft: 10,
marginTop: 0,
marginRight: 10,
marginBottom: 10,
),
AppText(
TranslationBase.of(context).price,
marginLeft: 10,
marginTop: 0,
marginRight: 10,
marginBottom: 2,
fontWeight: FontWeight.bold,
),
AppText(
model.pharmaciesList[0]["SellingPrice"].toString(),
marginLeft: 10,
marginTop: 0,
marginRight: 10,
marginBottom: 10,
),
],
),
)
],
))
: Container(),
Container(
margin: EdgeInsets.only(
top: SizeConfig.widthMultiplier * 2,
@ -131,18 +122,15 @@ class _PharmaciesListState extends State<PharmaciesListScreen> {
fontWeight: FontWeight.bold,
),
),
alignment: projectsProvider.isArabic
? Alignment.topRight
: Alignment.topLeft,
alignment: projectsProvider.isArabic ? Alignment.topRight : Alignment.topLeft,
),
Container(
width: SizeConfig.screenWidth * 0.99,
margin: EdgeInsets.only(left: 10,right: 10),
margin: EdgeInsets.only(left: 10, right: 10),
child: ListView.builder(
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
itemCount: model.pharmaciesList == null ? 0 : model
.pharmaciesList.length,
itemCount: model.pharmaciesList == null ? 0 : model.pharmaciesList.length,
itemBuilder: (BuildContext context, int index) {
return RoundedContainer(
margin: EdgeInsets.only(top: 5),
@ -151,15 +139,11 @@ class _PharmaciesListState extends State<PharmaciesListScreen> {
Expanded(
flex: 1,
child: ClipRRect(
borderRadius:
BorderRadius.all(Radius.circular(7)),
borderRadius: BorderRadius.all(Radius.circular(7)),
child: Image.network(
model
.pharmaciesList[index]["ProjectImageURL"],
height:
SizeConfig.imageSizeMultiplier * 15,
width:
SizeConfig.imageSizeMultiplier * 15,
model.pharmaciesList[index]["ProjectImageURL"],
height: SizeConfig.imageSizeMultiplier * 15,
width: SizeConfig.imageSizeMultiplier * 15,
fit: BoxFit.cover,
),
),
@ -167,8 +151,7 @@ class _PharmaciesListState extends State<PharmaciesListScreen> {
Expanded(
flex: 4,
child: AppText(
model
.pharmaciesList[index]["LocationDescription"],
model.pharmaciesList[index]["LocationDescription"],
margin: 10,
),
),
@ -186,10 +169,7 @@ class _PharmaciesListState extends State<PharmaciesListScreen> {
Icons.call,
color: Colors.red,
),
onTap: () =>
launch("tel://" +
model
.pharmaciesList[index]["PhoneNumber"]),
onTap: () => launch("tel://" + model.pharmaciesList[index]["PhoneNumber"]),
),
),
Padding(
@ -201,14 +181,9 @@ class _PharmaciesListState extends State<PharmaciesListScreen> {
),
onTap: () {
MapsLauncher.launchCoordinates(
double.parse(
model
.pharmaciesList[index]["Latitude"]),
double.parse(
model
.pharmaciesList[index]["Longitude"]),
model.pharmaciesList[index]
["LocationDescription"]);
double.parse(model.pharmaciesList[index]["Latitude"]),
double.parse(model.pharmaciesList[index]["Longitude"]),
model.pharmaciesList[index]["LocationDescription"]);
},
),
),
@ -221,18 +196,18 @@ class _PharmaciesListState extends State<PharmaciesListScreen> {
}),
)
]),
),),);
),
),
);
}
Image imageFromBase64String(String base64String) {
return Image.memory(base64Decode(base64String));
}
//TODO CHECK THE URL IS NULL OR NOT
Uint8List dataFromBase64String(String base64String) {
if(base64String !=null)
return base64Decode(base64String);
Uint8List? dataFromBase64String(String base64String) {
if (base64String != null) return base64Decode(base64String);
}
String base64String(Uint8List data) {

@ -24,322 +24,309 @@ class _DischargedPatientState extends State<DischargedPatient> {
@override
Widget build(BuildContext context) {
return BaseView<DischargedPatientViewModel>(
onModelReady: (model) => model.getDischargedPatient(),
builder: (_, model, w) => AppScaffold(
//appBarTitle: 'Discharged Patient',
//subtitle: "Last Three Months",
backgroundColor: Colors.grey[200],
isShowAppBar: false,
baseViewModel: model,
body: model.myDischargedPatient.isEmpty? Center(
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Container(
height: MediaQuery.of(context).size.height * 0.070,
),
SizedBox(
height: 100,
),
Image.asset('assets/images/no-data.png'),
Padding(
padding: const EdgeInsets.all(8.0),
child: AppText(
'No Discharged Patient',
color: Theme.of(context).errorColor,
),
)
],
),
):Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Container(
height: MediaQuery.of(context).size.height * 0.070,
),
SizedBox(height: 12,),
Container(
width: double.maxFinite,
height: 75,
decoration: BoxDecoration(
borderRadius: BorderRadius.all(
Radius.circular(6.0)),
border: Border.all(
width: 1.0,
color: Color(0xffCCCCCC),
),
color: Colors.white),
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Padding(
padding: EdgeInsets.only(
left: 10, top: 10),
onModelReady: (model) => model.getDischargedPatient(),
builder: (_, model, w) => AppScaffold(
//appBarTitle: 'Discharged Patient',
//subtitle: "Last Three Months",
backgroundColor: Colors.grey[200]!,
isShowAppBar: false,
baseViewModel: model,
body: model.myDischargedPatient.isEmpty
? Center(
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Container(
height: MediaQuery.of(context).size.height * 0.070,
),
SizedBox(
height: 100,
),
Image.asset('assets/images/no-data.png'),
Padding(
padding: const EdgeInsets.all(8.0),
child: AppText(
TranslationBase.of(
context)
.searchPatientName,
fontSize: 13,
)),
AppTextFormField(
// focusNode: focusProject,
controller: _controller,
borderColor: Colors.white,
prefix: IconButton(
icon: Icon(
DoctorApp.filter_1,
color: Colors.black,
),
iconSize: 20,
padding:
EdgeInsets.only(
bottom: 30),
'No Discharged Patient',
color: Theme.of(context).errorColor,
),
onChanged: (String str) {
model.searchData(str);
}),
])),
SizedBox(height: 5,),
Expanded(child: SingleChildScrollView(
child: Column(
children: [
...List.generate(model.filterData.length, (index) => InkWell(
onTap: () {
Navigator.of(context)
.pushNamed(
PATIENTS_PROFILE,
arguments: {
"patient": model.filterData[index],
"patientType": "1",
"isSearch": false,
"isInpatient":true,
"isDischargedPatient":true
});
},
child: Container(
width: double.maxFinite,
margin: EdgeInsets.all(8),
padding: EdgeInsets.only(left: 0, right: 5, bottom: 5, top: 5),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(15),
color: Colors.white,
),
child: Column(
children: [
Padding(
padding: EdgeInsets.only(left: 12.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(children: [
Container(
width: 170,
child: AppText(
(Helpers.capitalize(model
.filterData[index]
.firstName) +
" " +
Helpers.capitalize(model
.filterData[index]
.lastName)),
fontSize: 16,
fontWeight: FontWeight.bold,
fontFamily: 'Poppins',
textOverflow: TextOverflow.ellipsis,
),
),
model.filterData[index].gender == 1
? Icon(
DoctorApp.male_2,
color: Colors.blue,
)
: Icon(
DoctorApp.female_1,
color: Colors.pink,
),
]),
Row(
children: [
AppText(
model.filterData[index].nationalityName != null
? model.filterData[index].nationalityName.trim()
: model.filterData[index].nationality != null
? model.filterData[index].nationality.trim()
: model.filterData[index].nationalityId != null
? model.filterData[index].nationalityId
: "",
fontWeight: FontWeight.bold,
fontSize: 14,
textOverflow: TextOverflow.ellipsis,
),
model.filterData[index]
.nationality !=
null ||
model.filterData[index]
.nationalityId !=
null
? ClipRRect(
borderRadius:
BorderRadius.circular(20.0),
child: Image.network(
model.filterData[index].nationalityFlagURL != null ?
model.filterData[index].nationalityFlagURL
: '',
height: 25,
width: 30,
errorBuilder:
(BuildContext context,
Object exception,
StackTrace stackTrace) {
return AppText(
'',
fontSize: 10,
);
},
))
: SizedBox()
],
)
],
)),
Row(
children: <Widget>[
Column(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Padding(
padding: EdgeInsets.only(left: 12.0),
child: Container(
width: 60,
height: 60,
child: Image.asset(
model.filterData[index].gender ==
1
? 'assets/images/male_avatar.png'
: 'assets/images/female_avatar.png',
fit: BoxFit.cover,
),
)
],
),
)
: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Container(
height: MediaQuery.of(context).size.height * 0.070,
),
SizedBox(
height: 12,
),
Container(
width: double.maxFinite,
height: 75,
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(6.0)),
border: Border.all(
width: 1.0,
color: Color(0xffCCCCCC),
),
color: Colors.white),
child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
Padding(
padding: EdgeInsets.only(left: 10, top: 10),
child: AppText(
TranslationBase.of(context).searchPatientName,
fontSize: 13,
)),
AppTextFormField(
// focusNode: focusProject,
controller: _controller,
borderColor: Colors.white,
prefix: IconButton(
onPressed: () {},
icon: Icon(
DoctorApp.filter_1,
color: Colors.black,
),
iconSize: 20,
padding: EdgeInsets.only(bottom: 30),
),
],
),
SizedBox(
width: 10,
),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
child: RichText(
text: new TextSpan(
style: new TextStyle(
fontSize:
2.0 * SizeConfig.textMultiplier,
color: Colors.black),
children: <TextSpan>[
new TextSpan(
text: TranslationBase.of(context)
.fileNumber,
style: TextStyle(
fontSize: 14,
fontFamily: 'Poppins')),
new TextSpan(
text: model
.filterData[index]
.patientId
.toString(),
style: TextStyle(
fontWeight: FontWeight.w700,
fontFamily: 'Poppins',
fontSize: 15)),
],
),
),
),
Container(
child: RichText(
text: new TextSpan(
style: new TextStyle(
fontSize:
2.0 * SizeConfig.textMultiplier,
color: Colors.black,
fontFamily: 'Poppins',
),
children: <TextSpan>[
new TextSpan(
text: model.filterData[index].admissionDate == null ? "" :
TranslationBase.of(context).admissionDate + " : ",
style: TextStyle(fontSize: 14)),
new TextSpan(
text: model.filterData[index].admissionDate == null ? ""
: "${AppDateUtils.convertDateFromServerFormat(model.filterData[index].admissionDate.toString(), 'yyyy-MM-dd')}",
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 15)),
],
),
),
),
Container(
child: RichText(
text: new TextSpan(
style: new TextStyle(
fontSize:
2.0 * SizeConfig.textMultiplier,
color: Colors.black,
fontFamily: 'Poppins',
onChanged: (String str) {
model.searchData(str);
}),
])),
SizedBox(
height: 5,
),
Expanded(
child: SingleChildScrollView(
child: Column(
children: [
...List.generate(
model.filterData.length,
(index) => InkWell(
onTap: () {
Navigator.of(context).pushNamed(PATIENTS_PROFILE, arguments: {
"patient": model.filterData[index],
"patientType": "1",
"isSearch": false,
"isInpatient": true,
"isDischargedPatient": true
});
},
child: Container(
width: double.maxFinite,
margin: EdgeInsets.all(8),
padding: EdgeInsets.only(left: 0, right: 5, bottom: 5, top: 5),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(15),
color: Colors.white,
),
child: Column(
children: [
Padding(
padding: EdgeInsets.only(left: 12.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(children: [
Container(
width: 170,
child: AppText(
(Helpers.capitalize(model.filterData[index].firstName) +
" " +
Helpers.capitalize(
model.filterData[index].lastName)),
fontSize: 16,
fontWeight: FontWeight.bold,
fontFamily: 'Poppins',
textOverflow: TextOverflow.ellipsis,
),
),
model.filterData[index].gender == 1
? Icon(
DoctorApp.male_2,
color: Colors.blue,
)
: Icon(
DoctorApp.female_1,
color: Colors.pink,
),
]),
Row(
children: [
AppText(
model.filterData[index].nationalityName != null
? model.filterData[index].nationalityName!.trim()
: model.filterData[index].nationality != null
? model.filterData[index].nationality!.trim()
: model.filterData[index].nationalityId != null
? model.filterData[index].nationalityId
: "",
fontWeight: FontWeight.bold,
fontSize: 14,
textOverflow: TextOverflow.ellipsis,
),
model.filterData[index].nationality != null ||
model.filterData[index].nationalityId != null
? ClipRRect(
borderRadius: BorderRadius.circular(20.0),
child: Image.network(
model.filterData[index].nationalityFlagURL !=
null
? model
.filterData[index].nationalityFlagURL!
: '',
height: 25,
width: 30,
errorBuilder: (BuildContext context,
Object exception, StackTrace? stackTrace) {
return AppText(
'',
fontSize: 10,
);
},
))
: SizedBox()
],
)
],
)),
Row(
children: <Widget>[
Column(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Padding(
padding: EdgeInsets.only(left: 12.0),
child: Container(
width: 60,
height: 60,
child: Image.asset(
model.filterData[index].gender == 1
? 'assets/images/male_avatar.png'
: 'assets/images/female_avatar.png',
fit: BoxFit.cover,
),
),
),
],
),
SizedBox(
width: 10,
),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
child: RichText(
text: new TextSpan(
style: new TextStyle(
fontSize: 2.0 * SizeConfig.textMultiplier,
color: Colors.black),
children: <TextSpan>[
new TextSpan(
text: TranslationBase.of(context).fileNumber,
style: TextStyle(
fontSize: 14, fontFamily: 'Poppins')),
new TextSpan(
text: model.filterData[index].patientId
.toString(),
style: TextStyle(
fontWeight: FontWeight.w700,
fontFamily: 'Poppins',
fontSize: 15)),
],
),
),
),
Container(
child: RichText(
text: new TextSpan(
style: new TextStyle(
fontSize: 2.0 * SizeConfig.textMultiplier,
color: Colors.black,
fontFamily: 'Poppins',
),
children: <TextSpan>[
new TextSpan(
text: model.filterData[index].admissionDate ==
null
? ""
: TranslationBase.of(context)
.admissionDate! +
" : ",
style: TextStyle(fontSize: 14)),
new TextSpan(
text: model.filterData[index].admissionDate ==
null
? ""
: "${AppDateUtils.convertDateFromServerFormat(model.filterData[index].admissionDate.toString(), 'yyyy-MM-dd')}",
style: TextStyle(
fontWeight: FontWeight.w700, fontSize: 15)),
],
),
),
),
Container(
child: RichText(
text: new TextSpan(
style: new TextStyle(
fontSize: 2.0 * SizeConfig.textMultiplier,
color: Colors.black,
fontFamily: 'Poppins',
),
children: <TextSpan>[
new TextSpan(
text: model.filterData[index].dischargeDate ==
null
? ""
: "Discharge Date : ",
style: TextStyle(fontSize: 14)),
new TextSpan(
text: model.filterData[index].dischargeDate ==
null
? ""
: "${AppDateUtils.convertDateFromServerFormat(model.filterData[index].dischargeDate.toString(), 'yyyy-MM-dd')}",
style: TextStyle(
fontWeight: FontWeight.w700, fontSize: 15)),
],
),
),
),
Row(
children: [
AppText(
"${TranslationBase.of(context).numOfDays}: ",
fontSize: 14,
fontWeight: FontWeight.w300,
),
AppText(
"${AppDateUtils.convertStringToDate(model.filterData[index].dischargeDate!).difference(AppDateUtils.getDateTimeFromServerFormat(model.filterData[index].admissionDate ?? "")).inDays + 1}",
fontSize: 15,
fontWeight: FontWeight.w700),
],
),
],
),
)
],
)
],
),
),
children: <TextSpan>[
new TextSpan(
text: model.filterData[index].dischargeDate == null ? ""
: "Discharge Date : ",
style: TextStyle(fontSize: 14)),
new TextSpan(
text: model.filterData[index].dischargeDate == null ? ""
: "${AppDateUtils.convertDateFromServerFormat(model.filterData[index].dischargeDate.toString(), 'yyyy-MM-dd')}",
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 15)),
],
),
),
),
Row(
children: [
AppText(
"${TranslationBase.of(context).numOfDays}: ",
fontSize: 14,fontWeight: FontWeight.w300,
),
AppText(
"${AppDateUtils.convertStringToDate(model.filterData[index].dischargeDate).difference(AppDateUtils.getDateTimeFromServerFormat(model.filterData[index].admissionDate)).inDays + 1}",
fontSize: 15,
fontWeight: FontWeight.w700),
],
),
],
),
)
],
)
],
),
)),
],
),
),
),
],
),
)),
],
),
),
),],
),
),)
);
),
));
}
}

@ -17,21 +17,19 @@ import 'package:url_launcher/url_launcher.dart';
class ECGPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
final routeArgs = ModalRoute.of(context).settings.arguments as Map;
final routeArgs = ModalRoute.of(context)!.settings.arguments as Map;
PatiantInformtion patient = routeArgs['patient'];
String patientType = routeArgs['patient-type'];
String arrivalType = routeArgs['arrival-type'];
ProjectViewModel projectViewModel = Provider.of(context);
return BaseView<PatientMuseViewModel>(
onModelReady: (model) => model.getECGPatient(
patientType: patient.patientType,
patientOutSA: 0,
patientID: patient.patientId),
onModelReady: (model) =>
model.getECGPatient(patientType: patient.patientType, patientOutSA: 0, patientID: patient.patientId),
builder: (_, model, w) => AppScaffold(
baseViewModel: model,
isShowAppBar: true,
backgroundColor: Color(0xffF8F8F8),
appBar: PatientProfileHeaderNewDesignAppBar(patient,arrivalType??'0',patientType),
appBar: PatientProfileHeaderNewDesignAppBar(patient, arrivalType ?? '0', patientType),
body: SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.all(8.0),
@ -39,84 +37,105 @@ class ECGPage extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// PatientProfileHeaderNewDesign(patient,arrivalType??'0',patientType),
SizedBox(height: 12,),
AppText('Service',style: "caption2",color: Colors.black,),
AppText('ECG',bold: true,fontSize: 22,),
SizedBox(height: 12,),
...List.generate(model.patientMuseResultsModelList.length, (index) => InkWell(
onTap: () async {
await launch(
model.patientMuseResultsModelList[index].imageURL);
},
child: Container(
width: double.infinity,
height: 120,
margin: EdgeInsets.only(top: 5,bottom: 5),
padding: EdgeInsets.all(10),
decoration: BoxDecoration(
border: Border.all(color: Colors.white,width: 2),
color: Colors.white,
borderRadius: BorderRadius.circular(8)
),
child: Column(
children: [
Row(
// mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
AppText('ECG Report',fontWeight: FontWeight.w700,fontSize: 17,),
SizedBox(height:3),
RichText(
text: TextSpan(
style: TextStyle(
fontSize: 1.6 *
SizeConfig.textMultiplier,
color: Colors.black),
children: <TextSpan>[
new TextSpan(
text:
TranslationBase.of(context).orderNo,
style: TextStyle(
fontSize: 12,
fontFamily:
'Poppins')),
new TextSpan(
text: '${/*model.patientMuseResultsModelList[index].orderNo?? */'3455'}',
style: TextStyle(
fontWeight: FontWeight.w600,
fontFamily:
'Poppins',
fontSize: 14)),
],
SizedBox(
height: 12,
),
AppText(
'Service',
style: "caption2",
color: Colors.black,
),
AppText(
'ECG',
bold: true,
fontSize: 22,
),
SizedBox(
height: 12,
),
...List.generate(
model.patientMuseResultsModelList.length,
(index) => InkWell(
onTap: () async {
await launch(model.patientMuseResultsModelList[index].imageURL ?? "");
},
child: Container(
width: double.infinity,
height: 120,
margin: EdgeInsets.only(top: 5, bottom: 5),
padding: EdgeInsets.all(10),
decoration: BoxDecoration(
border: Border.all(color: Colors.white, width: 2),
color: Colors.white,
borderRadius: BorderRadius.circular(8)),
child: Column(
children: [
Row(
// mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
AppText(
'ECG Report',
fontWeight: FontWeight.w700,
fontSize: 17,
),
SizedBox(height: 3),
RichText(
text: TextSpan(
style: TextStyle(
fontSize: 1.6 * SizeConfig.textMultiplier, color: Colors.black),
children: <TextSpan>[
new TextSpan(
text: TranslationBase.of(context).orderNo,
style: TextStyle(fontSize: 12, fontFamily: 'Poppins')),
new TextSpan(
text:
'${/*model.patientMuseResultsModelList[index].orderNo?? */ '3455'}',
style: TextStyle(
fontWeight: FontWeight.w600,
fontFamily: 'Poppins',
fontSize: 14)),
],
),
)
],
),
),
)
],
),
),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
AppText('${AppDateUtils.getDayMonthYearDateFormatted(model.patientMuseResultsModelList[index].createdOnDateTime,isArabic: projectViewModel.isArabic)}',color: Colors.black,fontWeight: FontWeight.w600,fontSize: 14,),
AppText('${AppDateUtils.getHour(model.patientMuseResultsModelList[index].createdOnDateTime)}',fontWeight: FontWeight.w600,color: Colors.grey[700],fontSize: 14,),
],
),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
AppText(
'${AppDateUtils.getDayMonthYearDateFormatted(model.patientMuseResultsModelList[index].createdOnDateTime ?? DateTime.now(), isArabic: projectViewModel.isArabic)}',
color: Colors.black,
fontWeight: FontWeight.w600,
fontSize: 14,
),
AppText(
'${AppDateUtils.getHour(model.patientMuseResultsModelList[index].createdOnDateTime ?? DateTime.now())}',
fontWeight: FontWeight.w600,
color: Colors.grey[700],
fontSize: 14,
),
],
),
),
],
),
SizedBox(
height: 15,
),
Align(
alignment: Alignment.topRight,
child: Icon(DoctorApp.external_link),
)
],
),
],
),
SizedBox(height: 15,),
Align(
alignment: Alignment.topRight,
child: Icon(DoctorApp.external_link),
)
],
),
),
)),
),
)),
],
),
),

@ -68,73 +68,56 @@ class _InPatientPageState extends State<InPatientPage> {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
...List.generate(
model.filteredInPatientItems.length, (index) {
...List.generate(model.filteredInPatientItems.length, (index) {
if (!widget.isMyInPatient)
return PatientCard(
patientInfo:
model.filteredInPatientItems[index],
patientInfo: model.filteredInPatientItems[index],
patientType: "1",
arrivalType: "1",
isInpatient: true,
isMyPatient: model
.filteredInPatientItems[index]
.doctorId ==
model.doctorProfile.doctorID,
isMyPatient:
model.filteredInPatientItems[index].doctorId == model.doctorProfile!.doctorID,
onTap: () {
FocusScopeNode currentFocus =
FocusScope.of(context);
FocusScopeNode currentFocus = FocusScope.of(context);
if (!currentFocus.hasPrimaryFocus) {
currentFocus.unfocus();
}
Navigator.of(context).pushNamed(
PATIENTS_PROFILE,
arguments: {
"patient": model
.filteredInPatientItems[index],
"patientType": "1",
"from": "0",
"to": "0",
"isSearch": false,
"isInpatient": true,
"arrivalType": "1",
});
Navigator.of(context).pushNamed(PATIENTS_PROFILE, arguments: {
"patient": model.filteredInPatientItems[index],
"patientType": "1",
"from": "0",
"to": "0",
"isSearch": false,
"isInpatient": true,
"arrivalType": "1",
});
},
);
else if (model.filteredInPatientItems[index]
.doctorId ==
model.doctorProfile.doctorID &&
else if (model.filteredInPatientItems[index].doctorId == model.doctorProfile!.doctorID &&
widget.isMyInPatient)
return PatientCard(
patientInfo:
model.filteredInPatientItems[index],
patientInfo: model.filteredInPatientItems[index],
patientType: "1",
arrivalType: "1",
isInpatient: true,
isMyPatient: model
.filteredInPatientItems[index]
.doctorId ==
model.doctorProfile.doctorID,
isMyPatient:
model.filteredInPatientItems[index].doctorId == model.doctorProfile!.doctorID,
onTap: () {
FocusScopeNode currentFocus =
FocusScope.of(context);
FocusScopeNode currentFocus = FocusScope.of(context);
if (!currentFocus.hasPrimaryFocus) {
currentFocus.unfocus();
}
Navigator.of(context).pushNamed(
PATIENTS_PROFILE,
arguments: {
"patient": model
.filteredInPatientItems[index],
"patientType": "1",
"from": "0",
"to": "0",
"isSearch": false,
"isInpatient": true,
"arrivalType": "1",
});
Navigator.of(context).pushNamed(PATIENTS_PROFILE, arguments: {
"patient": model.filteredInPatientItems[index],
"patientType": "1",
"from": "0",
"to": "0",
"isSearch": false,
"isInpatient": true,
"arrivalType": "1",
});
},
);
else
@ -150,10 +133,7 @@ class _InPatientPageState extends State<InPatientPage> {
)
: Expanded(
child: SingleChildScrollView(
child: Container(
child: ErrorMessage(
error:
TranslationBase.of(context).noDataAvailable)),
child: Container(child: ErrorMessage(error: TranslationBase.of(context).noDataAvailable ?? "")),
),
),
],

@ -16,9 +16,8 @@ class PatientInPatientScreen extends StatefulWidget {
_PatientInPatientScreenState createState() => _PatientInPatientScreenState();
}
class _PatientInPatientScreenState extends State<PatientInPatientScreen>
with SingleTickerProviderStateMixin {
TabController _tabController;
class _PatientInPatientScreenState extends State<PatientInPatientScreen> with SingleTickerProviderStateMixin {
late TabController _tabController;
int _activeTab = 0;
@override
@ -85,15 +84,12 @@ class _PatientInPatientScreenState extends State<PatientInPatientScreen>
child: Scaffold(
extendBodyBehindAppBar: true,
appBar: PreferredSize(
preferredSize: Size.fromHeight(
MediaQuery.of(context).size.height * 0.070),
preferredSize: Size.fromHeight(MediaQuery.of(context).size.height * 0.070),
child: Container(
height: MediaQuery.of(context).size.height * 0.070,
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
color: Theme.of(context).dividerColor,
width: 0.5), //width: 0.7
bottom: BorderSide(color: Theme.of(context).dividerColor, width: 0.5), //width: 0.7
),
color: Colors.white),
child: Center(
@ -104,18 +100,14 @@ class _PatientInPatientScreenState extends State<PatientInPatientScreen>
indicatorWeight: 1.0,
indicatorSize: TabBarIndicatorSize.tab,
labelColor: Theme.of(context).primaryColor,
labelPadding: EdgeInsets.only(
top: 0, left: 0, right: 0, bottom: 0),
labelPadding: EdgeInsets.only(top: 0, left: 0, right: 0, bottom: 0),
unselectedLabelColor: Colors.grey[800],
tabs: [
tabWidget(screenSize, _activeTab == 0,
TranslationBase.of(context).inPatientAll,
tabWidget(screenSize, _activeTab == 0, TranslationBase.of(context).inPatientAll ?? "",
counter: model.inPatientList.length),
tabWidget(
screenSize, _activeTab == 1, "My InPatients",
tabWidget(screenSize, _activeTab == 1, "My InPatients",
counter: model.myIinPatientList.length),
tabWidget(screenSize, _activeTab == 2,
TranslationBase.of(context).discharged),
tabWidget(screenSize, _activeTab == 2, TranslationBase.of(context).discharged ?? ""),
],
),
),
@ -144,8 +136,7 @@ class _PatientInPatientScreenState extends State<PatientInPatientScreen>
);
}
Widget tabWidget(Size screenSize, bool isActive, String title,
{int counter = -1}) {
Widget tabWidget(Size screenSize, bool isActive, String title, {int counter = -1}) {
return Center(
child: Container(
height: screenSize.height * 0.070,

@ -49,8 +49,7 @@ class ReferralDischargedPatientDetails extends StatelessWidget {
),
Expanded(
child: AppText(
(Helpers.capitalize(
"${referredPatient.firstName} ${referredPatient.lastName}")),
(Helpers.capitalize("${referredPatient.firstName} ${referredPatient.lastName}")),
fontSize: SizeConfig.textMultiplier * 2.5,
fontWeight: FontWeight.bold,
fontFamily: 'Poppins',
@ -67,20 +66,15 @@ class ReferralDischargedPatientDetails extends StatelessWidget {
),
InkWell(
onTap: () {
PatiantInformtion patient =
model.getPatientFromDischargeReferralPatient(
referredPatient);
Navigator.of(context)
.pushNamed(PATIENTS_PROFILE, arguments: {
PatiantInformtion patient = model.getPatientFromDischargeReferralPatient(referredPatient);
Navigator.of(context).pushNamed(PATIENTS_PROFILE, arguments: {
"patient": patient,
"patientType": "1",
"isInpatient": true,
"arrivalType": "1",
"isDischargedPatient": true,
"from": AppDateUtils.convertDateToFormat(
DateTime.now(), 'yyyy-MM-dd'),
"to": AppDateUtils.convertDateToFormat(
DateTime.now(), 'yyyy-MM-dd'),
"from": AppDateUtils.convertDateToFormat(DateTime.now(), 'yyyy-MM-dd'),
"to": AppDateUtils.convertDateToFormat(DateTime.now(), 'yyyy-MM-dd'),
});
},
child: Icon(
@ -111,11 +105,10 @@ class ReferralDischargedPatientDetails extends StatelessWidget {
child: Column(
children: [
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
AppText(
"${model.getReferralStatusNameByCode(referredPatient.referralStatus, context)}",
"${model.getReferralStatusNameByCode(referredPatient.referralStatus!, context)}",
fontFamily: 'Poppins',
fontSize: 1.9 * SizeConfig.textMultiplier,
fontWeight: FontWeight.w700,
@ -127,7 +120,7 @@ class ReferralDischargedPatientDetails extends StatelessWidget {
),
AppText(
AppDateUtils.getDayMonthYearDateFormatted(
referredPatient.referralDate,
referredPatient.referralDate!,
),
fontFamily: 'Poppins',
fontWeight: FontWeight.w600,
@ -150,12 +143,10 @@ class ReferralDischargedPatientDetails extends StatelessWidget {
Expanded(
child: AppText(
AppDateUtils.convertDateFromServerFormat(
referredPatient.admissionDate,
"dd MMM,yyyy"),
referredPatient.admissionDate ?? "", "dd MMM,yyyy"),
fontFamily: 'Poppins',
fontWeight: FontWeight.w700,
fontSize:
1.8 * SizeConfig.textMultiplier,
fontSize: 1.8 * SizeConfig.textMultiplier,
color: Color(0XFF2E303A),
),
),
@ -175,12 +166,10 @@ class ReferralDischargedPatientDetails extends StatelessWidget {
Expanded(
child: AppText(
AppDateUtils.convertDateFromServerFormat(
referredPatient.dischargeDate,
"dd MMM,yyyy"),
referredPatient.dischargeDate ?? "", "dd MMM,yyyy"),
fontFamily: 'Poppins',
fontWeight: FontWeight.w700,
fontSize:
1.8 * SizeConfig.textMultiplier,
fontSize: 1.8 * SizeConfig.textMultiplier,
color: Color(0XFF2E303A),
),
),
@ -199,11 +188,10 @@ class ReferralDischargedPatientDetails extends StatelessWidget {
),
Expanded(
child: AppText(
"${AppDateUtils.convertStringToDate(referredPatient.dischargeDate).difference(AppDateUtils.convertStringToDate(referredPatient.admissionDate)).inDays + 1}",
"${AppDateUtils.convertStringToDate(referredPatient.dischargeDate ?? "").difference(AppDateUtils.convertStringToDate(referredPatient.admissionDate ?? "")).inDays + 1}",
fontFamily: 'Poppins',
fontWeight: FontWeight.w700,
fontSize:
1.8 * SizeConfig.textMultiplier,
fontSize: 1.8 * SizeConfig.textMultiplier,
color: Color(0XFF2E303A),
),
),
@ -225,36 +213,30 @@ class ReferralDischargedPatientDetails extends StatelessWidget {
referredPatient.referringDoctorName,
fontFamily: 'Poppins',
fontWeight: FontWeight.w700,
fontSize:
1.8 * SizeConfig.textMultiplier,
fontSize: 1.8 * SizeConfig.textMultiplier,
color: Color(0XFF2E303A),
),
),
],
),
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
mainAxisAlignment:
MainAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [
AppText(
TranslationBase.of(context)
.fileNumber,
TranslationBase.of(context).fileNumber,
fontFamily: 'Poppins',
fontWeight: FontWeight.w600,
fontSize:
1.7 * SizeConfig.textMultiplier,
fontSize: 1.7 * SizeConfig.textMultiplier,
color: Color(0XFF575757),
),
AppText(
"${referredPatient.patientID}",
fontFamily: 'Poppins',
fontWeight: FontWeight.w700,
fontSize:
1.8 * SizeConfig.textMultiplier,
fontSize: 1.8 * SizeConfig.textMultiplier,
color: Color(0XFF2E303A),
),
],
@ -262,60 +244,48 @@ class ReferralDischargedPatientDetails extends StatelessWidget {
],
),
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Expanded(
child: Column(
children: [
Row(
mainAxisAlignment:
MainAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [
AppText(
"${TranslationBase.of(context).refClinic}: ",
fontFamily: 'Poppins',
fontWeight: FontWeight.w600,
fontSize: 1.7 *
SizeConfig.textMultiplier,
fontSize: 1.7 * SizeConfig.textMultiplier,
color: Color(0XFF575757),
),
AppText(
referredPatient
.referringClinicDescription,
referredPatient.referringClinicDescription,
fontFamily: 'Poppins',
fontWeight: FontWeight.w700,
fontSize: 1.8 *
SizeConfig.textMultiplier,
fontSize: 1.8 * SizeConfig.textMultiplier,
color: Color(0XFF2E303A),
),
],
),
Row(
mainAxisAlignment:
MainAxisAlignment.start,
crossAxisAlignment:
CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
AppText(
TranslationBase.of(context)
.frequency +
": ",
TranslationBase.of(context).frequency! + ": ",
fontFamily: 'Poppins',
fontWeight: FontWeight.w600,
fontSize: 1.7 *
SizeConfig.textMultiplier,
fontSize: 1.7 * SizeConfig.textMultiplier,
color: Color(0XFF575757),
),
Expanded(
child: AppText(
referredPatient
.frequencyDescription,
referredPatient.frequencyDescription,
fontFamily: 'Poppins',
fontWeight: FontWeight.w700,
fontSize: 1.8 *
SizeConfig.textMultiplier,
fontSize: 1.8 * SizeConfig.textMultiplier,
color: Color(0XFF2E303A),
),
),
@ -331,8 +301,7 @@ class ReferralDischargedPatientDetails extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
AppText(
TranslationBase.of(context).priority +
": ",
TranslationBase.of(context).priority! + ": ",
fontFamily: 'Poppins',
fontWeight: FontWeight.w600,
fontSize: 1.7 * SizeConfig.textMultiplier,
@ -343,8 +312,7 @@ class ReferralDischargedPatientDetails extends StatelessWidget {
referredPatient.priorityDescription,
fontFamily: 'Poppins',
fontWeight: FontWeight.w700,
fontSize:
1.8 * SizeConfig.textMultiplier,
fontSize: 1.8 * SizeConfig.textMultiplier,
color: Color(0XFF2E303A),
),
),
@ -363,12 +331,10 @@ class ReferralDischargedPatientDetails extends StatelessWidget {
),
Expanded(
child: AppText(
referredPatient
.referringClinicDescription,
referredPatient.referringClinicDescription,
fontFamily: 'Poppins',
fontWeight: FontWeight.w700,
fontSize:
1.8 * SizeConfig.textMultiplier,
fontSize: 1.8 * SizeConfig.textMultiplier,
color: Color(0XFF2E303A),
),
),
@ -390,8 +356,7 @@ class ReferralDischargedPatientDetails extends StatelessWidget {
referredPatient.frequency.toString(),
fontFamily: 'Poppins',
fontWeight: FontWeight.w700,
fontSize:
1.8 * SizeConfig.textMultiplier,
fontSize: 1.8 * SizeConfig.textMultiplier,
color: Color(0XFF2E303A),
),
),
@ -413,8 +378,7 @@ class ReferralDischargedPatientDetails extends StatelessWidget {
referredPatient.frequency.toString(),
fontFamily: 'Poppins',
fontWeight: FontWeight.w700,
fontSize:
1.8 * SizeConfig.textMultiplier,
fontSize: 1.8 * SizeConfig.textMultiplier,
color: Color(0XFF2E303A),
),
),
@ -425,9 +389,7 @@ class ReferralDischargedPatientDetails extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
AppText(
TranslationBase.of(context)
.maxResponseTime +
": ",
TranslationBase.of(context).maxResponseTime! + ": ",
fontFamily: 'Poppins',
fontWeight: FontWeight.w600,
fontSize: 1.7 * SizeConfig.textMultiplier,
@ -436,12 +398,10 @@ class ReferralDischargedPatientDetails extends StatelessWidget {
Expanded(
child: AppText(
AppDateUtils.convertDateFromServerFormat(
referredPatient.mAXResponseTime,
"dd MMM,yyyy"),
referredPatient.mAXResponseTime ?? "", "dd MMM,yyyy"),
fontFamily: 'Poppins',
fontWeight: FontWeight.w700,
fontSize:
1.8 * SizeConfig.textMultiplier,
fontSize: 1.8 * SizeConfig.textMultiplier,
color: Color(0XFF2E303A),
),
),
@ -451,8 +411,7 @@ class ReferralDischargedPatientDetails extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
margin:
EdgeInsets.only(left: 10, right: 0),
margin: EdgeInsets.only(left: 10, right: 0),
child: Image.asset(
'assets/images/patient/ic_ref_arrow_left.png',
height: 50,
@ -496,30 +455,22 @@ class ReferralDischargedPatientDetails extends StatelessWidget {
Expanded(
flex: 4,
child: Container(
margin: EdgeInsets.only(
left: 10,
top: 30,
right: 10,
bottom: 0),
margin: EdgeInsets.only(left: 10, top: 30, right: 10, bottom: 0),
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
AppText(
"${TranslationBase.of(context).dr} ${referredPatient.referringDoctorName}",
fontFamily: 'Poppins',
fontWeight: FontWeight.w800,
fontSize: 1.5 *
SizeConfig.textMultiplier,
fontSize: 1.5 * SizeConfig.textMultiplier,
color: Colors.black,
),
AppText(
referredPatient
.referringClinicDescription,
referredPatient.referringClinicDescription,
fontFamily: 'Poppins',
fontWeight: FontWeight.w700,
fontSize: 1.3 *
SizeConfig.textMultiplier,
fontSize: 1.3 * SizeConfig.textMultiplier,
color: Color(0XFF2E303A),
),
],

@ -17,81 +17,88 @@ class ReferralDischargedPatientPage extends StatefulWidget {
}
class _ReferralDischargedPatientPageState extends State<ReferralDischargedPatientPage> {
@override
Widget build(BuildContext context) {
return BaseView<PatientReferralViewModel>(
onModelReady: (model) => model.gtMyDischargeReferralPatient(),
builder: (_, model, w) => AppScaffold(
appBarTitle: 'Referral Discharged ',
backgroundColor: Colors.grey[200],
backgroundColor: Colors.grey[200]!,
isShowAppBar: false,
baseViewModel: model,
body: model.myDischargeReferralPatient.isEmpty?Center(
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
SizedBox(
height: 100,
),
Image.asset('assets/images/no-data.png'),
Padding(
padding: const EdgeInsets.all(8.0),
child: AppText(
'No Discharged Patient',
color: Theme.of(context).errorColor,
body: model.myDischargeReferralPatient.isEmpty
? Center(
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
SizedBox(
height: 100,
),
Image.asset('assets/images/no-data.png'),
Padding(
padding: const EdgeInsets.all(8.0),
child: AppText(
'No Discharged Patient',
color: Theme.of(context).errorColor,
),
)
],
),
)
],
),
):Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
SizedBox(height: 5,),
Expanded(
child: ListView.builder(
itemCount: model.myDischargeReferralPatient.length,
itemBuilder: (context,index)=>InkWell(
onTap: () {
Navigator.push(
context,
FadePage(
page: ReferralDischargedPatientDetails(model.myDischargeReferralPatient[index]),
),
);
},
child: PatientReferralItemWidget(
referralStatus: model.getReferralStatusNameByCode(model.myDischargeReferralPatient[index].referralStatus,context),
referralStatusCode: model.myDischargeReferralPatient[index].referralStatus,
patientName: model.myDischargeReferralPatient[index].firstName+" "+model.myDischargeReferralPatient[index].lastName,
patientGender: model.myDischargeReferralPatient[index].gender,
referredDate: AppDateUtils.getDayMonthYearDateFormatted(model.myDischargeReferralPatient[index].referralDate),
referredTime: AppDateUtils.getTimeHHMMA(model.myDischargeReferralPatient[index].referralDate),
patientID: "${model.myDischargeReferralPatient[index].patientID}",
isSameBranch: false,
isReferral: true,
isReferralClinic: true,
referralClinic:"${model.myDischargeReferralPatient[index].referringClinicDescription}",
remark: model.myDischargeReferralPatient[index].referringDoctorRemarks,
nationality: model.myDischargeReferralPatient[index].nationalityName,
nationalityFlag: '',//model.myDischargeReferralPatient[index].nationalityFlagURL, //TODO From backend
doctorAvatar: '',//model.myDischargeReferralPatient[index].doctorImageURL, //TODO From backend
referralDoctorName: model.myDischargeReferralPatient[index].referringDoctorName,
clinicDescription: model.myDischargeReferralPatient[index].referringClinicDescription,
infoIcon: Icon(FontAwesomeIcons.arrowRight,
size: 25, color: Colors.black),
),
)),
: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
SizedBox(
height: 5,
),
Expanded(
child: ListView.builder(
itemCount: model.myDischargeReferralPatient.length,
itemBuilder: (context, index) => InkWell(
onTap: () {
Navigator.push(
context,
FadePage(
page: ReferralDischargedPatientDetails(model.myDischargeReferralPatient[index]),
),
);
},
child: PatientReferralItemWidget(
referralStatus: model.getReferralStatusNameByCode(
model.myDischargeReferralPatient[index].referralStatus!, context),
referralStatusCode: model.myDischargeReferralPatient[index].referralStatus,
patientName: model.myDischargeReferralPatient[index].firstName! +
" " +
model.myDischargeReferralPatient[index].lastName!,
patientGender: model.myDischargeReferralPatient[index].gender,
referredDate: AppDateUtils.getDayMonthYearDateFormatted(
model.myDischargeReferralPatient[index].referralDate!),
referredTime:
AppDateUtils.getTimeHHMMA(model.myDischargeReferralPatient[index].referralDate!),
patientID: "${model.myDischargeReferralPatient[index].patientID}",
isSameBranch: false,
isReferral: true,
isReferralClinic: true,
referralClinic:
"${model.myDischargeReferralPatient[index].referringClinicDescription}",
remark: model.myDischargeReferralPatient[index].referringDoctorRemarks,
nationality: model.myDischargeReferralPatient[index].nationalityName,
nationalityFlag:
'', //model.myDischargeReferralPatient[index].nationalityFlagURL, //TODO From backend
doctorAvatar:
'', //model.myDischargeReferralPatient[index].doctorImageURL, //TODO From backend
referralDoctorName: model.myDischargeReferralPatient[index].referringDoctorName,
clinicDescription: model.myDischargeReferralPatient[index].referringClinicDescription,
infoIcon: Icon(FontAwesomeIcons.arrowRight, size: 25, color: Colors.black),
),
)),
),
],
),
),
],
),
),
),
);
}
}

@ -15,21 +15,19 @@ import 'package:provider/provider.dart';
import '../base/base_view.dart';
class InsuranceApprovalScreenNew extends StatefulWidget {
final int appointmentNo;
final int? appointmentNo;
InsuranceApprovalScreenNew({this.appointmentNo});
@override
_InsuranceApprovalScreenNewState createState() =>
_InsuranceApprovalScreenNewState();
_InsuranceApprovalScreenNewState createState() => _InsuranceApprovalScreenNewState();
}
class _InsuranceApprovalScreenNewState
extends State<InsuranceApprovalScreenNew> {
class _InsuranceApprovalScreenNewState extends State<InsuranceApprovalScreenNew> {
@override
Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context);
final routeArgs = ModalRoute.of(context).settings.arguments as Map;
final routeArgs = ModalRoute.of(context)!.settings.arguments as Map;
PatiantInformtion patient = routeArgs['patient'];
patient = routeArgs['patient'];
String patientType = routeArgs['patientType'];
@ -39,11 +37,9 @@ class _InsuranceApprovalScreenNewState
? (model) => model.getInsuranceInPatient(mrn: patient.patientId)
: patient.appointmentNo != null
? (model) => model.getInsuranceApproval(patient,
appointmentNo: patient?.appointmentNo,
projectId: patient.projectId)
appointmentNo: patient?.appointmentNo, projectId: patient.projectId)
: (model) => model.getInsuranceApproval(patient),
builder: (BuildContext context, InsuranceViewModel model, Widget child) =>
AppScaffold(
builder: (BuildContext context, InsuranceViewModel model, Widget? child) => AppScaffold(
appBar: PatientProfileHeaderNewDesignAppBar(
patient,
patientType.toString() ?? "0",
@ -52,7 +48,7 @@ class _InsuranceApprovalScreenNewState
),
isShowAppBar: true,
baseViewModel: model,
appBarTitle: TranslationBase.of(context).approvals,
appBarTitle: TranslationBase.of(context).approvals ?? "",
body: patient.admissionNo != null
? SingleChildScrollView(
child: Container(
@ -98,8 +94,7 @@ class _InsuranceApprovalScreenNewState
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
InsuranceApprovalsDetails(
builder: (context) => InsuranceApprovalsDetails(
patient: patient,
indexInsurance: index,
patientType: patientType,
@ -108,27 +103,14 @@ class _InsuranceApprovalScreenNewState
},
child: DoctorCardInsurance(
patientOut: "In Patient",
profileUrl: model
.insuranceApprovalInPatient[index]
.doctorImage,
clinic: model
.insuranceApprovalInPatient[index]
.clinicName,
doctorName: model
.insuranceApprovalInPatient[index]
.doctorName,
branch: model
.insuranceApprovalInPatient[index]
.approvalNo
.toString(),
profileUrl: model.insuranceApprovalInPatient[index].doctorImage,
clinic: model.insuranceApprovalInPatient[index].clinicName,
doctorName: model.insuranceApprovalInPatient[index].doctorName,
branch: model.insuranceApprovalInPatient[index].approvalNo.toString(),
isPrescriptions: true,
approvalStatus: model
.insuranceApprovalInPatient[index]
.approvalStatusDescption ??
'',
branch2: model
.insuranceApprovalInPatient[index]
.projectName,
approvalStatus:
model.insuranceApprovalInPatient[index].approvalStatusDescption ?? '',
branch2: model.insuranceApprovalInPatient[index].projectName,
),
),
),
@ -145,8 +127,7 @@ class _InsuranceApprovalScreenNewState
Image.asset('assets/images/no-data.png'),
Padding(
padding: const EdgeInsets.all(8.0),
child: AppText(TranslationBase.of(context)
.noInsuranceApprovalFound),
child: AppText(TranslationBase.of(context).noInsuranceApprovalFound),
),
SizedBox(
height: 150.0,
@ -173,8 +154,7 @@ class _InsuranceApprovalScreenNewState
Row(
children: [
AppText(
TranslationBase.of(context)
.insurance22,
TranslationBase.of(context).insurance22,
fontSize: 15.0,
fontWeight: FontWeight.w600,
fontFamily: 'Poppins',
@ -184,8 +164,7 @@ class _InsuranceApprovalScreenNewState
Row(
children: [
AppText(
TranslationBase.of(context)
.approvals22,
TranslationBase.of(context).approvals22,
fontSize: 30.0,
fontWeight: FontWeight.w700,
),
@ -202,8 +181,7 @@ class _InsuranceApprovalScreenNewState
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
InsuranceApprovalsDetails(
builder: (context) => InsuranceApprovalsDetails(
patient: patient,
indexInsurance: index,
patientType: patientType,
@ -211,24 +189,14 @@ class _InsuranceApprovalScreenNewState
);
},
child: DoctorCardInsurance(
patientOut: model.insuranceApproval[index]
.patientDescription,
profileUrl: model
.insuranceApproval[index].doctorImage,
clinic: model
.insuranceApproval[index].clinicName,
doctorName: model
.insuranceApproval[index].doctorName,
branch: model
.insuranceApproval[index].approvalNo
.toString(),
patientOut: model.insuranceApproval[index].patientDescription,
profileUrl: model.insuranceApproval[index].doctorImage,
clinic: model.insuranceApproval[index].clinicName,
doctorName: model.insuranceApproval[index].doctorName,
branch: model.insuranceApproval[index].approvalNo.toString(),
isPrescriptions: true,
approvalStatus: model
.insuranceApproval[index]
.approvalStatusDescption ??
'',
branch2: model
.insuranceApproval[index].projectName,
approvalStatus: model.insuranceApproval[index].approvalStatusDescption ?? '',
branch2: model.insuranceApproval[index].projectName,
),
),
),
@ -245,8 +213,7 @@ class _InsuranceApprovalScreenNewState
Image.asset('assets/images/no-data.png'),
Padding(
padding: const EdgeInsets.all(8.0),
child: AppText(TranslationBase.of(context)
.noInsuranceApprovalFound),
child: AppText(TranslationBase.of(context).noInsuranceApprovalFound),
)
],
),

File diff suppressed because it is too large Load Diff

@ -16,8 +16,7 @@ class FilterDatePage extends StatefulWidget {
final OutPatientFilterType outPatientFilterType;
final PatientSearchViewModel patientSearchViewModel;
const FilterDatePage(
{Key key, this.outPatientFilterType, this.patientSearchViewModel})
const FilterDatePage({Key? key, required this.outPatientFilterType, required this.patientSearchViewModel})
: super(key: key);
@override
@ -46,8 +45,7 @@ class _FilterDatePageState extends State<FilterDatePage> {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
BottomSheetTitle(
title: (OutPatientFilterType.Previous ==
widget.outPatientFilterType)
title: (OutPatientFilterType.Previous == widget.outPatientFilterType)
? " Filter Previous Out Patient"
: "Filter Nextweek Out Patient",
),
@ -63,16 +61,12 @@ class _FilterDatePageState extends State<FilterDatePage> {
color: Colors.white,
child: InkWell(
onTap: () => selectDate(context,
firstDate:
getFirstDate(widget.outPatientFilterType),
lastDate:
getLastDate(widget.outPatientFilterType)),
firstDate: getFirstDate(widget.outPatientFilterType),
lastDate: getLastDate(widget.outPatientFilterType)),
child: TextField(
decoration: textFieldSelectorDecoration(
TranslationBase.of(context).fromDate,
widget.patientSearchViewModel
.selectedFromDate !=
null
TranslationBase.of(context).fromDate!,
widget.patientSearchViewModel.selectedFromDate != null
? "${AppDateUtils.convertStringToDateFormat(widget.patientSearchViewModel.selectedFromDate.toString(), "yyyy-MM-dd")}"
: null,
true,
@ -92,16 +86,12 @@ class _FilterDatePageState extends State<FilterDatePage> {
child: InkWell(
onTap: () => selectDate(context,
isFromDate: false,
firstDate:
getFirstDate(widget.outPatientFilterType),
lastDate:
getLastDate(widget.outPatientFilterType)),
firstDate: getFirstDate(widget.outPatientFilterType),
lastDate: getLastDate(widget.outPatientFilterType)),
child: TextField(
decoration: textFieldSelectorDecoration(
TranslationBase.of(context).toDate,
widget.patientSearchViewModel
.selectedToDate !=
null
TranslationBase.of(context).toDate!,
widget.patientSearchViewModel.selectedToDate != null
? "${AppDateUtils.convertStringToDateFormat(widget.patientSearchViewModel.selectedToDate.toString(), "yyyy-MM-dd")}"
: null,
true,
@ -146,41 +136,30 @@ class _FilterDatePageState extends State<FilterDatePage> {
padding: 10,
color: Color(0xFF359846),
onPressed: () async {
if (widget.patientSearchViewModel.selectedFromDate ==
null ||
widget.patientSearchViewModel.selectedToDate ==
null) {
Helpers.showErrorToast(
"Please Select All The date Fields ");
if (widget.patientSearchViewModel.selectedFromDate == null ||
widget.patientSearchViewModel.selectedToDate == null) {
Helpers.showErrorToast("Please Select All The date Fields ");
} else {
Duration difference = widget
.patientSearchViewModel.selectedToDate
.difference(widget
.patientSearchViewModel.selectedFromDate);
Duration difference = widget.patientSearchViewModel.selectedToDate!
.difference(widget.patientSearchViewModel.selectedFromDate!);
if (difference.inDays > 90) {
Helpers.showErrorToast(
"The difference between from date and end date must be less than 3 months");
} else {
String dateTo = AppDateUtils.convertDateToFormat(
widget.patientSearchViewModel.selectedToDate,
'yyyy-MM-dd');
widget.patientSearchViewModel.selectedToDate!, 'yyyy-MM-dd');
String dateFrom = AppDateUtils.convertDateToFormat(
widget.patientSearchViewModel.selectedFromDate,
'yyyy-MM-dd');
widget.patientSearchViewModel.selectedFromDate!, 'yyyy-MM-dd');
PatientSearchRequestModel currentModel =
PatientSearchRequestModel();
PatientSearchRequestModel currentModel = PatientSearchRequestModel();
currentModel.to = dateTo;
currentModel.from = dateFrom;
GifLoaderDialogUtils.showMyDialog(context);
await widget.patientSearchViewModel
.getOutPatient(currentModel, isLocalBusy: true);
await widget.patientSearchViewModel.getOutPatient(currentModel, isLocalBusy: true);
GifLoaderDialogUtils.hideDialog(context);
if (widget.patientSearchViewModel.state ==
ViewState.ErrorLocal) {
Helpers.showErrorToast(
widget.patientSearchViewModel.error);
if (widget.patientSearchViewModel.state == ViewState.ErrorLocal) {
Helpers.showErrorToast(widget.patientSearchViewModel.error);
} else {
Navigator.of(context).pop();
}
@ -199,16 +178,15 @@ class _FilterDatePageState extends State<FilterDatePage> {
));
}
selectDate(BuildContext context,
{bool isFromDate = true, DateTime firstDate, lastDate}) async {
selectDate(BuildContext context, {bool isFromDate = true, DateTime? firstDate, lastDate}) async {
Helpers.hideKeyboard(context);
DateTime selectedDate = isFromDate
? this.widget.patientSearchViewModel.selectedFromDate ?? firstDate
: this.widget.patientSearchViewModel.selectedToDate ?? lastDate;
final DateTime picked = await showDatePicker(
final DateTime? picked = await showDatePicker(
context: context,
initialDate: selectedDate,
firstDate: firstDate,
firstDate: firstDate!,
lastDate: lastDate,
initialEntryMode: DatePickerEntryMode.calendar,
);
@ -232,27 +210,22 @@ class _FilterDatePageState extends State<FilterDatePage> {
getFirstDate(OutPatientFilterType outPatientFilterType) {
if (outPatientFilterType == OutPatientFilterType.Previous) {
return DateTime(
DateTime.now().year - 20, DateTime.now().month, DateTime.now().day);
return DateTime(DateTime.now().year - 20, DateTime.now().month, DateTime.now().day);
} else {
return DateTime(
DateTime.now().year, DateTime.now().month, DateTime.now().day + 1);
return DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day + 1);
}
}
getLastDate(OutPatientFilterType outPatientFilterType) {
if (outPatientFilterType == OutPatientFilterType.Previous) {
return DateTime(
DateTime.now().year, DateTime.now().month, DateTime.now().day - 1);
return DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day - 1);
} else {
return DateTime(
DateTime.now().year, DateTime.now().month, DateTime.now().day + 7);
return DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day + 7);
}
}
InputDecoration textFieldSelectorDecoration(
String hintText, String selectedText, bool isDropDown,
{Icon suffixIcon}) {
InputDecoration textFieldSelectorDecoration(String? hintText, String? selectedText, bool isDropDown,
{Icon? suffixIcon}) {
return InputDecoration(
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0),

@ -35,13 +35,13 @@ class OutPatientsScreen extends StatefulWidget {
final isAppbar;
final arrivalType;
final isView;
final PatientType selectedPatientType;
final PatientSearchRequestModel patientSearchRequestModel;
final PatientType? selectedPatientType;
final PatientSearchRequestModel? patientSearchRequestModel;
final bool isSearchWithKeyInfo;
final bool isSearch;
final bool isInpatient;
final bool isSearchAndOut;
final String searchKey;
final String? searchKey;
OutPatientsScreen(
{this.patientSearchForm,
@ -62,21 +62,21 @@ class OutPatientsScreen extends StatefulWidget {
}
class _OutPatientsScreenState extends State<OutPatientsScreen> {
int clinicId;
AuthenticationViewModel authenticationViewModel;
late int clinicId;
late AuthenticationViewModel authenticationViewModel;
List<String> _times = [];
int _activeLocation = 1;
String patientType;
String patientTypeTitle;
late String patientType;
late String patientTypeTitle;
var selectedFilter = 1;
String arrivalType;
ProjectViewModel projectsProvider;
late String arrivalType;
late ProjectViewModel projectsProvider;
var isView;
final _controller = TextEditingController();
PatientModel patient;
late PatientModel patient;
OutPatientFilterType outPatientFilterType = OutPatientFilterType.Today;
@ -84,15 +84,15 @@ class _OutPatientsScreenState extends State<OutPatientsScreen> {
Widget build(BuildContext context) {
authenticationViewModel = Provider.of(context);
_times = [
TranslationBase.of(context).previous,
TranslationBase.of(context).today,
TranslationBase.of(context).nextWeek,
TranslationBase.of(context).previous!,
TranslationBase.of(context).today!,
TranslationBase.of(context).nextWeek!,
];
final screenSize = MediaQuery.of(context).size;
return BaseView<PatientSearchViewModel>(
onModelReady: (model) async {
await model.getOutPatient(widget.patientSearchRequestModel);
await model.getOutPatient(widget.patientSearchRequestModel!);
},
builder: (_, model, w) => AppScaffold(
appBarTitle: "Search Patient",
@ -106,15 +106,13 @@ class _OutPatientsScreenState extends State<OutPatientsScreen> {
Container(
// color: Colors.red,
height: screenSize.height * 0.070,
decoration: TextFieldsUtils.containerBorderDecoration(
Color(0Xffffffff), Color(0xFFCCCCCC),
decoration: TextFieldsUtils.containerBorderDecoration(Color(0Xffffffff), Color(0xFFCCCCCC),
borderRadius: 4, borderWidth: 0),
child: Row(
mainAxisSize: MainAxisSize.max,
crossAxisAlignment: CrossAxisAlignment.center,
children: _times.map((item) {
bool _isActive =
_times[_activeLocation] == item ? true : false;
bool _isActive = _times[_activeLocation] == item ? true : false;
return Expanded(
child: InkWell(
@ -134,8 +132,7 @@ class _OutPatientsScreenState extends State<OutPatientsScreen> {
await model.getPatientBasedOnDate(
item: item,
selectedPatientType: widget.selectedPatientType,
patientSearchRequestModel:
widget.patientSearchRequestModel,
patientSearchRequestModel: widget.patientSearchRequestModel,
isSearchWithKeyInfo: widget.isSearchWithKeyInfo,
outPatientFilterType: outPatientFilterType);
GifLoaderDialogUtils.hideDialog(context);
@ -143,16 +140,11 @@ class _OutPatientsScreenState extends State<OutPatientsScreen> {
child: Center(
child: Container(
height: screenSize.height * 0.070,
decoration:
TextFieldsUtils.containerBorderDecoration(
_isActive
? Color(0xFFD02127 /*B8382B*/)
: Color(0xFFEAEAEA),
_isActive
? Color(0xFFD02127)
: Color(0xFFEAEAEA),
borderRadius: 4,
borderWidth: 0),
decoration: TextFieldsUtils.containerBorderDecoration(
_isActive ? Color(0xFFD02127 /*B8382B*/) : Color(0xFFEAEAEA),
_isActive ? Color(0xFFD02127) : Color(0xFFEAEAEA),
borderRadius: 4,
borderWidth: 0),
child: Center(
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
@ -160,22 +152,16 @@ class _OutPatientsScreenState extends State<OutPatientsScreen> {
AppText(
item,
fontSize: SizeConfig.textMultiplier * 1.8,
color: _isActive
? Colors.white
: Color(0xFF2B353E),
color: _isActive ? Colors.white : Color(0xFF2B353E),
fontWeight: FontWeight.w700,
),
_isActive &&
_activeLocation != 0 &&
model.state == ViewState.Idle
_isActive && _activeLocation != 0 && model.state == ViewState.Idle
? Container(
padding: EdgeInsets.all(2),
margin: EdgeInsets.symmetric(
horizontal: 5),
margin: EdgeInsets.symmetric(horizontal: 5),
decoration: new BoxDecoration(
color: Colors.white,
borderRadius:
BorderRadius.circular(50),
borderRadius: BorderRadius.circular(50),
),
constraints: BoxConstraints(
minWidth: 20,
@ -183,9 +169,7 @@ class _OutPatientsScreenState extends State<OutPatientsScreen> {
),
child: new Text(
model.filterData.length.toString(),
style: new TextStyle(
color: Colors.red,
fontSize: 10),
style: new TextStyle(color: Colors.red, fontSize: 10),
textAlign: TextAlign.center,
),
)
@ -211,47 +195,40 @@ class _OutPatientsScreenState extends State<OutPatientsScreen> {
color: HexColor("#CCCCCC"),
),
color: Colors.white),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: EdgeInsets.only(left: 10, top: 10),
child: AppText(
TranslationBase.of(context).searchPatientName,
fontSize: 13,
)),
AppTextFormField(
// focusNode: focusProject,
controller: _controller,
borderColor: Colors.white,
prefix: IconButton(
icon: Icon(
_activeLocation != 0
? DoctorApp.filter_1
: FontAwesomeIcons.slidersH,
color: Colors.black,
),
iconSize: 20,
padding: EdgeInsets.only(bottom: 30),
onPressed: _activeLocation != 0
? null
: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (BuildContext context) =>
FilterDatePage(
outPatientFilterType:
outPatientFilterType,
patientSearchViewModel:
model,
)));
},
),
onChanged: (String str) {
model.searchData(str);
}),
])),
child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
Padding(
padding: EdgeInsets.only(left: 10, top: 10),
child: AppText(
TranslationBase.of(context).searchPatientName,
fontSize: 13,
)),
AppTextFormField(
// focusNode: focusProject,
controller: _controller,
borderColor: Colors.white,
prefix: IconButton(
icon: Icon(
_activeLocation != 0 ? DoctorApp.filter_1 : FontAwesomeIcons.slidersH,
color: Colors.black,
),
iconSize: 20,
padding: EdgeInsets.only(bottom: 30),
onPressed: _activeLocation != 0
? null
: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (BuildContext context) => FilterDatePage(
outPatientFilterType: outPatientFilterType,
patientSearchViewModel: model,
)));
},
),
onChanged: (String str) {
model.searchData(str);
}),
])),
SizedBox(
height: 10.0,
),
@ -260,8 +237,7 @@ class _OutPatientsScreenState extends State<OutPatientsScreen> {
child: model.filterData.isEmpty
? Center(
child: ErrorMessage(
error: TranslationBase.of(context)
.youDontHaveAnyPatient,
error: TranslationBase.of(context).youDontHaveAnyPatient ?? "",
),
)
: ListView.builder(
@ -270,11 +246,8 @@ class _OutPatientsScreenState extends State<OutPatientsScreen> {
itemCount: model.filterData.length,
itemBuilder: (BuildContext ctxt, int index) {
if (_activeLocation != 0 ||
(model.filterData[index].patientStatusType !=
null &&
model.filterData[index]
.patientStatusType ==
43))
(model.filterData[index].patientStatusType != null &&
model.filterData[index].patientStatusType == 43))
return Padding(
padding: EdgeInsets.all(8.0),
child: PatientCard(
@ -285,20 +258,16 @@ class _OutPatientsScreenState extends State<OutPatientsScreen> {
isInpatient: widget.isInpatient,
onTap: () {
// TODO change the parameter to daynamic
Navigator.of(context).pushNamed(
PATIENTS_PROFILE,
arguments: {
"patient": model.filterData[index],
"patientType": "1",
"from": widget
.patientSearchRequestModel.from,
"to": widget
.patientSearchRequestModel.from,
"isSearch": false,
"isInpatient": false,
"arrivalType": "7",
"isSearchAndOut": false,
});
Navigator.of(context).pushNamed(PATIENTS_PROFILE, arguments: {
"patient": model.filterData[index],
"patientType": "1",
"from": widget.patientSearchRequestModel!.from,
"to": widget.patientSearchRequestModel!.from,
"isSearch": false,
"isInpatient": false,
"arrivalType": "7",
"isSearchAndOut": false,
});
},
// isFromSearch: widget.isSearch,
),

@ -12,42 +12,38 @@ import 'package:flutter/material.dart';
class OutPatientPrescriptionDetailsScreen extends StatefulWidget {
final PrescriptionResModel prescriptionResModel;
OutPatientPrescriptionDetailsScreen({Key key, this.prescriptionResModel});
OutPatientPrescriptionDetailsScreen({Key? key, required this.prescriptionResModel});
@override
_OutPatientPrescriptionDetailsScreenState createState() =>
_OutPatientPrescriptionDetailsScreenState();
_OutPatientPrescriptionDetailsScreenState createState() => _OutPatientPrescriptionDetailsScreenState();
}
class _OutPatientPrescriptionDetailsScreenState
extends State<OutPatientPrescriptionDetailsScreen> {
getPrescriptionReport(BuildContext context,PatientViewModel model ){
RequestPrescriptionReport prescriptionReqModel =
RequestPrescriptionReport(
class _OutPatientPrescriptionDetailsScreenState extends State<OutPatientPrescriptionDetailsScreen> {
getPrescriptionReport(BuildContext context, PatientViewModel model) {
RequestPrescriptionReport prescriptionReqModel = RequestPrescriptionReport(
appointmentNo: widget.prescriptionResModel.appointmentNo,
episodeID: widget.prescriptionResModel.episodeID,
setupID: widget.prescriptionResModel.setupID,
patientTypeID: widget.prescriptionResModel.patientID);
model.getPrescriptionReport(prescriptionReqModel.toJson());
}
@override
Widget build(BuildContext context) {
return BaseView<PatientViewModel>(
onModelReady: (model) => getPrescriptionReport(context, model),
builder: (_, model, w) => AppScaffold(
appBarTitle: TranslationBase.of(context).prescriptionDetails,
body: CardWithBgWidgetNew(
widget: ListView.builder(
itemCount: model.prescriptionReport.length,
itemBuilder: (BuildContext context, int index) {
return OutPatientPrescriptionDetailsItem(
prescriptionReport:
model.prescriptionReport[index],
);
}),
),
),);
appBarTitle: TranslationBase.of(context).prescriptionDetails ?? "",
body: CardWithBgWidgetNew(
widget: ListView.builder(
itemCount: model.prescriptionReport.length,
itemBuilder: (BuildContext context, int index) {
return OutPatientPrescriptionDetailsItem(
prescriptionReport: model.prescriptionReport[index],
);
}),
),
),
);
}
}

@ -5,11 +5,11 @@ import 'package:flutter/material.dart';
class PatientSearchHeader extends StatelessWidget with PreferredSizeWidget {
final String title;
const PatientSearchHeader({Key key, this.title}) : super(key: key);
const PatientSearchHeader({Key? key, required this.title}) : super(key: key);
@override
Widget build(BuildContext context) {
return Container(
return Container(
padding: EdgeInsets.only(left: 0, right: 5, bottom: 5, top: 5),
decoration: BoxDecoration(
color: Colors.white,
@ -38,6 +38,5 @@ class PatientSearchHeader extends StatelessWidget with PreferredSizeWidget {
}
@override
Size get preferredSize => Size(double.maxFinite,65);
Size get preferredSize => Size(double.maxFinite, 65);
}

@ -32,45 +32,41 @@ class PatientsSearchResultScreen extends StatefulWidget {
final String searchKey;
PatientsSearchResultScreen(
{this.selectedPatientType,
this.patientSearchRequestModel,
{required this.selectedPatientType,
required this.patientSearchRequestModel,
this.isSearchWithKeyInfo = true,
this.isSearch = false,
this.isInpatient = false,
this.searchKey,
required this.searchKey,
this.isSearchAndOut = false});
@override
_PatientsSearchResultScreenState createState() =>
_PatientsSearchResultScreenState();
_PatientsSearchResultScreenState createState() => _PatientsSearchResultScreenState();
}
class _PatientsSearchResultScreenState
extends State<PatientsSearchResultScreen> {
int clinicId;
AuthenticationViewModel authenticationViewModel;
class _PatientsSearchResultScreenState extends State<PatientsSearchResultScreen> {
late int clinicId;
late AuthenticationViewModel authenticationViewModel;
String patientType;
String patientTypeTitle;
late String patientType;
late String patientTypeTitle;
var selectedFilter = 1;
String arrivalType;
ProjectViewModel projectsProvider;
late String arrivalType;
late ProjectViewModel projectsProvider;
var isView;
final _controller = TextEditingController();
PatientModel patient;
late PatientModel patient;
@override
Widget build(BuildContext context) {
authenticationViewModel = Provider.of(context);
return BaseView<PatientSearchViewModel>(
onModelReady: (model) async {
if (!widget.isSearchWithKeyInfo &&
widget.selectedPatientType == PatientType.OutPatient) {
if (!widget.isSearchWithKeyInfo && widget.selectedPatientType == PatientType.OutPatient) {
await model.getOutPatient(widget.patientSearchRequestModel);
} else {
await model
.getPatientFileInformation(widget.patientSearchRequestModel);
await model.getPatientFileInformation(widget.patientSearchRequestModel);
}
},
builder: (_, model, w) => AppScaffold(
@ -93,31 +89,30 @@ class _PatientsSearchResultScreenState
color: HexColor("#CCCCCC"),
),
color: Colors.white),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: EdgeInsets.only(left: 10, top: 10),
child: AppText(
TranslationBase.of(context).searchPatientName,
fontSize: 13,
)),
AppTextFormField(
// focusNode: focusProject,
controller: _controller,
borderColor: Colors.white,
prefix: IconButton(
icon: Icon(
DoctorApp.filter_1,
color: Colors.black,
),
iconSize: 20,
padding: EdgeInsets.only(bottom: 30),
),
onChanged: (String str) {
model.searchData(str);
}),
])),
child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
Padding(
padding: EdgeInsets.only(left: 10, top: 10),
child: AppText(
TranslationBase.of(context).searchPatientName,
fontSize: 13,
)),
AppTextFormField(
// focusNode: focusProject,
controller: _controller,
borderColor: Colors.white,
prefix: IconButton(
icon: Icon(
DoctorApp.filter_1,
color: Colors.black,
),
iconSize: 20,
padding: EdgeInsets.only(bottom: 30),
onPressed: () {},
),
onChanged: (String str) {
model.searchData(str);
}),
])),
SizedBox(
height: 10.0,
),
@ -126,8 +121,7 @@ class _PatientsSearchResultScreenState
child: model.filterData.isEmpty
? Center(
child: ErrorMessage(
error: TranslationBase.of(context)
.youDontHaveAnyPatient,
error: TranslationBase.of(context).youDontHaveAnyPatient ?? "",
),
)
: ListView.builder(
@ -145,21 +139,16 @@ class _PatientsSearchResultScreenState
isInpatient: widget.isInpatient,
onTap: () {
// TODO change the parameter to daynamic
Navigator.of(context).pushNamed(
PATIENTS_PROFILE,
arguments: {
"patient": model.filterData[index],
"patientType": "1",
"from": widget
.patientSearchRequestModel.from,
"to": widget
.patientSearchRequestModel.from,
"isSearch": widget.isSearch,
"isInpatient": widget.isInpatient,
"arrivalType": "7",
"isSearchAndOut":
widget.isSearchAndOut,
});
Navigator.of(context).pushNamed(PATIENTS_PROFILE, arguments: {
"patient": model.filterData[index],
"patientType": "1",
"from": widget.patientSearchRequestModel.from,
"to": widget.patientSearchRequestModel.from,
"isSearch": widget.isSearch,
"isInpatient": widget.isInpatient,
"arrivalType": "7",
"isSearchAndOut": widget.isSearchAndOut,
});
},
// isFromSearch: widget.isSearch,
),

@ -29,7 +29,7 @@ class _PatientSearchScreenState extends State<PatientSearchScreen> {
TextEditingController middleNameInfoController = TextEditingController();
TextEditingController lastNameFileInfoController = TextEditingController();
PatientType selectedPatientType = PatientType.inPatient;
AuthenticationViewModel authenticationViewModel;
late AuthenticationViewModel authenticationViewModel;
@override
Widget build(BuildContext context) {
@ -44,58 +44,46 @@ class _PatientSearchScreenState extends State<PatientSearchScreen> {
child: Center(
child: Column(
children: [
BottomSheetTitle(
title: TranslationBase.of(context).searchPatient),
BottomSheetTitle(title: TranslationBase.of(context).searchPatient!!),
FractionallySizedBox(
widthFactor: 0.9,
child: Container(
color: Theme.of(context).scaffoldBackgroundColor,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(
height: 16,
),
SizedBox(
height: 10,
),
Container(
margin:
EdgeInsets.only(left: 0, right: 0, top: 15),
child: AppTextFieldCustom(
hintText: TranslationBase.of(context)
.patpatientIDMobilenationalientID,
isTextFieldHasSuffix: false,
maxLines: 1,
minLines: 1,
inputType: TextInputType.number,
hasBorder: true,
controller: patientFileInfoController,
inputFormatters: [
FilteringTextInputFormatter.allow(
RegExp(ONLY_NUMBERS))
],
onChanged: (_) {},
validationError: (isFormSubmitted &&
(patientFileInfoController
.text.isEmpty &&
firstNameInfoController
.text.isEmpty &&
middleNameInfoController
.text.isEmpty &&
lastNameFileInfoController
.text.isEmpty))
? TranslationBase.of(context).emptyMessage
: null,
),
),
SizedBox(
height: 5,
),
SizedBox(
height: MediaQuery.of(context).size.height * 0.12,
),
])),
child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
SizedBox(
height: 16,
),
SizedBox(
height: 10,
),
Container(
margin: EdgeInsets.only(left: 0, right: 0, top: 15),
child: AppTextFieldCustom(
hintText: TranslationBase.of(context).patpatientIDMobilenationalientID,
isTextFieldHasSuffix: false,
maxLines: 1,
minLines: 1,
inputType: TextInputType.number,
hasBorder: true,
controller: patientFileInfoController,
inputFormatters: [FilteringTextInputFormatter.allow(RegExp(ONLY_NUMBERS))],
onChanged: (_) {},
validationError: (isFormSubmitted &&
(patientFileInfoController.text.isEmpty &&
firstNameInfoController.text.isEmpty &&
middleNameInfoController.text.isEmpty &&
lastNameFileInfoController.text.isEmpty))
? TranslationBase.of(context).emptyMessage
: null,
),
),
SizedBox(
height: 5,
),
SizedBox(
height: MediaQuery.of(context).size.height * 0.12,
),
])),
),
],
),
@ -147,41 +135,29 @@ class _PatientSearchScreenState extends State<PatientSearchScreen> {
isFormSubmitted = true;
});
PatientSearchRequestModel patientSearchRequestModel =
PatientSearchRequestModel(
doctorID: authenticationViewModel.doctorProfile.doctorID);
PatientSearchRequestModel(doctorID: authenticationViewModel.doctorProfile!.doctorID);
if (showOther) {
patientSearchRequestModel.firstName =
firstNameInfoController.text.trim().isEmpty
? "0"
: firstNameInfoController.text.trim();
firstNameInfoController.text.trim().isEmpty ? "0" : firstNameInfoController.text.trim();
patientSearchRequestModel.middleName =
middleNameInfoController.text.trim().isEmpty
? "0"
: middleNameInfoController.text.trim();
middleNameInfoController.text.trim().isEmpty ? "0" : middleNameInfoController.text.trim();
patientSearchRequestModel.lastName =
lastNameFileInfoController.text.isEmpty
? "0"
: lastNameFileInfoController.text.trim();
lastNameFileInfoController.text.isEmpty ? "0" : lastNameFileInfoController.text.trim();
}
if (patientFileInfoController.text.isNotEmpty) {
if (patientFileInfoController.text.length == 10 &&
(patientFileInfoController.text[0] == '2' ||
patientFileInfoController.text[0] == '1')) {
patientSearchRequestModel.identificationNo =
patientFileInfoController.text;
(patientFileInfoController.text[0] == '2' || patientFileInfoController.text[0] == '1')) {
patientSearchRequestModel.identificationNo = patientFileInfoController.text;
patientSearchRequestModel.searchType = 2;
patientSearchRequestModel.patientID = 0;
} else if ((patientFileInfoController.text.length == 10 ||
patientFileInfoController.text.length == 9) &&
((patientFileInfoController.text[0] == '0' &&
patientFileInfoController.text[1] == '5') ||
} else if ((patientFileInfoController.text.length == 10 || patientFileInfoController.text.length == 9) &&
((patientFileInfoController.text[0] == '0' && patientFileInfoController.text[1] == '5') ||
patientFileInfoController.text[0] == '5')) {
patientSearchRequestModel.mobileNo = patientFileInfoController.text;
patientSearchRequestModel.searchType = 0;
} else {
patientSearchRequestModel.patientID =
int.parse(patientFileInfoController.text);
patientSearchRequestModel.patientID = int.parse(patientFileInfoController.text);
patientSearchRequestModel.searchType = 1;
}
}
@ -201,8 +177,7 @@ class _PatientSearchScreenState extends State<PatientSearchScreen> {
builder: (BuildContext context) => PatientsSearchResultScreen(
selectedPatientType: selectedPatientType,
patientSearchRequestModel: patientSearchRequestModel,
isSearchWithKeyInfo:
patientFileInfoController.text.isNotEmpty ? true : false,
isSearchWithKeyInfo: patientFileInfoController.text.isNotEmpty ? true : false,
isSearch: true,
isSearchAndOut: true,
searchKey: patientFileInfoController.text,

@ -1,110 +0,0 @@
import 'package:doctor_app_flutter/config/size_config.dart';
import 'package:doctor_app_flutter/core/enum/patient_type.dart';
import 'package:doctor_app_flutter/core/model/patient_muse/PatientSearchRequestModel.dart';
import 'package:doctor_app_flutter/core/viewModel/PatientSearchViewModel.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart';
import 'package:flutter/material.dart';
import 'package:hexcolor/hexcolor.dart';
class TimeBar extends StatefulWidget {
final PatientSearchViewModel model;
final PatientType selectedPatientType;
final PatientSearchRequestModel patientSearchRequestModel;
final bool isSearchWithKeyInfo;
const TimeBar(
{Key key,
this.model,
this.selectedPatientType,
this.patientSearchRequestModel,
this.isSearchWithKeyInfo})
: super(key: key);
@override
_TimeBarState createState() => _TimeBarState();
}
class _TimeBarState extends State<TimeBar> {
@override
Widget build(BuildContext context) {
List _locations = [
TranslationBase.of(context).today,
TranslationBase.of(context).tomorrow,
TranslationBase.of(context).nextWeek,
];
int _activeLocation = 0;
return Container(
height: MediaQuery.of(context).size.height * 0.0619,
width: SizeConfig.screenWidth * 0.94,
decoration: BoxDecoration(
color: Color(0Xffffffff),
borderRadius: BorderRadius.circular(12.5),
// border: Border.all(
// width: 0.5,
// ),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
mainAxisSize: MainAxisSize.max,
crossAxisAlignment: CrossAxisAlignment.center,
children: _locations.map((item) {
bool _isActive = _locations[_activeLocation] == item ? true : false;
return Column(mainAxisSize: MainAxisSize.min, children: <Widget>[
InkWell(
child: Center(
child: Container(
height: MediaQuery.of(context).size.height * 0.058,
width: SizeConfig.screenWidth * 0.2334,
decoration: BoxDecoration(
borderRadius: BorderRadius.only(
bottomRight: Radius.circular(12.5),
topRight: Radius.circular(12.5),
topLeft: Radius.circular(9.5),
bottomLeft: Radius.circular(9.5)),
color: _isActive ? HexColor("#B8382B") : Colors.white,
),
child: Center(
child: Text(
item,
style: TextStyle(
fontSize: 12,
color: _isActive
? Colors.white
: Colors.black, //Colors.black,
fontWeight: FontWeight.normal,
),
),
)),
),
onTap: () async {
setState(() {
_activeLocation = _locations.indexOf(item);
});
GifLoaderDialogUtils.showMyDialog(context);
await widget.model.getPatientBasedOnDate(
item: item,
selectedPatientType: widget.selectedPatientType,
patientSearchRequestModel:
widget.patientSearchRequestModel,
isSearchWithKeyInfo: widget.isSearchWithKeyInfo);
GifLoaderDialogUtils.hideDialog(context);
}),
_isActive
? Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.only(
bottomRight: Radius.circular(10),
topRight: Radius.circular(10)),
color: Colors.white),
alignment: Alignment.center,
height: 1,
width: SizeConfig.screenWidth * 0.23,
)
: Container()
]);
}).toList(),
),
);
}
}

@ -31,7 +31,7 @@ class _UcafDetailScreenState extends State<UcafDetailScreen> {
@override
Widget build(BuildContext context) {
final routeArgs = ModalRoute.of(context).settings.arguments as Map;
final routeArgs = ModalRoute.of(context)!.settings.arguments as Map;
PatiantInformtion patient = routeArgs['patient'];
String patientType = routeArgs['patientType'];
String arrivalType = routeArgs['arrivalType'];
@ -47,9 +47,8 @@ class _UcafDetailScreenState extends State<UcafDetailScreen> {
builder: (_, model, w) => AppScaffold(
baseViewModel: model,
isShowAppBar: true,
appBar: PatientProfileHeaderNewDesignAppBar(
patient, patientType, arrivalType),
appBarTitle: TranslationBase.of(context).ucaf,
appBar: PatientProfileHeaderNewDesignAppBar(patient, patientType, arrivalType),
appBarTitle: TranslationBase.of(context).ucaf ?? "",
body: Column(
children: [
Expanded(
@ -88,17 +87,14 @@ class _UcafDetailScreenState extends State<UcafDetailScreen> {
height: 10,
),
Container(
margin: EdgeInsets.symmetric(
vertical: 16, horizontal: 16),
margin: EdgeInsets.symmetric(vertical: 16, horizontal: 16),
child: Column(
children: [
treatmentStepsBar(
context, model, screenSize, patient),
treatmentStepsBar(context, model, screenSize, patient),
SizedBox(
height: 16,
),
...getSelectedTreatmentStepItem(
context, model),
...getSelectedTreatmentStepItem(context, model),
],
),
),
@ -124,8 +120,7 @@ class _UcafDetailScreenState extends State<UcafDetailScreen> {
fontSize: 2.2,
onPressed: () {
Navigator.of(context).popUntil((route) {
return route.settings.name ==
PATIENTS_PROFILE;
return route.settings.name == PATIENTS_PROFILE;
});
},
),
@ -148,12 +143,9 @@ class _UcafDetailScreenState extends State<UcafDetailScreen> {
onPressed: () async {
await model.postUCAF(patient);
if (model.state == ViewState.Idle) {
DrAppToastMsg.showSuccesToast(
TranslationBase.of(context)
.postUcafSuccessMsg);
DrAppToastMsg.showSuccesToast(TranslationBase.of(context).postUcafSuccessMsg);
Navigator.of(context).popUntil((route) {
return route.settings.name ==
PATIENTS_PROFILE;
return route.settings.name == PATIENTS_PROFILE;
});
} else {
DrAppToastMsg.showErrorToast(model.error);
@ -170,17 +162,15 @@ class _UcafDetailScreenState extends State<UcafDetailScreen> {
));
}
Widget treatmentStepsBar(BuildContext _context, UcafViewModel model,
Size screenSize, PatiantInformtion patient) {
Widget treatmentStepsBar(BuildContext _context, UcafViewModel model, Size screenSize, PatiantInformtion patient) {
List<String> __treatmentSteps = [
TranslationBase.of(context).diagnosis.toUpperCase(),
TranslationBase.of(context).medications.toUpperCase(),
TranslationBase.of(context).procedures.toUpperCase(),
TranslationBase.of(context).diagnosis ?? "".toUpperCase(),
TranslationBase.of(context).medications ?? "".toUpperCase(),
TranslationBase.of(context).procedures ?? "".toUpperCase(),
];
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,
@ -192,16 +182,13 @@ class _UcafDetailScreenState extends State<UcafDetailScreen> {
child: Container(
height: screenSize.height * 0.070,
decoration: Helpers.containerBorderDecoration(
_isActive ? HexColor("#B8382B") : Colors.white,
_isActive ? HexColor("#B8382B") : Colors.white),
_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,
color: _isActive ? Colors.white : Colors.black, //Colors.black,
fontWeight: FontWeight.bold,
),
),
@ -228,16 +215,13 @@ class _UcafDetailScreenState extends State<UcafDetailScreen> {
);
}
List<Widget> getSelectedTreatmentStepItem(
BuildContext _context, UcafViewModel model) {
List<Widget> getSelectedTreatmentStepItem(BuildContext _context, UcafViewModel model) {
switch (_activeTap) {
case 0:
if (model.patientAssessmentList != null) {
return [
...List.generate(
model.patientAssessmentList.length,
(index) => DiagnosisWidget(
model, model.patientAssessmentList[index])).toList()
...List.generate(model.patientAssessmentList.length,
(index) => DiagnosisWidget(model, model.patientAssessmentList[index])).toList()
];
} else {
return [
@ -247,22 +231,15 @@ class _UcafDetailScreenState extends State<UcafDetailScreen> {
break;
case 1:
return [
...List.generate(
model.prescriptionList != null
? model.prescriptionList.entityList.length
: 0,
(index) => MedicationWidget(
model, model.prescriptionList.entityList[index])).toList()
...List.generate(model.prescriptionList != null ? model.prescriptionList!.entityList!.length : 0,
(index) => MedicationWidget(model, model.prescriptionList!.entityList![index])).toList()
];
break;
case 2:
if (model.orderProcedures != null) {
return [
...List.generate(
model.orderProcedures.length,
(index) =>
ProceduresWidget(model, model.orderProcedures[index]))
.toList()
model.orderProcedures.length, (index) => ProceduresWidget(model, model.orderProcedures[index])).toList()
];
} else {
return [
@ -286,12 +263,10 @@ class DiagnosisWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
MasterKeyModel diagnosisType = model.findMasterDataById(
masterKeys: MasterKeysService.DiagnosisType,
id: diagnosis.diagnosisTypeID);
MasterKeyModel diagnosisCondition = model.findMasterDataById(
masterKeys: MasterKeysService.DiagnosisCondition,
id: diagnosis.conditionID);
MasterKeyModel? diagnosisType =
model.findMasterDataById(masterKeys: MasterKeysService.DiagnosisType, id: diagnosis.diagnosisTypeID);
MasterKeyModel? diagnosisCondition =
model.findMasterDataById(masterKeys: MasterKeysService.DiagnosisCondition, id: diagnosis.conditionID);
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
@ -562,7 +537,7 @@ class ProceduresWidget extends StatelessWidget {
AppText(
"${procedure.isCovered}",
fontWeight: FontWeight.normal,
color: procedure.isCovered ? Colors.green : Colors.red,
color: procedure.isCovered! ? Colors.green : Colors.red,
fontSize: SizeConfig.textMultiplier * 2.0,
),
SizedBox(

@ -53,7 +53,7 @@ class _UCAFInputScreenState extends State<UCAFInputScreen> {
@override
Widget build(BuildContext context) {
final routeArgs = ModalRoute.of(context).settings.arguments as Map;
final routeArgs = ModalRoute.of(context)!.settings.arguments as Map;
PatiantInformtion patient = routeArgs['patient'];
String patientType = routeArgs['patientType'];
String arrivalType = routeArgs['arrivalType'];
@ -65,9 +65,8 @@ class _UCAFInputScreenState extends State<UCAFInputScreen> {
builder: (_, model, w) => AppScaffold(
baseViewModel: model,
isShowAppBar: true,
appBar: PatientProfileHeaderNewDesignAppBar(
patient, patientType, arrivalType),
appBarTitle: TranslationBase.of(context).ucaf,
appBar: PatientProfileHeaderNewDesignAppBar(patient, patientType, arrivalType),
appBarTitle: TranslationBase.of(context).ucaf ?? "",
body: model.patientVitalSignsHistory.length > 0 &&
model.patientChiefComplaintList != null &&
model.patientChiefComplaintList.length > 0
@ -105,8 +104,7 @@ class _UCAFInputScreenState extends State<UCAFInputScreen> {
screenSize: screenSize,
),
Container(
margin: EdgeInsets.symmetric(
vertical: 0, horizontal: 16),
margin: EdgeInsets.symmetric(vertical: 0, horizontal: 16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
@ -160,8 +158,7 @@ class _UCAFInputScreenState extends State<UCAFInputScreen> {
height: 16,
),*/
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: [
@ -175,8 +172,7 @@ class _UCAFInputScreenState extends State<UCAFInputScreen> {
),
AppText(
"BP (H/L)",
fontSize:
SizeConfig.textMultiplier * 1.8,
fontSize: SizeConfig.textMultiplier * 1.8,
color: Colors.black,
fontWeight: FontWeight.normal,
),
@ -185,8 +181,7 @@ class _UCAFInputScreenState extends State<UCAFInputScreen> {
),
AppText(
"${model.bloodPressure}",
fontSize:
SizeConfig.textMultiplier * 2,
fontSize: SizeConfig.textMultiplier * 2,
color: Colors.grey.shade800,
fontWeight: FontWeight.w700,
),
@ -200,8 +195,7 @@ class _UCAFInputScreenState extends State<UCAFInputScreen> {
children: [
AppText(
"${TranslationBase.of(context).temperature}",
fontSize:
SizeConfig.textMultiplier * 1.8,
fontSize: SizeConfig.textMultiplier * 1.8,
color: Colors.black,
fontWeight: FontWeight.normal,
),
@ -211,8 +205,7 @@ class _UCAFInputScreenState extends State<UCAFInputScreen> {
Expanded(
child: AppText(
"${model.temperatureCelcius}(C), ${(double.parse(model.temperatureCelcius) * (9 / 5) + 32).toStringAsFixed(2)}(F)",
fontSize:
SizeConfig.textMultiplier * 2,
fontSize: SizeConfig.textMultiplier * 2,
color: Colors.grey.shade800,
fontWeight: FontWeight.w700,
),
@ -226,15 +219,13 @@ class _UCAFInputScreenState extends State<UCAFInputScreen> {
height: 2,
),
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: [
AppText(
"${TranslationBase.of(context).pulseBeats}:",
fontSize:
SizeConfig.textMultiplier * 1.8,
fontSize: SizeConfig.textMultiplier * 1.8,
color: Colors.black,
fontWeight: FontWeight.normal,
),
@ -243,8 +234,7 @@ class _UCAFInputScreenState extends State<UCAFInputScreen> {
),
AppText(
"${model.hartRat}",
fontSize:
SizeConfig.textMultiplier * 2,
fontSize: SizeConfig.textMultiplier * 2,
color: Colors.grey.shade800,
fontWeight: FontWeight.w700,
),
@ -256,14 +246,13 @@ class _UCAFInputScreenState extends State<UCAFInputScreen> {
height: 16,
),
AppText(
TranslationBase.of(context)
.chiefComplaintsAndSymptoms,
TranslationBase.of(context).chiefComplaintsAndSymptoms,
fontFamily: 'Poppins',
fontSize: SizeConfig.textMultiplier * 2.2,
fontWeight: FontWeight.w700,
color: Color(0xFF2E303A),
),
/* SizedBox(
/* SizedBox(
height: 4,
),
AppText(
@ -278,11 +267,9 @@ class _UCAFInputScreenState extends State<UCAFInputScreen> {
height: 8,
),
AppTextFieldCustom(
hintText:
TranslationBase.of(context).instruction,
dropDownText: Helpers.parseHtmlString(model
.patientChiefComplaintList[0]
.chiefComplaint),
hintText: TranslationBase.of(context).instruction,
dropDownText:
Helpers.parseHtmlString(model.patientChiefComplaintList[0].chiefComplaint ?? ""),
controller: _additionalComplaintsController,
inputType: TextInputType.multiline,
enabled: false,
@ -323,7 +310,7 @@ class _UCAFInputScreenState extends State<UCAFInputScreen> {
SizedBox(
height: 8,
),
/* AppTextFieldCustom(
/* AppTextFieldCustom(
hintText: TranslationBase.of(context).other,
dropDownText: TranslationBase.of(context).none,
enabled: false,
@ -407,11 +394,7 @@ class _UCAFInputScreenState extends State<UCAFInputScreen> {
color: HexColor("#D02127"),
onPressed: () {
Navigator.of(context).pushNamed(PATIENT_UCAF_DETAIL,
arguments: {
'patient': patient,
'patientType': patientType,
'arrivalType': arrivalType
});
arguments: {'patient': patient, 'patientType': patientType, 'arrivalType': arrivalType});
},
),
),
@ -428,9 +411,9 @@ class _UCAFInputScreenState extends State<UCAFInputScreen> {
Padding(
padding: const EdgeInsets.all(8.0),
child: AppText(
model.patientVitalSignsHistory.length == 0
? TranslationBase.of(context).vitalSignEmptyMsg
: TranslationBase.of(context).chiefComplaintEmptyMsg,
model.patientVitalSignsHistory.length == 0
? TranslationBase.of(context).vitalSignEmptyMsg
: TranslationBase.of(context).chiefComplaintEmptyMsg,
fontWeight: FontWeight.normal,
textAlign: TextAlign.center,
color: HexColor("#B8382B"),

@ -17,7 +17,7 @@ class PageStepperWidget extends StatelessWidget {
final int currentStepIndex;
final Size screenSize;
PageStepperWidget({this.stepsCount, this.currentStepIndex, this.screenSize});
PageStepperWidget({required this.stepsCount, required this.currentStepIndex, required this.screenSize});
@override
Widget build(BuildContext context) {
@ -32,11 +32,9 @@ class PageStepperWidget extends StatelessWidget {
children: [
for (int i = 1; i <= stepsCount; i++)
if (i == currentStepIndex)
StepWidget(i, true, i == stepsCount, i < currentStepIndex,
dividerWidth)
StepWidget(i, true, i == stepsCount, i < currentStepIndex, dividerWidth)
else
StepWidget(i, false, i == stepsCount, i < currentStepIndex,
dividerWidth)
StepWidget(i, false, i == stepsCount, i < currentStepIndex, dividerWidth)
],
)
],
@ -46,15 +44,13 @@ class PageStepperWidget extends StatelessWidget {
}
class StepWidget extends StatelessWidget {
final int index;
final bool isInProgress;
final bool isFinalStep;
final bool isStepFinish;
final double dividerWidth;
StepWidget(this.index, this.isInProgress, this.isFinalStep, this.isStepFinish,
this.dividerWidth);
StepWidget(this.index, this.isInProgress, this.isFinalStep, this.isStepFinish, this.dividerWidth);
@override
Widget build(BuildContext context) {
@ -62,9 +58,9 @@ class StepWidget extends StatelessWidget {
if (isInProgress) {
status = StepStatus.InProgress;
} else {
if(isStepFinish){
if (isStepFinish) {
status = StepStatus.Completed;
}else {
} else {
status = StepStatus.Locked;
}
}
@ -80,10 +76,18 @@ class StepWidget extends StatelessWidget {
width: 30,
height: 30,
decoration: BoxDecoration(
color: status == StepStatus.InProgress ? Color(0xFFCC9B14) : status == StepStatus.Locked ? Color(0xFFE3E3E3) : Color(0xFF359846),
color: status == StepStatus.InProgress
? Color(0xFFCC9B14)
: status == StepStatus.Locked
? Color(0xFFE3E3E3)
: Color(0xFF359846),
shape: BoxShape.circle,
border: Border.all(
color: status == StepStatus.InProgress ? Color(0xFFCC9B14) : status == StepStatus.Locked ? Color(0xFFE3E3E3) : Color(0xFF359846),
color: status == StepStatus.InProgress
? Color(0xFFCC9B14)
: status == StepStatus.Locked
? Color(0xFFE3E3E3)
: Color(0xFF359846),
width: 1),
),
child: Center(
@ -124,11 +128,13 @@ class StepWidget extends StatelessWidget {
borderRadius: BorderRadius.all(
Radius.circular(4.0),
),
border: Border.all(color: status == StepStatus.InProgress
? Color(0xFFF1E9D3)
: status == StepStatus.Locked
? Color(0x29797979)
: Color(0xFFD8E8D8), width: 0.30),
border: Border.all(
color: status == StepStatus.InProgress
? Color(0xFFF1E9D3)
: status == StepStatus.Locked
? Color(0x29797979)
: Color(0xFFD8E8D8),
width: 0.30),
),
child: AppText(
status == StepStatus.InProgress
@ -143,8 +149,8 @@ class StepWidget extends StatelessWidget {
color: status == StepStatus.InProgress
? Color(0xFFCC9B14)
: status == StepStatus.Locked
? Color(0xFF969696)
: Color(0xFF359846),
? Color(0xFF969696)
: Color(0xFF359846),
),
)
],
@ -156,4 +162,4 @@ enum StepStatus {
InProgress,
Locked,
Completed,
}
}

@ -23,12 +23,10 @@ import '../../../../routes.dart';
class AdmissionRequestFirstScreen extends StatefulWidget {
@override
_AdmissionRequestThirdScreenState createState() =>
_AdmissionRequestThirdScreenState();
_AdmissionRequestThirdScreenState createState() => _AdmissionRequestThirdScreenState();
}
class _AdmissionRequestThirdScreenState
extends State<AdmissionRequestFirstScreen> {
class _AdmissionRequestThirdScreenState extends State<AdmissionRequestFirstScreen> {
final _dietTypeRemarksController = TextEditingController();
final _sickLeaveCommentsController = TextEditingController();
final _postMedicalHistoryController = TextEditingController();
@ -41,16 +39,16 @@ class _AdmissionRequestThirdScreenState
bool _isSickLeaveRequired = false;
bool _patientPregnant = false;
String clinicError;
String doctorError;
String sickLeaveCommentError;
String dietTypeError;
String medicalHistoryError;
String surgicalHistoryError;
String? clinicError;
String? doctorError;
String? sickLeaveCommentError;
String? dietTypeError;
String? medicalHistoryError;
String? surgicalHistoryError;
@override
Widget build(BuildContext context) {
final routeArgs = ModalRoute.of(context).settings.arguments as Map;
final routeArgs = ModalRoute.of(context)!.settings.arguments as Map;
PatiantInformtion patient = routeArgs['patient'];
String patientType = routeArgs['patientType'];
String arrivalType = routeArgs['arrivalType'];
@ -61,9 +59,8 @@ class _AdmissionRequestThirdScreenState
builder: (_, model, w) => AppScaffold(
baseViewModel: model,
isShowAppBar: true,
appBar: PatientProfileHeaderNewDesignAppBar(
patient, patientType, arrivalType),
appBarTitle: TranslationBase.of(context).admissionRequest,
appBar: PatientProfileHeaderNewDesignAppBar(patient, patientType, arrivalType),
appBarTitle: TranslationBase.of(context).admissionRequest!,
body: GestureDetector(
onTap: () {
FocusScopeNode currentFocus = FocusScope.of(context);
@ -100,14 +97,12 @@ class _AdmissionRequestThirdScreenState
),
),
Container(
margin:
EdgeInsets.symmetric(vertical: 0, horizontal: 16),
margin: EdgeInsets.symmetric(vertical: 0, horizontal: 16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
AppText(
TranslationBase.of(context)
.specialityAndDoctorDetail,
TranslationBase.of(context).specialityAndDoctorDetail,
color: Color(0xFF2E303A),
fontSize: SizeConfig.textMultiplier * 1.8,
fontWeight: FontWeight.w700,
@ -121,14 +116,15 @@ class _AdmissionRequestThirdScreenState
isTextFieldHasSuffix: true,
validationError: clinicError,
dropDownText: _selectedClinic != null
? projectViewModel.isArabic? _selectedClinic['clinicNameArabic'] : _selectedClinic['clinicNameEnglish']
? projectViewModel.isArabic
? _selectedClinic['clinicNameArabic']
: _selectedClinic['clinicNameEnglish']
: null,
enabled: false,
onClick: model.clinicList != null &&
model.clinicList.length > 0
onClick: model.clinicList != null && model.clinicList.length > 0
? () {
openListDialogField(
projectViewModel.isArabic? 'clinicNameArabic' : 'clinicNameEnglish',
projectViewModel.isArabic ? 'clinicNameArabic' : 'clinicNameEnglish',
'clinicID',
model.clinicList, (selectedValue) {
setState(() {
@ -137,28 +133,21 @@ class _AdmissionRequestThirdScreenState
});
}
: () async {
GifLoaderDialogUtils.showMyDialog(
context);
await model.getClinics().then((_) =>
GifLoaderDialogUtils.hideDialog(
context));
if (model.state == ViewState.Idle &&
model.clinicList.length > 0) {
GifLoaderDialogUtils.showMyDialog(context);
await model.getClinics().then((_) => GifLoaderDialogUtils.hideDialog(context));
if (model.state == ViewState.Idle && model.clinicList.length > 0) {
openListDialogField(
projectViewModel.isArabic? 'clinicNameArabic' : 'clinicNameEnglish',
projectViewModel.isArabic ? 'clinicNameArabic' : 'clinicNameEnglish',
'clinicID',
model.clinicList, (selectedValue) {
setState(() {
_selectedClinic = selectedValue;
});
});
} else if (model.state ==
ViewState.ErrorLocal) {
DrAppToastMsg.showErrorToast(
model.error);
} else if (model.state == ViewState.ErrorLocal) {
DrAppToastMsg.showErrorToast(model.error);
} else {
DrAppToastMsg.showErrorToast(
"Empty List");
DrAppToastMsg.showErrorToast("Empty List");
}
},
),
@ -169,17 +158,13 @@ class _AdmissionRequestThirdScreenState
height: screenSize.height * 0.075,
hintText: TranslationBase.of(context).doctor,
isTextFieldHasSuffix: true,
dropDownText: _selectedDoctor != null
? _selectedDoctor['DoctorName']
: null,
dropDownText: _selectedDoctor != null ? _selectedDoctor['DoctorName'] : null,
enabled: false,
validationError: doctorError,
onClick: _selectedClinic != null
? model.doctorsList != null &&
model.doctorsList.length > 0
? model.doctorsList != null && model.doctorsList.length > 0
? () {
openListDialogField('DoctorName',
'DoctorID', model.doctorsList,
openListDialogField('DoctorName', 'DoctorID', model.doctorsList,
(selectedValue) {
setState(() {
_selectedDoctor = selectedValue;
@ -187,29 +172,21 @@ class _AdmissionRequestThirdScreenState
});
}
: () async {
GifLoaderDialogUtils.showMyDialog(
context);
GifLoaderDialogUtils.showMyDialog(context);
await model
.getClinicDoctors(
_selectedClinic['clinicID'])
.then((_) => GifLoaderDialogUtils
.hideDialog(context));
if (model.state == ViewState.Idle &&
model.doctorsList.length > 0) {
openListDialogField('DoctorName',
'DoctorID', model.doctorsList,
.getClinicDoctors(_selectedClinic['clinicID'])
.then((_) => GifLoaderDialogUtils.hideDialog(context));
if (model.state == ViewState.Idle && model.doctorsList.length > 0) {
openListDialogField('DoctorName', 'DoctorID', model.doctorsList,
(selectedValue) {
setState(() {
_selectedDoctor = selectedValue;
});
});
} else if (model.state ==
ViewState.ErrorLocal) {
DrAppToastMsg.showErrorToast(
model.error);
} else if (model.state == ViewState.ErrorLocal) {
DrAppToastMsg.showErrorToast(model.error);
} else {
DrAppToastMsg.showErrorToast(
"Empty List");
DrAppToastMsg.showErrorToast("Empty List");
}
}
: null,
@ -226,7 +203,7 @@ class _AdmissionRequestThirdScreenState
SizedBox(
height: 10,
),
if(patient.gender != 1)
if (patient.gender != 1)
CheckboxListTile(
title: AppText(
TranslationBase.of(context).patientPregnant,
@ -238,7 +215,7 @@ class _AdmissionRequestThirdScreenState
activeColor: HexColor("#D02127"),
onChanged: (newValue) {
setState(() {
_patientPregnant = newValue;
_patientPregnant = newValue!;
});
},
controlAffinity: ListTileControlAffinity.leading,
@ -255,15 +232,14 @@ class _AdmissionRequestThirdScreenState
activeColor: HexColor("#D02127"),
onChanged: (newValue) {
setState(() {
_isSickLeaveRequired = newValue;
_isSickLeaveRequired = newValue!;
});
},
controlAffinity: ListTileControlAffinity.leading,
contentPadding: EdgeInsets.all(0),
),
AppTextFieldCustom(
hintText:
TranslationBase.of(context).sickLeaveComments,
hintText: TranslationBase.of(context).sickLeaveComments,
controller: _sickLeaveCommentsController,
minLines: 2,
maxLines: 4,
@ -278,43 +254,31 @@ class _AdmissionRequestThirdScreenState
hintText: TranslationBase.of(context).dietType,
isTextFieldHasSuffix: true,
validationError: dietTypeError,
dropDownText: _selectedDietType != null
? _selectedDietType['nameEn']
: null,
dropDownText: _selectedDietType != null ? _selectedDietType['nameEn'] : null,
enabled: false,
onClick: model.dietTypesList != null &&
model.dietTypesList.length > 0
onClick: model.dietTypesList != null && model.dietTypesList.length > 0
? () {
openListDialogField(
'nameEn', 'id', model.dietTypesList,
(selectedValue) {
openListDialogField('nameEn', 'id', model.dietTypesList, (selectedValue) {
setState(() {
_selectedDietType = selectedValue;
});
});
}
: () async {
GifLoaderDialogUtils.showMyDialog(
context);
await model.getDietTypes(patient.patientId).then((_) =>
GifLoaderDialogUtils.hideDialog(
context));
if (model.state == ViewState.Idle &&
model.dietTypesList.length > 0) {
openListDialogField(
'nameEn', 'id', model.dietTypesList,
(selectedValue) {
GifLoaderDialogUtils.showMyDialog(context);
await model
.getDietTypes(patient.patientId)
.then((_) => GifLoaderDialogUtils.hideDialog(context));
if (model.state == ViewState.Idle && model.dietTypesList.length > 0) {
openListDialogField('nameEn', 'id', model.dietTypesList, (selectedValue) {
setState(() {
_selectedDietType = selectedValue;
});
});
} else if (model.state ==
ViewState.ErrorLocal) {
DrAppToastMsg.showErrorToast(
model.error);
} else if (model.state == ViewState.ErrorLocal) {
DrAppToastMsg.showErrorToast(model.error);
} else {
DrAppToastMsg.showErrorToast(
"Empty List");
DrAppToastMsg.showErrorToast("Empty List");
}
},
),
@ -322,8 +286,7 @@ class _AdmissionRequestThirdScreenState
height: 10,
),
AppTextFieldCustom(
hintText:
TranslationBase.of(context).dietTypeRemarks,
hintText: TranslationBase.of(context).dietTypeRemarks,
controller: _dietTypeRemarksController,
minLines: 4,
maxLines: 6,
@ -370,75 +333,60 @@ class _AdmissionRequestThirdScreenState
_sickLeaveCommentsController.text != "" &&
_postMedicalHistoryController.text != "" &&
_postSurgicalHistoryController.text != "") {
model.admissionRequestData.patientMRN =
patient.patientMRN;
model.admissionRequestData.appointmentNo =
patient.appointmentNo;
model.admissionRequestData.patientMRN = patient.patientMRN!;
model.admissionRequestData.appointmentNo = patient.appointmentNo;
model.admissionRequestData.episodeID = patient.episodeNo;
model.admissionRequestData.admissionRequestNo = 0;
model.admissionRequestData.admitToClinic =
_selectedClinic['clinicID'];
model.admissionRequestData.mrpDoctorID =
_selectedDoctor['DoctorID'];
model.admissionRequestData.admitToClinic = _selectedClinic['clinicID'];
model.admissionRequestData.mrpDoctorID = _selectedDoctor['DoctorID'];
model.admissionRequestData.isPregnant = _patientPregnant;
model.admissionRequestData.isSickLeaveRequired =
_isSickLeaveRequired;
model.admissionRequestData.sickLeaveComments =
_sickLeaveCommentsController.text;
model.admissionRequestData.isDietType =
_selectedDietType != null ? true : false;
model.admissionRequestData.dietType =
_selectedDietType != null
? _selectedDietType['id']
: 0;
model.admissionRequestData.dietRemarks =
_dietTypeRemarksController.text;
model.admissionRequestData.pastMedicalHistory =
_postMedicalHistoryController.text;
model.admissionRequestData.pastSurgicalHistory =
_postSurgicalHistoryController.text;
Navigator.of(context)
.pushNamed(PATIENT_ADMISSION_REQUEST_2, arguments: {
model.admissionRequestData.isSickLeaveRequired = _isSickLeaveRequired;
model.admissionRequestData.sickLeaveComments = _sickLeaveCommentsController.text;
model.admissionRequestData.isDietType = _selectedDietType != null ? true : false;
model.admissionRequestData.dietType = _selectedDietType != null ? _selectedDietType['id'] : 0;
model.admissionRequestData.dietRemarks = _dietTypeRemarksController.text;
model.admissionRequestData.pastMedicalHistory = _postMedicalHistoryController.text;
model.admissionRequestData.pastSurgicalHistory = _postSurgicalHistoryController.text;
Navigator.of(context).pushNamed(PATIENT_ADMISSION_REQUEST_2, arguments: {
'patient': patient,
'patientType': patientType,
'arrivalType': arrivalType,
'admission-data': model.admissionRequestData
});
} else {
DrAppToastMsg.showErrorToast(
TranslationBase.of(context).pleaseFill);
DrAppToastMsg.showErrorToast(TranslationBase.of(context).pleaseFill);
setState(() {
if(_selectedClinic == null){
if (_selectedClinic == null) {
clinicError = TranslationBase.of(context).fieldRequired;
}else {
} else {
clinicError = null;
}
if(_selectedDoctor == null){
if (_selectedDoctor == null) {
doctorError = TranslationBase.of(context).fieldRequired;
}else {
} else {
doctorError = null;
}
if(_sickLeaveCommentsController.text == ""){
if (_sickLeaveCommentsController.text == "") {
sickLeaveCommentError = TranslationBase.of(context).fieldRequired;
}else {
} else {
sickLeaveCommentError = null;
}
if(_selectedDietType == null){
if (_selectedDietType == null) {
dietTypeError = TranslationBase.of(context).fieldRequired;
}else {
dietTypeError = null;
} else {
dietTypeError = "";
}
if(_postMedicalHistoryController.text == ""){
if (_postMedicalHistoryController.text == "") {
medicalHistoryError = TranslationBase.of(context).fieldRequired;
}else {
} else {
medicalHistoryError = null;
}
if(_postSurgicalHistoryController.text == ""){
if (_postSurgicalHistoryController.text == "") {
surgicalHistoryError = TranslationBase.of(context).fieldRequired;
}else {
} else {
surgicalHistoryError = null;
}
});
@ -453,8 +401,8 @@ class _AdmissionRequestThirdScreenState
);
}
void openListDialogField(String attributeName, String attributeValueId,
List<dynamic> list, Function(dynamic selectedValue) okFunction) {
void openListDialogField(
String attributeName, String attributeValueId, List<dynamic> list, Function(dynamic selectedValue) okFunction) {
ListSelectDialog dialog = ListSelectDialog(
list: list,
attributeName: attributeName,

@ -23,23 +23,21 @@ import '../../../../routes.dart';
class AdmissionRequestThirdScreen extends StatefulWidget {
@override
_AdmissionRequestThirdScreenState createState() =>
_AdmissionRequestThirdScreenState();
_AdmissionRequestThirdScreenState createState() => _AdmissionRequestThirdScreenState();
}
class _AdmissionRequestThirdScreenState
extends State<AdmissionRequestThirdScreen> {
class _AdmissionRequestThirdScreenState extends State<AdmissionRequestThirdScreen> {
dynamic _selectedDiagnosis;
dynamic _selectedIcd;
dynamic _selectedDiagnosisType;
String diagnosisError;
String icdError;
String diagnosisTypeError;
String? diagnosisError;
String? icdError;
String? diagnosisTypeError;
@override
Widget build(BuildContext context) {
final routeArgs = ModalRoute.of(context).settings.arguments as Map;
final routeArgs = ModalRoute.of(context)!.settings.arguments as Map;
PatiantInformtion patient = routeArgs['patient'];
String patientType = routeArgs['patientType'];
String arrivalType = routeArgs['arrivalType'];
@ -52,9 +50,8 @@ class _AdmissionRequestThirdScreenState
builder: (_, model, w) => AppScaffold(
baseViewModel: model,
isShowAppBar: true,
appBar: PatientProfileHeaderNewDesignAppBar(
patient, patientType, arrivalType),
appBarTitle: TranslationBase.of(context).admissionRequest,
appBar: PatientProfileHeaderNewDesignAppBar(patient, patientType, arrivalType),
appBarTitle: TranslationBase.of(context).admissionRequest!,
body: GestureDetector(
onTap: () {
FocusScopeNode currentFocus = FocusScope.of(context);
@ -106,18 +103,13 @@ class _AdmissionRequestThirdScreenState
AppTextFieldCustom(
height: screenSize.height * 0.075,
hintText: TranslationBase.of(context).diagnosis,
dropDownText: _selectedDiagnosis != null
? _selectedDiagnosis['nameEn']
: null,
dropDownText: _selectedDiagnosis != null ? _selectedDiagnosis['nameEn'] : null,
enabled: false,
isTextFieldHasSuffix: true,
validationError: diagnosisError,
onClick: model.diagnosisTypesList != null &&
model.diagnosisTypesList.length > 0
onClick: model.diagnosisTypesList != null && model.diagnosisTypesList.length > 0
? () {
openListDialogField('nameEn', 'id',
model.diagnosisTypesList,
(selectedValue) {
openListDialogField('nameEn', 'id', model.diagnosisTypesList, (selectedValue) {
setState(() {
_selectedDiagnosis = selectedValue;
});
@ -125,24 +117,17 @@ class _AdmissionRequestThirdScreenState
}
: () async {
GifLoaderDialogUtils.showMyDialog(context);
await model.getDiagnosis().then((_) =>
GifLoaderDialogUtils.hideDialog(
context));
if (model.state == ViewState.Idle &&
model.diagnosisTypesList.length > 0) {
openListDialogField('nameEn', 'id',
model.diagnosisTypesList,
(selectedValue) {
await model.getDiagnosis().then((_) => GifLoaderDialogUtils.hideDialog(context));
if (model.state == ViewState.Idle && model.diagnosisTypesList.length > 0) {
openListDialogField('nameEn', 'id', model.diagnosisTypesList, (selectedValue) {
setState(() {
_selectedDiagnosis = selectedValue;
});
});
} else if (model.state ==
ViewState.ErrorLocal) {
} else if (model.state == ViewState.ErrorLocal) {
DrAppToastMsg.showErrorToast(model.error);
} else {
DrAppToastMsg.showErrorToast(
"Empty List");
DrAppToastMsg.showErrorToast("Empty List");
}
},
),
@ -152,18 +137,13 @@ class _AdmissionRequestThirdScreenState
AppTextFieldCustom(
height: screenSize.height * 0.075,
hintText: TranslationBase.of(context).icd,
dropDownText: _selectedIcd != null
? _selectedIcd['description']
: null,
dropDownText: _selectedIcd != null ? _selectedIcd['description'] : null,
enabled: false,
isTextFieldHasSuffix: true,
validationError: icdError,
onClick: model.icdCodes != null &&
model.icdCodes.length > 0
onClick: model.icdCodes != null && model.icdCodes.length > 0
? () {
openListDialogField(
'description', 'code', model.icdCodes,
(selectedValue) {
openListDialogField('description', 'code', model.icdCodes, (selectedValue) {
setState(() {
_selectedIcd = selectedValue;
});
@ -172,25 +152,18 @@ class _AdmissionRequestThirdScreenState
: () async {
GifLoaderDialogUtils.showMyDialog(context);
await model
.getICDCodes(patient.patientMRN)
.then((_) =>
GifLoaderDialogUtils.hideDialog(
context));
if (model.state == ViewState.Idle &&
model.icdCodes.length > 0) {
openListDialogField(
'description', 'code', model.icdCodes,
(selectedValue) {
.getICDCodes(patient.patientMRN!)
.then((_) => GifLoaderDialogUtils.hideDialog(context));
if (model.state == ViewState.Idle && model.icdCodes.length > 0) {
openListDialogField('description', 'code', model.icdCodes, (selectedValue) {
setState(() {
_selectedIcd = selectedValue;
});
});
} else if (model.state ==
ViewState.ErrorLocal) {
} else if (model.state == ViewState.ErrorLocal) {
DrAppToastMsg.showErrorToast(model.error);
} else {
DrAppToastMsg.showErrorToast(
"Empty List");
DrAppToastMsg.showErrorToast("Empty List");
}
},
),
@ -200,19 +173,14 @@ class _AdmissionRequestThirdScreenState
AppTextFieldCustom(
height: screenSize.height * 0.075,
hintText: TranslationBase.of(context).diagnoseType,
dropDownText: _selectedDiagnosisType != null
? _selectedDiagnosisType['description']
: null,
dropDownText: _selectedDiagnosisType != null ? _selectedDiagnosisType['description'] : null,
enabled: false,
isTextFieldHasSuffix: true,
validationError: diagnosisTypeError,
onClick: model.listOfDiagnosisSelectionTypes !=
null &&
model.listOfDiagnosisSelectionTypes.length >
0
onClick: model.listOfDiagnosisSelectionTypes != null &&
model.listOfDiagnosisSelectionTypes.length > 0
? () {
openListDialogField('description', 'code',
model.listOfDiagnosisSelectionTypes,
openListDialogField('description', 'code', model.listOfDiagnosisSelectionTypes,
(selectedValue) {
setState(() {
_selectedDiagnosisType = selectedValue;
@ -222,29 +190,20 @@ class _AdmissionRequestThirdScreenState
: () async {
GifLoaderDialogUtils.showMyDialog(context);
await model
.getMasterLookup(MasterKeysService
.DiagnosisSelectionType)
.then((_) =>
GifLoaderDialogUtils.hideDialog(
context));
.getMasterLookup(MasterKeysService.DiagnosisSelectionType)
.then((_) => GifLoaderDialogUtils.hideDialog(context));
if (model.state == ViewState.Idle &&
model.listOfDiagnosisSelectionTypes
.length >
0) {
openListDialogField('description', 'code',
model.listOfDiagnosisSelectionTypes,
model.listOfDiagnosisSelectionTypes.length > 0) {
openListDialogField('description', 'code', model.listOfDiagnosisSelectionTypes,
(selectedValue) {
setState(() {
_selectedDiagnosisType =
selectedValue;
_selectedDiagnosisType = selectedValue;
});
});
} else if (model.state ==
ViewState.ErrorLocal) {
} else if (model.state == ViewState.ErrorLocal) {
DrAppToastMsg.showErrorToast(model.error);
} else {
DrAppToastMsg.showErrorToast(
"Empty List");
DrAppToastMsg.showErrorToast("Empty List");
}
},
),
@ -279,58 +238,48 @@ class _AdmissionRequestThirdScreenState
title: TranslationBase.of(context).submit,
color: HexColor("#359846"),
onPressed: () async {
if (_selectedDiagnosis != null &&
_selectedIcd != null &&
_selectedDiagnosisType != null) {
if (_selectedDiagnosis != null && _selectedIcd != null && _selectedDiagnosisType != null) {
model.admissionRequestData = admissionRequest;
dynamic admissionRequestDiagnoses = [
{
'diagnosisDescription':
_selectedDiagnosis['nameEn'],
'diagnosisDescription': _selectedDiagnosis['nameEn'],
'diagnosisType': _selectedDiagnosis['id'],
'icdCode': _selectedIcd['code'],
'icdCodeDescription':
_selectedIcd['description'],
'icdCodeDescription': _selectedIcd['description'],
'type': _selectedDiagnosisType['code'],
'remarks': "",
'isActive': true,
}
];
model.admissionRequestData
.admissionRequestDiagnoses =
admissionRequestDiagnoses;
model.admissionRequestData.admissionRequestDiagnoses = admissionRequestDiagnoses;
await model.makeAdmissionRequest();
if (model.state == ViewState.ErrorLocal) {
DrAppToastMsg.showErrorToast(model.error);
} else {
DrAppToastMsg.showSuccesToast(
TranslationBase.of(context)
.admissionRequestSuccessMsg);
Navigator.popUntil(context,
ModalRoute.withName(PATIENTS_PROFILE));
DrAppToastMsg.showSuccesToast(TranslationBase.of(context).admissionRequestSuccessMsg);
Navigator.popUntil(context, ModalRoute.withName(PATIENTS_PROFILE));
}
} else {
DrAppToastMsg.showErrorToast(
TranslationBase.of(context).pleaseFill);
DrAppToastMsg.showErrorToast(TranslationBase.of(context).pleaseFill);
setState(() {
if(_selectedDiagnosis == null){
if (_selectedDiagnosis == null) {
diagnosisError = TranslationBase.of(context).fieldRequired;
}else {
} else {
diagnosisError = null;
}
if(_selectedIcd == null){
if (_selectedIcd == null) {
icdError = TranslationBase.of(context).fieldRequired;
}else {
} else {
icdError = null;
}
if(_selectedDiagnosisType == null){
if (_selectedDiagnosisType == null) {
diagnosisTypeError = TranslationBase.of(context).fieldRequired;
}else {
} else {
diagnosisTypeError = null;
}
});
@ -348,8 +297,8 @@ class _AdmissionRequestThirdScreenState
);
}
void openListDialogField(String attributeName, String attributeValueId,
List<dynamic> list, Function(dynamic selectedValue) okFunction) {
void openListDialogField(
String attributeName, String attributeValueId, List<dynamic> list, Function(dynamic selectedValue) okFunction) {
ListSelectDialog dialog = ListSelectDialog(
list: list,
attributeName: attributeName,

@ -26,12 +26,10 @@ import '../../../../routes.dart';
class AdmissionRequestSecondScreen extends StatefulWidget {
@override
_AdmissionRequestSecondScreenState createState() =>
_AdmissionRequestSecondScreenState();
_AdmissionRequestSecondScreenState createState() => _AdmissionRequestSecondScreenState();
}
class _AdmissionRequestSecondScreenState
extends State<AdmissionRequestSecondScreen> {
class _AdmissionRequestSecondScreenState extends State<AdmissionRequestSecondScreen> {
final _postPlansEstimatedCostController = TextEditingController();
final _estimatedCostController = TextEditingController();
final _expectedDaysController = TextEditingController();
@ -40,28 +38,28 @@ class _AdmissionRequestSecondScreenState
final _complicationsController = TextEditingController();
final _otherProceduresController = TextEditingController();
DateTime _expectedAdmissionDate;
late DateTime _expectedAdmissionDate;
dynamic _selectedFloor;
dynamic _selectedWard;
dynamic _selectedRoomCategory;
dynamic _selectedAdmissionType;
String costError;
String plansError;
String otherInterventionsError;
String expectedDaysError;
String expectedDatesError;
String floorError;
String roomError;
String treatmentsError;
String complicationsError;
String proceduresError;
String admissionTypeError;
String? costError;
String? plansError;
String? otherInterventionsError;
String? expectedDaysError;
String? expectedDatesError;
String? floorError;
String? roomError;
String? treatmentsError;
String? complicationsError;
String? proceduresError;
String? admissionTypeError;
@override
Widget build(BuildContext context) {
final routeArgs = ModalRoute.of(context).settings.arguments as Map;
final routeArgs = ModalRoute.of(context)!.settings.arguments as Map;
PatiantInformtion patient = routeArgs['patient'];
String patientType = routeArgs['patientType'];
String arrivalType = routeArgs['arrivalType'];
@ -74,9 +72,8 @@ class _AdmissionRequestSecondScreenState
builder: (_, model, w) => AppScaffold(
baseViewModel: model,
isShowAppBar: true,
appBar: PatientProfileHeaderNewDesignAppBar(
patient, patientType, arrivalType),
appBarTitle: TranslationBase.of(context).admissionRequest,
appBar: PatientProfileHeaderNewDesignAppBar(patient, patientType, arrivalType),
appBarTitle: TranslationBase.of(context).admissionRequest!,
body: GestureDetector(
onTap: () {
FocusScopeNode currentFocus = FocusScope.of(context);
@ -112,14 +109,12 @@ class _AdmissionRequestSecondScreenState
),
),
Container(
margin:
EdgeInsets.symmetric(vertical: 0, horizontal: 16),
margin: EdgeInsets.symmetric(vertical: 0, horizontal: 16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
AppText(
TranslationBase.of(context)
.postPlansEstimatedCost,
TranslationBase.of(context).postPlansEstimatedCost,
color: Color(0xFF2E303A),
fontSize: SizeConfig.textMultiplier * 1.8,
fontWeight: FontWeight.w700,
@ -129,15 +124,11 @@ class _AdmissionRequestSecondScreenState
),
AppTextFieldCustom(
height: screenSize.height * 0.075,
hintText:
TranslationBase.of(context).estimatedCost,
hintText: TranslationBase.of(context).estimatedCost,
controller: _estimatedCostController,
validationError: costError,
inputType: TextInputType.number,
inputFormatters: [
FilteringTextInputFormatter.allow(
RegExp(ONLY_NUMBERS))
],
inputFormatters: [FilteringTextInputFormatter.allow(RegExp(ONLY_NUMBERS))],
),
SizedBox(
height: 10,
@ -154,10 +145,8 @@ class _AdmissionRequestSecondScreenState
height: 10,
),
AppTextFieldCustom(
hintText: TranslationBase.of(context)
.otherDepartmentsInterventions,
controller:
_otherDepartmentsInterventionsController,
hintText: TranslationBase.of(context).otherDepartmentsInterventions,
controller: _otherDepartmentsInterventionsController,
inputType: TextInputType.multiline,
validationError: otherInterventionsError,
minLines: 2,
@ -177,23 +166,18 @@ class _AdmissionRequestSecondScreenState
),
AppTextFieldCustom(
height: screenSize.height * 0.075,
hintText:
TranslationBase.of(context).expectedDays,
hintText: TranslationBase.of(context).expectedDays,
controller: _expectedDaysController,
validationError: expectedDaysError,
inputType: TextInputType.number,
inputFormatters: [
FilteringTextInputFormatter.allow(
RegExp(ONLY_NUMBERS))
],
inputFormatters: [FilteringTextInputFormatter.allow(RegExp(ONLY_NUMBERS))],
),
SizedBox(
height: 10,
),
AppTextFieldCustom(
height: screenSize.height * 0.075,
hintText: TranslationBase.of(context)
.expectedAdmissionDate,
hintText: TranslationBase.of(context).expectedAdmissionDate,
dropDownText: _expectedAdmissionDate != null
? "${AppDateUtils.convertStringToDateFormat(_expectedAdmissionDate.toString(), "yyyy-MM-dd")}"
: null,
@ -201,16 +185,16 @@ class _AdmissionRequestSecondScreenState
isTextFieldHasSuffix: true,
validationError: expectedDatesError,
suffixIcon: IconButton(
onPressed: () {},
icon: Icon(
Icons.calendar_today,
color: Colors.black,
)),
Icons.calendar_today,
color: Colors.black,
)),
onClick: () {
if (_expectedAdmissionDate == null) {
_expectedAdmissionDate = DateTime.now();
}
_selectDate(context, _expectedAdmissionDate,
(picked) {
_selectDate(context, _expectedAdmissionDate, (picked) {
setState(() {
_expectedAdmissionDate = picked;
});
@ -223,47 +207,32 @@ class _AdmissionRequestSecondScreenState
AppTextFieldCustom(
height: screenSize.height * 0.075,
hintText: TranslationBase.of(context).floor,
dropDownText: _selectedFloor != null
? _selectedFloor['description']
: null,
dropDownText: _selectedFloor != null ? _selectedFloor['description'] : null,
enabled: false,
isTextFieldHasSuffix: true,
validationError: floorError,
onClick: model.floorList != null &&
model.floorList.length > 0
onClick: model.floorList != null && model.floorList.length > 0
? () {
openListDialogField(
'description',
'floorID',
model.floorList, (selectedValue) {
openListDialogField('description', 'floorID', model.floorList, (selectedValue) {
setState(() {
_selectedFloor = selectedValue;
});
});
}
: () async {
GifLoaderDialogUtils.showMyDialog(
context);
await model.getFloors().then((_) =>
GifLoaderDialogUtils.hideDialog(
context));
if (model.state == ViewState.Idle &&
model.floorList.length > 0) {
openListDialogField(
'description',
'floorID',
model.floorList, (selectedValue) {
GifLoaderDialogUtils.showMyDialog(context);
await model.getFloors().then((_) => GifLoaderDialogUtils.hideDialog(context));
if (model.state == ViewState.Idle && model.floorList.length > 0) {
openListDialogField('description', 'floorID', model.floorList,
(selectedValue) {
setState(() {
_selectedFloor = selectedValue;
});
});
} else if (model.state ==
ViewState.ErrorLocal) {
DrAppToastMsg.showErrorToast(
model.error);
} else if (model.state == ViewState.ErrorLocal) {
DrAppToastMsg.showErrorToast(model.error);
} else {
DrAppToastMsg.showErrorToast(
"Empty List");
DrAppToastMsg.showErrorToast("Empty List");
}
},
),
@ -273,46 +242,32 @@ class _AdmissionRequestSecondScreenState
AppTextFieldCustom(
height: screenSize.height * 0.075,
hintText: TranslationBase.of(context).ward,
dropDownText: _selectedWard != null
? _selectedWard['description']
: null,
dropDownText: _selectedWard != null ? _selectedWard['description'] : null,
enabled: false,
isTextFieldHasSuffix: true,
onClick: model.wardList != null &&
model.wardList.length > 0
onClick: model.wardList != null && model.wardList.length > 0
? () {
openListDialogField(
'description',
'nursingStationID',
model.wardList, (selectedValue) {
openListDialogField('description', 'nursingStationID', model.wardList,
(selectedValue) {
setState(() {
_selectedWard = selectedValue;
});
});
}
: () async {
GifLoaderDialogUtils.showMyDialog(
context);
await model.getWards().then((_) =>
GifLoaderDialogUtils.hideDialog(
context));
if (model.state == ViewState.Idle &&
model.wardList.length > 0) {
openListDialogField(
'description',
'nursingStationID',
model.wardList, (selectedValue) {
GifLoaderDialogUtils.showMyDialog(context);
await model.getWards().then((_) => GifLoaderDialogUtils.hideDialog(context));
if (model.state == ViewState.Idle && model.wardList.length > 0) {
openListDialogField('description', 'nursingStationID', model.wardList,
(selectedValue) {
setState(() {
_selectedWard = selectedValue;
});
});
} else if (model.state ==
ViewState.ErrorLocal) {
DrAppToastMsg.showErrorToast(
model.error);
} else if (model.state == ViewState.ErrorLocal) {
DrAppToastMsg.showErrorToast(model.error);
} else {
DrAppToastMsg.showErrorToast(
"Empty List");
DrAppToastMsg.showErrorToast("Empty List");
}
},
),
@ -321,54 +276,37 @@ class _AdmissionRequestSecondScreenState
),
AppTextFieldCustom(
height: screenSize.height * 0.075,
hintText:
TranslationBase.of(context).roomCategory,
dropDownText: _selectedRoomCategory != null
? _selectedRoomCategory['description']
: null,
hintText: TranslationBase.of(context).roomCategory,
dropDownText:
_selectedRoomCategory != null ? _selectedRoomCategory['description'] : null,
enabled: false,
isTextFieldHasSuffix: true,
validationError: roomError,
onClick: model.roomCategoryList != null &&
model.roomCategoryList.length > 0
onClick: model.roomCategoryList != null && model.roomCategoryList.length > 0
? () {
openListDialogField(
'description',
'categoryID',
model.roomCategoryList,
openListDialogField('description', 'categoryID', model.roomCategoryList,
(selectedValue) {
setState(() {
_selectedRoomCategory =
selectedValue;
_selectedRoomCategory = selectedValue;
});
});
}
: () async {
GifLoaderDialogUtils.showMyDialog(
context);
await model.getRoomCategories().then(
(_) =>
GifLoaderDialogUtils.hideDialog(
context));
if (model.state == ViewState.Idle &&
model.roomCategoryList.length > 0) {
openListDialogField(
'description',
'categoryID',
model.roomCategoryList,
GifLoaderDialogUtils.showMyDialog(context);
await model
.getRoomCategories()
.then((_) => GifLoaderDialogUtils.hideDialog(context));
if (model.state == ViewState.Idle && model.roomCategoryList.length > 0) {
openListDialogField('description', 'categoryID', model.roomCategoryList,
(selectedValue) {
setState(() {
_selectedRoomCategory =
selectedValue;
_selectedRoomCategory = selectedValue;
});
});
} else if (model.state ==
ViewState.ErrorLocal) {
DrAppToastMsg.showErrorToast(
model.error);
} else if (model.state == ViewState.ErrorLocal) {
DrAppToastMsg.showErrorToast(model.error);
} else {
DrAppToastMsg.showErrorToast(
"Empty List");
DrAppToastMsg.showErrorToast("Empty List");
}
},
),
@ -376,8 +314,7 @@ class _AdmissionRequestSecondScreenState
height: 10,
),
AppTextFieldCustom(
hintText:
TranslationBase.of(context).treatmentLine,
hintText: TranslationBase.of(context).treatmentLine,
controller: _treatmentLineController,
inputType: TextInputType.multiline,
validationError: treatmentsError,
@ -388,8 +325,7 @@ class _AdmissionRequestSecondScreenState
height: 10,
),
AppTextFieldCustom(
hintText:
TranslationBase.of(context).complications,
hintText: TranslationBase.of(context).complications,
controller: _complicationsController,
inputType: TextInputType.multiline,
validationError: complicationsError,
@ -400,8 +336,7 @@ class _AdmissionRequestSecondScreenState
height: 10,
),
AppTextFieldCustom(
hintText:
TranslationBase.of(context).otherProcedure,
hintText: TranslationBase.of(context).otherProcedure,
controller: _otherProceduresController,
inputType: TextInputType.multiline,
validationError: proceduresError,
@ -413,53 +348,34 @@ class _AdmissionRequestSecondScreenState
),
AppTextFieldCustom(
height: screenSize.height * 0.075,
hintText:
TranslationBase.of(context).admissionType,
dropDownText: _selectedAdmissionType != null
? _selectedAdmissionType['nameEn']
: null,
hintText: TranslationBase.of(context).admissionType,
dropDownText: _selectedAdmissionType != null ? _selectedAdmissionType['nameEn'] : null,
enabled: false,
isTextFieldHasSuffix: true,
validationError: admissionTypeError,
onClick: model.admissionTypeList != null &&
model.admissionTypeList.length > 0
onClick: model.admissionTypeList != null && model.admissionTypeList.length > 0
? () {
openListDialogField('nameEn', 'id',
model.admissionTypeList,
(selectedValue) {
openListDialogField('nameEn', 'id', model.admissionTypeList, (selectedValue) {
setState(() {
_selectedAdmissionType =
selectedValue;
_selectedAdmissionType = selectedValue;
});
});
}
: () async {
GifLoaderDialogUtils.showMyDialog(
context);
GifLoaderDialogUtils.showMyDialog(context);
await model
.getMasterLookup(MasterKeysService
.AdmissionRequestType)
.then((_) =>
GifLoaderDialogUtils.hideDialog(
context));
if (model.state == ViewState.Idle &&
model.admissionTypeList.length >
0) {
openListDialogField('nameEn', 'id',
model.admissionTypeList,
(selectedValue) {
.getMasterLookup(MasterKeysService.AdmissionRequestType)
.then((_) => GifLoaderDialogUtils.hideDialog(context));
if (model.state == ViewState.Idle && model.admissionTypeList.length > 0) {
openListDialogField('nameEn', 'id', model.admissionTypeList, (selectedValue) {
setState(() {
_selectedAdmissionType =
selectedValue;
_selectedAdmissionType = selectedValue;
});
});
} else if (model.state ==
ViewState.ErrorLocal) {
DrAppToastMsg.showErrorToast(
model.error);
} else if (model.state == ViewState.ErrorLocal) {
DrAppToastMsg.showErrorToast(model.error);
} else {
DrAppToastMsg.showErrorToast(
"Empty List");
DrAppToastMsg.showErrorToast("Empty List");
}
},
),
@ -496,140 +412,107 @@ class _AdmissionRequestSecondScreenState
_postPlansEstimatedCostController.text != "" &&
_expectedDaysController.text != "" &&
_expectedAdmissionDate != null &&
_otherDepartmentsInterventionsController.text !=
"" &&
_otherDepartmentsInterventionsController.text != "" &&
_selectedFloor != null &&
_selectedRoomCategory !=
null /*_selectedWard is not required*/ &&
_selectedRoomCategory != null /*_selectedWard is not required*/ &&
_treatmentLineController.text != "" &&
_complicationsController.text != "" &&
_otherProceduresController.text != "" &&
_selectedAdmissionType != null) {
model.admissionRequestData = admissionRequest;
model.admissionRequestData.estimatedCost =
int.parse(_estimatedCostController.text);
model.admissionRequestData
.elementsForImprovement =
model.admissionRequestData.estimatedCost = int.parse(_estimatedCostController.text);
model.admissionRequestData.elementsForImprovement =
_postPlansEstimatedCostController.text;
model.admissionRequestData.expectedDays =
int.parse(_expectedDaysController.text);
model.admissionRequestData.admissionDate =
_expectedAdmissionDate.toIso8601String();
model.admissionRequestData
.otherDepartmentInterventions =
model.admissionRequestData.expectedDays = int.parse(_expectedDaysController.text);
model.admissionRequestData.admissionDate = _expectedAdmissionDate.toIso8601String();
model.admissionRequestData.otherDepartmentInterventions =
_otherDepartmentsInterventionsController.text;
model.admissionRequestData.admissionLocationID =
_selectedFloor['floorID'];
model.admissionRequestData.admissionLocationID = _selectedFloor['floorID'];
model.admissionRequestData.wardID =
_selectedWard != null
? _selectedWard['nursingStationID']
: 0;
model.admissionRequestData.roomCategoryID =
_selectedRoomCategory['categoryID'];
_selectedWard != null ? _selectedWard['nursingStationID'] : 0;
model.admissionRequestData.roomCategoryID = _selectedRoomCategory['categoryID'];
model.admissionRequestData
.admissionRequestProcedures = [];
model.admissionRequestData.admissionRequestProcedures = [];
model.admissionRequestData.mainLineOfTreatment =
_treatmentLineController.text;
model.admissionRequestData.complications =
_complicationsController.text;
model.admissionRequestData.otherProcedures =
_otherProceduresController.text;
model.admissionRequestData.admissionType =
_selectedAdmissionType['id'];
model.admissionRequestData.mainLineOfTreatment = _treatmentLineController.text;
model.admissionRequestData.complications = _complicationsController.text;
model.admissionRequestData.otherProcedures = _otherProceduresController.text;
model.admissionRequestData.admissionType = _selectedAdmissionType['id'];
Navigator.of(context).pushNamed(
PATIENT_ADMISSION_REQUEST_3,
arguments: {
'patient': patient,
'patientType': patientType,
'arrivalType': arrivalType,
'admission-data': model.admissionRequestData
});
Navigator.of(context).pushNamed(PATIENT_ADMISSION_REQUEST_3, arguments: {
'patient': patient,
'patientType': patientType,
'arrivalType': arrivalType,
'admission-data': model.admissionRequestData
});
} else {
DrAppToastMsg.showErrorToast(
TranslationBase.of(context).pleaseFill);
DrAppToastMsg.showErrorToast(TranslationBase.of(context).pleaseFill);
setState(() {
if (_estimatedCostController.text == "") {
costError =
TranslationBase.of(context).fieldRequired;
costError = TranslationBase.of(context).fieldRequired;
} else {
costError = null;
}
if (_postPlansEstimatedCostController.text ==
"") {
plansError =
TranslationBase.of(context).fieldRequired;
if (_postPlansEstimatedCostController.text == "") {
plansError = TranslationBase.of(context).fieldRequired;
} else {
plansError = null;
}
if (_expectedDaysController.text == "") {
expectedDaysError =
TranslationBase.of(context).fieldRequired;
expectedDaysError = TranslationBase.of(context).fieldRequired;
} else {
expectedDaysError = null;
expectedDaysError = "";
}
if (_expectedAdmissionDate == null) {
expectedDatesError =
TranslationBase.of(context).fieldRequired;
expectedDatesError = TranslationBase.of(context).fieldRequired;
} else {
expectedDatesError = null;
}
if (_otherDepartmentsInterventionsController
.text ==
"") {
otherInterventionsError =
TranslationBase.of(context).fieldRequired;
if (_otherDepartmentsInterventionsController.text == "") {
otherInterventionsError = TranslationBase.of(context).fieldRequired;
} else {
otherInterventionsError = null;
}
if (_selectedFloor == null) {
floorError =
TranslationBase.of(context).fieldRequired;
floorError = TranslationBase.of(context).fieldRequired;
} else {
floorError = null;
}
if (_selectedRoomCategory == null) {
roomError =
TranslationBase.of(context).fieldRequired;
roomError = TranslationBase.of(context).fieldRequired;
} else {
roomError = null;
}
if (_treatmentLineController.text == "") {
treatmentsError =
TranslationBase.of(context).fieldRequired;
treatmentsError = TranslationBase.of(context).fieldRequired;
} else {
treatmentsError = null;
}
if (_complicationsController.text == "") {
complicationsError =
TranslationBase.of(context).fieldRequired;
complicationsError = TranslationBase.of(context).fieldRequired;
} else {
complicationsError = null;
}
if (_otherProceduresController.text == "") {
proceduresError =
TranslationBase.of(context).fieldRequired;
proceduresError = TranslationBase.of(context).fieldRequired;
} else {
proceduresError = null;
}
if (_selectedAdmissionType == null) {
admissionTypeError =
TranslationBase.of(context).fieldRequired;
admissionTypeError = TranslationBase.of(context).fieldRequired;
} else {
admissionTypeError = null;
}
@ -647,9 +530,8 @@ class _AdmissionRequestSecondScreenState
);
}
Future _selectDate(BuildContext context, DateTime dateTime,
Function(DateTime picked) updateDate) async {
final DateTime picked = await showDatePicker(
Future _selectDate(BuildContext context, DateTime dateTime, Function(DateTime picked) updateDate) async {
final DateTime? picked = await showDatePicker(
context: context,
initialDate: dateTime,
firstDate: DateTime.now(),
@ -661,8 +543,8 @@ class _AdmissionRequestSecondScreenState
}
}
void openListDialogField(String attributeName, String attributeValueId,
List<dynamic> list, Function(dynamic selectedValue) okFunction) {
void openListDialogField(
String attributeName, String attributeValueId, List<dynamic> list, Function(dynamic selectedValue) okFunction) {
ListSelectDialog dialog = ListSelectDialog(
list: list,
attributeName: attributeName,

@ -18,15 +18,14 @@ class FlowChartPage extends StatelessWidget {
final PatiantInformtion patient;
final bool isInpatient;
FlowChartPage({this.patientLabOrder, this.filterName, this.patient, this.isInpatient});
FlowChartPage(
{required this.patientLabOrder, required this.filterName, required this.patient, required this.isInpatient});
@override
Widget build(BuildContext context) {
return BaseView<LabsViewModel>(
onModelReady: (model) => model.getPatientLabOrdersResults(
patientLabOrder: patientLabOrder,
procedure: filterName,
patient: patient),
onModelReady: (model) =>
model.getPatientLabOrdersResults(patientLabOrder: patientLabOrder, procedure: filterName, patient: patient),
builder: (context, model, w) => AppScaffold(
isShowAppBar: true,
appBarTitle: filterName,
@ -41,25 +40,25 @@ class FlowChartPage extends StatelessWidget {
),
)
: Container(
child: Center(
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: [
Image.asset('assets/images/no-data.png'),
Padding(
padding: const EdgeInsets.all(8.0),
child: AppText(
TranslationBase.of(context).noDataAvailable,
fontWeight: FontWeight.normal,
color: HexColor("#B8382B"),
fontSize: SizeConfig.textMultiplier * 2.5,
),
)
],
child: Center(
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: [
Image.asset('assets/images/no-data.png'),
Padding(
padding: const EdgeInsets.all(8.0),
child: AppText(
TranslationBase.of(context).noDataAvailable,
fontWeight: FontWeight.normal,
color: HexColor("#B8382B"),
fontSize: SizeConfig.textMultiplier * 2.5,
),
)
],
),
),
),
),
),
);
}

@ -18,14 +18,14 @@ class LabResultWidget extends StatelessWidget {
final bool isInpatient;
LabResultWidget(
{Key key,
this.filterName,
this.patientLabResultList,
this.patientLabOrder,
this.patient,
this.isInpatient})
{Key? key,
required this.filterName,
required this.patientLabResultList,
required this.patientLabOrder,
required this.patient,
required this.isInpatient})
: super(key: key);
ProjectViewModel projectViewModel;
late ProjectViewModel projectViewModel;
@override
Widget build(BuildContext context) {
@ -37,32 +37,32 @@ class LabResultWidget extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
// if (!isInpatient)
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
AppText(filterName),
InkWell(
onTap: () {
Navigator.push(
context,
FadePage(
page: FlowChartPage(
filterName: filterName,
patientLabOrder: patientLabOrder,
patient: patient,
isInpatient: isInpatient,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
AppText(filterName),
InkWell(
onTap: () {
Navigator.push(
context,
FadePage(
page: FlowChartPage(
filterName: filterName,
patientLabOrder: patientLabOrder,
patient: patient,
isInpatient: isInpatient,
),
);
},
child: AppText(
TranslationBase.of(context).showMoreBtn,
textDecoration: TextDecoration.underline,
color: Colors.blue,
),
),
);
},
child: AppText(
TranslationBase.of(context).showMoreBtn,
textDecoration: TextDecoration.underline,
color: Colors.blue,
),
],
),
),
],
),
Row(
children: [
Expanded(
@ -123,7 +123,7 @@ class LabResultWidget extends StatelessWidget {
child: Center(
child: AppText(
'${patientLabResultList[index].testCode}\n' +
patientLabResultList[index].description,
patientLabResultList[index].description!,
textAlign: TextAlign.center,
),
),
@ -135,9 +135,8 @@ class LabResultWidget extends StatelessWidget {
color: Colors.white,
child: Center(
child: AppText(
patientLabResultList[index].resultValue ??""+
" " +
"${patientLabResultList[index].uOM ?? ""}",
patientLabResultList[index].resultValue ??
"" + " " + "${patientLabResultList[index].uOM ?? ""}",
textAlign: TextAlign.center,
),
),
@ -228,7 +227,7 @@ class LabResultWidget extends StatelessWidget {
color: Colors.white,
child: Center(
child: AppText(
lab.resultValue + " " + lab.uOM,
lab.resultValue! + " " + lab.uOM!,
textAlign: TextAlign.center,
),
),

@ -12,7 +12,7 @@ class LabResultDetailsWidget extends StatefulWidget {
final List<LabOrderResult> labResult;
LabResultDetailsWidget({
this.labResult,
required this.labResult,
});
@override
@ -24,7 +24,7 @@ class _VitalSignDetailsWidgetState extends State<LabResultDetailsWidget> {
Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context);
return Container(
/* decoration: BoxDecoration(
/* decoration: BoxDecoration(
color: Colors.transparent,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(10.0), topRight: Radius.circular(10.0)),
@ -74,7 +74,7 @@ class _VitalSignDetailsWidgetState extends State<LabResultDetailsWidget> {
),
Table(
border: TableBorder.symmetric(
inside: BorderSide(width: 1.0, color: Colors.grey[300]),
inside: BorderSide(width: 1.0, color: Colors.grey[300]!),
),
children: fullData(projectViewModel),
),
@ -87,17 +87,16 @@ class _VitalSignDetailsWidgetState extends State<LabResultDetailsWidget> {
List<TableRow> fullData(ProjectViewModel projectViewModel) {
List<TableRow> tableRow = [];
widget.labResult.forEach((vital) {
var date = AppDateUtils.convertStringToDate(vital.verifiedOnDateTime);
var date = AppDateUtils.convertStringToDate(vital.verifiedOnDateTime!);
tableRow.add(TableRow(children: [
Container(
child: Container(
padding: EdgeInsets.all(8),
color: Colors.white,
child: AppText(
'${projectViewModel.isArabic? AppDateUtils.getWeekDayArabic(date.weekday): AppDateUtils.getWeekDay(date.weekday)} ,${date.day} ${projectViewModel.isArabic? AppDateUtils.getMonthArabic(date.month) : AppDateUtils.getMonth(date.month)} ${date.year}',
'${projectViewModel.isArabic ? AppDateUtils.getWeekDayArabic(date.weekday) : AppDateUtils.getWeekDay(date.weekday)} ,${date.day} ${projectViewModel.isArabic ? AppDateUtils.getMonthArabic(date.month) : AppDateUtils.getMonth(date.month)} ${date.year}',
fontSize: SizeConfig.textMultiplier * 1.8,
fontWeight: FontWeight.w600,
fontFamily: 'Poppins',
),
),
@ -110,7 +109,6 @@ class _VitalSignDetailsWidgetState extends State<LabResultDetailsWidget> {
'${vital.resultValue}',
fontSize: SizeConfig.textMultiplier * 1.8,
fontWeight: FontWeight.w600,
fontFamily: 'Poppins',
),
),

@ -10,15 +10,15 @@ class LineChartCurved extends StatefulWidget {
final String title;
final List<LabOrderResult> labResult;
LineChartCurved({this.title, this.labResult});
LineChartCurved({required this.title, required this.labResult});
@override
State<StatefulWidget> createState() => LineChartCurvedState();
}
class LineChartCurvedState extends State<LineChartCurved> {
bool isShowingMainData;
List<int> xAxixs = List();
bool? isShowingMainData;
List<int> xAxixs = [];
int indexes = 0;
@override
@ -59,7 +59,6 @@ class LineChartCurvedState extends State<LineChartCurved> {
widget.title,
fontSize: SizeConfig.textMultiplier * 2.1,
fontWeight: FontWeight.bold,
fontFamily: 'Poppins',
textAlign: TextAlign.center,
),
@ -92,8 +91,7 @@ class LineChartCurvedState extends State<LineChartCurved> {
touchCallback: (LineTouchResponse touchResponse) {},
handleBuiltInTouches: true,
),
gridData: FlGridData(
show: true, drawVerticalLine: true, drawHorizontalLine: true),
gridData: FlGridData(show: true, drawVerticalLine: true, drawHorizontalLine: true),
titlesData: FlTitlesData(
bottomTitles: SideTitles(
showTitles: true,
@ -102,27 +100,23 @@ class LineChartCurvedState extends State<LineChartCurved> {
fontSize: 11,
),
margin: 28,
rotateAngle:-65,
rotateAngle: -65,
getTitles: (value) {
print(value);
DateTime date = AppDateUtils.convertStringToDate(widget.labResult[value.toInt()].verifiedOnDateTime);
DateTime date = AppDateUtils.convertStringToDate(widget.labResult[value.toInt()].verifiedOnDateTime!);
if (widget.labResult.length < 8) {
if (widget.labResult.length > value.toInt()) {
return '${date.day}/ ${date.year}';
} else
return '';
} else {
if (value.toInt() == 0)
return '${date.day}/ ${date.year}';
if (value.toInt() == widget.labResult.length - 1)
return '${date.day}/ ${date.year}';
if (value.toInt() == 0) return '${date.day}/ ${date.year}';
if (value.toInt() == widget.labResult.length - 1) return '${date.day}/ ${date.year}';
if (xAxixs.contains(value.toInt())) {
return '${date.day}/ ${date.year}';
}
}
return '';
},
),
@ -160,7 +154,7 @@ class LineChartCurvedState extends State<LineChartCurved> {
),
minX: 0,
maxX: (widget.labResult.length - 1).toDouble(),
maxY: getMaxY()+2,
maxY: getMaxY() + 2,
minY: getMinY(),
lineBarsData: getData(),
);
@ -169,10 +163,10 @@ class LineChartCurvedState extends State<LineChartCurved> {
double getMaxY() {
double max = 0;
widget.labResult.forEach((element) {
try{
double resultValueDouble = double.parse(element.resultValue);
if (resultValueDouble > max) max = resultValueDouble;}
catch(e){
try {
double resultValueDouble = double.parse(element.resultValue!);
if (resultValueDouble > max) max = resultValueDouble;
} catch (e) {
print(e);
}
});
@ -182,13 +176,14 @@ class LineChartCurvedState extends State<LineChartCurved> {
double getMinY() {
double min = 0;
try{
min = double.parse(widget.labResult[0].resultValue);
widget.labResult.forEach((element) {
double resultValueDouble = double.parse(element.resultValue);
if (resultValueDouble < min) min = resultValueDouble;
});}catch(e){
try {
min = double.parse(widget.labResult[0].resultValue ?? "");
widget.labResult.forEach((element) {
double resultValueDouble = double.parse(element.resultValue ?? "");
if (resultValueDouble < min) min = resultValueDouble;
});
} catch (e) {
print(e);
}
int value = min.toInt();
@ -197,15 +192,14 @@ class LineChartCurvedState extends State<LineChartCurved> {
}
List<LineChartBarData> getData() {
List<FlSpot> spots = List();
List<FlSpot> spots = [];
for (int index = 0; index < widget.labResult.length; index++) {
try{
var resultValueDouble = double.parse(widget.labResult[index].resultValue);
spots.add(FlSpot(index.toDouble(), resultValueDouble));
}catch(e){
try {
var resultValueDouble = double.parse(widget.labResult[index].resultValue ?? "");
spots.add(FlSpot(index.toDouble(), resultValueDouble));
} catch (e) {
print(e);
spots.add(FlSpot(index.toDouble(), 0.0));
}
}

@ -1,4 +1,3 @@
import 'package:doctor_app_flutter/config/size_config.dart';
import 'package:doctor_app_flutter/core/model/labs/LabOrderResult.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
@ -8,18 +7,16 @@ import 'package:flutter/material.dart';
import 'Lab_Result_details_wideget.dart';
import 'LineChartCurved.dart';
class LabResultChartAndDetails extends StatelessWidget {
LabResultChartAndDetails({
Key key,
@required this.labResult,
@required this.name,
Key? key,
required this.labResult,
required this.name,
}) : super(key: key);
final List<LabOrderResult> labResult;
final String name;
@override
Widget build(BuildContext context) {
return Padding(
@ -29,19 +26,16 @@ class LabResultChartAndDetails extends StatelessWidget {
children: <Widget>[
Container(
margin: EdgeInsets.symmetric(horizontal: 8),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(12)
decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(12)),
child: LineChartCurved(
title: name,
labResult: labResult,
),
child: LineChartCurved(title: name,labResult:labResult,),
),
Container(
margin: EdgeInsets.symmetric(horizontal: 8, vertical: 16),
padding: EdgeInsets.only(top: 16, right: 18.0, left: 16.0),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(12)
),
decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(12)),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
@ -51,7 +45,9 @@ class LabResultChartAndDetails extends StatelessWidget {
fontWeight: FontWeight.bold,
fontFamily: 'Poppins',
),
SizedBox(height: 8,),
SizedBox(
height: 8,
),
LabResultDetailsWidget(
labResult: labResult.reversed.toList(),
),
@ -62,5 +58,4 @@ class LabResultChartAndDetails extends StatelessWidget {
),
);
}
}

@ -14,7 +14,7 @@ import 'package:flutter/material.dart';
class LabResult extends StatefulWidget {
final LabOrdersResModel labOrders;
LabResult({Key key, this.labOrders});
LabResult({Key? key, required this.labOrders});
@override
_LabResultState createState() => _LabResultState();
@ -27,13 +27,11 @@ class _LabResultState extends State<LabResult> {
onModelReady: (model) => model.getLabResult(widget.labOrders),
builder: (_, model, w) => AppScaffold(
baseViewModel: model,
appBarTitle: TranslationBase.of(context).labOrders,
appBarTitle: TranslationBase.of(context).labOrders ?? "",
body: model.labResultList.length == 0
? DrAppEmbeddedError(
error: TranslationBase.of(context).errorNoLabOrders)
? DrAppEmbeddedError(error: TranslationBase.of(context).errorNoLabOrders ?? "")
: Container(
margin: EdgeInsets.fromLTRB(SizeConfig.realScreenWidth * 0.05,
0, SizeConfig.realScreenWidth * 0.05, 0),
margin: EdgeInsets.fromLTRB(SizeConfig.realScreenWidth * 0.05, 0, SizeConfig.realScreenWidth * 0.05, 0),
child: ListView(
children: <Widget>[
CardWithBgWidgetNew(
@ -69,7 +67,6 @@ class _LabResultState extends State<LabResult> {
),
],
),
],
),
),

@ -17,12 +17,12 @@ class LaboratoryResultPage extends StatefulWidget {
final bool isInpatient;
LaboratoryResultPage(
{Key key,
this.patientLabOrders,
this.patient,
this.patientType,
this.arrivalType,
this.isInpatient});
{Key? key,
required this.patientLabOrders,
required this.patient,
required this.patientType,
required this.arrivalType,
required this.isInpatient});
@override
_LaboratoryResultPageState createState() => _LaboratoryResultPageState();
@ -40,9 +40,7 @@ class _LaboratoryResultPageState extends State<LaboratoryResultPage> {
// patient: widget.patient,
// isInpatient: widget.patientType == "1"),
onModelReady: (model) => model.getPatientLabResult(
patientLabOrder: widget.patientLabOrders,
patient: widget.patient,
isInpatient: true),
patientLabOrder: widget.patientLabOrders, patient: widget.patient, isInpatient: true),
builder: (_, model, w) => AppScaffold(
isShowAppBar: true,
appBar: PatientProfileHeaderWhitAppointmentAppBar(
@ -65,11 +63,11 @@ class _LaboratoryResultPageState extends State<LaboratoryResultPage> {
children: [
LaboratoryResultWidget(
onTap: () async {},
billNo: widget.patientLabOrders.invoiceNo,
billNo: widget.patientLabOrders.invoiceNo!,
details: model.patientLabSpecialResult.length > 0
? model.patientLabSpecialResult[0].resultDataHTML
? model.patientLabSpecialResult[0]!.resultDataHTML
: null,
orderNo: widget.patientLabOrders.orderNo,
orderNo: widget.patientLabOrders.orderNo!,
patientLabOrder: widget.patientLabOrders,
patient: widget.patient,
isInpatient: widget.patientType == "1",

@ -16,21 +16,21 @@ import 'package:provider/provider.dart';
class LaboratoryResultWidget extends StatefulWidget {
final GestureTapCallback onTap;
final String billNo;
final String details;
final String? details;
final String orderNo;
final PatientLabOrders patientLabOrder;
final PatiantInformtion patient;
final bool isInpatient;
const LaboratoryResultWidget(
{Key key,
this.onTap,
this.billNo,
this.details,
this.orderNo,
this.patientLabOrder,
this.patient,
this.isInpatient})
{Key? key,
required this.onTap,
required this.billNo,
required this.details,
required this.orderNo,
required this.patientLabOrder,
required this.patient,
required this.isInpatient})
: super(key: key);
@override
@ -40,7 +40,7 @@ class LaboratoryResultWidget extends StatefulWidget {
class _LaboratoryResultWidgetState extends State<LaboratoryResultWidget> {
bool _isShowMoreGeneral = true;
bool _isShowMore = true;
ProjectViewModel projectViewModel;
late ProjectViewModel projectViewModel;
@override
Widget build(BuildContext context) {
@ -88,20 +88,16 @@ class _LaboratoryResultWidgetState extends State<LaboratoryResultWidget> {
children: <Widget>[
Expanded(
child: Container(
margin: EdgeInsets.only(
left: 10, right: 10),
margin: EdgeInsets.only(left: 10, right: 10),
child: AppText(
TranslationBase.of(context)
.generalResult,
TranslationBase.of(context).generalResult,
bold: true,
))),
Container(
width: 25,
height: 25,
child: Icon(
_isShowMoreGeneral
? Icons.keyboard_arrow_up
: Icons.keyboard_arrow_down,
_isShowMoreGeneral ? Icons.keyboard_arrow_up : Icons.keyboard_arrow_down,
color: Colors.grey[800],
size: 22,
),
@ -132,11 +128,8 @@ class _LaboratoryResultWidgetState extends State<LaboratoryResultWidget> {
model.labResultLists.length,
(index) => LabResultWidget(
patientLabOrder: widget.patientLabOrder,
filterName: model
.labResultLists[index].filterName,
patientLabResultList: model
.labResultLists[index]
.patientLabResultList,
filterName: model.labResultLists[index].filterName,
patientLabResultList: model.labResultLists[index].patientLabResultList,
patient: widget.patient,
isInpatient: widget.isInpatient,
),
@ -151,7 +144,7 @@ class _LaboratoryResultWidgetState extends State<LaboratoryResultWidget> {
SizedBox(
height: 15,
),
if (widget.details != null && widget.details.isNotEmpty)
if (widget.details != null && widget.details!.isNotEmpty)
Column(
children: [
InkWell(
@ -173,20 +166,16 @@ class _LaboratoryResultWidgetState extends State<LaboratoryResultWidget> {
children: <Widget>[
Expanded(
child: Container(
margin: EdgeInsets.only(
left: 10, right: 10),
margin: EdgeInsets.only(left: 10, right: 10),
child: AppText(
TranslationBase.of(context)
.specialResult,
TranslationBase.of(context).specialResult,
bold: true,
))),
Container(
width: 25,
height: 25,
child: Icon(
_isShowMore
? Icons.keyboard_arrow_up
: Icons.keyboard_arrow_down,
_isShowMore ? Icons.keyboard_arrow_up : Icons.keyboard_arrow_down,
color: Colors.grey[800],
size: 22,
),
@ -209,16 +198,12 @@ class _LaboratoryResultWidgetState extends State<LaboratoryResultWidget> {
duration: Duration(milliseconds: 7000),
child: Container(
width: double.infinity,
child: !Helpers.isTextHtml(widget.details)
child: !Helpers.isTextHtml(widget.details!)
? AppText(
widget.details ??
TranslationBase.of(context)
.noDataAvailable,
widget.details ?? TranslationBase.of(context).noDataAvailable,
)
: Html(
data: widget.details ??
TranslationBase.of(context)
.noDataAvailable,
data: widget.details ?? TranslationBase.of(context).noDataAvailable,
),
),
),

@ -22,18 +22,17 @@ class LabsHomePage extends StatefulWidget {
}
class _LabsHomePageState extends State<LabsHomePage> {
String patientType;
String arrivalType;
PatiantInformtion patient;
bool isInpatient;
bool isFromLiveCare;
late String patientType;
late String arrivalType;
late PatiantInformtion patient;
late bool isInpatient;
late bool isFromLiveCare;
@override
void didChangeDependencies() {
super.didChangeDependencies();
final routeArgs = ModalRoute.of(context).settings.arguments as Map;
final routeArgs = ModalRoute.of(context)!.settings.arguments as Map;
patient = routeArgs['patient'];
patientType = routeArgs['patientType'];
arrivalType = routeArgs['arrivalType'];
@ -50,7 +49,7 @@ class _LabsHomePageState extends State<LabsHomePage> {
onModelReady: (model) => model.getLabs(patient, isInpatient: false),
builder: (context, ProcedureViewModel model, widget) => AppScaffold(
baseViewModel: model,
backgroundColor: Colors.grey[100],
backgroundColor: Colors.grey[100]!,
isShowAppBar: true,
appBar: PatientProfileHeaderNewDesignAppBar(
patient,
@ -68,8 +67,7 @@ class _LabsHomePageState extends State<LabsHomePage> {
SizedBox(
height: 12,
),
if (model.patientLabOrdersList.isNotEmpty &&
patient.patientStatusType != 43)
if (model.patientLabOrdersList.isNotEmpty && patient.patientStatusType != 43)
Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
@ -89,8 +87,7 @@ class _LabsHomePageState extends State<LabsHomePage> {
],
),
),
if (patient.patientStatusType != null &&
patient.patientStatusType == 43)
if (patient.patientStatusType != null && patient.patientStatusType == 43)
Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
@ -110,8 +107,7 @@ class _LabsHomePageState extends State<LabsHomePage> {
],
),
),
if ((patient.patientStatusType != null &&
patient.patientStatusType == 43) ||
if ((patient.patientStatusType != null && patient.patientStatusType == 43) ||
(isFromLiveCare && patient.appointmentNo != null))
AddNewOrder(
onTap: () {
@ -124,7 +120,7 @@ class _LabsHomePageState extends State<LabsHomePage> {
)),
);
},
label: TranslationBase.of(context).applyForNewLabOrder,
label: TranslationBase.of(context).applyForNewLabOrder ?? "",
),
...List.generate(
model.patientLabOrdersList.length,
@ -145,37 +141,26 @@ class _LabsHomePageState extends State<LabsHomePage> {
width: 20,
height: 160,
decoration: BoxDecoration(
color: model.patientLabOrdersList[index]
.isLiveCareAppointment
color: model.patientLabOrdersList[index].isLiveCareAppointment!
? Colors.red[900]
: !model.patientLabOrdersList[index]
.isInOutPatient
: !model.patientLabOrdersList[index].isInOutPatient!
? Colors.black
: Color(0xffa9a089),
borderRadius: BorderRadius.only(
topLeft: projectViewModel.isArabic? Radius.circular(0):Radius.circular(8),
bottomLeft: projectViewModel.isArabic? Radius.circular(0):Radius.circular(8),
topRight: projectViewModel.isArabic? Radius.circular(8):Radius.circular(0),
bottomRight: projectViewModel.isArabic? Radius.circular(8):Radius.circular(0)
),
topLeft: projectViewModel.isArabic ? Radius.circular(0) : Radius.circular(8),
bottomLeft: projectViewModel.isArabic ? Radius.circular(0) : Radius.circular(8),
topRight: projectViewModel.isArabic ? Radius.circular(8) : Radius.circular(0),
bottomRight: projectViewModel.isArabic ? Radius.circular(8) : Radius.circular(0)),
),
child: RotatedBox(
quarterTurns: 3,
child: Center(
child: Text(
model.patientLabOrdersList[index]
.isLiveCareAppointment
? TranslationBase.of(context)
.liveCare
.toUpperCase()
: !model.patientLabOrdersList[index]
.isInOutPatient
? TranslationBase.of(context)
.inPatientLabel
.toUpperCase()
: TranslationBase.of(context)
.outpatient
.toUpperCase(),
model.patientLabOrdersList[index].isLiveCareAppointment!
? TranslationBase.of(context).liveCare!.toUpperCase()
: !model.patientLabOrdersList[index].isInOutPatient!
? TranslationBase.of(context).inPatientLabel!.toUpperCase()
: TranslationBase.of(context).outpatient!.toUpperCase(),
style: TextStyle(color: Colors.white),
),
)),
@ -189,24 +174,18 @@ class _LabsHomePageState extends State<LabsHomePage> {
page: LaboratoryResultPage(
patientLabOrders: model.patientLabOrdersList[index],
patient: patient,
isInpatient:isInpatient,
isInpatient: isInpatient,
arrivalType: arrivalType,
patientType: patientType,
),
),
),
doctorName:
model.patientLabOrdersList[index].doctorName,
invoiceNO:
' ${model.patientLabOrdersList[index].invoiceNo}',
profileUrl: model
.patientLabOrdersList[index].doctorImageURL,
branch:
model.patientLabOrdersList[index].projectName,
clinic: model
.patientLabOrdersList[index].clinicDescription,
appointmentDate:
model.patientLabOrdersList[index].orderDate.add(Duration(days: 1)),
doctorName: model.patientLabOrdersList[index].doctorName ?? "",
invoiceNO: ' ${model.patientLabOrdersList[index].invoiceNo}',
profileUrl: model.patientLabOrdersList[index].doctorImageURL ?? "",
branch: model.patientLabOrdersList[index].projectName ?? "",
clinic: model.patientLabOrdersList[index].clinicDescription ?? "",
appointmentDate: model.patientLabOrdersList[index].orderDate!.add(Duration(days: 1)),
orderNo: model.patientLabOrdersList[index].orderNo,
isShowTime: false,
),
@ -215,8 +194,7 @@ class _LabsHomePageState extends State<LabsHomePage> {
),
),
),
if (model.patientLabOrdersList.isEmpty &&
patient.patientStatusType != 43)
if (model.patientLabOrdersList.isEmpty && patient.patientStatusType != 43)
Center(
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,

@ -21,16 +21,14 @@ class AddVerifyMedicalReport extends StatefulWidget {
}
class _AddVerifyMedicalReportState extends State<AddVerifyMedicalReport> {
HtmlEditorController _controller = HtmlEditorController();
HtmlEditorController _controller = HtmlEditorController();
@override
Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of<ProjectViewModel>(context);
final routeArgs = ModalRoute.of(context).settings.arguments as Map;
final routeArgs = ModalRoute.of(context)!.settings.arguments as Map;
PatiantInformtion patient = routeArgs['patient'];
MedicalReportStatus status = routeArgs['status'];
MedicalReportModel medicalReport = routeArgs.containsKey("medicalReport")
? routeArgs['medicalReport']
: null;
MedicalReportModel medicalReport = routeArgs.containsKey("medicalReport") ? routeArgs['medicalReport'] : null;
return BaseView<PatientMedicalReportViewModel>(
onModelReady: (model) => model.getMedicalReportTemplate(),
@ -38,8 +36,8 @@ class _AddVerifyMedicalReportState extends State<AddVerifyMedicalReport> {
baseViewModel: model,
isShowAppBar: true,
appBarTitle: status == MedicalReportStatus.ADD
? TranslationBase.of(context).medicalReportAdd
: TranslationBase.of(context).medicalReportVerify,
? TranslationBase.of(context).medicalReportAdd!
: TranslationBase.of(context).medicalReportVerify!,
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
body: Column(
children: [
@ -56,7 +54,7 @@ class _AddVerifyMedicalReportState extends State<AddVerifyMedicalReport> {
children: [
if (model.medicalReportTemplate.length > 0)
HtmlRichEditor(
initialText: model.medicalReportTemplate[0].templateTextHtml,
initialText: model.medicalReportTemplate[0].templateTextHtml!,
height: MediaQuery.of(context).size.height * 0.75,
controller: _controller,
),
@ -84,13 +82,11 @@ class _AddVerifyMedicalReportState extends State<AddVerifyMedicalReport> {
// disabled: progressNoteController.text.isEmpty,
fontWeight: FontWeight.w700,
onPressed: () async {
String txtOfMedicalReport =
await _controller.getText();
String txtOfMedicalReport = await _controller.getText();
if (txtOfMedicalReport.isNotEmpty) {
GifLoaderDialogUtils.showMyDialog(context);
model.insertMedicalReport(
patient, txtOfMedicalReport);
model.insertMedicalReport(patient, txtOfMedicalReport);
GifLoaderDialogUtils.hideDialog(context);
if (model.state == ViewState.ErrorLocal) {
DrAppToastMsg.showErrorToast(model.error);
@ -112,8 +108,7 @@ class _AddVerifyMedicalReportState extends State<AddVerifyMedicalReport> {
fontWeight: FontWeight.w700,
onPressed: () async {
GifLoaderDialogUtils.showMyDialog(context);
await model.verifyMedicalReport(
patient, medicalReport);
await model.verifyMedicalReport(patient, medicalReport);
GifLoaderDialogUtils.hideDialog(context);
if (model.state == ViewState.ErrorLocal) {
DrAppToastMsg.showErrorToast(model.error);

@ -20,7 +20,7 @@ class MedicalReportDetailPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context);
final routeArgs = ModalRoute.of(context).settings.arguments as Map;
final routeArgs = ModalRoute.of(context)!.settings.arguments as Map;
PatiantInformtion patient = routeArgs['patient'];
String patientType = routeArgs['patientType'];
String arrivalType = routeArgs['arrivalType'];
@ -61,27 +61,29 @@ class MedicalReportDetailPage extends StatelessWidget {
],
),
),
medicalReport.reportDataHtml != null ? Container(
width: double.infinity,
margin: EdgeInsets.symmetric(horizontal: 16, vertical: 16),
padding: EdgeInsets.symmetric(horizontal: 16, vertical: 16),
decoration: BoxDecoration(
color: Colors.white,
shape: BoxShape.rectangle,
borderRadius: BorderRadius.all(Radius.circular(8)),
border: Border.fromBorderSide(
BorderSide(
color: Colors.white,
width: 1.0,
medicalReport.reportDataHtml != null
? Container(
width: double.infinity,
margin: EdgeInsets.symmetric(horizontal: 16, vertical: 16),
padding: EdgeInsets.symmetric(horizontal: 16, vertical: 16),
decoration: BoxDecoration(
color: Colors.white,
shape: BoxShape.rectangle,
borderRadius: BorderRadius.all(Radius.circular(8)),
border: Border.fromBorderSide(
BorderSide(
color: Colors.white,
width: 1.0,
),
),
),
child: Html(data: medicalReport.reportDataHtml ?? ""),
)
: Container(
child: ErrorMessage(
error: "No Data",
),
),
),
),
child: Html(
data: medicalReport.reportDataHtml ?? ""
),
) : Container(
child: ErrorMessage(error: "No Data",),
),
],
),
),

@ -26,7 +26,7 @@ import 'AddVerifyMedicalReport.dart';
class MedicalReportPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
final routeArgs = ModalRoute.of(context).settings.arguments as Map;
final routeArgs = ModalRoute.of(context)!.settings.arguments as Map;
PatiantInformtion patient = routeArgs['patient'];
String patientType = routeArgs['patientType'];
String arrivalType = routeArgs['arrivalType'];
@ -75,15 +75,14 @@ class MedicalReportPage extends StatelessWidget {
),
AddNewOrder(
onTap: () {
Navigator.of(context)
.pushNamed(PATIENT_MEDICAL_REPORT_INSERT, arguments: {
Navigator.of(context).pushNamed(PATIENT_MEDICAL_REPORT_INSERT, arguments: {
'patient': patient,
'patientType': patientType,
'arrivalType': arrivalType,
'type': MedicalReportStatus.ADD
});
},
label: TranslationBase.of(context).createNewMedicalReport,
label: TranslationBase.of(context).createNewMedicalReport!,
),
if (model.state != ViewState.ErrorLocal)
...List.generate(
@ -91,33 +90,27 @@ class MedicalReportPage extends StatelessWidget {
(index) => InkWell(
onTap: () {
if (model.medicalReportList[index].status == 1) {
Navigator.of(context).pushNamed(
PATIENT_MEDICAL_REPORT_DETAIL,
arguments: {
'patient': patient,
'patientType': patientType,
'arrivalType': arrivalType,
'medicalReport': model.medicalReportList[index]
});
Navigator.of(context).pushNamed(PATIENT_MEDICAL_REPORT_DETAIL, arguments: {
'patient': patient,
'patientType': patientType,
'arrivalType': arrivalType,
'medicalReport': model.medicalReportList[index]
});
} else {
Navigator.of(context).pushNamed(
PATIENT_MEDICAL_REPORT_INSERT,
arguments: {
'patient': patient,
'patientType': patientType,
'arrivalType': arrivalType,
'type': MedicalReportStatus.ADD,
'medicalReport': model.medicalReportList[index]
});
Navigator.of(context).pushNamed(PATIENT_MEDICAL_REPORT_INSERT, arguments: {
'patient': patient,
'patientType': patientType,
'arrivalType': arrivalType,
'type': MedicalReportStatus.ADD,
'medicalReport': model.medicalReportList[index]
});
}
},
child: Container(
margin: EdgeInsets.symmetric(horizontal: 8),
child: CardWithBgWidget(
hasBorder: false,
bgColor: model.medicalReportList[index].status == 1
? Colors.red[700]
: Colors.green[700],
bgColor: model.medicalReportList[index].status == 1 ? Colors.red[700]! : Colors.green[700]!,
widget: Column(
children: [
Row(
@ -129,11 +122,8 @@ class MedicalReportPage extends StatelessWidget {
AppText(
model.medicalReportList[index].status == 1
? TranslationBase.of(context).onHold
: TranslationBase.of(context)
.verified,
color: model.medicalReportList[index]
.status ==
1
: TranslationBase.of(context).verified,
color: model.medicalReportList[index].status == 1
? Colors.red[700]
: Colors.green[700],
fontSize: 1.4 * SizeConfig.textMultiplier,
@ -141,10 +131,8 @@ class MedicalReportPage extends StatelessWidget {
),
AppText(
projectViewModel.isArabic
? model.medicalReportList[index]
.doctorNameN
: model.medicalReportList[index]
.doctorName,
? model.medicalReportList[index].doctorNameN
: model.medicalReportList[index].doctorName,
fontSize: 1.9 * SizeConfig.textMultiplier,
fontWeight: FontWeight.w700,
color: Color(0xFF2E303A),
@ -155,13 +143,13 @@ class MedicalReportPage extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.end,
children: [
AppText(
'${AppDateUtils.convertDateFromServerFormat(model.medicalReportList[index].editedOn ?? model.medicalReportList[index].createdOn, "dd MMM yyyy")}',
'${AppDateUtils.convertDateFromServerFormat(model.medicalReportList[index].editedOn ?? model.medicalReportList[index].createdOn ?? "", "dd MMM yyyy")}',
color: Color(0xFF2E303A),
fontWeight: FontWeight.w600,
fontSize: 1.6 * SizeConfig.textMultiplier,
),
AppText(
'${AppDateUtils.convertDateFromServerFormat(model.medicalReportList[index].editedOn ?? model.medicalReportList[index].createdOn, "hh:mm a")}',
'${AppDateUtils.convertDateFromServerFormat(model.medicalReportList[index].editedOn ?? model.medicalReportList[index].createdOn ?? "", "hh:mm a")}',
color: Color(0xFF2E303A),
fontWeight: FontWeight.w600,
fontSize: 1.5 * SizeConfig.textMultiplier,
@ -174,16 +162,12 @@ class MedicalReportPage extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Container(
margin: EdgeInsets.only(
left: 0, top: 4, right: 8, bottom: 0),
margin: EdgeInsets.only(left: 0, top: 4, right: 8, bottom: 0),
child: LargeAvatar(
name: projectViewModel.isArabic
? model.medicalReportList[index]
.doctorNameN
: model.medicalReportList[index]
.doctorName,
url: model.medicalReportList[index]
.doctorImageURL,
? model.medicalReportList[index].doctorNameN ?? ""
: model.medicalReportList[index].doctorName ?? "",
url: model.medicalReportList[index].doctorImageURL,
),
width: 50,
height: 50,
@ -191,27 +175,20 @@ class MedicalReportPage extends StatelessWidget {
Expanded(
child: Container(
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
AppText(
projectViewModel.isArabic
? model.medicalReportList[index]
.projectNameN
: model.medicalReportList[index]
.projectName,
fontSize:
1.6 * SizeConfig.textMultiplier,
? model.medicalReportList[index].projectNameN
: model.medicalReportList[index].projectName,
fontSize: 1.6 * SizeConfig.textMultiplier,
color: Color(0xFF2E303A),
),
AppText(
projectViewModel.isArabic
? model.medicalReportList[index]
.clinicNameN
: model.medicalReportList[index]
.clinicName,
fontSize:
1.6 * SizeConfig.textMultiplier,
? model.medicalReportList[index].clinicNameN
: model.medicalReportList[index].clinicName,
fontSize: 1.6 * SizeConfig.textMultiplier,
color: Color(0xFF2E303A),
),
],
@ -224,10 +201,7 @@ class MedicalReportPage extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.end,
children: [
Icon(
model.medicalReportList[index].status ==
1
? EvaIcons.eye
: DoctorApp.edit_1,
model.medicalReportList[index].status == 1 ? EvaIcons.eye : DoctorApp.edit_1,
),
],
),

@ -30,22 +30,21 @@ DrAppSharedPreferances sharedPref = new DrAppSharedPreferances();
class ProgressNoteScreen extends StatefulWidget {
final int visitType;
const ProgressNoteScreen({Key key, this.visitType}) : super(key: key);
const ProgressNoteScreen({Key? key, required this.visitType}) : super(key: key);
@override
_ProgressNoteState createState() => _ProgressNoteState();
}
class _ProgressNoteState extends State<ProgressNoteScreen> {
List<NoteModel> notesList;
late List<NoteModel> notesList;
var filteredNotesList;
bool isDischargedPatient = false;
AuthenticationViewModel authenticationViewModel;
ProjectViewModel projectViewModel;
late AuthenticationViewModel authenticationViewModel;
late ProjectViewModel projectViewModel;
getProgressNoteList(BuildContext context, PatientViewModel model,
{bool isLocalBusy = false}) async {
final routeArgs = ModalRoute.of(context).settings.arguments as Map;
getProgressNoteList(BuildContext context, PatientViewModel model, {bool isLocalBusy = false}) async {
final routeArgs = ModalRoute.of(context)!.settings.arguments as Map;
PatiantInformtion patient = routeArgs['patient'];
String token = await sharedPref.getString(TOKEN);
String type = await sharedPref.getString(SLECTED_PATIENT_TYPE);
@ -54,15 +53,12 @@ class _ProgressNoteState extends State<ProgressNoteScreen> {
ProgressNoteRequest progressNoteRequest = ProgressNoteRequest(
visitType: widget.visitType,
// if equal 5 then this will return progress note
admissionNo: int.parse(patient.admissionNo),
admissionNo: int.parse(patient.admissionNo ?? ""),
projectID: patient.projectId,
tokenID: token,
patientTypeID: patient.patientType,
languageID: 2);
model
.getPatientProgressNote(progressNoteRequest.toJson(),
isLocalBusy: isLocalBusy)
.then((c) {
model.getPatientProgressNote(progressNoteRequest.toJson(), isLocalBusy: isLocalBusy).then((c) {
notesList = model.patientProgressNoteList;
});
}
@ -71,172 +67,109 @@ class _ProgressNoteState extends State<ProgressNoteScreen> {
Widget build(BuildContext context) {
authenticationViewModel = Provider.of(context);
projectViewModel = Provider.of(context);
final routeArgs = ModalRoute
.of(context)
.settings
.arguments as Map;
final routeArgs = ModalRoute.of(context)!.settings.arguments as Map;
PatiantInformtion patient = routeArgs['patient'];
String arrivalType = routeArgs['arrivalType'];
if (routeArgs.containsKey('isDischargedPatient'))
isDischargedPatient = routeArgs['isDischargedPatient'];
if (routeArgs.containsKey('isDischargedPatient')) isDischargedPatient = routeArgs['isDischargedPatient'];
return BaseView<PatientViewModel>(
onModelReady: (model) => getProgressNoteList(context, model),
builder: (_, model, w) =>
AppScaffold(
baseViewModel: model,
backgroundColor: Theme
.of(context)
.scaffoldBackgroundColor,
// appBarTitle: TranslationBase.of(context).progressNote,
appBar: PatientProfileHeaderNewDesignAppBar(
patient,
patient.patientType.toString() ?? '0',
arrivalType,
isInpatient: true,
),
body: model.patientProgressNoteList == null ||
model.patientProgressNoteList.length == 0
? DrAppEmbeddedError(
error: TranslationBase
.of(context)
.errorNoProgressNote)
: Container(
color: Colors.grey[200],
child: Column(
children: <Widget>[
if (!isDischargedPatient)
AddNewOrder(
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
UpdateNoteOrder(
patientModel: model,
patient: patient,
visitType: widget.visitType,
isUpdate: false,
)),
);
},
label: widget.visitType == 3
? TranslationBase
.of(context)
.addNewOrderSheet
: TranslationBase
.of(context)
.addProgressNote,
),
Expanded(
child: Container(
child: ListView.builder(
itemCount: model.patientProgressNoteList.length,
itemBuilder: (BuildContext ctxt, int index) {
return FractionallySizedBox(
widthFactor: 0.95,
child: CardWithBgWidget(
hasBorder: false,
bgColor: model.patientProgressNoteList[index]
.status ==
1 &&
authenticationViewModel.doctorProfile.doctorID !=
model
.patientProgressNoteList[
index]
.createdBy
? Color(0xFFCC9B14)
: model.patientProgressNoteList[index]
.status ==
4
? Colors.red.shade700
: model.patientProgressNoteList[index]
.status ==
2
? Colors.green[600]
: Color(0xFFCC9B14),
widget: Column(
children: [
Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
if (model
.patientProgressNoteList[
index]
.status ==
1 &&
authenticationViewModel
.doctorProfile.doctorID !=
model
.patientProgressNoteList[
index]
.createdBy)
AppText(
TranslationBase
.of(context)
.notePending,
fontWeight: FontWeight.bold,
color: Color(0xFFCC9B14),
fontSize: 12,
),
if (model
.patientProgressNoteList[
index]
.status ==
4)
builder: (_, model, w) => AppScaffold(
baseViewModel: model,
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
// appBarTitle: TranslationBase.of(context).progressNote,
appBar: PatientProfileHeaderNewDesignAppBar(
patient,
patient.patientType.toString() ?? '0',
arrivalType,
isInpatient: true,
),
body: model.patientProgressNoteList == null || model.patientProgressNoteList.length == 0
? DrAppEmbeddedError(error: TranslationBase.of(context).errorNoProgressNote ?? "")
: Container(
color: Colors.grey[200],
child: Column(
children: <Widget>[
if (!isDischargedPatient)
AddNewOrder(
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => UpdateNoteOrder(
patientModel: model,
patient: patient,
visitType: widget.visitType,
isUpdate: false,
)),
);
},
label: widget.visitType == 3
? TranslationBase.of(context).addNewOrderSheet!
: TranslationBase.of(context).addProgressNote!,
),
Expanded(
child: Container(
child: ListView.builder(
itemCount: model.patientProgressNoteList.length,
itemBuilder: (BuildContext ctxt, int index) {
return FractionallySizedBox(
widthFactor: 0.95,
child: CardWithBgWidget(
hasBorder: false,
bgColor: model.patientProgressNoteList[index].status == 1 &&
authenticationViewModel.doctorProfile!.doctorID !=
model.patientProgressNoteList[index].createdBy
? Color(0xFFCC9B14)
: model.patientProgressNoteList[index].status == 4
? Colors.red.shade700
: model.patientProgressNoteList[index].status == 2
? Colors.green[600]!
: Color(0xFFCC9B14)!,
widget: Column(
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
if (model.patientProgressNoteList[index].status == 1 &&
authenticationViewModel.doctorProfile!.doctorID !=
model.patientProgressNoteList[index].createdBy)
AppText(
TranslationBase.of(context).notePending,
fontWeight: FontWeight.bold,
color: Color(0xFFCC9B14),
fontSize: 12,
),
if (model.patientProgressNoteList[index].status == 4)
AppText(
TranslationBase
.of(context)
.noteCanceled,
TranslationBase.of(context).noteCanceled,
fontWeight: FontWeight.bold,
color: Colors.red.shade700,
fontSize: 12,
),
if (model
.patientProgressNoteList[
index]
.status ==
2)
if (model.patientProgressNoteList[index].status == 2)
AppText(
TranslationBase
.of(context)
.noteVerified,
TranslationBase.of(context).noteVerified,
fontWeight: FontWeight.bold,
color: Colors.green[600],
fontSize: 12,
),
if (model.patientProgressNoteList[index].status != 2 &&
model
.patientProgressNoteList[
index]
.status !=
4 &&
authenticationViewModel
.doctorProfile.doctorID ==
model
.patientProgressNoteList[
index]
.createdBy)
model.patientProgressNoteList[index].status != 4 &&
authenticationViewModel.doctorProfile!.doctorID ==
model.patientProgressNoteList[index].createdBy)
Row(
crossAxisAlignment:
CrossAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
InkWell(
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
UpdateNoteOrder(
note: model
.patientProgressNoteList[
index],
patientModel:
model,
patient:
patient,
visitType: widget
.visitType,
builder: (context) => UpdateNoteOrder(
note: model.patientProgressNoteList[index],
patientModel: model,
patient: patient,
visitType: widget.visitType,
isUpdate: true,
)),
);
@ -244,9 +177,7 @@ class _ProgressNoteState extends State<ProgressNoteScreen> {
child: Container(
decoration: BoxDecoration(
color: Colors.grey[600],
borderRadius:
BorderRadius.circular(
10),
borderRadius: BorderRadius.circular(10),
),
// color:Colors.red[600],
@ -261,10 +192,7 @@ class _ProgressNoteState extends State<ProgressNoteScreen> {
width: 2,
),
AppText(
TranslationBase
.of(
context)
.update,
TranslationBase.of(context).update,
fontSize: 10,
color: Colors.white,
),
@ -282,61 +210,33 @@ class _ProgressNoteState extends State<ProgressNoteScreen> {
context: context,
actionName: "verify",
confirmFun: () async {
GifLoaderDialogUtils
.showMyDialog(
context);
UpdateNoteReqModel
reqModel =
UpdateNoteReqModel(
admissionNo: int
.parse(patient
.admissionNo),
cancelledNote:
false,
lineItemNo: model
.patientProgressNoteList[
index]
.lineItemNo,
createdBy: model
.patientProgressNoteList[
index]
.createdBy,
notes: model
.patientProgressNoteList[
index]
.notes,
GifLoaderDialogUtils.showMyDialog(context);
UpdateNoteReqModel reqModel = UpdateNoteReqModel(
admissionNo: int.parse(patient.admissionNo ?? ""),
cancelledNote: false,
lineItemNo: model.patientProgressNoteList[index].lineItemNo,
createdBy: model.patientProgressNoteList[index].createdBy,
notes: model.patientProgressNoteList[index].notes,
verifiedNote: true,
patientTypeID:
patient
.patientType,
patientTypeID: patient.patientType,
patientOutSA: false,
);
await model
.updatePatientProgressNote(
reqModel);
await getProgressNoteList(
context, model,
isLocalBusy:
true);
GifLoaderDialogUtils
.hideDialog(
context);
await model.updatePatientProgressNote(reqModel);
await getProgressNoteList(context, model, isLocalBusy: true);
GifLoaderDialogUtils.hideDialog(context);
});
},
child: Container(
decoration: BoxDecoration(
color: Colors.green[600],
borderRadius:
BorderRadius.circular(
10),
borderRadius: BorderRadius.circular(10),
),
// color:Colors.red[600],
child: Row(
children: [
Icon(
FontAwesomeIcons
.check,
FontAwesomeIcons.check,
size: 12,
color: Colors.white,
),
@ -344,10 +244,7 @@ class _ProgressNoteState extends State<ProgressNoteScreen> {
width: 2,
),
AppText(
TranslationBase
.of(
context)
.noteVerify,
TranslationBase.of(context).noteVerify,
fontSize: 10,
color: Colors.white,
),
@ -363,67 +260,37 @@ class _ProgressNoteState extends State<ProgressNoteScreen> {
onTap: () async {
showMyDialog(
context: context,
actionName:
TranslationBase
.of(
context)
.cancel,
actionName: TranslationBase.of(context).cancel!,
confirmFun: () async {
GifLoaderDialogUtils
.showMyDialog(
GifLoaderDialogUtils.showMyDialog(
context,
);
UpdateNoteReqModel
reqModel =
UpdateNoteReqModel(
admissionNo: int
.parse(patient
.admissionNo),
UpdateNoteReqModel reqModel = UpdateNoteReqModel(
admissionNo: int.parse(patient.admissionNo ?? ""),
cancelledNote: true,
lineItemNo: model
.patientProgressNoteList[
index]
.lineItemNo,
createdBy: model
.patientProgressNoteList[
index]
.createdBy,
notes: model
.patientProgressNoteList[
index]
.notes,
lineItemNo: model.patientProgressNoteList[index].lineItemNo,
createdBy: model.patientProgressNoteList[index].createdBy,
notes: model.patientProgressNoteList[index].notes,
verifiedNote: false,
patientTypeID:
patient
.patientType,
patientTypeID: patient.patientType,
patientOutSA: false,
);
await model
.updatePatientProgressNote(
reqModel);
await getProgressNoteList(
context, model,
isLocalBusy:
true);
GifLoaderDialogUtils
.hideDialog(
context);
await model.updatePatientProgressNote(reqModel);
await getProgressNoteList(context, model, isLocalBusy: true);
GifLoaderDialogUtils.hideDialog(context);
});
},
child: Container(
decoration: BoxDecoration(
color: Colors.red[600],
borderRadius:
BorderRadius.circular(
10),
borderRadius: BorderRadius.circular(10),
),
// color:Colors.red[600],
child: Row(
children: [
Icon(
FontAwesomeIcons
.trash,
FontAwesomeIcons.trash,
size: 12,
color: Colors.white,
),
@ -449,41 +316,25 @@ class _ProgressNoteState extends State<ProgressNoteScreen> {
height: 10,
),
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
crossAxisAlignment:
CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
width: MediaQuery.of(context)
.size
.width *
0.60,
width: MediaQuery.of(context).size.width * 0.60,
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
crossAxisAlignment:
CrossAxisAlignment
.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
AppText(
TranslationBase
.of(
context)
.createdBy,
TranslationBase.of(context).createdBy,
fontSize: 10,
),
Expanded(
child: AppText(
model
.patientProgressNoteList[
index]
.doctorName ??
'',
fontWeight:
FontWeight.w600,
model.patientProgressNoteList[index].doctorName ?? '',
fontWeight: FontWeight.w600,
fontSize: 12,
),
),
@ -495,187 +346,149 @@ class _ProgressNoteState extends State<ProgressNoteScreen> {
Column(
children: [
AppText(
model
.patientProgressNoteList[
index]
.createdOn !=
null
model.patientProgressNoteList[index].createdOn != null
? AppDateUtils.getDayMonthYearDateFormatted(
AppDateUtils
.getDateTimeFromServerFormat(
model
.patientProgressNoteList[
index]
.createdOn),
isArabic:
projectViewModel
.isArabic)
: AppDateUtils
.getDayMonthYearDateFormatted(
DateTime.now(),
isArabic:
projectViewModel
.isArabic),
AppDateUtils.getDateTimeFromServerFormat(
model.patientProgressNoteList[index].createdOn ?? ""),
isArabic: projectViewModel.isArabic)
: AppDateUtils.getDayMonthYearDateFormatted(DateTime.now(),
isArabic: projectViewModel.isArabic),
fontWeight: FontWeight.w600,
fontSize: 14,
),
AppText(
model
.patientProgressNoteList[
index]
.createdOn !=
null
? AppDateUtils.getHour(AppDateUtils
.getDateTimeFromServerFormat(
model
.patientProgressNoteList[
index]
.createdOn))
: AppDateUtils.getHour(
DateTime.now()),
model.patientProgressNoteList[index].createdOn != null
? AppDateUtils.getHour(AppDateUtils.getDateTimeFromServerFormat(
model.patientProgressNoteList[index].createdOn ?? ""))
: AppDateUtils.getHour(DateTime.now()),
fontWeight: FontWeight.w600,
fontSize: 14,
),
],
crossAxisAlignment:
CrossAxisAlignment.end,
crossAxisAlignment: CrossAxisAlignment.end,
)
],
),
SizedBox(
height: 8,
),
Row(
mainAxisAlignment:
MainAxisAlignment.start,
children: [
Expanded(
child: AppText(
model
.patientProgressNoteList[
index]
.notes,
fontSize: 10,
),
),
])
],
),
SizedBox(
height: 20,
),
],
Row(mainAxisAlignment: MainAxisAlignment.start, children: [
Expanded(
child: AppText(
model.patientProgressNoteList[index].notes,
fontSize: 10,
),
),
])
],
),
SizedBox(
height: 20,
),
],
),
),
),
);
}),
);
}),
),
),
),
],
],
),
),
),
),
);
}
showMyDialog({BuildContext context, Function confirmFun, String actionName}) {
showMyDialog({required BuildContext context, required Function confirmFun, required String actionName}) {
showDialog(
context: context,
builder: (ctx) => Center(
child: Container(
width: MediaQuery
.of(context)
.size
.width * 0.8,
height: 200,
child: AppScaffold(
isShowAppBar: false,
body: Container(
color: Colors.white,
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
// SizedBox(height: 20,),
SizedBox(
height: 10,
),
Row(
child: Container(
width: MediaQuery.of(context).size.width * 0.8,
height: 200,
child: AppScaffold(
isShowAppBar: false,
body: Container(
color: Colors.white,
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
AppText(
TranslationBase
.of(context)
.noteConfirm,
fontWeight: FontWeight.w600,
color: Colors.black,
fontSize: 16,
// SizedBox(height: 20,),
SizedBox(
height: 10,
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
AppText(
TranslationBase.of(context).noteConfirm,
fontWeight: FontWeight.w600,
color: Colors.black,
fontSize: 16,
),
],
),
SizedBox(
height: 10,
),
DividerWithSpacesAround(),
SizedBox(
height: 12,
),
],
),
SizedBox(
height: 10,
),
DividerWithSpacesAround(),
SizedBox(
height: 12,
),
Container(
padding: EdgeInsets.all(20),
color: Colors.white,
child: AppText(
projectViewModel.isArabic?"هل أنت متأكد أنك تريد تنفيذ $actionName هذا الأمر؟":'Are you sure you want $actionName this order?',
fontSize: 15,
textAlign: TextAlign.center,
),
),
Container(
padding: EdgeInsets.all(20),
color: Colors.white,
child: AppText(
projectViewModel.isArabic
? "هل أنت متأكد أنك تريد تنفيذ $actionName هذا الأمر؟"
: 'Are you sure you want $actionName this order?',
fontSize: 15,
textAlign: TextAlign.center,
),
),
SizedBox(
height: 8,
SizedBox(
height: 8,
),
DividerWithSpacesAround(),
FractionallySizedBox(
widthFactor: 0.75,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
FlatButton(
child: AppText(
TranslationBase.of(context).cancel,
fontWeight: FontWeight.w600,
color: Colors.black,
fontSize: 16,
), //Text("Cancel"),
onPressed: () {
Navigator.of(context).pop();
}),
FlatButton(
child: AppText(
TranslationBase.of(context).noteConfirm,
fontWeight: FontWeight.w600,
color: Colors.red.shade700,
fontSize: 16,
), //Text("Confirm", ),
onPressed: () async {
await confirmFun();
Navigator.of(context).pop();
})
],
),
)
],
),
DividerWithSpacesAround(),
FractionallySizedBox(
widthFactor: 0.75,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
FlatButton(
child: AppText(
TranslationBase
.of(context)
.cancel,
fontWeight: FontWeight.w600,
color: Colors.black,
fontSize: 16,
), //Text("Cancel"),
onPressed: () {
Navigator.of(context).pop();
}),
FlatButton(
child: AppText(
TranslationBase
.of(context)
.noteConfirm,
fontWeight: FontWeight.w600,
color: Colors.red.shade700,
fontSize: 16,
), //Text("Confirm", ),
onPressed: () async {
await confirmFun();
Navigator.of(context).pop();
})
],
),
)
],
),
),
),
),
),
),
)
);
));
}
}

@ -28,19 +28,19 @@ import 'package:speech_to_text/speech_recognition_error.dart';
import 'package:speech_to_text/speech_to_text.dart' as stt;
class UpdateNoteOrder extends StatefulWidget {
final NoteModel note;
final NoteModel? note;
final PatientViewModel patientModel;
final PatiantInformtion patient;
final int visitType;
final bool isUpdate;
const UpdateNoteOrder(
{Key key,
{Key? key,
this.note,
this.patientModel,
this.patient,
this.visitType,
this.isUpdate})
required this.patientModel,
required this.patient,
required this.visitType,
required this.isUpdate})
: super(key: key);
@override
@ -48,12 +48,12 @@ class UpdateNoteOrder extends StatefulWidget {
}
class _UpdateNoteOrderState extends State<UpdateNoteOrder> {
int selectedType;
int? selectedType;
bool isSubmitted = false;
stt.SpeechToText speech = stt.SpeechToText();
var reconizedWord;
var event = RobotProvider();
ProjectViewModel projectViewModel;
ProjectViewModel? projectViewModel;
TextEditingController progressNoteController = TextEditingController();
@ -81,7 +81,7 @@ class _UpdateNoteOrderState extends State<UpdateNoteOrder> {
projectViewModel = Provider.of(context);
if (widget.note != null) {
progressNoteController.text = widget.note.notes;
progressNoteController.text = widget.note!.notes!;
}
return AppScaffold(
@ -99,12 +99,12 @@ class _UpdateNoteOrderState extends State<UpdateNoteOrder> {
title: widget.visitType == 3
? (widget.isUpdate
? TranslationBase.of(context).noteUpdate
: TranslationBase.of(context).noteAdd) +
TranslationBase.of(context).orderSheet
: TranslationBase.of(context).noteAdd)! +
TranslationBase.of(context).orderSheet!
: (widget.isUpdate
? TranslationBase.of(context).noteUpdate
: TranslationBase.of(context).noteAdd) +
TranslationBase.of(context).progressNote,
: TranslationBase.of(context).noteAdd)! +
TranslationBase.of(context).progressNote!,
),
SizedBox(
height: 10.0,
@ -119,17 +119,13 @@ class _UpdateNoteOrderState extends State<UpdateNoteOrder> {
AppTextFieldCustom(
hintText: widget.visitType == 3
? (widget.isUpdate
? TranslationBase.of(context)
.noteUpdate
: TranslationBase.of(context)
.noteAdd) +
TranslationBase.of(context).orderSheet
? TranslationBase.of(context).noteUpdate
: TranslationBase.of(context).noteAdd)! +
TranslationBase.of(context).orderSheet!
: (widget.isUpdate
? TranslationBase.of(context)
.noteUpdate
: TranslationBase.of(context)
.noteAdd) +
TranslationBase.of(context).progressNote,
? TranslationBase.of(context).noteUpdate
: TranslationBase.of(context).noteAdd)! +
TranslationBase.of(context).progressNote!,
//TranslationBase.of(context).addProgressNote,
controller: progressNoteController,
maxLines: 35,
@ -137,26 +133,19 @@ class _UpdateNoteOrderState extends State<UpdateNoteOrder> {
hasBorder: true,
// isTextFieldHasSuffix: true,
validationError:
progressNoteController.text.isEmpty &&
isSubmitted
? TranslationBase.of(context).emptyMessage
: null,
validationError: progressNoteController.text.isEmpty && isSubmitted
? TranslationBase.of(context).emptyMessage
: null,
),
Positioned(
top:
-2, //MediaQuery.of(context).size.height * 0,
right: projectViewModel.isArabic
? MediaQuery.of(context).size.width * 0.75
: 15,
top: -2, //MediaQuery.of(context).size.height * 0,
right: projectViewModel!.isArabic ? MediaQuery.of(context).size.width * 0.75 : 15,
child: Column(
children: [
IconButton(
icon: Icon(DoctorApp.speechtotext,
color: Colors.black, size: 35),
icon: Icon(DoctorApp.speechtotext, color: Colors.black, size: 35),
onPressed: () {
initSpeechState()
.then((value) => {onVoiceText()});
initSpeechState().then((value) => {onVoiceText()});
},
),
],
@ -173,34 +162,34 @@ class _UpdateNoteOrderState extends State<UpdateNoteOrder> {
),
),
bottomSheet: Container(
height: progressNoteController.text.isNotEmpty? 130:70,
height: progressNoteController.text.isNotEmpty ? 130 : 70,
margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5),
child: Column(
children: <Widget>[
if(progressNoteController.text.isNotEmpty)
Container(
margin: EdgeInsets.all(5),
child: AppButton(
title: TranslationBase.of(context).clearText,
onPressed: () {
setState(() {
progressNoteController.text = '';
});
},
),
),
if (progressNoteController.text.isNotEmpty)
Container(
margin: EdgeInsets.all(5),
child: AppButton(
title: TranslationBase.of(context).clearText,
onPressed: () {
setState(() {
progressNoteController.text = '';
});
},
),
),
Container(
margin: EdgeInsets.all(5),
child: AppButton(
title: widget.visitType == 3
? (widget.isUpdate
? TranslationBase.of(context).noteUpdate
: TranslationBase.of(context).noteAdd) +
TranslationBase.of(context).orderSheet
: TranslationBase.of(context).noteAdd)! +
TranslationBase.of(context).orderSheet!
: (widget.isUpdate
? TranslationBase.of(context).noteUpdate
: TranslationBase.of(context).noteAdd) +
TranslationBase.of(context).progressNote,
? TranslationBase.of(context).noteUpdate!
: TranslationBase.of(context).noteAdd!) +
TranslationBase.of(context).progressNote!,
color: Color(0xff359846),
// disabled: progressNoteController.text.isEmpty,
fontWeight: FontWeight.w700,
@ -212,26 +201,23 @@ class _UpdateNoteOrderState extends State<UpdateNoteOrder> {
GifLoaderDialogUtils.showMyDialog(context);
Map profile = await sharedPref.getObj(DOCTOR_PROFILE);
DoctorProfileModel doctorProfile =
DoctorProfileModel.fromJson(profile);
DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile);
if (widget.isUpdate) {
UpdateNoteReqModel reqModel = UpdateNoteReqModel(
admissionNo: int.parse(widget.patient.admissionNo),
admissionNo: int.parse(widget.patient.admissionNo!),
cancelledNote: false,
lineItemNo: widget.note.lineItemNo,
createdBy: widget.note.createdBy,
lineItemNo: widget.note!.lineItemNo,
createdBy: widget.note?.createdBy,
notes: progressNoteController.text,
verifiedNote: false,
patientTypeID: widget.patient.patientType,
patientOutSA: false,
);
await widget.patientModel
.updatePatientProgressNote(reqModel);
await widget.patientModel.updatePatientProgressNote(reqModel);
} else {
CreateNoteModel reqModel = CreateNoteModel(
admissionNo:
int.parse(widget.patient.admissionNo),
admissionNo: int.parse(widget.patient.admissionNo!),
createdBy: doctorProfile.doctorID,
visitType: widget.visitType,
patientID: widget.patient.patientId,
@ -240,28 +226,23 @@ class _UpdateNoteOrderState extends State<UpdateNoteOrder> {
patientOutSA: false,
notes: progressNoteController.text);
await widget.patientModel
.createPatientProgressNote(reqModel);
await widget.patientModel.createPatientProgressNote(reqModel);
}
if (widget.patientModel.state == ViewState.ErrorLocal) {
Helpers.showErrorToast(widget.patientModel.error);
} else {
ProgressNoteRequest progressNoteRequest =
ProgressNoteRequest(
visitType: widget.visitType,
// if equal 5 then this will return progress note
admissionNo:
int.parse(widget.patient.admissionNo),
projectID: widget.patient.projectId,
patientTypeID: widget.patient.patientType,
languageID: 2);
await widget.patientModel.getPatientProgressNote(
progressNoteRequest.toJson());
ProgressNoteRequest progressNoteRequest = ProgressNoteRequest(
visitType: widget.visitType,
// if equal 5 then this will return progress note
admissionNo: int.parse(widget.patient.admissionNo!),
projectID: widget.patient.projectId,
patientTypeID: widget.patient.patientType,
languageID: 2);
await widget.patientModel.getPatientProgressNote(progressNoteRequest.toJson());
}
GifLoaderDialogUtils.hideDialog(context);
DrAppToastMsg.showSuccesToast(
"Your Order added Successfully");
DrAppToastMsg.showSuccesToast("Your Order added Successfully");
Navigator.of(context).pop();
} else {
Helpers.showErrorToast("You cant add only spaces");
@ -276,8 +257,7 @@ class _UpdateNoteOrderState extends State<UpdateNoteOrder> {
onVoiceText() async {
new SpeechToText(context: context).showAlertDialog(context);
var lang = TranslationBase.of(AppGlobal.CONTEX).locale.languageCode;
bool available = await speech.initialize(
onStatus: statusListener, onError: errorListener);
bool available = await speech.initialize(onStatus: statusListener, onError: errorListener);
if (available) {
speech.listen(
onResult: resultListener,
@ -321,8 +301,7 @@ class _UpdateNoteOrderState extends State<UpdateNoteOrder> {
}
Future<void> initSpeechState() async {
bool hasSpeech = await speech.initialize(
onError: errorListener, onStatus: statusListener);
bool hasSpeech = await speech.initialize(onError: errorListener, onStatus: statusListener);
print(hasSpeech);
if (!mounted) return;
}

@ -10,17 +10,15 @@ import 'package:flutter/material.dart';
class InpatientPrescriptionDetailsScreen extends StatefulWidget {
@override
_InpatientPrescriptionDetailsScreenState createState() =>
_InpatientPrescriptionDetailsScreenState();
_InpatientPrescriptionDetailsScreenState createState() => _InpatientPrescriptionDetailsScreenState();
}
class _InpatientPrescriptionDetailsScreenState
extends State<InpatientPrescriptionDetailsScreen> {
class _InpatientPrescriptionDetailsScreenState extends State<InpatientPrescriptionDetailsScreen> {
bool _showDetails = false;
String error;
TextEditingController answerController;
String? error;
TextEditingController? answerController;
bool _isInit = true;
PrescriptionReportForInPatient prescription;
late PrescriptionReportForInPatient prescription;
@override
void initState() {
@ -31,7 +29,7 @@ class _InpatientPrescriptionDetailsScreenState
void didChangeDependencies() {
super.didChangeDependencies();
if (_isInit) {
final routeArgs = ModalRoute.of(context).settings.arguments as Map;
final routeArgs = ModalRoute.of(context)!.settings.arguments as Map;
prescription = routeArgs['prescription'];
}
_isInit = false;
@ -40,7 +38,7 @@ class _InpatientPrescriptionDetailsScreenState
@override
Widget build(BuildContext context) {
return AppScaffold(
appBarTitle: TranslationBase.of(context).prescriptionInfo,
appBarTitle: TranslationBase.of(context).prescriptionInfo ?? "",
body: CardWithBgWidgetNew(
widget: Container(
child: ListView(
@ -59,9 +57,7 @@ class _InpatientPrescriptionDetailsScreenState
_showDetails = !_showDetails;
});
},
child: Icon(_showDetails
? Icons.keyboard_arrow_up
: Icons.keyboard_arrow_down)),
child: Icon(_showDetails ? Icons.keyboard_arrow_up : Icons.keyboard_arrow_down)),
],
),
!_showDetails
@ -83,52 +79,25 @@ class _InpatientPrescriptionDetailsScreenState
inside: BorderSide(width: 0.5),
),
children: [
buildTableRow(des: '${prescription.direction}', key: 'Direction'),
buildTableRow(des: '${prescription.refillID}', key: 'Refill'),
buildTableRow(des: '${prescription.dose}', key: 'Dose'),
buildTableRow(des: '${prescription.unitofMeasurement}', key: 'UOM'),
buildTableRow(
des: '${prescription.direction}',
key: 'Direction'),
des: '${AppDateUtils.getDate(prescription.startDatetime!)}', key: 'Start Date'),
buildTableRow(
des: '${prescription.refillID}',
key: 'Refill'),
des: '${AppDateUtils.getDate(prescription.stopDatetime!)}', key: 'Stop Date'),
buildTableRow(des: '${prescription.noOfDoses}', key: 'No of Doses'),
buildTableRow(des: '${prescription.route}', key: 'Route'),
buildTableRow(des: '${prescription.comments}', key: 'Comments'),
buildTableRow(des: '${prescription.pharmacyRemarks}', key: 'Pharmacy Remarks'),
buildTableRow(
des: '${prescription.dose}', key: 'Dose'),
buildTableRow(
des: '${prescription.unitofMeasurement}',
key: 'UOM'),
buildTableRow(
des:
'${AppDateUtils.getDate(prescription.startDatetime)}',
key: 'Start Date'),
buildTableRow(
des:
'${AppDateUtils.getDate(prescription.stopDatetime)}',
key: 'Stop Date'),
buildTableRow(
des: '${prescription.noOfDoses}',
key: 'No of Doses'),
buildTableRow(
des: '${prescription.route}', key: 'Route'),
buildTableRow(
des: '${prescription.comments}',
key: 'Comments'),
buildTableRow(
des: '${prescription.pharmacyRemarks}',
key: 'Pharmacy Remarks'),
buildTableRow(
des:
'${AppDateUtils.getDate(prescription.prescriptionDatetime)}',
des: '${AppDateUtils.getDate(prescription.prescriptionDatetime!)}',
key: 'Prescription Date'),
buildTableRow(
des: '${prescription.refillID}',
key: 'Status'),
buildTableRow(
des: '${prescription.refillID}',
key: 'Created By'),
buildTableRow(
des: '${prescription.refillID}',
key: 'Processed By'),
buildTableRow(
des: '${prescription.refillID}',
key: 'Authorized By'),
buildTableRow(des: '${prescription.refillID}', key: 'Status'),
buildTableRow(des: '${prescription.refillID}', key: 'Created By'),
buildTableRow(des: '${prescription.refillID}', key: 'Processed By'),
buildTableRow(des: '${prescription.refillID}', key: 'Authorized By'),
],
),
Divider(
@ -168,8 +137,7 @@ class _InpatientPrescriptionDetailsScreenState
),
Expanded(
child: Container(
margin:
EdgeInsets.only(left: 4, top: 2.5, right: 2.5, bottom: 2.5),
margin: EdgeInsets.only(left: 4, top: 2.5, right: 2.5, bottom: 2.5),
padding: EdgeInsets.all(5),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,

@ -7,7 +7,7 @@ import 'package:flutter/material.dart';
class OutPatientPrescriptionDetailsItem extends StatefulWidget {
final PrescriptionReport prescriptionReport;
OutPatientPrescriptionDetailsItem({Key key, this.prescriptionReport});
OutPatientPrescriptionDetailsItem({Key? key, required this.prescriptionReport});
@override
_OutPatientPrescriptionDetailsItemState createState() =>

@ -8,23 +8,19 @@ class PatientProfileCardModel {
final bool isInPatient;
final bool isDisable;
final bool isLoading;
final Function onTap;
final GestureTapCallback? onTap;
final bool isDischargedPatient;
final bool isSelectInpatient;
final bool isDartIcon;
final IconData dartIcon;
final IconData? dartIcon;
PatientProfileCardModel(
this.nameLine1,
this.nameLine2,
this.route,
this.icon, {
this.isInPatient = false,
this.isDisable = false,
this.isLoading = false,
this.onTap,
this.isDischargedPatient = false,
this.isSelectInpatient = false,
this.isDartIcon = false,this.dartIcon
});
PatientProfileCardModel(this.nameLine1, this.nameLine2, this.route, this.icon,
{this.isInPatient = false,
this.isDisable = false,
this.isLoading = false,
this.onTap,
this.isDischargedPatient = false,
this.isSelectInpatient = false,
this.isDartIcon = false,
this.dartIcon});
}

@ -28,9 +28,8 @@ class PatientProfileScreen extends StatefulWidget {
_PatientProfileScreenState createState() => _PatientProfileScreenState();
}
class _PatientProfileScreenState extends State<PatientProfileScreen>
with SingleTickerProviderStateMixin {
PatiantInformtion patient;
class _PatientProfileScreenState extends State<PatientProfileScreen> with SingleTickerProviderStateMixin {
late PatiantInformtion patient;
bool isFromSearch = false;
bool isFromLiveCare = false;
@ -39,11 +38,11 @@ class _PatientProfileScreenState extends State<PatientProfileScreen>
bool isCallFinished = false;
bool isDischargedPatient = false;
bool isSearchAndOut = false;
String patientType;
String arrivalType;
String from;
String to;
TabController _tabController;
late String patientType;
late String arrivalType;
late String from;
late String to;
late TabController _tabController;
int index = 0;
int _activeTab = 0;
@override
@ -61,7 +60,7 @@ class _PatientProfileScreenState extends State<PatientProfileScreen>
@override
void didChangeDependencies() {
super.didChangeDependencies();
final routeArgs = ModalRoute.of(context).settings.arguments as Map;
final routeArgs = ModalRoute.of(context)!.settings.arguments as Map;
patient = routeArgs['patient'];
patientType = routeArgs['patientType'];
arrivalType = routeArgs['arrivalType'];
@ -79,7 +78,7 @@ class _PatientProfileScreenState extends State<PatientProfileScreen>
if (routeArgs.containsKey("isSearchAndOut")) {
isSearchAndOut = routeArgs['isSearchAndOut'];
}
if(routeArgs.containsKey("isFromLiveCare")) {
if (routeArgs.containsKey("isFromLiveCare")) {
isFromLiveCare = routeArgs['isFromLiveCare'];
}
if (isInpatient)
@ -92,39 +91,37 @@ class _PatientProfileScreenState extends State<PatientProfileScreen>
Widget build(BuildContext context) {
final screenSize = MediaQuery.of(context).size;
return BaseView<LiveCarePatientViewModel>(
builder: (_, model, w) => AppScaffold(
baseViewModel: model,
appBarTitle: TranslationBase.of(context).patientProfile,
isShowAppBar: false,
body: Column(
children: [
Stack(
children: [
Column(
children: [
PatientProfileHeaderNewDesignAppBar(
patient, arrivalType ?? '0', patientType,
builder: (_, model, w) => AppScaffold(
baseViewModel: model,
appBarTitle: TranslationBase.of(context).patientProfile ?? "",
isShowAppBar: false,
body: Column(
children: [
Stack(
children: [
Column(
children: [
PatientProfileHeaderNewDesignAppBar(patient, arrivalType ?? '0', patientType,
isInpatient: isInpatient,
isFromLiveCare: isFromLiveCare,
height: (patient.patientStatusType != null &&
patient.patientStatusType == 43)
height: (patient.patientStatusType != null && patient.patientStatusType == 43)
? 210
: isDischargedPatient
? 240
: 0,
isDischargedPatient: isDischargedPatient),
Container(
height: !isSearchAndOut
? isDischargedPatient
? MediaQuery.of(context).size.height * 0.64
: MediaQuery.of(context).size.height * 0.65
: MediaQuery.of(context).size.height * 0.69,
child: ListView(
children: [
Container(
height: !isSearchAndOut
? isDischargedPatient
? MediaQuery.of(context).size.height * 0.64
: MediaQuery.of(context).size.height * 0.65
: MediaQuery.of(context).size.height * 0.69,
child: ListView(
children: [
Container(
child: isSearchAndOut
? ProfileGridForSearch(
patient: patient,
child: isSearchAndOut
? ProfileGridForSearch(
patient: patient,
patientType: patientType,
arrivalType: arrivalType,
isInpatient: isInpatient,
@ -139,8 +136,7 @@ class _PatientProfileScreenState extends State<PatientProfileScreen>
isInpatient: isInpatient,
from: from,
to: to,
isDischargedPatient:
isDischargedPatient,
isDischargedPatient: isDischargedPatient,
isFromSearch: isFromSearch,
)
: ProfileGridForOther(
@ -156,207 +152,190 @@ class _PatientProfileScreenState extends State<PatientProfileScreen>
SizedBox(
height: MediaQuery.of(context).size.height * 0.05,
)
],
),
),
],
),
if (patient.patientStatusType != null &&
patient.patientStatusType == 43)
BaseView<SOAPViewModel>(
onModelReady: (model) async {},
builder: (_, model, w) => Positioned(
top: 180,
left: 20,
right: 20,
child: Row(
children: [
Expanded(child: Container()),
if (patient.episodeNo == 0)
AppButton(
title:
"${TranslationBase.of(context).createNew}\n${TranslationBase.of(context).episode}",
color: patient.patientStatusType == 43
? Colors.red.shade700
: Colors.grey.shade700,
fontColor: Colors.white,
vPadding: 8,
radius: 30,
hPadding: 20,
fontWeight: FontWeight.normal,
fontSize: 1.6,
icon: Image.asset(
"assets/images/create-episod.png",
color: Colors.white,
height: 30,
),
onPressed: () async {
if (patient.patientStatusType ==
43) {
PostEpisodeReqModel
postEpisodeReqModel =
PostEpisodeReqModel(
appointmentNo:
patient.appointmentNo,
patientMRN:
patient.patientMRN);
GifLoaderDialogUtils.showMyDialog(
context);
await model.postEpisode(
postEpisodeReqModel);
GifLoaderDialogUtils.hideDialog(
context);
patient.episodeNo =
model.episodeID;
Navigator.of(context).pushNamed(
CREATE_EPISODE,
arguments: {
'patient': patient
});
}
},
),
if (patient.episodeNo != 0)
AppButton(
title:
"${TranslationBase.of(context).update}\n${TranslationBase.of(context).episode}",
color:
patient.patientStatusType == 43
? Colors.red.shade700
: Colors.grey.shade700,
fontColor: Colors.white,
vPadding: 8,
radius: 30,
hPadding: 20,
fontWeight: FontWeight.normal,
fontSize: 1.6,
icon: Image.asset(
"assets/images/modilfy-episode.png",
color: Colors.white,
height: 30,
),
onPressed: () {
if (patient.patientStatusType ==
43) {
Navigator.of(context).pushNamed(
UPDATE_EPISODE,
arguments: {
'patient': patient
});
}
}),
],
),
],
),
if (patient.patientStatusType != null && patient.patientStatusType == 43)
BaseView<SOAPViewModel>(
onModelReady: (model) async {},
builder: (_, model, w) => Positioned(
top: 180,
left: 20,
right: 20,
child: Row(
children: [
Expanded(child: Container()),
if (patient.episodeNo == 0)
AppButton(
title:
"${TranslationBase.of(context).createNew}\n${TranslationBase.of(context).episode}",
color: patient.patientStatusType == 43 ? Colors.red.shade700 : Colors.grey.shade700,
fontColor: Colors.white,
vPadding: 8,
radius: 30,
hPadding: 20,
fontWeight: FontWeight.normal,
fontSize: 1.6,
icon: Image.asset(
"assets/images/create-episod.png",
color: Colors.white,
height: 30,
),
onPressed: () async {
if (patient.patientStatusType == 43) {
PostEpisodeReqModel postEpisodeReqModel = PostEpisodeReqModel(
appointmentNo: patient.appointmentNo, patientMRN: patient.patientMRN);
GifLoaderDialogUtils.showMyDialog(context);
await model.postEpisode(postEpisodeReqModel);
GifLoaderDialogUtils.hideDialog(context);
patient.episodeNo = model.episodeID;
Navigator.of(context)
.pushNamed(CREATE_EPISODE, arguments: {'patient': patient});
}
},
),
)),
],
),
],
),
bottomSheet: isFromLiveCare ? Container(
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(
Radius.circular(0.0),
),
border: Border.all(color: HexColor('#707070'), width: 0),
if (patient.episodeNo != 0)
AppButton(
title:
"${TranslationBase.of(context).update}\n${TranslationBase.of(context).episode}",
color:
patient.patientStatusType == 43 ? Colors.red.shade700 : Colors.grey.shade700,
fontColor: Colors.white,
vPadding: 8,
radius: 30,
hPadding: 20,
fontWeight: FontWeight.normal,
fontSize: 1.6,
icon: Image.asset(
"assets/images/modilfy-episode.png",
color: Colors.white,
height: 30,
),
onPressed: () {
if (patient.patientStatusType == 43) {
Navigator.of(context)
.pushNamed(UPDATE_EPISODE, arguments: {'patient': patient});
}
}),
],
),
)),
],
),
height: MediaQuery
.of(context)
.size
.height * 0.1,
width: double.infinity,
child: Column(
children: [
SizedBox(
height: 10,
],
),
bottomSheet: isFromLiveCare
? Container(
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(
Radius.circular(0.0),
),
border: Border.all(color: HexColor('#707070'), width: 0),
),
Container(
child: FractionallySizedBox(
widthFactor: .80,
child: Center(
child: AppButton(
fontWeight: FontWeight.w700,
color: isCallFinished?Colors.red[600]:Colors.green[600],
title: isCallFinished?
TranslationBase.of(context).endCall:
TranslationBase.of(context).initiateCall,
disabled: model.state == ViewState.BusyLocal,
onPressed: () async {
if(isCallFinished) {
Navigator.push(context, MaterialPageRoute(
builder: (BuildContext context) =>
EndCallScreen(patient:patient)));
} else {
GifLoaderDialogUtils.showMyDialog(context);
await model.startCall( isReCall : false, vCID: patient.vcId);
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(
fontWeight: FontWeight.w700,
color: isCallFinished ? Colors.red[600] : Colors.green[600],
title: isCallFinished
? TranslationBase.of(context).endCall
: TranslationBase.of(context).initiateCall,
disabled: model.state == ViewState.BusyLocal,
onPressed: () async {
if (isCallFinished) {
Navigator.push(
context,
MaterialPageRoute(
builder: (BuildContext context) => EndCallScreen(patient: patient)));
} else {
GifLoaderDialogUtils.showMyDialog(context);
await model.startCall(isReCall: false, vCID: patient.vcId!);
if(model.state == ViewState.ErrorLocal) {
GifLoaderDialogUtils.hideDialog(context);
Helpers.showErrorToast(model.error);
} else {
await model.getDoctorProfile();
patient.appointmentNo = model.startCallRes.appointmentNo;
patient.episodeNo = 0;
if (model.state == ViewState.ErrorLocal) {
GifLoaderDialogUtils.hideDialog(context);
Helpers.showErrorToast(model.error);
} else {
await model.getDoctorProfile();
patient.appointmentNo = model.startCallRes.appointmentNo;
patient.episodeNo = 0;
GifLoaderDialogUtils.hideDialog(context);
await VideoChannel.openVideoCallScreen(
kToken: model.startCallRes.openTokenID,
kSessionId: model.startCallRes.openSessionID,
kApiKey: '46209962',
vcId: patient.vcId,
tokenID: await model.getToken(),
generalId: GENERAL_ID,
doctorId: model.doctorProfile.doctorID,
onFailure: (String error) {
DrAppToastMsg.showErrorToast(error);
},
onCallEnd: () {
WidgetsBinding.instance.addPostFrameCallback((_) {
GifLoaderDialogUtils.showMyDialog(context);
model.endCall(patient.vcId, false,).then((value) {
GifLoaderDialogUtils.hideDialog(context);
if (model.state == ViewState.ErrorLocal) {
DrAppToastMsg.showErrorToast(model.error);
}
setState(() {
isCallFinished = true;
GifLoaderDialogUtils.hideDialog(context);
await VideoChannel.openVideoCallScreen(
kToken: model.startCallRes.openTokenID,
kSessionId: model.startCallRes.openSessionID,
kApiKey: '46209962',
vcId: patient.vcId,
tokenID: await model.getToken(),
generalId: GENERAL_ID,
doctorId: model.doctorProfile!.doctorID,
onFailure: (String error) {
DrAppToastMsg.showErrorToast(error);
},
onCallEnd: () {
WidgetsBinding.instance!.addPostFrameCallback((_) {
GifLoaderDialogUtils.showMyDialog(context);
model
.endCall(
patient.vcId!,
false,
)
.then((value) {
GifLoaderDialogUtils.hideDialog(context);
if (model.state == ViewState.ErrorLocal) {
DrAppToastMsg.showErrorToast(model.error);
}
setState(() {
isCallFinished = true;
});
});
});
});
},
onCallNotRespond: (SessionStatusModel sessionStatusModel) {
WidgetsBinding.instance.addPostFrameCallback((_) {
GifLoaderDialogUtils.showMyDialog(context);
model.endCall(patient.vcId, sessionStatusModel.sessionStatus == 3,).then((value) {
GifLoaderDialogUtils.hideDialog(context);
if (model.state == ViewState.ErrorLocal) {
DrAppToastMsg.showErrorToast(model.error);
}
setState(() {
isCallFinished = true;
});
});
});
});
}
}
},
},
onCallNotRespond: (SessionStatusModel sessionStatusModel) {
WidgetsBinding.instance!.addPostFrameCallback((_) {
GifLoaderDialogUtils.showMyDialog(context);
model
.endCall(
patient.vcId!,
sessionStatusModel.sessionStatus == 3,
)
.then((value) {
GifLoaderDialogUtils.hideDialog(context);
if (model.state == ViewState.ErrorLocal) {
DrAppToastMsg.showErrorToast(model.error);
}
setState(() {
isCallFinished = true;
});
});
});
});
}
}
},
),
),
),
),
),
),
SizedBox(
height: 5,
SizedBox(
height: 5,
),
],
),
],
),
) : null,
),
)
: null,
),
);
}
}
@ -370,12 +349,7 @@ class AvatarWidget extends StatelessWidget {
Widget build(BuildContext context) {
return Container(
decoration: BoxDecoration(
boxShadow: [
BoxShadow(
color: Color.fromRGBO(0, 0, 0, 0.08),
offset: Offset(0.0, 5.0),
blurRadius: 16.0)
],
boxShadow: [BoxShadow(color: Color.fromRGBO(0, 0, 0, 0.08), offset: Offset(0.0, 5.0), blurRadius: 16.0)],
borderRadius: BorderRadius.all(Radius.circular(35.0)),
color: Color(0xffCCCCCC),
),

@ -12,7 +12,7 @@ class ProfileGridForInPatient extends StatelessWidget {
final PatiantInformtion patient;
final String patientType;
final String arrivalType;
final double height;
final double? height;
final bool isInpatient;
final bool isDischargedPatient;
final bool isFromSearch;
@ -20,102 +20,65 @@ class ProfileGridForInPatient extends StatelessWidget {
String to;
ProfileGridForInPatient(
{Key key,
this.patient,
this.patientType,
this.arrivalType,
{Key? key,
required this.patient,
required this.patientType,
required this.arrivalType,
this.height,
this.isInpatient,
this.from,
this.to,
this.isDischargedPatient,
this.isFromSearch})
required this.isInpatient,
required this.from,
required this.to,
required this.isDischargedPatient,
required this.isFromSearch})
: super(key: key);
@override
Widget build(BuildContext context) {
final List<PatientProfileCardModel> cardsList = [
PatientProfileCardModel(
TranslationBase.of(context).vital,
TranslationBase.of(context).signs,
VITAL_SIGN_DETAILS,
'patient/vital_signs.png',
PatientProfileCardModel(TranslationBase.of(context).vital ?? "", TranslationBase.of(context).signs ?? "",
VITAL_SIGN_DETAILS, 'patient/vital_signs.png',
isInPatient: isInpatient),
PatientProfileCardModel(
TranslationBase.of(context).lab,
TranslationBase.of(context).result,
LAB_RESULT,
'patient/lab_results.png',
PatientProfileCardModel(TranslationBase.of(context).lab ?? "", TranslationBase.of(context).result ?? "",
LAB_RESULT, 'patient/lab_results.png',
isInPatient: isInpatient),
PatientProfileCardModel(
TranslationBase.of(context).radiology,
TranslationBase.of(context).result,
RADIOLOGY_PATIENT,
'patient/health_summary.png',
PatientProfileCardModel(TranslationBase.of(context).radiology!, TranslationBase.of(context).result!,
RADIOLOGY_PATIENT, 'patient/health_summary.png',
isInPatient: isInpatient),
PatientProfileCardModel(
TranslationBase.of(context).patient,
TranslationBase.of(context).prescription,
ORDER_PRESCRIPTION_NEW,
'patient/order_prescription.png',
PatientProfileCardModel(TranslationBase.of(context).patient!, TranslationBase.of(context).prescription!,
ORDER_PRESCRIPTION_NEW, 'patient/order_prescription.png',
isInPatient: isInpatient),
PatientProfileCardModel(
TranslationBase.of(context).progress,
TranslationBase.of(context).note,
PROGRESS_NOTE,
PatientProfileCardModel(TranslationBase.of(context).progress!, TranslationBase.of(context).note!, PROGRESS_NOTE,
'patient/Progress_notes.png',
isInPatient: isInpatient,
isDischargedPatient: isDischargedPatient),
PatientProfileCardModel(
TranslationBase.of(context).order,
TranslationBase.of(context).sheet,
ORDER_NOTE,
isInPatient: isInpatient, isDischargedPatient: isDischargedPatient),
PatientProfileCardModel(TranslationBase.of(context).order!, TranslationBase.of(context).sheet!, ORDER_NOTE,
'patient/Progress_notes.png',
isInPatient: isInpatient,
isDischargedPatient: isDischargedPatient),
PatientProfileCardModel(
TranslationBase.of(context).orders,
TranslationBase.of(context).procedures,
ORDER_PROCEDURE,
'patient/Order_Procedures.png',
isInPatient: isInpatient, isDischargedPatient: isDischargedPatient),
PatientProfileCardModel(TranslationBase.of(context).orders!, TranslationBase.of(context).procedures!,
ORDER_PROCEDURE, 'patient/Order_Procedures.png',
isInPatient: isInpatient),
PatientProfileCardModel(
TranslationBase.of(context).health,
TranslationBase.of(context).summary,
HEALTH_SUMMARY,
PatientProfileCardModel(TranslationBase.of(context).health!, TranslationBase.of(context).summary!, HEALTH_SUMMARY,
'patient/health_summary.png',
isInPatient: isInpatient),
PatientProfileCardModel(TranslationBase.of(context).medical!, TranslationBase.of(context).report!,
PATIENT_MEDICAL_REPORT, 'patient/health_summary.png',
isInPatient: isInpatient, isDisable: false),
PatientProfileCardModel(
TranslationBase.of(context).medical,
TranslationBase.of(context).report,
PATIENT_MEDICAL_REPORT,
'patient/health_summary.png',
isInPatient: isInpatient,
isDisable: false),
PatientProfileCardModel(
TranslationBase.of(context).referral,
TranslationBase.of(context).patient,
TranslationBase.of(context).referral!,
TranslationBase.of(context).patient!,
REFER_IN_PATIENT_TO_DOCTOR,
'patient/refer_patient.png',
isInPatient: isInpatient,
isDisable: isDischargedPatient || isFromSearch,
),
PatientProfileCardModel(
TranslationBase.of(context).insurance,
TranslationBase.of(context).approvals,
PATIENT_INSURANCE_APPROVALS_NEW,
'patient/vital_signs.png',
PatientProfileCardModel(TranslationBase.of(context).insurance!, TranslationBase.of(context).approvals!,
PATIENT_INSURANCE_APPROVALS_NEW, 'patient/vital_signs.png',
isInPatient: isInpatient),
PatientProfileCardModel(
TranslationBase.of(context).discharge,
TranslationBase.of(context).report,
null,
PatientProfileCardModel(TranslationBase.of(context).discharge!, TranslationBase.of(context).report!, null,
'patient/patient_sick_leave.png',
isInPatient: isInpatient,
isDisable: true),
isInPatient: isInpatient, isDisable: true),
PatientProfileCardModel(
TranslationBase.of(context).patientSick,
TranslationBase.of(context).leave,
TranslationBase.of(context).patientSick!,
TranslationBase.of(context).leave!,
ADD_SICKLEAVE,
'patient/patient_sick_leave.png',
isInPatient: isInpatient,

@ -12,133 +12,79 @@ class ProfileGridForOther extends StatelessWidget {
final PatiantInformtion patient;
final String patientType;
final String arrivalType;
final double height;
final double? height;
final bool isInpatient;
final bool isFromLiveCare;
String from;
String to;
ProfileGridForOther(
{Key key,
this.patient,
this.patientType,
this.arrivalType,
{Key? key,
required this.patient,
required this.patientType,
required this.arrivalType,
this.height,
this.isInpatient,
this.from,
this.to,
this.isFromLiveCare})
required this.isInpatient,
required this.from,
required this.to,
required this.isFromLiveCare})
: super(key: key);
@override
Widget build(BuildContext context) {
final List<PatientProfileCardModel> cardsList = [
PatientProfileCardModel(
TranslationBase.of(context).vital,
TranslationBase.of(context).signs,
VITAL_SIGN_DETAILS,
'patient/vital_signs.png',
PatientProfileCardModel(TranslationBase.of(context).vital!, TranslationBase.of(context).signs!,
VITAL_SIGN_DETAILS, 'patient/vital_signs.png',
isInPatient: isInpatient),
PatientProfileCardModel(
TranslationBase.of(context).lab,
TranslationBase.of(context).result,
LAB_RESULT,
'patient/lab_results.png',
TranslationBase.of(context).lab!, TranslationBase.of(context).result!, LAB_RESULT, 'patient/lab_results.png',
isInPatient: isInpatient),
PatientProfileCardModel(
TranslationBase.of(context).radiology,
TranslationBase.of(context).service,
RADIOLOGY_PATIENT,
'patient/health_summary.png',
PatientProfileCardModel(TranslationBase.of(context).radiology!, TranslationBase.of(context).service!,
RADIOLOGY_PATIENT, 'patient/health_summary.png',
isInPatient: isInpatient),
PatientProfileCardModel(
TranslationBase.of(context).orders,
TranslationBase.of(context).prescription,
ORDER_PRESCRIPTION_NEW,
'patient/order_prescription.png',
PatientProfileCardModel(TranslationBase.of(context).orders!, TranslationBase.of(context).prescription!,
ORDER_PRESCRIPTION_NEW, 'patient/order_prescription.png',
isInPatient: isInpatient),
PatientProfileCardModel(
TranslationBase.of(context).health,
TranslationBase.of(context).summary,
HEALTH_SUMMARY,
PatientProfileCardModel(TranslationBase.of(context).health!, TranslationBase.of(context).summary!, HEALTH_SUMMARY,
'patient/health_summary.png',
isInPatient: isInpatient),
PatientProfileCardModel(
TranslationBase.of(context).patient,
"ECG",
PATIENT_ECG,
'patient/patient_sick_leave.png',
TranslationBase.of(context).patient!, "ECG", PATIENT_ECG, 'patient/patient_sick_leave.png',
isInPatient: isInpatient),
PatientProfileCardModel(
TranslationBase.of(context).orders,
TranslationBase.of(context).procedures,
ORDER_PROCEDURE,
'patient/Order_Procedures.png',
PatientProfileCardModel(TranslationBase.of(context).orders!, TranslationBase.of(context).procedures!,
ORDER_PROCEDURE, 'patient/Order_Procedures.png',
isInPatient: isInpatient),
PatientProfileCardModel(
TranslationBase
.of(context)
.insurance,
TranslationBase
.of(context)
.service,
PATIENT_INSURANCE_APPROVALS_NEW,
'patient/vital_signs.png',
PatientProfileCardModel(TranslationBase.of(context).insurance!, TranslationBase.of(context).service!,
PATIENT_INSURANCE_APPROVALS_NEW, 'patient/vital_signs.png',
isInPatient: isInpatient),
PatientProfileCardModel(
TranslationBase
.of(context)
.patientSick,
TranslationBase
.of(context)
.leave,
ADD_SICKLEAVE,
'patient/patient_sick_leave.png',
PatientProfileCardModel(TranslationBase.of(context).patientSick!, TranslationBase.of(context).leave!,
ADD_SICKLEAVE, 'patient/patient_sick_leave.png',
isInPatient: isInpatient),
if (isFromLiveCare ||
(patient.appointmentNo != null && patient.appointmentNo != 0))
PatientProfileCardModel(
TranslationBase
.of(context)
.patient,
TranslationBase
.of(context)
.ucaf,
PATIENT_UCAF_REQUEST,
'patient/ucaf.png',
if (isFromLiveCare || (patient.appointmentNo != null && patient.appointmentNo != 0))
PatientProfileCardModel(TranslationBase.of(context).patient!, TranslationBase.of(context).ucaf!,
PATIENT_UCAF_REQUEST, 'patient/ucaf.png',
isInPatient: isInpatient,
isDisable: isFromLiveCare?patient.appointmentNo == null:patient.patientStatusType != 43 ||
patient.appointmentNo == null ),
if (isFromLiveCare ||
(patient.appointmentNo != null && patient.appointmentNo != 0))
isDisable: isFromLiveCare
? patient.appointmentNo == null
: patient.patientStatusType != 43 || patient.appointmentNo == null),
if (isFromLiveCare || (patient.appointmentNo != null && patient.appointmentNo != 0))
PatientProfileCardModel(
TranslationBase
.of(context)
.referral,
TranslationBase
.of(context)
.patient,
REFER_PATIENT_TO_DOCTOR,
'patient/refer_patient.png',
isInPatient: isInpatient,
isDisable: isFromLiveCare?patient.appointmentNo == null:patient.patientStatusType != 43 ||
patient.appointmentNo == null ,
TranslationBase.of(context).referral!,
TranslationBase.of(context).patient!,
REFER_PATIENT_TO_DOCTOR,
'patient/refer_patient.png',
isInPatient: isInpatient,
isDisable: isFromLiveCare
? patient.appointmentNo == null
: patient.patientStatusType != 43 || patient.appointmentNo == null,
),
if (isFromLiveCare ||
(patient.appointmentNo != null && patient.appointmentNo != 0))
PatientProfileCardModel(
TranslationBase
.of(context)
.admission,
TranslationBase
.of(context)
.request,
PATIENT_ADMISSION_REQUEST,
'patient/admission_req.png',
if (isFromLiveCare || (patient.appointmentNo != null && patient.appointmentNo != 0))
PatientProfileCardModel(TranslationBase.of(context).admission!, TranslationBase.of(context).request!,
PATIENT_ADMISSION_REQUEST, 'patient/admission_req.png',
isInPatient: isInpatient,
isDisable: isFromLiveCare?patient.appointmentNo == null:patient.patientStatusType != 43 ||
patient.appointmentNo == null
),
isDisable: isFromLiveCare
? patient.appointmentNo == null
: patient.patientStatusType != 43 || patient.appointmentNo == null),
];
return Column(
@ -168,9 +114,7 @@ class ProfileGridForOther extends StatelessWidget {
isDisable: cardsList[index].isDisable,
onTap: cardsList[index].onTap,
isLoading: cardsList[index].isLoading,
isFromLiveCare: isFromLiveCare
),
isFromLiveCare: isFromLiveCare),
),
),
],

@ -11,101 +11,64 @@ class ProfileGridForSearch extends StatelessWidget {
final PatiantInformtion patient;
final String patientType;
final String arrivalType;
final double height;
final double? height;
final bool isInpatient;
String from;
String to;
ProfileGridForSearch(
{Key key,
this.patient,
this.patientType,
this.arrivalType,
ProfileGridForSearch(
{Key? key,
required this.patient,
required this.patientType,
required this.arrivalType,
this.height,
this.isInpatient, this.from,this.to})
required this.isInpatient,
required this.from,
required this.to})
: super(key: key);
@override
Widget build(BuildContext context) {
final List<PatientProfileCardModel> cardsList = [
PatientProfileCardModel(
TranslationBase.of(context).vital,
TranslationBase.of(context).signs,
VITAL_SIGN_DETAILS,
'patient/vital_signs.png',
PatientProfileCardModel(TranslationBase.of(context).vital!, TranslationBase.of(context).signs!,
VITAL_SIGN_DETAILS, 'patient/vital_signs.png',
isInPatient: isInpatient),
PatientProfileCardModel(
TranslationBase.of(context).lab,
TranslationBase.of(context).result,
LAB_RESULT,
'patient/lab_results.png',
TranslationBase.of(context).lab!, TranslationBase.of(context).result!, LAB_RESULT, 'patient/lab_results.png',
isInPatient: isInpatient),
PatientProfileCardModel(
TranslationBase.of(context).radiology,
TranslationBase.of(context).service,
RADIOLOGY_PATIENT,
'patient/health_summary.png',
PatientProfileCardModel(TranslationBase.of(context).radiology!, TranslationBase.of(context).service!,
RADIOLOGY_PATIENT, 'patient/health_summary.png',
isInPatient: isInpatient),
PatientProfileCardModel(
TranslationBase.of(context).orders,
TranslationBase.of(context).prescription,
ORDER_PRESCRIPTION_NEW,
'patient/order_prescription.png',
PatientProfileCardModel(TranslationBase.of(context).orders!, TranslationBase.of(context).prescription!,
ORDER_PRESCRIPTION_NEW, 'patient/order_prescription.png',
isInPatient: isInpatient),
PatientProfileCardModel(
TranslationBase.of(context).health,
TranslationBase.of(context).summary,
HEALTH_SUMMARY,
PatientProfileCardModel(TranslationBase.of(context).health!, TranslationBase.of(context).summary!, HEALTH_SUMMARY,
'patient/health_summary.png',
isInPatient: isInpatient),
PatientProfileCardModel(
TranslationBase.of(context).patient,
"ECG",
PATIENT_ECG,
'patient/patient_sick_leave.png',
TranslationBase.of(context).patient!, "ECG", PATIENT_ECG, 'patient/patient_sick_leave.png',
isInPatient: isInpatient),
PatientProfileCardModel(
TranslationBase.of(context).orders,
TranslationBase.of(context).procedures,
ORDER_PROCEDURE,
'patient/Order_Procedures.png',
PatientProfileCardModel(TranslationBase.of(context).orders!, TranslationBase.of(context).procedures!,
ORDER_PROCEDURE, 'patient/Order_Procedures.png',
isInPatient: isInpatient),
PatientProfileCardModel(
TranslationBase.of(context).insurance,
TranslationBase.of(context).service,
PATIENT_INSURANCE_APPROVALS_NEW,
'patient/vital_signs.png',
PatientProfileCardModel(TranslationBase.of(context).insurance!, TranslationBase.of(context).service!,
PATIENT_INSURANCE_APPROVALS_NEW, 'patient/vital_signs.png',
isInPatient: isInpatient),
PatientProfileCardModel(
TranslationBase.of(context).patientSick,
TranslationBase.of(context).leave,
ADD_SICKLEAVE,
'patient/patient_sick_leave.png',
PatientProfileCardModel(TranslationBase.of(context).patientSick!, TranslationBase.of(context).leave!,
ADD_SICKLEAVE, 'patient/patient_sick_leave.png',
isInPatient: isInpatient),
if (patient.appointmentNo != null && patient.appointmentNo != 0)
PatientProfileCardModel(
TranslationBase.of(context).patient,
TranslationBase.of(context).ucaf,
PATIENT_UCAF_REQUEST,
'patient/ucaf.png',
isInPatient: isInpatient,
isDisable: patient.patientStatusType != 43 ? true : false),
PatientProfileCardModel(TranslationBase.of(context).patient!, TranslationBase.of(context).ucaf!,
PATIENT_UCAF_REQUEST, 'patient/ucaf.png',
isInPatient: isInpatient, isDisable: patient.patientStatusType != 43 ? true : false),
if (patient.appointmentNo != null && patient.appointmentNo != 0)
PatientProfileCardModel(
TranslationBase.of(context).referral,
TranslationBase.of(context).patient,
REFER_PATIENT_TO_DOCTOR,
'patient/refer_patient.png',
isInPatient: isInpatient,
isDisable: patient.patientStatusType != 43 ? true : false),
PatientProfileCardModel(TranslationBase.of(context).referral!, TranslationBase.of(context).patient!,
REFER_PATIENT_TO_DOCTOR, 'patient/refer_patient.png',
isInPatient: isInpatient, isDisable: patient.patientStatusType != 43 ? true : false),
if (patient.appointmentNo != null && patient.appointmentNo != 0)
PatientProfileCardModel(
TranslationBase.of(context).admission,
TranslationBase.of(context).request,
PATIENT_ADMISSION_REQUEST,
'patient/admission_req.png',
isInPatient: isInpatient,
isDisable: patient.patientStatusType != 43 ? true : false),
PatientProfileCardModel(TranslationBase.of(context).admission!, TranslationBase.of(context).request!,
PATIENT_ADMISSION_REQUEST, 'patient/admission_req.png',
isInPatient: isInpatient, isDisable: patient.patientStatusType != 43 ? true : false),
];
return Column(

@ -14,15 +14,11 @@ import 'package:url_launcher/url_launcher.dart';
class RadiologyDetailsPage extends StatelessWidget {
final FinalRadiology finalRadiology;
final PatiantInformtion patient;
final String patientType;
final String arrivalType;
final String? patientType;
final String? arrivalType;
RadiologyDetailsPage(
{Key key,
this.finalRadiology,
this.patient,
this.patientType,
this.arrivalType});
{Key? key, required this.finalRadiology, required this.patient, this.patientType, this.arrivalType});
@override
Widget build(BuildContext context) {
@ -66,9 +62,11 @@ class RadiologyDetailsPage extends StatelessWidget {
),
Padding(
padding: const EdgeInsets.all(8.0),
child: AppText(TranslationBase.of(context).generalResult,color: Color(0xff2E303A),),
child: AppText(
TranslationBase.of(context).generalResult,
color: Color(0xff2E303A),
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: AppText(
@ -92,8 +90,7 @@ class RadiologyDetailsPage extends StatelessWidget {
height: 80,
width: double.maxFinite,
child: Container(
margin:
EdgeInsets.only(left: 35, right: 35, top: 12, bottom: 12),
margin: EdgeInsets.only(left: 35, right: 35, top: 12, bottom: 12),
child: SecondaryButton(
color: Color(0xffD02127),
disabled: finalRadiology.dIAPACSURL == "",
@ -101,7 +98,7 @@ class RadiologyDetailsPage extends StatelessWidget {
onTap: () {
launch(model.radImageURL);
},
label: TranslationBase.of(context).openRad,
label: TranslationBase.of(context).openRad ?? "",
),
),
)

@ -22,16 +22,16 @@ class RadiologyHomePage extends StatefulWidget {
}
class _RadiologyHomePageState extends State<RadiologyHomePage> {
String patientType;
PatiantInformtion patient;
String arrivalType;
bool isInpatient;
bool isFromLiveCare;
String? patientType;
late PatiantInformtion patient;
late String arrivalType;
late bool isInpatient;
late bool isFromLiveCare;
@override
void didChangeDependencies() {
super.didChangeDependencies();
final routeArgs = ModalRoute.of(context).settings.arguments as Map;
final routeArgs = ModalRoute.of(context)!.settings.arguments as Map;
patient = routeArgs['patient'];
patientType = routeArgs['patientType'];
arrivalType = routeArgs['arrivalType'];
@ -44,8 +44,7 @@ class _RadiologyHomePageState extends State<RadiologyHomePage> {
Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context);
return BaseView<ProcedureViewModel>(
onModelReady: (model) => model.getPatientRadOrders(patient,
patientType: patientType, isInPatient: false),
onModelReady: (model) => model.getPatientRadOrders(patient, patientType: patientType, isInPatient: false),
builder: (_, model, widget) => AppScaffold(
isShowAppBar: true,
backgroundColor: Colors.grey[100],
@ -65,8 +64,7 @@ class _RadiologyHomePageState extends State<RadiologyHomePage> {
SizedBox(
height: 12,
),
if (model.radiologyList.isNotEmpty &&
patient.patientStatusType != 43)
if (model.radiologyList.isNotEmpty && patient.patientStatusType != 43)
Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
@ -86,8 +84,7 @@ class _RadiologyHomePageState extends State<RadiologyHomePage> {
],
),
),
if (patient.patientStatusType != null &&
patient.patientStatusType == 43)
if (patient.patientStatusType != null && patient.patientStatusType == 43)
Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
@ -100,31 +97,27 @@ class _RadiologyHomePageState extends State<RadiologyHomePage> {
fontSize: 13,
),
AppText(
TranslationBase
.of(context)
.result,
TranslationBase.of(context).result,
bold: true,
fontSize: 22,
),
],
),
),
if ((patient.patientStatusType != null &&
patient.patientStatusType == 43) ||
if ((patient.patientStatusType != null && patient.patientStatusType == 43) ||
(isFromLiveCare && patient.appointmentNo != null))
AddNewOrder(
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
AddRadiologyScreen(
builder: (context) => AddRadiologyScreen(
patient: patient,
model: model,
)),
);
},
label: TranslationBase.of(context).applyForRadiologyOrder,
label: TranslationBase.of(context).applyForRadiologyOrder ?? "",
),
...List.generate(
model.radiologyList.length,
@ -146,36 +139,26 @@ class _RadiologyHomePageState extends State<RadiologyHomePage> {
height: 160,
decoration: BoxDecoration(
//Colors.red[900] Color(0xff404545)
color: model.radiologyList[index]
.isLiveCareAppodynamicment
color: model.radiologyList[index].isLiveCareAppodynamicment!
? Colors.red[900]
: !model.radiologyList[index].isInOutPatient
: !model.radiologyList[index].isInOutPatient!
? Colors.black
: Color(0xffa9a089),
borderRadius: BorderRadius.only(
topLeft: projectViewModel.isArabic? Radius.circular(0):Radius.circular(8),
bottomLeft: projectViewModel.isArabic? Radius.circular(0):Radius.circular(8),
topRight: projectViewModel.isArabic? Radius.circular(8):Radius.circular(0),
bottomRight: projectViewModel.isArabic? Radius.circular(8):Radius.circular(0)
),
topLeft: projectViewModel.isArabic ? Radius.circular(0) : Radius.circular(8),
bottomLeft: projectViewModel.isArabic ? Radius.circular(0) : Radius.circular(8),
topRight: projectViewModel.isArabic ? Radius.circular(8) : Radius.circular(0),
bottomRight: projectViewModel.isArabic ? Radius.circular(8) : Radius.circular(0)),
),
child: RotatedBox(
quarterTurns: 3,
child: Center(
child: Text(
model.radiologyList[index]
.isLiveCareAppodynamicment
? TranslationBase.of(context)
.liveCare
.toUpperCase()
: !model.radiologyList[index]
.isInOutPatient
? TranslationBase.of(context)
.inPatientLabel
.toUpperCase()
: TranslationBase.of(context)
.outpatient
.toUpperCase(),
model.radiologyList[index].isLiveCareAppodynamicment!
? TranslationBase.of(context).liveCare!.toUpperCase()
: !model.radiologyList[index].isInOutPatient!
? TranslationBase.of(context).inPatientLabel!.toUpperCase()
: TranslationBase.of(context).outpatient!.toUpperCase(),
style: TextStyle(color: Colors.white),
),
)),
@ -183,26 +166,19 @@ class _RadiologyHomePageState extends State<RadiologyHomePage> {
Expanded(
child: DoctorCard(
isNoMargin: true,
doctorName:
model.radiologyList[index].doctorName,
profileUrl:
model.radiologyList[index].doctorImageURL,
invoiceNO:
'${model.radiologyList[index].invoiceNo}',
branch:
'${model.radiologyList[index].projectName}',
clinic: model
.radiologyList[index].clinicDescription,
doctorName: model.radiologyList[index].doctorName,
profileUrl: model.radiologyList[index].doctorImageURL,
invoiceNO: '${model.radiologyList[index].invoiceNo}',
branch: '${model.radiologyList[index].projectName}',
clinic: model.radiologyList[index].clinicDescription,
appointmentDate:
model.radiologyList[index].orderDate ??
model.radiologyList[index].reportDate,
model.radiologyList[index].orderDate ?? model.radiologyList[index].reportDate!,
onTap: () {
Navigator.push(
context,
FadePage(
page: RadiologyDetailsPage(
finalRadiology:
model.radiologyList[index],
finalRadiology: model.radiologyList[index],
patient: patient,
),
),
@ -213,8 +189,7 @@ class _RadiologyHomePageState extends State<RadiologyHomePage> {
],
),
)),
if (model.radiologyList.isEmpty &&
patient.patientStatusType != 43)
if (model.radiologyList.isEmpty && patient.patientStatusType != 43)
Center(
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,

@ -11,12 +11,12 @@ class RadiologyReportScreen extends StatelessWidget {
final String reportData;
final String url;
RadiologyReportScreen({Key key, this.reportData, this.url});
RadiologyReportScreen({Key? key, required this.reportData, required this.url});
@override
Widget build(BuildContext context) {
return AppScaffold(
appBarTitle: TranslationBase.of(context).radiologyReport,
appBarTitle: TranslationBase.of(context).radiologyReport ?? "",
body: SingleChildScrollView(
child: Column(
children: [
@ -38,7 +38,9 @@ class RadiologyReportScreen extends StatelessWidget {
fontSize: 2.5 * SizeConfig.textMultiplier,
),
),
SizedBox(height:MediaQuery.of(context).size.height * 0.13 ,)
SizedBox(
height: MediaQuery.of(context).size.height * 0.13,
)
],
),
),

@ -24,16 +24,14 @@ class AddReplayOnReferralPatient extends StatefulWidget {
final MyReferralPatientModel myReferralInPatientModel;
const AddReplayOnReferralPatient(
{Key key, this.patientReferralViewModel, this.myReferralInPatientModel})
{Key? key, required this.patientReferralViewModel, required this.myReferralInPatientModel})
: super(key: key);
@override
_AddReplayOnReferralPatientState createState() =>
_AddReplayOnReferralPatientState();
_AddReplayOnReferralPatientState createState() => _AddReplayOnReferralPatientState();
}
class _AddReplayOnReferralPatientState
extends State<AddReplayOnReferralPatient> {
class _AddReplayOnReferralPatientState extends State<AddReplayOnReferralPatient> {
bool isSubmitted = false;
stt.SpeechToText speech = stt.SpeechToText();
var reconizedWord;
@ -75,11 +73,9 @@ class _AddReplayOnReferralPatientState
maxLines: 35,
minLines: 25,
hasBorder: true,
validationError:
replayOnReferralController.text.isEmpty &&
isSubmitted
? TranslationBase.of(context).emptyMessage
: null,
validationError: replayOnReferralController.text.isEmpty && isSubmitted
? TranslationBase.of(context).emptyMessage
: null,
),
Positioned(
top: 0, //MediaQuery.of(context).size.height * 0,
@ -137,17 +133,13 @@ class _AddReplayOnReferralPatientState
});
if (replayOnReferralController.text.isNotEmpty) {
GifLoaderDialogUtils.showMyDialog(context);
await widget.patientReferralViewModel.replay(
replayOnReferralController.text.trim(),
widget.myReferralInPatientModel);
if (widget.patientReferralViewModel.state ==
ViewState.ErrorLocal) {
Helpers.showErrorToast(
widget.patientReferralViewModel.error);
await widget.patientReferralViewModel
.replay(replayOnReferralController.text.trim(), widget.myReferralInPatientModel);
if (widget.patientReferralViewModel.state == ViewState.ErrorLocal) {
Helpers.showErrorToast(widget.patientReferralViewModel.error);
} else {
GifLoaderDialogUtils.hideDialog(context);
DrAppToastMsg.showSuccesToast(
"Your Replay Added Successfully");
DrAppToastMsg.showSuccesToast("Your Replay Added Successfully");
Navigator.of(context).pop();
Navigator.of(context).pop();
}
@ -167,8 +159,7 @@ class _AddReplayOnReferralPatientState
onVoiceText() async {
new SpeechToText(context: context).showAlertDialog(context);
var lang = TranslationBase.of(AppGlobal.CONTEX).locale.languageCode;
bool available = await speech.initialize(
onStatus: statusListener, onError: errorListener);
bool available = await speech.initialize(onStatus: statusListener, onError: errorListener);
if (available) {
speech.listen(
onResult: resultListener,

@ -17,33 +17,29 @@ import 'package:hexcolor/hexcolor.dart';
// ignore: must_be_immutable
class MyReferralDetailScreen extends StatelessWidget {
PendingReferral pendingReferral;
late PendingReferral pendingReferral;
@override
Widget build(BuildContext context) {
final routeArgs = ModalRoute.of(context).settings.arguments as Map;
final routeArgs = ModalRoute.of(context)!.settings.arguments as Map;
pendingReferral = routeArgs['referral'];
return BaseView<PatientReferralViewModel>(
onModelReady: (model) => model.getPatientDetails(
AppDateUtils.convertStringToDateFormat(
DateTime.now() /*.subtract(Duration(days: 350))*/ .toString(),
"yyyy-MM-dd"),
AppDateUtils.convertStringToDateFormat(
DateTime.now().toString(), "yyyy-MM-dd"),
pendingReferral.patientID,
pendingReferral.sourceAppointmentNo),
DateTime.now() /*.subtract(Duration(days: 350))*/ .toString(), "yyyy-MM-dd"),
AppDateUtils.convertStringToDateFormat(DateTime.now().toString(), "yyyy-MM-dd"),
pendingReferral.patientID!,
pendingReferral.sourceAppointmentNo!),
builder: (_, model, w) => AppScaffold(
baseViewModel: model,
appBarTitle: TranslationBase.of(context).referPatient,
appBarTitle: TranslationBase.of(context).referPatient!,
isShowAppBar: false,
body: model.patientArrivalList != null &&
model.patientArrivalList.length > 0
body: model.patientArrivalList != null && model.patientArrivalList.length > 0
? Column(
children: [
Container(
padding:
EdgeInsets.only(left: 0, right: 5, bottom: 5, top: 5),
padding: EdgeInsets.only(left: 0, right: 5, bottom: 5, top: 5),
decoration: BoxDecoration(
color: Colors.white,
),
@ -62,18 +58,13 @@ class MyReferralDetailScreen extends StatelessWidget {
),
Expanded(
child: AppText(
(Helpers.capitalize(model
.patientArrivalList[0]
.patientDetails
.fullName)),
(Helpers.capitalize(model.patientArrivalList[0].patientDetails!.fullName)),
fontSize: SizeConfig.textMultiplier * 2.5,
fontWeight: FontWeight.bold,
fontFamily: 'Poppins',
),
),
model.patientArrivalList[0].patientDetails
.gender ==
1
model.patientArrivalList[0].patientDetails!.gender == 1
? Icon(
DoctorApp.male_2,
color: Colors.blue,
@ -93,7 +84,7 @@ class MyReferralDetailScreen extends StatelessWidget {
width: 60,
height: 60,
child: Image.asset(
pendingReferral.patientDetails.gender == 1
pendingReferral.patientDetails?.gender == 1
? 'assets/images/male_avatar.png'
: 'assets/images/female_avatar.png',
fit: BoxFit.cover,
@ -107,148 +98,106 @@ class MyReferralDetailScreen extends StatelessWidget {
child: Column(
children: [
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
AppText(
pendingReferral.referralStatus != null
? pendingReferral.referralStatus
: "",
pendingReferral.referralStatus != null ? pendingReferral.referralStatus : "",
fontFamily: 'Poppins',
fontSize:
1.9 * SizeConfig.textMultiplier,
fontSize: 1.9 * SizeConfig.textMultiplier,
fontWeight: FontWeight.w700,
color: pendingReferral
.referralStatus !=
null
? pendingReferral
.referralStatus ==
'Pending'
color: pendingReferral.referralStatus != null
? pendingReferral.referralStatus == 'Pending'
? Color(0xffc4aa54)
: pendingReferral
.referralStatus ==
'Accepted'
: pendingReferral.referralStatus == 'Accepted'
? Colors.green[700]
: Colors.red[700]
: Colors.grey[500],
),
AppText(
pendingReferral.referredOn
.split(" ")[0],
pendingReferral.referredOn!.split(" ")[0],
fontFamily: 'Poppins',
fontWeight: FontWeight.w600,
fontSize:
2.0 * SizeConfig.textMultiplier,
fontSize: 2.0 * SizeConfig.textMultiplier,
color: Color(0XFF28353E),
)
],
),
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
mainAxisAlignment:
MainAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [
AppText(
TranslationBase.of(context)
.fileNumber,
TranslationBase.of(context).fileNumber,
fontFamily: 'Poppins',
fontWeight: FontWeight.w600,
fontSize: 1.7 *
SizeConfig.textMultiplier,
fontSize: 1.7 * SizeConfig.textMultiplier,
color: Color(0XFF575757),
),
AppText(
"${pendingReferral.patientID}",
fontFamily: 'Poppins',
fontWeight: FontWeight.w700,
fontSize: 1.8 *
SizeConfig.textMultiplier,
fontSize: 1.8 * SizeConfig.textMultiplier,
color: Color(0XFF2E303A),
),
],
),
AppText(
pendingReferral.referredOn
.split(" ")[1],
pendingReferral.referredOn!.split(" ")[1],
fontFamily: 'Poppins',
fontWeight: FontWeight.w600,
fontSize:
1.8 * SizeConfig.textMultiplier,
fontSize: 1.8 * SizeConfig.textMultiplier,
color: Color(0XFF575757),
)
],
),
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
crossAxisAlignment:
CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Expanded(
child: Column(
children: [
Row(
mainAxisAlignment:
MainAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [
AppText(
TranslationBase.of(context)
.referredFrom,
TranslationBase.of(context).referredFrom,
fontFamily: 'Poppins',
fontWeight: FontWeight.w600,
fontSize: 1.7 *
SizeConfig
.textMultiplier,
fontSize: 1.7 * SizeConfig.textMultiplier,
color: Color(0XFF575757),
),
AppText(
pendingReferral
.isReferralDoctorSameBranch
? TranslationBase.of(
context)
.sameBranch
: TranslationBase.of(
context)
.otherBranch,
pendingReferral.isReferralDoctorSameBranch!
? TranslationBase.of(context).sameBranch
: TranslationBase.of(context).otherBranch,
fontFamily: 'Poppins',
fontWeight: FontWeight.w700,
fontSize: 1.8 *
SizeConfig
.textMultiplier,
fontSize: 1.8 * SizeConfig.textMultiplier,
color: Color(0XFF2E303A),
),
],
),
Row(
mainAxisAlignment:
MainAxisAlignment.start,
crossAxisAlignment:
CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
AppText(
TranslationBase.of(context)
.remarks +
" : ",
TranslationBase.of(context).remarks ?? "" + " : ",
fontFamily: 'Poppins',
fontWeight: FontWeight.w600,
fontSize: 1.7 *
SizeConfig
.textMultiplier,
fontSize: 1.7 * SizeConfig.textMultiplier,
color: Color(0XFF575757),
),
Expanded(
child: AppText(
pendingReferral
.remarksFromSource,
pendingReferral.remarksFromSource,
fontFamily: 'Poppins',
fontWeight:
FontWeight.w700,
fontSize: 1.8 *
SizeConfig
.textMultiplier,
fontWeight: FontWeight.w700,
fontSize: 1.8 * SizeConfig.textMultiplier,
color: Color(0XFF2E303A),
),
),
@ -260,35 +209,22 @@ class MyReferralDetailScreen extends StatelessWidget {
Row(
children: [
AppText(
pendingReferral.patientDetails
.nationalityName !=
null
? pendingReferral
.patientDetails
.nationalityName
pendingReferral.patientDetails!.nationalityName != null
? pendingReferral.patientDetails!.nationalityName
: "",
fontWeight: FontWeight.bold,
color: Color(0xFF2E303A),
fontSize: 1.4 *
SizeConfig.textMultiplier,
fontSize: 1.4 * SizeConfig.textMultiplier,
),
pendingReferral
.nationalityFlagUrl !=
null
pendingReferral.nationalityFlagUrl != null
? ClipRRect(
borderRadius:
BorderRadius.circular(
20.0),
borderRadius: BorderRadius.circular(20.0),
child: Image.network(
pendingReferral
.nationalityFlagUrl,
pendingReferral.nationalityFlagUrl ?? "",
height: 25,
width: 30,
errorBuilder:
(BuildContext context,
Object exception,
StackTrace
stackTrace) {
errorBuilder: (BuildContext context, Object exception,
StackTrace? stackTrace) {
return Text('No Image');
},
))
@ -298,12 +234,10 @@ class MyReferralDetailScreen extends StatelessWidget {
],
),
Row(
crossAxisAlignment:
CrossAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
margin: EdgeInsets.only(
left: 10, right: 0),
margin: EdgeInsets.only(left: 10, right: 0),
child: Image.asset(
'assets/images/patient/ic_ref_arrow_up.png',
height: 50,
@ -311,43 +245,29 @@ class MyReferralDetailScreen extends StatelessWidget {
),
),
Container(
margin: EdgeInsets.only(
left: 0,
top: 25,
right: 0,
bottom: 0),
padding: EdgeInsets.only(
left: 4.0, right: 4.0),
margin: EdgeInsets.only(left: 0, top: 25, right: 0, bottom: 0),
padding: EdgeInsets.only(left: 4.0, right: 4.0),
child: Container(
width: 40,
height: 40,
child: CircleAvatar(
radius: 25.0,
backgroundImage: NetworkImage(
pendingReferral
.doctorImageUrl),
backgroundColor:
Colors.transparent,
backgroundImage: NetworkImage(pendingReferral.doctorImageUrl ?? ""),
backgroundColor: Colors.transparent,
),
),
),
Expanded(
flex: 4,
child: Container(
margin: EdgeInsets.only(
left: 10,
top: 25,
right: 10,
bottom: 0),
margin: EdgeInsets.only(left: 10, top: 25, right: 10, bottom: 0),
child: Column(
children: [
AppText(
pendingReferral
.referredByDoctorInfo,
pendingReferral.referredByDoctorInfo,
fontFamily: 'Poppins',
fontWeight: FontWeight.w700,
fontSize: 1.7 *
SizeConfig.textMultiplier,
fontSize: 1.7 * SizeConfig.textMultiplier,
color: Color(0XFF2E303A),
),
],
@ -375,14 +295,13 @@ class MyReferralDetailScreen extends StatelessWidget {
height: 16,
),
Padding(
padding:
const EdgeInsets.symmetric(horizontal: 16),
padding: const EdgeInsets.symmetric(horizontal: 16),
child: SizedBox(
child: ProfileMedicalInfoWidgetSearch(
patient: model.patientArrivalList[0],
patientType: "7",
from: null,
to: null,
from: "",
to: "",
),
),
),
@ -404,14 +323,11 @@ class MyReferralDetailScreen extends StatelessWidget {
hPadding: 8,
vPadding: 12,
onPressed: () async {
await model.responseReferral(
pendingReferral, true);
await model.responseReferral(pendingReferral, true);
if (model.state == ViewState.ErrorLocal) {
DrAppToastMsg.showErrorToast(model.error);
} else {
DrAppToastMsg.showSuccesToast(
TranslationBase.of(context)
.referralSuccessMsgAccept);
DrAppToastMsg.showSuccesToast(TranslationBase.of(context).referralSuccessMsgAccept);
Navigator.pop(context);
Navigator.pop(context);
}
@ -430,14 +346,11 @@ class MyReferralDetailScreen extends StatelessWidget {
hPadding: 8,
vPadding: 12,
onPressed: () async {
await model.responseReferral(
pendingReferral, true);
await model.responseReferral(pendingReferral, true);
if (model.state == ViewState.ErrorLocal) {
DrAppToastMsg.showErrorToast(model.error);
} else {
DrAppToastMsg.showSuccesToast(
TranslationBase.of(context)
.referralSuccessMsgReject);
DrAppToastMsg.showSuccesToast(TranslationBase.of(context).referralSuccessMsgReject);
Navigator.pop(context);
Navigator.pop(context);
}
@ -464,7 +377,6 @@ class MyReferralDetailScreen extends StatelessWidget {
"",
fontSize: SizeConfig.textMultiplier * 2.5,
fontWeight: FontWeight.bold,
fontFamily: 'Poppins',
),
),

@ -11,7 +11,6 @@ import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
class MyReferralInPatientScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
return BaseView<PatientReferralViewModel>(
@ -19,7 +18,7 @@ class MyReferralInPatientScreen extends StatelessWidget {
builder: (_, model, w) => AppScaffold(
baseViewModel: model,
isShowAppBar: false,
appBarTitle: TranslationBase.of(context).referPatient,
appBarTitle: TranslationBase.of(context).referPatient ?? "",
body: model.myReferralPatients.isEmpty
? Center(
child: Column(
@ -55,30 +54,31 @@ class MyReferralInPatientScreen extends StatelessWidget {
Navigator.push(
context,
FadePage(
page: ReferralPatientDetailScreen(model.myReferralPatients[index],model),
page: ReferralPatientDetailScreen(model.myReferralPatients[index], model),
),
);
},
child: PatientReferralItemWidget(
referralStatus: model.getReferralStatusNameByCode(model.myReferralPatients[index].referralStatus,context),
referralStatus: model.getReferralStatusNameByCode(
model.myReferralPatients[index].referralStatus!, context),
referralStatusCode: model.myReferralPatients[index].referralStatus,
patientName: model.myReferralPatients[index].patientName,
patientGender: model.myReferralPatients[index].gender,
referredDate: AppDateUtils.getDayMonthYearDateFormatted(model.myReferralPatients[index].referralDate),
referredTime: AppDateUtils.getTimeHHMMA(model.myReferralPatients[index].referralDate),
referredDate: AppDateUtils.getDayMonthYearDateFormatted(
model.myReferralPatients[index].referralDate!),
referredTime: AppDateUtils.getTimeHHMMA(model.myReferralPatients[index].referralDate!),
patientID: "${model.myReferralPatients[index].patientID}",
isSameBranch: false,
isReferral: true,
isReferralClinic: true,
referralClinic:"${model.myReferralPatients[index].referringClinicDescription}",
referralClinic: "${model.myReferralPatients[index].referringClinicDescription}",
remark: model.myReferralPatients[index].referringDoctorRemarks,
nationality: model.myReferralPatients[index].nationalityName,
nationalityFlag: model.myReferralPatients[index].nationalityFlagURL,
doctorAvatar: model.myReferralPatients[index].doctorImageURL,
referralDoctorName: model.myReferralPatients[index].referringDoctorName,
clinicDescription: model.myReferralPatients[index].referringClinicDescription,
infoIcon: Icon(FontAwesomeIcons.arrowRight,
size: 25, color: Colors.black),
infoIcon: Icon(FontAwesomeIcons.arrowRight, size: 25, color: Colors.black),
),
),
),

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save