SOAP vida plus in progress

update_flutter_3.24_vida_plus_episode_MDS
Sultan khan 1 year ago
parent f3876e9ef1
commit b727e66ac1

@ -308,6 +308,15 @@ const UPDATE_ALLERGIES = 'Services/DoctorApplication.svc/REST/UpdateAllergy';
const GET_CHIEF_COMPLAINT_VP = 'Services/DoctorApplication.svc/REST/ChiefComplaintDetails';
const CONTINUE_EPISODE_VP = 'Services/DoctorApplication.svc/REST/ContinueEpisode';
const UPDATE_CHIEF_COMPLAINT = 'Services/DoctorApplication.svc/REST/UpdateChiefComplaint';
const EPISODE_BY_CHIEF_COMPLAINT = 'Services/DoctorApplication.svc/REST/EpisodeByChiefcomplaint';
const GET_EDIT_ALLERGIES = 'Services/DoctorApplication.svc/REST/GetAllergy';
const GET_HOME_MEDICATION = 'Services/DoctorApplication.svc/REST/GetHomeMedication';
var selectedPatientType = 1;

@ -1205,5 +1205,7 @@ const Map<String, Map<String, String>> localizedValues = {
"mild": {"en": "Mild", "ar":"خفيف"},
"moderate": {"en": "Moderate", "ar":"معتدل"},
"noDiagnosisFound": {"en": "No Diagnosis added, please add it from the button above", "ar":"لم يتم إضافة تشخيص ، يرجى إضافته من الزر أعلاه"},
"activate": {"en": "Activate", "ar":"فعل"},
"resolved": {"en": "Resolved", "ar":"تم الحل"},
};

