chef complint for in patient

merge-requests/787/head^2
hussam al-habibeh 3 years ago
parent 8147d20fc6
commit 562fd1b515

@ -5,8 +5,8 @@ const ONLY_NUMBERS = "[0-9]";
const ONLY_LETTERS = "[a-zA-Z &'\"]"; const ONLY_LETTERS = "[a-zA-Z &'\"]";
const ONLY_DATE = "[0-9/]"; const ONLY_DATE = "[0-9/]";
const BASE_URL_LIVE_CARE = 'https://livecare.hmg.com/'; const BASE_URL_LIVE_CARE = 'https://livecare.hmg.com/';
// const BASE_URL = 'https://hmgwebservices.com/'; const BASE_URL = 'https://hmgwebservices.com/';
const BASE_URL = 'https://uat.hmgwebservices.com/'; // const BASE_URL = 'https://uat.hmgwebservices.com/';
const PHARMACY_ITEMS_URL = "Services/Lists.svc/REST/GetPharmcyItems_Region_enh"; const PHARMACY_ITEMS_URL = "Services/Lists.svc/REST/GetPharmcyItems_Region_enh";
const PHARMACY_LIST_URL = "Services/Patients.svc/REST/GetPharmcyList"; const PHARMACY_LIST_URL = "Services/Patients.svc/REST/GetPharmcyList";
const PATIENT_PROGRESS_NOTE_URL = "Services/DoctorApplication.svc/REST/GetProgressNoteForInPatient"; const PATIENT_PROGRESS_NOTE_URL = "Services/DoctorApplication.svc/REST/GetProgressNoteForInPatient";

