soap vida plus inprogress

update_flutter_3.24_vida_plus_episode_v2
Sultan khan 12 months ago
parent a95b5d331b
commit f3876e9ef1

@ -292,6 +292,22 @@ const PATIENT_ALLERGIES = 'Services/DoctorApplication.svc/REST/PatientAllergies'
const SEARCH_ALLERGIES = 'Services/DoctorApplication.svc/REST/SearchAllergies';
const POST_ALLERGIES = 'Services/DoctorApplication.svc/REST/PostAllergies';
const CREATE_HOPI = 'Services/DoctorApplication.svc/REST/CreateHOPI';
const HOPI_DETAILS = 'Services/DoctorApplication.svc/REST/DetailHOPI';
const POST_CHIEF_COMPLAINT_VP = 'Services/DoctorApplication.svc/REST/PostChiefcomplaint';
const SEARCH_CHIEF_COMPLAINT_VP = 'Services/DoctorApplication.svc/REST/SearchChiefcomplaint';
const RESOLVE_ALLERGIES = 'Services/DoctorApplication.svc/REST/ResolveAllergy';
const UPDATE_ALLERGIES = 'Services/DoctorApplication.svc/REST/UpdateAllergy';
const GET_CHIEF_COMPLAINT_VP = 'Services/DoctorApplication.svc/REST/ChiefComplaintDetails';
var selectedPatientType = 1;