@ -0,0 +1,245 @@
class EpisodeByChiefComplaintVidaPlus {
int? clinicId;
String? createdOn;
int? doctorId;
int? episodeStatus;
int? hospitalGroupId;
int? hospitalId;
String? modifiedOn;
int? patientEpisodeId;
int? patientId;
List<PatientPomrs>? patientPomrs;
EpisodeByChiefComplaintVidaPlus(
{this.clinicId,
this.createdOn,
this.doctorId,
this.episodeStatus,
this.hospitalGroupId,
this.hospitalId,
this.modifiedOn,
this.patientEpisodeId,
this.patientId,
this.patientPomrs});
EpisodeByChiefComplaintVidaPlus.fromJson(Map<String, dynamic> json) {
clinicId = json['clinicId'];
createdOn = json['createdOn'];
doctorId = json['doctorId'];
episodeStatus = json['episodeStatus'];
hospitalGroupId = json['hospitalGroupId'];
hospitalId = json['hospitalId'];
modifiedOn = json['modifiedOn'];
patientEpisodeId = json['patientEpisodeId'];
patientId = json['patientId'];
if (json['patientPomrs'] != null) {
patientPomrs = <PatientPomrs>[];
json['patientPomrs'].forEach((v) {
patientPomrs!.add(new PatientPomrs.fromJson(v));
});
}
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['clinicId'] = this.clinicId;
data['createdOn'] = this.createdOn;
data['doctorId'] = this.doctorId;
data['episodeStatus'] = this.episodeStatus;
data['hospitalGroupId'] = this.hospitalGroupId;
data['hospitalId'] = this.hospitalId;
data['modifiedOn'] = this.modifiedOn;
data['patientEpisodeId'] = this.patientEpisodeId;
data['patientId'] = this.patientId;
if (this.patientPomrs != null) {
data['patientPomrs'] = this.patientPomrs!.map((v) => v.toJson()).toList();
}
return data;
}
}
class PatientPomrs {
int? appointmentId;
int? chiefComplainTemplateId;
List<ChiefComplains>? chiefComplains;
int? clinicGroupId;
String? createdOn;
int? doctorId;
String? doctorName;
int? episodeId;
bool? fallowUp;
bool? fallowUpRequired;
bool? isReadOnly;
String? modifiedOn;
int? patientId;
int? patientPomrId;
String? pomrSingOn;
int? pomrStatus;
bool? readOnly;
String? seenAtStatus;
String? vprnSeenAtStatus;
PatientPomrs(
{this.appointmentId,
this.chiefComplainTemplateId,
this.chiefComplains,
this.clinicGroupId,
this.createdOn,
this.doctorId,
this.doctorName,
this.episodeId,
this.fallowUp,
this.fallowUpRequired,
this.isReadOnly,
this.modifiedOn,
this.patientId,
this.patientPomrId,
this.pomrSingOn,
this.pomrStatus,
this.readOnly,
this.seenAtStatus,
this.vprnSeenAtStatus});
PatientPomrs.fromJson(Map<String, dynamic> json) {
appointmentId = json['appointmentId'];
chiefComplainTemplateId = json['chiefComplainTemplateId'];
if (json['chiefComplains'] != null) {
chiefComplains = <ChiefComplains>[];
json['chiefComplains'].forEach((v) {
chiefComplains!.add(new ChiefComplains.fromJson(v));
});
}
clinicGroupId = json['clinicGroupId'];
createdOn = json['createdOn'];
doctorId = json['doctorId'];
doctorName = json['doctorName'];
episodeId = json['episodeId'];
fallowUp = json['fallowUp'];
fallowUpRequired = json['fallowUpRequired'];
isReadOnly = json['isReadOnly'];
modifiedOn = json['modifiedOn'];
patientId = json['patientId'];
patientPomrId = json['patientPomrId'];
pomrSingOn = json['pomrSingOn'];
pomrStatus = json['pomrStatus'];
readOnly = json['readOnly'];
seenAtStatus = json['seenAtStatus'];
vprnSeenAtStatus = json['vprnSeenAtStatus'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['appointmentId'] = this.appointmentId;
data['chiefComplainTemplateId'] = this.chiefComplainTemplateId;
if (this.chiefComplains != null) {
data['chiefComplains'] =
this.chiefComplains!.map((v) => v.toJson()).toList();
}
data['clinicGroupId'] = this.clinicGroupId;
data['createdOn'] = this.createdOn;
data['doctorId'] = this.doctorId;
data['doctorName'] = this.doctorName;
data['episodeId'] = this.episodeId;
data['fallowUp'] = this.fallowUp;
data['fallowUpRequired'] = this.fallowUpRequired;
data['isReadOnly'] = this.isReadOnly;
data['modifiedOn'] = this.modifiedOn;
data['patientId'] = this.patientId;
data['patientPomrId'] = this.patientPomrId;
data['pomrSingOn'] = this.pomrSingOn;
data['pomrStatus'] = this.pomrStatus;
data['readOnly'] = this.readOnly;
data['seenAtStatus'] = this.seenAtStatus;
data['vprnSeenAtStatus'] = this.vprnSeenAtStatus;
return data;
}
}
class ChiefComplains {
int? appointmentId;
String? chiefComplain;
int? chiefComplainId;
int? clinicId;
String? createdBy;
int? createdId;
String? createdOn;
int? doctorId;
String? doctorName;
int? episodeId;
int? hospitalGroupId;
int? hospitalId;
String? loginUserId;
String? modifiedBy;
Null? modifiedId;
String? modifiedOn;
int? patientId;
String? patientName;
int? patientPomrId;
ChiefComplains(
{this.appointmentId,
this.chiefComplain,
this.chiefComplainId,
this.clinicId,
this.createdBy,
this.createdId,
this.createdOn,
this.doctorId,
this.doctorName,
this.episodeId,
this.hospitalGroupId,
this.hospitalId,
this.loginUserId,
this.modifiedBy,
this.modifiedId,
this.modifiedOn,
this.patientId,
this.patientName,
this.patientPomrId});
ChiefComplains.fromJson(Map<String, dynamic> json) {
appointmentId = json['appointmentId'];
chiefComplain = json['chiefComplain'];
chiefComplainId = json['chiefComplainId'];
clinicId = json['clinicId'];
createdBy = json['createdBy'];
createdId = json['createdId'];
createdOn = json['createdOn'];
doctorId = json['doctorId'];
doctorName = json['doctorName'];
episodeId = json['episodeId'];
hospitalGroupId = json['hospitalGroupId'];
hospitalId = json['hospitalId'];
loginUserId = json['loginUserId'];
modifiedBy = json['modifiedBy'];
modifiedId = json['modifiedId'];
modifiedOn = json['modifiedOn'];
patientId = json['patientId'];
patientName = json['patientName'];
patientPomrId = json['patientPomrId'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['appointmentId'] = this.appointmentId;
data['chiefComplain'] = this.chiefComplain;
data['chiefComplainId'] = this.chiefComplainId;
data['clinicId'] = this.clinicId;
data['createdBy'] = this.createdBy;
data['createdId'] = this.createdId;
data['createdOn'] = this.createdOn;
data['doctorId'] = this.doctorId;
data['doctorName'] = this.doctorName;
data['episodeId'] = this.episodeId;
data['hospitalGroupId'] = this.hospitalGroupId;
data['hospitalId'] = this.hospitalId;
data['loginUserId'] = this.loginUserId;
data['modifiedBy'] = this.modifiedBy;
data['modifiedId'] = this.modifiedId;
data['modifiedOn'] = this.modifiedOn;
data['patientId'] = this.patientId;
data['patientName'] = this.patientName;
data['patientPomrId'] = this.patientPomrId;
return data;
}
}

@ -0,0 +1,156 @@
class GetHomeMedicationList {
List? personalizationEntity;
int? appointmentId;
int? clinicGroupId;
int? clinicId;
String? createdTime;
String? doseQuantity;
String? formularyName;
String? frequencyId;
String? frequencyString;
String? genericFormularyId;
String? homeMedFrom;
int? hospitalGroupId;
int? hospitalId;
String? id;
bool? isActive;
bool? isEHRIPReconciled;
bool? isEHROPReconciled;
bool? isERIPReconciled;
bool? isFreeText;
bool? isReconciled;
bool? isUnknownDetail;
String? lastUpdatedTime;
int? patientId;
int? patientPomrId;
String? prescribeTypeAlias;
int? prescribedItemId;
String? prescribedItemName;
String? remarks;
String? routeId;
String? routeString;
String? rowVersion;
String? sentence;
String? strengthId;
String? strengthString;
GetHomeMedicationList(
{this.personalizationEntity,
this.appointmentId,
this.clinicGroupId,
this.clinicId,
this.createdTime,
this.doseQuantity,
this.formularyName,
this.frequencyId,
this.frequencyString,
this.genericFormularyId,
this.homeMedFrom,
this.hospitalGroupId,
this.hospitalId,
this.id,
this.isActive,
this.isEHRIPReconciled,
this.isEHROPReconciled,
this.isERIPReconciled,
this.isFreeText,
this.isReconciled,
this.isUnknownDetail,
this.lastUpdatedTime,
this.patientId,
this.patientPomrId,
this.prescribeTypeAlias,
this.prescribedItemId,
this.prescribedItemName,
this.remarks,
this.routeId,
this.routeString,
this.rowVersion,
this.sentence,
this.strengthId,
this.strengthString});
GetHomeMedicationList.fromJson(Map<String, dynamic> json) {
if (json['PersonalizationEntity'] != null) {
personalizationEntity = [];
json['PersonalizationEntity'].forEach((v) {
personalizationEntity!.add( v.fromJson(v));
});
}
appointmentId = json['appointmentId'];
clinicGroupId = json['clinicGroupId'];
clinicId = json['clinicId'];
createdTime = json['createdTime'];
doseQuantity = json['doseQuantity'];
formularyName = json['formularyName'];
frequencyId = json['frequencyId'];
frequencyString = json['frequencyString'];
genericFormularyId = json['genericFormularyId'];
homeMedFrom = json['homeMedFrom'];
hospitalGroupId = json['hospitalGroupId'];
hospitalId = json['hospitalId'];
id = json['id'];
isActive = json['isActive'];
isEHRIPReconciled = json['isEHRIPReconciled'];
isEHROPReconciled = json['isEHROPReconciled'];
isERIPReconciled = json['isERIPReconciled'];
isFreeText = json['isFreeText'];
isReconciled = json['isReconciled'];
isUnknownDetail = json['isUnknownDetail'];
lastUpdatedTime = json['lastUpdatedTime'];
patientId = json['patientId'];
patientPomrId = json['patientPomrId'];
prescribeTypeAlias = json['prescribeTypeAlias'];
prescribedItemId = json['prescribedItemId'];
prescribedItemName = json['prescribedItemName'];
remarks = json['remarks'];
routeId = json['routeId'];
routeString = json['routeString'];
rowVersion = json['rowVersion'];
sentence = json['sentence'];
strengthId = json['strengthId'];
strengthString = json['strengthString'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
if (this.personalizationEntity != null) {
data['PersonalizationEntity'] =
this.personalizationEntity!.map((v) => v.toJson()).toList();
}
data['appointmentId'] = this.appointmentId;
data['clinicGroupId'] = this.clinicGroupId;
data['clinicId'] = this.clinicId;
data['createdTime'] = this.createdTime;
data['doseQuantity'] = this.doseQuantity;
data['formularyName'] = this.formularyName;
data['frequencyId'] = this.frequencyId;
data['frequencyString'] = this.frequencyString;
data['genericFormularyId'] = this.genericFormularyId;
data['homeMedFrom'] = this.homeMedFrom;
data['hospitalGroupId'] = this.hospitalGroupId;
data['hospitalId'] = this.hospitalId;
data['id'] = this.id;
data['isActive'] = this.isActive;
data['isEHRIPReconciled'] = this.isEHRIPReconciled;
data['isEHROPReconciled'] = this.isEHROPReconciled;
data['isERIPReconciled'] = this.isERIPReconciled;
data['isFreeText'] = this.isFreeText;
data['isReconciled'] = this.isReconciled;
data['isUnknownDetail'] = this.isUnknownDetail;
data['lastUpdatedTime'] = this.lastUpdatedTime;
data['patientId'] = this.patientId;
data['patientPomrId'] = this.patientPomrId;
data['prescribeTypeAlias'] = this.prescribeTypeAlias;
data['prescribedItemId'] = this.prescribedItemId;
data['prescribedItemName'] = this.prescribedItemName;
data['remarks'] = this.remarks;
data['routeId'] = this.routeId;
data['routeString'] = this.routeString;
data['rowVersion'] = this.rowVersion;
data['sentence'] = this.sentence;
data['strengthId'] = this.strengthId;
data['strengthString'] = this.strengthString;
return data;
}
}

@ -3,11 +3,13 @@ import 'package:doctor_app_flutter/core/model/SOAP/Allergy/get_allergies_res_mod
import 'package:doctor_app_flutter/core/model/SOAP/Assessment/get_assessment_res_model.dart';
import 'package:doctor_app_flutter/core/model/SOAP/allergy/get_allergies_list_vida_plus.dart';
import 'package:doctor_app_flutter/core/model/SOAP/allergy/get_patient_allergies_list_vida_plus.dart';
import 'package:doctor_app_flutter/core/model/SOAP/chief_complaint/episode_by_chief_complaint_vidaplus.dart';
import 'package:doctor_app_flutter/core/model/SOAP/chief_complaint/get_chief_complaint_vida_plus.dart';
import 'package:doctor_app_flutter/core/model/SOAP/chief_complaint/search_chief_complaint_vidaplus.dart';
import 'package:doctor_app_flutter/core/model/SOAP/general_get_req_for_SOAP.dart';
import 'package:doctor_app_flutter/core/model/SOAP/Assessment/get_assessment_req_model.dart';
import 'package:doctor_app_flutter/core/model/SOAP/get_hopi_details.dart';
import 'package:doctor_app_flutter/core/model/SOAP/home_medication_vp/GetHomeMedication.dart';
import 'package:doctor_app_flutter/core/model/SOAP/post_episode_req_model.dart';
import 'package:doctor_app_flutter/core/model/SOAP/chief_complaint/get_chief_complaint_req_model.dart';
import 'package:doctor_app_flutter/core/model/SOAP/chief_complaint/get_chief_complaint_res_model.dart';
@ -48,6 +50,9 @@ class SOAPService extends LookupService {
List<GetHopiDetails> hopiDetails = [];
List<GetChiefComplaintVidaPlus> patientChiefComplaintListVidaPlus = [];
List<SearchChiefComplaint> searchChiefComplaintListVidaPlus = [];
List<EpisodeByChiefComplaintVidaPlus> episodeByChiefComplaintListVidaPlus = [];
List<GetHomeMedicationList> getHomeMedicationList = [];
int? episodeID;
bool isPrescriptionOrder = false;
@ -376,6 +381,25 @@ class SOAPService extends LookupService {
}, body: request);
}
Future getEditAllergies(int allergyId) async {
hasError = false;
await baseAppClient.post(GET_EDIT_ALLERGIES,
onSuccess: (dynamic response, int statusCode) {
print("Success");
searchAllergiesList.clear();
response['List_SearchAllergies']['resultData'].forEach((v) {
searchAllergiesList.add(AllergiesListVidaPlus.fromJson(v));
});
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, body: {"allergyId": allergyId});
}
Future searchAllergies(String searchKey) async {
hasError = false;
@ -487,39 +511,48 @@ class SOAPService extends LookupService {
}
Future updateAllergies(
AllergiesListVidaPlus allergy, PatiantInformtion patientInfo) async {
allergy.allergyReactionDTOs!.forEach((value) {
value.patientID = patientInfo.patientMRN;
value.pomrid = patientInfo.episodeNo;
value.allergyReactionMappingID = 1;
PatientAllergiesVidaPlus allergy, PatiantInformtion patientInfo) async {
var doctorProfile = await sharedPref.getObj(LOGGED_IN_USER);
List<PatientsAllergyReactionsDTOs>? reaction =
allergy.patientsAllergyReactionsDTOs!;
List<AllergyReactionDTOs>? reactionRequest = [];
reaction.forEach((value) {
reactionRequest.add(AllergyReactionDTOs(
patientID: patientInfo.patientMRN,
pomrid: int.parse(patientInfo.pomrId!),
hospitalGroupID: value.hospitalGroupID,
allergyReactionMappingID: 0,
hospitalID: value.hospitalID,
isActive: value.isActive,
allergyReactionID: value.allergyReactionID,
allergyReactionName: value.allergyReactionName,
severity: value.severity));
});
var request = {
"patientsAllergyRevisionID": allergy.allergyRevisionID,
"pomrId": patientInfo.pomrId,
"patientMRN": patientInfo.patientMRN,
"allergyDiseaseType": 0,
"allergyTypeName": allergy.allergyTypeName,
"episodeId": patientInfo.episodeNo,
"isUpdatedByNurse": false,
"remarks": allergy.remark,
"createdBy": patientInfo.doctorId,
"createdOn": AppDateUtils.convertDateToFormat(
DateTime.now(), "yyyy-MM-dd kk:mm:ss"),
"assessmentId": 0,
"isActive": allergy.isActive,
"isActivePatientsAllergy": true,
"patientsAllergyReactionsDTOs": allergy.allergyReactionDTOs,
"dbCRUDOperation": 1,
"isActive": allergy.isActivePatientsAllergy,
"isActivePatientsAllergy": allergy.isActivePatientsAllergy,
"patientsAllergyReactionsDTOs":reactionRequest,
"dbCRUDOperation": 2,
"allergyID": allergy.allergyID,
"allergyName": allergy.allergyName,
"allergyTypeID": allergy.allergyTypeID
"allergyTypeID": allergy.allergyTypeID,
"remarks": allergy.remark,
"projectId": patientInfo.projectId,
"editedBy": doctorProfile['List_MemberInformation'][0]['MemberID'],
"setupId": await sharedPref.getString(DOCTOR_SETUP_ID)
};
hasError = false;
await baseAppClient.post(UPDATE_ALLERGIES,
onSuccess: (dynamic response, int statusCode) {
DrAppToastMsg.showSuccesToast("Allergies Saved Successfully");
DrAppToastMsg.showSuccesToast("Allergies Updated Successfully");
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
@ -631,4 +664,118 @@ class SOAPService extends LookupService {
super.error = error;
}, body: request);
}
continueEpisodeVidaPlus(
PatiantInformtion patient, List<PatientPomrs> chiefComplaint) async {
List<Map<String, dynamic>> chiefComplaintList=[];
chiefComplaint.forEach((action){
action.chiefComplains!.forEach((action2){
chiefComplaintList.add({"chiefComplain": action2.chiefComplain,"chiefComplainTemplateId": action!.chiefComplainTemplateId});
});
});
Map<String, dynamic> request = {
"appointmentId": patient.appointmentNo,
"projectId": patient.projectId,
"setupId": await sharedPref.getString(DOCTOR_SETUP_ID),
"chiefComplain":chiefComplaintList
};
hasError = false;
await baseAppClient.post(CONTINUE_EPISODE_VP,
onSuccess: (dynamic response, int statusCode) {
print("Success");
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, body: request);
}
updateChiefComplaintVidaPlus(
PatiantInformtion patient, GetChiefComplaintVidaPlus chiefComplaint) async {
Map<String, dynamic> request = {
"AppointmentNo": patient.appointmentNo,
"pomrId": patient.pomrId,
"PatientMRN": patient.patientMRN,
"PatientName":patient.firstName! + ' '+ patient.lastName! ,
"addedChiefComplaintCreateDtos": [
],
"removedChiefComplaintIds":[chiefComplaint.chiefComplainId]
};
hasError = false;
await baseAppClient.post(UPDATE_CHIEF_COMPLAINT,
onSuccess: (dynamic response, int statusCode) {
print("Success");
DrAppToastMsg.showErrorToast(response['List_UpdateChiefComplaint']['message']);
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, body: request);
}
episodeByChiefComplaint(
PatiantInformtion patient) async {
Map<String, dynamic> request = {
"patientId": patient.patientId,
"clinicId": patient.clinicId,
};
hasError = false;
await baseAppClient.post(EPISODE_BY_CHIEF_COMPLAINT,
onSuccess: (dynamic response, int statusCode) {
episodeByChiefComplaintListVidaPlus.clear();
response['EpisodeByChiefcomplaint']['resultData'].forEach((v) {
episodeByChiefComplaintListVidaPlus.add(EpisodeByChiefComplaintVidaPlus.fromJson(v));
});
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, body: request);
}
getHomeMedication(
PatiantInformtion patient) async {
Map<String, dynamic> request = {
"patientId": patient.patientId,
};
hasError = false;
await baseAppClient.post(GET_HOME_MEDICATION,
onSuccess: (dynamic response, int statusCode) {
getHomeMedicationList.clear();
response['ListHomeMedication']['resultData'].forEach((v) {
getHomeMedicationList.add(GetHomeMedicationList.fromJson(v));
});
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, body: request);
}
// createCCByEpisodeVidaPlus(
// PatiantInformtion patient, List<PatientPomrs> chiefComplaint) async {
// Map<String, dynamic> request =
// {
// "appointmentId": patient.appointmentNo,
// "projectId": patient.projectId,
// "setupId": 105,
// "chiefComplain":chiefComplaint,
// "patientId": patient.patientId,
// "pomrId": patient.pomrId,
// "doctorId": 2,
// };
//
// hasError = false;
// await baseAppClient.post(UPDATE_CHIEF_COMPLAINT,
// onSuccess: (dynamic response, int statusCode) {
// print("Success");
// }, onFailure: (String error, int statusCode) {
// hasError = true;
// super.error = error;
// }, body: request);
// }
}

@ -6,6 +6,7 @@ import 'package:doctor_app_flutter/core/model/SOAP/Assessment/get_assessment_req
import 'package:doctor_app_flutter/core/model/SOAP/Assessment/get_assessment_res_model.dart';
import 'package:doctor_app_flutter/core/model/SOAP/Assessment/post_assessment_request_model.dart';
import 'package:doctor_app_flutter/core/model/SOAP/allergy/get_allergies_list_vida_plus.dart';
import 'package:doctor_app_flutter/core/model/SOAP/chief_complaint/episode_by_chief_complaint_vidaplus.dart';
import 'package:doctor_app_flutter/core/model/SOAP/chief_complaint/get_chief_complaint_req_model.dart';
import 'package:doctor_app_flutter/core/model/SOAP/chief_complaint/get_chief_complaint_res_model.dart';
import 'package:doctor_app_flutter/core/model/SOAP/chief_complaint/get_chief_complaint_vida_plus.dart';
@ -16,6 +17,7 @@ import 'package:doctor_app_flutter/core/model/SOAP/get_hopi_details.dart';
import 'package:doctor_app_flutter/core/model/SOAP/history/get_history_req_model.dart';
import 'package:doctor_app_flutter/core/model/SOAP/history/get_history_res_model.dart';
import 'package:doctor_app_flutter/core/model/SOAP/history/post_histories_request_model.dart';
import 'package:doctor_app_flutter/core/model/SOAP/home_medication_vp/GetHomeMedication.dart';
import 'package:doctor_app_flutter/core/model/SOAP/in_patient/get_episode_for_inpatient_req_model.dart';
import 'package:doctor_app_flutter/core/model/SOAP/in_patient/post_episode_for_Inpatient_request_model.dart';
import 'package:doctor_app_flutter/core/model/SOAP/master_key_model.dart';
@ -36,6 +38,7 @@ import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/screens/patients/profile/soap_update/assessment/assessment_call_back.dart';
import 'package:doctor_app_flutter/screens/patients/profile/soap_update/objective/objective_call_back.dart';
import 'package:doctor_app_flutter/screens/patients/profile/soap_update/plan/plan_call_back.dart';
import 'package:doctor_app_flutter/screens/patients/profile/soap_update/subjective/cheif_complaints/update_Chief_complaints.dart';
import 'package:doctor_app_flutter/screens/patients/profile/soap_update/subjective/subjective_call_back.dart';
import '../../locator.dart';
@ -111,6 +114,11 @@ class SOAPViewModel extends BaseViewModel {
List<GetChiefComplaintVidaPlus> get getChiefComplaintListVidaPlus =>
_SOAPService.patientChiefComplaintListVidaPlus;
List<EpisodeByChiefComplaintVidaPlus> get episodeByChiefComplaintListVidaPlus =>
_SOAPService.episodeByChiefComplaintListVidaPlus;
int? get episodeID => _SOAPService.episodeID;
bool get isPrescriptionOrder => _SOAPService.isPrescriptionOrder;
@ -132,6 +140,11 @@ class SOAPViewModel extends BaseViewModel {
List<GetMedicationResponseModel>? get allMedicationList =>
_prescriptionService.allMedicationList;
List<GetHomeMedicationList>? get getHomeMedicationList =>
_SOAPService.getHomeMedicationList;
late SubjectiveCallBack subjectiveCallBack;
setSubjectiveCallBack(SubjectiveCallBack callBack) {
@ -921,6 +934,16 @@ class SOAPViewModel extends BaseViewModel {
setState(ViewState.Idle);
}
getEditAllergiesVidaPlus(int AllergyID ) async {
setState(ViewState.BusyLocal);
await _SOAPService.getEditAllergies(AllergyID);
if (_SOAPService.hasError) {
error = _SOAPService.error;
setState(ViewState.ErrorLocal);
} else
setState(ViewState.Idle);
}
searchAllergies(String searchKey) async {
setState(ViewState.BusyLocal);
await _SOAPService.searchAllergies(searchKey);
@ -953,6 +976,18 @@ class SOAPViewModel extends BaseViewModel {
setState(ViewState.Idle);
}
updateAllergies(
PatientAllergiesVidaPlus request, PatiantInformtion patientInfo) async {
setState(ViewState.BusyLocal);
await _SOAPService.updateAllergies(request, patientInfo);
if (_SOAPService.hasError) {
error = _SOAPService.error;
setState(ViewState.ErrorLocal);
} else
setState(ViewState.Idle);
}
saveHopi(Map<String, dynamic> req, PatiantInformtion patientInfo) async {
setState(ViewState.BusyLocal);
await _SOAPService.saveHopi(req, patientInfo);
@ -1002,4 +1037,41 @@ class SOAPViewModel extends BaseViewModel {
} else
setState(ViewState.Idle);
}
updateChiefComplaint(PatiantInformtion patientInfo, GetChiefComplaintVidaPlus CC) async {
setState(ViewState.BusyLocal);
await _SOAPService.updateChiefComplaintVidaPlus(patientInfo, CC);
if (_SOAPService.hasError) {
error = _SOAPService.error;
setState(ViewState.ErrorLocal);
} else
setState(ViewState.Idle);
}
episodeByChiefComplaint(PatiantInformtion patientInfo) async {
setState(ViewState.BusyLocal);
await _SOAPService.episodeByChiefComplaint(patientInfo);
if (_SOAPService.hasError) {
error = _SOAPService.error;
setState(ViewState.ErrorLocal);
} else
setState(ViewState.Idle);
}
createCCByEpisode(PatiantInformtion patientInfo, List<PatientPomrs> chiefComplaint) async {
setState(ViewState.BusyLocal);
await _SOAPService.continueEpisodeVidaPlus(patientInfo, chiefComplaint);
if (_SOAPService.hasError) {
error = _SOAPService.error;
setState(ViewState.ErrorLocal);
} else
setState(ViewState.Idle);
}
getHomeMedication(PatiantInformtion patientInfo) async {
setState(ViewState.BusyLocal);
await _SOAPService.getHomeMedication(patientInfo);
if (_SOAPService.hasError) {
error = _SOAPService.error;
setState(ViewState.ErrorLocal);
} else
setState(ViewState.Idle);
}
}

@ -138,11 +138,7 @@ openReaction(model, AllergiesListVidaPlus mySelectedAllergy){
mySelectedAllergy: mySelectedAllergy,
patientInfo: widget.patientInfo
)
// addReactionFun: (AllergiesListVidaPlus mySelectedAllergy) {
//
// Navigator.of(context).pop();
//
// })
));
}

@ -1,18 +1,17 @@
import 'package:doctor_app_flutter/config/config.dart';
import 'package:doctor_app_flutter/core/model/SOAP/allergy/get_allergies_list_vida_plus.dart';
import 'package:doctor_app_flutter/core/model/SOAP/allergy/get_patient_allergies_list_vida_plus.dart';
import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart';
import 'package:doctor_app_flutter/screens/base/base_view.dart';
import 'package:doctor_app_flutter/screens/patients/patient_search/patient_search_header.dart';
import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.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/rounded_container_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import '../../../../../../config/config.dart';
import '../../../../../../core/model/patient/patiant_info_model.dart';
import '../../../../../../core/viewModel/project_view_model.dart';
import '../../../../../../widgets/shared/app_scaffold_widget.dart';
import '../../../../../../widgets/shared/buttons/app_buttons_widget.dart';
import '../../../../../base/base_view.dart';
import '../../../../patient_search/patient_search_header.dart';
class ReactionsSelectionAllergiesWidget extends StatefulWidget {
@ -27,10 +26,9 @@ class ReactionsSelectionAllergiesWidget extends StatefulWidget {
Key? key,
required this.model,
required this.patientInfo,
this.mySelectedAllergy,
this.mySelectedAllergy,
this.editSelectedAllergy,
this.isEdit = false,
this.buttonName,
}) : super(key: key);
@ -42,7 +40,7 @@ class ReactionsSelectionAllergiesWidget extends StatefulWidget {
class _ReactionsSelectionAllergiesWidgetState
extends State<ReactionsSelectionAllergiesWidget> {
bool loading = false;
TextEditingController remark = TextEditingController();
@override
void initState() {
super.initState();
@ -50,367 +48,474 @@ class _ReactionsSelectionAllergiesWidgetState
@override
Widget build(BuildContext context) {
return BaseView<SOAPViewModel>(
builder: (_, model, w) => AppScaffold(
isLoading:loading,
appBar: PatientSearchHeader(
title: widget.mySelectedAllergy !=null ?widget.mySelectedAllergy!.allergyName : widget.editSelectedAllergy!.allergyName
),
body: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
widget.mySelectedAllergy != null ? Expanded(
child: RoundedContainer(
margin: EdgeInsets.all(15),
child: ListView.builder(
itemCount:
widget.mySelectedAllergy!.allergyReactionDTOs!.length,
itemBuilder: (context, index) {
loading = false;
return Column(children: [
ExpansionTile(
key: Key(index.toString()),
dense: false,
enableFeedback: false,
showTrailingIcon: false,
initiallyExpanded: widget
.mySelectedAllergy!
.allergyReactionDTOs![index].isSelected!,
leading:
Checkbox(
activeColor: Color(0xffD02127),
value: widget
.mySelectedAllergy!
.allergyReactionDTOs![index].isSelected!, onChanged: (value) {
widget
.mySelectedAllergy!
.allergyReactionDTOs![index].isSelected = value;
setState(() {
});
builder: (_, model, w) => AppScaffold(
isLoading: loading,
appBar: PatientSearchHeader(
title: widget.mySelectedAllergy != null
? widget.mySelectedAllergy!.allergyName
: widget.editSelectedAllergy!.allergyName),
body: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
widget.mySelectedAllergy != null
? Expanded(
child: RoundedContainer(
margin: EdgeInsets.only(top:10, left: 15, right: 15, bottom: 10),
child: ListView.builder(
itemCount: widget.mySelectedAllergy!
.allergyReactionDTOs!.length,
itemBuilder: (context, index) {
loading = false;
}),
title: AppText(widget
.mySelectedAllergy!
.allergyReactionDTOs![index]
.allergyReactionName!),
children: [
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Expanded(
child: ListTile(
title: Row(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Radio(
activeColor: Color(0xffD02127),
materialTapTargetSize:
MaterialTapTargetSize.shrinkWrap,
// Reduces padding around checkbox
visualDensity: VisualDensity.compact,
value: 1,
groupValue: widget
.mySelectedAllergy!
.allergyReactionDTOs![index]
.severity,
onChanged: (value) {
widget
.mySelectedAllergy!
.allergyReactionDTOs![index]
.severity = value;
setState(() {});
},
),
AppText(
TranslationBase.of(context).mild,
fontSize: 10,
),
],
))),
Expanded(
child: ListTile(
title: Row(
children: <Widget>[
Radio(
return Column(children: [
ExpansionTile(
key: Key(index.toString()),
dense: false,
enableFeedback: false,
showTrailingIcon: false,
initiallyExpanded: widget
.mySelectedAllergy!
.allergyReactionDTOs![index]
.isSelected!,
leading: Checkbox(
activeColor: Color(0xffD02127),
materialTapTargetSize:
MaterialTapTargetSize.shrinkWrap,
// Reduces padding around checkbox
visualDensity: VisualDensity.compact,
value: 2,
groupValue: widget
value: widget
.mySelectedAllergy!
.allergyReactionDTOs![index]
.severity,
.isSelected!,
onChanged: (value) {
widget
.mySelectedAllergy!
.allergyReactionDTOs![index]
.severity = value;
.isSelected = value;
setState(() {});
},
),
AppText(
TranslationBase.of(context).moderate,
fontSize: 10,
),
}),
title: AppText(widget
.mySelectedAllergy!
.allergyReactionDTOs![index]
.allergyReactionName!),
children: [
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Expanded(
child: ListTile(
title: Row(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Radio(
activeColor: Color(0xffD02127),
materialTapTargetSize:
MaterialTapTargetSize
.shrinkWrap,
// Reduces padding around checkbox
visualDensity:
VisualDensity.compact,
value: 1,
groupValue: widget
.mySelectedAllergy!
.allergyReactionDTOs![index]
.severity,
onChanged: (value) {
widget
.mySelectedAllergy!
.allergyReactionDTOs![
index]
.severity = value;
setState(() {});
},
),
AppText(
TranslationBase.of(context)
.mild,
fontSize: 10,
),
],
))),
Expanded(
child: ListTile(
title: Row(
children: <Widget>[
Radio(
activeColor: Color(0xffD02127),
materialTapTargetSize:
MaterialTapTargetSize
.shrinkWrap,
// Reduces padding around checkbox
visualDensity:
VisualDensity.compact,
value: 2,
groupValue: widget
.mySelectedAllergy!
.allergyReactionDTOs![index]
.severity,
onChanged: (value) {
widget
.mySelectedAllergy!
.allergyReactionDTOs![
index]
.severity = value;
setState(() {});
},
),
AppText(
TranslationBase.of(context)
.moderate,
fontSize: 10,
),
],
))),
Expanded(
child: ListTile(
title: Row(
children: <Widget>[
Radio(
activeColor: Color(0xffD02127),
materialTapTargetSize:
MaterialTapTargetSize
.shrinkWrap,
// Reduces padding around checkbox
visualDensity:
VisualDensity.compact,
value: 3,
groupValue: widget
.mySelectedAllergy!
.allergyReactionDTOs![index]
.severity,
onChanged: (value) {
widget
.mySelectedAllergy!
.allergyReactionDTOs![
index]
.severity = value;
setState(() {});
},
),
AppText(
TranslationBase.of(context)
.severe,
fontSize: 10,
),
],
)))
],
)
],
))),
Expanded(
child: ListTile(
title: Row(
children: <Widget>[
Radio(
),
Divider(),
]);
},
)))
: Expanded(
child: RoundedContainer(
margin: EdgeInsets.all(15),
child: ListView.builder(
itemCount: widget.editSelectedAllergy!
.patientsAllergyReactionsDTOs!.length,
itemBuilder: (context, index) {
loading = false;
return Column(children: [
ExpansionTile(
key: Key(index.toString()),
dense: false,
enableFeedback: false,
showTrailingIcon: false,
initiallyExpanded: widget
.editSelectedAllergy!
.patientsAllergyReactionsDTOs![index]
.isSelected!,
leading: Checkbox(
activeColor: Color(0xffD02127),
materialTapTargetSize:
MaterialTapTargetSize.shrinkWrap,
// Reduces padding around checkbox
visualDensity: VisualDensity.compact,
value: 3,
groupValue: widget
.mySelectedAllergy!
.allergyReactionDTOs![index]
.severity,
value: widget
.editSelectedAllergy!
.patientsAllergyReactionsDTOs![
index]
.isSelected!,
onChanged: (value) {
widget
.mySelectedAllergy!
.allergyReactionDTOs![index]
.severity = value;
.editSelectedAllergy!
.patientsAllergyReactionsDTOs![
index]
.isSelected = value;
setState(() {});
},
),
AppText(
TranslationBase.of(context).severe,
fontSize: 10,
),
],
)))
],
)
],
),
Divider(),
]);
},
))) : Expanded(
child: RoundedContainer(
margin: EdgeInsets.all(15),
child: ListView.builder(
itemCount:
widget.editSelectedAllergy!.patientsAllergyReactionsDTOs!.length,
itemBuilder: (context, index) {
loading = false;
return Column(children: [
ExpansionTile(
key: Key(index.toString()),
dense: false,
enableFeedback: false,
showTrailingIcon: false,
initiallyExpanded: widget.editSelectedAllergy!.patientsAllergyReactionsDTOs![index].isSelected!,
leading:
Checkbox(
activeColor: Color(0xffD02127),
value: widget.editSelectedAllergy!.patientsAllergyReactionsDTOs![index].isSelected!, onChanged: (value) {
widget.editSelectedAllergy!.patientsAllergyReactionsDTOs![index].isSelected = value;
setState(() {
});
}),
title: AppText( widget.editSelectedAllergy!.patientsAllergyReactionsDTOs![index]
.allergyReactionName!),
children: [
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Expanded(
child: ListTile(
title: Row(
}),
title: AppText(widget
.editSelectedAllergy!
.patientsAllergyReactionsDTOs![index]
.allergyReactionName!),
children: [
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Expanded(
child: ListTile(
title: Row(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Radio(
activeColor: Color(0xffD02127),
materialTapTargetSize:
MaterialTapTargetSize.shrinkWrap,
MaterialTapTargetSize
.shrinkWrap,
// Reduces padding around checkbox
visualDensity: VisualDensity.compact,
value: TranslationBase.of(context).mild,
groupValue:getSeverityByID(widget.editSelectedAllergy!.patientsAllergyReactionsDTOs![index]
visualDensity:
VisualDensity.compact,
value:
TranslationBase.of(context)
.mild,
groupValue: getSeverityByID(widget
.editSelectedAllergy!
.patientsAllergyReactionsDTOs![
index]
.severity!),
onChanged: (value) {
widget.editSelectedAllergy!.patientsAllergyReactionsDTOs![index]
.reactionSelection = getSeverityByID(widget.editSelectedAllergy!.patientsAllergyReactionsDTOs![index]
.severity!);
widget
.editSelectedAllergy!
.patientsAllergyReactionsDTOs![
index]
.reactionSelection =
getSeverityByID(widget
.editSelectedAllergy!
.patientsAllergyReactionsDTOs![
index]
.severity!);
setState(() {});
},
),
AppText(
TranslationBase.of(context).mild,
TranslationBase.of(context)
.mild,
fontSize: 10,
),
],
))),
Expanded(
child: ListTile(
title: Row(
Expanded(
child: ListTile(
title: Row(
children: <Widget>[
Radio(
activeColor: Color(0xffD02127),
materialTapTargetSize:
MaterialTapTargetSize.shrinkWrap,
MaterialTapTargetSize
.shrinkWrap,
// Reduces padding around checkbox
visualDensity: VisualDensity.compact,
value: TranslationBase.of(context).moderate,
groupValue: getSeverityByID(widget.editSelectedAllergy!.patientsAllergyReactionsDTOs![index]
visualDensity:
VisualDensity.compact,
value:
TranslationBase.of(context)
.moderate,
groupValue: getSeverityByID(widget
.editSelectedAllergy!
.patientsAllergyReactionsDTOs![
index]
.severity!),
onChanged: (value) {
widget.editSelectedAllergy!.patientsAllergyReactionsDTOs![index]
.reactionSelection =getSeverityByID(widget.editSelectedAllergy!.patientsAllergyReactionsDTOs![index]
.severity!);
widget
.editSelectedAllergy!
.patientsAllergyReactionsDTOs![
index]
.reactionSelection =
getSeverityByID(widget
.editSelectedAllergy!
.patientsAllergyReactionsDTOs![
index]
.severity!);
setState(() {});
},
),
AppText(
TranslationBase.of(context).moderate,
TranslationBase.of(context)
.moderate,
fontSize: 10,
),
],
))),
Expanded(
child: ListTile(
title: Row(
Expanded(
child: ListTile(
title: Row(
children: <Widget>[
Radio(
activeColor: Color(0xffD02127),
materialTapTargetSize:
MaterialTapTargetSize.shrinkWrap,
MaterialTapTargetSize
.shrinkWrap,
// Reduces padding around checkbox
visualDensity: VisualDensity.compact,
value: TranslationBase.of(context).severe,
groupValue: getSeverityByID(widget.editSelectedAllergy!.patientsAllergyReactionsDTOs![index]
visualDensity:
VisualDensity.compact,
value:
TranslationBase.of(context)
.severe,
groupValue: getSeverityByID(widget
.editSelectedAllergy!
.patientsAllergyReactionsDTOs![
index]
.severity!),
onChanged: (value) {
widget.editSelectedAllergy!.patientsAllergyReactionsDTOs![index]
.reactionSelection =getSeverityByID(widget.editSelectedAllergy!.patientsAllergyReactionsDTOs![index]
.severity!);
widget
.editSelectedAllergy!
.patientsAllergyReactionsDTOs![
index]
.reactionSelection =
getSeverityByID(widget
.editSelectedAllergy!
.patientsAllergyReactionsDTOs![
index]
.severity!);
setState(() {});
},
),
AppText(
TranslationBase.of(context).severe,
TranslationBase.of(context)
.severe,
fontSize: 10,
),
],
)))
],
)
],
),
Divider(),
]);
},
)))
],
),
bottomSheet: Container(
height: 90,
color: Colors.white,
margin: EdgeInsets.all(10),
child: Row(
children: [
Expanded(
child: Container(
child: AppButton(
title: TranslationBase.of(context).cancel,
vPadding: 8,
hPadding: 8,
color: Color(0xffEAEAEA),
fontColor: Colors.black,
onPressed: () {
Navigator.of(context).pop();
},
),
),
),
SizedBox(
width: 8,
),
Expanded(
child: Container(
child: AppButton(
loading: loading,
title: TranslationBase.of(context).save,
vPadding: 8,
hPadding: 8,
color: AppGlobal.appGreenColor,
fontColor: Colors.white,
onPressed: () {
if(widget.mySelectedAllergy ==null) {
],
)
],
),
Divider(),
]);
},
))),
editAllergy();
}
else{
Container(
margin: EdgeInsets.only(left: 15, right: 15),
child: AppTextFieldCustom(
addAllergy();
hintText:
TranslationBase.of(context).remarks,
controller: remark,
maxLines: 4,
minLines: 4,
hasBorder: true,
inputType: TextInputType.multiline,
}
},
),
),
),
onClick: () {},
onChanged: (value) {},
onFieldSubmitted: () {},
)),
SizedBox(height: 90,)
],
))
),
bottomSheet: Container(
height: 70,
color: Colors.white,
margin: EdgeInsets.all(10),
child: Row(
children: [
Expanded(
child: Container(
child: AppButton(
title: TranslationBase.of(context).cancel,
vPadding: 8,
hPadding: 8,
color: Color(0xffEAEAEA),
fontColor: Colors.black,
onPressed: () {
Navigator.of(context).pop();
},
),
),
),
SizedBox(
width: 8,
),
Expanded(
child: Container(
child: AppButton(
loading: loading,
title: TranslationBase.of(context).save,
vPadding: 8,
hPadding: 8,
color: AppGlobal.appGreenColor,
fontColor: Colors.white,
onPressed: () {
if (widget.isEdit == true) {
editAllergy();
} else {
addAllergy();
}
},
),
),
),
],
))
// CustomBottomSheetContainer(
// buttonColor: Color(0xff359846),
// fontColor: Colors.white,
// label: TranslationBase.of(context).next,
// onTap: () {
// widget.addReactionFun(widget
// .mySelectedAllergy
// );
// },
// )
// CustomBottomSheetContainer(
// buttonColor: Color(0xff359846),
// fontColor: Colors.white,
// label: TranslationBase.of(context).next,
// onTap: () {
// widget.addReactionFun(widget
// .mySelectedAllergy
// );
// },
// )
));
));
}
getSeverityByID(int id){
Map<int,dynamic> severity={
1:TranslationBase.of(context).mild,
2:TranslationBase.of(context).moderate,
3:TranslationBase.of(context).severe
};
getSeverityByID(int id) {
Map<int, dynamic> severity = {
1: TranslationBase.of(context).mild,
2: TranslationBase.of(context).moderate,
3: TranslationBase.of(context).severe
};
return severity[id];
}
addAllergy() async{
setLoader(true);
AllergiesListVidaPlus request = widget
.mySelectedAllergy!;
request.allergyReactionDTOs = widget
.mySelectedAllergy!.allergyReactionDTOs!.where((i) => i.isSelected!).toList();
await widget.model!.addAllergies(request, widget.patientInfo);
setLoader(false);
Navigator.of(context).pop();
addAllergy() async {
setLoader(true);
AllergiesListVidaPlus request = widget.mySelectedAllergy!;
request.remark = remark.text;
request.allergyReactionDTOs = widget.mySelectedAllergy!.allergyReactionDTOs!
.where((i) => i.isSelected!)
.toList();
await widget.model!.addAllergies(request, widget.patientInfo);
await widget.model!.getAllergiesVidaPlus(widget.patientInfo);
setLoader(false);
Navigator.of(context).pop();
}
editAllergy(){
editAllergy() async{
setLoader(true);
PatientAllergiesVidaPlus request = widget.editSelectedAllergy!;
request.remark = remark.text;
request.patientsAllergyReactionsDTOs =[];
widget.mySelectedAllergy!.allergyReactionDTOs!
.forEach((i){
if(i.isSelected!){
request.patientsAllergyReactionsDTOs!.add(PatientsAllergyReactionsDTOs(
pomrId: i.pomrid,
patientID:i.patientID,
hospitalGroupID:i.hospitalGroupID,
hospitalID:i.hospitalID,
isActive:i.isActive,
allergyReactionMappingID:i.allergyReactionMappingID,
allergyReactionID:i.allergyReactionID,
allergyReactionName: i.allergyReactionName,
severity:i.severity,
));
}
});
await widget.model!.updateAllergies(request, widget.patientInfo);
setLoader(false);
Navigator.of(context).pop();
}
setLoader(bool value) {
loading = value;
setState(() {
});
setState(() {});
}
}

@ -102,8 +102,9 @@ class _UpdateAllergiesWidgetState extends State<UpdateAllergiesWidgetVidaPlus> {
fontWeight: FontWeight.w800,
letterSpacing: -0.48,
),
selectedAllergy
.patientsAllergyReactionsDTOs!.isNotEmpty
selectedAllergy.patientsAllergyReactionsDTOs!
.isNotEmpty &&
selectedAllergy.isActivePatientsAllergy!
? ListView(
shrinkWrap: true,
children: selectedAllergy
@ -114,6 +115,9 @@ class _UpdateAllergiesWidgetState extends State<UpdateAllergiesWidgetVidaPlus> {
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
SizedBox(
height: 5,
),
Row(
children: [
AppText(
@ -128,7 +132,8 @@ class _UpdateAllergiesWidgetState extends State<UpdateAllergiesWidgetVidaPlus> {
reaction.severity! -
1]
.name,
color:getColor(reaction.severity!),
color: getColor(
reaction.severity!),
fontSize: 10,
fontWeight: FontWeight.w600,
letterSpacing: -0.48,
@ -138,49 +143,70 @@ class _UpdateAllergiesWidgetState extends State<UpdateAllergiesWidgetVidaPlus> {
],
))
.toList())
: AppText("----"),
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
SizedBox(
height: 10,
),
TextButton.icon(
onPressed: () {
Navigator.push(
context,
FadePage(
page:
ReactionsSelectionAllergiesWidget(
model: model,
mySelectedAllergy: null,
editSelectedAllergy: selectedAllergy!,
patientInfo: widget.patientInfo,
)));
},
icon: SvgPicture.asset(
"assets/images/svgs/edit-icon.svg",
height: 16,
),
label: AppText(
TranslationBase.of(context).edit,
fontSize: 12,
),
),
TextButton.icon(
onPressed: () {
resolveAllergy(model, selectedAllergy);
},
icon: SvgPicture.asset(
"assets/images/svgs/resolve.svg",
height: 18,
),
label: AppText(
TranslationBase.of(context).resolve,
fontSize: 12,
color: Color(0xff359846)))
],
)
: selectedAllergy.isActivePatientsAllergy!
? AppText("----")
: AppText(
TranslationBase.of(context).resolved,
color: Colors.lightBlue,
fontSize: 10,
fontWeight: FontWeight.w600,
letterSpacing: -0.48,
),
selectedAllergy.isActivePatientsAllergy! &&
selectedAllergy.allergyID! != 0
? Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
TextButton.icon(
onPressed: () {
editAllergy(selectedAllergy, model);
},
icon: SvgPicture.asset(
"assets/images/svgs/edit-icon.svg",
height: 16,
),
label: AppText(
TranslationBase.of(context).edit,
fontSize: 12,
),
),
TextButton.icon(
onPressed: () {
resolveAllergy(
model, selectedAllergy);
},
icon: SvgPicture.asset(
"assets/images/svgs/resolve.svg",
height: 18,
),
label: AppText(
TranslationBase.of(context).resolve,
fontSize: 12,
color: Color(0xff359846)))
],
)
: selectedAllergy.allergyID! != 0
? Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
TextButton.icon(
onPressed: () {
activateAllergy(
model, selectedAllergy);
},
icon: SvgPicture.asset(
"assets/images/svgs/resolve.svg",
height: 18,
color: Color(0xffD02127),
),
label: AppText(
TranslationBase.of(context)
.activate,
fontSize: 12,
color: Color(0xffD02127)))
],
)
: SizedBox()
],
);
}).toList()),
@ -189,19 +215,58 @@ class _UpdateAllergiesWidgetState extends State<UpdateAllergiesWidgetVidaPlus> {
}
resolveAllergy(
SOAPViewModel model, PatientAllergiesVidaPlus selectedAllergy) async{
SOAPViewModel model, PatientAllergiesVidaPlus selectedAllergy) async {
GifLoaderDialogUtils.showMyDialog(context);
await model.resolveAllergies(selectedAllergy, widget.patientInfo);
await model.resolveAllergies(selectedAllergy, widget.patientInfo);
await model.getAllergiesVidaPlus(widget.patientInfo);
GifLoaderDialogUtils.hideDialog(context);
}
activateAllergy(
SOAPViewModel model, PatientAllergiesVidaPlus selectedAllergy) async {
GifLoaderDialogUtils.showMyDialog(context);
await model.updateAllergies(selectedAllergy, widget.patientInfo);
await model.getAllergiesVidaPlus(widget.patientInfo);
GifLoaderDialogUtils.hideDialog(context);
}
Color getColor(int severity){
Map<int,dynamic> color ={
1:Color(0xff359846) ,
2:Color(0xFFCC9B14),
3:Color(0xffD02127)
Color getColor(int severity) {
Map<int, dynamic> color = {
1: Color(0xff359846),
2: Color(0xFFCC9B14),
3: Color(0xffD02127)
};
return color[severity];
return color[severity];
}
editAllergy(
PatientAllergiesVidaPlus selectedAllergy, SOAPViewModel model) async {
GifLoaderDialogUtils.showMyDialog(context);
await model.getEditAllergiesVidaPlus(selectedAllergy.allergyID!);
GifLoaderDialogUtils.hideDialog(context);
markSelected(selectedAllergy, model);
Navigator.push(
context,
FadePage(
page: ReactionsSelectionAllergiesWidget(
model: model,
mySelectedAllergy: model.searchAllergiesVidaPlus[0],
editSelectedAllergy: selectedAllergy!,
patientInfo: widget.patientInfo,
isEdit: true,
)));
}
markSelected(PatientAllergiesVidaPlus selectedAllergy, SOAPViewModel model) {
model.searchAllergiesVidaPlus[0].allergyReactionDTOs!.forEach((element) {
selectedAllergy.patientsAllergyReactionsDTOs!.forEach((element2) {
if (element.allergyReactionID == element2.allergyReactionID) {
element.isSelected = true;
element.severity =element2.severity;
}
});
});
}
}

@ -1,3 +1,5 @@
import 'package:doctor_app_flutter/core/model/SOAP/chief_complaint/episode_by_chief_complaint_vidaplus.dart';
import 'package:doctor_app_flutter/core/model/SOAP/chief_complaint/get_chief_complaint_vida_plus.dart';
import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart';
import 'package:doctor_app_flutter/screens/base/base_view.dart';
@ -9,29 +11,38 @@ import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart';
import 'package:flutter/material.dart';
class AddChiefComplaint extends StatelessWidget {
final List<String> complaints;
class AddChiefComplaint extends StatefulWidget {
final List<GetChiefComplaintVidaPlus> complaints;
final String selectedType;
final String? firstField;
final String? secondField;
final String? thirdField;
final PatiantInformtion patientInfo;
const AddChiefComplaint(
{super.key,
required this.complaints,
required this.selectedType,
this.firstField,
this.secondField,
this.thirdField,
required this.patientInfo
});
const AddChiefComplaint({super.key,
required this.complaints,
required this.selectedType,
this.firstField,
this.secondField,
this.thirdField,
required this.patientInfo
});
@override
State<AddChiefComplaint> createState() => _AddChiefComplaintState();
}
class _AddChiefComplaintState extends State<AddChiefComplaint> {
@override
Widget build(BuildContext context) {
return BaseView<SOAPViewModel>(
onModelReady: (model){
episodeByChiefComplaint(model);
},
builder: (_, model, w) => AppScaffold(
isShowAppBar: true,
appBar: PatientSearchHeader(
title: TranslationBase.of(context).addChiefComplaint
),
@ -43,21 +54,29 @@ class AddChiefComplaint extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.start,
children: [
ComplaintSelection(
complaints: ['option1' ,'option 2'],
selectedType: selectedType,
firstField: firstField,
secondField: secondField,
thirdField: thirdField,
complaints: widget.complaints,
selectedType: widget.selectedType,
firstField: widget.firstField,
secondField:widget. secondField,
thirdField: widget.thirdField,
searchData: model.searchChiefComplaintList,
onSearch:(String value){
searchChiefComplaint(model, value);
},
onSave: (String chiefComplaint){
addChiefComplaint(model, chiefComplaint);
addChiefComplaint(model, chiefComplaint, context);
},
onCrossClicked: (GetChiefComplaintVidaPlus chiefComplaint){
updateChiefComplaint(model, chiefComplaint, context);
},
),
SizedBox(height: 16,),
PreviousCheifComplaints()
PreviousChiefComplaints(
model.episodeByChiefComplaintListVidaPlus,
(List<PatientPomrs> chiefComplaint){
createCCByEpisode(model, chiefComplaint);
},
)
],
),
),
@ -65,13 +84,33 @@ class AddChiefComplaint extends StatelessWidget {
),
);
}
addChiefComplaint(SOAPViewModel model, String CC) async{
await model.saveChiefComplaint(patientInfo, CC);
addChiefComplaint(SOAPViewModel model, String CC, BuildContext context) async{
GifLoaderDialogUtils.showMyDialog(context);
await model.saveChiefComplaint(widget.patientInfo, CC);
await model.getChiefComplaint(widget.patientInfo);
GifLoaderDialogUtils.hideDialog(context);
}
searchChiefComplaint(SOAPViewModel model, String CC) async{
await model.searchChiefComplaint(widget.patientInfo, CC);
}
updateChiefComplaint(SOAPViewModel model, GetChiefComplaintVidaPlus cc, BuildContext context) async{
GifLoaderDialogUtils.showMyDialog(context);
await model.updateChiefComplaint(widget.patientInfo, cc);
await model.getChiefComplaint(widget.patientInfo);
GifLoaderDialogUtils.hideDialog(context);
setState(() {
await model.searchChiefComplaint(patientInfo, CC);
});
}
episodeByChiefComplaint(SOAPViewModel model) async{
await model.episodeByChiefComplaint(widget.patientInfo);
}
createCCByEpisode(model, List<PatientPomrs> chiefComplaint) async{
GifLoaderDialogUtils.showMyDialog(context);
await model.createCCByEpisode(widget.patientInfo, chiefComplaint);
GifLoaderDialogUtils.hideDialog(context);
Navigator.of(context).pop();
}
}

@ -1,20 +1,28 @@
import 'package:doctor_app_flutter/core/model/SOAP/chief_complaint/get_chief_complaint_vida_plus.dart';
import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart';
import 'package:doctor_app_flutter/screens/base/base_view.dart';
import 'package:doctor_app_flutter/screens/patients/profile/soap_update/subjective/medication/update_medication_widget.dart';
import 'package:doctor_app_flutter/screens/patients/profile/soap_update_vida_plus/subjective/chief_complaint/AddChiefComplaints.dart';
import 'package:doctor_app_flutter/screens/patients/profile/soap_update_vida_plus/subjective/chief_complaint/widgets/add_soap_item.dart';
import 'package:doctor_app_flutter/screens/patients/profile/soap_update_vida_plus/subjective/chief_complaint/widgets/complaint_items.dart';
import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.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';
import 'package:flutter/rendering.dart';
class UpdateChiefComplaints extends StatelessWidget {
final List<String> complaints;
final PatiantInformtion patientInfo;
const UpdateChiefComplaints({Key? key, required this.complaints, required this.patientInfo})
: super(key: key);
@override
Widget build(BuildContext context) {
TextEditingController medicationController = TextEditingController();
return BaseView<SOAPViewModel>(
onModelReady: (model){
WidgetsBinding.instance.addPostFrameCallback((_) {
@ -30,7 +38,7 @@ class UpdateChiefComplaints extends StatelessWidget {
context,
MaterialPageRoute(
builder: (BuildContext context) => AddChiefComplaint(
complaints: complaints,
complaints: model.getChiefComplaintListVidaPlus,
patientInfo: patientInfo,
selectedType: '',
@ -39,7 +47,7 @@ class UpdateChiefComplaints extends StatelessWidget {
thirdField: ''),
));
},
title: "Add Chief Complaint",
title: TranslationBase.of(context).addChiefComplaint,
),
SizedBox(height: 16),
Container(width: MediaQuery.of(context).size.width,
@ -51,10 +59,12 @@ class UpdateChiefComplaints extends StatelessWidget {
itemCount: model.getChiefComplaintListVidaPlus.length,
itemBuilder: (_, index) =>
ComplaintItems(
complaint: model.getChiefComplaintListVidaPlus[index].chiefComplain!,
onCrossClicked: (complaints) {})
complaint: model.getChiefComplaintListVidaPlus[index]!,
onCrossClicked: (complaints) {
))
})
)),
]),
));
@ -62,4 +72,5 @@ class UpdateChiefComplaints extends StatelessWidget {
getChiefComplaints(SOAPViewModel model){
model.getChiefComplaint(patientInfo);
}
}

@ -1,5 +1,6 @@
import 'dart:async';
import 'package:doctor_app_flutter/core/enum/view_state.dart';
import 'package:doctor_app_flutter/core/model/SOAP/chief_complaint/get_chief_complaint_vida_plus.dart';
import 'package:doctor_app_flutter/core/model/SOAP/chief_complaint/search_chief_complaint_vidaplus.dart';
import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart';
import 'package:doctor_app_flutter/screens/base/base_view.dart';
@ -9,7 +10,7 @@ import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
import 'package:flutter/material.dart';
class ComplaintSelection extends StatefulWidget {
final List<String> complaints;
final List<GetChiefComplaintVidaPlus> complaints;
final String selectedType;
final String? firstField;
final String? secondField;
@ -17,7 +18,7 @@ class ComplaintSelection extends StatefulWidget {
final Function(String cheifComplaint)? onSave;
final Function(String value)? onSearch;
final List<SearchChiefComplaint>? searchData;
final Function(GetChiefComplaintVidaPlus)? onCrossClicked;
const ComplaintSelection({super.key,
required this.complaints,
required this.selectedType,
@ -26,7 +27,8 @@ class ComplaintSelection extends StatefulWidget {
this.thirdField,
this.onSave,
this.onSearch,
this.searchData
this.searchData,
this.onCrossClicked
});
@override
@ -233,7 +235,7 @@ class _ComplaintSelectionState extends State<ComplaintSelection> {
});
}
TextEditingController searchController = TextEditingController();
Widget TextWithSelectedItems(SOAPViewModel model) {
return Material(
shape: RoundedRectangleBorder(
@ -265,7 +267,7 @@ class _ComplaintSelectionState extends State<ComplaintSelection> {
TextFormField(
autofocus: true,
controller: searchController,
decoration: InputDecoration(
hintText: '',
border: InputBorder.none,
@ -298,7 +300,9 @@ class _ComplaintSelectionState extends State<ComplaintSelection> {
var cc = widget.searchData![index].chiefComplain;
model.searchChiefComplaintList!.length =0;
setState((){});
widget.onSave!(cc!);
searchController.text ='';
}));
}))))]),
@ -313,8 +317,11 @@ class _ComplaintSelectionState extends State<ComplaintSelection> {
itemBuilder: (context, index) {
return ComplaintItems(
complaint: widget.complaints[index],
onCrossClicked: (complaints) {});
complaint: widget.complaints[index]!,
isDeletable:true,
onCrossClicked: (complaints) {
widget.onCrossClicked!(complaints);
});
})
// }),
),

