liveCare cahnges

merge-requests/703/head
mosazaid 5 years ago
parent 6119deb7a9
commit b16dc2092b

@ -17,19 +17,23 @@ class LiveCarePatientViewModel extends BaseViewModel {
LiveCarePatientServices _liveCarePatientServices =
locator<LiveCarePatientServices>();
StartCallRes get startCallRes => _liveCarePatientServices.startCallRes;
DashboardService _dashboardService =
locator<DashboardService>();
DashboardService _dashboardService = locator<DashboardService>();
getPendingPatientERForDoctorApp({bool isFromTimer = false}) async {
if (isFromTimer) {
setState(ViewState.Idle);
} else {
setState(ViewState.BusyLocal);
}
getPendingPatientERForDoctorApp() async {
setState(ViewState.BusyLocal);
PendingPatientERForDoctorAppRequestModel
pendingPatientERForDoctorAppRequestModel =
PendingPatientERForDoctorAppRequestModel(sErServiceID:_dashboardService.sServiceID, outSA: false);
await _liveCarePatientServices
.getPendingPatientERForDoctorApp(pendingPatientERForDoctorAppRequestModel);
PendingPatientERForDoctorAppRequestModel(
sErServiceID: _dashboardService.sServiceID, outSA: false);
await _liveCarePatientServices.getPendingPatientERForDoctorApp(
pendingPatientERForDoctorAppRequestModel);
if (_liveCarePatientServices.hasError) {
error = _liveCarePatientServices.error;
@ -49,8 +53,7 @@ class LiveCarePatientViewModel extends BaseViewModel {
endCallReq.isDestroy = isPatient;
setState(ViewState.BusyLocal);
await _liveCarePatientServices
.endCall(endCallReq);
await _liveCarePatientServices.endCall(endCallReq);
if (_liveCarePatientServices.hasError) {
error = _liveCarePatientServices.error;
setState(ViewState.ErrorLocal);
@ -59,7 +62,7 @@ class LiveCarePatientViewModel extends BaseViewModel {
}
}
getToken()async{
getToken() async {
String token = await sharedPref.getString(TOKEN);
return token;
}
@ -86,12 +89,11 @@ class LiveCarePatientViewModel extends BaseViewModel {
} else {
setState(ViewState.Idle);
}
}
Future endCallWithCharge(int vcID) async {
setState(ViewState.BusyLocal);
await _liveCarePatientServices
.endCallWithCharge(vcID);
await _liveCarePatientServices.endCallWithCharge(vcID);
if (_liveCarePatientServices.hasError) {
error = _liveCarePatientServices.error;
setState(ViewState.ErrorLocal);
@ -103,8 +105,7 @@ class LiveCarePatientViewModel extends BaseViewModel {
Future transferToAdmin(int vcID, String notes) async {
setState(ViewState.BusyLocal);
await _liveCarePatientServices
.transferToAdmin(vcID, notes);
await _liveCarePatientServices.transferToAdmin(vcID, notes);
if (_liveCarePatientServices.hasError) {
error = _liveCarePatientServices.error;
setState(ViewState.ErrorLocal);
@ -115,19 +116,20 @@ class LiveCarePatientViewModel extends BaseViewModel {
}
searchData(String str) {
var strExist= str.length > 0 ? true : false;
var strExist = str.length > 0 ? true : false;
if (strExist) {
filterData = [];
for (var i = 0; i < _liveCarePatientServices.patientList.length; i++) {
String fullName =
_liveCarePatientServices.patientList[i].fullName.toUpperCase();
_liveCarePatientServices.patientList[i].fullName.toUpperCase();
String patientID =
_liveCarePatientServices.patientList[i].patientId.toString();
_liveCarePatientServices.patientList[i].patientId.toString();
String mobile =
_liveCarePatientServices.patientList[i].mobileNumber.toUpperCase();
_liveCarePatientServices.patientList[i].mobileNumber.toUpperCase();
if (fullName.contains(str.toUpperCase()) ||
patientID.contains(str)|| mobile.contains(str)) {
patientID.contains(str) ||
mobile.contains(str)) {
filterData.add(_liveCarePatientServices.patientList[i]);
}
}

@ -7,6 +7,15 @@ class PatiantInformtion {
String appointmentDate;
dynamic appointmentNo;
dynamic appointmentType;
String arrivalTime;
String arrivalTimeD;
int callStatus;
Null callStatusDisc;
int callTypeID;
String clientRequestID;
String clinicName;
String consoltationEnd;
String consultationNotes;
int appointmentTypeId;
String arrivedOn;
int clinicGroupId;
@ -57,12 +66,14 @@ class PatiantInformtion {
String startTime;
String visitType;
String nationalityFlagURL;
int patientStatus;
int patientStatusType;
int visitTypeId;
String startTimes;
String dischargeDate;
int status;
int vcId;
String voipToken;
PatiantInformtion(
{this.patientDetails,
@ -102,6 +113,15 @@ class PatiantInformtion {
this.appointmentDate,
this.startTime,
this.appointmentNo,
this.arrivalTime,
this.arrivalTimeD,
this.callStatus,
this.callStatusDisc,
this.callTypeID,
this.clientRequestID,
this.clinicName,
this.consoltationEnd,
this.consultationNotes,
this.appointmentType,
this.appointmentTypeId,
this.arrivedOn,
@ -122,20 +142,27 @@ class PatiantInformtion {
this.fullNameN,
this.nationalityFlagURL,
this.patientStatusType,
this.patientStatus,
this.visitTypeId,
this.startTimes,this.dischargeDate,this.status, this.vcId});
this.startTimes,
this.dischargeDate,
this.status,
this.vcId,
this.voipToken});
factory PatiantInformtion.fromJson(Map<String, dynamic> json) =>
PatiantInformtion(
patientDetails: json['patientDetails'] != null ? new PatiantInformtion.fromJson(json['patientDetails'])
patientDetails: json['patientDetails'] != null
? new PatiantInformtion.fromJson(json['patientDetails'])
: null,
projectId: json["ProjectID"] ?? json["projectID"],
clinicId: json["ClinicID"] ?? json["clinicID"],
doctorId: json["DoctorID"] ?? json["doctorID"],
patientId: json["PatientID"]!= null ?json["PatientID"] is String ? int.parse(json["PatientID"]):json["PatientID"]:
json["patientID"] ??
json['patientMRN'] ??
json['PatientMRN'],
patientId: json["PatientID"] != null
? json["PatientID"] is String
? int.parse(json["PatientID"])
: json["PatientID"]
: json["patientID"] ?? json['patientMRN'] ?? json['PatientMRN'],
doctorName: json["DoctorName"] ?? json["doctorName"],
doctorNameN: json["DoctorNameN"] ?? json["doctorNameN"],
firstName: json["FirstName"] ?? json["firstName"],
@ -144,17 +171,22 @@ class PatiantInformtion {
firstNameN: json["FirstNameN"] ?? json["firstNameN"],
middleNameN: json["MiddleNameN"] ?? json["middleNameN"],
lastNameN: json["LastNameN"] ?? json["lastNameN"],
gender: json["Gender"]!= null? json["Gender"]is String ?int.parse(json["Gender"]):json["Gender"] :json["gender"],
fullName: json["fullName"] ?? json["fullName"]??json["PatientName"],
fullNameN: json["fullNameN"] ?? json["fullNameN"]??json["PatientName"],
dateofBirth: json["DateofBirth"] ?? json["dob"]??json['DateOfBirth'],
gender: json["Gender"] != null
? json["Gender"] is String
? int.parse(json["Gender"])
: json["Gender"]
: json["gender"],
fullName: json["fullName"] ?? json["fullName"] ?? json["PatientName"],
fullNameN:
json["fullNameN"] ?? json["fullNameN"] ?? json["PatientName"],
dateofBirth: json["DateofBirth"] ?? json["dob"] ?? json['DateOfBirth'],
nationalityId: json["NationalityID"] ?? json["nationalityID"],
mobileNumber: json["MobileNumber"] ?? json["mobileNumber"],
emailAddress: json["EmailAddress"] ?? json["emailAddress"],
patientIdentificationNo:
json["PatientIdentificationNo"] ?? json["patientIdentificationNo"],
//TODO make 7 dynamic when the backend retrun it in patient arrival
patientType: json["PatientType"] ?? json["patientType"]??1,
patientType: json["PatientType"] ?? json["patientType"] ?? 1,
admissionNo: json["AdmissionNo"] ?? json["admissionNo"],
admissionDate: json["AdmissionDate"] ?? json["admissionDate"],
createdOn: json["CreatedOn"] ?? json["CreatedOn"],
@ -176,10 +208,11 @@ class PatiantInformtion {
genderDescription: json["GenderDescription"],
nursingStationName: json["NursingStationName"],
appointmentDate: json["AppointmentDate"] ?? '',
startTime: json["startTime"]??json['StartTime'],
startTime: json["startTime"] ?? json['StartTime'],
appointmentNo: json['appointmentNo'] ?? json['AppointmentNo'],
appointmentType: json['appointmentType'],
appointmentTypeId: json['appointmentTypeId']?? json['appointmentTypeid'],
appointmentTypeId:
json['appointmentTypeId'] ?? json['appointmentTypeid'],
arrivedOn: json['ArrivedOn'] ?? json['arrivedOn'] ?? json['ArrivedOn'],
clinicGroupId: json['clinicGroupId'],
companyName: json['companyName'],
@ -192,15 +225,28 @@ class PatiantInformtion {
medicationOrders: json['medicationOrders'],
nationality: json['nationality'] ?? json['NationalityNameN'],
patientMRN: json['patientMRN'] ?? json['PatientMRN'],
visitType: json['visitType'] ?? json['visitType']?? json['visitType'],
visitType: json['visitType'] ?? json['visitType'] ?? json['visitType'],
nationalityFlagURL:
json['NationalityFlagURL'] ?? json['NationalityFlagURL'],
patientStatusType:
json['patientStatusType'] ?? json['PatientStatusType'],
visitTypeId: json['visitTypeId'] ?? json['visitTypeId'] ?? json['visitTypeid'],
visitTypeId:
json['visitTypeId'] ?? json['visitTypeId'] ?? json['visitTypeid'],
startTimes: json['StartTime'] ?? json['StartTime'],
dischargeDate: json['DischargeDate'] ,
status: json['Status'] ,
vcId: json['VC_ID'] ,
dischargeDate: json['DischargeDate'],
status: json['Status'],
vcId: json['VC_ID'],
arrivalTime: json['ArrivalTime'],
arrivalTimeD: json['ArrivalTimeD'],
callStatus: json['CallStatus'],
callStatusDisc: json['CallStatusDisc'],
callTypeID: json['CallTypeID'],
clientRequestID: json['ClientRequestID'],
clinicName: json['ClinicName'],
consoltationEnd: json['ConsoltationEnd'],
consultationNotes: json['ConsultationNotes'],
patientStatus: json['PatientStatus'],
voipToken: json['VoipToken'],
);
}

@ -1,3 +1,5 @@
import 'dart:async';
import 'package:doctor_app_flutter/config/size_config.dart';
import 'package:doctor_app_flutter/core/enum/viewstate.dart';
import 'package:doctor_app_flutter/core/viewModel/LiveCarePatientViewModel.dart';
@ -22,10 +24,30 @@ class LiveCarePatientScreen extends StatefulWidget {
class _LiveCarePatientScreenState extends State<LiveCarePatientScreen> {
final _controller = TextEditingController();
Timer timer;
LiveCarePatientViewModel _liveCareViewModel;
@override
void initState() {
super.initState();
timer = Timer.periodic(Duration(seconds: 10), (Timer t) {
if(_liveCareViewModel != null){
_liveCareViewModel.getPendingPatientERForDoctorApp(isFromTimer: true);
}
});
}
@override
void dispose() {
_liveCareViewModel = null;
timer?.cancel();
super.dispose();
}
@override
Widget build(BuildContext context) {
return BaseView<LiveCarePatientViewModel>(
onModelReady: (model) async {
_liveCareViewModel = model;
await model.getPendingPatientERForDoctorApp();
},

@ -43,15 +43,25 @@ class PatientCard extends StatelessWidget {
),
child: CardWithBgWidget(
padding: 0,
marginLeft: (!isMyPatient && isInpatient)?0:10,
marginSymmetric:isFromSearch ? 10 : 0.0,
marginLeft: (!isMyPatient && isInpatient) ? 0 : 10,
marginSymmetric: isFromSearch ? 10 : 0.0,
hasBorder: false,
bgColor:isFromLiveCare?Colors.white:(isMyPatient && !isFromSearch)?Colors.green[500]: patientInfo.patientStatusType == 43
? Colors.green[500]
:isMyPatient? Colors.green[500]:isInpatient?Colors.white:!isFromSearch?Colors.red[800]:Colors.white,
bgColor: isFromLiveCare
? Colors.white
: (isMyPatient && !isFromSearch)
? Colors.green[500]
: patientInfo.patientStatusType == 43
? Colors.green[500]
: isMyPatient
? Colors.green[500]
: isInpatient
? Colors.white
: !isFromSearch
? Colors.red[800]
: Colors.white,
widget: Container(
color: Colors.white,
// padding: EdgeInsets.only(left: 10, right: 0, bottom: 0),
color: Colors.white,
// padding: EdgeInsets.only(left: 10, right: 0, bottom: 0),
child: InkWell(
child: Column(
children: [
@ -66,67 +76,120 @@ class PatientCard extends StatelessWidget {
children: [
patientInfo.patientStatusType == 43
? Row(
children: [
AppText(
TranslationBase.of(context).arrivedP,
children: [
AppText(
TranslationBase.of(context)
.arrivedP,
color: Colors.green,
fontWeight: FontWeight.bold,
fontFamily: 'Poppins',
fontSize: 10,
),
SizedBox(width: 8,),
SizedBox(height: 12,width: 1.5,child: Container(color: Colors.grey,),),
SizedBox(width: 8,),
AppText(
patientInfo.status==2? 'Confirmed':'Booked',
color: patientInfo.status==2? Colors.green:Colors.grey ,
fontWeight: FontWeight.bold,
fontFamily: 'Poppins',
fontSize: 10,
),
],
)
: patientInfo.patientStatusType == 42?Row(
children: [
AppText(
TranslationBase.of(context).notArrived,
color: Colors.red[800],
SizedBox(
width: 8,
),
SizedBox(
height: 12,
width: 1.5,
child: Container(
color: Colors.grey,
),
),
SizedBox(
width: 8,
),
AppText(
patientInfo.status == 2
? 'Confirmed'
: 'Booked',
color: patientInfo.status == 2
? Colors.green
: Colors.grey,
fontWeight: FontWeight.bold,
fontFamily: 'Poppins',
fontSize: 10,
),
SizedBox(width: 8,),
SizedBox(height: 12,width: 1.5,child: Container(color: Colors.grey,),),
SizedBox(width: 8,),
AppText(
patientInfo.status==2? 'Confirmed':'Booked',
color: patientInfo.status==2? Colors.green:Colors.grey ,
fontWeight: FontWeight.bold,
fontFamily: 'Poppins',
fontSize: 10,
),
],
): !isFromSearch&&!isFromLiveCare && patientInfo.patientStatusType==null ? Row(
children: [
AppText(
TranslationBase.of(context).notArrived,
color: Colors.red[800],
fontWeight: FontWeight.bold,
fontFamily: 'Poppins',
fontSize: 12,
),
SizedBox(width: 8,),
SizedBox(height: 12,width: 1.5,child: Container(color: Colors.grey,),),
SizedBox(width: 8,),
AppText(
patientInfo.status==2? 'Booked':'Confirmed',
color: patientInfo.status==2? Colors.grey:Colors.green ,
fontWeight: FontWeight.bold,
fontFamily: 'Poppins',
fontSize: 12,
)
],
):SizedBox(),
],
)
: patientInfo.patientStatusType == 42
? Row(
children: [
AppText(
TranslationBase.of(context)
.notArrived,
color: Colors.red[800],
fontWeight: FontWeight.bold,
fontFamily: 'Poppins',
fontSize: 10,
),
SizedBox(
width: 8,
),
SizedBox(
height: 12,
width: 1.5,
child: Container(
color: Colors.grey,
),
),
SizedBox(
width: 8,
),
AppText(
patientInfo.status == 2
? 'Confirmed'
: 'Booked',
color: patientInfo.status == 2
? Colors.green
: Colors.grey,
fontWeight: FontWeight.bold,
fontFamily: 'Poppins',
fontSize: 10,
),
],
)
: !isFromSearch &&
!isFromLiveCare &&
patientInfo.patientStatusType ==
null
? Row(
children: [
AppText(
TranslationBase.of(context)
.notArrived,
color: Colors.red[800],
fontWeight: FontWeight.bold,
fontFamily: 'Poppins',
fontSize: 12,
),
SizedBox(
width: 8,
),
SizedBox(
height: 12,
width: 1.5,
child: Container(
color: Colors.grey,
),
),
SizedBox(
width: 8,
),
AppText(
patientInfo.status == 2
? 'Booked'
: 'Confirmed',
color:
patientInfo.status == 2
? Colors.grey
: Colors.green,
fontWeight: FontWeight.bold,
fontFamily: 'Poppins',
fontSize: 12,
)
],
)
: SizedBox(),
this.arrivalType == '1'
? AppText(
patientInfo.startTime != null
@ -137,27 +200,39 @@ class PatientCard extends StatelessWidget {
)
: patientInfo.arrivedOn != null
? AppText(
AppDateUtils.getDayMonthYearDate(AppDateUtils.convertStringToDate(patientInfo.arrivedOn,)
)+" "+ "${AppDateUtils.getStartTime(patientInfo.startTime)}",
AppDateUtils.getDayMonthYearDate(
AppDateUtils
.convertStringToDate(
patientInfo.arrivedOn,
)) +
" " +
"${AppDateUtils.getStartTime(patientInfo.startTime)}",
fontFamily: 'Poppins',
fontWeight: FontWeight.w400,
fontSize: 15,
fontSize: 15,
)
: (patientInfo.appointmentDate != null && patientInfo.appointmentDate.isNotEmpty)?
AppText(
"${AppDateUtils.getDayMonthYearDate(AppDateUtils.convertStringToDate(patientInfo.appointmentDate,))} ${AppDateUtils.getStartTime(patientInfo.startTime)}",
fontFamily: 'Poppins',
fontWeight: FontWeight.w400,
fontSize: 15,
):SizedBox()
: (patientInfo.appointmentDate !=
null &&
patientInfo
.appointmentDate.isNotEmpty)
? AppText(
"${AppDateUtils.getDayMonthYearDate(AppDateUtils.convertStringToDate(
patientInfo.appointmentDate,
))} ${AppDateUtils.getStartTime(patientInfo.startTime)}",
fontFamily: 'Poppins',
fontWeight: FontWeight.w400,
fontSize: 15,
)
: SizedBox()
],
))
: SizedBox(),
if(isInpatient && isMyPatient && !isFromSearch)
if (isInpatient && isMyPatient && !isFromSearch)
Row(
children: [
SizedBox(width: 12,),
SizedBox(
width: 12,
),
AppText(
'My Patient',
color: Colors.green,
@ -177,9 +252,14 @@ class PatientCard extends StatelessWidget {
Expanded(
// width: MediaQuery.of(context).size.width*0.51,
child: AppText(
isFromLiveCare? Helpers.capitalize(patientInfo.fullName): (Helpers.capitalize(patientInfo.firstName) +
" " +
Helpers.capitalize(patientInfo.lastName)),
isFromLiveCare
? Helpers.capitalize(
patientInfo.fullName)
: (Helpers.capitalize(
patientInfo.firstName) +
" " +
Helpers.capitalize(
patientInfo.lastName)),
fontSize: 16,
color: Color(0xff2e303a),
fontWeight: FontWeight.w700,
@ -189,12 +269,14 @@ class PatientCard extends StatelessWidget {
),
if (patientInfo.gender == 1)
Icon(
DoctorApp.male_2,
color: Colors.blue,
) else Icon(
DoctorApp.female_1,
color: Colors.pink,
),
DoctorApp.male_2,
color: Colors.blue,
)
else
Icon(
DoctorApp.female_1,
color: Colors.pink,
),
]),
),
Row(
@ -286,31 +368,30 @@ class PatientCard extends StatelessWidget {
),
),
//if (isInpatient)
Container(
child: RichText(
text: new TextSpan(
style: new TextStyle(
fontSize: 2.0 * SizeConfig.textMultiplier,
color: Colors.black,
fontFamily: 'Poppins',
),
children: <TextSpan>[
new TextSpan(
text:
TranslationBase.of(context).age +
" : ",
style: TextStyle(fontSize: 12)),
new TextSpan(
text:
"${AppDateUtils.getAgeByBirthday(patientInfo.dateofBirth, context, isServerFormat: !isFromLiveCare)}",
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 13)),
],
Container(
child: RichText(
text: new TextSpan(
style: new TextStyle(
fontSize: 2.0 * SizeConfig.textMultiplier,
color: Colors.black,
fontFamily: 'Poppins',
),
children: <TextSpan>[
new TextSpan(
text: TranslationBase.of(context).age +
" : ",
style: TextStyle(fontSize: 12)),
new TextSpan(
text:
"${AppDateUtils.getAgeByBirthday(patientInfo.dateofBirth, context, isServerFormat: !isFromLiveCare)}",
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 13)),
],
),
),
if (isInpatient )
),
if (isInpatient)
Container(
child: RichText(
text: new TextSpan(
@ -342,61 +423,75 @@ class PatientCard extends StatelessWidget {
text: new TextSpan(
style: new TextStyle(
fontSize:
2.0 * SizeConfig.textMultiplier,
2.0 * SizeConfig.textMultiplier,
color: Colors.black,
fontFamily: 'Poppins',
),
children: <TextSpan>[
new TextSpan(
text: TranslationBase.of(context).numOfDays + " : ",
style: TextStyle(fontSize: 12)),
new TextSpan(
text: "${DateTime.now().difference(AppDateUtils.getDateTimeFromServerFormat(patientInfo.admissionDate)).inDays + 1}",
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 13)),
]))),
new TextSpan(
text: TranslationBase.of(context)
.numOfDays +
" : ",
style: TextStyle(fontSize: 12)),
new TextSpan(
text:
"${DateTime.now().difference(AppDateUtils.getDateTimeFromServerFormat(patientInfo.admissionDate)).inDays + 1}",
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 13)),
]))),
]))
]),
!isInpatient && !isFromSearch
isFromLiveCare
? Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
Container(
padding: EdgeInsets.all(4),
child: Image.asset(
patientInfo.appointmentType ==
'Regular' &&
patientInfo.visitTypeId == 100
? 'assets/images/livecare.png'
: patientInfo.appointmentType ==
'Walkin'
? 'assets/images/walkin.png'
: 'assets/images/booked.png',
height: 25,
width: 35,
)),
])
: (isInpatient == true)
Container(
padding: EdgeInsets.all(4),
child: Image.asset(
'assets/images/livecare.png',
height: 25,
width: 35,
color: Colors.grey.shade700,
)),
],
)
: !isInpatient && !isFromSearch
? Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
Container(
padding: EdgeInsets.all(4),
child: Image.asset(
'assets/images/inpatient.png',
patientInfo.appointmentType ==
'Regular' &&
patientInfo.visitTypeId == 100
? 'assets/images/livecare.png'
: patientInfo.appointmentType ==
'Walkin'
? 'assets/images/walkin.png'
: 'assets/images/booked.png',
height: 25,
width: 35,
)),
])
: SizedBox()
: (isInpatient == true)
? Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
Container(
padding: EdgeInsets.all(4),
child: Image.asset(
'assets/images/inpatient.png',
height: 25,
width: 35,
)),
])
: SizedBox()
],
),
onTap: onTap,
)),
));
}
}

Loading…
Cancel
Save