fix the filter page

merge-requests/623/head
Mohammad Aljammal 5 years ago
parent 2c81941428
commit 27a3dd1eb4

@ -71,7 +71,7 @@ class BaseAppClient {
(body['ProjectID'] == 2 || body['ProjectID'] == 3)) { (body['ProjectID'] == 2 || body['ProjectID'] == 3)) {
body['PatientOutSA'] = true; body['PatientOutSA'] = true;
} }
body['DeviceTypeID'] = Platform.isAndroid ? 1 : 2;
print("URL : $url"); print("URL : $url");
print("Body : ${json.encode(body)}"); print("Body : ${json.encode(body)}");
var asd = json.encode(body); var asd = json.encode(body);

@ -49,7 +49,8 @@ class PatientSearchViewModel extends BaseViewModel{
} else { } else {
setState(ViewState.Busy); setState(ViewState.Busy);
} }
await getDoctorProfile(isGetProfile: true);
patientSearchRequestModel.doctorID = doctorProfile.doctorID;
await _outPatientService.getOutPatient( await _outPatientService.getOutPatient(
patientSearchRequestModel); patientSearchRequestModel);
if (_outPatientService.hasError) { if (_outPatientService.hasError) {

@ -22,7 +22,17 @@ class BaseViewModel extends ChangeNotifier {
notifyListeners(); notifyListeners();
} }
Future<DoctorProfileModel> getDoctorProfile() async { Future<DoctorProfileModel> getDoctorProfile({bool isGetProfile = false}) async {
if(isGetProfile)
{
Map profile = await sharedPref.getObj(DOCTOR_PROFILE);
if (profile != null) {
doctorProfile = DoctorProfileModel.fromJson(profile);
if (doctorProfile != null) {
return doctorProfile;
}
}
}
if (doctorProfile == null) { if (doctorProfile == null) {
Map profile = await sharedPref.getObj(DOCTOR_PROFILE); Map profile = await sharedPref.getObj(DOCTOR_PROFILE);
if (profile != null) { if (profile != null) {

@ -240,6 +240,11 @@ class _FilterDatePageState extends State<FilterDatePage> {
if (isFromDate) { if (isFromDate) {
setState(() { setState(() {
this.widget.patientSearchViewModel.selectedFromDate = picked; this.widget.patientSearchViewModel.selectedFromDate = picked;
var date = picked.add(Duration(days: 30));
if(date.isBefore(lastDate)){
this.widget.patientSearchViewModel.selectedToDate = date;
}else
this.widget.patientSearchViewModel.selectedToDate = lastDate;
}); });
} else { } else {
setState(() { setState(() {

@ -132,7 +132,10 @@ class _OutPatientsScreenState extends State<OutPatientsScreen> {
setState(() { setState(() {
_activeLocation = _times.indexOf(item); _activeLocation = _times.indexOf(item);
outPatientFilterType= _activeLocation==0?OutPatientFilterType.Previous:_activeLocation==0?OutPatientFilterType.Today:OutPatientFilterType.NextWeek; outPatientFilterType= _activeLocation==0?OutPatientFilterType.Previous:_activeLocation==0?OutPatientFilterType.Today:OutPatientFilterType.NextWeek;
_controller.text="";
}); });
model.searchData("");
FocusScope.of(context).requestFocus(new FocusNode());
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context);
await model.getPatientBasedOnDate(item: item, await model.getPatientBasedOnDate(item: item,
selectedPatientType: widget.selectedPatientType, selectedPatientType: widget.selectedPatientType,
@ -222,6 +225,7 @@ class _OutPatientsScreenState extends State<OutPatientsScreen> {
SizedBox( SizedBox(
height: 10.0, height: 10.0,
), ),
Expanded( Expanded(
child: Container( child: Container(
child: model.filterData.isEmpty child: model.filterData.isEmpty
@ -236,7 +240,9 @@ class _OutPatientsScreenState extends State<OutPatientsScreen> {
shrinkWrap: true, shrinkWrap: true,
itemCount: model.filterData.length, itemCount: model.filterData.length,
itemBuilder: (BuildContext ctxt, int index) { itemBuilder: (BuildContext ctxt, int index) {
return Padding( if(_activeLocation !=0 || (model.filterData[index].patientStatusType !=null && model.filterData[index].patientStatusType==43))
return
Padding(
padding: EdgeInsets.all(8.0), padding: EdgeInsets.all(8.0),
child: PatientCard( child: PatientCard(
patientInfo: model.filterData[index], patientInfo: model.filterData[index],
@ -264,6 +270,8 @@ class _OutPatientsScreenState extends State<OutPatientsScreen> {
// isFromSearch: widget.isSearch, // isFromSearch: widget.isSearch,
), ),
); );
else
return SizedBox();
})), })),
), ),
], ],

@ -94,6 +94,7 @@ class _PatientProfileScreenState extends State<PatientProfileScreen>
Column( Column(
children: [ children: [
PatientProfileHeaderNewDesignAppBar( PatientProfileHeaderNewDesignAppBar(
patient, patient,
arrivalType ?? '0', arrivalType ?? '0',
patientType, patientType,
@ -104,6 +105,7 @@ class _PatientProfileScreenState extends State<PatientProfileScreen>
: isDischargedPatient : isDischargedPatient
? 240 ? 240
: 0, : 0,
isDischargedPatient:isDischargedPatient
), ),
Container( Container(
height: !isSearchAndOut height: !isSearchAndOut

@ -18,9 +18,10 @@ class PatientProfileHeaderNewDesignAppBar extends StatelessWidget
final String arrivalType; final String arrivalType;
final double height; final double height;
final bool isInpatient; final bool isInpatient;
final bool isDischargedPatient;
PatientProfileHeaderNewDesignAppBar( PatientProfileHeaderNewDesignAppBar(
this.patient, this.patientType, this.arrivalType, {this.height = 0.0, this.isInpatient=false}); this.patient, this.patientType, this.arrivalType, {this.height = 0.0, this.isInpatient=false, this.isDischargedPatient=false});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -302,6 +303,12 @@ class PatientProfileHeaderNewDesignAppBar extends StatelessWidget
"${TranslationBase.of(context).numOfDays}: ", "${TranslationBase.of(context).numOfDays}: ",
fontSize: 15, fontSize: 15,
), ),
if(isDischargedPatient)
AppText(
"${DateUtils.getDateTimeFromServerFormat(patient.dischargeDate).difference(DateUtils.getDateTimeFromServerFormat(patient.admissionDate)).inDays + 1}",
fontSize: 15,
fontWeight: FontWeight.w700)
else
AppText( AppText(
"${DateTime.now().difference(DateUtils.getDateTimeFromServerFormat(patient.admissionDate)).inDays + 1}", "${DateTime.now().difference(DateUtils.getDateTimeFromServerFormat(patient.admissionDate)).inDays + 1}",
fontSize: 15, fontSize: 15,

@ -62,7 +62,6 @@ class _MasterKeyCheckboxSearchAllergiesWidgetState
Widget build(BuildContext context) { Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context); ProjectViewModel projectViewModel = Provider.of(context);
return Container( return Container(
child: Expanded(
child: Column( child: Column(
children: [ children: [
Expanded( Expanded(
@ -182,7 +181,6 @@ class _MasterKeyCheckboxSearchAllergiesWidgetState
widget.removeAllergy( widget.removeAllergy(
items[index]); items[index]);
} else { } else {
// TODO add Allergy
MySelectedAllergy mySelectedAllergy = MySelectedAllergy mySelectedAllergy =
new MySelectedAllergy( new MySelectedAllergy(
@ -394,7 +392,6 @@ class _MasterKeyCheckboxSearchAllergiesWidgetState
), ),
], ],
), ),
),
); );
} }

Loading…
Cancel
Save