@ -1,32 +1,63 @@
import 'package:doctor_app_flutter/core/model/SOAP/chief_complaint/get_chief_complaint_vida_plus.dart';
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
import 'package:flutter/material.dart';
class ComplaintItems extends StatelessWidget {
final String complaint;
final Function(String) onCrossClicked;
class ComplaintItems extends StatefulWidget {
final GetChiefComplaintVidaPlus complaint;
final Function(GetChiefComplaintVidaPlus) onCrossClicked;
final bool isDeletable;
const ComplaintItems(
{super.key, required this.complaint, required this.onCrossClicked});
{super.key, required this.complaint, required this.onCrossClicked, this.isDeletable = false});
@override
State<ComplaintItems> createState() => _ComplaintItemsState();
}
class _ComplaintItemsState extends State<ComplaintItems> {
@override
Widget build(BuildContext context) {
return Container(
return Stack(children: [ Container(
padding: const EdgeInsets.all(5.0),
width: 120,
height: 40,
margin:const EdgeInsets.all(5.0) ,
alignment: Alignment.center,
decoration: BoxDecoration(
color: Color(0xffEAEAEA),
borderRadius: BorderRadius.circular(
5,
)),
child: AppText(
textOverflow: TextOverflow.ellipsis,
complaint,
child:Text(
widget.complaint.chiefComplain!,
style: TextStyle(
overflow: TextOverflow.ellipsis,
fontWeight: FontWeight.w400,
height: 1.2,
fontSize: 14,
color: Color(0xFF575757),
color: Color(0xFF575757),
),
maxLines: 1,
softWrap: false,
textAlign: TextAlign.center,
)),
widget.isDeletable ? Positioned(
top:0,
bottom: 0,
right: 10,
child: InkWell(
onTap: () {
widget.onCrossClicked(widget.complaint);
},
child: Icon(
Icons.close,
size: 18,
color: Color(0xFFD02127),
),
);
),
) :SizedBox()
],);
}
}

@ -28,13 +28,17 @@ class ListOfComplaintsItem extends StatelessWidget {
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
AppText(
name,
fontWeight: FontWeight.w600,
fontSize: 16,
textAlign: TextAlign.start,
color: Color(0xFF2E303A),
textOverflow: TextOverflow.ellipsis,
),
SizedBox(
height: 4,
),
@ -50,15 +54,23 @@ class ListOfComplaintsItem extends StatelessWidget {
SizedBox(
width: 4,
),
AppText(
Container(
width: MediaQuery.of(context).size.width * 0.32,
child: AppText(
createdBy,
fontWeight: FontWeight.w400,
fontSize: 15,
fontSize: 12,
textAlign: TextAlign.start,
textOverflow: TextOverflow.ellipsis,
color: Color(0xFF2E303A),
),
)
],
),
SizedBox(
height: 5,
),
Row(
children: [
AppText(
@ -71,13 +83,19 @@ class ListOfComplaintsItem extends StatelessWidget {
SizedBox(
width: 4,
),
AppText(
Container(
width: MediaQuery.of(context).size.width * 0.32,
child:AppText(
createdAt,
fontWeight: FontWeight.w400,
textAlign: TextAlign.start,
fontSize: 15,
fontSize: 12,
textOverflow: TextOverflow.ellipsis,
color: Color(0xFF2E303A),
),
allowExpand: false,
maxLines: 1,
)),
],
)
],

@ -1,11 +1,16 @@
import 'package:doctor_app_flutter/core/model/SOAP/chief_complaint/episode_by_chief_complaint_vidaplus.dart';
import 'package:doctor_app_flutter/core/model/SOAP/chief_complaint/get_chief_complaint_vida_plus.dart';
import 'package:doctor_app_flutter/screens/patients/profile/soap_update_vida_plus/subjective/chief_complaint/widgets/listOfComplaints.dart';
import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart';
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
import 'package:flutter/material.dart';
import 'package:quiver/time.dart';
import '../../../../../../../widgets/shared/app_texts_widget.dart';
class PreviousCheifComplaints extends StatelessWidget {
const PreviousCheifComplaints({super.key});
class PreviousChiefComplaints extends StatelessWidget {
final List<EpisodeByChiefComplaintVidaPlus> complaints;
final Function(List<PatientPomrs>)? onSendClicked;
PreviousChiefComplaints(this.complaints,this.onSendClicked, {super.key,});
@override
Widget build(BuildContext context) {
@ -18,7 +23,7 @@ class PreviousCheifComplaints extends StatelessWidget {
)),
color: Colors.white,
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 12),
padding: const EdgeInsets.symmetric(horizontal: 10.0, vertical: 10),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
@ -41,22 +46,46 @@ class PreviousCheifComplaints extends StatelessWidget {
color: Color(0xFF575757),
),
SizedBox(
height: 16,
height: 10,
),
Flexible(
child: ListView.separated(
shrinkWrap: true,
itemCount: 2,
separatorBuilder: (context, index) => Divider(),
separatorBuilder: (context, index2) => Divider(),
itemCount: complaints.length,
itemBuilder: (context, index) {
return ListOfComplaintsItem(
name: "name",
createdBy: "createdBy",
createdAt: "createdAt",
onSendClick: () {});
}))
return complaints[index].patientPomrs!.isNotEmpty ? ListOfComplaintsItem(
name: getChildValue(complaints[index].patientPomrs!, 1),
createdBy: getChildValue(complaints[index].patientPomrs!,2),
createdAt: getChildValue(complaints[index].patientPomrs!, 3),
onSendClick: () {
onSendClicked!(complaints[index].patientPomrs!);
}) :SizedBox();
})
)
],
),
));
}
String getChildValue(List<PatientPomrs>? patientPomrs, int key) {
List<String> value = [];
patientPomrs!.forEach((element) {
if(key ==1) {
element.chiefComplains!.forEach((element2) {
value.add(element2.chiefComplain!);
});
}else if(key ==2) {
value.add(element.doctorName!);
}else {
value.add(element.createdOn!);
}
});
return value.join(" ");
}
}

