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_inp.dart';
class RequestSendPrescriptionEmail {
String? appointmentDate;
@ -26,6 +27,7 @@ class RequestSendPrescriptionEmail {
int? doctorID;
int? projectID;
List<PrescriptionReport>? listPrescriptions;
List<PrescriptionReportINP>? listPrescriptionsINP;
RequestSendPrescriptionEmail(
{this.appointmentDate,
@ -102,9 +104,12 @@ class RequestSendPrescriptionEmail {
data['PatientMobileNumber'] = this.patientMobileNumber;
data['PatientName'] = this.patientName;
data['SetupID'] = this.setupID;
if (this.listPrescriptions != null) {
if (this.listPrescriptions != null && this.listPrescriptions!.isNotEmpty) {
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['DoctorName'] = this.doctorName;
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) {
prescriptionReportList.clear();
prescriptionReportEnhList.clear();
prescriptionReportListINP.clear();
isMedDeliveryAllowed = response['IsHomeMedicineDeliverySupported'];
if (prescriptions.isInOutPatient!) {
response['ListPRM'].forEach((prescriptions) {
@ -120,8 +121,9 @@ class PrescriptionsService extends BaseService {
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.listPrescriptionsINP = prescriptionReportListINP;
_requestSendPrescriptionEmail.appointmentDate = appointmentDate;
_requestSendPrescriptionEmail.patientID = patientID;
_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);
await _prescriptionsService.sendPrescriptionEmail(appointmentDate, patientID, clinicName, doctorName, doctorID, projectID);
await _prescriptionsService.sendPrescriptionEmail(appointmentDate, patientID, clinicName, doctorName, doctorID, projectID, isInOutPatient);
if (_prescriptionsService.hasError) {
error = _prescriptionsService.error!;
setState(ViewState.ErrorLocal);

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

Loading…
Cancel
Save