finish plan page

pull/209/head
Elham Rababah 5 years ago
parent d8ac550357
commit 4caf40a2ab

@ -3,6 +3,8 @@ import 'package:doctor_app_flutter/models/SOAP/ChiefComplaint/GetChiefComplaintR
import 'package:doctor_app_flutter/models/SOAP/ChiefComplaint/GetChiefComplaintResModel.dart'; import 'package:doctor_app_flutter/models/SOAP/ChiefComplaint/GetChiefComplaintResModel.dart';
import 'package:doctor_app_flutter/models/SOAP/GeneralGetReqForSOAP.dart'; import 'package:doctor_app_flutter/models/SOAP/GeneralGetReqForSOAP.dart';
import 'package:doctor_app_flutter/models/SOAP/GetAllergiesResModel.dart'; import 'package:doctor_app_flutter/models/SOAP/GetAllergiesResModel.dart';
import 'package:doctor_app_flutter/models/SOAP/GetGetProgressNoteReqModel.dart';
import 'package:doctor_app_flutter/models/SOAP/GetGetProgressNoteResModel.dart';
import 'package:doctor_app_flutter/models/SOAP/GetHistoryReqModel.dart'; import 'package:doctor_app_flutter/models/SOAP/GetHistoryReqModel.dart';
import 'package:doctor_app_flutter/models/SOAP/GetHistoryResModel.dart'; import 'package:doctor_app_flutter/models/SOAP/GetHistoryResModel.dart';
import 'package:doctor_app_flutter/models/SOAP/GetPhysicalExamListResModel.dart'; import 'package:doctor_app_flutter/models/SOAP/GetPhysicalExamListResModel.dart';
@ -24,6 +26,7 @@ class SOAPService extends LookupService {
List<GetAllergiesResModel> patientAllergiesList = []; List<GetAllergiesResModel> patientAllergiesList = [];
List<GetHistoryResModel> patientHistoryList = []; List<GetHistoryResModel> patientHistoryList = [];
List<GetPhysicalExamResModel> patientPhysicalExamList = []; List<GetPhysicalExamResModel> patientPhysicalExamList = [];
List<GetGetProgressNoteResModel> patientProgressNoteList = [];
Future getAllergies(GetAllergiesRequestModel getAllergiesRequestModel) async { Future getAllergies(GetAllergiesRequestModel getAllergiesRequestModel) async {
await baseAppClient.post( await baseAppClient.post(
@ -246,6 +249,7 @@ class SOAPService extends LookupService {
response['PhysicalExamList']['entityList'].forEach((v) { response['PhysicalExamList']['entityList'].forEach((v) {
patientPhysicalExamList.add(GetPhysicalExamResModel.fromJson(v)); patientPhysicalExamList.add(GetPhysicalExamResModel.fromJson(v));
}); });
}, onFailure: (String error, int statusCode) { }, onFailure: (String error, int statusCode) {
hasError = true; hasError = true;
super.error = error; super.error = error;
@ -253,15 +257,19 @@ class SOAPService extends LookupService {
} }
Future getPatientProgressNote( Future getPatientProgressNote(
PostProgressNoteRequestModel getPatientProgressNoteRequestModel) async { GetGetProgressNoteReqModel getGetProgressNoteReqModel) async {
hasError = false; hasError = false;
await baseAppClient.post (GET_PROGRESS_NOTE, await baseAppClient.post (GET_PROGRESS_NOTE,
onSuccess: (dynamic response, int statusCode) { onSuccess: (dynamic response, int statusCode) {
print("Success"); print("Success");
patientProgressNoteList.clear();
response['ProgressNoteList']['entityList'].forEach((v) {
patientProgressNoteList.add(GetGetProgressNoteResModel.fromJson(v));
});
}, onFailure: (String error, int statusCode) { }, onFailure: (String error, int statusCode) {
hasError = true; hasError = true;
super.error = error; super.error = error;
}, body: getPatientProgressNoteRequestModel.toJson()); }, body: getGetProgressNoteReqModel.toJson());
} }
Future getPatientAssessment( Future getPatientAssessment(

@ -5,6 +5,8 @@ import 'package:doctor_app_flutter/models/SOAP/ChiefComplaint/GetChiefComplaintR
import 'package:doctor_app_flutter/models/SOAP/ChiefComplaint/GetChiefComplaintResModel.dart'; import 'package:doctor_app_flutter/models/SOAP/ChiefComplaint/GetChiefComplaintResModel.dart';
import 'package:doctor_app_flutter/models/SOAP/GeneralGetReqForSOAP.dart'; import 'package:doctor_app_flutter/models/SOAP/GeneralGetReqForSOAP.dart';
import 'package:doctor_app_flutter/models/SOAP/GetAllergiesResModel.dart'; import 'package:doctor_app_flutter/models/SOAP/GetAllergiesResModel.dart';
import 'package:doctor_app_flutter/models/SOAP/GetGetProgressNoteReqModel.dart';
import 'package:doctor_app_flutter/models/SOAP/GetGetProgressNoteResModel.dart';
import 'package:doctor_app_flutter/models/SOAP/GetHistoryReqModel.dart'; import 'package:doctor_app_flutter/models/SOAP/GetHistoryReqModel.dart';
import 'package:doctor_app_flutter/models/SOAP/GetHistoryResModel.dart'; import 'package:doctor_app_flutter/models/SOAP/GetHistoryResModel.dart';
import 'package:doctor_app_flutter/models/SOAP/GetPhysicalExamListResModel.dart'; import 'package:doctor_app_flutter/models/SOAP/GetPhysicalExamListResModel.dart';
@ -67,6 +69,9 @@ class SOAPViewModel extends BaseViewModel {
List<GetPhysicalExamResModel> get patientPhysicalExamList => List<GetPhysicalExamResModel> get patientPhysicalExamList =>
_SOAPService.patientPhysicalExamList; _SOAPService.patientPhysicalExamList;
List<GetGetProgressNoteResModel> get patientProgressNoteList =>
_SOAPService.patientProgressNoteList;
Future getAllergies(GetAllergiesRequestModel getAllergiesRequestModel) async { Future getAllergies(GetAllergiesRequestModel getAllergiesRequestModel) async {
setState(ViewState.Busy); setState(ViewState.Busy);
await _SOAPService.getAllergies(getAllergiesRequestModel); await _SOAPService.getAllergies(getAllergiesRequestModel);
@ -245,17 +250,17 @@ class SOAPViewModel extends BaseViewModel {
await _SOAPService.getPatientPhysicalExam(getPhysicalExamReqModel); await _SOAPService.getPatientPhysicalExam(getPhysicalExamReqModel);
if (_SOAPService.hasError) { if (_SOAPService.hasError) {
error = _SOAPService.error; error = _SOAPService.error;
setState(ViewState.Busy); setState(ViewState.Error);
} else } else
setState(ViewState.Idle); setState(ViewState.Idle);
} }
Future getPatientProgressNote(PostProgressNoteRequestModel getPatientProgressNoteRequestModel) async { Future getPatientProgressNote(GetGetProgressNoteReqModel getGetProgressNoteReqModel) async {
setState(ViewState.Busy); setState(ViewState.Busy);
await _SOAPService.getPatientProgressNote(getPatientProgressNoteRequestModel); await _SOAPService.getPatientProgressNote(getGetProgressNoteReqModel);
if (_SOAPService.hasError) { if (_SOAPService.hasError) {
error = _SOAPService.error; error = _SOAPService.error;
setState(ViewState.Busy); setState(ViewState.Error);
} else } else
setState(ViewState.Idle); setState(ViewState.Idle);
} }

@ -0,0 +1,40 @@
class GetGetProgressNoteReqModel {
int patientMRN;
int appointmentNo;
String episodeID;
String from;
String to;
int clinicID;
int doctorID;
GetGetProgressNoteReqModel(
{this.patientMRN,
this.appointmentNo,
this.episodeID,
this.from,
this.to,
this.clinicID,
this.doctorID});
GetGetProgressNoteReqModel.fromJson(Map<String, dynamic> json) {
patientMRN = json['PatientMRN'];
appointmentNo = json['AppointmentNo'];
episodeID = json['EpisodeID'];
from = json['From'];
to = json['To'];
clinicID = json['ClinicID'];
doctorID = json['DoctorID'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['PatientMRN'] = this.patientMRN;
data['AppointmentNo'] = this.appointmentNo;
data['EpisodeID'] = this.episodeID;
data['From'] = this.from;
data['To'] = this.to;
data['ClinicID'] = this.clinicID;
data['DoctorID'] = this.doctorID;
return data;
}
}

@ -0,0 +1,25 @@
class GetGetProgressNoteResModel {
int appointmentNo;
int episodeId;
int patientMRN;
String planNote;
GetGetProgressNoteResModel(
{this.appointmentNo, this.episodeId, this.patientMRN, this.planNote});
GetGetProgressNoteResModel.fromJson(Map<String, dynamic> json) {
appointmentNo = json['appointmentNo'];
episodeId = json['episodeId'];
patientMRN = json['patientMRN'];
planNote = json['planNote'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['appointmentNo'] = this.appointmentNo;
data['episodeId'] = this.episodeId;
data['patientMRN'] = this.patientMRN;
data['planNote'] = this.planNote;
return data;
}
}

@ -83,6 +83,8 @@ class _UpdateObjectivePageState extends State<UpdateObjectivePage> {
}, },
builder: (_, model, w) => AppScaffold( builder: (_, model, w) => AppScaffold(
isShowAppBar: false, isShowAppBar: false,
//TODO: retrun it back
// baseViewModel: model,
body: SingleChildScrollView( body: SingleChildScrollView(
physics: ScrollPhysics(), physics: ScrollPhysics(),
child: Center( child: Center(

@ -2,6 +2,7 @@ import 'package:doctor_app_flutter/client/base_app_client.dart';
import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/config/config.dart';
import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/enum/viewstate.dart';
import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart';
import 'package:doctor_app_flutter/models/SOAP/GetGetProgressNoteReqModel.dart';
import 'package:doctor_app_flutter/models/SOAP/post_progress_note_request_model.dart'; import 'package:doctor_app_flutter/models/SOAP/post_progress_note_request_model.dart';
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart';
@ -53,8 +54,21 @@ class _UpdatePlanPageState extends State<UpdatePlanPage> {
final screenSize = MediaQuery.of(context).size; final screenSize = MediaQuery.of(context).size;
return BaseView<SOAPViewModel>( return BaseView<SOAPViewModel>(
// onModelReady: (model) => model.getMasterLookup(MasterKeysService.Allergies), onModelReady: (model) async {
GetGetProgressNoteReqModel getGetProgressNoteReqModel =
GetGetProgressNoteReqModel(
appointmentNo: widget.patientInfo.appointmentNo,
patientMRN: widget.patientInfo.patientMRN,
episodeID: widget.patientInfo.episodeNo.toString());
await model.getPatientProgressNote(getGetProgressNoteReqModel);
if (model.patientProgressNoteList.isNotEmpty) {
progressNoteController.text =
model.patientProgressNoteList[0].planNote;
}
},
builder: (_, model, w) => AppScaffold( builder: (_, model, w) => AppScaffold(
baseViewModel: model,
isShowAppBar: false, isShowAppBar: false,
body: SingleChildScrollView( body: SingleChildScrollView(
physics: ScrollPhysics(), physics: ScrollPhysics(),
@ -74,8 +88,7 @@ class _UpdatePlanPageState extends State<UpdatePlanPage> {
Row( Row(
children: [ children: [
Texts('Progress Note', Texts('Progress Note',
variant: variant: isProgressNoteExpand ? "bodyText" : '',
isProgressNoteExpand ? "bodyText" : '',
bold: isProgressNoteExpand ? true : false, bold: isProgressNoteExpand ? true : false,
color: Colors.black), color: Colors.black),
Icon( Icon(
@ -88,8 +101,7 @@ class _UpdatePlanPageState extends State<UpdatePlanPage> {
InkWell( InkWell(
onTap: () { onTap: () {
setState(() { setState(() {
isProgressNoteExpand = isProgressNoteExpand = !isProgressNoteExpand;
!isProgressNoteExpand;
}); });
}, },
child: Icon(isProgressNoteExpand child: Icon(isProgressNoteExpand
@ -105,7 +117,7 @@ class _UpdatePlanPageState extends State<UpdatePlanPage> {
children: [ children: [
Container( Container(
margin: margin:
EdgeInsets.only(left: 10, right: 10, top: 15), EdgeInsets.only(left: 10, right: 10, top: 15),
child: TextFields( child: TextFields(
hintText: "Add Progress Note", hintText: "Add Progress Note",
fontSize: 13.5, fontSize: 13.5,
@ -120,8 +132,7 @@ class _UpdatePlanPageState extends State<UpdatePlanPage> {
// controller: messageController, // controller: messageController,
validator: (value) { validator: (value) {
if (value == null) if (value == null)
return TranslationBase return TranslationBase.of(context)
.of(context)
.emptyMessage; .emptyMessage;
else else
return null; return null;
@ -133,10 +144,10 @@ class _UpdatePlanPageState extends State<UpdatePlanPage> {
if (progressNoteController.text.isNotEmpty) if (progressNoteController.text.isNotEmpty)
Container( Container(
margin: margin:
EdgeInsets.only(left: 5, right: 5, top: 15), EdgeInsets.only(left: 5, right: 5, top: 15),
child: Row( child: Row(
mainAxisAlignment: mainAxisAlignment:
MainAxisAlignment.spaceBetween, MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Column( Column(
@ -144,9 +155,9 @@ class _UpdatePlanPageState extends State<UpdatePlanPage> {
children: [ children: [
Column( Column(
mainAxisAlignment: mainAxisAlignment:
MainAxisAlignment.start, MainAxisAlignment.start,
crossAxisAlignment: crossAxisAlignment:
CrossAxisAlignment.start, CrossAxisAlignment.start,
children: [ children: [
AppText( AppText(
"12".toUpperCase(), "12".toUpperCase(),
@ -163,13 +174,12 @@ class _UpdatePlanPageState extends State<UpdatePlanPage> {
], ],
), ),
Column( Column(
crossAxisAlignment: CrossAxisAlignment crossAxisAlignment:
.start, CrossAxisAlignment.start,
children: [ children: [
Row( Row(
mainAxisAlignment: mainAxisAlignment:
MainAxisAlignment.start, MainAxisAlignment.start,
children: [ children: [
SizedBox( SizedBox(
height: 6, height: 6,
@ -177,25 +187,25 @@ class _UpdatePlanPageState extends State<UpdatePlanPage> {
Padding( Padding(
padding: const EdgeInsets.all(0.0), padding: const EdgeInsets.all(0.0),
child: Container( child: Container(
width: MediaQuery width: MediaQuery.of(context)
.of(context) .size
.size .width *
.width * 0.6, 0.6,
child: AppText( child: AppText(
progressNoteController.text, progressNoteController.text,
fontSize: 10, fontSize: 10,
color: Colors.grey, color: Colors.grey,
), ),
), ),
), ),
], ],
), SizedBox( ),
SizedBox(
height: 8, height: 8,
), ),
Row( Row(
mainAxisAlignment: mainAxisAlignment:
MainAxisAlignment.start, MainAxisAlignment.start,
children: [ children: [
AppText( AppText(
"Created By : ", "Created By : ",
@ -211,7 +221,7 @@ class _UpdatePlanPageState extends State<UpdatePlanPage> {
), ),
Row( Row(
mainAxisAlignment: mainAxisAlignment:
MainAxisAlignment.start, MainAxisAlignment.start,
children: [ children: [
AppText( AppText(
"Edited By : ", "Edited By : ",
@ -225,7 +235,6 @@ class _UpdatePlanPageState extends State<UpdatePlanPage> {
), ),
], ],
), ),
], ],
), ),
Column( Column(
@ -246,14 +255,13 @@ class _UpdatePlanPageState extends State<UpdatePlanPage> {
]), ]),
isExpand: isProgressNoteExpand, isExpand: isProgressNoteExpand,
), ),
DividerWithSpacesAround(height: 30,), DividerWithSpacesAround(
height: 30,
),
AppButton( AppButton(
title: TranslationBase title: TranslationBase.of(context).next,
.of(context)
.next,
loading: model.state == ViewState.BusyLocal, loading: model.state == ViewState.BusyLocal,
onPressed: () { onPressed: () {
submitPlan(model); submitPlan(model);
// widget.changePageViewIndex(2); // widget.changePageViewIndex(2);
}, },
@ -265,7 +273,9 @@ class _UpdatePlanPageState extends State<UpdatePlanPage> {
), ),
), ),
), ),
),),); ),
),
);
} }
submitPlan(SOAPViewModel model) async { submitPlan(SOAPViewModel model) async {
@ -276,8 +286,13 @@ class _UpdatePlanPageState extends State<UpdatePlanPage> {
appointmentNo: widget.patientInfo.appointmentNo, appointmentNo: widget.patientInfo.appointmentNo,
planNote: progressNoteController.text); planNote: progressNoteController.text);
if(model.patientProgressNoteList.isEmpty){
await model.postProgressNote(postProgressNoteRequestModel);
}else {
await model.patchProgressNote(postProgressNoteRequestModel);
await model.patchProgressNote(postProgressNoteRequestModel); }
if (model.state == ViewState.ErrorLocal) { if (model.state == ViewState.ErrorLocal) {
helpers.showErrorToast(model.error); helpers.showErrorToast(model.error);

Loading…
Cancel
Save