InPatient prescription send email issue fixed

merge-update-with-lab-changes
haroon amjad 1 year ago
parent 20bfdc3652
commit c58cbae99c

@ -1,4 +1,5 @@
import 'package:diplomaticquarterapp/core/model/prescriptions/prescription_report.dart'; import 'package:diplomaticquarterapp/core/model/prescriptions/prescription_report.dart';
import 'package:diplomaticquarterapp/core/model/prescriptions/prescription_report_inp.dart';
class RequestSendPrescriptionEmail { class RequestSendPrescriptionEmail {
String? appointmentDate; String? appointmentDate;
@ -26,6 +27,7 @@ class RequestSendPrescriptionEmail {
int? doctorID; int? doctorID;
int? projectID; int? projectID;
List<PrescriptionReport>? listPrescriptions; List<PrescriptionReport>? listPrescriptions;
List<PrescriptionReportINP>? listPrescriptionsINP;
RequestSendPrescriptionEmail( RequestSendPrescriptionEmail(
{this.appointmentDate, {this.appointmentDate,
@ -102,9 +104,12 @@ class RequestSendPrescriptionEmail {
data['PatientMobileNumber'] = this.patientMobileNumber; data['PatientMobileNumber'] = this.patientMobileNumber;
data['PatientName'] = this.patientName; data['PatientName'] = this.patientName;
data['SetupID'] = this.setupID; data['SetupID'] = this.setupID;
if (this.listPrescriptions != null) { if (this.listPrescriptions != null && this.listPrescriptions!.isNotEmpty) {
data['ListPrescriptions'] = this.listPrescriptions!.map((v) => v.toJson()).toList(); data['ListPrescriptions'] = this.listPrescriptions!.map((v) => v.toJson()).toList();
} }
if (this.listPrescriptionsINP != null && this.listPrescriptionsINP!.isNotEmpty) {
data['ListPrescriptions'] = this.listPrescriptionsINP!.map((v) => v.toJson()).toList();
}
data['ClinicName'] = this.clinicName; data['ClinicName'] = this.clinicName;
data['DoctorName'] = this.doctorName; data['DoctorName'] = this.doctorName;
data['ProjectID'] = this.projectID; data['ProjectID'] = this.projectID;

@ -98,6 +98,7 @@ class PrescriptionsService extends BaseService {
await baseAppClient.post(prescriptions.isInOutPatient! ? GET_PRESCRIPTION_REPORT_ENH : GET_PRESCRIPTION_REPORT, onSuccess: (dynamic response, int statusCode) { await baseAppClient.post(prescriptions.isInOutPatient! ? GET_PRESCRIPTION_REPORT_ENH : GET_PRESCRIPTION_REPORT, onSuccess: (dynamic response, int statusCode) {
prescriptionReportList.clear(); prescriptionReportList.clear();
prescriptionReportEnhList.clear(); prescriptionReportEnhList.clear();
prescriptionReportListINP.clear();
isMedDeliveryAllowed = response['IsHomeMedicineDeliverySupported']; isMedDeliveryAllowed = response['IsHomeMedicineDeliverySupported'];
if (prescriptions.isInOutPatient!) { if (prescriptions.isInOutPatient!) {
response['ListPRM'].forEach((prescriptions) { response['ListPRM'].forEach((prescriptions) {
@ -120,8 +121,9 @@ class PrescriptionsService extends BaseService {
isDentalAllowedBackend: false, isDentalAllowedBackend: false,
); );
Future sendPrescriptionEmail(String appointmentDate, int patientID, String clinicName, String doctorName, int doctorID, int projectID) async { Future sendPrescriptionEmail(String appointmentDate, int patientID, String clinicName, String doctorName, int doctorID, int projectID, bool isInOutPatient) async {
_requestSendPrescriptionEmail.listPrescriptions = prescriptionReportList; _requestSendPrescriptionEmail.listPrescriptions = prescriptionReportList;
_requestSendPrescriptionEmail.listPrescriptionsINP = prescriptionReportListINP;
_requestSendPrescriptionEmail.appointmentDate = appointmentDate; _requestSendPrescriptionEmail.appointmentDate = appointmentDate;
_requestSendPrescriptionEmail.patientID = patientID; _requestSendPrescriptionEmail.patientID = patientID;
_requestSendPrescriptionEmail.clinicName = clinicName; _requestSendPrescriptionEmail.clinicName = clinicName;

@ -114,9 +114,9 @@ class PrescriptionsViewModel extends BaseViewModel {
} }
} }
sendPrescriptionEmail({required String appointmentDate, required int patientID, required String clinicName, required String doctorName, required int doctorID, required String mes, required int projectID}) async { sendPrescriptionEmail({required String appointmentDate, required int patientID, required String clinicName, required String doctorName, required int doctorID, required String mes, required int projectID, required bool isInOutPatient}) async {
setState(ViewState.BusyLocal); setState(ViewState.BusyLocal);
await _prescriptionsService.sendPrescriptionEmail(appointmentDate, patientID, clinicName, doctorName, doctorID, projectID); await _prescriptionsService.sendPrescriptionEmail(appointmentDate, patientID, clinicName, doctorName, doctorID, projectID, isInOutPatient);
if (_prescriptionsService.hasError) { if (_prescriptionsService.hasError) {
error = _prescriptionsService.error!; error = _prescriptionsService.error!;
setState(ViewState.ErrorLocal); setState(ViewState.ErrorLocal);

@ -61,9 +61,11 @@ class PrescriptionItemsPage extends StatelessWidget {
prescriptions.name!, prescriptions.name!,
DateUtil.convertStringToDate(prescriptions.appointmentDate!), DateUtil.convertStringToDate(prescriptions.appointmentDate!),
DateUtil.formatDateToTime( DateUtil.formatDateToTime(
model.prescriptionReportEnhList.length > 0 || model.prescriptionReportListINP.length > 0 ? DateUtil.convertStringToDate( model.prescriptionReportEnhList.length > 0 || model.prescriptionReportListINP.length > 0
model.prescriptionReportEnhList.length > 0 ? model.prescriptionReportEnhList[0].orderDate! : model.prescriptionReportListINP[0].orderDate!, ? DateUtil.convertStringToDate(
) : DateTime.now(), model.prescriptionReportEnhList.length > 0 ? model.prescriptionReportEnhList[0].orderDate! : model.prescriptionReportListINP[0].orderDate!,
)
: DateTime.now(),
), ),
prescriptions.nationalityFlagURL ?? "", prescriptions.nationalityFlagURL ?? "",
prescriptions.doctorRate, prescriptions.doctorRate,
@ -433,7 +435,8 @@ class PrescriptionItemsPage extends StatelessWidget {
doctorName: prescriptions.doctorName!, doctorName: prescriptions.doctorName!,
doctorID: prescriptions.doctorID!, doctorID: prescriptions.doctorID!,
mes: TranslationBase.of(context).sendSuc, mes: TranslationBase.of(context).sendSuc,
projectID: prescriptions.projectID!); projectID: prescriptions.projectID!,
isInOutPatient: prescriptions.isInOutPatient!);
}, },
), ),
); );

Loading…
Cancel
Save