@ -0,0 +1,342 @@
// ignore: must_be_immutable
import 'package:autocomplete_textfield/autocomplete_textfield.dart';
import 'package:doctor_app_flutter/config/size_config.dart';
import 'package:doctor_app_flutter/core/enum/view_state.dart';
import 'package:doctor_app_flutter/core/model/SOAP/master_key_model.dart';
import 'package:doctor_app_flutter/core/model/SOAP/selected_items/my_selected_allergy.dart';
import 'package:doctor_app_flutter/core/model/search_drug/get_medication_response_model.dart';
import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart';
import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart';
import 'package:doctor_app_flutter/screens/base/base_view.dart';
import 'package:doctor_app_flutter/screens/patients/patient_search/patient_search_header.dart';
import 'package:doctor_app_flutter/screens/patients/profile/soap_update/shared_soap_widgets/bottom_sheet_title.dart';
import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart';
import 'package:doctor_app_flutter/utils/utils.dart';
import 'package:doctor_app_flutter/widgets/bottom_sheet/custom_bottom_sheet_container.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/master_key_dailog.dart';
import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart';
import 'package:doctor_app_flutter/widgets/shared/text_fields/auto_complete_text_field.dart';
import 'package:doctor_app_flutter/widgets/shared/text_fields/text_fields_utils.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
// ignore: must_be_immutable
class AddMedication extends StatefulWidget {
final Function(MySelectedAllergy mySelectedAllergy) addMedicationFun;
TextEditingController medicationController;
AddMedication({Key? key, required this.addMedicationFun, required this.medicationController}) : super(key: key);
@override
_AddMedicationState createState() => _AddMedicationState();
}
class _AddMedicationState extends State<AddMedication> {
MasterKeyModel? _selectedMedicationDose;
MasterKeyModel? _selectedMedicationStrength;
MasterKeyModel? _selectedMedicationRoute;
MasterKeyModel? _selectedMedicationFrequency;
TextEditingController doseController = TextEditingController();
TextEditingController strengthController = TextEditingController();
TextEditingController routeController = TextEditingController();
TextEditingController frequencyController = TextEditingController();
GetMedicationResponseModel? _selectedMedication;
GlobalKey<AutoCompleteTextFieldState<GetMedicationResponseModel>> key = GlobalKey<AutoCompleteTextFieldState<GetMedicationResponseModel>>();
bool isFormSubmitted = false;
@override
Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context);
return BaseView<SOAPViewModel>(
onModelReady: (model) async {
// model.onAddMedicationStart();
},
builder: (_, model, w) => AppScaffold(
backgroundColor: Colors.white,
baseViewModel: model,
isShowAppBar: true,
appBar: PatientSearchHeader(
title:TranslationBase.of(context).addMedication,
),
body: Container(
padding: EdgeInsets.all(15),
child:
SingleChildScrollView(
child: Column(
children: [
// SizedBox(
// height: SizeConfig.heightMultiplier! *
// (SizeConfig.isHeightVeryShort
// ? 2
// : SizeConfig.isHeightShort
// ? 2
// : 2),
// ),
// Container(
// // height: screenSize.height * 0.070,
// child: InkWell(
// onTap: model.allMedicationList != null
// ? () {
// setState(() {
// _selectedMedication = GetMedicationResponseModel();
// });
// }
// : null,
// child: _selectedMedication == null
// // ?
// CustomAutoCompleteTextField(
// isShowError: isFormSubmitted && _selectedMedication == null,
// child: AutoCompleteTextField<GetMedicationResponseModel>(
// decoration: TextFieldsUtils.textFieldSelectorDecoration(TranslationBase.of(context).searchMedicineNameHere, "", true, suffixIcon: Icons.search),
// itemSubmitted: (item) => setState(() => _selectedMedication = item),
// key: key,
// suggestions: model.allMedicationList!,
// itemBuilder: (context, suggestion) => new Padding(child: AppText(suggestion.description! + '/' + suggestion.genericName!), padding: EdgeInsets.all(8.0)),
// itemSorter: (a, b) => 1,
// itemFilter: (suggestion, input) =>
// suggestion.genericName!.toLowerCase().startsWith(input.toLowerCase()) ||
// suggestion.description!.toLowerCase().startsWith(input.toLowerCase()) ||
// suggestion.keywords!.toLowerCase().startsWith(input.toLowerCase()),
// ),
// )
// :
AppTextFieldCustom(
height: Utils.getTextFieldHeight(),
hintText: _selectedMedication != null
? _selectedMedication!.description! + (' (${_selectedMedication!.genericName} )')
: TranslationBase.of(context).searchMedicineNameHere,
minLines: 1,
maxLines: 1,
isTextFieldHasSuffix: true,
suffixIcon: IconButton(
icon: Icon(
Icons.search,
color: Colors.grey.shade600,
),
onPressed: () {},
),
onChanged: (value) {},
onFieldSubmitted: () {},
),
// ),
// ),
if (_selectedMedication != null)
Column(
children: [
SizedBox(
height: 3,
),
Container(
width: MediaQuery.of(context).size.width * 0.7,
child: AppText(
_selectedMedication!.description! + (' (${_selectedMedication!.genericName} )'),
color: Color(0xFF575757),
fontSize: 10,
fontWeight: FontWeight.w700,
letterSpacing: -0.4,
),
),
],
),
SizedBox(
height: 5,
),
AppTextFieldCustom(
height: Utils.getTextFieldHeight(),
onClick: model.medicationDoseTimeList != null
? () {
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;
},
);
}
: null,
hintText: TranslationBase.of(context).doseTime,
maxLines: 1,
minLines: 1,
isTextFieldHasSuffix: true,
controller: doseController,
validationError: isFormSubmitted && _selectedMedicationDose == null ? TranslationBase.of(context).emptyMessage : null,
onChanged: (value) {},
onFieldSubmitted: () {},
),
SizedBox(
height: 5,
),
AppTextFieldCustom(
height: Utils.getTextFieldHeight(),
isTextFieldHasSuffix: true,
onClick: model.medicationStrengthList != null
? () {
MasterKeyDailog dialog = MasterKeyDailog(
list: model.medicationStrengthList,
okText: TranslationBase.of(context).ok,
selectedValue: _selectedMedicationStrength,
okFunction: (selectedValue) {
setState(() {
_selectedMedicationStrength = selectedValue;
strengthController.text = projectViewModel.isArabic ? _selectedMedicationStrength!.nameAr! : _selectedMedicationStrength!.nameEn!;
});
},
);
showDialog(
barrierDismissible: false,
context: context,
builder: (BuildContext context) {
return dialog;
},
);
}
: null,
hintText: TranslationBase.of(context).strength,
maxLines: 1,
minLines: 1,
controller: strengthController,
validationError: isFormSubmitted && _selectedMedicationStrength == null ? TranslationBase.of(context).emptyMessage : null,
onChanged: (value) {},
onFieldSubmitted: () {},
),
SizedBox(
height: 5,
),
SizedBox(
height: 5,
),
AppTextFieldCustom(
height: Utils.getTextFieldHeight(),
enabled: false,
isTextFieldHasSuffix: true,
onClick: model.medicationRouteList != null
? () {
MasterKeyDailog dialog = MasterKeyDailog(
list: model.medicationRouteList,
selectedValue: _selectedMedicationRoute,
okText: TranslationBase.of(context).ok,
okFunction: (selectedValue) {
setState(() {
_selectedMedicationRoute = selectedValue;
routeController.text = projectViewModel.isArabic ? _selectedMedicationRoute!.nameAr! : _selectedMedicationRoute!.nameEn!;
});
},
);
showDialog(
barrierDismissible: false,
context: context,
builder: (BuildContext context) {
return dialog;
},
);
}
: null,
hintText: TranslationBase.of(context).route,
maxLines: 1,
minLines: 1,
controller: routeController,
validationError: isFormSubmitted && _selectedMedicationRoute == null ? TranslationBase.of(context).emptyMessage : null,
onChanged: (value) {},
onFieldSubmitted: () {},
),
SizedBox(
height: 5,
),
SizedBox(
height: 5,
),
AppTextFieldCustom(
height: Utils.getTextFieldHeight(),
onClick: model.medicationFrequencyList != null
? () {
MasterKeyDailog dialog = MasterKeyDailog(
list: model.medicationFrequencyList,
okText: TranslationBase.of(context).ok,
selectedValue: _selectedMedicationFrequency,
okFunction: (selectedValue) {
setState(() {
_selectedMedicationFrequency = selectedValue;
frequencyController.text = projectViewModel.isArabic ? _selectedMedicationFrequency!.nameAr! : _selectedMedicationFrequency!.nameEn!;
});
},
);
showDialog(
barrierDismissible: false,
context: context,
builder: (BuildContext context) {
return dialog;
},
);
}
: null,
hintText: TranslationBase.of(context).frequency,
enabled: false,
maxLines: 1,
minLines: 1,
isTextFieldHasSuffix: true,
controller: frequencyController,
validationError: isFormSubmitted && _selectedMedicationFrequency == null ? TranslationBase.of(context).emptyMessage : null,
onChanged: (value) {},
onFieldSubmitted: () {},
),
// SizedBox(
// height: SizeConfig.heightMultiplier! *
// (SizeConfig.isHeightVeryShort
// ? 20
// : SizeConfig.isHeightShort
// ? 15
// : 10),
// ),
],
),
),),
bottomSheet: model.state != ViewState.Idle
? Container(
height: 0,
)
: CustomBottomSheetContainer(
label: TranslationBase.of(context).addMedication,
onTap: () {
setState(() {
isFormSubmitted = true;
});
if (_selectedMedication != null &&
_selectedMedicationDose != null &&
_selectedMedicationStrength != null &&
_selectedMedicationRoute != null &&
_selectedMedicationFrequency != null) {
widget.medicationController.text = widget.medicationController.text +
'${_selectedMedication!.description} (${TranslationBase.of(context).doseTime} ) ${doseController.text} (${TranslationBase.of(context).strength}) ${strengthController.text} (${TranslationBase.of(context).route}) ${routeController.text} (${TranslationBase.of(context).frequency}) ${frequencyController.text} \n \n';
Navigator.of(context).pop();
}
},
)),
);
}
}

