bug fixes

merge-requests/369/head
Sultan Khan 4 years ago
parent 1ac94d9ec8
commit 10ef8f7954

@ -49,23 +49,21 @@ class PatientViewModel extends BaseViewModel {
_patientService.referalFrequancyList;
Future getPatientList(patient, patientType,
{bool isBusyLocal = false}) async {
var localRes ;
{bool isBusyLocal = false, isView}) async {
var localRes;
if (isBusyLocal) {
setState(ViewState.BusyLocal);
} else {
setState(ViewState.Busy);
}
localRes = await _patientService.getPatientList(patient, patientType);
localRes = await _patientService.getPatientList(patient, patientType,
isView: isView);
if (_patientService.hasError) {
error = _patientService.error;
setState(ViewState.Error);
}
return localRes;
}
Future getPatientVitalSign(patient) async {

@ -93,6 +93,7 @@ class _PatientSearchScreenState extends State<PatientSearchScreen> {
"patientSearchForm": _patientSearchFormValues,
"selectedType": _selectedType,
"isSearch": true,
"isView": isView
});
}
} else {
@ -180,7 +181,7 @@ class _PatientSearchScreenState extends State<PatientSearchScreen> {
padding: EdgeInsets.all(10),
child: AppTextFormField(
labelText:
TranslationBase.of(context).phoneNumber,
TranslationBase.of(context).patientID,
borderColor: Colors.white,
textInputType: TextInputType.number,
textInputAction: TextInputAction.done,
@ -188,15 +189,14 @@ class _PatientSearchScreenState extends State<PatientSearchScreen> {
focusNode: _nodeText1,
onSaved: (value) {
value == null || value == ''
? _patientSearchFormValues
.setPatientMobileNumber = "0"
: _patientSearchFormValues
.setPatientMobileNumber = value;
? _patientSearchFormValues.setPatientID =
0
: _patientSearchFormValues.setPatientID =
int.parse(value);
if (value != null &&
value.toString().trim().isEmpty) {
_patientSearchFormValues
.setPatientMobileNumber = "0";
_patientSearchFormValues.setPatientID = 0;
}
},
),
@ -263,7 +263,8 @@ class _PatientSearchScreenState extends State<PatientSearchScreen> {
elevation: 16,
selectedItemBuilder:
(BuildContext context) {
return PATIENT_TYPE_Des.map((item) {
return PATIENT_TYPE_Des.map(
(item) {
return Row(
mainAxisSize:
MainAxisSize.max,
@ -292,7 +293,8 @@ class _PatientSearchScreenState extends State<PatientSearchScreen> {
int.parse(_selectedType);
})
},
items: PATIENT_TYPE_Des.map((item) {
items:
PATIENT_TYPE_Des.map((item) {
!projectsProvider.isArabic
? itemText = item['text']
: itemText =
@ -347,35 +349,39 @@ class _PatientSearchScreenState extends State<PatientSearchScreen> {
SizedBox(
height: 10,
),
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.all(
Radius.circular(6.0)),
border: Border.all(
width: 1.0,
color: HexColor("#CCCCCC"))),
padding: EdgeInsets.all(10),
child: AppTextFormField(
if (_selectedType != '7')
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.all(
Radius.circular(6.0)),
border: Border.all(
width: 1.0,
color: HexColor("#CCCCCC"))),
padding: EdgeInsets.all(10),
child: AppTextFormField(
labelText: TranslationBase.of(context)
.middleName,
.phoneNumber,
borderColor: Colors.white,
textInputType: TextInputType.number,
textInputAction: TextInputAction.done,
inputFormatter: ONLY_NUMBERS,
focusNode: _nodeText1,
onSaved: (value) {
value == null || value == ''
? _patientSearchFormValues
.setMiddleName = "0"
.setPatientMobileNumber = "0"
: _patientSearchFormValues
.setMiddleName = value;
.setPatientMobileNumber =
value;
if (value != null &&
value.toString().trim().isEmpty) {
_patientSearchFormValues
.setMiddleName = "0";
.setPatientMobileNumber = "0";
}
},
// validator: (value) {
// return TextValidator().validateName(value);
// },
inputFormatter: ONLY_LETTERS),
),
),
),
SizedBox(
height: 10,
),
@ -389,20 +395,23 @@ class _PatientSearchScreenState extends State<PatientSearchScreen> {
padding: EdgeInsets.all(10),
child: AppTextFormField(
labelText: TranslationBase.of(context)
.lastName,
.middleName,
borderColor: Colors.white,
onSaved: (value) {
value == null || value == ''
? _patientSearchFormValues
.setLastName = "0"
.setMiddleName = "0"
: _patientSearchFormValues
.setLastName = value;
.setMiddleName = value;
if (value != null &&
value.toString().trim().isEmpty) {
_patientSearchFormValues
.setLastName = "0";
.setMiddleName = "0";
}
},
// validator: (value) {
// return TextValidator().validateName(value);
// },
inputFormatter: ONLY_LETTERS),
),
SizedBox(
@ -418,25 +427,54 @@ class _PatientSearchScreenState extends State<PatientSearchScreen> {
padding: EdgeInsets.all(10),
child: AppTextFormField(
labelText: TranslationBase.of(context)
.patientID,
.lastName,
borderColor: Colors.white,
textInputType: TextInputType.number,
inputFormatter: ONLY_NUMBERS,
focusNode: _nodeText2,
onSaved: (value) {
value == null || value == ''
? _patientSearchFormValues
.setPatientID = 0
.setLastName = "0"
: _patientSearchFormValues
.setPatientID =
int.parse(value);
.setLastName = value;
if (value != null &&
value.trim().toString().isEmpty) {
value.toString().trim().isEmpty) {
_patientSearchFormValues
.setPatientID = 0;
.setLastName = "0";
}
}),
},
inputFormatter: ONLY_LETTERS),
),
// SizedBox(
// height: 10,
// ),
// Container(
// decoration: BoxDecoration(
// borderRadius: BorderRadius.all(
// Radius.circular(6.0)),
// border: Border.all(
// width: 1.0,
// color: HexColor("#CCCCCC"))),
// padding: EdgeInsets.all(10),
// child: AppTextFormField(
// labelText: TranslationBase.of(context)
// .patientID,
// borderColor: Colors.white,
// textInputType: TextInputType.number,
// inputFormatter: ONLY_NUMBERS,
// focusNode: _nodeText2,
// onSaved: (value) {
// value == null || value == ''
// ? _patientSearchFormValues
// .setPatientID = 0
// : _patientSearchFormValues
// .setPatientID =
// int.parse(value);
// if (value != null &&
// value.trim().toString().isEmpty) {
// _patientSearchFormValues
// .setPatientID = 0;
// }
// }),
// ),
SizedBox(
height: 10,
),

@ -24,6 +24,7 @@ import 'package:doctor_app_flutter/widgets/shared/errors/dr_app_embedded_error.d
import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart';
import 'package:flutter/material.dart';
import 'package:hexcolor/hexcolor.dart';
import 'package:intl/intl.dart';
import 'package:provider/provider.dart';
import '../../config/size_config.dart';
@ -34,11 +35,13 @@ class PatientsScreen extends StatefulWidget {
final selectedType;
final isAppbar;
final arrivalType;
final isView;
PatientsScreen(
{this.patientSearchForm,
this.selectedType,
this.isAppbar = true,
this.arrivalType});
this.arrivalType,
this.isView});
@override
_PatientsScreenState createState() => _PatientsScreenState();
}
@ -261,7 +264,8 @@ class _PatientsScreenState extends State<PatientsScreen> {
val2 == 7
? getPatientArrivalListRequestModel.toJson()
: patient,
patientType)
patientType,
isView: widget.isView)
.then((res) {
setState(() {
if (res != null && res['MessageStatus'] == 1) {
@ -289,6 +293,20 @@ class _PatientsScreenState extends State<PatientsScreen> {
}
parsed = lItems;
responseModelList = new ModelResponse.fromJson(parsed).list;
responseModelList.sort((a, b) {
DateTime now = DateTime.now();
DateFormat dateFormat = DateFormat("yyyy-MM-dd HH:mm");
String formattedDate =
DateFormat('yyyy-MM-dd ' + a.startTime).format(now);
DateTime dateTimeA = dateFormat.parse(formattedDate);
String formattedDateB =
DateFormat('yyyy-MM-dd ' + b.startTime).format(now);
DateTime dateTimeB = dateFormat.parse(formattedDateB);
var adate = dateTimeA; //a.startTime;
var bdate = dateTimeB;
return adate.compareTo(bdate);
});
responseModelList2 = responseModelList;
_isError = false;
} else {
@ -516,7 +534,8 @@ class _PatientsScreenState extends State<PatientsScreen> {
.getFrom,
"to":
patient.getTo,
"isSearch":isSearch
"isSearch":
isSearch
});
},
);
@ -597,8 +616,16 @@ class _PatientsScreenState extends State<PatientsScreen> {
parsed = lItems;
responseModelList = new ModelResponse.fromJson(parsed).list;
responseModelList.sort((a, b) {
var adate = a.arrivedOn;
var bdate = b.arrivedOn; //before -> var bdate = b.expiry;
DateTime now = DateTime.now();
DateFormat dateFormat = DateFormat("yyyy-MM-dd HH:mm");
String formattedDate =
DateFormat('yyyy-MM-dd ' + a.startTime).format(now);
DateTime dateTimeA = dateFormat.parse(formattedDate);
String formattedDateB =
DateFormat('yyyy-MM-dd ' + b.startTime).format(now);
DateTime dateTimeB = dateFormat.parse(formattedDateB);
var adate = dateTimeA; //a.startTime;
var bdate = dateTimeB;
return adate.compareTo(bdate);
});
responseModelList2 = responseModelList;

@ -286,7 +286,14 @@ class PatientCard extends StatelessWidget {
bottomRight: Radius.circular(8),
topLeft: Radius.circular(8),
),
color: Colors.red,
color: patientInfo.appointmentType ==
'Regular' &&
patientInfo.visitTypeId == 100
? HexColor('#D02127')
: patientInfo.appointmentType ==
'Walkin'
? HexColor('#28323A')
: HexColor('#6C7379'),
),
child: Image.asset(
patientInfo.appointmentType ==

Loading…
Cancel
Save