bug fixes

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

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

@ -93,6 +93,7 @@ class _PatientSearchScreenState extends State<PatientSearchScreen> {
"patientSearchForm": _patientSearchFormValues, "patientSearchForm": _patientSearchFormValues,
"selectedType": _selectedType, "selectedType": _selectedType,
"isSearch": true, "isSearch": true,
"isView": isView
}); });
} }
} else { } else {
@ -180,7 +181,7 @@ class _PatientSearchScreenState extends State<PatientSearchScreen> {
padding: EdgeInsets.all(10), padding: EdgeInsets.all(10),
child: AppTextFormField( child: AppTextFormField(
labelText: labelText:
TranslationBase.of(context).phoneNumber, TranslationBase.of(context).patientID,
borderColor: Colors.white, borderColor: Colors.white,
textInputType: TextInputType.number, textInputType: TextInputType.number,
textInputAction: TextInputAction.done, textInputAction: TextInputAction.done,
@ -188,15 +189,14 @@ class _PatientSearchScreenState extends State<PatientSearchScreen> {
focusNode: _nodeText1, focusNode: _nodeText1,
onSaved: (value) { onSaved: (value) {
value == null || value == '' value == null || value == ''
? _patientSearchFormValues ? _patientSearchFormValues.setPatientID =
.setPatientMobileNumber = "0" 0
: _patientSearchFormValues : _patientSearchFormValues.setPatientID =
.setPatientMobileNumber = value; int.parse(value);
if (value != null && if (value != null &&
value.toString().trim().isEmpty) { value.toString().trim().isEmpty) {
_patientSearchFormValues _patientSearchFormValues.setPatientID = 0;
.setPatientMobileNumber = "0";
} }
}, },
), ),
@ -263,7 +263,8 @@ class _PatientSearchScreenState extends State<PatientSearchScreen> {
elevation: 16, elevation: 16,
selectedItemBuilder: selectedItemBuilder:
(BuildContext context) { (BuildContext context) {
return PATIENT_TYPE_Des.map((item) { return PATIENT_TYPE_Des.map(
(item) {
return Row( return Row(
mainAxisSize: mainAxisSize:
MainAxisSize.max, MainAxisSize.max,
@ -292,7 +293,8 @@ class _PatientSearchScreenState extends State<PatientSearchScreen> {
int.parse(_selectedType); int.parse(_selectedType);
}) })
}, },
items: PATIENT_TYPE_Des.map((item) { items:
PATIENT_TYPE_Des.map((item) {
!projectsProvider.isArabic !projectsProvider.isArabic
? itemText = item['text'] ? itemText = item['text']
: itemText = : itemText =
@ -347,35 +349,39 @@ class _PatientSearchScreenState extends State<PatientSearchScreen> {
SizedBox( SizedBox(
height: 10, height: 10,
), ),
Container( if (_selectedType != '7')
decoration: BoxDecoration( Container(
borderRadius: BorderRadius.all( decoration: BoxDecoration(
Radius.circular(6.0)), borderRadius: BorderRadius.all(
border: Border.all( Radius.circular(6.0)),
width: 1.0, border: Border.all(
color: HexColor("#CCCCCC"))), width: 1.0,
padding: EdgeInsets.all(10), color: HexColor("#CCCCCC"))),
child: AppTextFormField( padding: EdgeInsets.all(10),
child: AppTextFormField(
labelText: TranslationBase.of(context) labelText: TranslationBase.of(context)
.middleName, .phoneNumber,
borderColor: Colors.white, borderColor: Colors.white,
textInputType: TextInputType.number,
textInputAction: TextInputAction.done,
inputFormatter: ONLY_NUMBERS,
focusNode: _nodeText1,
onSaved: (value) { onSaved: (value) {
value == null || value == '' value == null || value == ''
? _patientSearchFormValues ? _patientSearchFormValues
.setMiddleName = "0" .setPatientMobileNumber = "0"
: _patientSearchFormValues : _patientSearchFormValues
.setMiddleName = value; .setPatientMobileNumber =
value;
if (value != null && if (value != null &&
value.toString().trim().isEmpty) { value.toString().trim().isEmpty) {
_patientSearchFormValues _patientSearchFormValues
.setMiddleName = "0"; .setPatientMobileNumber = "0";
} }
}, },
// validator: (value) { ),
// return TextValidator().validateName(value); ),
// },
inputFormatter: ONLY_LETTERS),
),
SizedBox( SizedBox(
height: 10, height: 10,
), ),
@ -389,20 +395,23 @@ class _PatientSearchScreenState extends State<PatientSearchScreen> {
padding: EdgeInsets.all(10), padding: EdgeInsets.all(10),
child: AppTextFormField( child: AppTextFormField(
labelText: TranslationBase.of(context) labelText: TranslationBase.of(context)
.lastName, .middleName,
borderColor: Colors.white, borderColor: Colors.white,
onSaved: (value) { onSaved: (value) {
value == null || value == '' value == null || value == ''
? _patientSearchFormValues ? _patientSearchFormValues
.setLastName = "0" .setMiddleName = "0"
: _patientSearchFormValues : _patientSearchFormValues
.setLastName = value; .setMiddleName = value;
if (value != null && if (value != null &&
value.toString().trim().isEmpty) { value.toString().trim().isEmpty) {
_patientSearchFormValues _patientSearchFormValues
.setLastName = "0"; .setMiddleName = "0";
} }
}, },
// validator: (value) {
// return TextValidator().validateName(value);
// },
inputFormatter: ONLY_LETTERS), inputFormatter: ONLY_LETTERS),
), ),
SizedBox( SizedBox(
@ -418,25 +427,54 @@ class _PatientSearchScreenState extends State<PatientSearchScreen> {
padding: EdgeInsets.all(10), padding: EdgeInsets.all(10),
child: AppTextFormField( child: AppTextFormField(
labelText: TranslationBase.of(context) labelText: TranslationBase.of(context)
.patientID, .lastName,
borderColor: Colors.white, borderColor: Colors.white,
textInputType: TextInputType.number,
inputFormatter: ONLY_NUMBERS,
focusNode: _nodeText2,
onSaved: (value) { onSaved: (value) {
value == null || value == '' value == null || value == ''
? _patientSearchFormValues ? _patientSearchFormValues
.setPatientID = 0 .setLastName = "0"
: _patientSearchFormValues : _patientSearchFormValues
.setPatientID = .setLastName = value;
int.parse(value);
if (value != null && if (value != null &&
value.trim().toString().isEmpty) { value.toString().trim().isEmpty) {
_patientSearchFormValues _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( SizedBox(
height: 10, 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:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:hexcolor/hexcolor.dart'; import 'package:hexcolor/hexcolor.dart';
import 'package:intl/intl.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import '../../config/size_config.dart'; import '../../config/size_config.dart';
@ -34,11 +35,13 @@ class PatientsScreen extends StatefulWidget {
final selectedType; final selectedType;
final isAppbar; final isAppbar;
final arrivalType; final arrivalType;
final isView;
PatientsScreen( PatientsScreen(
{this.patientSearchForm, {this.patientSearchForm,
this.selectedType, this.selectedType,
this.isAppbar = true, this.isAppbar = true,
this.arrivalType}); this.arrivalType,
this.isView});
@override @override
_PatientsScreenState createState() => _PatientsScreenState(); _PatientsScreenState createState() => _PatientsScreenState();
} }
@ -261,7 +264,8 @@ class _PatientsScreenState extends State<PatientsScreen> {
val2 == 7 val2 == 7
? getPatientArrivalListRequestModel.toJson() ? getPatientArrivalListRequestModel.toJson()
: patient, : patient,
patientType) patientType,
isView: widget.isView)
.then((res) { .then((res) {
setState(() { setState(() {
if (res != null && res['MessageStatus'] == 1) { if (res != null && res['MessageStatus'] == 1) {
@ -289,6 +293,20 @@ class _PatientsScreenState extends State<PatientsScreen> {
} }
parsed = lItems; parsed = lItems;
responseModelList = new ModelResponse.fromJson(parsed).list; 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; responseModelList2 = responseModelList;
_isError = false; _isError = false;
} else { } else {
@ -516,7 +534,8 @@ class _PatientsScreenState extends State<PatientsScreen> {
.getFrom, .getFrom,
"to": "to":
patient.getTo, patient.getTo,
"isSearch":isSearch "isSearch":
isSearch
}); });
}, },
); );
@ -597,8 +616,16 @@ class _PatientsScreenState extends State<PatientsScreen> {
parsed = lItems; parsed = lItems;
responseModelList = new ModelResponse.fromJson(parsed).list; responseModelList = new ModelResponse.fromJson(parsed).list;
responseModelList.sort((a, b) { responseModelList.sort((a, b) {
var adate = a.arrivedOn; DateTime now = DateTime.now();
var bdate = b.arrivedOn; //before -> var bdate = b.expiry; 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); return adate.compareTo(bdate);
}); });
responseModelList2 = responseModelList; responseModelList2 = responseModelList;

@ -286,7 +286,14 @@ class PatientCard extends StatelessWidget {
bottomRight: Radius.circular(8), bottomRight: Radius.circular(8),
topLeft: 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( child: Image.asset(
patientInfo.appointmentType == patientInfo.appointmentType ==

Loading…
Cancel
Save