@ -0,0 +1,64 @@
import 'package:doctor_app_flutter/core/model/SOAP/selected_items/my_selected_allergy.dart';
import 'package:doctor_app_flutter/screens/patients/profile/soap_update/shared_soap_widgets/SOAP_open_items.dart';
import 'package:doctor_app_flutter/screens/patients/profile/soap_update_vida_plus/subjective/chief_complaint/widgets/add_soap_item.dart';
import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart';
import 'package:doctor_app_flutter/widgets/transitions/fade_page.dart';
import 'package:flutter/material.dart';
import 'add_medication.dart';
class UpdateMedicationWidget extends StatefulWidget {
final TextEditingController? medicationController;
UpdateMedicationWidget({
Key? key,
this.medicationController,
});
@override
_UpdateMedicationWidgetState createState() => _UpdateMedicationWidgetState();
}
class _UpdateMedicationWidgetState extends State<UpdateMedicationWidget> {
@override
Widget build(BuildContext context) {
return Column(
children: [
AddSoapItem(
title: "${TranslationBase.of(context).addMedication}",
onAddSoapItemClicked: () {
Navigator.push(
context,
FadePage(
page:AddMedication(
addMedicationFun: (MySelectedAllergy mySelectedAllergy) {},
medicationController: widget.medicationController!,
)
));
// openMedicationList(context);
},
),
SizedBox(
height: 20,
)
],
);
}
//
// openMedicationList(BuildContext context) {
// showModalBottomSheet(
// backgroundColor: Colors.white,
// isScrollControlled: true,
// isDismissible: false,
// context: context,
// builder: (context) {
// return AddMedication(
// addMedicationFun: (MySelectedAllergy mySelectedAllergy) {},
// medicationController: widget.medicationController!,
// );
// });
// }
}

