WD: data mapping and request handling

update_flutter_3.24_vida_plus_episode
taha.alam 11 months ago
parent 8f12c3da17
commit 248c55f75d

@ -73,7 +73,7 @@ class AllergyReactionDTOs {
int? allergyReactionID;
String? allergyReactionName;
int? allergyReactionRevisionID;
int? hospitalGroupID;
dynamic? hospitalGroupID;
int? hospitalID;
bool? isActive;
bool? isSelected =false;

@ -175,6 +175,8 @@ class ChiefComplains {
int? patientId;
String? patientName;
int? patientPomrId;
int? chiefComplainTemplateId;
ChiefComplains(
{this.appointmentId,
@ -200,6 +202,7 @@ class ChiefComplains {
ChiefComplains.fromJson(Map<String, dynamic> json) {
appointmentId = json['appointmentId'];
chiefComplain = json['chiefComplain'];
chiefComplainTemplateId = json['chiefComplainTemplateId'];
chiefComplainId = json['chiefComplainId'];
clinicId = json['clinicId'];
createdBy = json['createdBy'];
@ -235,6 +238,7 @@ class ChiefComplains {
data['hospitalId'] = this.hospitalId;
data['loginUserId'] = this.loginUserId;
data['modifiedBy'] = this.modifiedBy;
data['chiefComplainTemplateId'] = this.chiefComplainTemplateId;
data['modifiedId'] = this.modifiedId;
data['modifiedOn'] = this.modifiedOn;
data['patientId'] = this.patientId;

@ -58,12 +58,12 @@ class CreatePhysicalExamination {
extension ConvertCategoryToCreatePhysicalExamination on Category {
CreatePhysicalExamination createPhysicalExaminationFromCategory() =>
CreatePhysicalExamination()
..isChecked = true
..physicalExaminationDescription = this.name
..physicalExaminationSystemID = this.id
..physicalExaminationCondition = this.selectedCondition
..remark = this.remarksController.text
..selected = false
..isChecked = false
..specialityID = this.specialityId
..patientID = this.paitientId
..pomrid = this.pomrId

@ -86,6 +86,7 @@ class SOAPService extends LookupService {
Map<String, List<Category>> specialityDetails = {};
Map<String, dynamic> diagnosisTypeList = {};
Map<String, dynamic> conditionTypeList = {};
Map<String, dynamic> conditionTypeMapWithIdAsKey = {};
List<String> icdVersionList = [];
bool showAuditBottomSheet = false;
@ -460,6 +461,8 @@ class SOAPService extends LookupService {
Future addAllergies(AllergiesListVidaPlus allergy,
PatiantInformtion patientInfo, bool isNoKnown) async {
var hospitalGroudpId = await sharedPref.getString(DOCTOR_SETUP_ID);
if (!isNoKnown) {
allergy.allergyReactionDTOs!.forEach((value) {
value.patientID = patientInfo.patientMRN;
@ -468,6 +471,11 @@ class SOAPService extends LookupService {
value.severity = value.severity ?? 1;
});
}
allergy.allergyReactionDTOs?.forEach((value) {
value.hospitalGroupID = hospitalGroudpId;
value.hospitalID = patientInfo.projectId;
});
var request = {
"patientsAllergyRevisionID": allergy.allergyRevisionID,
"patientMRN": patientInfo.patientMRN,
@ -519,16 +527,18 @@ class SOAPService extends LookupService {
/*changed request parameters based on the vida plus requested */
var doctorProfile = await sharedPref.getObj(LOGGED_IN_USER);
var hospitalGroudpId = await sharedPref.getString(DOCTOR_SETUP_ID);
List<PatientsAllergyReactionsDTOs>? reaction =
allergy.patientsAllergyReactionsDTOs!;
List<AllergyReactionDTOs>? reactionRequest = [];
reaction.forEach((value) {
reaction.forEach((value) async {
reactionRequest.add(AllergyReactionDTOs(
patientID: patientInfo.patientMRN,
pomrid: int.parse(patientInfo.pomrId!),
hospitalGroupID: value.hospitalGroupID,
hospitalGroupID: hospitalGroudpId,
allergyReactionMappingID: 0,
hospitalID: value.hospitalID,
hospitalID: patientInfo.projectId,
isActive: value.isActive,
allergyReactionID: value.allergyReactionID,
allergyReactionName: value.allergyReactionName,
@ -566,6 +576,7 @@ class SOAPService extends LookupService {
Future updateAllergies(
PatientAllergiesVidaPlus allergy, PatiantInformtion patientInfo) async {
var doctorProfile = await sharedPref.getObj(LOGGED_IN_USER);
var hospitalGroudpId = await sharedPref.getString(DOCTOR_SETUP_ID);
List<PatientsAllergyReactionsDTOs>? reaction =
allergy.patientsAllergyReactionsDTOs!;
List<AllergyReactionDTOs>? reactionRequest = [];
@ -573,9 +584,9 @@ class SOAPService extends LookupService {
reactionRequest.add(AllergyReactionDTOs(
patientID: patientInfo.patientMRN,
pomrid: int.parse(patientInfo.pomrId!),
hospitalGroupID: value.hospitalGroupID,
hospitalGroupID: hospitalGroudpId,
allergyReactionMappingID: 0,
hospitalID: value.hospitalID,
hospitalID: patientInfo.projectId,
isActive: value.isActive,
allergyReactionID: value.allergyReactionID,
allergyReactionName: value.allergyReactionName,
@ -788,6 +799,9 @@ class SOAPService extends LookupService {
response['ListDiagnosisCondition']['resultData']
.forEach((v) => conditionTypeList[v['itemName']] = v['id']);
;
response['ListDiagnosisCondition']['resultData']
.forEach((v) => conditionTypeMapWithIdAsKey[v['id']] = v['itemName']);
;
}, onFailure: (String error, int statusCode) {
searchChiefComplaintListVidaPlus.clear();
hasError = true;
@ -1071,10 +1085,10 @@ class SOAPService extends LookupService {
"patientId": patient.patientId,
"doctorId": patient.doctorId,
"pomrId": patient.pomrId,
"appointmentId": diagnosis.appointmentId,
"appointmentId": patient.appointmentNo,
"createdBy": patient.doctorId,
"hospitalId": patient.projectId,
"hospitalGroupId": diagnosis.hospitalGroupId,
"hospitalGroupId": await sharedPref.getString(DOCTOR_SETUP_ID),
"clinicGroupId": diagnosis.clinicGroupId ?? patient.clinicGroupId,
"clinicId": diagnosis.clinicId,
"isSelected": true,
@ -1156,6 +1170,8 @@ class SOAPService extends LookupService {
String remarks,
bool isNew) async {
Map<String, dynamic>? user = await sharedPref.getObj(LOGGED_IN_USER);
var mappedConditionValue = conditionTypeList[conditionType] ?? '';
var request = {
"pomrId": patient.pomrId,
"appointmentId": patient.appointmentNo,
@ -1165,7 +1181,7 @@ class SOAPService extends LookupService {
"hospitalId": patient.projectId,
"hospitalGroupId": await sharedPref.getString(DOCTOR_SETUP_ID),
"diagnosisType": diagnosisType,
"condition": conditionType,
"condition": mappedConditionValue,
"remarks": remarks,
"icdType": searchDiagnosis!.icdType,
// "icdVersion": searchDiagnosis.icdVersion,
@ -1208,6 +1224,7 @@ class SOAPService extends LookupService {
String remarks,
bool isNew) async {
Map<String, dynamic>? user = await sharedPref.getObj(LOGGED_IN_USER);
var mappedConditionValue = conditionTypeList[conditionType] ?? '';
var request = {
"pomrId": patient.pomrId,
"appointmentId": patient.appointmentNo,
@ -1217,10 +1234,11 @@ class SOAPService extends LookupService {
"hospitalId": patient.projectId,
"hospitalGroupId": await sharedPref.getString(DOCTOR_SETUP_ID),
"diagnosisType": diagnosisType,
"condition": conditionType,
"condition": mappedConditionValue,
"remarks": remarks,
"icdType": searchDiagnosis!.icdType,
"selectedIcdCode": searchDiagnosis.diseasesCode,
"selectedNandaCode": searchDiagnosis.diseasesCode,
// "icdVersion": searchDiagnosis.icdVersion,
"icdSubVersion": searchDiagnosis.icdSubVersion,
"isNew": isNew,
@ -1325,8 +1343,7 @@ class SOAPService extends LookupService {
onSuccess: (dynamic response, int statusCode) {
if (response['ListDiagnosisResolve'] != null &&
response['ListDiagnosisResolve']['resultData'] != null &&
(response['ListDiagnosisResolve']['resultData'] as List)
.isNotEmpty) {
(response['ListDiagnosisResolve']['resultData'] as List).isNotEmpty) {
success = true;
}
}, onFailure: (String error, int statusCode) {
@ -1360,6 +1377,7 @@ class SOAPService extends LookupService {
Future<bool> getPatientCondition() async {
Map<String, dynamic> request = {};
var success = false;
patientConditionList.clear();
await baseAppClient.post(GET_PATIENT_CLINIC,
onSuccess: (dynamic response, int statusCode) {
response['ListPatientConditionProgress']['resultData'].forEach((v) =>
@ -1383,7 +1401,9 @@ class SOAPService extends LookupService {
action.chiefComplains!.forEach((action2) {
chiefComplaintList.add({
"chiefComplain": action2.chiefComplain,
"chiefComplainTemplateId": action!.chiefComplainTemplateId
"chiefComplainTemplateId": action2.chiefComplainTemplateId ??
action.chiefComplainTemplateId ??
''
});
});
});
@ -1391,7 +1411,11 @@ class SOAPService extends LookupService {
"appointmentId": patient.appointmentNo,
"projectId": patient.projectId,
"setupId": await sharedPref.getString(DOCTOR_SETUP_ID),
"chiefComplain": chiefComplaintList
"chiefComplain": chiefComplaintList,
'EpisodeID': chiefComplaint.first.episodeId,
'pomrId': patient.pomrId,
'doctorId': patient.doctorId,
'patientId': patient.patientId
};
hasError = false;
await baseAppClient.post(CONTINUE_EPISODE_VP,
@ -1414,7 +1438,7 @@ class SOAPService extends LookupService {
"appointmentId": patient.appointmentNo,
"projectId": patient.projectId,
"setupId": await sharedPref.getString(DOCTOR_SETUP_ID),
"chiefComplain": listofComplain
"chiefComplain": listofComplain,
};
hasError = false;
await baseAppClient.post(CONTINUE_EPISODE_VP,

@ -1572,4 +1572,13 @@ class SOAPViewModel extends BaseViewModel {
_SOAPService.searchAllergiesList.clear();
notifyListeners();
}
String? getConditionValue(String key){
print('the value is ${_SOAPService.conditionTypeMapWithIdAsKey[key.trim()]}');
return _SOAPService.conditionTypeMapWithIdAsKey[key.trim()];
}
String? getConditionID(String key){
print('the value is ${_SOAPService.conditionTypeMapWithIdAsKey[key.trim()]}');
return _SOAPService.conditionTypeList[key.trim()];
}
}

@ -69,6 +69,7 @@ class _UpdateAssessmentPageState extends State<UpdateAssessmentPage>
mySelectedAssessmentList.clear();
WidgetsBinding.instance.addPostFrameCallback((_) async {
widget.changeLoadingState(true);
model.getConditionAndType(widget.patientInfo);
model.getPreviousPatientDetails(widget.patientInfo);
model.getCurrentDiagnosisList(widget.patientInfo);
widget.changeLoadingState(false);

@ -93,8 +93,10 @@ class _CurrentDiagnosisState extends State<CurrentDiagnosis> {
status:
widget.currentDiagnosisItems[index].status ??
'',
condition: widget
.currentDiagnosisItems[index].condition ??
condition: model.getConditionValue(widget
.currentDiagnosisItems[index]
.condition ??
'') ??
'',
remarks:
widget.currentDiagnosisItems[index].remarks ??
@ -111,14 +113,16 @@ class _CurrentDiagnosisState extends State<CurrentDiagnosis> {
break;
case SoapDetailItemActions.EDIT:
if (widget.currentDiagnosisItems[index]
.status ==
.status ==
"Deleted") {
DrAppToastMsg.showErrorToast(TranslationBase.of(context).diagnosisAlreadyDeleted);
DrAppToastMsg.showErrorToast(
TranslationBase.of(context)
.diagnosisAlreadyDeleted);
return;
}
if (widget.currentDiagnosisItems[index]
.resolved ==
.resolved ==
true) {
DrAppToastMsg.showErrorToast(
TranslationBase.of(context)
@ -141,9 +145,11 @@ class _CurrentDiagnosisState extends State<CurrentDiagnosis> {
break;
case SoapDetailItemActions.RESOLVE:
if (widget.currentDiagnosisItems[index]
.status ==
.status ==
"Deleted") {
DrAppToastMsg.showErrorToast(TranslationBase.of(context).diagnosisAlreadyDeleted);
DrAppToastMsg.showErrorToast(
TranslationBase.of(context)
.diagnosisAlreadyDeleted);
return;
}
if (widget.currentDiagnosisItems[index]
@ -167,25 +173,27 @@ class _CurrentDiagnosisState extends State<CurrentDiagnosis> {
if (widget.currentDiagnosisItems[index]
.status ==
"Deleted") {
DrAppToastMsg.showErrorToast(TranslationBase.of(context).diagnosisAlreadyDeleted);
DrAppToastMsg.showErrorToast(
TranslationBase.of(context)
.diagnosisAlreadyDeleted);
return;
}
if (widget.currentDiagnosisItems[index]
.resolved ==
.resolved ==
true) {
DrAppToastMsg.showErrorToast(
TranslationBase.of(context)
.diagnosisAlreadyResolved);
return;
}
showConfirmationDialog(context,
"${TranslationBase.of(context).delete} ${TranslationBase.of(context).diagnosis}",
(remarks) {
widget.model.removeDiagnosis(
widget.patientInfo,
widget.currentDiagnosisItems[index],
remarks);
});
showConfirmationDialog(context,
"${TranslationBase.of(context).delete} ${TranslationBase.of(context).diagnosis}",
(remarks) {
widget.model.removeDiagnosis(
widget.patientInfo,
widget.currentDiagnosisItems[index],
remarks);
});
case SoapDetailItemActions.CHANGE_STATUS:
// TODO: Handle this case.

@ -50,7 +50,6 @@ class _EditDiagnosisState extends State<EditDiagnosis> {
super.initState();
filteredSearchController.text = widget.diagnosis.selectedDisease ?? '';
remarksController.text = widget.diagnosis.remarks ?? '';
status = widget.diagnosis.condition ?? '';
selectedDiagnosisItemValue = widget.diagnosis?.diagnosisType ?? '';
}
@ -76,22 +75,24 @@ class _EditDiagnosisState extends State<EditDiagnosis> {
this.model = model;
WidgetsBinding.instance.addPostFrameCallback((_) {
model.getConditionAndType(widget.patientInfo);
status =
model.getConditionValue(widget.diagnosis.condition ?? '') ?? '';
});
}, builder: (_, model, w) {
if (selectedDiagnosisItem == null && model.diagnosisTypeList.isNotEmpty) {
WidgetsBinding.instance.addPostFrameCallback((_) {
if (mounted) {
setState(() {
selectedDiagnosisItem = model.diagnosisTypeList.keys.firstWhere(
WidgetsBinding.instance.addPostFrameCallback((_) {
if (mounted) {
setState(() {
selectedDiagnosisItem = model.diagnosisTypeList.keys.firstWhere(
(k) =>
model.diagnosisTypeList[k] == selectedDiagnosisItemValue,
orElse: () => '');
if (selectedDiagnosisItem?.isEmpty == true)
selectedDiagnosisItem = null;
model.diagnosisTypeList[k] == selectedDiagnosisItemValue,
orElse: () => '');
if (selectedDiagnosisItem?.isEmpty == true)
selectedDiagnosisItem = null;
});
}
});
}
});
}
return AppScaffold(
isLoading: model.state == ViewState.BusyLocal,
isShowAppBar: true,
@ -126,14 +127,10 @@ class _EditDiagnosisState extends State<EditDiagnosis> {
},
);
},
onChanged: (value) {
},
onFieldSubmitted: () {
},
onEditingComplete: (){
if(filteredSearchController.text.isEmpty) return;
onChanged: (value) {},
onFieldSubmitted: () {},
onEditingComplete: () {
if (filteredSearchController.text.isEmpty) return;
_onStopped(filteredSearchController.text);
},
suffixIcon: IconButton(
@ -143,7 +140,7 @@ class _EditDiagnosisState extends State<EditDiagnosis> {
size: 30,
),
onPressed: () {
if(filteredSearchController.text.isEmpty) return;
if (filteredSearchController.text.isEmpty) return;
_onStopped(filteredSearchController.text);
},
),
@ -309,7 +306,8 @@ class _EditDiagnosisState extends State<EditDiagnosis> {
if (newValue != null)
setState(() {
selectedDiagnosisItem = newValue;
selectedDiagnosisItemValue = model.diagnosisTypeList[newValue];
selectedDiagnosisItemValue =
model.diagnosisTypeList[newValue];
});
},
items:
@ -444,7 +442,9 @@ class _EditDiagnosisState extends State<EditDiagnosis> {
if (filteredSearchController.text ==
widget.diagnosis.selectedDisease &&
status.toLowerCase() == widget.diagnosis.condition?.toLowerCase() &&
status.toLowerCase() ==
widget.diagnosis.condition
?.toLowerCase() &&
widget.diagnosis.diagnosisType ==
selectedDiagnosisItemValue &&
widget.diagnosis.remarks ==
@ -456,13 +456,12 @@ class _EditDiagnosisState extends State<EditDiagnosis> {
}
widget.diagnosis.selectedDisease =
filteredSearchController.text;
widget.diagnosis.remarks =
remarksController.text;
widget.diagnosis.condition = status;
widget.diagnosis.remarks = remarksController.text;
widget.diagnosis.condition = model.getConditionID(status);
widget.diagnosis.diagnosisType =
selectedDiagnosisItemValue;
if(selectedDiagnosis != null ) {
if (selectedDiagnosis != null) {
widget.diagnosis.selectedCategoryCode =
selectedDiagnosis?.selectedCategoryCode ??
'';

@ -36,9 +36,9 @@ class ListOfExamination extends StatelessWidget {
);
}
String? getCondition(int condition, BuildContext context) => condition ==0
String? getCondition(int condition, BuildContext context) => condition == 1
? TranslationBase.of(context).normal
: condition == 1
: condition == 2
? TranslationBase.of(context).abnormal
: TranslationBase.of(context).notExamined;
}

@ -73,8 +73,9 @@ class _AddChiefComplaintState extends State<AddChiefComplaint> {
SizedBox(height: 16,),
PreviousChiefComplaints(
model.episodeByChiefComplaintListVidaPlus,
(ChiefComplains , String){
addChiefComplaint(model, ChiefComplains.chiefComplain??'', context);
(chiefComplains , String){
var listOfChiefComplaint = [chiefComplains];
createCCByEpisode(model,listOfChiefComplaint );
},
)
],

@ -8,7 +8,7 @@ import 'package:quiver/time.dart';
class PreviousChiefComplaints extends StatelessWidget {
final List<EpisodeByChiefComplaintVidaPlus> complaints;
final Function(ChiefComplains , String)? onSendClicked;
final Function(PatientPomrs , String)? onSendClicked;
PreviousChiefComplaints(
this.complaints,
@ -104,8 +104,6 @@ class PreviousChiefComplaints extends StatelessWidget {
onSendClicked!(
complaints[index]
.patientPomrs![pomrID]
.chiefComplains![
cheifComplainIndex]
,complaints[index]
.patientPomrs?[pomrID].chiefComplainTemplateId?.toString() ??'');
});

@ -5,7 +5,6 @@
import FlutterMacOS
import Foundation
import cloud_firestore
import connectivity_macos
import firebase_analytics
import firebase_core
@ -15,11 +14,10 @@ import maps_launcher
import path_provider_foundation
import shared_preferences_foundation
import speech_to_text_macos
import sqflite_darwin
import sqflite
import url_launcher_macos
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
FLTFirebaseFirestorePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseFirestorePlugin"))
ConnectivityPlugin.register(with: registry.registrar(forPlugin: "ConnectivityPlugin"))
FLTFirebaseAnalyticsPlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseAnalyticsPlugin"))
FLTFirebaseCorePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseCorePlugin"))

Loading…
Cancel
Save