WD: nursing stations added.

update_3.16.0_CR5439_Pharmacy_Intervention
taha.alam 9 months ago
parent 5a554a9ea6
commit b25398b97b

@ -373,6 +373,7 @@ const IS_INFECTIOUS_DISEASE_CONSULTANT = 'Services/DoctorApplication.svc/REST/Is
const IS_INFECTIOUS_DISEASE_PENDING = 'Services/DoctorApplication.svc/REST/IsInterventionAccessLevel3Pending';
const INFECTIOUS_HISTORY = 'Services/DoctorApplication.svc/REST/InterventionHistory';
const UPDATE_INFECTIOUS_STATUS = 'Services/DoctorApplication.svc/REST/UpdateInterventionStatus';
const GET_NURSING_STATIONS = 'Services/DoctorApplication.svc/REST/GetWards';
var selectedPatientType = 1;

@ -0,0 +1,73 @@
class NursingStation {
final List<NursingStationEntity>? entityList;
final int? rowcount;
final String? statusMessage;
final bool? success;
NursingStation({
this.entityList,
this.rowcount,
this.statusMessage,
this.success,
});
factory NursingStation.fromJson(Map<String, dynamic> json) {
return NursingStation(
entityList: (json['entityList'] as List<dynamic>?)
?.map((e) => NursingStationEntity.fromJson(e as Map<String, dynamic>))
.toList(),
rowcount: json['rowcount'] as int?,
statusMessage: json['statusMessage'] as String?,
success: json['success'] as bool?,
);
}
Map<String, dynamic> toJson() {
return {
'entityList': entityList?.map((e) => e.toJson()).toList(),
'rowcount': rowcount,
'statusMessage': statusMessage,
'success': success,
};
}
}
class NursingStationEntity {
final int? categoryID;
final String? description;
final String? descriptionN;
final int? floorID;
final bool? isActive;
final int? nursingStationID;
NursingStationEntity({
this.categoryID,
this.description,
this.descriptionN,
this.floorID,
this.isActive,
this.nursingStationID,
});
factory NursingStationEntity.fromJson(Map<String, dynamic> json) {
return NursingStationEntity(
categoryID: json['categoryID'] as int?,
description: json['description'] ??'${json['nursingStationID']}',
descriptionN: json['descriptionN'] as String?,
floorID: json['floorID'] as int?,
isActive: json['isActive'] as bool?,
nursingStationID: json['nursingStationID'] as int?,
);
}
Map<String, dynamic> toJson() {
return {
'categoryID': categoryID,
'description': description,
'descriptionN': descriptionN,
'floorID': floorID,
'isActive': isActive,
'nursingStationID': nursingStationID,
};
}
}