@ -127,9 +127,14 @@ class UpdatePresentIllnessState extends State<UpdatePresentIllness> {
maxLines: 25,
minLines: 3,
hasBorder: true,
isTextFieldHasSuffix: true,
onClick: () {},
onChanged: (value) {},
onFieldSubmitted: () {},
suffixIcon: IconButton(icon:Icon(Icons.save_as_outlined, color: Colors.red, size: 25,), onPressed: (){
saveHopi(model);
},),
),
])),
@ -174,9 +179,12 @@ class UpdatePresentIllnessState extends State<UpdatePresentIllness> {
maxLines: 25,
minLines: 3,
hasBorder: true,
isTextFieldHasSuffix: true,
onClick: () {},
onChanged: (value) {},
onFieldSubmitted: () {},
onFieldSubmitted: () {}, suffixIcon: IconButton(icon:Icon(Icons.save_as_outlined, color: Colors.red, size: 25,), onPressed: (){
saveHopi(model);
},),
),
],
),

@ -9,12 +9,13 @@ import 'package:doctor_app_flutter/screens/base/base_view.dart';
import 'package:doctor_app_flutter/screens/patients/profile/soap_update/shared_soap_widgets/SOAP_step_header.dart';
import 'package:doctor_app_flutter/screens/patients/profile/soap_update/shared_soap_widgets/expandable_SOAP_widget.dart';
import 'package:doctor_app_flutter/screens/patients/profile/soap_update/soap_utils.dart';
import 'package:doctor_app_flutter/screens/patients/profile/soap_update/subjective/history/update_history_widget.dart';
import 'package:doctor_app_flutter/screens/patients/profile/soap_update/subjective/subjective_call_back.dart';
import 'package:doctor_app_flutter/screens/patients/profile/soap_update_vida_plus/subjective/medication/update_medication_widget.dart';
import 'package:doctor_app_flutter/screens/patients/profile/soap_update_vida_plus/subjective/present_illness/update_present_illness.dart';
import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart';
import 'package:doctor_app_flutter/utils/utils.dart';
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart';
import 'package:flutter/material.dart';
import '../../../../../core/model/SOAP/allergy/get_patient_allergies_list_vida_plus.dart';
@ -42,6 +43,7 @@ class _UpdateSubjectivePageVidaPlusState
bool isChiefExpand = false;
bool isHistoryExpand = false;
bool isAllergiesExpand = false;
bool isMedicationExpand =false;
TextEditingController illnessController = TextEditingController();
TextEditingController complaintsController = TextEditingController();
TextEditingController medicationController = TextEditingController();
@ -50,73 +52,73 @@ class _UpdateSubjectivePageVidaPlusState
List<PatientAllergiesVidaPlus> myAllergiesList = [];
List<MySelectedHistory> myHistoryList = [];
getHistory(SOAPViewModel model) async {
widget.changeLoadingState(true);
if (model.patientHistoryList.isNotEmpty) {
model.patientHistoryList.forEach((element) {
if (element.historyType ==
MasterKeysService.HistoryFamily.getMasterKeyService()) {
MasterKeyModel? history = model.getOneMasterKey(
masterKeys: MasterKeysService.HistoryFamily,
id: element.historyId,
);
if (history != null) {
MySelectedHistory mySelectedHistory = SoapUtils
.generateMySelectedHistory(history: history,
isChecked: element.isChecked,
remark: element.remarks,
isLocal: false);
myHistoryList.add(mySelectedHistory);
}
}
if (element.historyType ==
MasterKeysService.HistoryMedical.getMasterKeyService()) {
MasterKeyModel? history = model.getOneMasterKey(
masterKeys: MasterKeysService.HistoryMedical,
id: element.historyId,
);
if (history != null) {
MySelectedHistory mySelectedHistory = SoapUtils
.generateMySelectedHistory(history: history,
isChecked: element.isChecked,
remark: element.remarks,
isLocal: false);
myHistoryList.add(mySelectedHistory);
}
}
if (element.historyType ==
MasterKeysService.HistorySports.getMasterKeyService()) {
MasterKeyModel? history = model.getOneMasterKey(
masterKeys: MasterKeysService.HistorySports,
id: element.historyId,
);
if (history != null) {
MySelectedHistory mySelectedHistory = SoapUtils
.generateMySelectedHistory(history: history,
isChecked: element.isChecked,
remark: element.remarks,
isLocal: false);
myHistoryList.add(mySelectedHistory);
}
}
if (element.historyType ==
MasterKeysService.HistorySurgical.getMasterKeyService()) {
MasterKeyModel? history = model.getOneMasterKey(
masterKeys: MasterKeysService.HistorySurgical,
id: element.historyId,
);
if (history != null) {
MySelectedHistory mySelectedHistory = SoapUtils
.generateMySelectedHistory(history: history,
isChecked: element.isChecked,
remark: element.remarks,
isLocal: false);
myHistoryList.add(mySelectedHistory);
}
}
});
}
}
// getHistory(SOAPViewModel model) async {
// widget.changeLoadingState(true);
// if (model.patientHistoryList.isNotEmpty) {
// model.patientHistoryList.forEach((element) {
// if (element.historyType ==
// MasterKeysService.HistoryFamily.getMasterKeyService()) {
// MasterKeyModel? history = model.getOneMasterKey(
// masterKeys: MasterKeysService.HistoryFamily,
// id: element.historyId,
// );
// if (history != null) {
// MySelectedHistory mySelectedHistory = SoapUtils
// .generateMySelectedHistory(history: history,
// isChecked: element.isChecked,
// remark: element.remarks,
// isLocal: false);
// myHistoryList.add(mySelectedHistory);
// }
// }
// if (element.historyType ==
// MasterKeysService.HistoryMedical.getMasterKeyService()) {
// MasterKeyModel? history = model.getOneMasterKey(
// masterKeys: MasterKeysService.HistoryMedical,
// id: element.historyId,
// );
// if (history != null) {
// MySelectedHistory mySelectedHistory = SoapUtils
// .generateMySelectedHistory(history: history,
// isChecked: element.isChecked,
// remark: element.remarks,
// isLocal: false);
// myHistoryList.add(mySelectedHistory);
// }
// }
// if (element.historyType ==
// MasterKeysService.HistorySports.getMasterKeyService()) {
// MasterKeyModel? history = model.getOneMasterKey(
// masterKeys: MasterKeysService.HistorySports,
// id: element.historyId,
// );
// if (history != null) {
// MySelectedHistory mySelectedHistory = SoapUtils
// .generateMySelectedHistory(history: history,
// isChecked: element.isChecked,
// remark: element.remarks,
// isLocal: false);
// myHistoryList.add(mySelectedHistory);
// }
// }
// if (element.historyType ==
// MasterKeysService.HistorySurgical.getMasterKeyService()) {
// MasterKeyModel? history = model.getOneMasterKey(
// masterKeys: MasterKeysService.HistorySurgical,
// id: element.historyId,
// );
// if (history != null) {
// MySelectedHistory mySelectedHistory = SoapUtils
// .generateMySelectedHistory(history: history,
// isChecked: element.isChecked,
// remark: element.remarks,
// isLocal: false);
// myHistoryList.add(mySelectedHistory);
// }
// }
// });
// }
// }
getAllergies(SOAPViewModel model) async {
await model.getAllergiesVidaPlus(widget.patientInfo);
@ -146,31 +148,34 @@ class _UpdateSubjectivePageVidaPlusState
Widget build(BuildContext context) {
return BaseView<SOAPViewModel>(
onModelReady: (model) async {
myAllergiesList.clear();
myHistoryList.clear();
model.setSubjectiveCallBack(this);
await model.onUpdateSubjectStepStart(widget.patientInfo);
WidgetsBinding.instance.addPostFrameCallback((_) async {
myAllergiesList.clear();
myHistoryList.clear();
model.setSubjectiveCallBack(this);
// await model.onUpdateSubjectStepStart(widget.patientInfo);
if (model.patientChiefComplaintList.isNotEmpty) {
isChiefExpand = true;
complaintsController.text = Utils.parseHtmlString(
model.patientChiefComplaintList[0].chiefComplaint!);
illnessController.text = model.patientChiefComplaintList[0].hopi!;
medicationController.text =
model.patientChiefComplaintList[0].currentMedication != null
? !(model.patientChiefComplaintList[0].currentMedication!)
.isNotEmpty
? model.patientChiefComplaintList[0].currentMedication! + '\n \n'
: model.patientChiefComplaintList[0].currentMedication!
: "";
}
if (widget.patientInfo.admissionNo == null) {
// await getHistory(model);
if (model.patientChiefComplaintList.isNotEmpty) {
isChiefExpand = true;
complaintsController.text = Utils.parseHtmlString(
model.patientChiefComplaintList[0].chiefComplaint!);
illnessController.text = model.patientChiefComplaintList[0].hopi!;
medicationController.text =
model.patientChiefComplaintList[0].currentMedication != null
? !(model.patientChiefComplaintList[0].currentMedication!)
.isNotEmpty
? model.patientChiefComplaintList[0].currentMedication! +
'\n \n'
: model.patientChiefComplaintList[0].currentMedication!
: "";
}
if (widget.patientInfo.admissionNo == null) {
// await getHistory(model);
await getAllergies(model);
}
await getAllergies(model);
}
widget.changeLoadingState(false);
widget.changeLoadingState(false);
});
},
builder: (_, model, w) =>
AppScaffold(
@ -255,6 +260,34 @@ class _UpdateSubjectivePageVidaPlusState
),
isExpanded: isAllergiesExpand,
),
SizedBox(
height: SizeConfig.heightMultiplier! *
(SizeConfig.isHeightVeryShort ? 4 : 2),
),
ExpandableSOAPWidget(
headerTitle: TranslationBase
.of(context)
.currentMedications,
onTap: () {
setState(() {
isMedicationExpand = !isMedicationExpand;
});
},
child: Column(children: [
SizedBox(
height: SizeConfig.heightMultiplier! *
(SizeConfig.isHeightVeryShort ? 4 : 2),
),
UpdateMedicationWidget(
medicationController: medicationController,
),
SizedBox(
height: 10,
),
],),
isExpanded: isMedicationExpand,
),
SizedBox(
height: SizeConfig.heightMultiplier! *
(SizeConfig.isHeightVeryShort ? 20 : 10),
@ -330,3 +363,26 @@ class _UpdateSubjectivePageVidaPlusState
}
}
//
// UpdateMedicationWidget(
// medicationController: medicationController,
// ),
// SizedBox(
// height: 10,
// ),
// AppTextFieldCustom(
// hintText: TranslationBase.of(context).currentMedications,
// controller: medicationController,
// maxLines: 25,
// minLines: 7,
// hasBorder: true,
// inputType: TextInputType.multiline,
// // validationError: medicationControllerError != '' ? medicationControllerError : "",
// onClick: () {},
// onChanged: (value) {},
// onFieldSubmitted: () {},
// ),
// SizedBox(
// height: 10,
// )

@ -1931,7 +1931,8 @@ class TranslationBase {
String get acute => localizedValues['acute']![locale.languageCode]!;
String get subAcute => localizedValues['subAcute']![locale.languageCode]!;
String get chronic => localizedValues['chronic']![locale.languageCode]!;
String get activate => localizedValues['activate']![locale.languageCode]!;
String get resolved => localizedValues['resolved']![locale.languageCode]!;
}
class TranslationBaseDelegate extends LocalizationsDelegate<TranslationBase> {

@ -15,7 +15,7 @@ import maps_launcher
import path_provider_foundation
import shared_preferences_foundation
import speech_to_text_macos
import sqflite_darwin
import sqflite
import url_launcher_macos
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {

Loading…
Cancel
Save