diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 82805ecc..9cd98ee3 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -30,7 +30,7 @@ > localizedValues = { "operationReports": {"en": "Operation Reports", "ar": "تقارير العملية"}, "registerNewPatient": {"en": "Register\nNew Patient", "ar": "تسجيل\n مريض جديد"}, "registeraPatient": {"en": "Register a Patient", "ar": "تسجيل المريض"}, + "occupation": {"en": "Occupation", "ar": "مهنة"}, + "healthID": {"en": "Health ID", "ar": "معرف الصحة"}, + "identityNumber": {"en": "Identity Number", "ar": "رقم الهوية"}, + "maritalStatus": {"en": "Marital Status", "ar": "الحالة الزوجية"}, }; diff --git a/lib/core/model/PatientRegistration/CheckActivationCodeModel.dart b/lib/core/model/PatientRegistration/CheckActivationCodeModel.dart new file mode 100644 index 00000000..4b95c1b0 --- /dev/null +++ b/lib/core/model/PatientRegistration/CheckActivationCodeModel.dart @@ -0,0 +1,112 @@ +class CheckActivationCodeModel { + int patientMobileNumber; + String mobileNo; + int projectOutSA; + int loginType; + String zipCode; + bool isRegister; + String logInTokenID; + int searchType; + int patientID; + int nationalID; + int patientIdentificationID; + bool forRegisteration; + String activationCode; + double versionID; + int channel; + int languageID; + String iPAdress; + String generalid; + int patientOutSA; + Null sessionID; + bool isDentalAllowedBackend; + int deviceTypeID; + String dOB; + int isHijri; + String healthId; + + CheckActivationCodeModel( + {this.patientMobileNumber, + this.mobileNo, + this.projectOutSA, + this.loginType, + this.zipCode, + this.isRegister, + this.logInTokenID, + this.searchType, + this.patientID, + this.nationalID, + this.patientIdentificationID, + this.forRegisteration, + this.activationCode, + this.versionID, + this.channel, + this.languageID, + this.iPAdress, + this.generalid, + this.patientOutSA, + this.sessionID, + this.isDentalAllowedBackend, + this.deviceTypeID, + this.dOB, + this.isHijri, + this.healthId}); + + CheckActivationCodeModel.fromJson(Map json) { + patientMobileNumber = json['PatientMobileNumber']; + mobileNo = json['MobileNo']; + projectOutSA = json['ProjectOutSA']; + loginType = json['LoginType']; + zipCode = json['ZipCode']; + isRegister = json['isRegister']; + logInTokenID = json['LogInTokenID']; + searchType = json['SearchType']; + patientID = json['PatientID']; + nationalID = json['NationalID']; + patientIdentificationID = json['PatientIdentificationID']; + forRegisteration = json['ForRegisteration']; + activationCode = json['activationCode']; + versionID = json['VersionID']; + channel = json['Channel']; + languageID = json['LanguageID']; + iPAdress = json['IPAdress']; + generalid = json['generalid']; + patientOutSA = json['PatientOutSA']; + sessionID = json['SessionID']; + isDentalAllowedBackend = json['isDentalAllowedBackend']; + deviceTypeID = json['DeviceTypeID']; + dOB = json['DOB']; + isHijri = json['IsHijri']; + healthId = json['HealthId']; + } + + Map toJson() { + final Map data = new Map(); + data['PatientMobileNumber'] = this.patientMobileNumber; + data['MobileNo'] = this.mobileNo; + data['ProjectOutSA'] = this.projectOutSA; + data['LoginType'] = this.loginType; + data['ZipCode'] = this.zipCode; + data['isRegister'] = this.isRegister; + data['LogInTokenID'] = this.logInTokenID; + data['SearchType'] = this.searchType; + data['PatientID'] = this.patientID; + data['NationalID'] = this.nationalID; + data['PatientIdentificationID'] = this.patientIdentificationID; + data['ForRegisteration'] = this.forRegisteration; + data['activationCode'] = this.activationCode; + data['VersionID'] = this.versionID; + data['Channel'] = this.channel; + data['LanguageID'] = this.languageID; + data['IPAdress'] = this.iPAdress; + data['generalid'] = this.generalid; + data['PatientOutSA'] = this.patientOutSA; + data['SessionID'] = this.sessionID; + data['isDentalAllowedBackend'] = this.isDentalAllowedBackend; + data['DeviceTypeID'] = this.deviceTypeID; + data['DOB'] = this.dOB; + data['IsHijri'] = this.isHijri; + data['HealthId'] = this.healthId; + return data; + } +} diff --git a/lib/core/model/PatientRegistration/CheckPatientForRegistrationModel.dart b/lib/core/model/PatientRegistration/CheckPatientForRegistrationModel.dart new file mode 100644 index 00000000..3465cf8d --- /dev/null +++ b/lib/core/model/PatientRegistration/CheckPatientForRegistrationModel.dart @@ -0,0 +1,80 @@ +class CheckPatientForRegistrationModel { + int patientIdentificationID; + int patientMobileNumber; + String zipCode; + double versionID; + int channel; + int languageID; + String iPAdress; + String generalid; + int patientOutSA; + Null sessionID; + bool isDentalAllowedBackend; + int deviceTypeID; + String tokenID; + int patientID; + bool isRegister; + String dOB; + int isHijri; + + CheckPatientForRegistrationModel( + {this.patientIdentificationID, + this.patientMobileNumber, + this.zipCode, + this.versionID, + this.channel, + this.languageID, + this.iPAdress, + this.generalid, + this.patientOutSA, + this.sessionID, + this.isDentalAllowedBackend, + this.deviceTypeID, + this.tokenID, + this.patientID, + this.isRegister, + this.dOB, + this.isHijri}); + + CheckPatientForRegistrationModel.fromJson(Map json) { + patientIdentificationID = json['PatientIdentificationID']; + patientMobileNumber = json['PatientMobileNumber']; + zipCode = json['ZipCode']; + versionID = json['VersionID']; + channel = json['Channel']; + languageID = json['LanguageID']; + iPAdress = json['IPAdress']; + generalid = json['generalid']; + patientOutSA = json['PatientOutSA']; + sessionID = json['SessionID']; + isDentalAllowedBackend = json['isDentalAllowedBackend']; + deviceTypeID = json['DeviceTypeID']; + tokenID = json['TokenID']; + patientID = json['PatientID']; + isRegister = json['isRegister']; + dOB = json['DOB']; + isHijri = json['IsHijri']; + } + + Map toJson() { + final Map data = new Map(); + data['PatientIdentificationID'] = this.patientIdentificationID; + data['PatientMobileNumber'] = this.patientMobileNumber; + data['ZipCode'] = this.zipCode; + data['VersionID'] = this.versionID; + data['Channel'] = this.channel; + data['LanguageID'] = this.languageID; + data['IPAdress'] = this.iPAdress; + data['generalid'] = this.generalid; + data['PatientOutSA'] = this.patientOutSA; + data['SessionID'] = this.sessionID; + data['isDentalAllowedBackend'] = this.isDentalAllowedBackend; + data['DeviceTypeID'] = this.deviceTypeID; + data['TokenID'] = this.tokenID; + data['PatientID'] = this.patientID; + data['isRegister'] = this.isRegister; + data['DOB'] = this.dOB; + data['IsHijri'] = this.isHijri; + return data; + } +} diff --git a/lib/core/model/PatientRegistration/PatientRegistrationModel.dart b/lib/core/model/PatientRegistration/PatientRegistrationModel.dart new file mode 100644 index 00000000..83ff53d7 --- /dev/null +++ b/lib/core/model/PatientRegistration/PatientRegistrationModel.dart @@ -0,0 +1,185 @@ +class PatientRegistrationModel { + Patientobject patientobject; + String patientIdentificationID; + String patientMobileNumber; + String logInTokenID; + double versionID; + int channel; + int languageID; + String iPAdress; + String generalid; + int patientOutSA; + Null sessionID; + bool isDentalAllowedBackend; + int deviceTypeID; + String tokenID; + String dOB; + int isHijri; + String healthId; + String zipCode; + + PatientRegistrationModel( + {this.patientobject, + this.patientIdentificationID, + this.patientMobileNumber, + this.logInTokenID, + this.versionID, + this.channel, + this.languageID, + this.iPAdress, + this.generalid, + this.patientOutSA, + this.sessionID, + this.isDentalAllowedBackend, + this.deviceTypeID, + this.tokenID, + this.dOB, + this.isHijri, + this.healthId, + this.zipCode}); + + PatientRegistrationModel.fromJson(Map json) { + patientobject = json['Patientobject'] != null + ? new Patientobject.fromJson(json['Patientobject']) + : null; + patientIdentificationID = json['PatientIdentificationID']; + patientMobileNumber = json['PatientMobileNumber']; + logInTokenID = json['LogInTokenID']; + versionID = json['VersionID']; + channel = json['Channel']; + languageID = json['LanguageID']; + iPAdress = json['IPAdress']; + generalid = json['generalid']; + patientOutSA = json['PatientOutSA']; + sessionID = json['SessionID']; + isDentalAllowedBackend = json['isDentalAllowedBackend']; + deviceTypeID = json['DeviceTypeID']; + tokenID = json['TokenID']; + dOB = json['DOB']; + isHijri = json['IsHijri']; + healthId = json['HealthId']; + zipCode = json['ZipCode']; + } + + Map toJson() { + final Map data = new Map(); + if (this.patientobject != null) { + data['Patientobject'] = this.patientobject.toJson(); + } + data['PatientIdentificationID'] = this.patientIdentificationID; + data['PatientMobileNumber'] = this.patientMobileNumber; + data['LogInTokenID'] = this.logInTokenID; + data['VersionID'] = this.versionID; + data['Channel'] = this.channel; + data['LanguageID'] = this.languageID; + data['IPAdress'] = this.iPAdress; + data['generalid'] = this.generalid; + data['PatientOutSA'] = this.patientOutSA; + data['SessionID'] = this.sessionID; + data['isDentalAllowedBackend'] = this.isDentalAllowedBackend; + data['DeviceTypeID'] = this.deviceTypeID; + data['TokenID'] = this.tokenID; + data['DOB'] = this.dOB; + data['IsHijri'] = this.isHijri; + data['HealthId'] = this.healthId; + data['ZipCode'] = this.zipCode; + return data; + } +} + +class Patientobject { + bool tempValue; + int patientIdentificationType; + String patientIdentificationNo; + int mobileNumber; + int patientOutSA; + String firstNameN; + String middleNameN; + String lastNameN; + String firstName; + String middleName; + String lastName; + String strDateofBirth; + String dateofBirth; + int gender; + String nationalityID; + String dateofBirthN; + String emailAddress; + String sourceType; + String preferredLanguage; + String marital; + String eHealthIDField; + + Patientobject( + {this.tempValue, + this.patientIdentificationType, + this.patientIdentificationNo, + this.mobileNumber, + this.patientOutSA, + this.firstNameN, + this.middleNameN, + this.lastNameN, + this.firstName, + this.middleName, + this.lastName, + this.strDateofBirth, + this.dateofBirth, + this.gender, + this.nationalityID, + this.dateofBirthN, + this.emailAddress, + this.sourceType, + this.preferredLanguage, + this.marital, + this.eHealthIDField}); + + Patientobject.fromJson(Map json) { + tempValue = json['TempValue']; + patientIdentificationType = json['PatientIdentificationType']; + patientIdentificationNo = json['PatientIdentificationNo']; + mobileNumber = json['MobileNumber']; + patientOutSA = json['PatientOutSA']; + firstNameN = json['FirstNameN']; + middleNameN = json['MiddleNameN']; + lastNameN = json['LastNameN']; + firstName = json['FirstName']; + middleName = json['MiddleName']; + lastName = json['LastName']; + strDateofBirth = json['StrDateofBirth']; + dateofBirth = json['DateofBirth']; + gender = json['Gender']; + nationalityID = json['NationalityID']; + dateofBirthN = json['DateofBirthN']; + emailAddress = json['EmailAddress']; + sourceType = json['SourceType']; + preferredLanguage = json['PreferredLanguage']; + marital = json['Marital']; + eHealthIDField = json['eHealthIDField']; + } + + Map toJson() { + final Map data = new Map(); + data['TempValue'] = this.tempValue; + data['PatientIdentificationType'] = this.patientIdentificationType; + data['PatientIdentificationNo'] = this.patientIdentificationNo; + data['MobileNumber'] = this.mobileNumber; + data['PatientOutSA'] = this.patientOutSA; + data['FirstNameN'] = this.firstNameN; + data['MiddleNameN'] = this.middleNameN; + data['LastNameN'] = this.lastNameN; + data['FirstName'] = this.firstName; + data['MiddleName'] = this.middleName; + data['LastName'] = this.lastName; + data['StrDateofBirth'] = this.strDateofBirth; + data['DateofBirth'] = this.dateofBirth; + data['Gender'] = this.gender; + data['NationalityID'] = this.nationalityID; + data['DateofBirthN'] = this.dateofBirthN; + data['EmailAddress'] = this.emailAddress; + data['SourceType'] = this.sourceType; + data['PreferredLanguage'] = this.preferredLanguage; + data['Marital'] = this.marital; + data['eHealthIDField'] = this.eHealthIDField; + return data; + } +} diff --git a/lib/core/model/PatientRegistration/SendActivationCodebyOTPNotificationTypeForRegistrationModel.dart b/lib/core/model/PatientRegistration/SendActivationCodebyOTPNotificationTypeForRegistrationModel.dart new file mode 100644 index 00000000..8244a95f --- /dev/null +++ b/lib/core/model/PatientRegistration/SendActivationCodebyOTPNotificationTypeForRegistrationModel.dart @@ -0,0 +1,109 @@ +class SendActivationCodeByOTPNotificationTypeForRegistrationModel { + int patientMobileNumber; + String mobileNo; + int projectOutSA; + int loginType; + String zipCode; + bool isRegister; + String logInTokenID; + int searchType; + int patientID; + int nationalID; + int patientIdentificationID; + int oTPSendType; + int languageID; + double versionID; + int channel; + String iPAdress; + String generalid; + int patientOutSA; + Null sessionID; + bool isDentalAllowedBackend; + int deviceTypeID; + String dOB; + int isHijri; + String healthId; + + SendActivationCodeByOTPNotificationTypeForRegistrationModel( + {this.patientMobileNumber, + this.mobileNo, + this.projectOutSA, + this.loginType, + this.zipCode, + this.isRegister, + this.logInTokenID, + this.searchType, + this.patientID, + this.nationalID, + this.patientIdentificationID, + this.oTPSendType, + this.languageID, + this.versionID, + this.channel, + this.iPAdress, + this.generalid, + this.patientOutSA, + this.sessionID, + this.isDentalAllowedBackend, + this.deviceTypeID, + this.dOB, + this.isHijri, + this.healthId}); + + SendActivationCodeByOTPNotificationTypeForRegistrationModel.fromJson( + Map json) { + patientMobileNumber = json['PatientMobileNumber']; + mobileNo = json['MobileNo']; + projectOutSA = json['ProjectOutSA']; + loginType = json['LoginType']; + zipCode = json['ZipCode']; + isRegister = json['isRegister']; + logInTokenID = json['LogInTokenID']; + searchType = json['SearchType']; + patientID = json['PatientID']; + nationalID = json['NationalID']; + patientIdentificationID = json['PatientIdentificationID']; + oTPSendType = json['OTP_SendType']; + languageID = json['LanguageID']; + versionID = json['VersionID']; + channel = json['Channel']; + iPAdress = json['IPAdress']; + generalid = json['generalid']; + patientOutSA = json['PatientOutSA']; + sessionID = json['SessionID']; + isDentalAllowedBackend = json['isDentalAllowedBackend']; + deviceTypeID = json['DeviceTypeID']; + dOB = json['DOB']; + isHijri = json['IsHijri']; + healthId = json['HealthId']; + } + + Map toJson() { + final Map data = new Map(); + data['PatientMobileNumber'] = this.patientMobileNumber; + data['MobileNo'] = this.mobileNo; + data['ProjectOutSA'] = this.projectOutSA; + data['LoginType'] = this.loginType; + data['ZipCode'] = this.zipCode; + data['isRegister'] = this.isRegister; + data['LogInTokenID'] = this.logInTokenID; + data['SearchType'] = this.searchType; + data['PatientID'] = this.patientID; + data['NationalID'] = this.nationalID; + data['PatientIdentificationID'] = this.patientIdentificationID; + data['OTP_SendType'] = this.oTPSendType; + data['LanguageID'] = this.languageID; + data['VersionID'] = this.versionID; + data['Channel'] = this.channel; + data['IPAdress'] = this.iPAdress; + data['generalid'] = this.generalid; + data['PatientOutSA'] = this.patientOutSA; + data['SessionID'] = this.sessionID; + data['isDentalAllowedBackend'] = this.isDentalAllowedBackend; + data['DeviceTypeID'] = this.deviceTypeID; + data['DOB'] = this.dOB; + data['IsHijri'] = this.isHijri; + data['HealthId'] = this.healthId; + return data; + } +} diff --git a/lib/core/model/diabetic_chart/DiabeticType.dart b/lib/core/model/diabetic_chart/DiabeticType.dart new file mode 100644 index 00000000..26641e61 --- /dev/null +++ b/lib/core/model/diabetic_chart/DiabeticType.dart @@ -0,0 +1,21 @@ +class DiabeticType { + int value; + String nameEn; + String nameAr; + + DiabeticType({this.value, this.nameEn, this.nameAr}); + + DiabeticType.fromJson(Map json) { + value = json['value']; + nameEn = json['nameEn']; + nameAr = json['nameAr']; + } + + Map toJson() { + final Map data = new Map(); + data['value'] = this.value; + data['nameEn'] = this.nameEn; + data['nameAr'] = this.nameAr; + return data; + } +} diff --git a/lib/core/model/diabetic_chart/GetDiabeticChartValuesRequestModel.dart b/lib/core/model/diabetic_chart/GetDiabeticChartValuesRequestModel.dart new file mode 100644 index 00000000..7fad3106 --- /dev/null +++ b/lib/core/model/diabetic_chart/GetDiabeticChartValuesRequestModel.dart @@ -0,0 +1,44 @@ +class GetDiabeticChartValuesRequestModel { + int deviceTypeID; + int patientID; + int resultType; + int admissionNo; + String setupID; + bool patientOutSA; + int patientType; + int patientTypeID; + + GetDiabeticChartValuesRequestModel( + {this.deviceTypeID, + this.patientID, + this.resultType, + this.admissionNo, + this.setupID, + this.patientOutSA, + this.patientType, + this.patientTypeID}); + + GetDiabeticChartValuesRequestModel.fromJson(Map json) { + deviceTypeID = json['DeviceTypeID']; + patientID = json['PatientID']; + resultType = json['ResultType']; + admissionNo = json['AdmissionNo']; + setupID = json['SetupID']; + patientOutSA = json['PatientOutSA']; + patientType = json['PatientType']; + patientTypeID = json['PatientTypeID']; + } + + Map toJson() { + final Map data = new Map(); + data['DeviceTypeID'] = this.deviceTypeID; + data['PatientID'] = this.patientID; + data['ResultType'] = this.resultType; + data['AdmissionNo'] = this.admissionNo; + data['SetupID'] = this.setupID; + data['PatientOutSA'] = this.patientOutSA; + data['PatientType'] = this.patientType; + data['PatientTypeID'] = this.patientTypeID; + return data; + } +} diff --git a/lib/core/model/diabetic_chart/GetDiabeticChartValuesResponseModel.dart b/lib/core/model/diabetic_chart/GetDiabeticChartValuesResponseModel.dart new file mode 100644 index 00000000..fa2c1ca2 --- /dev/null +++ b/lib/core/model/diabetic_chart/GetDiabeticChartValuesResponseModel.dart @@ -0,0 +1,36 @@ +class GetDiabeticChartValuesResponseModel { + String resultType; + int admissionNo; + String dateChart; + int resultValue; + int createdBy; + String createdOn; + + GetDiabeticChartValuesResponseModel( + {this.resultType, + this.admissionNo, + this.dateChart, + this.resultValue, + this.createdBy, + this.createdOn}); + + GetDiabeticChartValuesResponseModel.fromJson(Map json) { + resultType = json['ResultType']; + admissionNo = json['AdmissionNo']; + dateChart = json['DateChart']; + resultValue = json['ResultValue']; + createdBy = json['CreatedBy']; + createdOn = json['CreatedOn']; + } + + Map toJson() { + final Map data = new Map(); + data['ResultType'] = this.resultType; + data['AdmissionNo'] = this.admissionNo; + data['DateChart'] = this.dateChart; + data['ResultValue'] = this.resultValue; + data['CreatedBy'] = this.createdBy; + data['CreatedOn'] = this.createdOn; + return data; + } +} diff --git a/lib/core/model/diagnosis/GetDiagnosisForInPatientResponseModel.dart b/lib/core/model/diagnosis/GetDiagnosisForInPatientResponseModel.dart index c4a4e528..1ec48964 100644 --- a/lib/core/model/diagnosis/GetDiagnosisForInPatientResponseModel.dart +++ b/lib/core/model/diagnosis/GetDiagnosisForInPatientResponseModel.dart @@ -8,6 +8,8 @@ class GetDiagnosisForInPatientResponseModel { String createdOn; int editedBy; String editedOn; + String createdByName; + String editedByName; GetDiagnosisForInPatientResponseModel( {this.iCDCode10ID, @@ -18,7 +20,7 @@ class GetDiagnosisForInPatientResponseModel { this.createdBy, this.createdOn, this.editedBy, - this.editedOn}); + this.editedOn, this.createdByName}); GetDiagnosisForInPatientResponseModel.fromJson(Map json) { iCDCode10ID = json['ICDCode10ID']; @@ -30,6 +32,8 @@ class GetDiagnosisForInPatientResponseModel { createdOn = json['CreatedOn']; editedBy = json['EditedBy']; editedOn = json['EditedOn']; + createdByName = json['CreatedByName']; + editedByName = json['EditedByName']; } Map toJson() { diff --git a/lib/core/model/note/GetNursingProgressNoteResposeModel.dart b/lib/core/model/note/GetNursingProgressNoteResposeModel.dart index 55ede866..fb7fbcec 100644 --- a/lib/core/model/note/GetNursingProgressNoteResposeModel.dart +++ b/lib/core/model/note/GetNursingProgressNoteResposeModel.dart @@ -6,13 +6,19 @@ class GetNursingProgressNoteResposeModel { dynamic editedBy; dynamic editedOn; + String createdByName; + + String editedByName; + GetNursingProgressNoteResposeModel( {this.notes, - this.conditionType, - this.createdBy, - this.createdOn, - this.editedBy, - this.editedOn}); + this.conditionType, + this.createdBy, + this.createdOn, + this.editedBy, + this.editedOn, + this.editedByName, + this.createdByName}); GetNursingProgressNoteResposeModel.fromJson(Map json) { notes = json['Notes']; @@ -21,6 +27,8 @@ class GetNursingProgressNoteResposeModel { createdOn = json['CreatedOn']; editedBy = json['EditedBy']; editedOn = json['EditedOn']; + createdByName = json['CreatedByName']; + editedByName = json['EditedByName']; } Map toJson() { diff --git a/lib/core/service/PatientRegistrationService.dart b/lib/core/service/PatientRegistrationService.dart new file mode 100644 index 00000000..fefa9021 --- /dev/null +++ b/lib/core/service/PatientRegistrationService.dart @@ -0,0 +1,51 @@ +import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/core/model/PatientRegistration/CheckActivationCodeModel.dart'; +import 'package:doctor_app_flutter/core/model/PatientRegistration/CheckPatientForRegistrationModel.dart'; +import 'package:doctor_app_flutter/core/model/PatientRegistration/PatientRegistrationModel.dart'; +import 'package:doctor_app_flutter/core/model/PatientRegistration/SendActivationCodebyOTPNotificationTypeForRegistrationModel.dart'; +import 'package:doctor_app_flutter/core/service/base/base_service.dart'; + +class PatientRegistrationService extends BaseService { + checkPatientForRegistration( + CheckPatientForRegistrationModel registrationModel) async { + hasError = false; + await baseAppClient.post(CHECK_PATIENT_FOR_REGISTRATION, + onSuccess: (dynamic response, int statusCode) {}, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: registrationModel.toJson()); + } + + sendActivationCodeByOTPNotificationType( + SendActivationCodeByOTPNotificationTypeForRegistrationModel + registrationModel) async { + hasError = false; + await baseAppClient.post(SEND_ACTIVATION_CODE_BY_OTP_NOT_TYPE, + onSuccess: (dynamic response, int statusCode) {}, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: registrationModel.toJson()); + } + + checkActivationCode(CheckActivationCodeModel registrationModel) async { + hasError = false; + await baseAppClient.post(CHECK_ACTIVATION_CODE_FOR_PATIENT, + onSuccess: (dynamic response, int statusCode) {}, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: registrationModel.toJson()); + } + + registrationPatient(PatientRegistrationModel registrationModel) async { + hasError = false; + await baseAppClient.post(PATIENT_REGISTRATION, + onSuccess: (dynamic response, int statusCode) {}, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: registrationModel.toJson()); + } +} diff --git a/lib/core/service/base/base_service.dart b/lib/core/service/base/base_service.dart index ade01d9b..58526da7 100644 --- a/lib/core/service/base/base_service.dart +++ b/lib/core/service/base/base_service.dart @@ -1,5 +1,4 @@ import 'package:doctor_app_flutter/client/base_app_client.dart'; -import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; @@ -44,38 +43,5 @@ class BaseService { } } - Future getPatientArrivalList(String date,{String fromDate, int patientMrn = -1, int appointmentNo = -1}) async{ - hasError = false; - Map body = Map(); - body['From'] = fromDate == null ? date : fromDate; - body['To'] = date; - body['PageIndex'] = 0; - body['PageSize'] = 0; - if(patientMrn != -1){ - body['PatientMRN'] = patientMrn; - } - if(appointmentNo != -1){ - body['AppointmentNo'] = appointmentNo; - } - - await baseAppClient.post( - ARRIVED_PATIENT_URL, - onSuccess: (dynamic response, int statusCode) { - patientArrivalList.clear(); - - if(response['patientArrivalList']['entityList'] != null){ - response['patientArrivalList']['entityList'].forEach((v) { - PatiantInformtion item = PatiantInformtion.fromJson(v); - patientArrivalList.add(item); - }); - } - }, - onFailure: (String error, int statusCode) { - hasError = true; - this.error = error; - }, - body: body, - ); - } } diff --git a/lib/core/service/operation_report_servive.dart b/lib/core/service/operation_report_servive.dart index 4eb7ad8d..7ac4ade7 100644 --- a/lib/core/service/operation_report_servive.dart +++ b/lib/core/service/operation_report_servive.dart @@ -1,42 +1,68 @@ import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/core/service/base/base_service.dart'; import 'package:doctor_app_flutter/models/operation_report/create_update_operation_report_request_model.dart'; -import 'package:doctor_app_flutter/models/operation_report/get_operation_report_model.dart'; -import 'package:doctor_app_flutter/models/operation_report/get_operation_report_request_model.dart'; +import 'package:doctor_app_flutter/models/operation_report/get_operation_details_request_modle.dart'; +import 'package:doctor_app_flutter/models/operation_report/get_operation_details_response_modle.dart'; +import 'package:doctor_app_flutter/models/operation_report/get_reservations_response_model.dart'; +import 'package:doctor_app_flutter/models/operation_report/get_reservations_request_model.dart'; class OperationReportService extends BaseService { - List get _operationReportList => List(); - List get operationReportList => _operationReportList; + List _reservationList = []; + List get reservationList => _reservationList; - Future getOperationReport( - {GetOperationReportRequestModel getOperationReportRequestModel, + List _operationDetailsList = []; + List get operationDetailsList => _operationDetailsList; + + Future getReservations( + {GetReservationsRequestModel getReservationsRequestModel, int patientId}) async { - getOperationReportRequestModel = - GetOperationReportRequestModel(patientID: patientId); + getReservationsRequestModel = + GetReservationsRequestModel(patientID: patientId, doctorID: ""); hasError = false; - await baseAppClient.post(GET_OPERATION_REPORT, + await baseAppClient.post(GET_RESERVATIONS, onSuccess: (dynamic response, int statusCode) { print("Success"); - _operationReportList.clear(); + _reservationList.clear(); response['List_OTReservationDetails'].forEach( (v) { - _operationReportList.add(GetOperationReportModel.fromJson(v)); + _reservationList.add(GetReservationsResponseModel.fromJson(v)); }, ); }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; - }, body: getOperationReportRequestModel.toJson()); + }, body: getReservationsRequestModel.toJson()); } - Future updateOperationReport(CreateUpdateOperationReportRequestModel createUpdateOperationReport) async { - await baseAppClient.post(UPDATE_OPERATION_REPORT, + Future getOperationReportDetails( + {GetOperationDetailsRequestModel getOperationReportRequestModel, + }) async { + + hasError = false; + await baseAppClient.post(GET_OPERATION_DETAILS, onSuccess: (dynamic response, int statusCode) { + print("Success"); + _operationDetailsList.clear(); + response['List_OperationDetails'].forEach( + (v) { + _operationDetailsList.add(GetOperationDetailsResponseModel.fromJson(v)); + }, + ); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: getOperationReportRequestModel.toJson()); + } - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }, body: createUpdateOperationReport.toJson(),isFallLanguage: true); + Future updateOperationReport( + CreateUpdateOperationReportRequestModel + createUpdateOperationReport) async { + await baseAppClient.post(UPDATE_OPERATION_REPORT, + onSuccess: (dynamic response, int statusCode) {}, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: createUpdateOperationReport.toJson(), isFallLanguage: true); } } diff --git a/lib/core/service/patient/PatientRegisterService.dart b/lib/core/service/patient/PatientRegisterService.dart deleted file mode 100644 index a7013a3c..00000000 --- a/lib/core/service/patient/PatientRegisterService.dart +++ /dev/null @@ -1,5 +0,0 @@ -import 'package:doctor_app_flutter/core/service/base/base_service.dart'; - -class PatientRegisterService extends BaseService{ - -} \ No newline at end of file diff --git a/lib/core/service/patient/patient_service.dart b/lib/core/service/patient/patient_service.dart index a3272201..f79e342c 100644 --- a/lib/core/service/patient/patient_service.dart +++ b/lib/core/service/patient/patient_service.dart @@ -1,6 +1,8 @@ import 'package:doctor_app_flutter/client/base_app_client.dart'; import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; +import 'package:doctor_app_flutter/core/model/diabetic_chart/GetDiabeticChartValuesRequestModel.dart'; +import 'package:doctor_app_flutter/core/model/diabetic_chart/GetDiabeticChartValuesResponseModel.dart'; import 'package:doctor_app_flutter/core/model/diagnosis/GetDiagnosisForInPatientRequestModel.dart'; import 'package:doctor_app_flutter/core/model/diagnosis/GetDiagnosisForInPatientResponseModel.dart'; import 'package:doctor_app_flutter/core/model/note/CreateNoteModel.dart'; @@ -66,6 +68,9 @@ class PatientService extends BaseService { List _diagnosisForInPatientList = []; List get diagnosisForInPatientList => _diagnosisForInPatientList; + List _diabeticChartValuesList = []; + + List get diabeticChartValuesList => _diabeticChartValuesList; // TODO: replace var with model var _insuranceApporvalsList = []; @@ -515,4 +520,24 @@ class PatientService extends BaseService { body: getDiagnosisForInPatientRequestModel.toJson(), ); } + + + Future getDiabeticChartValues(GetDiabeticChartValuesRequestModel getDiabeticChartValuesRequestModel) async { + hasError = false; + + await baseAppClient.post( + GET_DIABETIC_CHART_VALUES, + onSuccess: (dynamic response, int statusCode) { + _diabeticChartValuesList = []; + response['List_DiabeticChartValues'].forEach((v) { + _diabeticChartValuesList.add( GetDiabeticChartValuesResponseModel.fromJson(v)); + }); + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + body: getDiabeticChartValuesRequestModel.toJson(), + ); + } } diff --git a/lib/core/viewModel/PatientRegisterViewModel.dart b/lib/core/viewModel/PatientRegisterViewModel.dart deleted file mode 100644 index 43aa7500..00000000 --- a/lib/core/viewModel/PatientRegisterViewModel.dart +++ /dev/null @@ -1,8 +0,0 @@ -import 'package:doctor_app_flutter/core/service/patient/PatientRegisterService.dart'; -import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart'; - -import '../../locator.dart'; - -class PatientRegisterViewModel extends BaseViewModel { - PatientRegisterService _service = locator(); -} \ No newline at end of file diff --git a/lib/core/viewModel/PatientRegistrationViewModel.dart b/lib/core/viewModel/PatientRegistrationViewModel.dart new file mode 100644 index 00000000..6dddffcd --- /dev/null +++ b/lib/core/viewModel/PatientRegistrationViewModel.dart @@ -0,0 +1,59 @@ +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/model/PatientRegistration/CheckActivationCodeModel.dart'; +import 'package:doctor_app_flutter/core/model/PatientRegistration/CheckPatientForRegistrationModel.dart'; +import 'package:doctor_app_flutter/core/model/PatientRegistration/PatientRegistrationModel.dart'; +import 'package:doctor_app_flutter/core/model/PatientRegistration/SendActivationCodebyOTPNotificationTypeForRegistrationModel.dart'; +import 'package:doctor_app_flutter/core/service/PatientRegistrationService.dart'; +import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart'; + +import '../../locator.dart'; + +class PatientRegistrationViewModel extends BaseViewModel { + PatientRegistrationService _patientRegistrationService = + locator(); + + Future checkPatientForRegistration( + CheckPatientForRegistrationModel registrationModel) async { + setState(ViewState.Busy); + await _patientRegistrationService + .checkPatientForRegistration(registrationModel); + if (_patientRegistrationService.hasError) { + error = _patientRegistrationService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } + + Future sendActivationCodeByOTPNotificationType( + SendActivationCodeByOTPNotificationTypeForRegistrationModel + registrationModel) async { + setState(ViewState.Busy); + await _patientRegistrationService + .sendActivationCodeByOTPNotificationType(registrationModel); + if (_patientRegistrationService.hasError) { + error = _patientRegistrationService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } + + Future checkActivationCode(CheckActivationCodeModel registrationModel) async { + setState(ViewState.Busy); + await _patientRegistrationService.checkActivationCode(registrationModel); + if (_patientRegistrationService.hasError) { + error = _patientRegistrationService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } + + Future registrationPatient(PatientRegistrationModel registrationModel) async { + setState(ViewState.Busy); + await _patientRegistrationService.registrationPatient(registrationModel); + if (_patientRegistrationService.hasError) { + error = _patientRegistrationService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } +} diff --git a/lib/core/viewModel/base_view_model.dart b/lib/core/viewModel/base_view_model.dart index 03f6e84a..d50a8d5a 100644 --- a/lib/core/viewModel/base_view_model.dart +++ b/lib/core/viewModel/base_view_model.dart @@ -22,7 +22,7 @@ class BaseViewModel extends ChangeNotifier { void setState(ViewState viewState) { _state = viewState; - notifyListeners(); + notifyListeners(); } Future getDoctorProfile({bool isGetProfile = false}) async { diff --git a/lib/core/viewModel/operation_report_view_model.dart b/lib/core/viewModel/operation_report_view_model.dart index 77867d95..2bfdebce 100644 --- a/lib/core/viewModel/operation_report_view_model.dart +++ b/lib/core/viewModel/operation_report_view_model.dart @@ -3,20 +3,38 @@ import 'package:doctor_app_flutter/core/service/operation_report_servive.dart'; import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart'; import 'package:doctor_app_flutter/locator.dart'; import 'package:doctor_app_flutter/models/operation_report/create_update_operation_report_request_model.dart'; -import 'package:doctor_app_flutter/models/operation_report/get_operation_report_model.dart'; +import 'package:doctor_app_flutter/models/operation_report/get_operation_details_request_modle.dart'; +import 'package:doctor_app_flutter/models/operation_report/get_operation_details_response_modle.dart'; +import 'package:doctor_app_flutter/models/operation_report/get_reservations_response_model.dart'; class OperationReportViewModel extends BaseViewModel { bool hasError = false; OperationReportService _operationReportService = locator(); - List get operationReportList => - _operationReportService.operationReportList; + List get reservationList => + _operationReportService.reservationList; - Future getOperationReport(int patientId) async { + List get operationDetailsList => + _operationReportService.operationDetailsList; + + Future getReservations(int patientId) async { + hasError = false; + setState(ViewState.Busy); + await _operationReportService.getReservations(patientId: patientId); + if (_operationReportService.hasError) { + error = _operationReportService.error; + setState(ViewState.ErrorLocal); + } else { + setState(ViewState.Idle); + } + } + + Future getOperationReportDetails(GetReservationsResponseModel reservation) async { hasError = false; setState(ViewState.Busy); - await _operationReportService.getOperationReport(patientId: patientId); + GetOperationDetailsRequestModel getOperationReportRequestModel = GetOperationDetailsRequestModel(reservationNo:reservation.oTReservationID, patientID: reservation.patientID, setupID: "010266" ); + await _operationReportService.getOperationReportDetails(getOperationReportRequestModel:getOperationReportRequestModel); if (_operationReportService.hasError) { error = _operationReportService.error; setState(ViewState.ErrorLocal); diff --git a/lib/core/viewModel/patient-referral-viewmodel.dart b/lib/core/viewModel/patient-referral-viewmodel.dart index 4240e848..93635629 100644 --- a/lib/core/viewModel/patient-referral-viewmodel.dart +++ b/lib/core/viewModel/patient-referral-viewmodel.dart @@ -256,17 +256,7 @@ class PatientReferralViewModel extends BaseViewModel { } } - Future getPatientDetails(String fromDate, String toDate, int patientMrn, int appointmentNo) async { - setState(ViewState.Busy); - await _referralPatientService.getPatientArrivalList(toDate, fromDate: fromDate, patientMrn: patientMrn); - if (_referralPatientService.hasError) { - error = _referralPatientService.error; - setState(ViewState.Error); - } else { - setState(ViewState.Idle); - } - } Future getReferralFrequencyList() async { setState(ViewState.Busy); diff --git a/lib/core/viewModel/patient_view_model.dart b/lib/core/viewModel/patient_view_model.dart index 38d23df9..1d5f087a 100644 --- a/lib/core/viewModel/patient_view_model.dart +++ b/lib/core/viewModel/patient_view_model.dart @@ -1,4 +1,6 @@ import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/model/diabetic_chart/GetDiabeticChartValuesRequestModel.dart'; +import 'package:doctor_app_flutter/core/model/diabetic_chart/GetDiabeticChartValuesResponseModel.dart'; import 'package:doctor_app_flutter/core/model/diagnosis/GetDiagnosisForInPatientRequestModel.dart'; import 'package:doctor_app_flutter/core/model/diagnosis/GetDiagnosisForInPatientResponseModel.dart'; import 'package:doctor_app_flutter/core/model/note/CreateNoteModel.dart'; @@ -25,43 +27,60 @@ class PatientViewModel extends BaseViewModel { List get inPatientList => _patientService.inPatientList; - List get patientVitalSignList => _patientService.patientVitalSignList; + List get patientVitalSignList => + _patientService.patientVitalSignList; - List get patientVitalSignOrderdSubList => _patientService.patientVitalSignOrderdSubList; + List get patientVitalSignOrderdSubList => + _patientService.patientVitalSignOrderdSubList; - List get patientLabResultOrdersList => _patientService.patientLabResultOrdersList; + List get patientLabResultOrdersList => + _patientService.patientLabResultOrdersList; - List get patientPrescriptionsList => _patientService.patientPrescriptionsList; + List get patientPrescriptionsList => + _patientService.patientPrescriptionsList; List get prescriptionReportForInPatientList => _patientService.prescriptionReportForInPatientList; - List get prescriptionReport => _patientService.prescriptionReport; + List get prescriptionReport => + _patientService.prescriptionReport; - List get patientRadiologyList => _patientService.patientRadiologyList; + List get patientRadiologyList => + _patientService.patientRadiologyList; List get labResultList => _patientService.labResultList; get insuranceApporvalsList => _patientService.insuranceApporvalsList; - List get patientProgressNoteList => _patientService.patientProgressNoteList; - List get patientNursingProgressNoteList => _patientService.patientNursingProgressNoteList; - List get diagnosisForInPatientList => _patientService.diagnosisForInPatientList; + List get patientProgressNoteList => + _patientService.patientProgressNoteList; + + List get patientNursingProgressNoteList => + _patientService.patientNursingProgressNoteList; + + List get diagnosisForInPatientList => + _patientService.diagnosisForInPatientList; + + List get diabeticChartValuesList => + _patientService.diabeticChartValuesList; List get clinicsList => _patientService.clinicsList; List get doctorsList => _patientService.doctorsList; - List get referralFrequencyList => _patientService.referalFrequancyList; + List get referralFrequencyList => + _patientService.referalFrequancyList; - Future getPatientList(patient, patientType, {bool isBusyLocal = false, isView}) async { + Future getPatientList(patient, patientType, + {bool isBusyLocal = false, isView}) async { var localRes; if (isBusyLocal) { setState(ViewState.BusyLocal); } else { setState(ViewState.Busy); } - localRes = await _patientService.getPatientList(patient, patientType, isView: isView); + localRes = await _patientService.getPatientList(patient, patientType, + isView: isView); if (_patientService.hasError) { error = _patientService.error; @@ -210,12 +229,16 @@ class PatientViewModel extends BaseViewModel { } List getDoctorNameList() { - var doctorNamelist = _patientService.doctorsList.map((value) => value['DoctorName'].toString()).toList(); + var doctorNamelist = _patientService.doctorsList + .map((value) => value['DoctorName'].toString()) + .toList(); return doctorNamelist; } List getClinicNameList() { - var clinicsNameslist = _patientService.clinicsList.map((value) => value['ClinicDescription'].toString()).toList(); + var clinicsNameslist = _patientService.clinicsList + .map((value) => value['ClinicDescription'].toString()) + .toList(); return clinicsNameslist; } @@ -230,8 +253,9 @@ class PatientViewModel extends BaseViewModel { } List getReferralNamesList() { - var referralNamesList = - _patientService.referalFrequancyList.map((value) => value['Description'].toString()).toList(); + var referralNamesList = _patientService.referalFrequancyList + .map((value) => value['Description'].toString()) + .toList(); return referralNamesList; } @@ -277,7 +301,8 @@ class PatientViewModel extends BaseViewModel { setState(ViewState.Idle); } - Future getInPatientList(PatientSearchRequestModel requestModel, {bool isMyInpatient = false}) async { + Future getInPatientList(PatientSearchRequestModel requestModel, + {bool isMyInpatient = false}) async { await getDoctorProfile(); setState(ViewState.Busy); @@ -291,7 +316,8 @@ class PatientViewModel extends BaseViewModel { } } - Future getNursingProgressNote(GetNursingProgressNoteRequestModel requestModel) async { + Future getNursingProgressNote( + GetNursingProgressNoteRequestModel requestModel) async { await getDoctorProfile(); setState(ViewState.Busy); @@ -303,7 +329,9 @@ class PatientViewModel extends BaseViewModel { setState(ViewState.Idle); } } - Future getDiagnosisForInPatient(GetDiagnosisForInPatientRequestModel requestModel) async { + + Future getDiagnosisForInPatient( + GetDiagnosisForInPatientRequestModel requestModel) async { await getDoctorProfile(); setState(ViewState.Busy); @@ -315,4 +343,32 @@ class PatientViewModel extends BaseViewModel { setState(ViewState.Idle); } } + + Future getDiabeticChartValues(PatiantInformtion patient, int resultType, + {bool isLocalBusy = false}) async { + await getDoctorProfile(); + if (isLocalBusy) + setState(ViewState.BusyLocal); + else + setState(ViewState.Busy); + + GetDiabeticChartValuesRequestModel requestModel = + GetDiabeticChartValuesRequestModel( + patientID: patient.patientId, + admissionNo: int.parse(patient.admissionNo), + patientTypeID: 1, + patientType: 1, + resultType: resultType, + setupID: "010266"); + await _patientService.getDiabeticChartValues(requestModel); + if (_patientService.hasError) { + error = _patientService.error; + if (isLocalBusy) + setState(ViewState.ErrorLocal); + else + setState(ViewState.ErrorLocal); + } else { + setState(ViewState.Idle); + } + } } diff --git a/lib/locator.dart b/lib/locator.dart index d67b2d35..243905d8 100644 --- a/lib/locator.dart +++ b/lib/locator.dart @@ -16,6 +16,7 @@ import 'package:get_it/get_it.dart'; import 'core/service/AnalyticsService.dart'; import 'core/service/NavigationService.dart'; +import 'core/service/PatientRegistrationService.dart'; import 'core/service/VideoCallService.dart'; import 'core/service/home/dasboard_service.dart'; import 'core/service/home/doctor_reply_service.dart'; @@ -25,7 +26,6 @@ import 'core/service/patient/DischargedPatientService.dart'; import 'core/service/patient/LiveCarePatientServices.dart'; import 'core/service/patient/MyReferralPatientService.dart'; import 'core/service/patient/PatientMuseService.dart'; -import 'core/service/patient/PatientRegisterService.dart'; import 'core/service/patient/ReferralService.dart'; import 'core/service/patient/out_patient_service.dart'; import 'core/service/patient/patient-doctor-referral-service.dart'; @@ -52,7 +52,7 @@ import 'core/viewModel/InsuranceViewModel.dart'; import 'core/viewModel/LiveCarePatientViewModel.dart'; import 'core/viewModel/PatientMedicalReportViewModel.dart'; import 'core/viewModel/PatientMuseViewModel.dart'; -import 'core/viewModel/PatientRegisterViewModel.dart'; +import 'core/viewModel/PatientRegistrationViewModel.dart'; import 'core/viewModel/PatientSearchViewModel.dart'; import 'core/viewModel/SOAP_view_model.dart'; import 'core/viewModel/doctor_replay_view_model.dart'; @@ -108,7 +108,7 @@ void setupLocator() { locator.registerLazySingleton(() => AnalyticsService()); locator.registerLazySingleton(() => OperationReportService()); locator.registerLazySingleton(() => PendingOrderService()); - locator.registerLazySingleton(() => PatientRegisterService()); + locator.registerLazySingleton(() => PatientRegistrationService()); /// View Model locator.registerFactory(() => DoctorReplayViewModel()); @@ -138,6 +138,7 @@ void setupLocator() { locator.registerFactory(() => PatientMedicalReportViewModel()); locator.registerFactory(() => ScanQrViewModel()); locator.registerFactory(() => OperationReportViewModel()); + locator.registerFactory(() => PatientRegistrationViewModel()); locator.registerFactory(() => PendingOrdersViewModel()); - locator.registerFactory(() => PatientRegisterViewModel()); + } diff --git a/lib/models/admisson_orders/admission_orders_model.dart b/lib/models/admisson_orders/admission_orders_model.dart index caea4d15..a0891a02 100644 --- a/lib/models/admisson_orders/admission_orders_model.dart +++ b/lib/models/admisson_orders/admission_orders_model.dart @@ -9,6 +9,7 @@ class AdmissionOrdersModel { int createdBy; String editedOn; int editedBy; + String createdByName; AdmissionOrdersModel( {this.procedureID, @@ -20,7 +21,8 @@ class AdmissionOrdersModel { this.createdOn, this.createdBy, this.editedOn, - this.editedBy}); + this.editedBy, + this.createdByName}); AdmissionOrdersModel.fromJson(Map json) { procedureID = json['ProcedureID']; @@ -33,6 +35,7 @@ class AdmissionOrdersModel { createdBy = json['CreatedBy']; editedOn = json['EditedOn']; editedBy = json['EditedBy']; + createdByName = json['CreatedByName']; } Map toJson() { @@ -47,6 +50,8 @@ class AdmissionOrdersModel { data['CreatedBy'] = this.createdBy; data['EditedOn'] = this.editedOn; data['EditedBy'] = this.editedBy; + data['CreatedByName'] = this.createdByName; + return data; } } diff --git a/lib/models/operation_report/get_operation_details_request_modle.dart b/lib/models/operation_report/get_operation_details_request_modle.dart new file mode 100644 index 00000000..7e23b503 --- /dev/null +++ b/lib/models/operation_report/get_operation_details_request_modle.dart @@ -0,0 +1,68 @@ +class GetOperationDetailsRequestModel { + bool isDentalAllowedBackend; + double versionID; + int channel; + int languageID; + String iPAdress; + String generalid; + int deviceTypeID; + String tokenID; + int patientID; + int reservationNo; + String sessionID; + int projectID; + String setupID; + bool patientOutSA; + + GetOperationDetailsRequestModel( + {this.isDentalAllowedBackend = false, + this.versionID, + this.channel, + this.languageID, + this.iPAdress, + this.generalid, + this.deviceTypeID, + this.tokenID, + this.patientID, + this.reservationNo, + this.sessionID, + this.projectID, + this.setupID, + this.patientOutSA}); + + GetOperationDetailsRequestModel.fromJson(Map json) { + isDentalAllowedBackend = json['isDentalAllowedBackend']; + versionID = json['VersionID']; + channel = json['Channel']; + languageID = json['LanguageID']; + iPAdress = json['IPAdress']; + generalid = json['generalid']; + deviceTypeID = json['DeviceTypeID']; + tokenID = json['TokenID']; + patientID = json['PatientID']; + reservationNo = json['reservationNo']; + sessionID = json['SessionID']; + projectID = json['ProjectID']; + setupID = json['SetupID']; + patientOutSA = json['PatientOutSA']; + } + + Map toJson() { + final Map data = new Map(); + data['isDentalAllowedBackend'] = this.isDentalAllowedBackend; + data['VersionID'] = this.versionID; + data['Channel'] = this.channel; + data['LanguageID'] = this.languageID; + data['IPAdress'] = this.iPAdress; + data['generalid'] = this.generalid; + data['DeviceTypeID'] = this.deviceTypeID; + data['TokenID'] = this.tokenID; + data['PatientID'] = this.patientID; + data['reservationNo'] = this.reservationNo; + data['SessionID'] = this.sessionID; + data['ProjectID'] = this.projectID; + data['SetupID'] = this.setupID; + data['PatientOutSA'] = this.patientOutSA; + return data; + } +} diff --git a/lib/models/operation_report/get_operation_details_response_modle.dart b/lib/models/operation_report/get_operation_details_response_modle.dart new file mode 100644 index 00000000..04540ea6 --- /dev/null +++ b/lib/models/operation_report/get_operation_details_response_modle.dart @@ -0,0 +1,148 @@ +class GetOperationDetailsResponseModel { + String setupID; + int projectID; + int reservationNo; + int patientID; + int admissionID; + dynamic surgeryDate; + String preOpDiagnosis; + String postOpDiagnosis; + String surgeon; + String assistant; + String anasthetist; + String operation; + String inasion; + String finding; + String surgeryProcedure; + String postOpInstruction; + bool isActive; + int createdBy; + String createdName; + dynamic createdNameN; + String createdOn; + dynamic editedBy; + dynamic editedByName; + dynamic editedByNameN; + dynamic editedOn; + dynamic oRBookStatus; + String complicationDetail; + String bloodLossDetail; + String histopathSpecimen; + String microbiologySpecimen; + String otherSpecimen; + dynamic scrubNurse; + dynamic circulatingNurse; + dynamic bloodTransfusedDetail; + + GetOperationDetailsResponseModel( + {this.setupID, + this.projectID, + this.reservationNo, + this.patientID, + this.admissionID, + this.surgeryDate, + this.preOpDiagnosis, + this.postOpDiagnosis, + this.surgeon, + this.assistant, + this.anasthetist, + this.operation, + this.inasion, + this.finding, + this.surgeryProcedure, + this.postOpInstruction, + this.isActive, + this.createdBy, + this.createdName, + this.createdNameN, + this.createdOn, + this.editedBy, + this.editedByName, + this.editedByNameN, + this.editedOn, + this.oRBookStatus, + this.complicationDetail, + this.bloodLossDetail, + this.histopathSpecimen, + this.microbiologySpecimen, + this.otherSpecimen, + this.scrubNurse, + this.circulatingNurse, + this.bloodTransfusedDetail}); + + GetOperationDetailsResponseModel.fromJson(Map json) { + setupID = json['SetupID']; + projectID = json['ProjectID']; + reservationNo = json['ReservationNo']; + patientID = json['PatientID']; + admissionID = json['AdmissionID']; + surgeryDate = json['SurgeryDate']; + preOpDiagnosis = json['PreOpDiagnosis']; + postOpDiagnosis = json['PostOpDiagnosis']; + surgeon = json['Surgeon']; + assistant = json['Assistant']; + anasthetist = json['Anasthetist']; + operation = json['Operation']; + inasion = json['Inasion']; + finding = json['Finding']; + surgeryProcedure = json['SurgeryProcedure']; + postOpInstruction = json['PostOpInstruction']; + isActive = json['IsActive']; + createdBy = json['CreatedBy']; + createdName = json['CreatedName']; + createdNameN = json['CreatedNameN']; + createdOn = json['CreatedOn']; + editedBy = json['EditedBy']; + editedByName = json['EditedByName']; + editedByNameN = json['EditedByNameN']; + editedOn = json['EditedOn']; + oRBookStatus = json['ORBookStatus']; + complicationDetail = json['ComplicationDetail']; + bloodLossDetail = json['BloodLossDetail']; + histopathSpecimen = json['HistopathSpecimen']; + microbiologySpecimen = json['MicrobiologySpecimen']; + otherSpecimen = json['OtherSpecimen']; + scrubNurse = json['ScrubNurse']; + circulatingNurse = json['CirculatingNurse']; + bloodTransfusedDetail = json['BloodTransfusedDetail']; + } + + Map toJson() { + final Map data = new Map(); + data['SetupID'] = this.setupID; + data['ProjectID'] = this.projectID; + data['ReservationNo'] = this.reservationNo; + data['PatientID'] = this.patientID; + data['AdmissionID'] = this.admissionID; + data['SurgeryDate'] = this.surgeryDate; + data['PreOpDiagnosis'] = this.preOpDiagnosis; + data['PostOpDiagnosis'] = this.postOpDiagnosis; + data['Surgeon'] = this.surgeon; + data['Assistant'] = this.assistant; + data['Anasthetist'] = this.anasthetist; + data['Operation'] = this.operation; + data['Inasion'] = this.inasion; + data['Finding'] = this.finding; + data['SurgeryProcedure'] = this.surgeryProcedure; + data['PostOpInstruction'] = this.postOpInstruction; + data['IsActive'] = this.isActive; + data['CreatedBy'] = this.createdBy; + data['CreatedName'] = this.createdName; + data['CreatedNameN'] = this.createdNameN; + data['CreatedOn'] = this.createdOn; + data['EditedBy'] = this.editedBy; + data['EditedByName'] = this.editedByName; + data['EditedByNameN'] = this.editedByNameN; + data['EditedOn'] = this.editedOn; + data['ORBookStatus'] = this.oRBookStatus; + data['ComplicationDetail'] = this.complicationDetail; + data['BloodLossDetail'] = this.bloodLossDetail; + data['HistopathSpecimen'] = this.histopathSpecimen; + data['MicrobiologySpecimen'] = this.microbiologySpecimen; + data['OtherSpecimen'] = this.otherSpecimen; + data['ScrubNurse'] = this.scrubNurse; + data['CirculatingNurse'] = this.circulatingNurse; + data['BloodTransfusedDetail'] = this.bloodTransfusedDetail; + return data; + } +} diff --git a/lib/models/operation_report/get_operation_report_request_model.dart b/lib/models/operation_report/get_reservations_request_model.dart similarity index 91% rename from lib/models/operation_report/get_operation_report_request_model.dart rename to lib/models/operation_report/get_reservations_request_model.dart index 6fc969ee..06425254 100644 --- a/lib/models/operation_report/get_operation_report_request_model.dart +++ b/lib/models/operation_report/get_reservations_request_model.dart @@ -1,4 +1,4 @@ -class GetOperationReportRequestModel { +class GetReservationsRequestModel { int patientID; int projectID; String doctorID; @@ -13,7 +13,7 @@ class GetOperationReportRequestModel { String tokenID; String sessionID; - GetOperationReportRequestModel( + GetReservationsRequestModel( {this.patientID, this.projectID, this.doctorID, @@ -28,7 +28,7 @@ class GetOperationReportRequestModel { this.tokenID, this.sessionID}); - GetOperationReportRequestModel.fromJson(Map json) { + GetReservationsRequestModel.fromJson(Map json) { patientID = json['PatientID']; projectID = json['ProjectID']; doctorID = json['DoctorID']; diff --git a/lib/models/operation_report/get_operation_report_model.dart b/lib/models/operation_report/get_reservations_response_model.dart similarity index 97% rename from lib/models/operation_report/get_operation_report_model.dart rename to lib/models/operation_report/get_reservations_response_model.dart index 29a0158c..3bebdc8b 100644 --- a/lib/models/operation_report/get_operation_report_model.dart +++ b/lib/models/operation_report/get_reservations_response_model.dart @@ -1,4 +1,4 @@ -class GetOperationReportModel { +class GetReservationsResponseModel { String setupID; int projectID; int oTReservationID; @@ -35,7 +35,7 @@ class GetOperationReportModel { String clinicDescription; Null clinicDescriptionN; - GetOperationReportModel( + GetReservationsResponseModel( {this.setupID, this.projectID, this.oTReservationID, @@ -72,7 +72,7 @@ class GetOperationReportModel { this.clinicDescription, this.clinicDescriptionN}); - GetOperationReportModel.fromJson(Map json) { + GetReservationsResponseModel.fromJson(Map json) { setupID = json['SetupID']; projectID = json['ProjectID']; oTReservationID = json['OTReservationID']; diff --git a/lib/routes.dart b/lib/routes.dart index 489ed512..da56ce33 100644 --- a/lib/routes.dart +++ b/lib/routes.dart @@ -4,6 +4,7 @@ import 'package:doctor_app_flutter/screens/medical-file/health_summary_page.dart import 'package:doctor_app_flutter/screens/patient-sick-leave/patient_sick_leave_screen.dart'; import 'package:doctor_app_flutter/screens/patients/ECGPage.dart'; import 'package:doctor_app_flutter/screens/patients/insurance_approval_screen_patient.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/diabetic_chart/diabetic_chart.dart'; import 'package:doctor_app_flutter/screens/patients/profile/diagnosis/diagnosis_screen.dart'; import 'package:doctor_app_flutter/screens/patients/profile/admission-orders/admission_orders_screen.dart'; import 'package:doctor_app_flutter/screens/patients/profile/lab_result/all_lab_special_result_page.dart'; @@ -77,6 +78,7 @@ const String PENDING_ORDERS = 'pending-orders'; const String ADMISSION_ORDERS = 'admission-orders'; const String NURSING_PROGRESS_NOTE = 'nursing_progress_note'; const String DIAGNOSIS_FOR_IN_PATIENT = 'get_diagnosis_for_in_patient'; +const String DIABETIC_CHART_VALUES = 'get_diabetic_chart_values'; //todo: change the routing way. var routes = { @@ -122,5 +124,8 @@ var routes = { ALL_SPECIAL_LAB_RESULT: (_) => AllLabSpecialResult(), GET_OPERATION_REPORT: (_) => OperationReportScreen(), PENDING_ORDERS: (_) => PendingOrdersScreen(), + NURSING_PROGRESS_NOTE: (_) => NursingProgressNoteScreen(), + DIAGNOSIS_FOR_IN_PATIENT: (_) => DiagnosisScreen(), ADMISSION_ORDERS: (_) => AdmissionOrdersScreen(), + DIABETIC_CHART_VALUES: (_) => DiabeticChart(), }; diff --git a/lib/screens/patients/profile/admission-orders/admission_orders_screen.dart b/lib/screens/patients/profile/admission-orders/admission_orders_screen.dart index b55aad9a..f83117e2 100644 --- a/lib/screens/patients/profile/admission-orders/admission_orders_screen.dart +++ b/lib/screens/patients/profile/admission-orders/admission_orders_screen.dart @@ -90,43 +90,12 @@ class _AdmissionOrdersScreenState extends State { widthFactor: 0.95, child: CardWithBgWidget( hasBorder: false, - // bgColor: model.admissionOrderList[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: [ - Row( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - SizedBox( - width: 10, - ), - SizedBox( - width: 10, - ) - ], - ), SizedBox( height: 10, ), @@ -155,14 +124,14 @@ class _AdmissionOrdersScreenState extends State { context) .createdBy .toString(), - fontSize: 10, + fontSize: 13, ), Expanded( child: AppText( model .admissionOrderList[ index] - .createdBy + .createdByName .toString() ?? '', fontWeight: @@ -180,10 +149,11 @@ class _AdmissionOrdersScreenState extends State { children: [ AppText( TranslationBase.of( - context) - .procedureName - .toString(), - fontSize: 10, + context) + .procedureName + .toString() + + ": ", + fontSize: 13, ), Expanded( child: AppText( @@ -211,7 +181,7 @@ class _AdmissionOrdersScreenState extends State { context) .orderNo .toString(), - fontSize: 10, + fontSize: 13, ), Expanded( child: AppText( @@ -229,34 +199,6 @@ class _AdmissionOrdersScreenState extends State { ), ], ), - // Row( - // crossAxisAlignment: - // CrossAxisAlignment - // .start, - // children: [ - // AppText( - // TranslationBase.of( - // context) - // .createdBy - // .toString(), - // fontSize: 10, - // ), - // Expanded( - // child: AppText( - // model - // .admissionOrderList[ - // index] - // .createdBy - // .toString() ?? - // '', - // fontWeight: - // FontWeight.w600, - // fontSize: 12, - // isCopyable: true, - // ), - // ), - // ], - // ), ], ), ), diff --git a/lib/screens/patients/profile/diabetic_chart/diabetic_chart.dart b/lib/screens/patients/profile/diabetic_chart/diabetic_chart.dart new file mode 100644 index 00000000..1aea89c2 --- /dev/null +++ b/lib/screens/patients/profile/diabetic_chart/diabetic_chart.dart @@ -0,0 +1,255 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/model/diabetic_chart/DiabeticType.dart'; +import 'package:doctor_app_flutter/core/viewModel/patient_view_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/models/patient/vital_sign/patient-vital-sign-history.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/diabetic_chart/line_chart_for_diabetic.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/vital_sign/vital_sign_details_blood_pressurewideget.dart'; +import 'package:doctor_app_flutter/util/date-utils.dart'; +import 'package:doctor_app_flutter/util/helpers.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/charts/app_time_series_chart.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-app-bar.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/card_with_bg_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/errors/dr_app_embedded_error.dart'; +import 'package:doctor_app_flutter/widgets/shared/errors/error_message.dart'; +import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart'; +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; + +import 'diabetic_details_blood_pressurewideget.dart'; + +class DiabeticChart extends StatefulWidget { + DiabeticChart({ + Key key, + }) : super(key: key); + + @override + _DiabeticChartState createState() => _DiabeticChartState(); +} + +class _DiabeticChartState extends State { + List timeSeriesData1 = []; + + List timeSeriesData2 = []; + + List diabeticType = [ + DiabeticType(nameAr: "Urine Glucose", nameEn: "Urine Glucose", value: 1), + DiabeticType(nameAr: "Urine Acet", nameEn: "Urine Acet", value: 2), + DiabeticType(nameAr: "Blood Glucose", nameEn: "Blood Glucose", value: 3), + DiabeticType(nameAr: "Blood Glucose(Glucometer)", nameEn: "Blood Glucose(Glucometer)", value: 4) + ]; + + DiabeticType selectedDiabeticType; + + @override + Widget build(BuildContext context) { + final routeArgs = ModalRoute.of(context).settings.arguments as Map; + PatiantInformtion patient = routeArgs['patient']; + ProjectViewModel projectsProvider = Provider.of(context); + return BaseView( + onModelReady: (model) async { + selectedDiabeticType = diabeticType[2]; + + await model.getDiabeticChartValues(patient, selectedDiabeticType.value, isLocalBusy: false); + generateData(model); + }, + builder: (_, model, w) => AppScaffold( + baseViewModel: model, + backgroundColor: Theme.of(context).scaffoldBackgroundColor, + appBar: PatientProfileAppBar( + patient, + isInpatient: true, + ), + body: SingleChildScrollView( + child: Column( + children: [ + Container( + width: MediaQuery.of(context).size.width * 0.7, + child: DropdownButtonHideUnderline( + child: DropdownButton( + dropdownColor: Colors.white, + iconEnabledColor: Colors.black, + isExpanded: true, + value: selectedDiabeticType.value, + iconSize: 25, + elevation: 16, + selectedItemBuilder: (BuildContext context) { + return diabeticType + .map((item) { + return Row( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: + MainAxisAlignment.end, + children: [ + Column( + mainAxisAlignment: + MainAxisAlignment.center, + children: [ + Container( + + padding: EdgeInsets.all(2), + margin: EdgeInsets.all(2), + decoration: new BoxDecoration( + color: Colors.red[800], + borderRadius: + BorderRadius.circular( + 20), + ), + constraints: BoxConstraints( + minWidth: 20, + minHeight: 20, + ), + child: Center( + child: AppText( + diabeticType + .length + .toString(), + color: Colors.white, + fontSize: projectsProvider + .isArabic + ? 10 + : 11, + textAlign: + TextAlign.center, + ), + )), + ], + ), + AppText( + selectedDiabeticType.nameEn, + fontSize: 12, + color: Colors.black, + fontWeight: FontWeight.bold, + textAlign: TextAlign.end), + ], + ); + }).toList(); + }, + onChanged: (newValue) async { + await onChangeFunc(newValue, model, patient); + setState(() { + + }); + }, + items: diabeticType + .map((item) { + return DropdownMenuItem( + child: AppText( + item.nameEn, + textAlign: TextAlign.left, + ), + value: item.value, + ); + }).toList(), + )), + ), + timeSeriesData1.length != 0 || timeSeriesData2.length != 0 + ? Padding( + padding: const EdgeInsets.all(10.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + + Container( + margin: EdgeInsets.symmetric(horizontal: 8), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(12)), + child: LineChartForDiabetic( + title: selectedDiabeticType.nameEn, + isOX: false, + timeSeries1: timeSeriesData1, + // timeSeries2: timeSeriesData2, + indexes: timeSeriesData1.length ~/ 5.5, + ), + ), + 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)), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + TranslationBase.of(context).graphDetails, + fontSize: SizeConfig.textMultiplier * 2.3, + fontWeight: FontWeight.bold, + fontFamily: 'Poppins', + ), + SizedBox( + height: 8, + ), + DiabeticDetails( + diabeticDetailsList: + model.diabeticChartValuesList, + ), + ], + ), + ), + ], + ), + ) + : ErrorMessage(error: TranslationBase.of(context).noItem), + ], + ), + )), + ); + } + + generateData(PatientViewModel model) { + if (model.diabeticChartValuesList.length > 0) { + model.diabeticChartValuesList.toList().forEach( + (element) { + DateTime elementDate = + AppDateUtils.getDateTimeFromServerFormat(element.dateChart); + if (element.resultValue.toInt() != 0) + timeSeriesData1.add( + TimeSeriesSales2( + new DateTime( + elementDate.year, elementDate.month, elementDate.day), + element.resultValue.toDouble(), + ), + ); + if (element.resultValue.toInt() != 0) + timeSeriesData2.add( + TimeSeriesSales2( + new DateTime( + elementDate.year, elementDate.month, elementDate.day), + element.resultValue.toDouble(), + ), + ); + }, + ); + } + } + + onChangeFunc(newValue, PatientViewModel model, patient) async { + GifLoaderDialogUtils.showMyDialog(context); + setState(() { + selectedDiabeticType = diabeticType[newValue-1]; + timeSeriesData1.clear(); + timeSeriesData2.clear(); + }); + + await model.getDiabeticChartValues(patient, selectedDiabeticType.value,isLocalBusy:true); + if(model.state == ViewState.ErrorLocal){ + Helpers.showErrorToast(model.error); + } + generateData(model); + GifLoaderDialogUtils.hideDialog(context); + + + + + } +} diff --git a/lib/screens/patients/profile/diabetic_chart/diabetic_details_blood_pressurewideget.dart b/lib/screens/patients/profile/diabetic_chart/diabetic_details_blood_pressurewideget.dart new file mode 100644 index 00000000..b3b1b581 --- /dev/null +++ b/lib/screens/patients/profile/diabetic_chart/diabetic_details_blood_pressurewideget.dart @@ -0,0 +1,123 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/model/diabetic_chart/GetDiabeticChartValuesResponseModel.dart'; +import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; +import 'package:doctor_app_flutter/models/patient/vital_sign/patient-vital-sign-history.dart'; +import 'package:doctor_app_flutter/util/date-utils.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; + +class DiabeticDetails extends StatefulWidget { + final List diabeticDetailsList; + + DiabeticDetails( + {Key key, this.diabeticDetailsList,}); + + @override + _VitalSignDetailsWidgetState createState() => _VitalSignDetailsWidgetState(); +} + +class _VitalSignDetailsWidgetState extends State { + @override + Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); + return Container( + margin: EdgeInsets.all(0), + child: Container( + color: Colors.transparent, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Expanded( + child: Container( + child: Container( + padding: EdgeInsets.all(8), + child: AppText( + TranslationBase.of(context).date, + fontSize: SizeConfig.textMultiplier * 1.5, + fontWeight: FontWeight.bold, + + fontFamily: 'Poppins', + ), + // height: 60, + ), + ), + ), + Expanded( + child: Container( + padding: EdgeInsets.all(8), + child: Container( + child: AppText( + "Result", + fontSize: SizeConfig.textMultiplier * 1.5, + fontWeight: FontWeight.bold, + fontFamily: 'Poppins', + ), + // height: 60 + ), + ), + ), + ], + ), + const Divider( + height: 1, + thickness: 1, + color: Colors.black, + ), + Table( + border: TableBorder( + horizontalInside: BorderSide(width: 1.0, color: Colors.grey[300]), + ), + children: fullData(projectViewModel), + ), + ], + ), + ), + ); + } + + List fullData(ProjectViewModel projectViewModel) { + List tableRow = []; + widget.diabeticDetailsList.forEach((diabetic) { + var data = diabetic.resultValue; + DateTime elementDate = + AppDateUtils.getDateTimeFromServerFormat(diabetic.dateChart); + if (data != 0) + tableRow.add(TableRow(children: [ + Container( + child: Container( + padding: EdgeInsets.all(10), + color: Colors.white, + child: AppText( + '${projectViewModel.isArabic ? AppDateUtils.getWeekDayArabic(elementDate.weekday) : AppDateUtils.getWeekDay(elementDate.weekday)}, ${elementDate.day} ${projectViewModel.isArabic ? AppDateUtils.getMonthArabic(elementDate.month) : AppDateUtils.getMonth(elementDate.month)}, ${elementDate.year} ${AppDateUtils.getHour(elementDate)}', + // textAlign: TextAlign.center, + fontSize: SizeConfig.textMultiplier * 1.6, + fontWeight: FontWeight.w600, + + fontFamily: 'Poppins', + ), + ), + ), + Container( + child: Container( + padding: EdgeInsets.all(10), + color: Colors.white, + child: AppText( + '${diabetic.resultValue}', + // textAlign: TextAlign.center, + fontSize: SizeConfig.textMultiplier * 1.6, + fontWeight: FontWeight.w600, + + fontFamily: 'Poppins', + ), + ), + ), + ])); + }); + return tableRow; + } +} diff --git a/lib/screens/patients/profile/diabetic_chart/line_chart_for_diabetic.dart b/lib/screens/patients/profile/diabetic_chart/line_chart_for_diabetic.dart new file mode 100644 index 00000000..671230c2 --- /dev/null +++ b/lib/screens/patients/profile/diabetic_chart/line_chart_for_diabetic.dart @@ -0,0 +1,237 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/charts/app_time_series_chart.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:fl_chart/fl_chart.dart'; +import 'package:flutter/material.dart'; + +class LineChartForDiabetic extends StatelessWidget { + final String title; + final List timeSeries1; + final int indexes; + final bool isOX; + + LineChartForDiabetic( + {this.title, this.timeSeries1, this.indexes, this.isOX= false}); + + List xAxixs = List(); + List yAxixs = List(); + + @override + Widget build(BuildContext context) { + getXaxix(); + return AspectRatio( + aspectRatio: 1.1, + child: Container( + decoration: const BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(18)), + // color: Colors.white, + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + const SizedBox( + height: 4, + ), + Container( + padding: const EdgeInsets.only(right: 18.0, left: 16.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + title, + fontSize: SizeConfig.textMultiplier * 2.1, + fontWeight: FontWeight.bold, + fontFamily: 'Poppins', + textAlign: TextAlign.center, + ), + ], + ), + ), + SizedBox( + height: 10, + ), + Expanded( + child: Padding( + padding: + const EdgeInsets.only(right: 18.0, left: 16.0, top: 15), + child: LineChart( + sampleData1(context), + swapAnimationDuration: const Duration(milliseconds: 250), + ), + ), + ), + SizedBox( + height: 10, + ), + ], + ), + ), + ); + } + + getXaxix() { + for (int index = 0; index < timeSeries1.length; index++) { + int mIndex = indexes * index; + if (mIndex < timeSeries1.length) { + xAxixs.add(mIndex); + } + } + } + + LineChartData sampleData1(context) { + return LineChartData( + lineTouchData: LineTouchData( + touchTooltipData: LineTouchTooltipData( + tooltipBgColor: Colors.white, + ), + touchCallback: (LineTouchResponse touchResponse) {}, + handleBuiltInTouches: true, + ), + gridData: FlGridData( + show: true, drawVerticalLine: true, drawHorizontalLine: true), + titlesData: FlTitlesData( + bottomTitles: SideTitles( + showTitles: true, + getTextStyles: (value) => const TextStyle( + color: Colors.black, + fontSize: 10, + ), + rotateAngle: -65, + //rotateAngle:-65, + interval: 100, + margin: 22, + getTitles: (value) { + if (timeSeries1.length < 15) { + if (timeSeries1.length > value.toInt()) { + return '${timeSeries1[value.toInt()].time.month}/ ${timeSeries1[value.toInt()].time.year}'; + } else + return ''; + } else { + if (value.toInt() == 0) + return '${timeSeries1[value.toInt()].time.month}/ ${timeSeries1[value.toInt()].time.year}'; + if (value.toInt() == timeSeries1.length - 1) + return '${timeSeries1[value.toInt()].time.month}/ ${timeSeries1[value.toInt()].time.year}'; + if (xAxixs.contains(value.toInt())) { + return '${timeSeries1[value.toInt()].time.month}/ ${timeSeries1[value.toInt()].time.year}'; + } + } + return ''; + }, + ), + leftTitles: SideTitles( + showTitles: true, + getTextStyles: (value) => const TextStyle( + color: Colors.black, + fontWeight: FontWeight.bold, + fontSize: 10, + ), + interval:getMaxY() - getMinY() <=500?50:getMaxY() - getMinY() <=1000?100:200, + + margin: 12, + ), + ), + borderData: FlBorderData( + show: true, + border: const Border( + bottom: BorderSide( + color: Colors.black, + width: 0.5, + ), + left: BorderSide( + color: Colors.black, + ), + right: BorderSide( + color: Colors.black, + ), + top: BorderSide( + color: Colors.transparent, + ), + ), + ), + minX: 0, + maxX: (timeSeries1.length - 1).toDouble(), + maxY: getMaxY() + 0.3, + minY: getMinY(), + lineBarsData: getData(context), + ); + } + + double getMaxY() { + double max = 0; + timeSeries1.forEach((element) { + double resultValueDouble = element.sales; + if (resultValueDouble > max) max = resultValueDouble; + }); + // timeSeries2.forEach((element) { + // double resultValueDouble = element.sales; + // if (resultValueDouble > max) max = resultValueDouble; + // }); + + return max.roundToDouble(); + } + + double getMinY() { + double min = timeSeries1[0].sales; + timeSeries1.forEach((element) { + double resultValueDouble = element.sales; + if (resultValueDouble < min) min = resultValueDouble; + }); + // timeSeries2.forEach((element) { + // double resultValueDouble = element.sales; + // if (resultValueDouble < min) min = resultValueDouble; + // }); + + int value = min.toInt(); + + return value.toDouble(); + } + + List getData(context) { + List spots = List(); + for (int index = 0; index < timeSeries1.length; index++) { + spots.add(FlSpot(index.toDouble(), timeSeries1[index].sales)); + } + + List spots2 = List(); + // for (int index = 0; index < timeSeries2.length; index++) { + // spots2.add(FlSpot(index.toDouble(), timeSeries2[index].sales)); + // } + + final LineChartBarData lineChartBarData1 = LineChartBarData( + spots: spots, + isCurved: true, + colors: [Colors.red], + barWidth: 5, + isStrokeCapRound: true, + dotData: FlDotData( + show: false, + ), + belowBarData: BarAreaData( + show: false, + ), + ); + final LineChartBarData lineChartBarData2 = LineChartBarData( + spots: spots2, + isCurved: true, + colors: [Colors.red], + barWidth: 5, + isStrokeCapRound: true, + dotData: FlDotData( + show: false, + ), + belowBarData: BarAreaData( + show: false, + ), + ); + + List lineChartData = List(); + if(spots.isNotEmpty){ + lineChartData.add(lineChartBarData1); + } + if(spots2.isNotEmpty){ + lineChartData.add(lineChartBarData2); + } + return lineChartData; + } +} diff --git a/lib/screens/patients/profile/diagnosis/diagnosis_screen.dart b/lib/screens/patients/profile/diagnosis/diagnosis_screen.dart index 2abc55ea..65e483b5 100644 --- a/lib/screens/patients/profile/diagnosis/diagnosis_screen.dart +++ b/lib/screens/patients/profile/diagnosis/diagnosis_screen.dart @@ -133,7 +133,7 @@ class _ProgressNoteState extends State { model .diagnosisForInPatientList[ index] - .createdBy + .createdByName .toString() ?? '', fontWeight: diff --git a/lib/screens/patients/profile/notes/nursing_note/nursing_note_screen.dart b/lib/screens/patients/profile/notes/nursing_note/nursing_note_screen.dart index d683bab4..0fbac8bf 100644 --- a/lib/screens/patients/profile/notes/nursing_note/nursing_note_screen.dart +++ b/lib/screens/patients/profile/notes/nursing_note/nursing_note_screen.dart @@ -135,7 +135,7 @@ class _ProgressNoteState extends State { model .patientNursingProgressNoteList[ index] - .createdBy + .createdByName .toString() ?? '', fontWeight: diff --git a/lib/screens/patients/profile/operation_report/operation_report.dart b/lib/screens/patients/profile/operation_report/operation_report.dart index 5e41092d..a445309e 100644 --- a/lib/screens/patients/profile/operation_report/operation_report.dart +++ b/lib/screens/patients/profile/operation_report/operation_report.dart @@ -46,41 +46,16 @@ class _ProgressNoteState extends State { AuthenticationViewModel authenticationViewModel; ProjectViewModel projectViewModel; - 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); - - print(type); - ProgressNoteRequest progressNoteRequest = ProgressNoteRequest( - visitType: widget.visitType, - // if equal 5 then this will return progress note - admissionNo: int.parse(patient.admissionNo), - projectID: patient.projectId, - tokenID: token, - patientTypeID: patient.patientType, - languageID: 2); - model - .getPatientProgressNote(progressNoteRequest.toJson(), - isLocalBusy: isLocalBusy) - .then((c) { - notesList = model.patientProgressNoteList; - }); - } - @override Widget build(BuildContext context) { authenticationViewModel = Provider.of(context); projectViewModel = Provider.of(context); final routeArgs = ModalRoute.of(context).settings.arguments as Map; PatiantInformtion patient = routeArgs['patient']; - String arrivalType = routeArgs['arrivalType']; if (routeArgs.containsKey('isDischargedPatient')) isDischargedPatient = routeArgs['isDischargedPatient']; return BaseView( - onModelReady: (model) => model.getOperationReport(patient.patientMRN), + onModelReady: (model) => model.getReservations(patient.patientMRN), builder: (_, model, w) => AppScaffold( baseViewModel: model, backgroundColor: Theme.of(context).scaffoldBackgroundColor, @@ -93,35 +68,14 @@ class _ProgressNoteState extends State { color: Colors.grey[200], child: Column( children: [ - AddNewOrder( - onTap: () async { - await locator().logEvent( - eventCategory: "Operation Report Screen", - eventAction: "Update Operation Report ", - ); - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => UpdateOperationReport( - operationReportViewModel: model, - patient: patient, - visitType: widget.visitType, - isUpdate: false, - ), - settings: RouteSettings(name: 'UpdateNoteOrder'), - ), - ); - }, - label: TranslationBase.of(context).operationReports, - ), - model.operationReportList == null || - model.operationReportList.length == 0 + model.reservationList == null || + model.reservationList.length == 0 ? DrAppEmbeddedError( error: TranslationBase.of(context).errorNoProgressNote) : Expanded( child: Container( child: ListView.builder( - itemCount: model.operationReportList.length, + itemCount: model.reservationList.length, itemBuilder: (BuildContext ctxt, int index) { return FractionallySizedBox( widthFactor: 0.95, @@ -133,283 +87,9 @@ class _ProgressNoteState extends State { Column( crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: + MainAxisAlignment.start, children: [ - if (model.operationReportList[index] - .status == - 1 && - authenticationViewModel - .doctorProfile.doctorID != - model - .operationReportList[ - index] - .createdBy) - AppText( - TranslationBase.of(context) - .notePending, - fontWeight: FontWeight.bold, - color: Color(0xFFCC9B14), - fontSize: 12, - ), - if (model.operationReportList[index] - .status == - 4) - AppText( - TranslationBase.of(context) - .noteCanceled, - fontWeight: FontWeight.bold, - color: Colors.red.shade700, - fontSize: 12, - ), - if (model.operationReportList[index] - .status == - 2) - AppText( - TranslationBase.of(context) - .noteVerified, - fontWeight: FontWeight.bold, - color: Colors.green[600], - fontSize: 12, - ), - if (model.operationReportList[index] - .status != - 2 && - model.operationReportList[index] - .status != - 4 && - authenticationViewModel - .doctorProfile.doctorID == - model - .operationReportList[ - index] - .createdBy) - Row( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - InkWell( - // onTap: () { - // Navigator.push( - // context, - // MaterialPageRoute( - // builder: (context) => - // UpdateNoteOrder( - // note: model - // .operationReportList[ - // index], - // patientModel: - // model, - // patient: - // patient, - // visitType: widget - // .visitType, - // isUpdate: true, - // )), - // ); - // }, - child: Container( - decoration: BoxDecoration( - color: Colors.grey[600], - borderRadius: - BorderRadius.circular( - 10), - ), - // color:Colors.red[600], - - child: Row( - children: [ - Icon( - DoctorApp.edit_1, - size: 12, - color: Colors.white, - ), - SizedBox( - width: 2, - ), - AppText( - TranslationBase.of( - context) - .update, - fontSize: 10, - color: Colors.white, - ), - ], - ), - padding: EdgeInsets.all(6), - ), - ), - SizedBox( - width: 10, - ), - // InkWell( - // onTap: () async { - // showMyDialog( - // 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, - // verifiedNote: true, - // patientTypeID: - // patient - // .patientType, - // patientOutSA: false, - // ); - // 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), - // ), - // // color:Colors.red[600], - // - // child: Row( - // children: [ - // Icon( - // FontAwesomeIcons - // .check, - // size: 12, - // color: Colors.white, - // ), - // SizedBox( - // width: 2, - // ), - // AppText( - // TranslationBase.of( - // context) - // .noteVerify, - // fontSize: 10, - // color: Colors.white, - // ), - // ], - // ), - // padding: EdgeInsets.all(6), - // ), - // ), - SizedBox( - width: 10, - ), - // InkWell( - // onTap: () async { - // showMyDialog( - // context: context, - // actionName: - // TranslationBase.of( - // context) - // .cancel, - // confirmFun: () async { - // GifLoaderDialogUtils - // .showMyDialog( - // context, - // ); - // 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, - // verifiedNote: false, - // patientTypeID: - // patient - // .patientType, - // patientOutSA: false, - // ); - // 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), - // ), - // // color:Colors.red[600], - // - // child: Row( - // children: [ - // Icon( - // FontAwesomeIcons - // .trash, - // size: 12, - // color: Colors.white, - // ), - // SizedBox( - // width: 2, - // ), - // AppText( - // 'Cancel', - // fontSize: 10, - // color: Colors.white, - // ), - // ], - // ), - // padding: EdgeInsets.all(6), - // ), - // ), - SizedBox( - width: 10, - ) - ], - ), - SizedBox( - height: 10, - ), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, @@ -439,7 +119,7 @@ class _ProgressNoteState extends State { Expanded( child: AppText( model - .operationReportList[ + .reservationList[ index] .doctorName ?? '', @@ -457,14 +137,14 @@ class _ProgressNoteState extends State { children: [ AppText( model - .operationReportList[ + .reservationList[ index] .createdOn != null ? AppDateUtils.getDayMonthYearDateFormatted( AppDateUtils .getDateTimeFromServerFormat(model - .operationReportList[ + .reservationList[ index] .createdOn), isArabic: @@ -482,14 +162,14 @@ class _ProgressNoteState extends State { ), AppText( model - .operationReportList[ + .reservationList[ index] .createdOn != null ? AppDateUtils.getHour( AppDateUtils .getDateTimeFromServerFormat(model - .operationReportList[ + .reservationList[ index] .createdOn)) : AppDateUtils.getHour( @@ -508,23 +188,174 @@ class _ProgressNoteState extends State { ), Row( mainAxisAlignment: - MainAxisAlignment.start, + MainAxisAlignment.start, children: [ + AppText( + "Reservation: ", + fontSize: 10, + ), Expanded( child: AppText( - model - .operationReportList[ - index] - .remarks, + model.reservationList[index].oTReservationID.toString(), fontSize: 10, ), - ), - ]) + ) + ]), + SizedBox( + height: 8, + ), + if (model.reservationList[index] + .operationDate != + null) + Row( + mainAxisAlignment: + MainAxisAlignment.start, + children: [ + AppText( + "Operation Date : ", + fontSize: 10, + ), + Expanded( + child: AppText( + AppDateUtils.getDayMonthYearDateFormatted( + AppDateUtils + .getDateTimeFromServerFormat(model + .reservationList[ + index] + .operationDate), + isArabic: + projectViewModel + .isArabic, + isMonthShort: true), + fontSize: 10, + ), + ) + ]), + if (model.reservationList[index] + .timeStart != + null) + Row( + mainAxisAlignment: + MainAxisAlignment.start, + children: [ + AppText( + "Operation Time Start : ", + fontSize: 10, + ), + Expanded( + child: AppText( + model + .reservationList[ + index] + .timeStart, + fontSize: 10, + ), + ) + ]), + if (model.reservationList[index] + .remarks != + null) + Row( + mainAxisAlignment: + MainAxisAlignment.start, + children: [ + AppText( + "Remarks : ", + fontSize: 10, + ), + Expanded( + child: AppText( + model + .reservationList[ + index] + .remarks ?? + '', + fontSize: 10, + ), + ), + ]) ], ), + SizedBox( height: 20, ), + + // if ( + // authenticationViewModel + // .doctorProfile.doctorID == + // model + // .operationReportList[ + // index] + // .createdBy) + Row( + crossAxisAlignment: + CrossAxisAlignment.start, + mainAxisAlignment: + MainAxisAlignment.end, + children: [ + InkWell( + onTap: () async { + await locator() + .logEvent( + eventCategory: + "Operation Report Screen", + eventAction: + "Update Operation Report ", + ); + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => + UpdateOperationReport( + reservation: model + .reservationList[ + index], + patient: patient, + isUpdate: true, + )), + ); + }, + child: Container( + decoration: BoxDecoration( + color: Colors.green[600], + borderRadius: + BorderRadius.circular(10), + ), + // color:Colors.red[600], + + child: Row( + children: [ + Icon( + DoctorApp.edit_1, + size: 12, + color: Colors.white, + ), + SizedBox( + width: 2, + ), + AppText( + "Operation Reports", + fontSize: 10, + color: Colors.white, + ), + ], + ), + padding: EdgeInsets.all(6), + ), + ), + SizedBox( + width: 10, + ), + SizedBox( + width: 10, + ), + ], + ), + + SizedBox( + height: 10, + ), ], ), ), diff --git a/lib/screens/patients/profile/operation_report/update_operation_report.dart b/lib/screens/patients/profile/operation_report/update_operation_report.dart index dc64acb5..0800bc16 100644 --- a/lib/screens/patients/profile/operation_report/update_operation_report.dart +++ b/lib/screens/patients/profile/operation_report/update_operation_report.dart @@ -12,8 +12,11 @@ import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart'; import 'package:doctor_app_flutter/models/operation_report/create_update_operation_report_request_model.dart'; +import 'package:doctor_app_flutter/models/operation_report/get_operation_details_response_modle.dart'; +import 'package:doctor_app_flutter/models/operation_report/get_reservations_response_model.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/models/patient/progress_note_request.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/patients/profile/soap_update/shared_soap_widgets/bottom_sheet_title.dart'; import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; import 'package:doctor_app_flutter/util/helpers.dart'; @@ -30,19 +33,19 @@ import 'package:speech_to_text/speech_recognition_error.dart'; import 'package:speech_to_text/speech_to_text.dart' as stt; class UpdateOperationReport extends StatefulWidget { - final NoteModel note; - final OperationReportViewModel operationReportViewModel; + final GetReservationsResponseModel reservation; + // final OperationReportViewModel operationReportViewModel; final PatiantInformtion patient; final int visitType; final bool isUpdate; const UpdateOperationReport( {Key key, - this.note, - this.operationReportViewModel, + // this.operationReportViewModel, this.patient, this.visitType, - this.isUpdate}) + this.isUpdate, + this.reservation}) : super(key: key); @override @@ -77,6 +80,7 @@ class _UpdateOperationReportState extends State { TextEditingController BloodTransfusedDetailController = TextEditingController(); TextEditingController anasthetistController = TextEditingController(); + TextEditingController OTReservationID = TextEditingController(); setSelectedType(int val) { setState(() { @@ -93,442 +97,528 @@ class _UpdateOperationReportState extends State { Widget build(BuildContext context) { projectViewModel = Provider.of(context); //TODO Elham* add translation to hints - return AppScaffold( - isShowAppBar: true, - backgroundColor: Theme.of(context).scaffoldBackgroundColor, - appBar: BottomSheetTitle( - title: (widget.isUpdate - ? TranslationBase.of(context).noteUpdate - : TranslationBase.of(context).noteAdd) + - TranslationBase.of(context).operationReports, - ), - body: SingleChildScrollView( - child: Container( - height: MediaQuery.of(context).size.height * 1.0, - child: Padding( - padding: EdgeInsets.all(0.0), - child: SingleChildScrollView( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - height: 10.0, - ), - SingleChildScrollView( - child: Center( - child: FractionallySizedBox( - widthFactor: 0.9, - child: Column( - children: [ - AppTextFieldCustom( - hintText: "Pre Op Diagmosis", - //TranslationBase.of(context).addoperationReports, - controller: preOpDiagmosisController, - maxLines: 1, - minLines: 1, - hasBorder: true, - - // isTextFieldHasSuffix: true, - validationError: - preOpDiagmosisController.text.isEmpty && - isSubmitted - ? TranslationBase.of(context).emptyMessage - : null, - ), - SizedBox( - height: 4, - ), - AppTextFieldCustom( - hintText: "Post Op Diagmosis", - //TranslationBase.of(context).addoperationReports, - controller: postOpDiagmosisNoteController, - maxLines: 1, - minLines: 1, - hasBorder: true, - - // isTextFieldHasSuffix: true, - validationError: - postOpDiagmosisNoteController.text.isEmpty && - isSubmitted - ? TranslationBase.of(context).emptyMessage - : null, - ), - SizedBox( - height: 4, - ), - AppTextFieldCustom( - hintText: "Surgeon", - //TranslationBase.of(context).addoperationReports, - controller: surgeonController, - maxLines: 1, - minLines: 1, - hasBorder: true, - - // isTextFieldHasSuffix: true, - validationError: - surgeonController.text.isEmpty && isSubmitted - ? TranslationBase.of(context).emptyMessage - : null, - ), - SizedBox( - height: 4, - ), - AppTextFieldCustom( - hintText: "assistant", - //TranslationBase.of(context).addoperationReports, - controller: assistantNoteController, - maxLines: 1, - minLines: 1, - hasBorder: true, - - // isTextFieldHasSuffix: true, - validationError: - assistantNoteController.text.isEmpty && - isSubmitted - ? TranslationBase.of(context).emptyMessage - : null, - ), - SizedBox( - height: 4, - ), - AppTextFieldCustom( - hintText: "Operation", - //TranslationBase.of(context).addoperationReports, - controller: operationController, - maxLines: 1, - minLines: 1, - hasBorder: true, - - // isTextFieldHasSuffix: true, - validationError: - operationController.text.isEmpty && - isSubmitted - ? TranslationBase.of(context).emptyMessage - : null, - ), - SizedBox( - height: 4, - ), - AppTextFieldCustom( - hintText: "inasion", - //TranslationBase.of(context).addoperationReports, - controller: inasionController, - maxLines: 1, - minLines: 1, - hasBorder: true, - - // isTextFieldHasSuffix: true, - validationError: - inasionController.text.isEmpty && isSubmitted - ? TranslationBase.of(context).emptyMessage - : null, - ), - SizedBox( - height: 4, - ), - AppTextFieldCustom( - hintText: "finding", - //TranslationBase.of(context).addoperationReports, - controller: findingController, - maxLines: 1, - minLines: 1, - hasBorder: true, - - // isTextFieldHasSuffix: true, - validationError: - findingController.text.isEmpty && isSubmitted - ? TranslationBase.of(context).emptyMessage - : null, - ), - SizedBox( - height: 4, - ), - AppTextFieldCustom( - hintText: "Surgery Procedure", - //TranslationBase.of(context).addoperationReports, - controller: surgeryProcedureController, - maxLines: 1, - minLines: 1, - hasBorder: true, - - // isTextFieldHasSuffix: true, - validationError: - surgeryProcedureController.text.isEmpty && - isSubmitted - ? TranslationBase.of(context).emptyMessage - : null, - ), - SizedBox( - height: 4, - ), - AppTextFieldCustom( - hintText: "Post Op Instruction", - //TranslationBase.of(context).addoperationReports, - controller: postOpInstructionController, - maxLines: 1, - minLines: 1, - hasBorder: true, - - // isTextFieldHasSuffix: true, - validationError: - postOpInstructionController.text.isEmpty && - isSubmitted - ? TranslationBase.of(context).emptyMessage - : null, - ), - SizedBox( - height: 4, - ), - AppTextFieldCustom( - hintText: "Complication Details", - //TranslationBase.of(context).addoperationReports, - controller: complicationDetailsController, - maxLines: 1, - minLines: 1, - hasBorder: true, - - // isTextFieldHasSuffix: true, - validationError: - complicationDetailsController.text.isEmpty && - isSubmitted - ? TranslationBase.of(context).emptyMessage - : null, - ), - SizedBox( - height: 4, - ), - AppTextFieldCustom( - hintText: "Blood Loss Detail", - //TranslationBase.of(context).addoperationReports, - controller: bloodLossDetailController, - maxLines: 1, - minLines: 1, - hasBorder: true, - - // isTextFieldHasSuffix: true, - validationError: - bloodLossDetailController.text.isEmpty && - isSubmitted - ? TranslationBase.of(context).emptyMessage - : null, - ), - SizedBox( - height: 4, - ), - AppTextFieldCustom( - hintText: "histopal the Specimen", - //TranslationBase.of(context).addoperationReports, - controller: histopathSpecimenController, - maxLines: 1, - minLines: 1, - hasBorder: true, - - // isTextFieldHasSuffix: true, - validationError: - histopathSpecimenController.text.isEmpty && - isSubmitted - ? TranslationBase.of(context).emptyMessage - : null, - ), - SizedBox( - height: 4, - ), - AppTextFieldCustom( - hintText: "microbiology Specimen ", - //TranslationBase.of(context).addoperationReports, - controller: microbiologySpecimenController, - maxLines: 1, - minLines: 1, - hasBorder: true, - - // isTextFieldHasSuffix: true, - validationError: - microbiologySpecimenController.text.isEmpty && - isSubmitted - ? TranslationBase.of(context).emptyMessage - : null, - ), - SizedBox( - height: 4, - ), - AppTextFieldCustom( - hintText: "other Specimen", - //TranslationBase.of(context).addoperationReports, - controller: otherSpecimenController, - maxLines: 1, - minLines: 1, - hasBorder: true, - - // isTextFieldHasSuffix: true, - validationError: - otherSpecimenController.text.isEmpty && - isSubmitted - ? TranslationBase.of(context).emptyMessage - : null, - ), - SizedBox( - height: 4, - ), - AppTextFieldCustom( - hintText: "scrub Nurse", - //TranslationBase.of(context).addoperationReports, - controller: scrubNurseController, - maxLines: 1, - minLines: 1, - hasBorder: true, - - // isTextFieldHasSuffix: true, - validationError: - scrubNurseController.text.isEmpty && - isSubmitted - ? TranslationBase.of(context).emptyMessage - : null, - ), - SizedBox( - height: 4, - ), - AppTextFieldCustom( - hintText: "circulating Nurse", - //TranslationBase.of(context).addoperationReports, - controller: circulatingNurseController, - maxLines: 1, - minLines: 1, - hasBorder: true, - - // isTextFieldHasSuffix: true, - validationError: - circulatingNurseController.text.isEmpty && - isSubmitted - ? TranslationBase.of(context).emptyMessage - : null, - ), - SizedBox( - height: 4, - ), - AppTextFieldCustom( - hintText: "Blood Transfused Detail", - //TranslationBase.of(context).addoperationReports, - controller: BloodTransfusedDetailController, - maxLines: 1, - minLines: 1, - hasBorder: true, - - // isTextFieldHasSuffix: true, - validationError: BloodTransfusedDetailController - .text.isEmpty && - isSubmitted - ? TranslationBase.of(context).emptyMessage - : null, - ), - SizedBox( - height: 4, - ), - AppTextFieldCustom( - hintText: "Anasthetist", - //TranslationBase.of(context).addoperationReports, - controller: anasthetistController, - maxLines: 1, - minLines: 1, - hasBorder: true, - - // isTextFieldHasSuffix: true, - validationError: - anasthetistController.text.isEmpty && - isSubmitted - ? TranslationBase.of(context).emptyMessage - : null, - ), - SizedBox( - height: 250, - ), - ], - ), + + return BaseView( + onModelReady: (model) async { + await model + .getOperationReportDetails(widget.reservation); + OTReservationID.text = widget.reservation.oTReservationID.toString(); + + if (model.operationDetailsList.isNotEmpty) { + GetOperationDetailsResponseModel oldDetails = + model.operationDetailsList[0]; + + postOpDiagmosisNoteController.text = oldDetails.postOpInstruction; + preOpDiagmosisController.text = oldDetails.preOpDiagnosis; + surgeonController.text = oldDetails.surgeon; + assistantNoteController.text = oldDetails.assistant; + operationController.text = oldDetails.operation; + inasionController.text = oldDetails.inasion; + findingController.text = oldDetails.finding; + surgeryProcedureController.text = oldDetails.surgeryProcedure; + postOpInstructionController.text = oldDetails.postOpInstruction; + complicationDetailsController.text = oldDetails.complicationDetail; + bloodLossDetailController.text = oldDetails.bloodLossDetail; + histopathSpecimenController.text = oldDetails.histopathSpecimen; + microbiologySpecimenController.text = + oldDetails.microbiologySpecimen; + otherSpecimenController.text = oldDetails.otherSpecimen; + scrubNurseController.text = oldDetails.scrubNurse; + circulatingNurseController.text = oldDetails.circulatingNurse; + BloodTransfusedDetailController.text = + oldDetails.bloodTransfusedDetail; + anasthetistController.text = oldDetails.anasthetist; + } + }, + builder: (_, model, w) => AppScaffold( + isShowAppBar: true, + baseViewModel: model, + backgroundColor: Theme.of(context).scaffoldBackgroundColor, + appBar: BottomSheetTitle( + title: TranslationBase.of(context).operationReports, + ), + body: SingleChildScrollView( + child: Container( + height: MediaQuery.of(context).size.height * 1.0, + child: Padding( + padding: EdgeInsets.all(0.0), + child: SingleChildScrollView( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 10.0, + ), + SingleChildScrollView( + child: Center( + child: FractionallySizedBox( + widthFactor: 0.9, + child: Column( + children: [ + AppTextFieldCustom( + hintText: "Reservation No", + //TranslationBase.of(context).addoperationReports, + controller: OTReservationID, + maxLines: 1, + minLines: 1, + enabled: false, + hasBorder: true, + ), + SizedBox( + height: 4, + ), + AppTextFieldCustom( + hintText: "Pre Op Diagmosis", + //TranslationBase.of(context).addoperationReports, + controller: preOpDiagmosisController, + maxLines: 1, + minLines: 1, + hasBorder: true, + + // isTextFieldHasSuffix: true, + validationError: preOpDiagmosisController + .text.isEmpty && + isSubmitted + ? TranslationBase.of(context) + .emptyMessage + : null, + ), + SizedBox( + height: 4, + ), + AppTextFieldCustom( + hintText: "Post Op Diagmosis", + //TranslationBase.of(context).addoperationReports, + controller: postOpDiagmosisNoteController, + maxLines: 1, + minLines: 1, + hasBorder: true, + + // isTextFieldHasSuffix: true, + validationError: + postOpDiagmosisNoteController + .text.isEmpty && + isSubmitted + ? TranslationBase.of(context) + .emptyMessage + : null, + ), + SizedBox( + height: 4, + ), + AppTextFieldCustom( + hintText: "Surgeon", + //TranslationBase.of(context).addoperationReports, + controller: surgeonController, + maxLines: 1, + minLines: 1, + hasBorder: true, + + // isTextFieldHasSuffix: true, + validationError: + surgeonController.text.isEmpty && + isSubmitted + ? TranslationBase.of(context) + .emptyMessage + : null, + ), + SizedBox( + height: 4, + ), + AppTextFieldCustom( + hintText: "assistant", + //TranslationBase.of(context).addoperationReports, + controller: assistantNoteController, + maxLines: 1, + minLines: 1, + hasBorder: true, + + // isTextFieldHasSuffix: true, + validationError: assistantNoteController + .text.isEmpty && + isSubmitted + ? TranslationBase.of(context) + .emptyMessage + : null, + ), + SizedBox( + height: 4, + ), + AppTextFieldCustom( + hintText: "Operation", + //TranslationBase.of(context).addoperationReports, + controller: operationController, + maxLines: 1, + minLines: 1, + hasBorder: true, + + // isTextFieldHasSuffix: true, + validationError: + operationController.text.isEmpty && + isSubmitted + ? TranslationBase.of(context) + .emptyMessage + : null, + ), + SizedBox( + height: 4, + ), + AppTextFieldCustom( + hintText: "inasion", + //TranslationBase.of(context).addoperationReports, + controller: inasionController, + maxLines: 1, + minLines: 1, + hasBorder: true, + + // isTextFieldHasSuffix: true, + validationError: + inasionController.text.isEmpty && + isSubmitted + ? TranslationBase.of(context) + .emptyMessage + : null, + ), + SizedBox( + height: 4, + ), + AppTextFieldCustom( + hintText: "finding", + //TranslationBase.of(context).addoperationReports, + controller: findingController, + maxLines: 1, + minLines: 1, + hasBorder: true, + + // isTextFieldHasSuffix: true, + validationError: + findingController.text.isEmpty && + isSubmitted + ? TranslationBase.of(context) + .emptyMessage + : null, + ), + SizedBox( + height: 4, + ), + AppTextFieldCustom( + hintText: "Surgery Procedure", + //TranslationBase.of(context).addoperationReports, + controller: surgeryProcedureController, + maxLines: 1, + minLines: 1, + hasBorder: true, + + // isTextFieldHasSuffix: true, + validationError: + surgeryProcedureController + .text.isEmpty && + isSubmitted + ? TranslationBase.of(context) + .emptyMessage + : null, + ), + SizedBox( + height: 4, + ), + AppTextFieldCustom( + hintText: "Post Op Instruction", + //TranslationBase.of(context).addoperationReports, + controller: postOpInstructionController, + maxLines: 1, + minLines: 1, + hasBorder: true, + + // isTextFieldHasSuffix: true, + validationError: + postOpInstructionController + .text.isEmpty && + isSubmitted + ? TranslationBase.of(context) + .emptyMessage + : null, + ), + SizedBox( + height: 4, + ), + AppTextFieldCustom( + hintText: "Complication Details", + //TranslationBase.of(context).addoperationReports, + controller: complicationDetailsController, + maxLines: 1, + minLines: 1, + hasBorder: true, + + // isTextFieldHasSuffix: true, + validationError: + complicationDetailsController + .text.isEmpty && + isSubmitted + ? TranslationBase.of(context) + .emptyMessage + : null, + ), + SizedBox( + height: 4, + ), + AppTextFieldCustom( + hintText: "Blood Loss Detail", + //TranslationBase.of(context).addoperationReports, + controller: bloodLossDetailController, + maxLines: 1, + minLines: 1, + hasBorder: true, + + // isTextFieldHasSuffix: true, + validationError: bloodLossDetailController + .text.isEmpty && + isSubmitted + ? TranslationBase.of(context) + .emptyMessage + : null, + ), + SizedBox( + height: 4, + ), + AppTextFieldCustom( + hintText: "histopal the Specimen", + //TranslationBase.of(context).addoperationReports, + controller: histopathSpecimenController, + maxLines: 1, + minLines: 1, + hasBorder: true, + + // isTextFieldHasSuffix: true, + validationError: + histopathSpecimenController + .text.isEmpty && + isSubmitted + ? TranslationBase.of(context) + .emptyMessage + : null, + ), + SizedBox( + height: 4, + ), + AppTextFieldCustom( + hintText: "microbiology Specimen ", + //TranslationBase.of(context).addoperationReports, + controller: + microbiologySpecimenController, + maxLines: 1, + minLines: 1, + hasBorder: true, + + // isTextFieldHasSuffix: true, + validationError: + microbiologySpecimenController + .text.isEmpty && + isSubmitted + ? TranslationBase.of(context) + .emptyMessage + : null, + ), + SizedBox( + height: 4, + ), + AppTextFieldCustom( + hintText: "other Specimen", + //TranslationBase.of(context).addoperationReports, + controller: otherSpecimenController, + maxLines: 1, + minLines: 1, + hasBorder: true, + + // isTextFieldHasSuffix: true, + validationError: otherSpecimenController + .text.isEmpty && + isSubmitted + ? TranslationBase.of(context) + .emptyMessage + : null, + ), + SizedBox( + height: 4, + ), + AppTextFieldCustom( + hintText: "scrub Nurse", + //TranslationBase.of(context).addoperationReports, + controller: scrubNurseController, + maxLines: 1, + minLines: 1, + hasBorder: true, + + // isTextFieldHasSuffix: true, + validationError: + scrubNurseController.text.isEmpty && + isSubmitted + ? TranslationBase.of(context) + .emptyMessage + : null, + ), + SizedBox( + height: 4, + ), + AppTextFieldCustom( + hintText: "circulating Nurse", + //TranslationBase.of(context).addoperationReports, + controller: circulatingNurseController, + maxLines: 1, + minLines: 1, + hasBorder: true, + + // isTextFieldHasSuffix: true, + validationError: + circulatingNurseController + .text.isEmpty && + isSubmitted + ? TranslationBase.of(context) + .emptyMessage + : null, + ), + SizedBox( + height: 4, + ), + AppTextFieldCustom( + hintText: "Blood Transfused Detail", + //TranslationBase.of(context).addoperationReports, + controller: + BloodTransfusedDetailController, + maxLines: 1, + minLines: 1, + hasBorder: true, + + // isTextFieldHasSuffix: true, + validationError: + BloodTransfusedDetailController + .text.isEmpty && + isSubmitted + ? TranslationBase.of(context) + .emptyMessage + : null, + ), + SizedBox( + height: 4, + ), + AppTextFieldCustom( + hintText: "Anasthetist", + //TranslationBase.of(context).addoperationReports, + controller: anasthetistController, + maxLines: 1, + minLines: 1, + hasBorder: true, + + // isTextFieldHasSuffix: true, + validationError: + anasthetistController.text.isEmpty && + isSubmitted + ? TranslationBase.of(context) + .emptyMessage + : null, + ), + SizedBox( + height: 250, + ), + ], + ), + ), + ), + ), + ], ), ), ), - ], + ), ), - ), - ), - ), - ), - bottomSheet: Container( - height: 70, - margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5), - child: Column( - children: [ - Container( - margin: EdgeInsets.all(5), - child: AppButton( - title: (widget.isUpdate - ? TranslationBase.of(context).noteUpdate - : TranslationBase.of(context).noteAdd) + - TranslationBase.of(context).operationReports, - color: Color(0xff359846), - // disabled: operationReportsController.text.isEmpty, - fontWeight: FontWeight.w700, - onPressed: () async { - setState(() { - isSubmitted = true; - }); - if (isFormValid()) { - GifLoaderDialogUtils.showMyDialog(context); - await widget.operationReportViewModel.getDoctorProfile(); - - CreateUpdateOperationReportRequestModel - createUpdateOperationReportRequestModel = - CreateUpdateOperationReportRequestModel( - inasion: inasionController.text, - /// TODO Elham* Add dynamic reservation - reservationNo: 0, - preOpDiagmosis: preOpDiagmosisController.text, - postOpDiagmosis: postOpDiagmosisNoteController.text, - surgeon: surgeonController.text, - assistant: assistantNoteController.text, - anasthetist: assistantNoteController.text, - operation: operationController.text, - finding: findingController.text, - surgeryProcedure: surgeonController.text, - postOpInstruction: postOpInstructionController.text, - complicationDetails: - complicationDetailsController.text, - bloodLossDetail: bloodLossDetailController.text, - histopathSpecimen: histopathSpecimenController.text, - microbiologySpecimen: - microbiologySpecimenController.text, - otherSpecimen: otherSpecimenController.text, - scrubNurse: surgeonController.text, - circulatingNurse: circulatingNurseController.text, - bloodTransfusedDetail: - bloodLossDetailController.text, - patientID: widget.patient.patientId, - admissionNo: int.parse(widget.patient.admissionNo), - createdBy: widget.operationReportViewModel.doctorProfile.doctorID, - setupID: SETUP_ID); - await widget.operationReportViewModel.updateOperationReport( - createUpdateOperationReportRequestModel); - - if (widget.operationReportViewModel.state == - ViewState.ErrorLocal) { - Helpers.showErrorToast( - widget.operationReportViewModel.error); - } else { - // await widget.operationReportViewModel.( - // operationReportsRequest.toJson()); - - DrAppToastMsg.showSuccesToast( - "Your Order added Successfully"); - Navigator.of(context).pop(); - } - GifLoaderDialogUtils.hideDialog(context); - } - }, + bottomSheet: model.state != ViewState.Idle?Container(height: 0,): Container( + height: 70, + margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5), + child: Column( + children: [ + Container( + margin: EdgeInsets.all(5), + child: AppButton( + title: (widget.isUpdate + ? TranslationBase.of(context).noteUpdate + : TranslationBase.of(context).noteAdd) + + TranslationBase.of(context).operationReports, + color: Color(0xff359846), + // disabled: operationReportsController.text.isEmpty, + fontWeight: FontWeight.w700, + onPressed: () async { + setState(() { + isSubmitted = true; + }); + if (isFormValid()) { + GifLoaderDialogUtils.showMyDialog(context); + await model + .getDoctorProfile(); + + CreateUpdateOperationReportRequestModel + createUpdateOperationReportRequestModel = + CreateUpdateOperationReportRequestModel( + inasion: inasionController.text, + + /// TODO Elham* Add dynamic reservation + reservationNo: + widget.reservation.oTReservationID, + preOpDiagmosis: + preOpDiagmosisController.text, + postOpDiagmosis: + postOpDiagmosisNoteController.text, + surgeon: surgeonController.text, + assistant: assistantNoteController.text, + anasthetist: assistantNoteController.text, + operation: operationController.text, + finding: findingController.text, + surgeryProcedure: surgeonController.text, + postOpInstruction: + postOpInstructionController.text, + complicationDetails: + complicationDetailsController.text, + bloodLossDetail: + bloodLossDetailController.text, + histopathSpecimen: + histopathSpecimenController.text, + microbiologySpecimen: + microbiologySpecimenController.text, + otherSpecimen: otherSpecimenController.text, + scrubNurse: surgeonController.text, + circulatingNurse: + circulatingNurseController.text, + bloodTransfusedDetail: + bloodLossDetailController.text, + patientID: widget.patient.patientId, + admissionNo: + int.parse(widget.patient.admissionNo), + createdBy: model + .doctorProfile.doctorID, + setupID: "010266"); + await model + .updateOperationReport( + createUpdateOperationReportRequestModel); + + if (model.state == + ViewState.ErrorLocal) { + Helpers.showErrorToast( + model.error); + } else { + // await model.( + // operationReportsRequest.toJson()); + + DrAppToastMsg.showSuccesToast( + "Your Order added Successfully"); + Navigator.of(context).pop(); + } + GifLoaderDialogUtils.hideDialog(context); + } + }, + ), + ), + ], + ), ), - ), - ], - ), - ), - ); + )); } isFormValid() { diff --git a/lib/screens/patients/profile/profile_screen/profile_gird_for_InPatient.dart b/lib/screens/patients/profile/profile_screen/profile_gird_for_InPatient.dart index a9138d1d..69090bde 100644 --- a/lib/screens/patients/profile/profile_screen/profile_gird_for_InPatient.dart +++ b/lib/screens/patients/profile/profile_screen/profile_gird_for_InPatient.dart @@ -161,6 +161,13 @@ class ProfileGridForInPatient extends StatelessWidget { 'patient/patient_sick_leave.png', isInPatient: isInpatient, ), + PatientProfileCardModel( + "Diabetic", + "Chart", + DIABETIC_CHART_VALUES, + 'patient/patient_sick_leave.png', + isInPatient: isInpatient, + ), ]; return Padding( diff --git a/lib/screens/patients/profile/vital_sign/vital_sign_details_blood_pressurewideget.dart b/lib/screens/patients/profile/vital_sign/vital_sign_details_blood_pressurewideget.dart index 1e593af7..69f45d6e 100644 --- a/lib/screens/patients/profile/vital_sign/vital_sign_details_blood_pressurewideget.dart +++ b/lib/screens/patients/profile/vital_sign/vital_sign_details_blood_pressurewideget.dart @@ -34,12 +34,6 @@ class _VitalSignDetailsWidgetState extends State { Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); return Container( - /*decoration: BoxDecoration( - color: Colors.transparent, - borderRadius: BorderRadius.only( - topLeft: Radius.circular(10.0), topRight: Radius.circular(10.0)), - border: Border.all(color: Colors.grey, width: 1), - ),*/ margin: EdgeInsets.all(0), child: Container( color: Colors.transparent, @@ -52,13 +46,6 @@ class _VitalSignDetailsWidgetState extends State { child: Container( child: Container( padding: EdgeInsets.all(8), - /*decoration: BoxDecoration( - color: Theme.of(context).primaryColor, - borderRadius: BorderRadius.only( - topLeft:projectViewModel.isArabic? Radius.circular(0.0):Radius.circular(10.0), - topRight: projectViewModel.isArabic? Radius.circular(10.0):Radius.circular(0.0) - ), - ),*/ child: AppText( TranslationBase.of(context).date, fontSize: SizeConfig.textMultiplier * 1.5, @@ -74,13 +61,6 @@ class _VitalSignDetailsWidgetState extends State { child: Container( padding: EdgeInsets.all(8), child: Container( - /*decoration: BoxDecoration( - color: Theme.of(context).primaryColor, - borderRadius: BorderRadius.only( - topRight: projectViewModel.isArabic? Radius.circular(0.0):Radius.circular(10.0), - topLeft: projectViewModel.isArabic? Radius.circular(10.0):Radius.circular(0.0) - ), - ),*/ child: AppText( widget.title2, fontSize: SizeConfig.textMultiplier * 1.5, @@ -96,13 +76,6 @@ class _VitalSignDetailsWidgetState extends State { child: Container( padding: EdgeInsets.all(8), child: Container( - /*decoration: BoxDecoration( - color: Theme.of(context).primaryColor, - borderRadius: BorderRadius.only( - topRight: projectViewModel.isArabic? Radius.circular(0.0):Radius.circular(10.0), - topLeft: projectViewModel.isArabic? Radius.circular(10.0):Radius.circular(0.0) - ), - ),*/ child: AppText( widget.title3, fontSize: SizeConfig.textMultiplier * 1.5, diff --git a/lib/screens/patients/register_patient/CustomEditableText.dart b/lib/screens/patients/register_patient/CustomEditableText.dart new file mode 100644 index 00000000..e4de6aae --- /dev/null +++ b/lib/screens/patients/register_patient/CustomEditableText.dart @@ -0,0 +1,87 @@ +import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart'; +import 'package:flutter/material.dart'; + +class CustomEditableText extends StatefulWidget { + CustomEditableText({ + Key key, + @required this.controller, + this.hint, + this.isEditable = false, + }) : super(key: key); + + final TextEditingController controller; + + final String hint; + bool isEditable; + + @override + _CustomEditableTextState createState() => _CustomEditableTextState(); +} + +class _CustomEditableTextState extends State { + @override + Widget build(BuildContext context) { + return Column( + children: [ + if(!widget.isEditable) + Container( + height: 60, + decoration: BoxDecoration( + color: Colors.grey[300], + shape: BoxShape.rectangle, + borderRadius: BorderRadius.all(Radius.circular(20)), + border: Border.fromBorderSide( + BorderSide( + color: Colors.grey[300], + width: 2, + ), + ), + ), + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText(widget.hint, fontSize: 12, color: Colors.black), + AppText( + widget.controller.text, + fontSize: 12, + color: Colors.grey[600], + ), + ], + ), + InkWell( + child: Icon( + DoctorApp.edit_1, + size: 20, + + ), + onTap: () { + setState(() { + widget.isEditable = true; + }); + }, + ) + ], + ), + ), + ), + if(widget.isEditable) + AppTextFieldCustom( + hintText: widget.hint, + //TranslationBase.of(context).addoperationReports, + controller: widget.controller, + maxLines: 1, + minLines: 1, + hasBorder: true, + ), + ], + ); + } +} \ No newline at end of file diff --git a/lib/screens/patients/register_patient/RegisterConfirmationPatientPage.dart b/lib/screens/patients/register_patient/RegisterConfirmationPatientPage.dart new file mode 100644 index 00000000..d51e57f3 --- /dev/null +++ b/lib/screens/patients/register_patient/RegisterConfirmationPatientPage.dart @@ -0,0 +1,342 @@ +import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/model/note/CreateNoteModel.dart'; +import 'package:doctor_app_flutter/core/model/note/note_model.dart'; +import 'package:doctor_app_flutter/core/model/note/update_note_model.dart'; +import 'package:doctor_app_flutter/core/provider/robot_provider.dart'; +import 'package:doctor_app_flutter/core/viewModel/operation_report_view_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/patient_view_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; +import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; +import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart'; +import 'package:doctor_app_flutter/models/operation_report/create_update_operation_report_request_model.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/models/patient/progress_note_request.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/soap_update/shared_soap_widgets/bottom_sheet_title.dart'; +import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; +import 'package:doctor_app_flutter/util/helpers.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart'; +import 'package:doctor_app_flutter/widgets/shared/speech-text-popup.dart'; +import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart'; +import 'package:doctor_app_flutter/widgets/shared/text_fields/text_fields_utils.dart'; +import 'package:flutter/material.dart'; +import 'package:permission_handler/permission_handler.dart'; +import 'package:provider/provider.dart'; +import 'package:speech_to_text/speech_recognition_error.dart'; +import 'package:speech_to_text/speech_to_text.dart' as stt; + +import 'CustomEditableText.dart'; + +class RegisterConfirmationPatientPage extends StatefulWidget { + final OperationReportViewModel operationReportViewModel; + final PatiantInformtion patient; + final int visitType; + final bool isUpdate; + + const RegisterConfirmationPatientPage( + {Key key, + this.operationReportViewModel, + this.patient, + this.visitType, + this.isUpdate}) + : super(key: key); + + @override + _RegisterConfirmationPatientPageState createState() => + _RegisterConfirmationPatientPageState(); +} + +class _RegisterConfirmationPatientPageState + extends State { + int selectedType; + bool isSubmitted = false; + stt.SpeechToText speech = stt.SpeechToText(); + var reconizedWord; + var event = RobotProvider(); + ProjectViewModel projectViewModel; + TextEditingController firstName = TextEditingController(text: "Elham"); + TextEditingController middleName = TextEditingController(text: "Ali"); + TextEditingController lastName = TextEditingController(text: "Rababah"); + TextEditingController emailAddressController = TextEditingController(text: "Elham@Rababah.com"); + + setSelectedType(int val) { + setState(() { + selectedType = val; + }); + } + + @override + void initState() { + super.initState(); + } + + @override + Widget build(BuildContext context) { + projectViewModel = Provider.of(context); + return AppScaffold( + isShowAppBar: false, + backgroundColor: Color(0xFFF8F8F8), + body: SingleChildScrollView( + child: Container( + height: MediaQuery.of(context).size.height * 1.0, + child: Padding( + padding: EdgeInsets.all(0.0), + child: SingleChildScrollView( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 10.0, + ), + SingleChildScrollView( + child: Center( + child: FractionallySizedBox( + widthFactor: 0.9, + child: Column( + children: [ + CustomEditableText( + controller: firstName, hint: TranslationBase.of(context).firstName), + SizedBox( + height: 4, + ), + CustomEditableText( + controller: middleName, hint: TranslationBase.of(context).middleName), + SizedBox( + height: 4, + ), + CustomEditableText( + controller: lastName, hint: TranslationBase.of(context).lastName), + SizedBox( + height: 20, + ), + + FractionallySizedBox( + widthFactor: .9, + child: Center( + child: Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText(TranslationBase.of(context).healthID, fontSize: 12, color: Colors.black), + AppText( + "123456", + fontSize: 12, + color: Colors.grey[600], + ), + ], + ), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText(TranslationBase.of(context).identityNumber, fontSize: 12, color: Colors.black), + AppText( + "ss", + fontSize: 12, + color: Colors.grey[600], + ), + ], + ), + SizedBox(width: 20,) + ], + ), + SizedBox( + height: 20, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText(TranslationBase.of(context).nationality, fontSize: 12, color: Colors.black), + AppText( + "Jordanian", + fontSize: 12, + color: Colors.grey[600], + ), + ], + ), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText(TranslationBase.of(context).occupation, fontSize: 12, color: Colors.black), + AppText( + "--", + fontSize: 12, + color: Colors.grey[600], + ), + ], + ), + SizedBox(width: 20,) + ], + ), + SizedBox( + height: 20, + ), + + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText(TranslationBase.of(context).mobileNo, fontSize: 12, color: Colors.black), + AppText( + "075XXXXXX", + fontSize: 12, + color: Colors.grey[600], + ), + ], + ), + SizedBox(width: 20,) + ], + ), + SizedBox( + height: 20, + ), + ], + ), + ), + ), + + AppTextFieldCustom( + height: Helpers.getTextFieldHeight(), + enabled: false, + onClick: () { + // MasterKeyDailog dialog = + // MasterKeyDailog( + // list: + // model.medicationDoseTimeList, + // okText: + // TranslationBase.of(context) + // .ok, + // selectedValue: + // _selectedMedicationDose, + // okFunction: (selectedValue) { + // setState(() { + // _selectedMedicationDose = + // selectedValue; + // + // doseController + // .text = projectViewModel + // .isArabic + // ? _selectedMedicationDose + // .nameAr + // : _selectedMedicationDose + // .nameEn; + // }); + // }, + // ); + // showDialog( + // barrierDismissible: false, + // context: context, + // builder: (BuildContext context) { + // return dialog; + // }, + // ); + }, + hintText: + TranslationBase.of(context).maritalStatus, + maxLines: 1, + minLines: 1, + isTextFieldHasSuffix: true, + // controller: doseController, + // validationError: isFormSubmitted && + // _selectedMedicationDose == null + // ? TranslationBase.of(context) + // .emptyMessage + // : null, + ), + SizedBox( + height: 20, + ), + AppTextFieldCustom( + height: Helpers.getTextFieldHeight(), + enabled: false, + onClick: () { + // MasterKeyDailog dialog = + // MasterKeyDailog( + // list: + // model.medicationDoseTimeList, + // okText: + // TranslationBase.of(context) + // .ok, + // selectedValue: + // _selectedMedicationDose, + // okFunction: (selectedValue) { + // setState(() { + // _selectedMedicationDose = + // selectedValue; + // + // doseController + // .text = projectViewModel + // .isArabic + // ? _selectedMedicationDose + // .nameAr + // : _selectedMedicationDose + // .nameEn; + // }); + // }, + // ); + // showDialog( + // barrierDismissible: false, + // context: context, + // builder: (BuildContext context) { + // return dialog; + // }, + // ); + }, + hintText: + TranslationBase.of(context).lanEnglish, + maxLines: 1, + minLines: 1, + isTextFieldHasSuffix: true, + // controller: doseController, + // validationError: isFormSubmitted && + // _selectedMedicationDose == null + // ? TranslationBase.of(context) + // .emptyMessage + // : null, + ), + SizedBox( + height: 20, + ), + AppTextFieldCustom( + hintText: "Email Address", + //TranslationBase.of(context).addoperationReports, + controller: emailAddressController, + maxLines: 1, + minLines: 1, + hasBorder: true, + ), + + SizedBox( + height: 400, + ), + ], + ), + ), + ), + ), + ], + ), + ), + ), + ), + ), + ); + } +} diff --git a/lib/screens/patients/register_patient/RegisterPatientPage.dart b/lib/screens/patients/register_patient/RegisterPatientPage.dart index ab85d820..3604a943 100644 --- a/lib/screens/patients/register_patient/RegisterPatientPage.dart +++ b/lib/screens/patients/register_patient/RegisterPatientPage.dart @@ -1,8 +1,8 @@ -import 'package:doctor_app_flutter/core/viewModel/PatientRegisterViewModel.dart'; +import 'package:doctor_app_flutter/core/viewModel/PatientRegistrationViewModel.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; -import 'package:doctor_app_flutter/screens/patients/In_patient/InPatientHeader.dart'; import 'package:doctor_app_flutter/screens/patients/patient_search/patient_search_header.dart'; import 'package:doctor_app_flutter/screens/patients/profile/UCAF/page-stepper-widget.dart'; +import 'package:doctor_app_flutter/screens/patients/register_patient/RegisterConfirmationPatientPage.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart'; @@ -53,7 +53,7 @@ class _RegisterPatientPageState extends State Widget build(BuildContext context) { final screenSize = MediaQuery.of(context).size; - return BaseView( + return BaseView( builder: (_, model, w) => AppScaffold( baseViewModel: model, isShowAppBar: true, @@ -99,6 +99,8 @@ class _RegisterPatientPageState extends State scrollDirection: Axis.horizontal, children: [ RegisterSearchPatientPage(), + RegisterConfirmationPatientPage(), + ]), ), ), @@ -116,7 +118,7 @@ class _RegisterPatientPageState extends State ); } - Widget pagerButtons(PatientRegisterViewModel model) { + Widget pagerButtons(PatientRegistrationViewModel model) { switch (_currentIndex) { case 2: return Container( diff --git a/lib/screens/patients/register_patient/RegisterSearchPatientPage.dart b/lib/screens/patients/register_patient/RegisterSearchPatientPage.dart index 0f4b95c4..162f2e89 100644 --- a/lib/screens/patients/register_patient/RegisterSearchPatientPage.dart +++ b/lib/screens/patients/register_patient/RegisterSearchPatientPage.dart @@ -1,15 +1,15 @@ import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/core/enum/CalenderType.dart'; -import 'package:doctor_app_flutter/core/enum/viewstate.dart'; -import 'package:doctor_app_flutter/core/viewModel/PatientRegisterViewModel.dart'; +import 'package:doctor_app_flutter/core/model/PatientRegistration/PatientRegistrationModel.dart'; +import 'package:doctor_app_flutter/core/viewModel/PatientRegistrationViewModel.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/util/date-utils.dart'; -import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; + import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/dialogs/dailog-list-select.dart'; -import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart'; + import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart'; import 'package:flutter/material.dart'; @@ -40,7 +40,7 @@ class _RegisterSearchPatientPageState extends State { Widget build(BuildContext context) { final screenSize = MediaQuery.of(context).size; - return BaseView( + return BaseView( builder: (_, model, w) => AppScaffold( baseViewModel: model, isShowAppBar: false, diff --git a/lib/util/translations_delegate_base.dart b/lib/util/translations_delegate_base.dart index 58e17a94..397f8b36 100644 --- a/lib/util/translations_delegate_base.dart +++ b/lib/util/translations_delegate_base.dart @@ -294,6 +294,10 @@ class TranslationBase { String get age => localizedValues['age'][locale.languageCode]; String get nationality => localizedValues['nationality'][locale.languageCode]; + String get occupation => localizedValues['occupation'][locale.languageCode]; + String get healthID => localizedValues['healthID'][locale.languageCode]; + String get identityNumber => localizedValues['identityNumber'][locale.languageCode]; + String get maritalStatus => localizedValues['maritalStatus'][locale.languageCode]; String get today => localizedValues['today'][locale.languageCode];