From d3b11b82e43444640f81c7beaf4b50ffd90adcfa Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Thu, 21 May 2026 16:29:47 +0300 Subject: [PATCH] fixes for Pharmacy intervention --- lib/client/base_app_client.dart | 4 +- lib/config/config.dart | 2 +- .../intervention_history.dart | 21 ++++++---- .../pharmacy_intervention_item.dart | 42 +++++++++++-------- .../pharmacy_intervention_service.dart | 14 +++---- .../pharmacy_intervention_view_model.dart | 21 +++++++--- pubspec.yaml | 4 +- 7 files changed, 66 insertions(+), 42 deletions(-) diff --git a/lib/client/base_app_client.dart b/lib/client/base_app_client.dart index fda8db44..6d798d88 100755 --- a/lib/client/base_app_client.dart +++ b/lib/client/base_app_client.dart @@ -149,9 +149,9 @@ class BaseAppClient { printEmojis: true, ), ); - log("URL : $url"); + print("URL : $url"); logger.d("URL : $url"); - log("Body : ${json.encode(body)}"); + print("Body : ${json.encode(body)}"); logger.d("Body : ${json.encode(body)}"); var asd = json.encode(body); var asd2; diff --git a/lib/config/config.dart b/lib/config/config.dart index 3ab41298..6ea7a00e 100755 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -413,7 +413,7 @@ const TRANSACTION_NO = 0; const LANGUAGE_ID = 2; const STAMP = '2020-04-27T12:17:17.721Z'; const IP_ADDRESS = '9.9.9.9'; -const VERSION_ID = 10.9; +const VERSION_ID = 11.0; const CHANNEL = 9; const SESSION_ID = 'BlUSkYymTt'; const IS_LOGIN_FOR_DOCTOR_APP = true; diff --git a/lib/core/model/pharmacy-intervention-model/intervention_history.dart b/lib/core/model/pharmacy-intervention-model/intervention_history.dart index c3e872b9..536748a0 100644 --- a/lib/core/model/pharmacy-intervention-model/intervention_history.dart +++ b/lib/core/model/pharmacy-intervention-model/intervention_history.dart @@ -36,16 +36,23 @@ class InterventionHistory { factory InterventionHistory.fromJson(Map json) { print('the remark is ${json['remark']}'); return InterventionHistory( - authizationFormText: json['authizationFormText'] ?? '', - authorizedAction: json['authorizedAction'] ?? '', - commentedBy: json['commentedBy'] ?? '', - commentedByName: json['commentedByName'] ?? '', - interventionDesc: json['interventionDesc'] ?? '', - interventionId: json['interventionId'] ?? '', - remark: json['remark'] ?? '', + authizationFormText: json['authizationFormText']?.toString() ?? '', + authorizedAction: _parseInt(json['authorizedAction']), + commentedBy: _parseInt(json['commentedBy']), + commentedByName: json['commentedByName']?.toString() ?? '', + interventionDesc: json['interventionDesc']?.toString() ?? '', + interventionId: _parseInt(json['interventionId']), + remark: json['remark']?.toString() ?? '', ); } + static int? _parseInt(dynamic value) { + if (value == null) return null; + if (value is int) return value; + if (value is String) return int.tryParse(value); + return null; + } + Map toJson() { return { 'authizationFormText': authizationFormText, diff --git a/lib/core/model/pharmacy-intervention-model/pharmacy_intervention_item.dart b/lib/core/model/pharmacy-intervention-model/pharmacy_intervention_item.dart index d7d34f00..c073f24a 100644 --- a/lib/core/model/pharmacy-intervention-model/pharmacy_intervention_item.dart +++ b/lib/core/model/pharmacy-intervention-model/pharmacy_intervention_item.dart @@ -58,28 +58,36 @@ class Medication { factory Medication.fromJson(Map json) { return Medication( - admissionNo: json['admissionNo']?? '', - createdBy: json['createdBy']?? '', - doctorComments: json['doctorComments']?? '', - doctorName: json['doctorName']?? '', - dosageDetail: json['dosageDetail']?? '', - itemID: json['itemID']?? '', - lineItemNo: json['lineItemNo']?? '', - medication: json['medication']?? '', - nursingStation: json['nursingStation']?? '', - orderNo: json['orderNo']?? '', - patientID: json['patientID']?? '', - patientName: json['patientName']?? '', - pharmacyRemarks: json['pharmacyRemarks']?? '-', - prescriptionNo: json['prescriptionNo']?? '', + accessLevel: _parseInt(json['accessLevel']), + admissionNo: _parseInt(json['admissionNo']), + createdBy: json['createdBy']?.toString() ?? '', + doctorComments: json['doctorComments']?.toString() ?? '', + doctorName: json['doctorName']?.toString() ?? '', + dosageDetail: json['dosageDetail']?.toString() ?? '', + itemID: _parseInt(json['itemID']), + lineItemNo: _parseInt(json['lineItemNo']), + medication: json['medication']?.toString() ?? '', + nursingStation: json['nursingStation']?.toString() ?? '', + orderNo: _parseInt(json['orderNo']), + patientID: _parseInt(json['patientID']), + patientName: json['patientName']?.toString() ?? '', + pharmacyRemarks: json['pharmacyRemarks']?.toString() ?? '-', + prescriptionNo: _parseInt(json['prescriptionNo']), startDatetime: json['startDatetime'] != null ? DateTime.parse(json['startDatetime']) : null, - status: json['status']?? '', - statusName: json['statusName']?? '', - accessLevelDescription: json['accessLevelDescription']?? '', + status: _parseInt(json['status']), + statusName: json['statusName']?.toString() ?? '', + accessLevelDescription: json['accessLevelDescription']?.toString() ?? '', stopDatetime: json['stopDatetime'] != null ? DateTime.parse(json['stopDatetime']) : null, ); } + static int? _parseInt(dynamic value) { + if (value == null) return null; + if (value is int) return value; + if (value is String) return int.tryParse(value); + return null; + } + Map toJson() { return { 'accessLevel': accessLevel, diff --git a/lib/screens/pharmacy_intervention/viewmodel/pharmacy_intervention_service.dart b/lib/screens/pharmacy_intervention/viewmodel/pharmacy_intervention_service.dart index 8410d806..574da0f2 100644 --- a/lib/screens/pharmacy_intervention/viewmodel/pharmacy_intervention_service.dart +++ b/lib/screens/pharmacy_intervention/viewmodel/pharmacy_intervention_service.dart @@ -7,6 +7,7 @@ import 'package:doctor_app_flutter/core/model/pharmacy-intervention-model/interv import 'package:doctor_app_flutter/core/model/pharmacy-intervention-model/nursing_station.dart'; import 'package:doctor_app_flutter/core/model/pharmacy-intervention-model/pharmacy_intervention_item.dart'; import 'package:doctor_app_flutter/core/service/base/base_service.dart'; +import 'package:doctor_app_flutter/core/service/hospitals/hospitals_service.dart'; import 'package:doctor_app_flutter/utils/dr_app_toast_msg.dart'; import 'package:intl/intl.dart'; @@ -22,9 +23,6 @@ class PharmacyInterventionService extends BaseService { "AdmissionNo": admissionId.isEmpty ?'0': admissionId, "PatientID": num.parse((patientID.isEmpty)?'0':patientID), }; - - print("the date is ${convertToISO8601(fromDate).toString()}"); - print("the to Date is ${convertToISO8601(fromDate).toString()}"); if(fromDate.isNotEmpty){ var temp = { "InterventionFromDate": convertToISO8601(fromDate).toString(), @@ -101,16 +99,18 @@ class PharmacyInterventionService extends BaseService { } Future getInfectiousDiseaseHistory({ - String admissionNumber = '', - String prescriptionNumber = '', - String orderNumber = '', - String itemID = '', + int admissionNumber = 0, + int prescriptionNumber = 0, + int orderNumber = 0, + int itemID = 0, + dynamic memberID, }) async { var request = { "AdmissionNo": admissionNumber, "PrescriptionNo": prescriptionNumber, "OrderNo": orderNumber, "ItemID": itemID, + "MemberID": memberID, }; hasError = false; diff --git a/lib/screens/pharmacy_intervention/viewmodel/pharmacy_intervention_view_model.dart b/lib/screens/pharmacy_intervention/viewmodel/pharmacy_intervention_view_model.dart index dbfba2c4..a66bd1d5 100644 --- a/lib/screens/pharmacy_intervention/viewmodel/pharmacy_intervention_view_model.dart +++ b/lib/screens/pharmacy_intervention/viewmodel/pharmacy_intervention_view_model.dart @@ -1,5 +1,6 @@ import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; import 'package:doctor_app_flutter/core/enum/view_state.dart'; +import 'package:doctor_app_flutter/core/model/doctor/doctor_profile_model.dart'; import 'package:doctor_app_flutter/core/model/pharmacy-intervention-model/intervention_history.dart'; import 'package:doctor_app_flutter/core/model/pharmacy-intervention-model/nursing_station.dart'; import 'package:doctor_app_flutter/core/model/pharmacy-intervention-model/pharmacy_intervention_item.dart'; @@ -612,12 +613,20 @@ class PharmacyInterventionViewModel extends BaseViewModel { }) async { currentlySelectedMedication = null; setState(ViewState.BusyLocal); - InterventionHistoryList? result = - await _service.getInfectiousDiseaseHistory( - admissionNumber: medication?.admissionNo?.toString() ?? '', - prescriptionNumber: medication?.prescriptionNo?.toString() ?? '', - orderNumber: medication?.orderNo?.toString() ?? '', - itemID: medication?.itemID?.toString() ?? ''); + DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(await sharedPref.getObj(DOCTOR_PROFILE)); + InterventionHistoryList? result = await _service.getInfectiousDiseaseHistory( + admissionNumber: medication?.admissionNo ?? 0, + prescriptionNumber: medication?.prescriptionNo ?? 0, + orderNumber: medication?.orderNo ?? 0, + itemID: medication?.itemID ?? 0, + memberID: doctorProfile.doctorID ?? 0 + ); + + // await _service.getInfectiousDiseaseHistory( + // admissionNumber: medication?.admissionNo?.toString() ?? '', + // prescriptionNumber: medication?.prescriptionNo?.toString() ?? '', + // orderNumber: medication?.orderNo?.toString() ?? '', + // itemID: medication?.itemID?.toString() ?? ''); if (_service.hasError) { error = _service.error; setState(ViewState.ErrorLocal); diff --git a/pubspec.yaml b/pubspec.yaml index 710cea32..f1275715 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -12,8 +12,8 @@ description: A new Flutter project. # Read more about iOS versioning at # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html -version: 1.4.37+48 -#version: 1.4.33+1 +version: 1.4.39+50 +#version: 1.4.36+1 environment: