fix referral patient services

merge-requests/726/head
Elham Rababah 4 years ago
parent 663c8d1104
commit 72966c3269

@ -5,8 +5,8 @@ const ONLY_NUMBERS = "[0-9]";
const ONLY_LETTERS = "[a-zA-Z &'\"]";
const ONLY_DATE = "[0-9/]";
const BASE_URL_LIVE_CARE = 'https://livecare.hmg.com/';
const BASE_URL = 'https://hmgwebservices.com/';
// const BASE_URL = 'https://uat.hmgwebservices.com/';
// const BASE_URL = 'https://hmgwebservices.com/';
const BASE_URL = 'https://uat.hmgwebservices.com/';
const PHARMACY_ITEMS_URL = "Services/Lists.svc/REST/GetPharmcyItems_Region_enh";
const PHARMACY_LIST_URL = "Services/Patients.svc/REST/GetPharmcyList";
const PATIENT_PROGRESS_NOTE_URL = "Services/DoctorApplication.svc/REST/GetProgressNoteForInPatient";
@ -56,7 +56,7 @@ const ADD_REFERRED_DOCTOR_REMARKS = 'Services/DoctorApplication.svc/REST/AddRefe
const GET_MY_REFERRED_PATIENT = 'Services/DoctorApplication.svc/REST/GtMyReferredPatient';
const GET_MY_REFERRED_OUT_PATIENT = 'Services/DoctorApplication.svc/REST/GtMyReferralForOutPatient';
const GET_MY_REFERRED_OUT_PATIENT = 'Services/DoctorApplication.svc/REST/GtMyReferredOutPatient';
const GET_PENDING_REFERRAL_PATIENT = 'Services/DoctorApplication.svc/REST/PendingReferrals';
@ -181,7 +181,7 @@ const GET_ECG = "Services/Patients.svc/REST/HIS_GetPatientMuseResults";
const GET_MY_REFERRAL_INPATIENT = "Services/DoctorApplication.svc/REST/GtMyReferralPatient";
const GET_MY_REFERRAL_OUTPATIENT = "Services/DoctorApplication.svc/REST/GtMyReferredOutPatient";
const GET_MY_REFERRAL_OUTPATIENT = "Services/DoctorApplication.svc/REST/GtMyReferralForOutPatient";
const GET_MY_DISCHARGE_PATIENT = "Services/DoctorApplication.svc/REST/GtMyDischargeReferralPatient";
const GET_DISCHARGE_PATIENT = "Services/DoctorApplication.svc/REST/GtMyDischargePatient";

@ -158,8 +158,8 @@ class MyReferralPatientModel {
referringDoctor = json['ReferringDoctor'];
referralClinic = json['ReferralClinic'];
referringClinic = json['ReferringClinic'];
referralStatus = json['ReferralStatus'];
referralDate = AppDateUtils.convertStringToDate(json['ReferralDate']);
referralStatus = json["ReferralStatus"] is String ?json['ReferralStatus']== "Accepted"?46:json['ReferralStatus']=="Pending"?1:0: json["ReferralStatus"];
referralDate = AppDateUtils.getDateTimeFromString(json['ReferralDate']);
referringDoctorRemarks = json['ReferringDoctorRemarks'];
referredDoctorRemarks = json['ReferredDoctorRemarks'];
referralResponseOn = json['ReferralResponseOn'];

@ -0,0 +1,104 @@
class MyReferralPatientRequestModel {
int channel;
int clinicID;
int doctorID;
int editedBy;
String firstName;
String from;
String iPAdress;
bool isLoginForDoctorApp;
int languageID;
String lastName;
String middleName;
int patientID;
String patientIdentificationID;
String patientMobileNumber;
bool patientOutSA;
int patientTypeID;
int projectID;
String sessionID;
String stamp;
String to;
String tokenID;
double versionID;
String vidaAuthTokenID;
MyReferralPatientRequestModel(
{this.channel,
this.clinicID,
this.doctorID,
this.editedBy,
this.firstName,
this.from,
this.iPAdress,
this.isLoginForDoctorApp,
this.languageID,
this.lastName,
this.middleName,
this.patientID,
this.patientIdentificationID,
this.patientMobileNumber,
this.patientOutSA,
this.patientTypeID,
this.projectID,
this.sessionID,
this.stamp,
this.to,
this.tokenID,
this.versionID,
this.vidaAuthTokenID});
MyReferralPatientRequestModel.fromJson(Map<String, dynamic> json) {
channel = json['Channel'];
clinicID = json['ClinicID'];
doctorID = json['DoctorID'];
editedBy = json['EditedBy'];
firstName = json['FirstName'];
from = json['From'];
iPAdress = json['IPAdress'];
isLoginForDoctorApp = json['IsLoginForDoctorApp'];
languageID = json['LanguageID'];
lastName = json['LastName'];
middleName = json['MiddleName'];
patientID = json['PatientID'];
patientIdentificationID = json['PatientIdentificationID'];
patientMobileNumber = json['PatientMobileNumber'];
patientOutSA = json['PatientOutSA'];
patientTypeID = json['PatientTypeID'];
projectID = json['ProjectID'];
sessionID = json['SessionID'];
stamp = json['stamp'];
to = json['To'];
tokenID = json['TokenID'];
versionID = json['VersionID'];
vidaAuthTokenID = json['VidaAuthTokenID'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['Channel'] = this.channel;
data['ClinicID'] = this.clinicID;
data['DoctorID'] = this.doctorID;
data['EditedBy'] = this.editedBy;
data['FirstName'] = this.firstName;
data['From'] = this.from;
data['IPAdress'] = this.iPAdress;
data['IsLoginForDoctorApp'] = this.isLoginForDoctorApp;
data['LanguageID'] = this.languageID;
data['LastName'] = this.lastName;
data['MiddleName'] = this.middleName;
data['PatientID'] = this.patientID;
data['PatientIdentificationID'] = this.patientIdentificationID;
data['PatientMobileNumber'] = this.patientMobileNumber;
data['PatientOutSA'] = this.patientOutSA;
data['PatientTypeID'] = this.patientTypeID;
data['ProjectID'] = this.projectID;
data['SessionID'] = this.sessionID;
data['stamp'] = this.stamp;
data['To'] = this.to;
data['TokenID'] = this.tokenID;
data['VersionID'] = this.versionID;
data['VidaAuthTokenID'] = this.vidaAuthTokenID;
return data;
}
}

@ -1,5 +1,6 @@
import 'package:doctor_app_flutter/config/config.dart';
import 'package:doctor_app_flutter/core/model/referral/MyReferralPatientModel.dart';
import 'package:doctor_app_flutter/core/model/referral/MyReferralPatientRequestModel.dart';
import 'package:doctor_app_flutter/core/service/base/base_service.dart';
import 'package:doctor_app_flutter/models/doctor/request_add_referred_doctor_remarks.dart';
@ -8,22 +9,22 @@ class MyReferralInPatientService extends BaseService {
Future getMyReferralPatientService() async {
hasError = false;
Map<String, dynamic> body = Map();
await getDoctorProfile();
body['DoctorID'] = doctorProfile.doctorID;
body['FirstName'] = "0";
body['MiddleName'] = "0";
body['LastName'] = "0";
body['PatientMobileNumber'] = "0";
body['PatientIdentificationID'] = "0";
body['PatientID'] = 0;
body['From'] = "0";
body['To'] = "0";
body['stamp'] = DateTime.now().toIso8601String();
body['IsLoginForDoctorApp'] = true;
body['IPAdress'] = "11.11.11.11";
body['PatientOutSA'] = false;
body['PatientTypeID'] = 1;
MyReferralPatientRequestModel myReferralPatientRequestModel =
MyReferralPatientRequestModel(
doctorID: doctorProfile.doctorID,
firstName: "0",
middleName: "0",
lastName: "0",
patientMobileNumber: "0",
patientIdentificationID: "0",
patientID: 0,
from: "0",
to: "0",
stamp: DateTime.now().toIso8601String(),
isLoginForDoctorApp: true,
patientTypeID: 1);
myReferralPatients.clear();
await baseAppClient.post(
GET_MY_REFERRAL_INPATIENT,
@ -38,34 +39,34 @@ class MyReferralInPatientService extends BaseService {
hasError = true;
super.error = error;
},
body: body,
body: myReferralPatientRequestModel.toJson(),
);
}
Future getMyReferralOutPatientService() async {
hasError = false;
Map<String, dynamic> body = Map();
await getDoctorProfile();
body['DoctorID'] = doctorProfile.doctorID;
body['FirstName'] = "0";
body['MiddleName'] = "0";
body['LastName'] = "0";
body['PatientMobileNumber'] = "0";
body['PatientIdentificationID'] = "0";
body['PatientID'] = 0;
body['From'] = "0";
body['To'] = "0";
body['stamp'] = DateTime.now().toIso8601String();
body['IsLoginForDoctorApp'] = true;
body['IPAdress'] = "11.11.11.11";
body['PatientOutSA'] = false;
body['PatientTypeID'] = 1;
MyReferralPatientRequestModel myReferralPatientRequestModel =
MyReferralPatientRequestModel(
doctorID: doctorProfile.doctorID,
firstName: "0",
middleName: "0",
lastName: "0",
patientMobileNumber: "0",
patientIdentificationID: "0",
patientID: 0,
from: "0",
to: "0",
stamp: DateTime.now().toIso8601String(),
isLoginForDoctorApp: true,
patientTypeID: 1);
myReferralPatients.clear();
await baseAppClient.post(
GET_MY_REFERRAL_OUTPATIENT,
onSuccess: (dynamic response, int statusCode) {
if (response['List_MyReferredOutPatient'] != null) {
response['List_MyReferredOutPatient'].forEach((v) {
if (response['List_MyOutPatientReferral'] != null) {
response['List_MyOutPatientReferral'].forEach((v) {
myReferralPatients.add(MyReferralPatientModel.fromJson(v));
});
}
@ -74,7 +75,7 @@ class MyReferralInPatientService extends BaseService {
hasError = true;
super.error = error;
},
body: body,
body: myReferralPatientRequestModel.toJson(),
);
}

@ -161,7 +161,6 @@ class PatientReferralService extends LookupService {
hasError = false;
RequestMyReferralPatientModel _requestMyReferralPatient =
RequestMyReferralPatientModel();
// _requestMyReferralPatient.doctorID = 1002;
DoctorProfileModel doctorProfile = await getDoctorProfile();
await baseAppClient.post(
@ -169,7 +168,7 @@ class PatientReferralService extends LookupService {
onSuccess: (dynamic response, int statusCode) {
listMyReferredPatientModel.clear();
response['List_MyOutPatientReferral'].forEach((v) {
response['List_MyReferredOutPatient'].forEach((v) {
MyReferredPatientModel item = MyReferredPatientModel.fromJson(v);
if (doctorProfile != null) {
item.isReferralDoctorSameBranch =

@ -174,22 +174,22 @@ class PatientReferralViewModel extends BaseViewModel {
setState(ViewState.Idle);
}
Future getMyReferralPatientService() async {
setState(ViewState.Busy);
Future getMyReferralPatientService({bool localBusy = false}) async {
if(localBusy) setState(ViewState.BusyLocal); else setState(ViewState.Busy);
await _myReferralService.getMyReferralPatientService();
if (_myReferralService.hasError) {
error = _myReferralService.error;
setState(ViewState.Error);
if(localBusy) setState(ViewState.ErrorLocal); else setState(ViewState.Error);
} else
setState(ViewState.Idle);
}
Future getMyReferralOutPatientService() async {
setState(ViewState.Busy);
Future getMyReferralOutPatientService({bool localBusy = false}) async {
if(localBusy) setState(ViewState.BusyLocal); else setState(ViewState.Busy);
await _myReferralService.getMyReferralOutPatientService();
if (_myReferralService.hasError) {
error = _myReferralService.error;
setState(ViewState.Error);
if(localBusy) setState(ViewState.ErrorLocal); else setState(ViewState.Error);
} else
setState(ViewState.Idle);
}

@ -166,7 +166,7 @@ class MyReferredPatientModel {
referringDoctor = json['ReferringDoctor'];
referralClinic = json['ReferralClinic'];
referringClinic = json['ReferringClinic'];
referralStatus = json['ReferralStatus'];
referralStatus = json["ReferralStatus"] is String?json['ReferralStatus']== "Accepted"?46:json['ReferralStatus']=="Pending"?1:0 : json['ReferralStatus'];// TODO Elham json['ReferralStatus'];
referralDate = json['ReferralDate'];
referringDoctorRemarks = json['ReferringDoctorRemarks'];
referredDoctorRemarks = json['ReferredDoctorRemarks'];

@ -1,16 +1,21 @@
import 'package:doctor_app_flutter/core/enum/PatientType.dart';
import 'package:doctor_app_flutter/core/viewModel/patient-referral-viewmodel.dart';
import 'package:doctor_app_flutter/screens/base/base_view.dart';
import 'package:doctor_app_flutter/screens/patients/profile/referral/referral_patient_detail_in-paint.dart';
import 'package:doctor_app_flutter/screens/patients/profile/referral/referred-patient-screen.dart';
import 'package:doctor_app_flutter/util/date-utils.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/patients/patient-referral-item-widget.dart';
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart';
import 'package:doctor_app_flutter/widgets/transitions/fade_page.dart';
import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
class MyReferralInPatientScreen extends StatelessWidget {
PatientType patientType = PatientType.IN_PATIENT;
@override
Widget build(BuildContext context) {
@ -20,70 +25,90 @@ class MyReferralInPatientScreen extends StatelessWidget {
baseViewModel: model,
isShowAppBar: false,
appBarTitle: TranslationBase.of(context).referPatient,
body: model.myReferralPatients.isEmpty
? Center(
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
SizedBox(
height: 100,
body: Column(
children: [
Container(
margin: EdgeInsets.only(top: 70),
child: PatientTypeRadioWidget(
(patientType) async {
this.patientType = patientType;
GifLoaderDialogUtils.showMyDialog(context);
if (patientType == PatientType.IN_PATIENT) {
await model.getMyReferralPatientService(localBusy: true);
} else {
await model.getMyReferralOutPatientService(localBusy: true);
}
GifLoaderDialogUtils.hideDialog(context);
},
),
),
model.myReferralPatients.isEmpty
? Center(
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
SizedBox(
height: 100,
),
Image.asset('assets/images/no-data.png'),
Padding(
padding: const EdgeInsets.all(8.0),
child: AppText(
TranslationBase.of(context).referralEmptyMsg,
color: Theme.of(context).errorColor,
),
)
],
),
Image.asset('assets/images/no-data.png'),
Padding(
padding: const EdgeInsets.all(8.0),
child: AppText(
TranslationBase.of(context).referralEmptyMsg,
color: Theme.of(context).errorColor,
),
)
],
),
)
: SingleChildScrollView(
child: Container(
margin: EdgeInsets.only(top: 70),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
)
: SingleChildScrollView(
child: Container(
margin: EdgeInsets.only(top: 70),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
...List.generate(
model.myReferralPatients.length,
(index) => InkWell(
onTap: () {
Navigator.push(
context,
FadePage(
page: ReferralPatientDetailScreen(model.myReferralPatients[index],model),
...List.generate(
model.myReferralPatients.length,
(index) => InkWell(
onTap: () {
Navigator.push(
context,
FadePage(
page: ReferralPatientDetailScreen(model.myReferralPatients[index],model),
),
);
},
child: PatientReferralItemWidget(
referralStatus: model.getReferralStatusNameByCode(model.myReferralPatients[index].referralStatus,context),
referralStatusCode: model.myReferralPatients[index].referralStatus,
patientName: model.myReferralPatients[index].patientName,
patientGender: model.myReferralPatients[index].gender,
referredDate: AppDateUtils.getDayMonthYearDateFormatted(model.myReferralPatients[index].referralDate),
referredTime: AppDateUtils.getTimeHHMMA(model.myReferralPatients[index].referralDate),
patientID: "${model.myReferralPatients[index].patientID}",
isSameBranch: false,
isReferral: true,
isReferralClinic: true,
referralClinic:"${model.myReferralPatients[index].referringClinicDescription}",
remark: model.myReferralPatients[index].referringDoctorRemarks,
nationality: model.myReferralPatients[index].nationalityName,
nationalityFlag: model.myReferralPatients[index].nationalityFlagURL,
doctorAvatar: model.myReferralPatients[index].doctorImageURL,
referralDoctorName: model.myReferralPatients[index].referringDoctorName,
clinicDescription: model.myReferralPatients[index].referringClinicDescription,
infoIcon: Icon(FontAwesomeIcons.arrowRight,
size: 25, color: Colors.black),
),
);
},
child: PatientReferralItemWidget(
referralStatus: model.getReferralStatusNameByCode(model.myReferralPatients[index].referralStatus,context),
referralStatusCode: model.myReferralPatients[index].referralStatus,
patientName: model.myReferralPatients[index].patientName,
patientGender: model.myReferralPatients[index].gender,
referredDate: AppDateUtils.getDayMonthYearDateFormatted(model.myReferralPatients[index].referralDate),
referredTime: AppDateUtils.getTimeHHMMA(model.myReferralPatients[index].referralDate),
patientID: "${model.myReferralPatients[index].patientID}",
isSameBranch: false,
isReferral: true,
isReferralClinic: true,
referralClinic:"${model.myReferralPatients[index].referringClinicDescription}",
remark: model.myReferralPatients[index].referringDoctorRemarks,
nationality: model.myReferralPatients[index].nationalityName,
nationalityFlag: model.myReferralPatients[index].nationalityFlagURL,
doctorAvatar: model.myReferralPatients[index].doctorImageURL,
referralDoctorName: model.myReferralPatients[index].referringDoctorName,
clinicDescription: model.myReferralPatients[index].referringClinicDescription,
infoIcon: Icon(FontAwesomeIcons.arrowRight,
size: 25, color: Colors.black),
),
),
),
],
),
],
),
),
),
),
],
),
),
);
}

@ -237,6 +237,7 @@ class ReferralPatientDetailScreen extends StatelessWidget {
),
],
),
if(referredPatient.frequency != null)
Row(
mainAxisAlignment:
MainAxisAlignment.start,
@ -256,7 +257,7 @@ class ReferralPatientDetailScreen extends StatelessWidget {
Expanded(
child: AppText(
referredPatient
.frequencyDescription,
.frequencyDescription??'',
fontFamily: 'Poppins',
fontWeight: FontWeight.w700,
fontSize: 1.8 *
@ -303,6 +304,7 @@ class ReferralPatientDetailScreen extends StatelessWidget {
)
],
),
if(referredPatient.priorityDescription != null)
Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
@ -317,7 +319,7 @@ class ReferralPatientDetailScreen extends StatelessWidget {
),
Expanded(
child: AppText(
referredPatient.priorityDescription,
referredPatient.priorityDescription??'',
fontFamily: 'Poppins',
fontWeight: FontWeight.w700,
fontSize:
@ -327,6 +329,7 @@ class ReferralPatientDetailScreen extends StatelessWidget {
),
],
),
if(referredPatient.mAXResponseTime != null)
Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
@ -342,9 +345,9 @@ class ReferralPatientDetailScreen extends StatelessWidget {
),
Expanded(
child: AppText(
AppDateUtils.convertDateFromServerFormat(
referredPatient.mAXResponseTime != null? AppDateUtils.convertDateFromServerFormat(
referredPatient.mAXResponseTime,
"dd MMM,yyyy"),
"dd MMM,yyyy"):'',
fontFamily: 'Poppins',
fontWeight: FontWeight.w700,
fontSize:
@ -469,7 +472,7 @@ class ReferralPatientDetailScreen extends StatelessWidget {
color: Color(0XFF2E303A),
),
AppText(
referredPatient.referringDoctorRemarks,
referredPatient.referringDoctorRemarks??'',
fontFamily: 'Poppins',
fontWeight: FontWeight.w600,
fontSize: 1.8 * SizeConfig.textMultiplier,

@ -236,6 +236,8 @@ class ReferredPatientDetailScreen extends StatelessWidget {
),
],
),
if(referredPatient
.frequencyDescription != null)
Row(
mainAxisAlignment:
MainAxisAlignment.start,
@ -301,6 +303,7 @@ class ReferredPatientDetailScreen extends StatelessWidget {
)
],
),
if(referredPatient.priorityDescription != null)
Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
@ -322,6 +325,7 @@ class ReferredPatientDetailScreen extends StatelessWidget {
),
],
),
if(referredPatient.mAXResponseTime != null)
Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
@ -337,9 +341,9 @@ class ReferredPatientDetailScreen extends StatelessWidget {
),
Expanded(
child: AppText(
AppDateUtils.convertDateFromServerFormat(
referredPatient.mAXResponseTime != null?AppDateUtils.convertDateFromServerFormat(
referredPatient.mAXResponseTime,
"dd MMM,yyyy"),
"dd MMM,yyyy"):'',
fontFamily: 'Poppins',
fontWeight: FontWeight.w700,
fontSize:
@ -515,6 +519,7 @@ class ReferredPatientDetailScreen extends StatelessWidget {
),
AppText(
referredPatient
.referredDoctorRemarks == null ?'':referredPatient
.referredDoctorRemarks.isNotEmpty
? referredPatient.referredDoctorRemarks
: TranslationBase.of(context).notRepliedYet,
@ -543,7 +548,7 @@ class ReferredPatientDetailScreen extends StatelessWidget {
fontSize: 1.8,
hPadding: 8,
vPadding: 12,
disabled: referredPatient.referredDoctorRemarks.isNotEmpty
disabled: referredPatient.referredDoctorRemarks == null? true: referredPatient.referredDoctorRemarks.isNotEmpty
? false
: true,
onPressed: () async {

@ -371,4 +371,22 @@ class AppDateUtils {
else
return "";
}
// handel date like "09/05/2021 17:00"
static DateTime getDateTimeFromString(String str) {
List<String> array = str.split('/');
int day = int.parse(array[0]);
int month = int.parse(array[1]);
List<String> array2 = array[2].split(' ');
int year = int.parse(array2[0]);
String hour = array2[1];
List<String> hourList = hour.split(":");
DateTime date = DateTime(year, month, day, int.parse(hourList[0]), int.parse(hourList[1]));
return date;
}
}

Loading…
Cancel
Save