@ -23,7 +23,10 @@ class _PharmacyInterventionState extends State<PharmacyIntervention> {
Widget build(BuildContext context) {
return BaseView<PharmacyInterventionViewModel>(onModelReady: (model) {
WidgetsBinding.instance.addPostFrameCallback((_) {
model.getPharmacyIntervention();
Future.wait([
model.getNursingStations(),
model.getPharmacyIntervention(),
]);
});
}, builder: (_, model, __) {
if (model.interventionHistoryList != null) {
@ -147,8 +150,9 @@ class _PharmacyInterventionState extends State<PharmacyIntervention> {
dateFrom: model.fromDate,
dateTo: model.toDate,
admissionNumber: model.admissionId,
nursingStation: model.nursingStationId,
nursingStation: model.entity,
patientID: model.patientID,
station: model.nursingStations,
onDispose: (dateFrom, dateTo, admissionNumber, patientId,
nursingStation) {
if (dateFrom == model.fromDate &&
@ -172,9 +176,11 @@ class _PharmacyInterventionState extends State<PharmacyIntervention> {
model.getPharmacyIntervention(
admissionId: admissionNumber,
patientID: patientId,
nursingStationId: nursingStation,
nursingStationId:
"${nursingStation?.nursingStationID ?? '0'}",
toDate: dateTo,
fromDate: dateFrom);
fromDate: dateFrom,
entity: nursingStation);
Navigator.of(context).pop();
});
});

@ -4,6 +4,7 @@ import 'dart:ffi';
import 'package:doctor_app_flutter/config/config.dart';
import 'package:doctor_app_flutter/config/shared_pref_kay.dart';
import 'package:doctor_app_flutter/core/model/pharmacy-intervention-model/intervention_history.dart';
import 'package:doctor_app_flutter/core/model/pharmacy-intervention-model/nursing_station.dart';
import 'package:doctor_app_flutter/core/model/pharmacy-intervention-model/pharmacy_intervention_item.dart';
import 'package:doctor_app_flutter/core/service/base/base_service.dart';
import 'package:doctor_app_flutter/utils/dr_app_toast_msg.dart';
@ -17,8 +18,8 @@ class PharmacyInterventionService extends BaseService {
String fromDate = '',
String toDate = ''}) async {
Map<String,dynamic> request = {
"NursingStationID": num.parse((nursingStationId.isEmpty)?'0':nursingStationId),
"AdmissionNo": num.parse((admissionId.isEmpty)?'0':admissionId),
"NursingStationID": nursingStationId.isEmpty?'0':nursingStationId,
"AdmissionNo": admissionId.isEmpty ?'0': admissionId,
"PatientID": num.parse((patientID.isEmpty)?'0':patientID),
};
@ -146,4 +147,20 @@ class PharmacyInterventionService extends BaseService {
}, body: request);
return result;
}
Future<NursingStation?> getNursingStation() async{
hasError = false;
NursingStation? station;
await baseAppClient.post(GET_NURSING_STATIONS,
onSuccess: (dynamic response, int statusCode) {
station = NursingStation.fromJson(response['AdmissionMasterList']);
}, onFailure: (String error, int statusCode) {
hasError = true;
DrAppToastMsg.showErrorToast(error);
super.error = super.error! + "\n" + error;
}, body: {});
return station;
}
}

@ -1,6 +1,7 @@
import 'package:doctor_app_flutter/config/shared_pref_kay.dart';
import 'package:doctor_app_flutter/core/enum/view_state.dart';
import 'package:doctor_app_flutter/core/model/pharmacy-intervention-model/intervention_history.dart';
import 'package:doctor_app_flutter/core/model/pharmacy-intervention-model/nursing_station.dart';
import 'package:doctor_app_flutter/core/model/pharmacy-intervention-model/pharmacy_intervention_item.dart';
import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart';
import 'package:doctor_app_flutter/locator.dart';
@ -92,6 +93,8 @@ class PharmacyInterventionViewModel extends BaseViewModel {
InterventionHistoryList? interventionHistoryList;
NursingStation? nursingStations;
// InterventionHistoryList? interventionHistoryList = InterventionHistoryList.fromJson({
// "entityList": [
// {
@ -499,6 +502,7 @@ class PharmacyInterventionViewModel extends BaseViewModel {
String patientID = '';
String fromDate = '';
String toDate = '';
NursingStationEntity? entity;
String getDate(String dateTime) {
if (dateTime.isEmpty) return '';
@ -506,13 +510,20 @@ class PharmacyInterventionViewModel extends BaseViewModel {
return DateFormat('dd MMM yyyy').format(now);
}
Future getNursingStations() async {
nursingStations = await _service.getNursingStation();
}
Future getPharmacyIntervention(
{String nursingStationId = '0',
String admissionId = '0',
String patientID = '0',
String fromDate = '',
String toDate = ''}) async {
String toDate = '',
NursingStationEntity? entity,
}) async {
setState(ViewState.BusyLocal);
MedicationList? result = await _service.getMedicationList(
nursingStationId: nursingStationId,
admissionId: admissionId,
@ -525,6 +536,7 @@ class PharmacyInterventionViewModel extends BaseViewModel {
this.patientID = patientID;
this.fromDate = fromDate;
this.toDate = toDate;
this.entity = entity;
if (_service.hasError || result == null) {
error = _service.error;

@ -1,3 +1,4 @@
import 'package:doctor_app_flutter/config/config.dart';
import 'package:doctor_app_flutter/core/model/pharmacy-intervention-model/pharmacy_intervention_item.dart';
import 'package:doctor_app_flutter/screens/pharmacy_intervention/viewmodel/pharmacy_intervention_view_model.dart';
import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart';
@ -21,8 +22,8 @@ class InterventionCardFooter extends StatelessWidget {
.of(context)
.details,
hasBorder: true,
borderColor: Colors.grey,
color: Colors.grey,
borderColor: AppGlobal.appGreenColor,
color: AppGlobal.appGreenColor,
fontColor: Colors.white,
onPressed: () async {
model.getInterventionHistory(

@ -1,23 +1,28 @@
import 'package:doctor_app_flutter/config/config.dart';
import 'package:doctor_app_flutter/core/model/pharmacy-intervention-model/nursing_station.dart';
import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart';
import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart';
import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
import '../../../widgets/shared/app_texts_widget.dart';
import '../../patients/profile/soap_update_vida_plus/assessment/widget/empty_dropdown.dart';
class PharmacyInterventionDialog extends StatefulWidget {
final Function(
String, // dataFrom
String, // dateTo
String, // admissionNumber
String, // patient ID
String, // nursingStation
NursingStationEntity?, // nursingStation
) onDispose;
final String dateFrom;
final String dateTo;
final String admissionNumber;
final String patientID;
final String nursingStation;
final NursingStationEntity? nursingStation;
final NursingStation? station;
const PharmacyInterventionDialog({super.key,
required this.onDispose,
@ -25,7 +30,9 @@ class PharmacyInterventionDialog extends StatefulWidget {
required this.dateTo,
required this.admissionNumber,
required this.patientID,
required this.nursingStation});
required this.nursingStation,
required this.station,
});
@override
State<PharmacyInterventionDialog> createState() =>
@ -35,7 +42,7 @@ class PharmacyInterventionDialog extends StatefulWidget {
class _PharmacyInterventionDialogState
extends State<PharmacyInterventionDialog> {
final TextEditingController admissionNumber = TextEditingController();
final TextEditingController nursingStation = TextEditingController();
NursingStationEntity? nursingStation = null;
final TextEditingController patientId = TextEditingController();
@ -51,7 +58,7 @@ class _PharmacyInterventionDialogState
void initData() {
admissionNumber.text = (widget.admissionNumber == '0')?'':widget.admissionNumber;
nursingStation.text = (widget.nursingStation == '0')?'':widget.nursingStation;
nursingStation = widget.nursingStation;
patientId.text = (widget.patientID == '0' )?'':widget.patientID;
dateTo = getDateString(widget.dateTo);
dateFrom = getDateString(widget.dateFrom);
@ -66,93 +73,92 @@ class _PharmacyInterventionDialogState
),
child: Padding(
padding: const EdgeInsets.all(24),
child: Column(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.end,
crossAxisAlignment: CrossAxisAlignment.end,
children: [
IconButton(
icon: Icon(Icons.close),
onPressed: () {
Navigator.pop(context);
},
),
SizedBox(height: 8,),
_titleAndTextField(TranslationBase
.of(context)
.nursingStation,
nursingStation, TextInputType.number),
SizedBox(
height: 4,
),
_titleAndTextField(TranslationBase
.of(context)
.admissionNumber,
admissionNumber, TextInputType.number),
SizedBox(
height: 4,
),
_titleAndTextField(TranslationBase
.of(context)
.patientID, patientId,
TextInputType.number),
SizedBox(
height: 4,
),
_dateSelection(TranslationBase
.of(context)
.dateFrom, (date) {
DateTime? fromDate = getDate(date);
DateTime? toDate =getDate(dateTo);
if(toDate == null){
child: SingleChildScrollView(
child: Column(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.end,
crossAxisAlignment: CrossAxisAlignment.end,
children: [
IconButton(
icon: Icon(Icons.close),
onPressed: () {
Navigator.pop(context);
},
),
SizedBox(height: 8,),
nursingStationView,
SizedBox(
height: 4,
),
_titleAndTextField(TranslationBase
.of(context)
.admissionNumber,
admissionNumber, TextInputType.text),
SizedBox(
height: 4,
),
_titleAndTextField(TranslationBase
.of(context)
.patientID, patientId,
TextInputType.number),
SizedBox(
height: 4,
),
_dateSelection(TranslationBase
.of(context)
.dateFrom, (date) {
DateTime? fromDate = getDate(date);
DateTime? toDate = getDate(dateTo);
if (toDate == null) {
setState(() {
dateFrom = date;
});
return;
}
if (fromDate!.compareTo(toDate!) == 1) {
setState(() {
dateFrom = date;
dateTo = '';
});
return;
}
setState(() {
dateFrom = date;
});
return;
}
if(fromDate!.compareTo(toDate!) == 1){
}, dateFrom, false),
SizedBox(
height: 4,
),
_dateSelection(TranslationBase
.of(context)
.dateTo, (date) {
setState(() {
dateFrom = date;
dateTo = '';
dateTo = date;
});
return;
}
setState(() {
dateFrom = date;
});
}, dateFrom, false),
SizedBox(
height: 4,
),
_dateSelection(TranslationBase
.of(context)
.dateTo, (date) {
setState(() {
dateTo = date;
});
}, dateTo, true, selectedFromDate: dateFrom),
SizedBox(
height: 8,
),
Row(children: [
Expanded(
child: AppButton(
title: TranslationBase
.of(context)
.search,
hasBorder: true,
borderColor: Color(0xFFB8382B),
color: AppGlobal.appRedColor,
fontColor: Colors.white,
onPressed: () async {
//(dateFrom, dateTo, admissionNumber, patientId, nursingStation)
widget.onDispose(dateFrom, dateTo, nursingStation.text,
patientId.text, nursingStation.text);
},
),
}, dateTo, true, selectedFromDate: dateFrom),
SizedBox(
height: 8,
),
]),
],
Row(children: [
Expanded(
child: AppButton(
title: TranslationBase
.of(context)
.search,
hasBorder: true,
borderColor: Color(0xFFB8382B),
color: AppGlobal.appRedColor,
fontColor: Colors.white,
onPressed: () async {
//(dateFrom, dateTo, admissionNumber, patientId, nursingStation)
widget.onDispose(dateFrom, dateTo, admissionNumber.text,
patientId.text, nursingStation);
},
),
),
]),
],
),
),
),
);
@ -184,8 +190,11 @@ class _PharmacyInterventionDialogState
DateTime? fromDate = getDate(selectedFromDate??'');
final DateTime? picked = await showDatePicker(
context: context,
initialDate:date.isNotEmpty? getDate(date) :fromDate != null? fromDate: DateTime.now(),
firstDate:(( date.isNotEmpty && dateTime != null ) ) ? dateTime: (toDateSelection && fromDate != null)?fromDate :DateTime(DateTime
initialDate: date.isNotEmpty ? getDate(date) : fromDate != null
? fromDate
: DateTime.now(),
firstDate: (toDateSelection && fromDate != null) ? fromDate : ((date
.isNotEmpty && dateTime != null)) ? dateTime : DateTime(DateTime
.now()
.year - 150),
lastDate: DateTime(DateTime
@ -257,4 +266,50 @@ class _PharmacyInterventionDialogState
int.parse(splitedDate[1]), int.parse(splitedDate[2]));
return now;
}
Widget get nursingStationView =>
Row(
children: [
Text(TranslationBase
.of(context)
.nursingStation,),
SizedBox(width: 10,),
widget.station?.entityList?.isEmpty == true ? Expanded(
child: EmptyDropDown())
: Expanded(
child: DropdownButtonHideUnderline(
child: DropdownButton(
dropdownColor: Colors.white,
iconEnabledColor: Colors.black,
icon: Icon(Icons.keyboard_arrow_down),
isExpanded: true,
value: nursingStation == null
? widget.station?.entityList?.first
: nursingStation,
iconSize: 25,
elevation: 16,
onChanged: (newValue) async {
if (newValue != null)
setState(() {
nursingStation = newValue ;
});
},
items:
widget.station?.entityList?.map((item) {
return DropdownMenuItem(
child: AppText(
item.description ?? '',
fontSize: 14,
letterSpacing: -0.96,
color: AppGlobal.appTextColor,
fontWeight: FontWeight.normal,
textAlign: TextAlign.left,
),
value: item,
);
}).toList(),
),
),
)
]);
}
Loading…
Cancel
Save