inpatient services contd.
parent
b1f2858c0c
commit
a8ba6c9f3c
@ -0,0 +1,95 @@
|
|||||||
|
import 'package:dartz/dartz.dart';
|
||||||
|
import 'package:hmg_patient_app_new/core/api/api_client.dart';
|
||||||
|
import 'package:hmg_patient_app_new/core/api_consts.dart';
|
||||||
|
import 'package:hmg_patient_app_new/core/common_models/generic_api_model.dart';
|
||||||
|
import 'package:hmg_patient_app_new/core/exceptions/api_failure.dart';
|
||||||
|
import 'package:hmg_patient_app_new/features/inpatient_services/models/get_general_instructions_response_model.dart';
|
||||||
|
import 'package:hmg_patient_app_new/services/logger_service.dart';
|
||||||
|
|
||||||
|
abstract class InpatientServicesRepo {
|
||||||
|
Future<Either<Failure, GenericApiModel<dynamic>>> checkIfIsInPatient();
|
||||||
|
|
||||||
|
Future<Either<Failure, GenericApiModel<List<GetGeneralInstructions>>>> getGeneralInstructions({required int projectID});
|
||||||
|
}
|
||||||
|
|
||||||
|
// List<GetGeneralInstructions> getGeneralInstructionsList = [];
|
||||||
|
|
||||||
|
class InpatientServicesRepoImp implements InpatientServicesRepo {
|
||||||
|
final ApiClient apiClient;
|
||||||
|
final LoggerService loggerService;
|
||||||
|
|
||||||
|
InpatientServicesRepoImp({required this.loggerService, required this.apiClient});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<Either<Failure, GenericApiModel>> checkIfIsInPatient() async {
|
||||||
|
Map<String, dynamic> mapDevice = {"IsActiveAppointment": false};
|
||||||
|
|
||||||
|
try {
|
||||||
|
GenericApiModel<dynamic>? apiResponse;
|
||||||
|
Failure? failure;
|
||||||
|
await apiClient.post(
|
||||||
|
CHECK_IF_PATIENT_ADMITTED,
|
||||||
|
body: mapDevice,
|
||||||
|
onFailure: (error, statusCode, {messageStatus, failureType}) {
|
||||||
|
failure = failureType;
|
||||||
|
},
|
||||||
|
onSuccess: (response, statusCode, {messageStatus, errorMessage}) {
|
||||||
|
try {
|
||||||
|
apiResponse = GenericApiModel<dynamic>(
|
||||||
|
messageStatus: messageStatus,
|
||||||
|
statusCode: statusCode,
|
||||||
|
errorMessage: null,
|
||||||
|
data: response,
|
||||||
|
);
|
||||||
|
} catch (e) {
|
||||||
|
failure = DataParsingFailure(e.toString());
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
if (failure != null) return Left(failure!);
|
||||||
|
if (apiResponse == null) return Left(ServerFailure("Unknown error"));
|
||||||
|
return Right(apiResponse!);
|
||||||
|
} catch (e) {
|
||||||
|
return Left(UnknownFailure(e.toString()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<Either<Failure, GenericApiModel<List<GetGeneralInstructions>>>> getGeneralInstructions({required int projectID}) async {
|
||||||
|
Map<String, dynamic> mapDevice = {"ProjectID": projectID};
|
||||||
|
|
||||||
|
try {
|
||||||
|
GenericApiModel<List<GetGeneralInstructions>>? apiResponse;
|
||||||
|
Failure? failure;
|
||||||
|
await apiClient.post(
|
||||||
|
GET_GENERAL_INSTRUCTIONS,
|
||||||
|
body: mapDevice,
|
||||||
|
onFailure: (error, statusCode, {messageStatus, failureType}) {
|
||||||
|
failure = failureType;
|
||||||
|
},
|
||||||
|
onSuccess: (response, statusCode, {messageStatus, errorMessage}) {
|
||||||
|
try {
|
||||||
|
List<GetGeneralInstructions> getGeneralInstructionsList = [];
|
||||||
|
response['generalInstructions'].forEach((v) {
|
||||||
|
getGeneralInstructionsList.add(GetGeneralInstructions.fromJson(v));
|
||||||
|
});
|
||||||
|
|
||||||
|
apiResponse = GenericApiModel<List<GetGeneralInstructions>>(
|
||||||
|
messageStatus: messageStatus,
|
||||||
|
statusCode: statusCode,
|
||||||
|
errorMessage: null,
|
||||||
|
data: getGeneralInstructionsList,
|
||||||
|
);
|
||||||
|
} catch (e) {
|
||||||
|
failure = DataParsingFailure(e.toString());
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
if (failure != null) return Left(failure!);
|
||||||
|
if (apiResponse == null) return Left(ServerFailure("Unknown error"));
|
||||||
|
return Right(apiResponse!);
|
||||||
|
} catch (e) {
|
||||||
|
return Left(UnknownFailure(e.toString()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,95 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:hmg_patient_app_new/core/app_state.dart';
|
||||||
|
import 'package:hmg_patient_app_new/features/inpatient_services/inpatient_services_repo.dart';
|
||||||
|
import 'package:hmg_patient_app_new/features/inpatient_services/models/get_admission_info_response_model.dart';
|
||||||
|
import 'package:hmg_patient_app_new/features/inpatient_services/models/get_admission_request_info_response_model.dart';
|
||||||
|
import 'package:hmg_patient_app_new/features/inpatient_services/models/get_general_instructions_response_model.dart';
|
||||||
|
import 'package:hmg_patient_app_new/services/error_handler_service.dart';
|
||||||
|
|
||||||
|
class InpatientServicesViewModel extends ChangeNotifier {
|
||||||
|
InpatientServicesRepo inpatientServicesRepo;
|
||||||
|
ErrorHandlerService errorHandlerService;
|
||||||
|
AppState appState;
|
||||||
|
|
||||||
|
GetAdmissionInfoResponseModel? getAdmissionInfoResponseModel;
|
||||||
|
GetAdmissionRequestInfoResponseModel? getAdmissionRequestInfoResponseModel;
|
||||||
|
|
||||||
|
bool isAdmitted = false;
|
||||||
|
bool hasAdmissionRequest = false;
|
||||||
|
bool isGeneralInstructionsLoading = true;
|
||||||
|
|
||||||
|
List<GetGeneralInstructions> getGeneralInstructionsList = [];
|
||||||
|
|
||||||
|
InpatientServicesViewModel({required this.inpatientServicesRepo, required this.errorHandlerService, required this.appState});
|
||||||
|
|
||||||
|
initInPatientServices() {
|
||||||
|
isAdmitted = false;
|
||||||
|
hasAdmissionRequest = false;
|
||||||
|
isGeneralInstructionsLoading = true;
|
||||||
|
notifyListeners();
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> checkIfIsInPatient({Function(dynamic)? onSuccess, Function(String)? onError}) async {
|
||||||
|
final result = await inpatientServicesRepo.checkIfIsInPatient();
|
||||||
|
|
||||||
|
result.fold(
|
||||||
|
(failure) async {
|
||||||
|
notifyListeners();
|
||||||
|
},
|
||||||
|
(apiResponse) {
|
||||||
|
if (apiResponse.messageStatus == 2) {
|
||||||
|
// dialogService.showErrorDialog(message: apiResponse.errorMessage!, onOkPressed: () {});
|
||||||
|
} else if (apiResponse.messageStatus == 1) {
|
||||||
|
isAdmitted = apiResponse.data['isAdmitted'];
|
||||||
|
hasAdmissionRequest = apiResponse.data['hasAdmissionRequests'];
|
||||||
|
if (isAdmitted) {
|
||||||
|
if (apiResponse.data['PatientAdmittedInformation'].length != 0) {
|
||||||
|
getAdmissionInfoResponseModel = GetAdmissionInfoResponseModel.fromJson(apiResponse.data['PatientAdmittedInformation'][0]);
|
||||||
|
appState.setIsPatientAdmitted(true);
|
||||||
|
appState.setHasAdmissionRequest(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (hasAdmissionRequest) {
|
||||||
|
if (apiResponse.data['MedicalInstruction'].length != 0) {
|
||||||
|
getAdmissionRequestInfoResponseModel = GetAdmissionRequestInfoResponseModel.fromJson(apiResponse.data['MedicalInstruction'][0]);
|
||||||
|
appState.setIsPatientAdmitted(false);
|
||||||
|
appState.setHasAdmissionRequest(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
notifyListeners();
|
||||||
|
if (onSuccess != null) {
|
||||||
|
onSuccess(apiResponse);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> getGeneralInstructions({required int projectID, Function(dynamic)? onSuccess, Function(String)? onError}) async {
|
||||||
|
isGeneralInstructionsLoading = true;
|
||||||
|
getGeneralInstructionsList.clear();
|
||||||
|
notifyListeners();
|
||||||
|
|
||||||
|
|
||||||
|
final result = await inpatientServicesRepo.getGeneralInstructions(projectID: projectID);
|
||||||
|
|
||||||
|
result.fold(
|
||||||
|
(failure) async {
|
||||||
|
isGeneralInstructionsLoading = false;
|
||||||
|
notifyListeners();
|
||||||
|
},
|
||||||
|
(apiResponse) {
|
||||||
|
if (apiResponse.messageStatus == 2) {
|
||||||
|
// dialogService.showErrorDialog(message: apiResponse.errorMessage!, onOkPressed: () {});
|
||||||
|
} else if (apiResponse.messageStatus == 1) {
|
||||||
|
isGeneralInstructionsLoading = false;
|
||||||
|
getGeneralInstructionsList = apiResponse.data!;
|
||||||
|
notifyListeners();
|
||||||
|
if (onSuccess != null) {
|
||||||
|
onSuccess(apiResponse);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,104 @@
|
|||||||
|
class GetAdmissionInfoResponseModel {
|
||||||
|
String? setupID;
|
||||||
|
int? projectID;
|
||||||
|
int? admissionNo;
|
||||||
|
String? admissionDate;
|
||||||
|
int? admissionRequestNo;
|
||||||
|
int? admissionType;
|
||||||
|
int? patientType;
|
||||||
|
int? patientID;
|
||||||
|
int? clinicID;
|
||||||
|
int? doctorID;
|
||||||
|
int? admittingClinicID;
|
||||||
|
int? admittingDoctorID;
|
||||||
|
int? categoryID;
|
||||||
|
String? roomID;
|
||||||
|
String? bedID;
|
||||||
|
dynamic dischargeDate;
|
||||||
|
int? approvalNo;
|
||||||
|
int? status;
|
||||||
|
String? statusDesc;
|
||||||
|
String? statusDescN;
|
||||||
|
String? clinicName;
|
||||||
|
String? doctorName;
|
||||||
|
String? projectName;
|
||||||
|
|
||||||
|
GetAdmissionInfoResponseModel(
|
||||||
|
{this.setupID,
|
||||||
|
this.projectID,
|
||||||
|
this.admissionNo,
|
||||||
|
this.admissionDate,
|
||||||
|
this.admissionRequestNo,
|
||||||
|
this.admissionType,
|
||||||
|
this.patientType,
|
||||||
|
this.patientID,
|
||||||
|
this.clinicID,
|
||||||
|
this.doctorID,
|
||||||
|
this.admittingClinicID,
|
||||||
|
this.admittingDoctorID,
|
||||||
|
this.categoryID,
|
||||||
|
this.roomID,
|
||||||
|
this.bedID,
|
||||||
|
this.dischargeDate,
|
||||||
|
this.approvalNo,
|
||||||
|
this.status,
|
||||||
|
this.statusDesc,
|
||||||
|
this.statusDescN,
|
||||||
|
this.clinicName,
|
||||||
|
this.doctorName,
|
||||||
|
this.projectName});
|
||||||
|
|
||||||
|
GetAdmissionInfoResponseModel.fromJson(Map<String, dynamic> json) {
|
||||||
|
setupID = json['SetupID'];
|
||||||
|
projectID = json['ProjectID'];
|
||||||
|
admissionNo = json['AdmissionNo'];
|
||||||
|
admissionDate = json['AdmissionDate'];
|
||||||
|
admissionRequestNo = json['AdmissionRequestNo'];
|
||||||
|
admissionType = json['AdmissionType'];
|
||||||
|
patientType = json['PatientType'];
|
||||||
|
patientID = json['PatientID'];
|
||||||
|
clinicID = json['ClinicID'];
|
||||||
|
doctorID = json['DoctorID'];
|
||||||
|
admittingClinicID = json['AdmittingClinicID'];
|
||||||
|
admittingDoctorID = json['AdmittingDoctorID'];
|
||||||
|
categoryID = json['CategoryID'];
|
||||||
|
roomID = json['RoomID'];
|
||||||
|
bedID = json['BedID'];
|
||||||
|
dischargeDate = json['DischargeDate'];
|
||||||
|
approvalNo = json['ApprovalNo'];
|
||||||
|
status = json['Status'];
|
||||||
|
statusDesc = json['StatusDesc'];
|
||||||
|
statusDescN = json['StatusDescN'];
|
||||||
|
clinicName = json['ClinicName'];
|
||||||
|
doctorName = json['DoctorName'];
|
||||||
|
projectName = json['ProjectName'];
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||||
|
data['SetupID'] = this.setupID;
|
||||||
|
data['ProjectID'] = this.projectID;
|
||||||
|
data['AdmissionNo'] = this.admissionNo;
|
||||||
|
data['AdmissionDate'] = this.admissionDate;
|
||||||
|
data['AdmissionRequestNo'] = this.admissionRequestNo;
|
||||||
|
data['AdmissionType'] = this.admissionType;
|
||||||
|
data['PatientType'] = this.patientType;
|
||||||
|
data['PatientID'] = this.patientID;
|
||||||
|
data['ClinicID'] = this.clinicID;
|
||||||
|
data['DoctorID'] = this.doctorID;
|
||||||
|
data['AdmittingClinicID'] = this.admittingClinicID;
|
||||||
|
data['AdmittingDoctorID'] = this.admittingDoctorID;
|
||||||
|
data['CategoryID'] = this.categoryID;
|
||||||
|
data['RoomID'] = this.roomID;
|
||||||
|
data['BedID'] = this.bedID;
|
||||||
|
data['DischargeDate'] = this.dischargeDate;
|
||||||
|
data['ApprovalNo'] = this.approvalNo;
|
||||||
|
data['Status'] = this.status;
|
||||||
|
data['StatusDesc'] = this.statusDesc;
|
||||||
|
data['StatusDescN'] = this.statusDescN;
|
||||||
|
data['ClinicName'] = this.clinicName;
|
||||||
|
data['DoctorName'] = this.doctorName;
|
||||||
|
data['ProjectName'] = this.projectName;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,86 @@
|
|||||||
|
class GetAdmissionRequestInfoResponseModel {
|
||||||
|
int? admissionRequestNo;
|
||||||
|
String? clinicName;
|
||||||
|
String? doctorName;
|
||||||
|
String? expectedAdmissionDate;
|
||||||
|
List<MedicaLInstructions> ?medicalInstructions;
|
||||||
|
dynamic medicalInstructionsXML;
|
||||||
|
String? medicalRemarks;
|
||||||
|
int? projectId;
|
||||||
|
String? projectName;
|
||||||
|
String? setupId;
|
||||||
|
int? clinicId;
|
||||||
|
int? doctorId;
|
||||||
|
|
||||||
|
GetAdmissionRequestInfoResponseModel(
|
||||||
|
{this.admissionRequestNo,
|
||||||
|
this.clinicName,
|
||||||
|
this.doctorName,
|
||||||
|
this.expectedAdmissionDate,
|
||||||
|
this.medicalInstructions,
|
||||||
|
this.medicalInstructionsXML,
|
||||||
|
this.medicalRemarks,
|
||||||
|
this.projectId,
|
||||||
|
this.projectName,
|
||||||
|
this.setupId,
|
||||||
|
this.clinicId,
|
||||||
|
this.doctorId});
|
||||||
|
|
||||||
|
GetAdmissionRequestInfoResponseModel.fromJson(Map<String, dynamic> json) {
|
||||||
|
admissionRequestNo = json['admissionRequestNo'];
|
||||||
|
clinicName = json['clinicName'];
|
||||||
|
doctorName = json['doctorName'];
|
||||||
|
clinicId = json['ClinicID'];
|
||||||
|
doctorId = json['DoctorID'];
|
||||||
|
expectedAdmissionDate = json['expectedAdmissionDate'];
|
||||||
|
if (json['medicaLInstructions'] != null) {
|
||||||
|
medicalInstructions = <MedicaLInstructions>[];
|
||||||
|
json['medicaLInstructions'].forEach((v) {
|
||||||
|
medicalInstructions!.add(new MedicaLInstructions.fromJson(v));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
medicalInstructionsXML = json['medicalInstructionsXML'];
|
||||||
|
medicalRemarks = json['medicalRemarks'];
|
||||||
|
projectId = json['projectId'];
|
||||||
|
projectName = json['projectName'];
|
||||||
|
setupId = json['setupId'];
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||||
|
data['admissionRequestNo'] = this.admissionRequestNo;
|
||||||
|
data['clinicName'] = this.clinicName;
|
||||||
|
data['doctorName'] = this.doctorName;
|
||||||
|
data['clinicId'] = this.clinicId;
|
||||||
|
data['doctorId'] = this.doctorId;
|
||||||
|
data['expectedAdmissionDate'] = this.expectedAdmissionDate;
|
||||||
|
if (this.medicalInstructions != null) {
|
||||||
|
data['medicaLInstructions'] = this.medicalInstructions!.map((v) => v.toJson()).toList();
|
||||||
|
}
|
||||||
|
data['medicalInstructionsXML'] = this.medicalInstructionsXML;
|
||||||
|
data['medicalRemarks'] = this.medicalRemarks;
|
||||||
|
data['projectId'] = this.projectId;
|
||||||
|
data['projectName'] = this.projectName;
|
||||||
|
data['setupId'] = this.setupId;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class MedicaLInstructions {
|
||||||
|
String? description;
|
||||||
|
int? parameterCode;
|
||||||
|
|
||||||
|
MedicaLInstructions({this.description, this.parameterCode});
|
||||||
|
|
||||||
|
MedicaLInstructions.fromJson(Map<String, dynamic> json) {
|
||||||
|
description = json['description'];
|
||||||
|
parameterCode = json['parameterCode'];
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||||
|
data['description'] = this.description;
|
||||||
|
data['parameterCode'] = this.parameterCode;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,52 @@
|
|||||||
|
class GetGeneralInstructions {
|
||||||
|
int? rowID;
|
||||||
|
int? iD;
|
||||||
|
int? projectID;
|
||||||
|
String? text;
|
||||||
|
String? textN;
|
||||||
|
bool? isActive;
|
||||||
|
int? createdBy;
|
||||||
|
String? createdOn;
|
||||||
|
dynamic editedBy;
|
||||||
|
dynamic editedOn;
|
||||||
|
|
||||||
|
GetGeneralInstructions(
|
||||||
|
{this.rowID,
|
||||||
|
this.iD,
|
||||||
|
this.projectID,
|
||||||
|
this.text,
|
||||||
|
this.textN,
|
||||||
|
this.isActive,
|
||||||
|
this.createdBy,
|
||||||
|
this.createdOn,
|
||||||
|
this.editedBy,
|
||||||
|
this.editedOn});
|
||||||
|
|
||||||
|
GetGeneralInstructions.fromJson(Map<String, dynamic> json) {
|
||||||
|
rowID = json['RowID'];
|
||||||
|
iD = json['ID'];
|
||||||
|
projectID = json['ProjectID'];
|
||||||
|
text = json['Text'];
|
||||||
|
textN = json['TextN'];
|
||||||
|
isActive = json['IsActive'];
|
||||||
|
createdBy = json['CreatedBy'];
|
||||||
|
createdOn = json['CreatedOn'];
|
||||||
|
editedBy = json['EditedBy'];
|
||||||
|
editedOn = json['EditedOn'];
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||||
|
data['RowID'] = this.rowID;
|
||||||
|
data['ID'] = this.iD;
|
||||||
|
data['ProjectID'] = this.projectID;
|
||||||
|
data['Text'] = this.text;
|
||||||
|
data['TextN'] = this.textN;
|
||||||
|
data['IsActive'] = this.isActive;
|
||||||
|
data['CreatedBy'] = this.createdBy;
|
||||||
|
data['CreatedOn'] = this.createdOn;
|
||||||
|
data['EditedBy'] = this.editedBy;
|
||||||
|
data['EditedOn'] = this.editedOn;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,59 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:hmg_patient_app_new/core/utils/size_utils.dart';
|
||||||
|
import 'package:hmg_patient_app_new/extensions/string_extensions.dart';
|
||||||
|
import 'package:hmg_patient_app_new/extensions/widget_extensions.dart';
|
||||||
|
import 'package:hmg_patient_app_new/features/inpatient_services/inpatient_services_view_model.dart';
|
||||||
|
import 'package:hmg_patient_app_new/theme/colors.dart';
|
||||||
|
import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
|
class GeneralInstructionsPage extends StatelessWidget {
|
||||||
|
const GeneralInstructionsPage({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
backgroundColor: AppColors.bgScaffoldColor,
|
||||||
|
body: CollapsingListView(
|
||||||
|
title: "General Instructions",
|
||||||
|
child: Padding(
|
||||||
|
padding: EdgeInsets.all(24.h),
|
||||||
|
child: Container(
|
||||||
|
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
|
||||||
|
color: AppColors.whiteColor,
|
||||||
|
borderRadius: 24.r,
|
||||||
|
hasShadow: true,
|
||||||
|
),
|
||||||
|
child: Consumer<InpatientServicesViewModel>(builder: (context, inpatientServicesVM, child) {
|
||||||
|
return inpatientServicesVM.isGeneralInstructionsLoading
|
||||||
|
? ListView.builder(
|
||||||
|
padding: EdgeInsets.zero,
|
||||||
|
shrinkWrap: true,
|
||||||
|
itemCount: 5,
|
||||||
|
itemBuilder: (context, index) {
|
||||||
|
return Column(
|
||||||
|
children: [
|
||||||
|
"Lorem <i>ipsum dolor sit</i> amet, consectetur <b>adipiscing elit</b>".toText16().toShimmer2(),
|
||||||
|
SizedBox(
|
||||||
|
height: 16.h,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
).paddingSymmetrical(24.h, 16.h);
|
||||||
|
},
|
||||||
|
)
|
||||||
|
: ListView.builder(
|
||||||
|
padding: EdgeInsets.zero,
|
||||||
|
shrinkWrap: true,
|
||||||
|
itemCount: inpatientServicesVM.getGeneralInstructionsList.length,
|
||||||
|
itemBuilder: (context, index) {
|
||||||
|
final instruction = inpatientServicesVM.getGeneralInstructionsList[index];
|
||||||
|
return "• ${instruction.text}".toText16(weight: FontWeight.w500).paddingSymmetrical(24.h, 16.h);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,177 @@
|
|||||||
|
import 'package:easy_localization/easy_localization.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:hmg_patient_app_new/core/app_assets.dart';
|
||||||
|
import 'package:hmg_patient_app_new/core/app_state.dart';
|
||||||
|
import 'package:hmg_patient_app_new/core/dependencies.dart';
|
||||||
|
import 'package:hmg_patient_app_new/core/utils/size_utils.dart';
|
||||||
|
import 'package:hmg_patient_app_new/core/utils/utils.dart';
|
||||||
|
import 'package:hmg_patient_app_new/extensions/string_extensions.dart';
|
||||||
|
import 'package:hmg_patient_app_new/extensions/widget_extensions.dart';
|
||||||
|
import 'package:hmg_patient_app_new/features/inpatient_services/inpatient_services_view_model.dart';
|
||||||
|
import 'package:hmg_patient_app_new/presentation/inpatient_services/general_instructions_page.dart';
|
||||||
|
import 'package:hmg_patient_app_new/theme/colors.dart';
|
||||||
|
import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart';
|
||||||
|
import 'package:hmg_patient_app_new/widgets/routes/custom_page_route.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
|
import '../../generated/locale_keys.g.dart';
|
||||||
|
|
||||||
|
class InpatientServicesHomepage extends StatelessWidget {
|
||||||
|
InpatientServicesHomepage({super.key});
|
||||||
|
|
||||||
|
late InpatientServicesViewModel inPatientServicesViewModel;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
inPatientServicesViewModel = Provider.of<InpatientServicesViewModel>(context, listen: false);
|
||||||
|
return Scaffold(
|
||||||
|
backgroundColor: AppColors.bgScaffoldColor,
|
||||||
|
body: CollapsingListView(
|
||||||
|
title: LocaleKeys.InPatientServicesHeader.tr(context: context),
|
||||||
|
child: Padding(
|
||||||
|
padding: EdgeInsets.all(24.h),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
buildInpatientServicesCard(
|
||||||
|
iconBgColor: AppColors.primaryRedColor,
|
||||||
|
icon: AppAssets.bloodSugarOnlyIcon,
|
||||||
|
title: LocaleKeys.generalConsentTitle.tr(context: context),
|
||||||
|
description: LocaleKeys.trackYourGlucoseLevels.tr(context: context),
|
||||||
|
onTap: () {},
|
||||||
|
),
|
||||||
|
SizedBox(height: 16.h),
|
||||||
|
buildInpatientServicesCard(
|
||||||
|
iconBgColor: AppColors.primaryRedColor,
|
||||||
|
icon: AppAssets.bloodSugarOnlyIcon,
|
||||||
|
title: LocaleKeys.generalInstructions.tr(context: context),
|
||||||
|
description: LocaleKeys.trackYourGlucoseLevels.tr(context: context),
|
||||||
|
onTap: () {
|
||||||
|
inPatientServicesViewModel.getGeneralInstructions(
|
||||||
|
projectID: inPatientServicesViewModel.isAdmitted
|
||||||
|
? inPatientServicesViewModel.getAdmissionInfoResponseModel!.projectID!
|
||||||
|
: inPatientServicesViewModel.getAdmissionRequestInfoResponseModel!.projectId!);
|
||||||
|
Navigator.of(context).push(
|
||||||
|
CustomPageRoute(
|
||||||
|
page: GeneralInstructionsPage(),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
SizedBox(height: 16.h),
|
||||||
|
buildInpatientServicesCard(
|
||||||
|
iconBgColor: AppColors.primaryRedColor,
|
||||||
|
icon: AppAssets.bloodSugarOnlyIcon,
|
||||||
|
title: LocaleKeys.medicalInstructions.tr(context: context),
|
||||||
|
description: LocaleKeys.trackYourGlucoseLevels.tr(context: context),
|
||||||
|
onTap: () {},
|
||||||
|
),
|
||||||
|
SizedBox(height: 16.h),
|
||||||
|
buildInpatientServicesCard(
|
||||||
|
iconBgColor: AppColors.primaryRedColor,
|
||||||
|
icon: AppAssets.bloodSugarOnlyIcon,
|
||||||
|
title: LocaleKeys.mealPlanTitle.tr(context: context),
|
||||||
|
description: LocaleKeys.trackYourGlucoseLevels.tr(context: context),
|
||||||
|
onTap: () {},
|
||||||
|
),
|
||||||
|
SizedBox(height: 16.h),
|
||||||
|
buildInpatientServicesCard(
|
||||||
|
iconBgColor: AppColors.primaryRedColor,
|
||||||
|
icon: AppAssets.bloodSugarOnlyIcon,
|
||||||
|
title: LocaleKeys.birthNotificationTitle.tr(context: context),
|
||||||
|
description: LocaleKeys.trackYourGlucoseLevels.tr(context: context),
|
||||||
|
onTap: () {},
|
||||||
|
),
|
||||||
|
SizedBox(height: 16.h),
|
||||||
|
buildInpatientServicesCard(
|
||||||
|
iconBgColor: AppColors.primaryRedColor,
|
||||||
|
icon: AppAssets.bloodSugarOnlyIcon,
|
||||||
|
title: LocaleKeys.advancePayment.tr(context: context),
|
||||||
|
description: LocaleKeys.trackYourGlucoseLevels.tr(context: context),
|
||||||
|
onTap: () {},
|
||||||
|
),
|
||||||
|
SizedBox(height: 16.h),
|
||||||
|
buildInpatientServicesCard(
|
||||||
|
iconBgColor: AppColors.primaryRedColor,
|
||||||
|
icon: AppAssets.bloodSugarOnlyIcon,
|
||||||
|
title: LocaleKeys.admissionNoticeTitle.tr(context: context),
|
||||||
|
description: LocaleKeys.trackYourGlucoseLevels.tr(context: context),
|
||||||
|
onTap: () {},
|
||||||
|
),
|
||||||
|
SizedBox(height: 16.h),
|
||||||
|
buildInpatientServicesCard(
|
||||||
|
iconBgColor: AppColors.primaryRedColor,
|
||||||
|
icon: AppAssets.bloodSugarOnlyIcon,
|
||||||
|
title: LocaleKeys.prescriptions.tr(context: context),
|
||||||
|
description: LocaleKeys.trackYourGlucoseLevels.tr(context: context),
|
||||||
|
onTap: () {},
|
||||||
|
),
|
||||||
|
SizedBox(height: 16.h),
|
||||||
|
buildInpatientServicesCard(
|
||||||
|
iconBgColor: AppColors.primaryRedColor,
|
||||||
|
icon: AppAssets.bloodSugarOnlyIcon,
|
||||||
|
title: LocaleKeys.patientRelationOffice.tr(context: context),
|
||||||
|
description: LocaleKeys.trackYourGlucoseLevels.tr(context: context),
|
||||||
|
onTap: () {},
|
||||||
|
),
|
||||||
|
SizedBox(height: 16.h),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget buildInpatientServicesCard({
|
||||||
|
required String icon,
|
||||||
|
required String title,
|
||||||
|
required String description,
|
||||||
|
required Color iconBgColor,
|
||||||
|
required VoidCallback onTap,
|
||||||
|
}) {
|
||||||
|
return Container(
|
||||||
|
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 20.r),
|
||||||
|
child: Row(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: iconBgColor, borderRadius: 10.r),
|
||||||
|
height: 40.w,
|
||||||
|
width: 40.w,
|
||||||
|
child: Utils.buildSvgWithAssets(
|
||||||
|
icon: icon,
|
||||||
|
fit: BoxFit.none,
|
||||||
|
height: 22.w,
|
||||||
|
width: 22.w,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(width: 12.w),
|
||||||
|
Flexible(
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
title.toText16(isBold: true),
|
||||||
|
description.toText12(
|
||||||
|
isBold: true,
|
||||||
|
color: Color(0xFF8F9AA3),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(width: 12.w),
|
||||||
|
Transform.flip(
|
||||||
|
flipX: getIt.get<AppState>().isArabic(),
|
||||||
|
child: Utils.buildSvgWithAssets(
|
||||||
|
icon: AppAssets.arrowRight,
|
||||||
|
width: 24.w,
|
||||||
|
height: 24.h,
|
||||||
|
fit: BoxFit.contain,
|
||||||
|
iconColor: AppColors.textColor,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
).paddingAll(16.w),
|
||||||
|
).onPress(onTap);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,108 @@
|
|||||||
|
import 'package:easy_localization/easy_localization.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:hmg_patient_app_new/core/utils/date_util.dart';
|
||||||
|
import 'package:hmg_patient_app_new/core/utils/size_utils.dart';
|
||||||
|
import 'package:hmg_patient_app_new/extensions/string_extensions.dart';
|
||||||
|
import 'package:hmg_patient_app_new/extensions/widget_extensions.dart';
|
||||||
|
import 'package:hmg_patient_app_new/features/inpatient_services/inpatient_services_view_model.dart';
|
||||||
|
import 'package:hmg_patient_app_new/presentation/inpatient_services/inpatient_services_homepage.dart';
|
||||||
|
import 'package:hmg_patient_app_new/theme/colors.dart';
|
||||||
|
import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart';
|
||||||
|
import 'package:hmg_patient_app_new/widgets/chip/app_custom_chip_widget.dart';
|
||||||
|
import 'package:hmg_patient_app_new/widgets/routes/custom_page_route.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
|
import '../../../generated/locale_keys.g.dart';
|
||||||
|
|
||||||
|
class InpatientServicesCard extends StatelessWidget {
|
||||||
|
const InpatientServicesCard({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Consumer<InpatientServicesViewModel>(builder: (context, inpatientServicesVM, child) {
|
||||||
|
return Container(
|
||||||
|
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
|
||||||
|
color: AppColors.whiteColor,
|
||||||
|
borderRadius: 20.h,
|
||||||
|
hasShadow: true,
|
||||||
|
),
|
||||||
|
child: Padding(
|
||||||
|
padding: EdgeInsets.all(16.h),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
mainAxisSize: MainAxisSize.max,
|
||||||
|
children: [
|
||||||
|
Wrap(
|
||||||
|
alignment: WrapAlignment.start,
|
||||||
|
direction: Axis.horizontal,
|
||||||
|
spacing: 6.w,
|
||||||
|
runSpacing: 6.h,
|
||||||
|
children: [
|
||||||
|
AppCustomChipWidget(
|
||||||
|
labelText: inpatientServicesVM.isAdmitted ? LocaleKeys.InPatient.tr(context: context) : LocaleKeys.admissionReq.tr(context: context),
|
||||||
|
backgroundColor: AppColors.textColor,
|
||||||
|
textColor: AppColors.whiteColor,
|
||||||
|
),
|
||||||
|
inpatientServicesVM.isAdmitted
|
||||||
|
? AppCustomChipWidget(
|
||||||
|
labelText: "Room: ${inpatientServicesVM.getAdmissionInfoResponseModel!.roomID} • Bed: ${inpatientServicesVM.getAdmissionInfoResponseModel!.bedID}",
|
||||||
|
backgroundColor: AppColors.infoColor.withAlpha(30),
|
||||||
|
textColor: AppColors.infoColor,
|
||||||
|
)
|
||||||
|
: SizedBox(),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
SizedBox(height: 24.h),
|
||||||
|
inpatientServicesVM.isAdmitted
|
||||||
|
? "${LocaleKeys.admissionNo.tr(context: context)}: ${inpatientServicesVM.getAdmissionInfoResponseModel!.admissionNo}".toText16(isBold: true)
|
||||||
|
: "${LocaleKeys.admissionReqNo.tr(context: context)}: ${inpatientServicesVM.getAdmissionRequestInfoResponseModel!.admissionRequestNo}".toText16(isBold: true),
|
||||||
|
SizedBox(height: 8.h),
|
||||||
|
Wrap(
|
||||||
|
alignment: WrapAlignment.start,
|
||||||
|
direction: Axis.horizontal,
|
||||||
|
spacing: 6.w,
|
||||||
|
runSpacing: 6.h,
|
||||||
|
children: [
|
||||||
|
AppCustomChipWidget(
|
||||||
|
labelText: inpatientServicesVM.isAdmitted
|
||||||
|
? "${LocaleKeys.clinicName.tr(context: context)}: ${inpatientServicesVM.getAdmissionInfoResponseModel!.clinicName}"
|
||||||
|
: "${LocaleKeys.clinicName.tr(context: context)}: ${inpatientServicesVM.getAdmissionRequestInfoResponseModel!.clinicName}",
|
||||||
|
),
|
||||||
|
AppCustomChipWidget(
|
||||||
|
labelText: inpatientServicesVM.isAdmitted
|
||||||
|
? "${LocaleKeys.branch.tr(context: context)} ${inpatientServicesVM.getAdmissionInfoResponseModel!.projectName}"
|
||||||
|
: "${LocaleKeys.branch.tr(context: context)} ${inpatientServicesVM.getAdmissionRequestInfoResponseModel!.projectName}",
|
||||||
|
),
|
||||||
|
AppCustomChipWidget(
|
||||||
|
labelText: inpatientServicesVM.isAdmitted
|
||||||
|
? "${LocaleKeys.admissionDate.tr(context: context)}: ${DateUtil.formatDateToDate(DateUtil.convertStringToDate(inpatientServicesVM.getAdmissionInfoResponseModel!.admissionDate), false)}"
|
||||||
|
: "${LocaleKeys.admissionRequestDate.tr(context: context)}: ${DateUtil.formatDateToDate(DateUtil.convertStringToDate(inpatientServicesVM.getAdmissionRequestInfoResponseModel!.expectedAdmissionDate), false)}",
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
SizedBox(height: 16.h),
|
||||||
|
CustomButton(
|
||||||
|
text: LocaleKeys.viewDetails.tr(context: context),
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.of(context).push(
|
||||||
|
CustomPageRoute(
|
||||||
|
page: InpatientServicesHomepage(),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
backgroundColor: AppColors.secondaryLightRedColor,
|
||||||
|
borderColor: AppColors.secondaryLightRedColor,
|
||||||
|
textColor: AppColors.primaryRedColor,
|
||||||
|
fontSize: (isFoldable || isTablet) ? 12.f : 14.f,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
borderRadius: 12.r,
|
||||||
|
padding: EdgeInsets.symmetric(horizontal: 10.w),
|
||||||
|
height: isFoldable ? 36.h : 40.h,
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue