Merge branch 'doctor_res' into 'development'

Doctor res

See merge request Cloud_Solution/doctor_app_flutter!783
merge-requests/784/head
Elham Ali 3 years ago
commit c49827dec5

@ -32,35 +32,7 @@ class DoctorReplyService extends BaseService {
}, body: _requestDoctorReply.toJson(),); }, body: _requestDoctorReply.toJson(),);
} }
Future replay( Future createDoctorResponse(
String referredDoctorRemarks, ListGtMyPatientsQuestions model) async {
RequestMyReferralPatientModel _requestMyReferralPatient =
RequestMyReferralPatientModel();
RequestAddReferredDoctorRemarks _requestAddReferredDoctorRemarks =
RequestAddReferredDoctorRemarks();
_requestAddReferredDoctorRemarks.admissionNo = model.admissionNo.toString();
_requestAddReferredDoctorRemarks.patientID = model.patientID;
_requestAddReferredDoctorRemarks.referredDoctorRemarks =
referredDoctorRemarks;
_requestAddReferredDoctorRemarks.lineItemNo = model.lineItemNo;
_requestAddReferredDoctorRemarks.referringDoctor = model.referringDoctor;
await baseAppClient.post(
ADD_REFERRED_DOCTOR_REMARKS,
body: _requestAddReferredDoctorRemarks.toJson(),
onSuccess: (dynamic body, int statusCode) {
print("succsss");
// model.referredDoctorRemarks = referredDoctorRemarks;
// listMyReferralPatientModel[listMyReferralPatientModel.indexOf(model)] =
// model;
},
onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
},
);
}
Future createDoctorResponse(
CreateDoctorResponseModel createDoctorResponseModel) async { CreateDoctorResponseModel createDoctorResponseModel) async {
hasError = false; hasError = false;
await baseAppClient.post( await baseAppClient.post(

@ -14,6 +14,7 @@ class DoctorReplayViewModel extends BaseViewModel {
Future getDoctorReply() async { Future getDoctorReply() async {
setState(ViewState.Busy); setState(ViewState.Busy);
await getDoctorProfile();
await _doctorReplyService.getDoctorReply(); await _doctorReplyService.getDoctorReply();
if (_doctorReplyService.hasError) { if (_doctorReplyService.hasError) {
error = _doctorReplyService.error; error = _doctorReplyService.error;
@ -22,16 +23,6 @@ class DoctorReplayViewModel extends BaseViewModel {
setState(ViewState.Idle); setState(ViewState.Idle);
} }
Future replay(
String referredDoctorRemarks, ListGtMyPatientsQuestions model) async {
setState(ViewState.BusyLocal);
await _doctorReplyService.replay(referredDoctorRemarks, model);
if (_doctorReplyService.hasError) {
error = _doctorReplyService.error;
setState(ViewState.ErrorLocal);
} else
setState(ViewState.Idle);
}
Future createDoctorResponse( Future createDoctorResponse(
String response, ListGtMyPatientsQuestions model) async { String response, ListGtMyPatientsQuestions model) async {

@ -1,9 +1,6 @@
import 'package:doctor_app_flutter/util/date-utils.dart'; import 'package:doctor_app_flutter/util/date-utils.dart';
class ListGtMyPatientsQuestions { class ListGtMyPatientsQuestions {
String setupID; String setupID;
int projectID; int projectID;
@ -26,9 +23,9 @@ class ListGtMyPatientsQuestions {
String dateofBirth; String dateofBirth;
String mobileNumber; String mobileNumber;
String emailAddress; String emailAddress;
int admissionNo; int infoStatus;
int referringDoctor; String infoDesc;
int lineItemNo; String doctorResponse;
String age; String age;
String genderDescription; String genderDescription;
bool isVidaCall; bool isVidaCall;
@ -55,9 +52,9 @@ class ListGtMyPatientsQuestions {
this.dateofBirth, this.dateofBirth,
this.mobileNumber, this.mobileNumber,
this.emailAddress, this.emailAddress,
this.admissionNo, this.infoStatus,
this.referringDoctor, this.infoDesc,
this.lineItemNo, this.doctorResponse,
this.age, this.age,
this.genderDescription, this.genderDescription,
this.isVidaCall}); this.isVidaCall});
@ -84,9 +81,9 @@ class ListGtMyPatientsQuestions {
dateofBirth = json['DateofBirth']; dateofBirth = json['DateofBirth'];
mobileNumber = json['MobileNumber']; mobileNumber = json['MobileNumber'];
emailAddress = json['EmailAddress']; emailAddress = json['EmailAddress'];
admissionNo = json['AdmissionNo']; infoStatus = json['InfoStatus'];
referringDoctor = json['ReferringDoctor']; infoDesc = json['InfoDesc'];
lineItemNo = json['LineItemNo']; doctorResponse = json['DoctorResponse'];
age = json['Age']; age = json['Age'];
genderDescription = json['GenderDescription']; genderDescription = json['GenderDescription'];
isVidaCall = json['IsVidaCall']; isVidaCall = json['IsVidaCall'];
@ -115,9 +112,9 @@ class ListGtMyPatientsQuestions {
data['DateofBirth'] = this.dateofBirth; data['DateofBirth'] = this.dateofBirth;
data['MobileNumber'] = this.mobileNumber; data['MobileNumber'] = this.mobileNumber;
data['EmailAddress'] = this.emailAddress; data['EmailAddress'] = this.emailAddress;
data['AdmissionNo'] = this.admissionNo; data['InfoStatus'] = this.infoStatus;
data['ReferringDoctor'] = this.referringDoctor; data['InfoDesc'] = this.infoDesc;
data['LineItemNo'] = this.lineItemNo; data['DoctorResponse'] = this.doctorResponse;
data['Age'] = this.age; data['Age'] = this.age;
data['GenderDescription'] = this.genderDescription; data['GenderDescription'] = this.genderDescription;
data['IsVidaCall'] = this.isVidaCall; data['IsVidaCall'] = this.isVidaCall;
@ -125,3 +122,4 @@ class ListGtMyPatientsQuestions {
} }
} }

@ -28,8 +28,12 @@ class DoctorReplayChat extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
if(reply.doctorResponse.isNotEmpty){
msgController.text = reply.doctorResponse;
}
return BaseView<DoctorReplayViewModel>( return BaseView<DoctorReplayViewModel>(
onModelReady: (model) async {}, onModelReady: (model) async {
},
builder: (_, model, w) => AppScaffold( builder: (_, model, w) => AppScaffold(
baseViewModel: model, baseViewModel: model,
isShowAppBar: false, isShowAppBar: false,
@ -103,7 +107,7 @@ class DoctorReplayChat extends StatelessWidget {
SizedBox(height: 30,), SizedBox(height: 30,),
Container( Container(
// color: Color(0xFF2B353E), // color: Color(0xFF2B353E),
width: MediaQuery.of(context).size.width * 0.9, width: MediaQuery.of(context).size.width * 0.8,
padding: EdgeInsets.all(10), padding: EdgeInsets.all(10),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Color(0xFF2B353E), color: Color(0xFF2B353E),
@ -128,8 +132,8 @@ class DoctorReplayChat extends StatelessWidget {
children: [ children: [
Container( Container(
margin: EdgeInsets.only(top: 5), margin: EdgeInsets.only(top: 5),
width: 60, width: 50,
height: 60, height: 50,
child: Image.asset( child: Image.asset(
reply.gender == 1 reply.gender == 1
? 'assets/images/male_avatar.png' ? 'assets/images/male_avatar.png'
@ -140,7 +144,7 @@ class DoctorReplayChat extends StatelessWidget {
Divider(), Divider(),
SizedBox(width: 10,), SizedBox(width: 10,),
Container( Container(
width: MediaQuery.of(context).size.width * 0.35, width: MediaQuery.of(context).size.width * 0.31,
child: AppText( child: AppText(
reply.patientName reply.patientName
.toString(), .toString(),
@ -152,7 +156,7 @@ class DoctorReplayChat extends StatelessWidget {
), ),
), ),
Container( Container(
margin: EdgeInsets.symmetric(horizontal: 4), margin: EdgeInsets.symmetric(horizontal: 0),
child: InkWell( child: InkWell(
onTap: () { onTap: () {
launch("tel://" +reply.mobileNumber); launch("tel://" +reply.mobileNumber);
@ -172,7 +176,7 @@ class DoctorReplayChat extends StatelessWidget {
AppText( AppText(
reply.createdOn !=null?AppDateUtils.getDayMonthYearDateFormatted(AppDateUtils.getDateTimeFromServerFormat(reply.createdOn)):AppDateUtils.getDayMonthYearDateFormatted(DateTime.now()), reply.createdOn !=null?AppDateUtils.getDayMonthYearDateFormatted(AppDateUtils.getDateTimeFromServerFormat(reply.createdOn)):AppDateUtils.getDayMonthYearDateFormatted(DateTime.now()),
fontWeight: FontWeight fontWeight: FontWeight
.w600, .w500,
color: Colors.white, color: Colors.white,
fontSize: 14, fontSize: 14,
), ),
@ -217,6 +221,113 @@ class DoctorReplayChat extends StatelessWidget {
), ),
), ),
SizedBox(height: 30,), SizedBox(height: 30,),
SizedBox(height: 30,),
Align(
alignment: Alignment.centerRight,
child: Container(
// color: Color(0xFF2B353E),
width: MediaQuery.of(context).size.width * 0.8,
padding: EdgeInsets.all(10),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(
Radius.circular(10.0),
),
border: Border.all(
color: HexColor('#707070') ,
width: 0.30),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.end,
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Container(
margin: EdgeInsets.only(top: 5),
width: 50,
height: 50,
child: Image.asset(
previousModel.doctorProfile.gender == 0
? 'assets/images/male_avatar.png'
: 'assets/images/female_avatar.png',
fit: BoxFit.cover,
),
),
Divider(),
SizedBox(width: 10,),
Container(
width: MediaQuery.of(context).size.width * 0.35,
child: AppText(
previousModel.doctorProfile.doctorName,
fontSize: 14,
fontFamily: 'Poppins',
color: Color(0xFF2B353E),
fontWeight: FontWeight.bold,
// fontSize: 18
),
),
],
),
Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
AppText(
reply.createdOn !=null?AppDateUtils.getDayMonthYearDateFormatted(AppDateUtils.getDateTimeFromServerFormat(reply.createdOn)):AppDateUtils.getDayMonthYearDateFormatted(DateTime.now()),
fontWeight: FontWeight
.w500,
color: Color(0xFF2B353E),
fontSize: 14,
),
AppText(
reply.createdOn !=null?AppDateUtils.getHour(AppDateUtils.getDateTimeFromServerFormat(reply.createdOn)):AppDateUtils.getHour(DateTime.now()),
fontSize: 14,
fontFamily: 'Poppins',
color: Color(0xFF2B353E),
// fontSize: 18
),
],
),
],
),
SizedBox(
height: 10,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Column(
children: [
Padding(
padding: const EdgeInsets.all(8.0),
child: Container(
width: MediaQuery.of(context).size.width * 0.7,
child: AppText(
reply.doctorResponse,
fontSize: 15,
fontFamily: 'Poppins',
color: Color(0xFF2B353E),
// fontSize: 18
),
),
),
],
),
],
),
],
),
),
),
], ],
), ),
), ),
@ -248,9 +359,9 @@ class DoctorReplayChat extends StatelessWidget {
suffixIconColor: Colors.green, suffixIconColor: Colors.green,
onSuffixTap: ()async { onSuffixTap: ()async {
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context);
await model.createDoctorResponse(msgController.text, reply); await previousModel.createDoctorResponse(msgController.text, reply);
if(model.state == ViewState.ErrorLocal) { if(previousModel.state == ViewState.ErrorLocal) {
Helpers.showErrorToast(model.error); Helpers.showErrorToast(previousModel.error);
} else { } else {
DrAppToastMsg.showSuccesToast("Thank you for your replay "); DrAppToastMsg.showSuccesToast("Thank you for your replay ");
await previousModel.getDoctorReply(); await previousModel.getDoctorReply();
@ -263,7 +374,7 @@ class DoctorReplayChat extends StatelessWidget {
}, },
// hintColor: Colors.black, // hintColor: Colors.black,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w500,
maxLines: 50, maxLines: 50,
minLines: 3, minLines: 3,
controller: msgController, controller: msgController,

Loading…
Cancel
Save