@ -21,10 +21,18 @@ class GetChiefComplaintReqModel {
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>(); final Map<String, dynamic> data = new Map<String, dynamic>();
data['PatientMRN'] = this.patientMRN; data['PatientMRN'] = this.patientMRN;
data['AppointmentNo'] = this.appointmentNo; if (this.appointmentNo != null) {
data['EpisodeId'] = this.episodeId; data['AppointmentNo'] = this.appointmentNo;
data['EpisodeID'] = this.episodeID; }
data['DoctorID'] = this.doctorID; if (this.episodeId != null) {
data['EpisodeId'] = this.episodeId;
}
if (episodeID != null) {
data['EpisodeID'] = this.episodeID;
}
if (doctorID != null) {
data['DoctorID'] = this.doctorID;
}
if (this.admissionNo != null) { if (this.admissionNo != null) {
data['AdmissionNo'] = this.admissionNo; data['AdmissionNo'] = this.admissionNo;
} }

@ -43,8 +43,13 @@ class PostChiefComplaintRequestModel {
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>(); final Map<String, dynamic> data = new Map<String, dynamic>();
data['AppointmentNo'] = this.appointmentNo; if (appointmentNo != null) {
data['EpisodeID'] = this.episodeID; data['AppointmentNo'] = this.appointmentNo;
}
if (episodeID != null) {
data['EpisodeID'] = this.episodeID;
}
data['PatientMRN'] = this.patientMRN; data['PatientMRN'] = this.patientMRN;
data['chiefComplaint'] = this.chiefComplaint; data['chiefComplaint'] = this.chiefComplaint;
data['Hopi'] = this.hopi; data['Hopi'] = this.hopi;
@ -53,8 +58,10 @@ class PostChiefComplaintRequestModel {
data['isLactation'] = this.isLactation; data['isLactation'] = this.isLactation;
data['numberOfWeeks'] = this.numberOfWeeks; data['numberOfWeeks'] = this.numberOfWeeks;
data['DoctorID'] = this.doctorID; data['DoctorID'] = this.doctorID;
data['EditedBy'] = this.editedBy; if (editedBy != null) {
if (this.admissionNo != null) { data['EditedBy'] = this.editedBy;
}
if (admissionNo != null) {
data['AdmissionNo'] = this.admissionNo; data['AdmissionNo'] = this.admissionNo;
} }

@ -79,95 +79,93 @@ class PatiantInformtion {
int vcId; int vcId;
String voipToken; String voipToken;
PatiantInformtion({this.patientDetails, PatiantInformtion(
this.projectId, {this.patientDetails,
this.clinicId, this.projectId,
this.doctorId, this.clinicId,
this.patientId, this.doctorId,
this.doctorName, this.patientId,
this.doctorNameN, this.doctorName,
this.firstName, this.doctorNameN,
this.middleName, this.firstName,
this.lastName, this.middleName,
this.firstNameN, this.lastName,
this.middleNameN, this.firstNameN,
this.lastNameN, this.middleNameN,
this.gender, this.lastNameN,
this.dateofBirth, this.gender,
this.nationalityId, this.dateofBirth,
this.mobileNumber, this.nationalityId,
this.emailAddress, this.mobileNumber,
this.patientIdentificationNo, this.emailAddress,
this.patientType, this.patientIdentificationNo,
this.admissionNo, this.patientType,
this.admissionDate, this.admissionNo,
this.createdOn, this.admissionDate,
this.roomId, this.createdOn,
this.bedId, this.roomId,
this.nursingStationId, this.bedId,
this.description, this.nursingStationId,
this.clinicDescription, this.description,
this.clinicDescriptionN, this.clinicDescription,
this.nationalityName, this.clinicDescriptionN,
this.nationalityNameN, this.nationalityName,
this.age, this.nationalityNameN,
this.genderDescription, this.age,
this.nursingStationName, this.genderDescription,
this.appointmentDate, this.nursingStationName,
this.startTime, this.appointmentDate,
this.appointmentNo, this.startTime,
this.arrivalTime, this.appointmentNo,
this.arrivalTimeD, this.arrivalTime,
this.callStatus, this.arrivalTimeD,
this.callStatusDisc, this.callStatus,
this.callTypeID, this.callStatusDisc,
this.clientRequestID, this.callTypeID,
this.clinicName, this.clientRequestID,
this.consoltationEnd, this.clinicName,
this.consultationNotes, this.consoltationEnd,
this.appointmentType, this.consultationNotes,
this.appointmentTypeId, this.appointmentType,
this.arrivedOn, this.appointmentTypeId,
this.clinicGroupId, this.arrivedOn,
this.companyName, this.clinicGroupId,
this.dischargeStatus, this.companyName,
this.doctorDetails, this.dischargeStatus,
this.endTime, this.doctorDetails,
this.episodeNo, this.endTime,
this.fallRiskScore, this.episodeNo,
this.genderInt, this.fallRiskScore,
this.isSigned, this.genderInt,
this.medicationOrders, this.isSigned,
this.nationality, this.medicationOrders,
this.patientMRN, this.nationality,
this.visitType, this.patientMRN,
this.fullName, this.visitType,
this.fullNameN, this.fullName,
this.nationalityFlagURL, this.fullNameN,
this.patientStatusType, this.nationalityFlagURL,
this.patientStatus, this.patientStatusType,
this.visitTypeId, this.patientStatus,
this.startTimes, this.visitTypeId,
this.dischargeDate, this.startTimes,
this.status, this.dischargeDate,
this.vcId, this.status,
this.voipToken, this.vcId,
this.admissionDateWithDateTimeForm, this.voipToken,
this.admissionDateWithDateTimeForm,
this.appointmentDateWithDateTimeForm}); this.appointmentDateWithDateTimeForm});
PatiantInformtion.fromJson(Map<String, dynamic> json) { PatiantInformtion.fromJson(Map<String, dynamic> json) {
{ {
patientDetails = json['patientDetails'] != null patientDetails = json['patientDetails'] != null ? new PatiantInformtion.fromJson(json['patientDetails']) : null;
? new PatiantInformtion.fromJson(json['patientDetails'])
: null;
projectId = json["ProjectID"] ?? json["projectID"]; projectId = json["ProjectID"] ?? json["projectID"];
clinicId = json["ClinicID"] ?? json["clinicID"]; clinicId = json["ClinicID"] ?? json["clinicID"];
doctorId = json["DoctorID"] ?? json["doctorID"]; doctorId = json["DoctorID"] ?? json["doctorID"];
patientId = json["PatientID"] != null patientId = json["PatientID"] != null
? json["PatientID"] is String ? json["PatientID"] is String
? int.parse(json["PatientID"]) ? int.parse(json["PatientID"])
: json["PatientID"] : json["PatientID"]
: json["patientID"] ?? json['patientMRN'] ?? json['PatientMRN']; : json["patientID"] ?? json['patientMRN'] ?? json['PatientMRN'];
doctorName = json["DoctorName"] ?? json["doctorName"]; doctorName = json["DoctorName"] ?? json["doctorName"];
doctorNameN = json["DoctorNameN"] ?? json["doctorNameN"]; doctorNameN = json["DoctorNameN"] ?? json["doctorNameN"];
@ -179,18 +177,16 @@ class PatiantInformtion {
lastNameN = json["LastNameN"] ?? json["lastNameN"]; lastNameN = json["LastNameN"] ?? json["lastNameN"];
gender = json["Gender"] != null gender = json["Gender"] != null
? json["Gender"] is String ? json["Gender"] is String
? int.parse(json["Gender"]) ? int.parse(json["Gender"])
: json["Gender"] : json["Gender"]
: json["gender"]; : json["gender"];
fullName = json["fullName"] ?? json["fullName"] ?? json["PatientName"]; fullName = json["fullName"] ?? json["fullName"] ?? json["PatientName"];
fullNameN = fullNameN = json["fullNameN"] ?? json["fullNameN"] ?? json["PatientName"];
json["fullNameN"] ?? json["fullNameN"] ?? json["PatientName"];
dateofBirth = json["DateofBirth"] ?? json["dob"] ?? json['DateOfBirth']; dateofBirth = json["DateofBirth"] ?? json["dob"] ?? json['DateOfBirth'];
nationalityId = json["NationalityID"] ?? json["nationalityID"]; nationalityId = json["NationalityID"] ?? json["nationalityID"];
mobileNumber = json["MobileNumber"] ?? json["mobileNumber"]; mobileNumber = json["MobileNumber"] ?? json["mobileNumber"];
emailAddress = json["EmailAddress"] ?? json["emailAddress"]; emailAddress = json["EmailAddress"] ?? json["emailAddress"];
patientIdentificationNo = patientIdentificationNo = json["PatientIdentificationNo"] ?? json["patientIdentificationNo"];
json["PatientIdentificationNo"] ?? json["patientIdentificationNo"];
//TODO make 7 dynamic when the backend retrun it in patient arrival //TODO make 7 dynamic when the backend retrun it in patient arrival
patientType = json["PatientType"] ?? json["patientType"] ?? 1; patientType = json["PatientType"] ?? json["patientType"] ?? 1;
admissionNo = json["AdmissionNo"] ?? json["admissionNo"]; admissionNo = json["AdmissionNo"] ?? json["admissionNo"];
@ -200,16 +196,10 @@ class PatiantInformtion {
bedId = json["BedID"] ?? json["bedID"]; bedId = json["BedID"] ?? json["bedID"];
nursingStationId = json["NursingStationID"] ?? json["nursingStationID"]; nursingStationId = json["NursingStationID"] ?? json["nursingStationID"];
description = json["Description"] ?? json["description"]; description = json["Description"] ?? json["description"];
clinicDescription = clinicDescription = json["ClinicDescription"] ?? json["clinicDescription"];
json["ClinicDescription"] ?? json["clinicDescription"]; clinicDescriptionN = json["ClinicDescriptionN"] ?? json["clinicDescriptionN"];
clinicDescriptionN = nationalityName = json["NationalityName"] ?? json["nationalityName"] ?? json['NationalityName'];
json["ClinicDescriptionN"] ?? json["clinicDescriptionN"]; nationalityNameN = json["NationalityNameN"] ?? json["nationalityNameN"] ?? json['NationalityNameN'];
nationalityName = json["NationalityName"] ??
json["nationalityName"] ??
json['NationalityName'];
nationalityNameN = json["NationalityNameN"] ??
json["nationalityNameN"] ??
json['NationalityNameN'];
age = json["Age"] ?? json["age"]; age = json["Age"] ?? json["age"];
genderDescription = json["GenderDescription"]; genderDescription = json["GenderDescription"];
nursingStationName = json["NursingStationName"]; nursingStationName = json["NursingStationName"];
@ -217,8 +207,7 @@ class PatiantInformtion {
startTime = json["startTime"] ?? json['StartTime']; startTime = json["startTime"] ?? json['StartTime'];
appointmentNo = json['appointmentNo'] ?? json['AppointmentNo']; appointmentNo = json['appointmentNo'] ?? json['AppointmentNo'];
appointmentType = json['appointmentType']; appointmentType = json['appointmentType'];
appointmentTypeId = appointmentTypeId = json['appointmentTypeId'] ?? json['appointmentTypeid'];
json['appointmentTypeId'] ?? json['appointmentTypeid'];
arrivedOn = json['ArrivedOn'] ?? json['arrivedOn'] ?? json['ArrivedOn']; arrivedOn = json['ArrivedOn'] ?? json['arrivedOn'] ?? json['ArrivedOn'];
clinicGroupId = json['clinicGroupId']; clinicGroupId = json['clinicGroupId'];
companyName = json['companyName']; companyName = json['companyName'];
@ -234,16 +223,15 @@ class PatiantInformtion {
json['PatientMRN'] ?? json['PatientMRN'] ??
(json["PatientID"] != null (json["PatientID"] != null
? int?.parse(json["PatientID"].toString()) ? int?.parse(json["PatientID"].toString())
: json["patientID"] != null ? int?.parse( : json["patientID"] != null
json["patientID"].toString()) : json["patientId"] != null ? int ? int?.parse(json["patientID"].toString())
?.parse(json["patientId"].toString()) : ''); : json["patientId"] != null
? int?.parse(json["patientId"].toString())
: '');
visitType = json['visitType'] ?? json['visitType'] ?? json['visitType']; visitType = json['visitType'] ?? json['visitType'] ?? json['visitType'];
nationalityFlagURL = nationalityFlagURL = json['NationalityFlagURL'] ?? json['NationalityFlagURL'];
json['NationalityFlagURL'] ?? json['NationalityFlagURL']; patientStatusType = json['patientStatusType'] ?? json['PatientStatusType'];
patientStatusType = visitTypeId = json['visitTypeId'] ?? json['visitTypeId'] ?? json['visitTypeid'];
json['patientStatusType'] ?? json['PatientStatusType'];
visitTypeId =
json['visitTypeId'] ?? json['visitTypeId'] ?? json['visitTypeid'];
startTimes = json['StartTime'] ?? json['StartTime']; startTimes = json['StartTime'] ?? json['StartTime'];
dischargeDate = json['DischargeDate']; dischargeDate = json['DischargeDate'];
status = json['Status']; status = json['Status'];
@ -262,16 +250,15 @@ class PatiantInformtion {
voipToken = json['VoipToken']; voipToken = json['VoipToken'];
admissionDateWithDateTimeForm = json["AdmissionDate"] != null admissionDateWithDateTimeForm = json["AdmissionDate"] != null
? AppDateUtils.convertStringToDate(json["AdmissionDate"]) ? AppDateUtils.convertStringToDate(json["AdmissionDate"])
: json["admissionDate"] != null ? AppDateUtils.convertStringToDate( : json["admissionDate"] != null
json["admissionDate"]) : null; ? AppDateUtils.convertStringToDate(json["admissionDate"])
: null;
appointmentDateWithDateTimeForm = appointmentDateWithDateTimeForm =
json["AppointmentDate"] != null ? AppDateUtils.convertStringToDate( json["AppointmentDate"] != null ? AppDateUtils.convertStringToDate(json["AppointmentDate"]) : null;
json["AppointmentDate"]) : null;
} }
} }
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>(); final Map<String, dynamic> data = new Map<String, dynamic>();
@ -315,9 +302,9 @@ class PatiantInformtion {
data["Gender"] = this.gender; data["Gender"] = this.gender;
data["gender"] = this.gender; data["gender"] = this.gender;
data['Age'] = this.age; data['Age'] = this.age;
data['AppointmentDate'] = this.appointmentDate.isNotEmpty?this.appointmentDate:null; data['AppointmentDate'] = this.appointmentDate.isNotEmpty ? this.appointmentDate : null;
data['AppointmentNo'] = this.appointmentNo; data['AppointmentNo'] = this.appointmentNo;
data['ArrivalTime'] = this.arrivalTime; data['ArrivalTime'] = this.arrivalTime;
data['ArrivalTimeD'] = this.arrivalTimeD; data['ArrivalTimeD'] = this.arrivalTimeD;
@ -343,4 +330,4 @@ class PatiantInformtion {
data['DateOfBirth'] = this.dateofBirth; data['DateOfBirth'] = this.dateofBirth;
return data; return data;
} }
} }

@ -37,18 +37,13 @@ class UpdateSubjectivePage extends StatefulWidget {
final int currentIndex; final int currentIndex;
UpdateSubjectivePage( UpdateSubjectivePage(
{Key key, {Key key, this.changePageViewIndex, this.patientInfo, this.changeLoadingState, this.currentIndex});
this.changePageViewIndex,
this.patientInfo,
this.changeLoadingState,
this.currentIndex});
@override @override
_UpdateSubjectivePageState createState() => _UpdateSubjectivePageState(); _UpdateSubjectivePageState createState() => _UpdateSubjectivePageState();
} }
class _UpdateSubjectivePageState extends State<UpdateSubjectivePage> class _UpdateSubjectivePageState extends State<UpdateSubjectivePage> implements SubjectiveCallBack {
implements SubjectiveCallBack {
bool isChiefExpand = false; bool isChiefExpand = false;
bool isHistoryExpand = false; bool isHistoryExpand = false;
bool isAllergiesExpand = false; bool isAllergiesExpand = false;
@ -88,63 +83,47 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage>
} }
model.patientHistoryList.forEach((element) { model.patientHistoryList.forEach((element) {
if (element.historyType == if (element.historyType == MasterKeysService.HistoryFamily.getMasterKeyService()) {
MasterKeysService.HistoryFamily.getMasterKeyService()) {
MasterKeyModel history = model.getOneMasterKey( MasterKeyModel history = model.getOneMasterKey(
masterKeys: MasterKeysService.HistoryFamily, masterKeys: MasterKeysService.HistoryFamily,
id: element.historyId, id: element.historyId,
); );
if (history != null) { if (history != null) {
MySelectedHistory mySelectedHistory = SoapUtils.generateMySelectedHistory( MySelectedHistory mySelectedHistory = SoapUtils.generateMySelectedHistory(
history: history, history: history, isChecked: element.isChecked, remark: element.remarks, isLocal: false);
isChecked: element.isChecked,
remark: element.remarks,
isLocal: false);
myHistoryList.add(mySelectedHistory); myHistoryList.add(mySelectedHistory);
} }
} }
if (element.historyType == if (element.historyType == MasterKeysService.HistoryMedical.getMasterKeyService()) {
MasterKeysService.HistoryMedical.getMasterKeyService()) {
MasterKeyModel history = model.getOneMasterKey( MasterKeyModel history = model.getOneMasterKey(
masterKeys: MasterKeysService.HistoryMedical, masterKeys: MasterKeysService.HistoryMedical,
id: element.historyId, id: element.historyId,
); );
if (history != null) { if (history != null) {
MySelectedHistory mySelectedHistory = SoapUtils.generateMySelectedHistory( MySelectedHistory mySelectedHistory = SoapUtils.generateMySelectedHistory(
history: history, history: history, isChecked: element.isChecked, remark: element.remarks, isLocal: false);
isChecked: element.isChecked,
remark: element.remarks,
isLocal: false);
myHistoryList.add(mySelectedHistory); myHistoryList.add(mySelectedHistory);
} }
} }
if (element.historyType == if (element.historyType == MasterKeysService.HistorySports.getMasterKeyService()) {
MasterKeysService.HistorySports.getMasterKeyService()) {
MasterKeyModel history = model.getOneMasterKey( MasterKeyModel history = model.getOneMasterKey(
masterKeys: MasterKeysService.HistorySports, masterKeys: MasterKeysService.HistorySports,
id: element.historyId, id: element.historyId,
); );
if (history != null) { if (history != null) {
MySelectedHistory mySelectedHistory = SoapUtils.generateMySelectedHistory( MySelectedHistory mySelectedHistory = SoapUtils.generateMySelectedHistory(
history: history, history: history, isChecked: element.isChecked, remark: element.remarks, isLocal: false);
isChecked: element.isChecked,
remark: element.remarks,
isLocal: false);
myHistoryList.add(mySelectedHistory); myHistoryList.add(mySelectedHistory);
} }
} }
if (element.historyType == if (element.historyType == MasterKeysService.HistorySurgical.getMasterKeyService()) {
MasterKeysService.HistorySurgical.getMasterKeyService()) {
MasterKeyModel history = model.getOneMasterKey( MasterKeyModel history = model.getOneMasterKey(
masterKeys: MasterKeysService.HistorySurgical, masterKeys: MasterKeysService.HistorySurgical,
id: element.historyId, id: element.historyId,
); );
if (history != null) { if (history != null) {
MySelectedHistory mySelectedHistory = SoapUtils.generateMySelectedHistory( MySelectedHistory mySelectedHistory = SoapUtils.generateMySelectedHistory(
history: history, history: history, isChecked: element.isChecked, remark: element.remarks, isLocal: false);
isChecked: element.isChecked,
remark: element.remarks,
isLocal: false);
myHistoryList.add(mySelectedHistory); myHistoryList.add(mySelectedHistory);
} }
} }
@ -161,23 +140,16 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage>
editedBy: ''); editedBy: '');
await model.getPatientAllergy(generalGetReqForSOAP); await model.getPatientAllergy(generalGetReqForSOAP);
if (model.patientAllergiesList.isNotEmpty) { if (model.patientAllergiesList.isNotEmpty) {
if (model.allergiesList.isEmpty) if (model.allergiesList.isEmpty) await model.getMasterLookup(MasterKeysService.Allergies);
await model.getMasterLookup(MasterKeysService.Allergies); if (model.allergySeverityList.isEmpty) await model.getMasterLookup(MasterKeysService.AllergySeverity);
if (model.allergySeverityList.isEmpty)
await model.getMasterLookup(MasterKeysService.AllergySeverity);
model.patientAllergiesList.forEach((element) { model.patientAllergiesList.forEach((element) {
MasterKeyModel selectedAllergy = model.getOneMasterKey( MasterKeyModel selectedAllergy = model.getOneMasterKey(
masterKeys: MasterKeysService.Allergies, masterKeys: MasterKeysService.Allergies, id: element.allergyDiseaseId, typeId: element.allergyDiseaseType);
id: element.allergyDiseaseId,
typeId: element.allergyDiseaseType);
MasterKeyModel selectedAllergySeverity; MasterKeyModel selectedAllergySeverity;
if (element.severity == 0) { if (element.severity == 0) {
selectedAllergySeverity = MasterKeyModel( selectedAllergySeverity = MasterKeyModel(
id: 0, id: 0, typeId: MasterKeysService.AllergySeverity.getMasterKeyService(), nameAr: '', nameEn: '');
typeId: MasterKeysService.AllergySeverity.getMasterKeyService(),
nameAr: '',
nameEn: '');
} else { } else {
selectedAllergySeverity = model.getOneMasterKey( selectedAllergySeverity = model.getOneMasterKey(
masterKeys: MasterKeysService.AllergySeverity, masterKeys: MasterKeysService.AllergySeverity,
@ -185,17 +157,15 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage>
); );
} }
MySelectedAllergy mySelectedAllergy = MySelectedAllergy mySelectedAllergy = SoapUtils.generateMySelectedAllergy(
SoapUtils.generateMySelectedAllergy( allergy: selectedAllergy,
allergy: selectedAllergy, isChecked: element.isChecked,
isChecked: element.isChecked, createdBy: element.createdBy,
createdBy: element.createdBy, remark: element.remarks,
remark: element.remarks, isLocal: false,
isLocal: false, allergySeverity: selectedAllergySeverity);
allergySeverity: selectedAllergySeverity);
if (selectedAllergy != null && selectedAllergySeverity != null) myAllergiesList.add(mySelectedAllergy);
if (selectedAllergy != null && selectedAllergySeverity != null)
myAllergiesList.add(mySelectedAllergy);
}); });
} }
} }
@ -207,29 +177,29 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage>
myAllergiesList.clear(); myAllergiesList.clear();
myHistoryList.clear(); myHistoryList.clear();
model.setSubjectiveCallBack(this); model.setSubjectiveCallBack(this);
GetChiefComplaintReqModel getChiefComplaintReqModel = GetChiefComplaintReqModel getChiefComplaintReqModel = GetChiefComplaintReqModel(
GetChiefComplaintReqModel( admissionNo: widget.patientInfo.admissionNo != null ? int.parse(widget.patientInfo.admissionNo) : null,
admissionNo: int.parse(widget.patientInfo.admissionNo),patientMRN: widget.patientInfo.patientMRN, patientMRN: widget.patientInfo.patientMRN,
appointmentNo: appointmentNo: widget.patientInfo.appointmentNo != null
int.parse(widget.patientInfo.appointmentNo.toString()), ? int.parse(widget.patientInfo.appointmentNo.toString())
episodeId: widget.patientInfo.episodeNo, : null,
episodeID: widget.patientInfo.episodeNo, episodeId: widget.patientInfo.episodeNo,
doctorID: ''); episodeID: widget.patientInfo.episodeNo,
doctorID: '');
await model.getPatientChiefComplaint(getChiefComplaintReqModel); await model.getPatientChiefComplaint(getChiefComplaintReqModel);
if (model.patientChiefComplaintList.isNotEmpty) { if (model.patientChiefComplaintList.isNotEmpty) {
isChiefExpand = true; isChiefExpand = true;
complaintsController.text = Helpers.parseHtmlString( complaintsController.text = Helpers.parseHtmlString(model.patientChiefComplaintList[0].chiefComplaint);
model.patientChiefComplaintList[0].chiefComplaint);
illnessController.text = model.patientChiefComplaintList[0].hopi; illnessController.text = model.patientChiefComplaintList[0].hopi;
medicationController.text = medicationController.text = !(model.patientChiefComplaintList[0].currentMedication).isNotEmpty
!(model.patientChiefComplaintList[0].currentMedication).isNotEmpty ? model.patientChiefComplaintList[0].currentMedication + '\n \n'
? model.patientChiefComplaintList[0].currentMedication + : model.patientChiefComplaintList[0].currentMedication;
'\n \n'
: model.patientChiefComplaintList[0].currentMedication;
} }
if (widget.patientInfo.admissionNo == null) {
await getHistory(model);
await getHistory(model); await getAllergies(model);
await getAllergies(model); }
widget.changeLoadingState(false); widget.changeLoadingState(false);
}, },
@ -245,9 +215,7 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage>
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
SOAPStepHeader( SOAPStepHeader(currentIndex: widget.currentIndex, changePageViewIndex: widget.changePageViewIndex),
currentIndex: widget.currentIndex,
changePageViewIndex: widget.changePageViewIndex),
ExpandableSOAPWidget( ExpandableSOAPWidget(
headerTitle: TranslationBase.of(context).chiefComplaints, headerTitle: TranslationBase.of(context).chiefComplaints,
onTap: () { onTap: () {
@ -267,51 +235,48 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage>
isExpanded: isChiefExpand, isExpanded: isChiefExpand,
), ),
SizedBox( SizedBox(
height: SizeConfig.heightMultiplier * height: SizeConfig.heightMultiplier * (SizeConfig.isHeightVeryShort ? 4 : 2),
(SizeConfig.isHeightVeryShort ? 4 : 2),
), ),
ExpandableSOAPWidget( if (widget.patientInfo.admissionNo == null)
headerTitle: TranslationBase.of(context).histories, ExpandableSOAPWidget(
isRequired: false, headerTitle: TranslationBase.of(context).histories,
onTap: () { isRequired: false,
setState(() { onTap: () {
isHistoryExpand = !isHistoryExpand; setState(() {
}); isHistoryExpand = !isHistoryExpand;
}, });
child: Column( },
children: [ child: Column(
UpdateHistoryWidget(myHistoryList: myHistoryList) children: [UpdateHistoryWidget(myHistoryList: myHistoryList)],
], ),
isExpanded: isHistoryExpand,
), ),
isExpanded: isHistoryExpand,
),
SizedBox( SizedBox(
height: SizeConfig.heightMultiplier * height: SizeConfig.heightMultiplier * (SizeConfig.isHeightVeryShort ? 4 : 2),
(SizeConfig.isHeightVeryShort ? 4 : 2),
), ),
ExpandableSOAPWidget( if (widget.patientInfo.admissionNo == null)
headerTitle: TranslationBase.of(context).allergiesSoap, ExpandableSOAPWidget(
isRequired: false, headerTitle: TranslationBase.of(context).allergiesSoap,
onTap: () { isRequired: false,
setState(() { onTap: () {
isAllergiesExpand = !isAllergiesExpand; setState(() {
}); isAllergiesExpand = !isAllergiesExpand;
}, });
child: Column( },
children: [ child: Column(
UpdateAllergiesWidget( children: [
myAllergiesList: myAllergiesList, UpdateAllergiesWidget(
), myAllergiesList: myAllergiesList,
SizedBox( ),
height: 30, SizedBox(
), height: 30,
], ),
],
),
isExpanded: isAllergiesExpand,
), ),
isExpanded: isAllergiesExpand,
),
SizedBox( SizedBox(
height: SizeConfig.heightMultiplier * height: SizeConfig.heightMultiplier * (SizeConfig.isHeightVeryShort ? 20 : 10),
(SizeConfig.isHeightVeryShort ? 20 : 10),
), ),
], ],
), ),
@ -323,9 +288,7 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage>
} }
addSubjectiveInfo( addSubjectiveInfo(
{SOAPViewModel model, {SOAPViewModel model, List<MySelectedAllergy> myAllergiesList, List<MySelectedHistory> myHistoryList}) async {
List<MySelectedAllergy> myAllergiesList,
List<MySelectedHistory> myHistoryList}) async {
if (FocusScope.of(context).hasFocus) FocusScope.of(context).unfocus(); if (FocusScope.of(context).hasFocus) FocusScope.of(context).unfocus();
widget.changeLoadingState(true); widget.changeLoadingState(true);
formKey.currentState.save(); formKey.currentState.save();
@ -338,79 +301,73 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage>
///TODO Elham* ///TODO Elham*
/// ///
widget.changePageViewIndex(1); widget.changePageViewIndex(1);
// if (complaintsController.text.isNotEmpty && if (complaintsController.text.isNotEmpty &&
// illnessController.text.isNotEmpty && illnessController.text.isNotEmpty &&
// complaintsController.text.length > 25) { complaintsController.text.length > 25) {
// await postChiefComplaint(model: model); await postChiefComplaint(model: model);
// if (model.state == ViewState.ErrorLocal) { if (model.state == ViewState.ErrorLocal) {
// Helpers.showErrorToast(model.error); Helpers.showErrorToast(model.error);
// } }
// if (myHistoryList.length != 0) { if (myHistoryList.length != 0 && widget.patientInfo.admissionNo == null) {
// await postHistories(model: model, myHistoryList: myHistoryList); await postHistories(model: model, myHistoryList: myHistoryList);
// if (model.state == ViewState.ErrorLocal) { if (model.state == ViewState.ErrorLocal) {
// Helpers.showErrorToast(model.error); Helpers.showErrorToast(model.error);
// } }
// } }
// if (myAllergiesList.length != 0) { if (myAllergiesList.length != 0 && widget.patientInfo.admissionNo == null) {
// await postAllergy(myAllergiesList: myAllergiesList, model: model); await postAllergy(myAllergiesList: myAllergiesList, model: model);
// if (model.state == ViewState.ErrorLocal) { if (model.state == ViewState.ErrorLocal) {
// Helpers.showErrorToast(model.error); Helpers.showErrorToast(model.error);
// } }
// } }
// widget.changeLoadingState(true); widget.changeLoadingState(true);
//
// widget.changePageViewIndex(1); widget.changePageViewIndex(1);
// } else { } else {
// setState(() { setState(() {
// if (complaintsController.text.isEmpty) { if (complaintsController.text.isEmpty) {
// complaintsControllerError = TranslationBase.of(context).emptyMessage; complaintsControllerError = TranslationBase.of(context).emptyMessage;
// } else if (complaintsController.text.length < 25) { } else if (complaintsController.text.length < 25) {
// complaintsControllerError = complaintsControllerError = TranslationBase.of(context).chiefComplaintLength;
// TranslationBase.of(context).chiefComplaintLength; }
// }
// if (illnessController.text.isEmpty) {
// if (illnessController.text.isEmpty) { illnessControllerError = TranslationBase.of(context).emptyMessage;
// illnessControllerError = TranslationBase.of(context).emptyMessage; }
// }
// if (medicationController.text.isEmpty) {
// if (medicationController.text.isEmpty) { medicationControllerError = TranslationBase.of(context).emptyMessage;
// medicationControllerError = TranslationBase.of(context).emptyMessage; }
// } });
// });
// widget.changeLoadingState(false);
// widget.changeLoadingState(false); Helpers.showErrorToast(TranslationBase.of(context).chiefComplaintErrorMsg);
// Helpers.showErrorToast( }
// TranslationBase.of(context).chiefComplaintErrorMsg);
// }
} }
postAllergy( postAllergy({List<MySelectedAllergy> myAllergiesList, SOAPViewModel model}) async {
{List<MySelectedAllergy> myAllergiesList, SOAPViewModel model}) async { PostAllergyRequestModel postAllergyRequestModel = new PostAllergyRequestModel();
PostAllergyRequestModel postAllergyRequestModel =
new PostAllergyRequestModel();
Map profile = await sharedPref.getObj(DOCTOR_PROFILE); Map profile = await sharedPref.getObj(DOCTOR_PROFILE);
DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile); DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile);
myAllergiesList.forEach((allergy) { myAllergiesList.forEach((allergy) {
if (postAllergyRequestModel.listHisProgNotePatientAllergyDiseaseVM == if (postAllergyRequestModel.listHisProgNotePatientAllergyDiseaseVM == null)
null)
postAllergyRequestModel.listHisProgNotePatientAllergyDiseaseVM = []; postAllergyRequestModel.listHisProgNotePatientAllergyDiseaseVM = [];
postAllergyRequestModel.listHisProgNotePatientAllergyDiseaseVM.add( postAllergyRequestModel.listHisProgNotePatientAllergyDiseaseVM.add(ListHisProgNotePatientAllergyDiseaseVM(
ListHisProgNotePatientAllergyDiseaseVM( allergyDiseaseId: allergy.selectedAllergy.id,
allergyDiseaseId: allergy.selectedAllergy.id, allergyDiseaseType: allergy.selectedAllergy.typeId,
allergyDiseaseType: allergy.selectedAllergy.typeId, patientMRN: widget.patientInfo.patientMRN,
patientMRN: widget.patientInfo.patientMRN, episodeId: widget.patientInfo.episodeNo,
episodeId: widget.patientInfo.episodeNo, appointmentNo: widget.patientInfo.appointmentNo,
appointmentNo: widget.patientInfo.appointmentNo, severity: allergy.selectedAllergySeverity.id,
severity: allergy.selectedAllergySeverity.id, remarks: allergy.remark,
remarks: allergy.remark, createdBy: allergy.createdBy ?? doctorProfile.doctorID,
createdBy: allergy.createdBy ?? doctorProfile.doctorID, createdOn: DateTime.now().toIso8601String(),
createdOn: DateTime.now().toIso8601String(), editedBy: doctorProfile.doctorID,
editedBy: doctorProfile.doctorID, editedOn: DateTime.now().toIso8601String(),
editedOn: DateTime.now().toIso8601String(), isChecked: allergy.isChecked,
isChecked: allergy.isChecked, isUpdatedByNurse: false));
isUpdatedByNurse: false));
}); });
if (model.patientAllergiesList.isEmpty) { if (model.patientAllergiesList.isEmpty) {
await model.postAllergy(postAllergyRequestModel); await model.postAllergy(postAllergyRequestModel);
@ -434,13 +391,10 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage>
} }
} }
postHistories( postHistories({List<MySelectedHistory> myHistoryList, SOAPViewModel model}) async {
{List<MySelectedHistory> myHistoryList, SOAPViewModel model}) async { PostHistoriesRequestModel postHistoriesRequestModel = new PostHistoriesRequestModel(doctorID: '');
PostHistoriesRequestModel postHistoriesRequestModel =
new PostHistoriesRequestModel(doctorID: '');
myHistoryList.forEach((history) { myHistoryList.forEach((history) {
if (postHistoriesRequestModel.listMedicalHistoryVM == null) if (postHistoriesRequestModel.listMedicalHistoryVM == null) postHistoriesRequestModel.listMedicalHistoryVM = [];
postHistoriesRequestModel.listMedicalHistoryVM = [];
postHistoriesRequestModel.listMedicalHistoryVM.add(ListMedicalHistoryVM( postHistoriesRequestModel.listMedicalHistoryVM.add(ListMedicalHistoryVM(
patientMRN: widget.patientInfo.patientMRN, patientMRN: widget.patientInfo.patientMRN,
episodeId: widget.patientInfo.episodeNo, episodeId: widget.patientInfo.episodeNo,
@ -466,18 +420,18 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage>
postChiefComplaint({SOAPViewModel model}) async { postChiefComplaint({SOAPViewModel model}) async {
formKey.currentState.save(); formKey.currentState.save();
if (formKey.currentState.validate()) { if (formKey.currentState.validate()) {
PostChiefComplaintRequestModel postChiefComplaintRequestModel = PostChiefComplaintRequestModel postChiefComplaintRequestModel = new PostChiefComplaintRequestModel(
new PostChiefComplaintRequestModel( admissionNo: widget.patientInfo.admissionNo != null ? int.parse(widget.patientInfo.admissionNo) : null,
admissionNo: int.parse(widget.patientInfo.admissionNo),patientMRN: widget.patientInfo.patientMRN, patientMRN: widget.patientInfo.patientMRN,
episodeID: widget.patientInfo.episodeNo, episodeID: widget.patientInfo.episodeNo,
appointmentNo: widget.patientInfo.appointmentNo, appointmentNo: widget.patientInfo.appointmentNo,
chiefComplaint: complaintsController.text, chiefComplaint: complaintsController.text,
currentMedication: medicationController.text, currentMedication: medicationController.text,
hopi: illnessController.text, hopi: illnessController.text,
isLactation: false, isLactation: false,
ispregnant: false, ispregnant: false,
doctorID: '', doctorID: '',
numberOfWeeks: 0); numberOfWeeks: 0);
if (model.patientChiefComplaintList.isEmpty) { if (model.patientChiefComplaintList.isEmpty) {
postChiefComplaintRequestModel.editedBy = ''; postChiefComplaintRequestModel.editedBy = '';
await model.postChiefComplaint(postChiefComplaintRequestModel); await model.postChiefComplaint(postChiefComplaintRequestModel);
@ -489,9 +443,6 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage>
@override @override
Function nextFunction(model) { Function nextFunction(model) {
addSubjectiveInfo( addSubjectiveInfo(model: model, myAllergiesList: myAllergiesList, myHistoryList: myHistoryList);
model: model,
myAllergiesList: myAllergiesList,
myHistoryList: myHistoryList);
} }
} }

Loading…
Cancel
Save