@ -11,7 +11,7 @@ class AllergiesListVidaPlus {
bool? isActive;
bool? isSnowMedAllergy;
String? snowMedCode;
String? remark;
AllergiesListVidaPlus(
{this.allergyID,
this.allergyName,
@ -24,7 +24,9 @@ class AllergiesListVidaPlus {
this.hospitalID,
this.isActive,
this.isSnowMedAllergy,
this.snowMedCode});
this.snowMedCode,
this.remark
});
AllergiesListVidaPlus.fromJson(Map<String, dynamic> json) {
allergyID = json['allergyID'];
@ -74,8 +76,12 @@ class AllergyReactionDTOs {
int? hospitalGroupID;
int? hospitalID;
bool? isActive;
String? reactionSelection ="";
bool? isSelected =false;
int? dbCRUDOperation =1;
int? pomrid;
int? patientID;
int? allergyReactionMappingID = 0;
int? severity =1;
AllergyReactionDTOs(
{this.allergyReactionID,
this.allergyReactionName,
@ -83,8 +89,12 @@ class AllergyReactionDTOs {
this.hospitalGroupID,
this.hospitalID,
this.isActive,
this.reactionSelection,
this.isSelected,
this.dbCRUDOperation,
this.pomrid,
this.patientID,
this.allergyReactionMappingID,
this.severity
});
AllergyReactionDTOs.fromJson(Map<String, dynamic> json) {
@ -94,6 +104,12 @@ class AllergyReactionDTOs {
hospitalGroupID = json['hospitalGroupID'];
hospitalID = json['hospitalID'];
isActive = json['isActive'];
dbCRUDOperation = json["DbCRUDOperation"];
pomrid = json['pomrid'];
patientID = json['patientID'];
allergyReactionMappingID = json['allergyReactionMappingID'];
severity = json['severity'];
}
Map<String, dynamic> toJson() {
@ -104,6 +120,11 @@ class AllergyReactionDTOs {
data['hospitalGroupID'] = this.hospitalGroupID;
data['hospitalID'] = this.hospitalID;
data['isActive'] = this.isActive;
data["DbCRUDOperation"] = this.dbCRUDOperation;
data['pomrid'] = this.pomrid;
data['patientID'] = patientID;
data['allergyReactionMappingID'] = this.allergyReactionMappingID;
data['severity'] = this.severity;
return data;
}
}

@ -78,8 +78,9 @@ class PatientsAllergyReactionsDTOs {
int? patientID;
int? patientsAllergyReactionRevisionID;
int? pomrId;
int? severity;
int? severity =1;
bool? isSelected =true;
String? reactionSelection ="";
PatientsAllergyReactionsDTOs(
{this.allergyReactionID,
this.allergyReactionMappingID,
@ -90,7 +91,10 @@ class PatientsAllergyReactionsDTOs {
this.patientID,
this.patientsAllergyReactionRevisionID,
this.pomrId,
this.severity});
this.severity,
this.isSelected,
this.reactionSelection
});
PatientsAllergyReactionsDTOs.fromJson(Map<String, dynamic> json) {
allergyReactionID = json['allergyReactionID'];

@ -0,0 +1,68 @@
class GetChiefComplaintVidaPlus {
int? appointmentId;
String? chiefComplain;
int? chiefComplainId;
int? chiefComplainTemplateId;
int? clinicGroupId;
int? clinicId;
int? doctorId;
String? doctorName;
int? episodeId;
int? hospitalGroupId;
int? hospitalId;
String? loginUserId;
int? patientId;
int? patientPomrId;
GetChiefComplaintVidaPlus(
{this.appointmentId,
this.chiefComplain,
this.chiefComplainId,
this.chiefComplainTemplateId,
this.clinicGroupId,
this.clinicId,
this.doctorId,
this.doctorName,
this.episodeId,
this.hospitalGroupId,
this.hospitalId,
this.loginUserId,
this.patientId,
this.patientPomrId});
GetChiefComplaintVidaPlus.fromJson(Map<String, dynamic> json) {
appointmentId = json['appointmentId'];
chiefComplain = json['chiefComplain'];
chiefComplainId = json['chiefComplainId'];
chiefComplainTemplateId = json['chiefComplainTemplateId'];
clinicGroupId = json['clinicGroupId'];
clinicId = json['clinicId'];
doctorId = json['doctorId'];
doctorName = json['doctorName'];
episodeId = json['episodeId'];
hospitalGroupId = json['hospitalGroupId'];
hospitalId = json['hospitalId'];
loginUserId = json['loginUserId'];
patientId = json['patientId'];
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['chiefComplainTemplateId'] = this.chiefComplainTemplateId;
data['clinicGroupId'] = this.clinicGroupId;
data['clinicId'] = this.clinicId;
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['patientId'] = this.patientId;
data['patientPomrId'] = this.patientPomrId;
return data;
}
}

@ -0,0 +1,40 @@
class SearchChiefComplaint {
String? chiefComplain;
String? chiefComplainCode;
int? chiefComplainId;
String? clinic;
int? hospitalGroupId;
int? hospitalId;
String? nursingGroup;
SearchChiefComplaint(
{this.chiefComplain,
this.chiefComplainCode,
this.chiefComplainId,
this.clinic,
this.hospitalGroupId,
this.hospitalId,
this.nursingGroup});
SearchChiefComplaint.fromJson(Map<String, dynamic> json) {
chiefComplain = json['chiefComplain'];
chiefComplainCode = json['chiefComplainCode'];
chiefComplainId = json['chiefComplainId'];
clinic = json['clinic'];
hospitalGroupId = json['hospitalGroupId'];
hospitalId = json['hospitalId'];
nursingGroup = json['nursingGroup'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['chiefComplain'] = this.chiefComplain;
data['chiefComplainCode'] = this.chiefComplainCode;
data['chiefComplainId'] = this.chiefComplainId;
data['clinic'] = this.clinic;
data['hospitalGroupId'] = this.hospitalGroupId;
data['hospitalId'] = this.hospitalId;
data['nursingGroup'] = this.nursingGroup;
return data;
}
}

@ -0,0 +1,60 @@
class GetHopiDetails {
int? clinicId;
int? doctorId;
int? hospitalGroupId;
int? hospitalId;
String? hpi;
int? hpiId;
bool? isHpiTakenFamily;
bool? isHpiTakenOther;
bool? isHpiTakenPatient;
String? loginUserId;
int? patientId;
int? patientPomrId;
GetHopiDetails(
{this.clinicId,
this.doctorId,
this.hospitalGroupId,
this.hospitalId,
this.hpi,
this.hpiId,
this.isHpiTakenFamily,
this.isHpiTakenOther,
this.isHpiTakenPatient,
this.loginUserId,
this.patientId,
this.patientPomrId});
GetHopiDetails.fromJson(Map<String, dynamic> json) {
clinicId = json['clinicId'];
doctorId = json['doctorId'];
hospitalGroupId = json['hospitalGroupId'];
hospitalId = json['hospitalId'];
hpi = json['hpi'];
hpiId = json['hpiId'];
isHpiTakenFamily = json['isHpiTakenFamily'];
isHpiTakenOther = json['isHpiTakenOther'];
isHpiTakenPatient = json['isHpiTakenPatient'];
loginUserId = json['loginUserId'];
patientId = json['patientId'];
patientPomrId = json['patientPomrId'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['clinicId'] = this.clinicId;
data['doctorId'] = this.doctorId;
data['hospitalGroupId'] = this.hospitalGroupId;
data['hospitalId'] = this.hospitalId;
data['hpi'] = this.hpi;
data['hpiId'] = this.hpiId;
data['isHpiTakenFamily'] = this.isHpiTakenFamily;
data['isHpiTakenOther'] = this.isHpiTakenOther;
data['isHpiTakenPatient'] = this.isHpiTakenPatient;
data['loginUserId'] = this.loginUserId;
data['patientId'] = this.patientId;
data['patientPomrId'] = this.patientPomrId;
return data;
}
}

@ -79,7 +79,7 @@ class PatiantInformtion {
int? status;
int? vcId;
String? voipToken;
String? pomrId;
PatiantInformtion(
{this.patientDetails,
this.projectId,
@ -155,7 +155,9 @@ class PatiantInformtion {
this.vcId,
this.voipToken,
this.admissionDateWithDateTimeForm,
this.appointmentDateWithDateTimeForm});
this.appointmentDateWithDateTimeForm,
this.pomrId
});
PatiantInformtion.fromJson(Map<String, dynamic> json) {
{
@ -262,6 +264,7 @@ class PatiantInformtion {
consultationNotes = json['ConsultationNotes'];
patientStatus = json['PatientStatus'];
voipToken = json['VoipToken'];
pomrId = json['pomrId'];
admissionDateWithDateTimeForm = json["AdmissionDate"] != null
? AppDateUtils.convertStringToDate(json["AdmissionDate"])
: json["admissionDate"] != null
@ -340,7 +343,7 @@ class PatiantInformtion {
data['ProjectID'] = this.projectId;
data['VC_ID'] = this.vcId;
data['VoipToken'] = this.voipToken;
data['pomrId'] = this.pomrId;
data["DateofBirth"] = this.dateofBirth;
data["dob"] = this.dateofBirth;
data['DateOfBirth'] = this.dateofBirth;

@ -3,8 +3,11 @@ 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/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/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';
@ -22,7 +25,13 @@ import 'package:doctor_app_flutter/core/model/SOAP/physical_exam/post_physical_e
import 'package:doctor_app_flutter/core/model/SOAP/progress_note/GetGetProgressNoteResModel.dart';
import 'package:doctor_app_flutter/core/model/SOAP/progress_note/get_progress_note_req_model.dart';
import 'package:doctor_app_flutter/core/model/SOAP/progress_note/post_progress_note_request_model.dart';
import 'package:doctor_app_flutter/core/model/doctor/doctor_profile_model.dart';
import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart';
import 'package:doctor_app_flutter/utils/dr_app_toast_msg.dart';
import 'package:doctor_app_flutter/utils/utils.dart';
import 'package:http/http.dart';
import '../../../../config/shared_pref_kay.dart';
import '../../../../utils/date-utils.dart';
import '../../../model/SOAP/assessment/patch_assessment_req_model.dart';
import '../../../model/patient/patiant_info_model.dart';
import '../../base/lookup-service.dart';
@ -34,10 +43,15 @@ class SOAPService extends LookupService {
List<GetPhysicalExamResModel> patientPhysicalExamList = [];
List<GetPatientProgressNoteResModel> patientProgressNoteList = [];
List<GetAssessmentResModel> patientAssessmentList = [];
List<AllergiesListVidaPlus> searchAllergiesList =[];
List<PatientAllergiesVidaPlus> patientAllergiesVidaPlus =[];
List<AllergiesListVidaPlus> searchAllergiesList = [];
List<PatientAllergiesVidaPlus> patientAllergiesVidaPlus = [];
List<GetHopiDetails> hopiDetails = [];
List<GetChiefComplaintVidaPlus> patientChiefComplaintListVidaPlus = [];
List<SearchChiefComplaint> searchChiefComplaintListVidaPlus = [];
int? episodeID;
bool isPrescriptionOrder =false;
bool isPrescriptionOrder = false;
Future postEpisode(PostEpisodeReqModel postEpisodeReqModel) async {
hasError = false;
@ -321,41 +335,45 @@ class SOAPService extends LookupService {
super.error = error;
}, body: getEpisodeForInpatientReqModel.toJson());
}
Future isPrescriptionOrderCreated(
PatiantInformtion patientInfo) async {
Future isPrescriptionOrderCreated(PatiantInformtion patientInfo) async {
hasError = false;
await baseAppClient.post(IS_PRESCRIPTION_ORDER_CREATED,
onSuccess: (dynamic response, int statusCode) {
print("Success");
print("Success");
isPrescriptionOrder = response['IsPrescriptionCreated'];
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, body: {
"PatientMRN":patientInfo.patientMRN,
"EncounterNo":patientInfo.appointmentNo,
"EncounterType":patientInfo.appointmentTypeId,
"DoctorID":patientInfo.doctorId,
});
isPrescriptionOrder = response['IsPrescriptionCreated'];
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, body: {
"PatientMRN": patientInfo.patientMRN,
"EncounterNo": patientInfo.appointmentNo,
"EncounterType": patientInfo.appointmentTypeId,
"DoctorID": patientInfo.doctorId,
});
}
/* vida plus API allergies */
Future patientAllergies(GeneralGetReqForSOAP generalGetReqForSOAP) async {
Future patientAllergies(PatiantInformtion patientInfo) async {
Map<String, dynamic> request = {
"patientId": patientInfo.patientMRN,
"ProjectID": patientInfo.projectId
};
hasError = false;
await baseAppClient.post(PATIENT_ALLERGIES,
onSuccess: (dynamic response, int statusCode) {
print("Success");
patientAllergiesVidaPlus.clear();
print("Success");
patientAllergiesVidaPlus.clear();
response['List_PatientAllergies']['resultData'].forEach((v) {
patientAllergiesVidaPlus.add(PatientAllergiesVidaPlus.fromJson(v));
});
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, body: generalGetReqForSOAP.toJson());
response['List_PatientAllergies']['resultData'].forEach((v) {
patientAllergiesVidaPlus.add(PatientAllergiesVidaPlus.fromJson(v));
});
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, body: request);
}
Future searchAllergies(String searchKey) async {
@ -363,15 +381,254 @@ class SOAPService extends LookupService {
await baseAppClient.post(SEARCH_ALLERGIES,
onSuccess: (dynamic response, int statusCode) {
print("Success");
searchAllergiesList.clear();
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: {"AllergyName": searchKey});
}
Future addAllergies(
AllergiesListVidaPlus allergy, PatiantInformtion patientInfo) async {
allergy.allergyReactionDTOs!.forEach((value) {
value.patientID = patientInfo.patientMRN;
value.pomrid = int.parse(patientInfo.pomrId!);
value.allergyReactionMappingID = 1;
});
var request = {
"patientsAllergyRevisionID": allergy.allergyRevisionID,
"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,
"allergyID": allergy.allergyID,
"allergyName": allergy.allergyName,
"allergyTypeID": allergy.allergyTypeID
};
hasError = false;
await baseAppClient.post(POST_ALLERGIES,
onSuccess: (dynamic response, int statusCode) {
DrAppToastMsg.showSuccesToast("Allergies Saved Successfully");
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, body: {
"listProgNotePatientAllergyDiseaseVM": [request]
});
}
Future resolveAllergies(
PatientAllergiesVidaPlus allergy, PatiantInformtion patientInfo) async {
/*changed request parameters based on the vida plus requested */
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 = {
"pomrId": patientInfo.pomrId,
"patientMRN": patientInfo.patientMRN,
"allergyTypeName": allergy.allergyTypeName,
"assessmentId": 0,
"isActive": allergy.isActivePatientsAllergy,
"patientsAllergyReactionsDTOs":reactionRequest,
"dbCRUDOperation": 2,
"allergyID": allergy.allergyID,
"allergyName": allergy.allergyName,
"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(RESOLVE_ALLERGIES,
onSuccess: (dynamic response, int statusCode) {
DrAppToastMsg.showSuccesToast("Resolved Successfully");
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, body: {
"listProgNotePatientAllergyDiseaseVM": [request]
});
}
Future updateAllergies(
AllergiesListVidaPlus allergy, PatiantInformtion patientInfo) async {
allergy.allergyReactionDTOs!.forEach((value) {
value.patientID = patientInfo.patientMRN;
value.pomrid = patientInfo.episodeNo;
value.allergyReactionMappingID = 1;
});
var request = {
"patientsAllergyRevisionID": allergy.allergyRevisionID,
"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,
"allergyID": allergy.allergyID,
"allergyName": allergy.allergyName,
"allergyTypeID": allergy.allergyTypeID
};
hasError = false;
await baseAppClient.post(UPDATE_ALLERGIES,
onSuccess: (dynamic response, int statusCode) {
DrAppToastMsg.showSuccesToast("Allergies Saved Successfully");
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, body: {
"listProgNotePatientAllergyDiseaseVM": [request]
});
}
saveHopi(Map<String, dynamic> req, PatiantInformtion patient) async {
var request = {
"clinicGroupId": patient.clinicGroupId, // patient.clinicGroupId
"clinicId": patient.clinicId,
"doctorId": patient.doctorId,
"hospitalGroupId": await sharedPref.getString(DOCTOR_SETUP_ID), //setup
"hospitalId": patient.projectId, //projectid
"patientId": patient.patientMRN,
"patientPomrId": patient.pomrId,
};
Map<String, dynamic> finalRequest = {}
..addAll(request)
..addAll(req);
hasError = false;
await baseAppClient.post(CREATE_HOPI,
onSuccess: (dynamic response, int statusCode) {
DrAppToastMsg.showSuccesToast("History Saved Successfully");
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, body: finalRequest);
}
response['List_SearchAllergies']['resultData'].forEach((v) {
searchAllergiesList.add(AllergiesListVidaPlus.fromJson(v));
});
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, body: {"AllergyName": searchKey});
getHopi(PatiantInformtion patient) async {
Map<String, dynamic> request = {
"patientId": patient.patientMRN,
"pomrId": patient.pomrId,
};
hasError = false;
await baseAppClient.post(HOPI_DETAILS,
onSuccess: (dynamic response, int statusCode) {
hopiDetails.clear();
response['DetailHOPI']['resultData'].forEach((v) {
hopiDetails.add(GetHopiDetails.fromJson(v));
});
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, body: request);
}
getChiefComplaint(PatiantInformtion patient) async {
Map<String, dynamic> request = {
"ProjectID": patient.projectId,
"pomrId": patient.pomrId,
};
hasError = false;
await baseAppClient.post(GET_CHIEF_COMPLAINT_VP,
onSuccess: (dynamic response, int statusCode) {
patientChiefComplaintListVidaPlus.clear();
response['ListChiefComplaintDetails']['resultData'].forEach((v) {
patientChiefComplaintListVidaPlus.add(GetChiefComplaintVidaPlus.fromJson(v));
});
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, body: request);
}
postChiefComplaintVidaPlus(
PatiantInformtion patient, String cheifComplaint) async {
Map<String, dynamic> request = {
"ListCreateChiefComplaint": [
{
"appointmentNo": patient.appointmentNo,
"pomrId": patient.pomrId,
"patientMRN": patient.patientMRN,
"chiefComplaint": cheifComplaint
}
]
};
hasError = false;
await baseAppClient.post(POST_CHIEF_COMPLAINT_VP,
onSuccess: (dynamic response, int statusCode) {
print("Success");
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, body: request);
}
searchChiefComplaintVidaPlus(PatiantInformtion patient, String CC) async {
Map<String, dynamic> request = {
"doctorId": patient.doctorId,
"searchParam": CC,
};
hasError = false;
searchChiefComplaintListVidaPlus.clear();
await baseAppClient.post(SEARCH_CHIEF_COMPLAINT_VP,
onSuccess: (dynamic response, int statusCode) {
searchChiefComplaintListVidaPlus.clear();
//
response['List_SearchChiefComplaint']['resultData'].forEach((v) {
searchChiefComplaintListVidaPlus.add(SearchChiefComplaint.fromJson(v));
});
}, onFailure: (String error, int statusCode) {
searchChiefComplaintListVidaPlus.clear();
hasError = true;
super.error = error;
}, body: request);
}
}

@ -8,8 +8,11 @@ import 'package:doctor_app_flutter/core/model/SOAP/Assessment/post_assessment_re
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/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';
import 'package:doctor_app_flutter/core/model/SOAP/chief_complaint/post_chief_complaint_request_model.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/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';
@ -42,52 +45,75 @@ import 'base_view_model.dart';
class SOAPViewModel extends BaseViewModel {
SOAPService _SOAPService = locator<SOAPService>();
PrescriptionService _prescriptionService = locator<PrescriptionService>();
List<MasterKeyModel> get allergiesList => _SOAPService.allergiesList;
List<MasterKeyModel> get allergySeverityList => _SOAPService.allergySeverityList;
List<MasterKeyModel> get allergySeverityList =>
_SOAPService.allergySeverityList;
List<MasterKeyModel> get historyFamilyList => _SOAPService.historyFamilyList;
List<MasterKeyModel> get historyMedicalList => _SOAPService.historyMedicalList;
List<MasterKeyModel> get historyMedicalList =>
_SOAPService.historyMedicalList;
List<MasterKeyModel> get historySportList => _SOAPService.historySportList;
List<MasterKeyModel> get historySocialList => _SOAPService.historySocialList;
List<MasterKeyModel> get historySurgicalList => _SOAPService.historySurgicalList;
List<MasterKeyModel> get historySurgicalList =>
_SOAPService.historySurgicalList;
List<MasterKeyModel> get mergeHistorySurgicalWithHistorySportList => [...historySurgicalList, ...historySportList];
List<MasterKeyModel> get mergeHistorySurgicalWithHistorySportList =>
[...historySurgicalList, ...historySportList];
List<MasterKeyModel> get physicalExaminationList => _SOAPService.physicalExaminationList;
List<MasterKeyModel> get physicalExaminationList =>
_SOAPService.physicalExaminationList;
List<MasterKeyModel> get listOfDiagnosisType => _SOAPService.listOfDiagnosisType;
List<MasterKeyModel> get listOfDiagnosisType =>
_SOAPService.listOfDiagnosisType;
List<MasterKeyModel> get listOfDiagnosisCondition => _SOAPService.listOfDiagnosisCondition;
List<MasterKeyModel> get listOfDiagnosisCondition =>
_SOAPService.listOfDiagnosisCondition;
List<MasterKeyModel> get listOfICD10 => _SOAPService.listOfICD10;
List<GetChiefComplaintResModel> get patientChiefComplaintList => _SOAPService.patientChiefComplaintList;
List<GetChiefComplaintResModel> get patientChiefComplaintList =>
_SOAPService.patientChiefComplaintList;
List<GetAllergiesResModel> get patientAllergiesList =>
_SOAPService.patientAllergiesList;
List<GetAllergiesResModel> get patientAllergiesList => _SOAPService.patientAllergiesList;
List<GetHistoryResModel> get patientHistoryList =>
_SOAPService.patientHistoryList;
List<GetHistoryResModel> get patientHistoryList => _SOAPService.patientHistoryList;
List<GetPhysicalExamResModel> get patientPhysicalExamList =>
_SOAPService.patientPhysicalExamList;
List<GetPhysicalExamResModel> get patientPhysicalExamList => _SOAPService.patientPhysicalExamList;
List<GetPatientProgressNoteResModel> get patientProgressNoteList =>
_SOAPService.patientProgressNoteList;
List<GetPatientProgressNoteResModel> get patientProgressNoteList => _SOAPService.patientProgressNoteList;
List<GetAssessmentResModel> get patientAssessmentList =>
_SOAPService.patientAssessmentList;
List<GetAssessmentResModel> get patientAssessmentList => _SOAPService.patientAssessmentList;
List<AllergiesListVidaPlus> get searchAllergiesVidaPlus =>
_SOAPService.searchAllergiesList;
List<PatientAllergiesVidaPlus> get patientAllergiesVidaPlus =>
_SOAPService.patientAllergiesVidaPlus;
List<AllergiesListVidaPlus> get searchAllergiesVidaPlus => _SOAPService.searchAllergiesList;
List<GetHopiDetails> get getHopiDetails => _SOAPService.hopiDetails;
List<PatientAllergiesVidaPlus> get patientAllergiesVidaPlus => _SOAPService.patientAllergiesVidaPlus;
List<SearchChiefComplaint> get searchChiefComplaintList =>
_SOAPService.searchChiefComplaintListVidaPlus;
List<GetChiefComplaintVidaPlus> get getChiefComplaintListVidaPlus =>
_SOAPService.patientChiefComplaintListVidaPlus;
int? get episodeID => _SOAPService.episodeID;
bool get isPrescriptionOrder => _SOAPService.isPrescriptionOrder;
bool get isPrescriptionOrder => _SOAPService.isPrescriptionOrder;
bool isAddProgress = true;
bool isAddExamInProgress = true;
String progressNoteText = "";
@ -103,7 +129,8 @@ class SOAPViewModel extends BaseViewModel {
get medicationFrequencyList => _SOAPService.medicationFrequencyListWithModel;
List<GetMedicationResponseModel>? get allMedicationList => _prescriptionService.allMedicationList;
List<GetMedicationResponseModel>? get allMedicationList =>
_prescriptionService.allMedicationList;
late SubjectiveCallBack subjectiveCallBack;
@ -145,7 +172,10 @@ class SOAPViewModel extends BaseViewModel {
planCallBack.nextFunction(model);
}
Future getMasterLookup(MasterKeysService masterKeys, {bool isBusyLocal = false, String searchKey = "", bool allowSetState = false}) async {
Future getMasterLookup(MasterKeysService masterKeys,
{bool isBusyLocal = false,
String searchKey = "",
bool allowSetState = false}) async {
if (isBusyLocal) {
setState(ViewState.Busy);
} else
@ -168,9 +198,12 @@ class SOAPViewModel extends BaseViewModel {
setState(ViewState.Idle);
}
Future postEpisodeForInPatient(PostEpisodeForInpatientRequestModel postEpisodeForInpatientRequestModel) async {
Future postEpisodeForInPatient(
PostEpisodeForInpatientRequestModel
postEpisodeForInpatientRequestModel) async {
setState(ViewState.BusyLocal);
await _SOAPService.postEpisodeForInPatient(postEpisodeForInpatientRequestModel);
await _SOAPService.postEpisodeForInPatient(
postEpisodeForInpatientRequestModel);
if (_SOAPService.hasError) {
error = _SOAPService.error;
setState(ViewState.ErrorLocal);
@ -178,7 +211,8 @@ class SOAPViewModel extends BaseViewModel {
setState(ViewState.Idle);
}
Future postPhysicalExam(PostPhysicalExamRequestModel postPhysicalExamRequestModel) async {
Future postPhysicalExam(
PostPhysicalExamRequestModel postPhysicalExamRequestModel) async {
setState(ViewState.BusyLocal);
await _SOAPService.postPhysicalExam(postPhysicalExamRequestModel);
if (_SOAPService.hasError) {
@ -188,7 +222,8 @@ class SOAPViewModel extends BaseViewModel {
setState(ViewState.Idle);
}
Future postProgressNote(PostProgressNoteRequestModel postProgressNoteRequestModel) async {
Future postProgressNote(
PostProgressNoteRequestModel postProgressNoteRequestModel) async {
setState(ViewState.BusyLocal);
await _SOAPService.postProgressNote(postProgressNoteRequestModel);
if (_SOAPService.hasError) {
@ -198,7 +233,8 @@ class SOAPViewModel extends BaseViewModel {
setState(ViewState.Idle);
}
Future postAssessment(PostAssessmentRequestModel postAssessmentRequestModel) async {
Future postAssessment(
PostAssessmentRequestModel postAssessmentRequestModel) async {
setState(ViewState.BusyLocal);
await _SOAPService.postAssessment(postAssessmentRequestModel);
if (_SOAPService.hasError) {
@ -208,7 +244,8 @@ class SOAPViewModel extends BaseViewModel {
setState(ViewState.Idle);
}
Future patchPhysicalExam(PostPhysicalExamRequestModel patchPhysicalExamRequestModel) async {
Future patchPhysicalExam(
PostPhysicalExamRequestModel patchPhysicalExamRequestModel) async {
setState(ViewState.BusyLocal);
await _SOAPService.patchPhysicalExam(patchPhysicalExamRequestModel);
if (_SOAPService.hasError) {
@ -218,7 +255,8 @@ class SOAPViewModel extends BaseViewModel {
setState(ViewState.Idle);
}
Future patchProgressNote(PostProgressNoteRequestModel patchProgressNoteRequestModel) async {
Future patchProgressNote(
PostProgressNoteRequestModel patchProgressNoteRequestModel) async {
setState(ViewState.BusyLocal);
await _SOAPService.patchProgressNote(patchProgressNoteRequestModel);
if (_SOAPService.hasError) {
@ -228,7 +266,8 @@ class SOAPViewModel extends BaseViewModel {
setState(ViewState.Idle);
}
Future patchAssessment(PostAssessmentRequestUpdateModel patchAssessmentRequestModel) async {
Future patchAssessment(
PostAssessmentRequestUpdateModel patchAssessmentRequestModel) async {
setState(ViewState.BusyLocal);
await _SOAPService.patchAssessment(patchAssessmentRequestModel!);
if (_SOAPService.hasError) {
@ -238,7 +277,8 @@ class SOAPViewModel extends BaseViewModel {
setState(ViewState.Idle);
}
Future getPatientAllergy(GeneralGetReqForSOAP generalGetReqForSOAP, {isLocalBusy = false}) async {
Future getPatientAllergy(GeneralGetReqForSOAP generalGetReqForSOAP,
{isLocalBusy = false}) async {
if (isLocalBusy) {
setState(ViewState.BusyLocal);
} else
@ -257,8 +297,14 @@ class SOAPViewModel extends BaseViewModel {
String getAllergicNames(isArabic) {
String allergiesString = '';
patientAllergiesList.forEach((element) {
MasterKeyModel? selectedAllergy = getOneMasterKey(masterKeys: MasterKeysService.Allergies, id: element.allergyDiseaseId, typeId: element.allergyDiseaseType!);
if (selectedAllergy != null && element.isChecked!) allergiesString += ((isArabic ? selectedAllergy.nameAr : selectedAllergy.nameEn)! + ' , ');
MasterKeyModel? selectedAllergy = getOneMasterKey(
masterKeys: MasterKeysService.Allergies,
id: element.allergyDiseaseId,
typeId: element.allergyDiseaseType!);
if (selectedAllergy != null && element.isChecked!)
allergiesString +=
((isArabic ? selectedAllergy.nameAr : selectedAllergy.nameEn)! +
' , ');
});
return allergiesString;
}
@ -266,7 +312,9 @@ class SOAPViewModel extends BaseViewModel {
Future getPatientPhysicalExam(PatiantInformtion patientInfo) async {
GetPhysicalExamReqModel getPhysicalExamReqModel = GetPhysicalExamReqModel(
patientMRN: patientInfo.patientMRN,
episodeID: patientInfo.episodeNo == null ? "0" : patientInfo.episodeNo.toString(),
episodeID: patientInfo.episodeNo == null
? "0"
: patientInfo.episodeNo.toString(),
appointmentNo: patientInfo.appointmentNo == null
? 0
: int.parse(
@ -286,7 +334,8 @@ class SOAPViewModel extends BaseViewModel {
setState(ViewState.Idle);
}
Future getPatientProgressNote(GetProgressNoteReqModel getGetProgressNoteReqModel) async {
Future getPatientProgressNote(
GetProgressNoteReqModel getGetProgressNoteReqModel) async {
setState(ViewState.Busy);
await _SOAPService.getPatientProgressNote(getGetProgressNoteReqModel);
if (_SOAPService.hasError) {
@ -308,7 +357,11 @@ class SOAPViewModel extends BaseViewModel {
Future getEpisodeForInpatient(PatiantInformtion patient) async {
setState(ViewState.BusyLocal);
GetEpisodeForInpatientReqModel getEpisodeForInpatientReqModel = GetEpisodeForInpatientReqModel(patientID: patient.patientId, admissionNo: int.parse(patient.admissionNo!), patientTypeID: 1);
GetEpisodeForInpatientReqModel getEpisodeForInpatientReqModel =
GetEpisodeForInpatientReqModel(
patientID: patient.patientId,
admissionNo: int.parse(patient.admissionNo!),
patientTypeID: 1);
await _SOAPService.getEpisodeForInpatient(getEpisodeForInpatientReqModel);
if (_SOAPService.hasError) {
error = _SOAPService.error;
@ -320,11 +373,13 @@ class SOAPViewModel extends BaseViewModel {
}
// ignore: missing_return
MasterKeyModel? getOneMasterKey({required MasterKeysService masterKeys, dynamic id, int? typeId}) {
MasterKeyModel? getOneMasterKey(
{required MasterKeysService masterKeys, dynamic id, int? typeId}) {
switch (masterKeys) {
case MasterKeysService.Allergies:
List<MasterKeyModel> result = allergiesList.where((element) {
return element.id == id && element.typeId == masterKeys.getMasterKeyService();
return element.id == id &&
element.typeId == masterKeys.getMasterKeyService();
}).toList();
if (result.isNotEmpty) {
return result.first;
@ -333,7 +388,8 @@ class SOAPViewModel extends BaseViewModel {
case MasterKeysService.HistoryFamily:
List<MasterKeyModel> result = historyFamilyList.where((element) {
return element.id == id && element.typeId == masterKeys.getMasterKeyService();
return element.id == id &&
element.typeId == masterKeys.getMasterKeyService();
}).toList();
if (result.isNotEmpty) {
return result.first;
@ -341,7 +397,8 @@ class SOAPViewModel extends BaseViewModel {
break;
case MasterKeysService.HistoryMedical:
List<MasterKeyModel> result = historyMedicalList.where((element) {
return element.id == id && element.typeId == masterKeys.getMasterKeyService();
return element.id == id &&
element.typeId == masterKeys.getMasterKeyService();
}).toList();
if (result.isNotEmpty) {
return result.first;
@ -349,7 +406,8 @@ class SOAPViewModel extends BaseViewModel {
break;
case MasterKeysService.HistorySocial:
List<MasterKeyModel> result = historySocialList.where((element) {
return element.id == id && element.typeId == masterKeys.getMasterKeyService();
return element.id == id &&
element.typeId == masterKeys.getMasterKeyService();
}).toList();
if (result.isNotEmpty) {
return result.first;
@ -357,7 +415,8 @@ class SOAPViewModel extends BaseViewModel {
break;
case MasterKeysService.HistorySports:
List<MasterKeyModel> result = historySocialList.where((element) {
return element.id == id && element.typeId == masterKeys.getMasterKeyService();
return element.id == id &&
element.typeId == masterKeys.getMasterKeyService();
}).toList();
if (result.isNotEmpty) {
return result.first;
@ -373,7 +432,8 @@ class SOAPViewModel extends BaseViewModel {
break;
case MasterKeysService.PhysicalExamination:
List<MasterKeyModel> result = physicalExaminationList.where((element) {
return element.id == id && element.typeId == masterKeys.getMasterKeyService();
return element.id == id &&
element.typeId == masterKeys.getMasterKeyService();
}).toList();
if (result.isNotEmpty) {
return result.first;
@ -381,7 +441,8 @@ class SOAPViewModel extends BaseViewModel {
break;
case MasterKeysService.AllergySeverity:
List<MasterKeyModel> result = allergySeverityList.where((element) {
return element.id == id && element.typeId == masterKeys.getMasterKeyService();
return element.id == id &&
element.typeId == masterKeys.getMasterKeyService();
}).toList();
if (result.isNotEmpty) {
return result.first;
@ -389,7 +450,8 @@ class SOAPViewModel extends BaseViewModel {
break;
case MasterKeysService.DiagnosisType:
List<MasterKeyModel> result = listOfDiagnosisType.where((element) {
return element.id == id && element.typeId == masterKeys.getMasterKeyService();
return element.id == id &&
element.typeId == masterKeys.getMasterKeyService();
}).toList();
if (result.isNotEmpty) {
return result.first;
@ -397,7 +459,8 @@ class SOAPViewModel extends BaseViewModel {
break;
case MasterKeysService.DiagnosisCondition:
List<MasterKeyModel> result = listOfDiagnosisCondition.where((element) {
return element.id == id && element.typeId == masterKeys.getMasterKeyService();
return element.id == id &&
element.typeId == masterKeys.getMasterKeyService();
}).toList();
if (result.isNotEmpty) {
return result.first;
@ -436,8 +499,10 @@ class SOAPViewModel extends BaseViewModel {
}
}
int getFirstIndexForOldExamination(List<MySelectedExamination> mySelectedExamination) {
Iterable<MySelectedExamination> examList = mySelectedExamination.where((element) => !element.isLocal);
int getFirstIndexForOldExamination(
List<MySelectedExamination> mySelectedExamination) {
Iterable<MySelectedExamination> examList =
mySelectedExamination.where((element) => !element.isLocal);
if (examList.length > 0) {
return mySelectedExamination.indexOf(examList.first);
@ -446,25 +511,44 @@ class SOAPViewModel extends BaseViewModel {
}
onUpdateSubjectStepStart(PatiantInformtion patientInfo) async {
GetChiefComplaintReqModel getChiefComplaintReqModel = GetChiefComplaintReqModel(
admissionNo: patientInfo.admissionNo != null ? int.parse(patientInfo.admissionNo!) : null,
patientMRN: patientInfo.patientMRN,
appointmentNo: patientInfo.appointmentNo != null ? int.parse(patientInfo.appointmentNo.toString()) : null,
episodeId: patientInfo.episodeNo,
episodeID: patientInfo.episodeNo,
doctorID: '');
var services = [await _SOAPService.getPatientChiefComplaint(getChiefComplaintReqModel)];
GetChiefComplaintReqModel getChiefComplaintReqModel =
GetChiefComplaintReqModel(
admissionNo:
patientInfo
.admissionNo !=
null
? int.parse(patientInfo.admissionNo!)
: null,
patientMRN: patientInfo.patientMRN,
appointmentNo: patientInfo.appointmentNo != null
? int.parse(patientInfo.appointmentNo.toString())
: null,
episodeId: patientInfo.episodeNo,
episodeID: patientInfo.episodeNo,
doctorID: '');
var services = [
await _SOAPService.getPatientChiefComplaint(getChiefComplaintReqModel)
];
if (patientInfo.admissionNo == null) {
complaintsControllerError = '';
medicationControllerError = '';
illnessControllerError = '';
GetHistoryReqModel getHistoryReqModel = GetHistoryReqModel(
patientMRN: patientInfo.patientMRN, episodeID: patientInfo.episodeNo.toString(), appointmentNo: int.parse(patientInfo.appointmentNo.toString()), doctorID: '', editedBy: '');
services.add(await _SOAPService.getPatientHistories(getHistoryReqModel, isFirst: true));
GeneralGetReqForSOAP generalGetReqForSOAP =
GeneralGetReqForSOAP(patientMRN: patientInfo.patientMRN, episodeId: patientInfo.episodeNo, appointmentNo: int.parse(patientInfo.appointmentNo.toString()), doctorID: '', editedBy: '');
patientMRN: patientInfo.patientMRN,
episodeID: patientInfo.episodeNo.toString(),
appointmentNo: int.parse(patientInfo.appointmentNo.toString()),
doctorID: '',
editedBy: '');
services.add(await _SOAPService.getPatientHistories(getHistoryReqModel,
isFirst: true));
GeneralGetReqForSOAP generalGetReqForSOAP = GeneralGetReqForSOAP(
patientMRN: patientInfo.patientMRN,
episodeId: patientInfo.episodeNo,
appointmentNo: int.parse(patientInfo.appointmentNo.toString()),
doctorID: '',
editedBy: '');
services.add(await _SOAPService.getPatientAllergy(generalGetReqForSOAP));
}
@ -478,41 +562,61 @@ class SOAPViewModel extends BaseViewModel {
if (patientHistoryList.isNotEmpty) {
if (historyFamilyList.isEmpty) {
if (services.isEmpty) {
services = [await _SOAPService.getMasterLookup(MasterKeysService.HistoryFamily)];
services = [
await _SOAPService.getMasterLookup(MasterKeysService.HistoryFamily)
];
} else {
services.add(await _SOAPService.getMasterLookup(MasterKeysService.HistoryFamily));
services.add(await _SOAPService.getMasterLookup(
MasterKeysService.HistoryFamily));
}
}
if (historyMedicalList.isEmpty) {
if (services.isEmpty) {
services = [await _SOAPService.getMasterLookup(MasterKeysService.HistoryMedical)];
services = [
await _SOAPService.getMasterLookup(MasterKeysService.HistoryMedical)
];
} else
services.add(await _SOAPService.getMasterLookup(MasterKeysService.HistoryMedical));
services.add(await _SOAPService.getMasterLookup(
MasterKeysService.HistoryMedical));
}
if (historySurgicalList.length == 0) {
if (services.isEmpty) {
services = [await _SOAPService.getMasterLookup(MasterKeysService.HistorySurgical)];
services = [
await _SOAPService.getMasterLookup(
MasterKeysService.HistorySurgical)
];
} else
services.add(await _SOAPService.getMasterLookup(MasterKeysService.HistorySurgical));
services.add(await _SOAPService.getMasterLookup(
MasterKeysService.HistorySurgical));
}
if (historySportList.length == 0) {
if (services.isEmpty) {
services = [await _SOAPService.getMasterLookup(MasterKeysService.HistorySports)];
services = [
await _SOAPService.getMasterLookup(MasterKeysService.HistorySports)
];
} else
services.add(await _SOAPService.getMasterLookup(MasterKeysService.HistorySports));
services.add(await _SOAPService.getMasterLookup(
MasterKeysService.HistorySports));
}
}
if (patientAllergiesList.isNotEmpty) {
if (allergiesList.isEmpty) if (services.isEmpty) {
services = [await _SOAPService.getMasterLookup(MasterKeysService.Allergies)];
services = [
await _SOAPService.getMasterLookup(MasterKeysService.Allergies)
];
} else
services.add(await _SOAPService.getMasterLookup(MasterKeysService.Allergies));
services.add(
await _SOAPService.getMasterLookup(MasterKeysService.Allergies));
if (allergySeverityList.isEmpty) {
if (services.isEmpty) {
services = [await _SOAPService.getMasterLookup(MasterKeysService.AllergySeverity)];
services = [
await _SOAPService.getMasterLookup(
MasterKeysService.AllergySeverity)
];
} else
services.add(await _SOAPService.getMasterLookup(MasterKeysService.AllergySeverity));
services.add(await _SOAPService.getMasterLookup(
MasterKeysService.AllergySeverity));
}
}
@ -530,30 +634,45 @@ class SOAPViewModel extends BaseViewModel {
List services = [];
if (medicationStrengthList.length == 0) {
if (services.isEmpty) {
services = [await _SOAPService.getMasterLookup(MasterKeysService.MedicationStrength)];
services = [
await _SOAPService.getMasterLookup(
MasterKeysService.MedicationStrength)
];
} else {
services.add(await _SOAPService.getMasterLookup(MasterKeysService.MedicationStrength));
services.add(await _SOAPService.getMasterLookup(
MasterKeysService.MedicationStrength));
}
}
if (medicationFrequencyList.length == 0) {
if (services.isEmpty) {
services = [await _SOAPService.getMasterLookup(MasterKeysService.MedicationFrequency)];
services = [
await _SOAPService.getMasterLookup(
MasterKeysService.MedicationFrequency)
];
} else {
services.add(await _SOAPService.getMasterLookup(MasterKeysService.MedicationFrequency));
services.add(await _SOAPService.getMasterLookup(
MasterKeysService.MedicationFrequency));
}
}
if (medicationDoseTimeList.length == 0) {
if (services.isEmpty) {
services = [await _SOAPService.getMasterLookup(MasterKeysService.MedicationDoseTime)];
services = [
await _SOAPService.getMasterLookup(
MasterKeysService.MedicationDoseTime)
];
} else {
services.add(await _SOAPService.getMasterLookup(MasterKeysService.MedicationDoseTime));
services.add(await _SOAPService.getMasterLookup(
MasterKeysService.MedicationDoseTime));
}
}
if (medicationRouteList.length == 0) {
if (services.isEmpty) {
services = [await _SOAPService.getMasterLookup(MasterKeysService.MedicationRoute)];
services = [
await _SOAPService.getMasterLookup(MasterKeysService.MedicationRoute)
];
} else {
services.add(await _SOAPService.getMasterLookup(MasterKeysService.MedicationRoute));
services.add(await _SOAPService.getMasterLookup(
MasterKeysService.MedicationRoute));
}
}
if (allMedicationList!.isEmpty) {
@ -567,7 +686,8 @@ class SOAPViewModel extends BaseViewModel {
final results = services;
if (_SOAPService.hasError || _prescriptionService.hasError) {
error = _SOAPService.error.toString() + _prescriptionService.error.toString();
error =
_SOAPService.error.toString() + _prescriptionService.error.toString();
setState(ViewState.ErrorLocal);
} else {
setState(
@ -576,28 +696,40 @@ class SOAPViewModel extends BaseViewModel {
}
}
callAddAssessmentLookupsServices({String searchKey = "", bool allowSetState = true}) async {
callAddAssessmentLookupsServices(
{String searchKey = "", bool allowSetState = true}) async {
if (allowSetState) setState(ViewState.Busy);
List services = [];
if (listOfDiagnosisCondition.isEmpty) {
if (services.isEmpty) {
services = [await _SOAPService.getMasterLookup(MasterKeysService.DiagnosisCondition)];
services = [
await _SOAPService.getMasterLookup(
MasterKeysService.DiagnosisCondition)
];
} else {
services.add(await _SOAPService.getMasterLookup(MasterKeysService.DiagnosisCondition));
services.add(await _SOAPService.getMasterLookup(
MasterKeysService.DiagnosisCondition));
}
}
if (listOfDiagnosisType.length == 0) {
if (services.isEmpty) {
services = [await _SOAPService.getMasterLookup(MasterKeysService.DiagnosisType)];
services = [
await _SOAPService.getMasterLookup(MasterKeysService.DiagnosisType)
];
} else {
services.add(await _SOAPService.getMasterLookup(MasterKeysService.DiagnosisType));
services.add(await _SOAPService.getMasterLookup(
MasterKeysService.DiagnosisType));
}
}
if (listOfICD10.length == 0) {
if (services.isEmpty) {
services = [await _SOAPService.getMasterLookup(MasterKeysService.ICD10, searchKey: searchKey)];
services = [
await _SOAPService.getMasterLookup(MasterKeysService.ICD10,
searchKey: searchKey)
];
} else {
services.add(await _SOAPService.getMasterLookup(MasterKeysService.ICD10, searchKey: searchKey));
services.add(await _SOAPService.getMasterLookup(MasterKeysService.ICD10,
searchKey: searchKey));
}
}
@ -613,9 +745,15 @@ class SOAPViewModel extends BaseViewModel {
onUpdateAssessmentStepStart(PatiantInformtion patientInfo) async {
GetAssessmentReqModel getAssessmentReqModel = GetAssessmentReqModel(
patientMRN: patientInfo.patientMRN, episodeID: patientInfo.episodeNo.toString(), editedBy: '', doctorID: '', appointmentNo: int.parse(patientInfo.appointmentNo.toString()));
patientMRN: patientInfo.patientMRN,
episodeID: patientInfo.episodeNo.toString(),
editedBy: '',
doctorID: '',
appointmentNo: int.parse(patientInfo.appointmentNo.toString()));
var services = [await _SOAPService.getPatientAssessment(getAssessmentReqModel)];
var services = [
await _SOAPService.getPatientAssessment(getAssessmentReqModel)
];
final results = services;
@ -630,8 +768,7 @@ class SOAPViewModel extends BaseViewModel {
setState(ViewState.Idle);
}
Future isPrescriptionOrderCreated(PatiantInformtion patientInfo) async{
Future isPrescriptionOrderCreated(PatiantInformtion patientInfo) async {
setState(ViewState.BusyLocal);
await _SOAPService.isPrescriptionOrderCreated(patientInfo);
if (_SOAPService.hasError) {
@ -641,32 +778,51 @@ class SOAPViewModel extends BaseViewModel {
setState(ViewState.Idle);
}
postSubjectServices({patientInfo, String? complaintsText, String? medicationText, String? illnessText, List<MySelectedHistory>? myHistoryList, List<MySelectedAllergy>? myAllergiesList}) async {
postSubjectServices(
{patientInfo,
String? complaintsText,
String? medicationText,
String? illnessText,
List<MySelectedHistory>? myHistoryList,
List<MySelectedAllergy>? myAllergiesList}) async {
List services = [];
PostChiefComplaintRequestModel postChiefComplaintRequestModel =
createPostChiefComplaintRequestModel(patientInfo: patientInfo, illnessText: illnessText!, medicationText: medicationText!, complaintsText: complaintsText!);
createPostChiefComplaintRequestModel(
patientInfo: patientInfo,
illnessText: illnessText!,
medicationText: medicationText!,
complaintsText: complaintsText!);
if (patientChiefComplaintList.isEmpty) {
postChiefComplaintRequestModel.editedBy = '';
services = [await _SOAPService.postChiefComplaint(postChiefComplaintRequestModel)];
services = [
await _SOAPService.postChiefComplaint(postChiefComplaintRequestModel)
];
} else {
postChiefComplaintRequestModel.editedBy = '';
services = [await _SOAPService.patchChiefComplaint(postChiefComplaintRequestModel)];
services = [
await _SOAPService.patchChiefComplaint(postChiefComplaintRequestModel)
];
}
if (myHistoryList!.length != 0) {
PostHistoriesRequestModel postHistoriesRequestModel = createPostHistoriesRequestModel(patientInfo: patientInfo, myHistoryList: myHistoryList);
PostHistoriesRequestModel postHistoriesRequestModel =
createPostHistoriesRequestModel(
patientInfo: patientInfo, myHistoryList: myHistoryList);
if (patientHistoryList.isEmpty) {
services.add(await _SOAPService.postHistories(postHistoriesRequestModel));
services
.add(await _SOAPService.postHistories(postHistoriesRequestModel));
} else {
services.add(await _SOAPService.patchHistories(postHistoriesRequestModel));
services
.add(await _SOAPService.patchHistories(postHistoriesRequestModel));
}
}
if (myAllergiesList!.length != 0) {
PostAllergyRequestModel postAllergyRequestModel = createPostAllergyRequestModel(myAllergiesList: myAllergiesList, patientInfo: patientInfo);
PostAllergyRequestModel postAllergyRequestModel =
createPostAllergyRequestModel(
myAllergiesList: myAllergiesList, patientInfo: patientInfo);
if (patientAllergiesList.isEmpty) {
services.add(await _SOAPService.postAllergy(postAllergyRequestModel));
} else {
@ -683,9 +839,15 @@ class SOAPViewModel extends BaseViewModel {
setState(ViewState.Idle);
}
PostChiefComplaintRequestModel createPostChiefComplaintRequestModel({patientInfo, String? complaintsText, String? medicationText, String? illnessText}) {
PostChiefComplaintRequestModel createPostChiefComplaintRequestModel(
{patientInfo,
String? complaintsText,
String? medicationText,
String? illnessText}) {
return PostChiefComplaintRequestModel(
admissionNo: patientInfo.admissionNo != null ? int.parse(patientInfo.admissionNo) : null,
admissionNo: patientInfo.admissionNo != null
? int.parse(patientInfo.admissionNo)
: null,
patientMRN: patientInfo.patientMRN,
episodeID: patientInfo.episodeNo ?? 0,
appointmentNo: patientInfo.appointmentNo ?? 0,
@ -698,10 +860,13 @@ class SOAPViewModel extends BaseViewModel {
numberOfWeeks: 0);
}
PostHistoriesRequestModel createPostHistoriesRequestModel({patientInfo, List<MySelectedHistory>? myHistoryList}) {
PostHistoriesRequestModel postHistoriesRequestModel = new PostHistoriesRequestModel(doctorID: '');
PostHistoriesRequestModel createPostHistoriesRequestModel(
{patientInfo, List<MySelectedHistory>? myHistoryList}) {
PostHistoriesRequestModel postHistoriesRequestModel =
new PostHistoriesRequestModel(doctorID: '');
myHistoryList!.forEach((history) {
if (postHistoriesRequestModel.listMedicalHistoryVM == null) postHistoriesRequestModel.listMedicalHistoryVM = [];
if (postHistoriesRequestModel.listMedicalHistoryVM == null)
postHistoriesRequestModel.listMedicalHistoryVM = [];
postHistoriesRequestModel.listMedicalHistoryVM!.add(ListMedicalHistoryVM(
patientMRN: patientInfo.patientMRN,
episodeId: patientInfo.episodeNo,
@ -716,24 +881,29 @@ class SOAPViewModel extends BaseViewModel {
return postHistoriesRequestModel;
}
PostAllergyRequestModel createPostAllergyRequestModel({myAllergiesList, patientInfo}) {
PostAllergyRequestModel postAllergyRequestModel = new PostAllergyRequestModel();
PostAllergyRequestModel createPostAllergyRequestModel(
{myAllergiesList, patientInfo}) {
PostAllergyRequestModel postAllergyRequestModel =
new PostAllergyRequestModel();
myAllergiesList.forEach((allergy) {
if (postAllergyRequestModel.listHisProgNotePatientAllergyDiseaseVM == null) postAllergyRequestModel.listHisProgNotePatientAllergyDiseaseVM = [];
postAllergyRequestModel.listHisProgNotePatientAllergyDiseaseVM!.add(ListHisProgNotePatientAllergyDiseaseVM(
allergyDiseaseId: allergy.selectedAllergy.id,
allergyDiseaseType: allergy.selectedAllergy.typeId,
patientMRN: patientInfo.patientMRN,
episodeId: patientInfo.episodeNo,
appointmentNo: patientInfo.appointmentNo,
severity: allergy.selectedAllergySeverity.id,
remarks: allergy.remark,
createdBy: allergy.createdBy ?? doctorProfile!.doctorID,
createdOn: DateTime.now().toIso8601String(),
editedBy: doctorProfile!.doctorID,
editedOn: DateTime.now().toIso8601String(),
isChecked: allergy.isChecked,
isUpdatedByNurse: false));
if (postAllergyRequestModel.listHisProgNotePatientAllergyDiseaseVM ==
null)
postAllergyRequestModel.listHisProgNotePatientAllergyDiseaseVM = [];
postAllergyRequestModel.listHisProgNotePatientAllergyDiseaseVM!.add(
ListHisProgNotePatientAllergyDiseaseVM(
allergyDiseaseId: allergy.selectedAllergy.id,
allergyDiseaseType: allergy.selectedAllergy.typeId,
patientMRN: patientInfo.patientMRN,
episodeId: patientInfo.episodeNo,
appointmentNo: patientInfo.appointmentNo,
severity: allergy.selectedAllergySeverity.id,
remarks: allergy.remark,
createdBy: allergy.createdBy ?? doctorProfile!.doctorID,
createdOn: DateTime.now().toIso8601String(),
editedBy: doctorProfile!.doctorID,
editedOn: DateTime.now().toIso8601String(),
isChecked: allergy.isChecked,
isUpdatedByNurse: false));
});
return postAllergyRequestModel;
@ -741,13 +911,61 @@ class SOAPViewModel extends BaseViewModel {
/*vida plus */
getAllergiesVidaPlus(PatiantInformtion patientInfo) async{
getAllergiesVidaPlus(PatiantInformtion patientInfo) async {
setState(ViewState.BusyLocal);
await _SOAPService.patientAllergies(patientInfo);
if (_SOAPService.hasError) {
error = _SOAPService.error;
setState(ViewState.ErrorLocal);
} else
setState(ViewState.Idle);
}
searchAllergies(String searchKey) async {
setState(ViewState.BusyLocal);
await _SOAPService.searchAllergies(searchKey);
if (_SOAPService.hasError) {
error = _SOAPService.error;
setState(ViewState.ErrorLocal);
} else
setState(ViewState.Idle);
}
addAllergies(
AllergiesListVidaPlus request, PatiantInformtion patientInfo) async {
setState(ViewState.BusyLocal);
await _SOAPService.addAllergies(request, patientInfo);
if (_SOAPService.hasError) {
error = _SOAPService.error;
setState(ViewState.ErrorLocal);
} else
setState(ViewState.Idle);
}
resolveAllergies(
PatientAllergiesVidaPlus request, PatiantInformtion patientInfo) async {
setState(ViewState.BusyLocal);
await _SOAPService.resolveAllergies(request, patientInfo);
if (_SOAPService.hasError) {
error = _SOAPService.error;
setState(ViewState.ErrorLocal);
} else
setState(ViewState.Idle);
}
GeneralGetReqForSOAP generalGetReqForSOAP =
GeneralGetReqForSOAP(patientMRN: patientInfo.patientMRN, episodeId: patientInfo.episodeNo, appointmentNo: int.parse(patientInfo.appointmentNo.toString()), doctorID: '', editedBy: '');
saveHopi(Map<String, dynamic> req, PatiantInformtion patientInfo) async {
setState(ViewState.BusyLocal);
await _SOAPService.saveHopi(req, patientInfo);
if (_SOAPService.hasError) {
error = _SOAPService.error;
setState(ViewState.ErrorLocal);
} else
setState(ViewState.Idle);
}
getHopi(PatiantInformtion patientInfo) async {
setState(ViewState.BusyLocal);
await _SOAPService.patientAllergies(generalGetReqForSOAP);
await _SOAPService.getHopi(patientInfo);
if (_SOAPService.hasError) {
error = _SOAPService.error;
setState(ViewState.ErrorLocal);
@ -755,10 +973,29 @@ class SOAPViewModel extends BaseViewModel {
setState(ViewState.Idle);
}
getChiefComplaint(PatiantInformtion patientInfo) async {
setState(ViewState.BusyLocal);
await _SOAPService.getChiefComplaint(patientInfo);
if (_SOAPService.hasError) {
error = _SOAPService.error;
setState(ViewState.ErrorLocal);
} else
setState(ViewState.Idle);
}
searchAllergies(String searchKey) async{
searchChiefComplaint(PatiantInformtion patientInfo, String CC) async {
setState(ViewState.BusyLocal);
await _SOAPService.searchAllergies(searchKey);
await _SOAPService.searchChiefComplaintVidaPlus(patientInfo, CC);
if (_SOAPService.hasError) {
error = _SOAPService.error;
setState(ViewState.ErrorLocal);
} else
setState(ViewState.Idle);
}
saveChiefComplaint(PatiantInformtion patientInfo, String CC) async {
setState(ViewState.BusyLocal);
await _SOAPService.postChiefComplaintVidaPlus(patientInfo, CC);
if (_SOAPService.hasError) {
error = _SOAPService.error;
setState(ViewState.ErrorLocal);

@ -1,25 +1,19 @@
import 'package:autocomplete_textfield/autocomplete_textfield.dart';
import 'package:doctor_app_flutter/core/model/SOAP/allergy/get_allergies_list_vida_plus.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/viewModel/SOAP_view_model.dart';
import 'package:doctor_app_flutter/screens/base/base_view.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:flutter/material.dart';
import '../../../../../../core/model/SOAP/allergy/get_patient_allergies_list_vida_plus.dart';
import '../../../../../../core/model/patient/patiant_info_model.dart';
import '../../../../patient_search/patient_search_header.dart';
import '../../../soap_update/shared_soap_widgets/bottom_sheet_title.dart';
import 'master_key_checkbox_search_allergies_widget.dart';
class AddAllergies extends StatefulWidget {
final Function? addAllergiesFun;
final AllergiesListVidaPlus? myAllergiesList;
const AddAllergies({Key? key, this.addAllergiesFun, this.myAllergiesList})
final PatientAllergiesVidaPlus? myAllergiesList;
final PatiantInformtion patientInfo;
const AddAllergies({Key? key, this.myAllergiesList, required this.patientInfo})
: super(key: key);
@override
@ -53,9 +47,8 @@ class _AddAllergiesState extends State<AddAllergies> {
title: TranslationBase.of(context).addAllergies),
body: MasterKeyCheckboxSearchAllergiesWidget(
model: model,
// addAllergy: (AllergiesListVidaPlus mySelectedAllergy) {
// widget.addAllergiesFun!(mySelectedAllergy);
// },
myAllergiesList: widget.myAllergiesList,
patientInfo: widget.patientInfo
),
bottomSheet: CustomBottomSheetContainer(
widthFactor: .9,

@ -10,6 +10,8 @@ import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-cust
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import '../../../../../../core/model/SOAP/allergy/get_patient_allergies_list_vida_plus.dart';
import '../../../../../../core/model/patient/patiant_info_model.dart';
import '../../../../../../widgets/transitions/fade_page.dart';
import '../../objective/widget/EmptyExamination.dart';
@ -18,13 +20,13 @@ class MasterKeyCheckboxSearchAllergiesWidget extends StatefulWidget {
final SOAPViewModel model;
final String? buttonName;
final String? hintSearchText;
final PatientAllergiesVidaPlus? myAllergiesList;
final PatiantInformtion patientInfo;
MasterKeyCheckboxSearchAllergiesWidget(
{Key? key,
required this.model,
// required this.addAllergy,
this.myAllergiesList,
required this.patientInfo,
this.buttonName,
this.hintSearchText,
@ -42,7 +44,7 @@ bool loading =false;
@override
void initState() {
// items.addAll(widget.masterList);
super.initState();
}
@ -102,6 +104,7 @@ bool loading =false;
itemBuilder: (context, index) {
loading =false;
return ListTile(title: AppText(widget.model.searchAllergiesVidaPlus[index].allergyName!), trailing: TextButton.icon(icon: SvgPicture.asset("assets/images/svgs/add-square.svg", color: Color(0xffD02127),), style: ButtonStyle(iconColor: WidgetStateProperty.all<Color>(Color(0xffD02127)), ), onPressed: (){
openReaction(widget.model, widget.model.searchAllergiesVidaPlus[index]);
}, label: AppText(TranslationBase.of(context).add, fontSize:12, color:Color(0xffD02127) ,),
@ -126,16 +129,20 @@ bool loading =false;
);
}
openReaction(model, AllergiesListVidaPlus mySelectedAllergy){
Navigator.of(context).pop();
Navigator.push(
context,
FadePage(
page:ReactionsSelectionAllergiesWidget(
model:model,
mySelectedAllergy: mySelectedAllergy,
addReactionFun: (AllergiesListVidaPlus mySelectedAllergy) {
Navigator.of(context).pop();
})
patientInfo: widget.patientInfo
)
// addReactionFun: (AllergiesListVidaPlus mySelectedAllergy) {
//
// Navigator.of(context).pop();
//
// })
));
}

@ -1,32 +1,36 @@
import 'package:doctor_app_flutter/core/enum/view_state.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/viewModel/SOAP_view_model.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_texts_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/rounded_container_widget.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:provider/provider.dart';
import '../../../../../../config/config.dart';
import '../../../../../../widgets/bottom_sheet/custom_bottom_sheet_container.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';
import '../../../soap_update/shared_soap_widgets/bottom_sheet_title.dart';
class ReactionsSelectionAllergiesWidget extends StatefulWidget {
final SOAPViewModel? model;
final AllergiesListVidaPlus mySelectedAllergy;
final Function(AllergiesListVidaPlus mySelectedAllergy) addReactionFun;
final AllergiesListVidaPlus? mySelectedAllergy;
final bool isEdit;
final PatientAllergiesVidaPlus? editSelectedAllergy;
final PatiantInformtion patientInfo;
final String? buttonName;
ReactionsSelectionAllergiesWidget({
Key? key,
required this.model,
required this.addReactionFun,
required this.mySelectedAllergy,
required this.patientInfo,
this.mySelectedAllergy,
this.editSelectedAllergy,
this.isEdit = false,
this.buttonName,
}) : super(key: key);
@ -37,11 +41,8 @@ class ReactionsSelectionAllergiesWidget extends StatefulWidget {
class _ReactionsSelectionAllergiesWidgetState
extends State<ReactionsSelectionAllergiesWidget> {
// List<MasterKeyModel> items = [];
bool loading = false;
// TextEditingController filteredSearchController = TextEditingController();
@override
void initState() {
super.initState();
@ -49,21 +50,23 @@ class _ReactionsSelectionAllergiesWidgetState
@override
Widget build(BuildContext context) {
return AppScaffold(
// isShowAppBar: true,
return BaseView<SOAPViewModel>(
builder: (_, model, w) => AppScaffold(
isLoading:loading,
appBar: PatientSearchHeader(
title: "Select Reaction"
title: widget.mySelectedAllergy !=null ?widget.mySelectedAllergy!.allergyName : widget.editSelectedAllergy!.allergyName
),
body: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Expanded(
widget.mySelectedAllergy != null ? Expanded(
child: RoundedContainer(
margin: EdgeInsets.all(15),
child: ListView.builder(
itemCount:
widget.mySelectedAllergy.allergyReactionDTOs!.length,
widget.mySelectedAllergy!.allergyReactionDTOs!.length,
itemBuilder: (context, index) {
loading = false;
return Column(children: [
@ -74,17 +77,17 @@ class _ReactionsSelectionAllergiesWidgetState
showTrailingIcon: false,
initiallyExpanded: widget
.mySelectedAllergy
.mySelectedAllergy!
.allergyReactionDTOs![index].isSelected!,
leading:
Checkbox(
activeColor: Color(0xffD02127),
value: widget
.mySelectedAllergy
.mySelectedAllergy!
.allergyReactionDTOs![index].isSelected!, onChanged: (value) {
widget
.mySelectedAllergy
.mySelectedAllergy!
.allergyReactionDTOs![index].isSelected = value;
setState(() {
@ -92,7 +95,7 @@ class _ReactionsSelectionAllergiesWidgetState
}),
title: AppText(widget
.mySelectedAllergy
.mySelectedAllergy!
.allergyReactionDTOs![index]
.allergyReactionName!),
children: [
@ -111,16 +114,16 @@ class _ReactionsSelectionAllergiesWidgetState
MaterialTapTargetSize.shrinkWrap,
// Reduces padding around checkbox
visualDensity: VisualDensity.compact,
value: TranslationBase.of(context).mild,
value: 1,
groupValue: widget
.mySelectedAllergy
.mySelectedAllergy!
.allergyReactionDTOs![index]
.reactionSelection,
.severity,
onChanged: (value) {
widget
.mySelectedAllergy
.mySelectedAllergy!
.allergyReactionDTOs![index]
.reactionSelection = value;
.severity = value;
setState(() {});
},
),
@ -140,16 +143,16 @@ class _ReactionsSelectionAllergiesWidgetState
MaterialTapTargetSize.shrinkWrap,
// Reduces padding around checkbox
visualDensity: VisualDensity.compact,
value: TranslationBase.of(context).moderate,
value: 2,
groupValue: widget
.mySelectedAllergy
.mySelectedAllergy!
.allergyReactionDTOs![index]
.reactionSelection,
.severity,
onChanged: (value) {
widget
.mySelectedAllergy
.mySelectedAllergy!
.allergyReactionDTOs![index]
.reactionSelection = value;
.severity = value;
setState(() {});
},
),
@ -169,16 +172,16 @@ class _ReactionsSelectionAllergiesWidgetState
MaterialTapTargetSize.shrinkWrap,
// Reduces padding around checkbox
visualDensity: VisualDensity.compact,
value: TranslationBase.of(context).severe,
value: 3,
groupValue: widget
.mySelectedAllergy
.mySelectedAllergy!
.allergyReactionDTOs![index]
.reactionSelection,
.severity,
onChanged: (value) {
widget
.mySelectedAllergy
.mySelectedAllergy!
.allergyReactionDTOs![index]
.reactionSelection = value;
.severity = value;
setState(() {});
},
),
@ -195,6 +198,127 @@ class _ReactionsSelectionAllergiesWidgetState
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(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Radio(
activeColor: Color(0xffD02127),
materialTapTargetSize:
MaterialTapTargetSize.shrinkWrap,
// Reduces padding around checkbox
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!);
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: TranslationBase.of(context).moderate,
groupValue: getSeverityByID(widget.editSelectedAllergy!.patientsAllergyReactionsDTOs![index]
.severity!),
onChanged: (value) {
widget.editSelectedAllergy!.patientsAllergyReactionsDTOs![index]
.reactionSelection =getSeverityByID(widget.editSelectedAllergy!.patientsAllergyReactionsDTOs![index]
.severity!);
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: TranslationBase.of(context).severe,
groupValue: getSeverityByID(widget.editSelectedAllergy!.patientsAllergyReactionsDTOs![index]
.severity!),
onChanged: (value) {
widget.editSelectedAllergy!.patientsAllergyReactionsDTOs![index]
.reactionSelection =getSeverityByID(widget.editSelectedAllergy!.patientsAllergyReactionsDTOs![index]
.severity!);
setState(() {});
},
),
AppText(
TranslationBase.of(context).severe,
fontSize: 10,
),
],
)))
],
)
],
),
Divider(),
]);
},
)))
],
),
@ -224,15 +348,22 @@ class _ReactionsSelectionAllergiesWidgetState
Expanded(
child: Container(
child: AppButton(
loading: loading,
title: TranslationBase.of(context).save,
vPadding: 8,
hPadding: 8,
color: AppGlobal.appGreenColor,
fontColor: Colors.white,
onPressed: () {
widget.addReactionFun(widget
.mySelectedAllergy
);
if(widget.mySelectedAllergy ==null) {
editAllergy();
}
else{
addAllergy();
}
},
),
),
@ -251,6 +382,35 @@ class _ReactionsSelectionAllergiesWidgetState
// },
// )
);
));
}
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();
}
editAllergy(){
}
setLoader(bool value) {
loading = value;
setState(() {
});
}
}

@ -1,181 +1,207 @@
import 'package:doctor_app_flutter/core/model/SOAP/allergy/get_patient_allergies_list_vida_plus.dart';
import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart';
import 'package:doctor_app_flutter/core/model/SOAP/selected_items/my_selected_allergy.dart';
import 'package:doctor_app_flutter/screens/base/base_view.dart';
import 'package:doctor_app_flutter/screens/patients/profile/soap_update_vida_plus/subjective/allergies/reactions_selection.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/dr_app_toast_msg.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_texts_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:provider/provider.dart';
import '../../../../../../core/model/patient/patiant_info_model.dart';
import '../../../../../../widgets/transitions/fade_page.dart';
import '../chief_complaint/widgets/add_soap_item.dart';
import 'add_allergies.dart';
import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart';
class UpdateAllergiesWidgetVidaPlus extends StatefulWidget {
List<PatientAllergiesVidaPlus>? myAllergiesList;
final PatiantInformtion patientInfo;
UpdateAllergiesWidgetVidaPlus({Key? key, this.myAllergiesList});
UpdateAllergiesWidgetVidaPlus(
{Key? key, this.myAllergiesList, required this.patientInfo});
@override
_UpdateAllergiesWidgetState createState() => _UpdateAllergiesWidgetState();
}
bool noKnownAllergies = false;
enum Severity {mild,moderate,severe }
enum Severity { mild, moderate, severe }
class _UpdateAllergiesWidgetState extends State<UpdateAllergiesWidgetVidaPlus> {
SOAPViewModel? model;
@override
Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context);
changeAllState() {
setState(() {
print(widget.myAllergiesList);
});
}
return Column(
children: [
SizedBox(
height: 20,
),
AddSoapItem(
title: "${TranslationBase.of(context).addAllergies}",
onAddSoapItemClicked: () {
Navigator.push(
context,
FadePage(
page: AddAllergies(),
),
);
},
),
SizedBox(
height: 20,
),
widget.myAllergiesList!.isEmpty
? Row(
mainAxisSize: MainAxisSize.max,
children: [
Checkbox(
value: noKnownAllergies,
checkColor: Colors.white,
activeColor: Colors.red,
onChanged: (value) {
noKnownAllergies = value!;
setState(() {});
},
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
// Reduces padding around checkbox
visualDensity:
VisualDensity.compact, // Minimizes size further
),
AppText(TranslationBase.of(context).noKnownAllergies)
],
)
: Divider(
thickness: 1,
color: Color(0xffEFEFEF),
),
ListView(
padding: EdgeInsets.all(10),
shrinkWrap: true,
children: widget.myAllergiesList!.map((selectedAllergy) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
AppText(
selectedAllergy.allergyName!,
fontSize: 12,
fontWeight: FontWeight.w800,
letterSpacing: -0.48,
),
selectedAllergy.patientsAllergyReactionsDTOs!.isNotEmpty ? ListView(
shrinkWrap: true,
children: selectedAllergy.patientsAllergyReactionsDTOs!.map((PatientsAllergyReactionsDTOs reaction) => Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(children: [ AppText(reaction.allergyReactionName!, fontSize: 10,),
AppText(" - "),
AppText(
Severity.values[reaction.severity! -1].name,
color: Color(0xFFCC9B14),
fontSize: 10,
fontWeight: FontWeight.w600,
letterSpacing: -0.48,
)],)
],)).toList()) : AppText("----"),
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
SizedBox(
height: 10,
),
TextButton.icon(
onPressed: () {},
icon: SvgPicture.asset(
"assets/images/svgs/edit-icon.svg",
height: 16,
),
label: AppText(
"Edit",
fontSize: 12,
return BaseView<SOAPViewModel>(
onModelReady: (model) {},
builder: (_, model, w) => Column(
children: [
SizedBox(
height: 20,
),
AddSoapItem(
title: "${TranslationBase.of(context).addAllergies}",
onAddSoapItemClicked: () {
Navigator.push(
context,
FadePage(
page: AddAllergies(
patientInfo: widget.patientInfo,
// addAllergiesFun: (){
// print("addAllergies save");
// },
),
),
TextButton.icon(
onPressed: () {},
icon: SvgPicture.asset(
"assets/images/svgs/resolve.svg",
height: 18,
);
},
),
SizedBox(
height: 20,
),
widget.myAllergiesList!.isEmpty
? Row(
mainAxisSize: MainAxisSize.max,
children: [
Checkbox(
value: noKnownAllergies,
checkColor: Colors.white,
activeColor: Colors.red,
onChanged: (value) {
noKnownAllergies = value!;
setState(() {});
},
materialTapTargetSize:
MaterialTapTargetSize.shrinkWrap,
// Reduces padding around checkbox
visualDensity:
VisualDensity.compact, // Minimizes size further
),
AppText(TranslationBase.of(context).noKnownAllergies)
],
)
: Divider(
thickness: 1,
color: Color(0xffEFEFEF),
),
ListView(
padding: EdgeInsets.all(10),
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
children: widget.myAllergiesList!.map((selectedAllergy) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
AppText(
selectedAllergy.allergyName!,
fontSize: 12,
fontWeight: FontWeight.w800,
letterSpacing: -0.48,
),
label: AppText("Resolve",
fontSize: 12, color: Color(0xff359846)))
],
)
],
);
}).toList()),
],
);
selectedAllergy
.patientsAllergyReactionsDTOs!.isNotEmpty
? ListView(
shrinkWrap: true,
children: selectedAllergy
.patientsAllergyReactionsDTOs!
.map((PatientsAllergyReactionsDTOs
reaction) =>
Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Row(
children: [
AppText(
reaction
.allergyReactionName!,
fontSize: 10,
),
AppText(" - "),
AppText(
Severity
.values[
reaction.severity! -
1]
.name,
color:getColor(reaction.severity!),
fontSize: 10,
fontWeight: FontWeight.w600,
letterSpacing: -0.48,
)
],
)
],
))
.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)))
],
)
],
);
}).toList()),
],
));
}
//
// removeAllergy(MySelectedAllergy mySelectedAllergy) {
// List<MySelectedAllergy> allergy =
// // ignore: missing_return
// widget.myAllergiesList!
// .where((element) => mySelectedAllergy.selectedAllergySeverity!.id == element.selectedAllergySeverity!.id && mySelectedAllergy.selectedAllergy!.id == element.selectedAllergy!.id)
// .toList();
//
// if (allergy.length > 0) {
// if (allergy.first.isLocal) {
// setState(() {
// widget.myAllergiesList!.remove(allergy.first);
// });
// }
// setState(() {
// allergy[0].isChecked = false;
// });
// }
// }
// openAllergiesList(BuildContext context, Function changeParentState) {
// showModalBottomSheet(
// backgroundColor: Colors.white,
// isScrollControlled: true,
// isDismissible: false,
// context: context,
// builder: (context) {
// return AddAllergies();
// });
// }
resolveAllergy(
SOAPViewModel model, PatientAllergiesVidaPlus selectedAllergy) async{
GifLoaderDialogUtils.showMyDialog(context);
await model.resolveAllergies(selectedAllergy, widget.patientInfo);
GifLoaderDialogUtils.hideDialog(context);
}
Color getColor(int severity){
Map<int,dynamic> color ={
1:Color(0xff359846) ,
2:Color(0xFFCC9B14),
3:Color(0xffD02127)
};
return color[severity];
}
}

@ -1,3 +1,4 @@
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';
@ -5,6 +6,7 @@ import 'package:doctor_app_flutter/screens/patients/profile/soap_update_vida_plu
import 'package:doctor_app_flutter/screens/patients/profile/soap_update_vida_plus/subjective/chief_complaint/widgets/previous_cheif_complaints.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/loader/gif_loader_dialog_utils.dart';
import 'package:flutter/material.dart';
class AddChiefComplaint extends StatelessWidget {
@ -13,6 +15,7 @@ class AddChiefComplaint extends StatelessWidget {
final String? firstField;
final String? secondField;
final String? thirdField;
final PatiantInformtion patientInfo;
const AddChiefComplaint(
{super.key,
@ -20,7 +23,9 @@ class AddChiefComplaint extends StatelessWidget {
required this.selectedType,
this.firstField,
this.secondField,
this.thirdField});
this.thirdField,
required this.patientInfo
});
@override
Widget build(BuildContext context) {
@ -43,6 +48,13 @@ class AddChiefComplaint extends StatelessWidget {
firstField: firstField,
secondField: secondField,
thirdField: thirdField,
searchData: model.searchChiefComplaintList,
onSearch:(String value){
searchChiefComplaint(model, value);
},
onSave: (String chiefComplaint){
addChiefComplaint(model, chiefComplaint);
},
),
SizedBox(height: 16,),
PreviousCheifComplaints()
@ -53,4 +65,13 @@ class AddChiefComplaint extends StatelessWidget {
),
);
}
addChiefComplaint(SOAPViewModel model, String CC) async{
await model.saveChiefComplaint(patientInfo, CC);
}
searchChiefComplaint(SOAPViewModel model, String CC) async{
await model.searchChiefComplaint(patientInfo, CC);
}
}

@ -1,21 +1,27 @@
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_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/screens/patients/profile/soap_update_vida_plus/subjective/chief_complaint/widgets/empty_complaints.dart';
import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart';
import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
class UpdateChiefComplaints extends StatelessWidget {
final List<String> complaints;
const UpdateChiefComplaints({Key? key, required this.complaints})
final PatiantInformtion patientInfo;
const UpdateChiefComplaints({Key? key, required this.complaints, required this.patientInfo})
: super(key: key);
@override
Widget build(BuildContext context) {
return Padding(
return BaseView<SOAPViewModel>(
onModelReady: (model){
WidgetsBinding.instance.addPostFrameCallback((_) {
getChiefComplaints(model);
});
},
builder: (_, model, w) => Padding(
padding: const EdgeInsets.all(12.0),
child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
AddSoapItem(
@ -25,6 +31,8 @@ class UpdateChiefComplaints extends StatelessWidget {
MaterialPageRoute(
builder: (BuildContext context) => AddChiefComplaint(
complaints: complaints,
patientInfo: patientInfo,
selectedType: '',
firstField: '',
secondField: '',
@ -34,15 +42,24 @@ class UpdateChiefComplaints extends StatelessWidget {
title: "Add Chief Complaint",
),
SizedBox(height: 16),
if (complaints.isEmpty) ...{
Center(child: EmptyComplaints())
} else ...{
Container(width: MediaQuery.of(context).size.width,
height: 40,
child:
ListView.builder(
itemBuilder: (_, index) => ComplaintItems(
complaint: complaints[index],
onCrossClicked: (complaints) {}))
}
shrinkWrap: true,
scrollDirection: Axis.horizontal,
itemCount: model.getChiefComplaintListVidaPlus.length,
itemBuilder: (_, index) =>
ComplaintItems(
complaint: model.getChiefComplaintListVidaPlus[index].chiefComplain!,
onCrossClicked: (complaints) {})
))
]),
);
));
}
getChiefComplaints(SOAPViewModel model){
model.getChiefComplaint(patientInfo);
}
}

@ -1,8 +1,12 @@
import 'dart:async';
import 'package:doctor_app_flutter/core/enum/view_state.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';
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/app_texts_widget.dart';
import 'package:flutter/material.dart';
import 'package:hexcolor/hexcolor.dart';
class ComplaintSelection extends StatefulWidget {
final List<String> complaints;
@ -10,13 +14,20 @@ class ComplaintSelection extends StatefulWidget {
final String? firstField;
final String? secondField;
final String? thirdField;
final Function(String cheifComplaint)? onSave;
final Function(String value)? onSearch;
final List<SearchChiefComplaint>? searchData;
const ComplaintSelection({super.key,
required this.complaints,
required this.selectedType,
this.firstField,
this.secondField,
this.thirdField});
this.thirdField,
this.onSave,
this.onSearch,
this.searchData
});
@override
State<ComplaintSelection> createState() => _ComplaintSelectionState();
@ -84,7 +95,11 @@ class _ComplaintSelectionState extends State<ComplaintSelection> {
@override
Widget build(BuildContext context) {
return Material(
return BaseView<SOAPViewModel>(
onModelReady: (model){
},
builder: (_, model, w) => Material(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10),
side: BorderSide(
@ -194,16 +209,32 @@ class _ComplaintSelectionState extends State<ComplaintSelection> {
),
),
),
TextWithSelectedItems()
TextWithSelectedItems(model)
],
),
),
);
));
}
FocusNode _focus = FocusNode();
Timer? _tTimer;
void _onStopped(String text) {
widget.onSearch!(text);
print(text);
}
void _onTextChanged(String text) {
if (_tTimer != null) {
_tTimer!.cancel();
}
_tTimer = Timer(Duration(milliseconds: 500), (){
_onStopped(text);
});
}
Widget TextWithSelectedItems() {
Widget TextWithSelectedItems(SOAPViewModel model) {
return Material(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10),
@ -227,33 +258,65 @@ class _ComplaintSelectionState extends State<ComplaintSelection> {
),
),
SizedBox(height: 8,),
Row(children: [
Expanded(child: Padding(
padding: EdgeInsets.only(left: 10,right: 10),
child:
TextFormField(
autofocus: true,
decoration: InputDecoration(
hintText: '',
border: InputBorder.none,
isCollapsed: true,
suffixIcon: model.state == ViewState.BusyLocal ?Transform.scale(
scale: 0.5,
child: CircularProgressIndicator(strokeWidth: 2,) ,): SizedBox()
),
onChanged: _onTextChanged,)
),)
],),
Stack(children: [
Positioned(child:Material(
elevation: 4.0, // Optional: for shadow effect
child:
ConstrainedBox(
constraints: BoxConstraints(
minHeight: 0,
maxHeight: 300),
child:
ListView.builder(
shrinkWrap: true,
itemCount: widget.searchData!.length,
itemBuilder: (context, index) {
return ListTile(
title: InkWell(child:AppText(widget.searchData![index].chiefComplain!), onTap:(){
var cc = widget.searchData![index].chiefComplain;
model.searchChiefComplaintList!.length =0;
setState((){});
widget.onSave!(cc!);
}));
}))))]),
SizedBox(
height: 43,
child: Row(
children: [
Expanded(
child: ListView.builder(scrollDirection: Axis.horizontal,
itemCount: widget.complaints.length + 1,
itemCount: widget.complaints.length,
itemBuilder: (context, index) {
if (index == widget.complaints.length) {
return SizedBox(
width: MediaQuery
.sizeOf(context)
.width,
child: TextField(
decoration: InputDecoration.collapsed(
hintText: '',
),
onChanged: (value) {
},),
);
} else {
return ComplaintItems(
complaint: widget.complaints[index],
onCrossClicked: (complaints) {});
}
}),
})
// }),
),
],
),

@ -10,38 +10,23 @@ class ComplaintItems extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.all(8.0),
child: Material(
color: Color(0XAAA5A5A5),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(5),),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
SizedBox(width: 6,),
AppText(
complaint,
fontWeight: FontWeight.w400,
fontSize: 14,
color: Color(0xFF575757),
),
SizedBox(width: 8,),
InkWell(
onTap: () {
onCrossClicked(complaint);
},
child: Icon(
Icons.close,
size: 16,
color: Color(0xFFD02127),
),
),
SizedBox(width: 4,),
],
),
),
);
return Container(
padding: const EdgeInsets.all(5.0),
width: 120,
height: 40,
alignment: Alignment.center,
decoration: BoxDecoration(
color: Color(0xffEAEAEA),
borderRadius: BorderRadius.circular(
5,
)),
child: AppText(
textOverflow: TextOverflow.ellipsis,
complaint,
fontWeight: FontWeight.w400,
fontSize: 14,
color: Color(0xFF575757),
),
);
}
}

@ -1,25 +1,48 @@
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/utils/dr_app_toast_msg.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: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/text_fields/app-textfield-custom.dart';
import 'package:flutter/material.dart';
import '../../../../../../utils/translations_delegate_base_utils.dart';
import '../../../../../../widgets/shared/app_texts_widget.dart';
import '../../../../../../widgets/shared/text_fields/app-textfield-custom.dart';
class UpdatePresentIllness extends StatefulWidget {
PatiantInformtion? patientInfo;
UpdatePresentIllness(this.patientInfo, {Key? key}) : super(key: key);
@override
State<UpdatePresentIllness> createState() => _UpdatePresentIllnessState();
State<UpdatePresentIllness> createState() => UpdatePresentIllnessState();
}
class _UpdatePresentIllnessState extends State<UpdatePresentIllness> {
bool isPatientSelected = false;
class UpdatePresentIllnessState extends State<UpdatePresentIllness> {
bool isPatientSelected = true;
bool isFamilySelected = false;
bool isOtherSelected = false;
final TextEditingController familyController = TextEditingController();
final TextEditingController otherController = TextEditingController();
final TextEditingController patientController = TextEditingController();
@override
void initState() {
super.initState();
}
@override
Widget build(BuildContext context) {
return Column(
return BaseView<SOAPViewModel>(
onModelReady: (model){
WidgetsBinding.instance.addPostFrameCallback((_) {
getHopi(model);
});
},
builder: (_, model, w) => Column(
// key:UpdatePresentIllness.HopiKey,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(
@ -36,7 +59,7 @@ class _UpdatePresentIllnessState extends State<UpdatePresentIllness> {
ListTileTheme(
horizontalTitleGap: 0,
child: CheckboxListTile(
value: isPatientSelected,
value: this.isPatientSelected,
activeColor: Color(0xFFD02127),
checkColor: Colors.white,
controlAffinity: ListTileControlAffinity.leading,
@ -174,27 +197,67 @@ class _UpdatePresentIllnessState extends State<UpdatePresentIllness> {
height: 8,
),
AppTextFieldCustom(
isTextFieldHasSuffix: true,
hintText: TranslationBase.of(context).remarks,
controller: otherController,
controller: patientController,
inputType: TextInputType.multiline,
maxLines: 25,
minLines: 3,
hasBorder: true,
onClick: () {},
onChanged: (value) {},
onFieldSubmitted: () {},
onChanged: (value) {
print("On Field Changed..");
},
onFieldSubmitted: () {
print("---Submit.....");
},
suffixIcon: IconButton(icon:Icon(Icons.save_as_outlined, color: Colors.red, size: 25,), onPressed: (){
saveHopi(model);
},),
),
SizedBox(
height: 8,
),
AppText(
'Last saved: 22-10-2024 08:07 am [3 hours ago]',
fontSize: 10,
fontWeight: FontWeight.normal,
textAlign: TextAlign.start,
color: Color(0XFF575757),
),
// AppText(
// 'Last saved: 22-10-2024 08:07 am [3 hours ago]',
// fontSize: 10,
// fontWeight: FontWeight.normal,
// textAlign: TextAlign.start,
// color: Color(0XFF575757),
// ),
],
),
);
}
saveHopi(SOAPViewModel model) async{
GifLoaderDialogUtils.showMyDialog(context);
if(patientController.text.isEmpty) {
DrAppToastMsg.showErrorToast("Please Enter Remarks");
return;
}
Map<String,dynamic> request = {
"hpi": patientController.text,
"isHpiTakenPatient": isPatientSelected,
"isHpiTakenFamily": isFamilySelected,
"isHpiTakenOther": isOtherSelected,
"hpiTakenOtherText": otherController.text,
"hpiTakenFamilyText": familyController.text,
};
await model!.saveHopi(request, widget.patientInfo!);
GifLoaderDialogUtils.hideDialog(context);
}
getHopi(SOAPViewModel model) async{
await model!.getHopi(widget.patientInfo!);
setData(model);
}
setData(SOAPViewModel model){
if(model.getHopiDetails.isNotEmpty) {
patientController.text = model.getHopiDetails[0].hpi!;
isOtherSelected = model.getHopiDetails[0].isHpiTakenOther!;
isFamilySelected = model.getHopiDetails[0].isHpiTakenFamily!;
isPatientSelected = model.getHopiDetails[0].isHpiTakenPatient!;
}
}
}

@ -203,6 +203,7 @@ class _UpdateSubjectivePageVidaPlusState
},
child: UpdateChiefComplaints(
complaints: [],
patientInfo: widget.patientInfo,
),
isExpanded: isChiefExpand,
),
@ -222,7 +223,7 @@ class _UpdateSubjectivePageVidaPlusState
});
},
child: Column(
children: [UpdatePresentIllness()],
children: [UpdatePresentIllness(widget.patientInfo)],
),
isExpanded: isHistoryExpand,
),
@ -245,6 +246,7 @@ class _UpdateSubjectivePageVidaPlusState
children: [
UpdateAllergiesWidgetVidaPlus(
myAllergiesList: myAllergiesList,
patientInfo: widget.patientInfo
),
SizedBox(
height: 30,
@ -321,11 +323,10 @@ class _UpdateSubjectivePageVidaPlusState
}
}
@override
Function nextFunction(model) {
// addSubjectiveInfo(model: model,
// // myAllergiesList: myAllergiesList.where((i) => i.isChecked).toList(),
// myHistoryList: myHistoryList);
return () {};
//need to be implemented ..
return (){};
}
}

@ -32,7 +32,7 @@ class UpdateSoapIndexVidaPlus extends StatefulWidget {
class _UpdateSoapIndexVidaPlusState extends State<UpdateSoapIndexVidaPlus>
with TickerProviderStateMixin {
PageController? _controller;
int _currentIndex = 2;
int _currentIndex = 0;
List<MySelectedAllergy> myAllergiesList = [];
List<MySelectedHistory> myHistoryList = [];
@ -97,6 +97,18 @@ class _UpdateSoapIndexVidaPlusState extends State<UpdateSoapIndexVidaPlus>
},
scrollDirection: Axis.horizontal,
children: <Widget>[
UpdateSubjectivePageVidaPlus(
changePageViewIndex: changePageViewIndex,
currentIndex: _currentIndex,
patientInfo: patient,
changeLoadingState: changeLoadingState),
UpdateObjectivePageVidaPlus(
changePageViewIndex: changePageViewIndex,
currentIndex: _currentIndex,
patientInfo: patient,
changeLoadingState: changeLoadingState),
UpdateAssessmentPage(
changePageViewIndex: changePageViewIndex,
currentIndex: _currentIndex,
@ -111,16 +123,6 @@ class _UpdateSoapIndexVidaPlusState extends State<UpdateSoapIndexVidaPlus>
sOAPViewModel: model,
changeStateFun: changeStateFun,
),
UpdateObjectivePageVidaPlus(
changePageViewIndex: changePageViewIndex,
currentIndex: _currentIndex,
patientInfo: patient,
changeLoadingState: changeLoadingState),
UpdateSubjectivePageVidaPlus(
changePageViewIndex: changePageViewIndex,
currentIndex: _currentIndex,
patientInfo: patient,
changeLoadingState: changeLoadingState),
],
),
)
@ -175,6 +177,7 @@ class _UpdateSoapIndexVidaPlusState extends State<UpdateSoapIndexVidaPlus>
fontWeight: FontWeight.w600,
color: Colors.red[700]!,
onPressed: () async {
model.nextOnSubjectPage(model);
},
),

@ -344,7 +344,7 @@ class SMSOTP {
}
checkValue() async {
if (verifyAccountForm.currentState!.validate() && _token !=null) {
if (verifyAccountForm.currentState!.validate() ) { //&& _token !=null removed cloud flare for vida plus
// if (digit1.text.isNotEmpty && digit2.text.isNotEmpty && digit3.text.isNotEmpty && digit4.text.isNotEmpty) {
onSuccess(digit1.text.toString() + digit2.text.toString() + digit3.text.toString() + digit4.text.toString());
this.isClosed = true;

Loading…
Cancel
Save