Merge branch 'development' of https://gitlab.com/Cloud_Solution/doctor_app_flutter into in_patient_services
Conflicts: lib/widgets/patients/profile/profile_medical_info_widget_in_patient.dartmerge-requests/540/head
commit
e3102b3f5e
@ -0,0 +1,88 @@
|
||||
class CreateNoteModel {
|
||||
int visitType;
|
||||
int admissionNo;
|
||||
int projectID;
|
||||
int patientTypeID;
|
||||
int patientID;
|
||||
int clinicID;
|
||||
String notes;
|
||||
int createdBy;
|
||||
int editedBy;
|
||||
String nursingRemarks;
|
||||
int languageID;
|
||||
String stamp;
|
||||
String iPAdress;
|
||||
double versionID;
|
||||
int channel;
|
||||
String tokenID;
|
||||
String sessionID;
|
||||
bool isLoginForDoctorApp;
|
||||
bool patientOutSA;
|
||||
|
||||
CreateNoteModel(
|
||||
{this.visitType,
|
||||
this.admissionNo,
|
||||
this.projectID,
|
||||
this.patientTypeID,
|
||||
this.patientID,
|
||||
this.clinicID,
|
||||
this.notes,
|
||||
this.createdBy,
|
||||
this.editedBy,
|
||||
this.nursingRemarks,
|
||||
this.languageID,
|
||||
this.stamp,
|
||||
this.iPAdress,
|
||||
this.versionID,
|
||||
this.channel,
|
||||
this.tokenID,
|
||||
this.sessionID,
|
||||
this.isLoginForDoctorApp,
|
||||
this.patientOutSA});
|
||||
|
||||
CreateNoteModel.fromJson(Map<String, dynamic> json) {
|
||||
visitType = json['VisitType'];
|
||||
admissionNo = json['AdmissionNo'];
|
||||
projectID = json['ProjectID'];
|
||||
patientTypeID = json['PatientTypeID'];
|
||||
patientID = json['PatientID'];
|
||||
clinicID = json['ClinicID'];
|
||||
notes = json['Notes'];
|
||||
createdBy = json['CreatedBy'];
|
||||
editedBy = json['EditedBy'];
|
||||
nursingRemarks = json['NursingRemarks'];
|
||||
languageID = json['LanguageID'];
|
||||
stamp = json['stamp'];
|
||||
iPAdress = json['IPAdress'];
|
||||
versionID = json['VersionID'];
|
||||
channel = json['Channel'];
|
||||
tokenID = json['TokenID'];
|
||||
sessionID = json['SessionID'];
|
||||
isLoginForDoctorApp = json['IsLoginForDoctorApp'];
|
||||
patientOutSA = json['PatientOutSA'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['VisitType'] = this.visitType;
|
||||
data['AdmissionNo'] = this.admissionNo;
|
||||
data['ProjectID'] = this.projectID;
|
||||
data['PatientTypeID'] = this.patientTypeID;
|
||||
data['PatientID'] = this.patientID;
|
||||
data['ClinicID'] = this.clinicID;
|
||||
data['Notes'] = this.notes;
|
||||
data['CreatedBy'] = this.createdBy;
|
||||
data['EditedBy'] = this.editedBy;
|
||||
data['NursingRemarks'] = this.nursingRemarks;
|
||||
data['LanguageID'] = this.languageID;
|
||||
data['stamp'] = this.stamp;
|
||||
data['IPAdress'] = this.iPAdress;
|
||||
data['VersionID'] = this.versionID;
|
||||
data['Channel'] = this.channel;
|
||||
data['TokenID'] = this.tokenID;
|
||||
data['SessionID'] = this.sessionID;
|
||||
data['IsLoginForDoctorApp'] = this.isLoginForDoctorApp;
|
||||
data['PatientOutSA'] = this.patientOutSA;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,92 @@
|
||||
class NoteModel {
|
||||
String setupID;
|
||||
int projectID;
|
||||
int patientID;
|
||||
int patientType;
|
||||
String admissionNo;
|
||||
int lineItemNo;
|
||||
int visitType;
|
||||
String notes;
|
||||
String assessmentDate;
|
||||
String visitTime;
|
||||
int status;
|
||||
String nursingRemarks;
|
||||
String createdOn;
|
||||
String editedOn;
|
||||
int createdBy;
|
||||
int admissionClinicID;
|
||||
String admissionClinicName;
|
||||
Null doctorClinicName;
|
||||
String doctorName;
|
||||
String visitTypeDesc;
|
||||
|
||||
NoteModel(
|
||||
{this.setupID,
|
||||
this.projectID,
|
||||
this.patientID,
|
||||
this.patientType,
|
||||
this.admissionNo,
|
||||
this.lineItemNo,
|
||||
this.visitType,
|
||||
this.notes,
|
||||
this.assessmentDate,
|
||||
this.visitTime,
|
||||
this.status,
|
||||
this.nursingRemarks,
|
||||
this.createdOn,
|
||||
this.editedOn,
|
||||
this.createdBy,
|
||||
this.admissionClinicID,
|
||||
this.admissionClinicName,
|
||||
this.doctorClinicName,
|
||||
this.doctorName,
|
||||
this.visitTypeDesc});
|
||||
|
||||
NoteModel.fromJson(Map<String, dynamic> json) {
|
||||
setupID = json['SetupID'];
|
||||
projectID = json['ProjectID'];
|
||||
patientID = json['PatientID'];
|
||||
patientType = json['PatientType'];
|
||||
admissionNo = json['AdmissionNo'];
|
||||
lineItemNo = json['LineItemNo'];
|
||||
visitType = json['VisitType'];
|
||||
notes = json['Notes'];
|
||||
assessmentDate = json['AssessmentDate'];
|
||||
visitTime = json['VisitTime'];
|
||||
status = json['Status'];
|
||||
nursingRemarks = json['NursingRemarks'];
|
||||
createdOn = json['CreatedOn'];
|
||||
editedOn = json['EditedOn'];
|
||||
createdBy = json['CreatedBy'];
|
||||
admissionClinicID = json['AdmissionClinicID'];
|
||||
admissionClinicName = json['AdmissionClinicName'];
|
||||
doctorClinicName = json['DoctorClinicName'];
|
||||
doctorName = json['DoctorName'];
|
||||
visitTypeDesc = json['VisitTypeDesc'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['SetupID'] = this.setupID;
|
||||
data['ProjectID'] = this.projectID;
|
||||
data['PatientID'] = this.patientID;
|
||||
data['PatientType'] = this.patientType;
|
||||
data['AdmissionNo'] = this.admissionNo;
|
||||
data['LineItemNo'] = this.lineItemNo;
|
||||
data['VisitType'] = this.visitType;
|
||||
data['Notes'] = this.notes;
|
||||
data['AssessmentDate'] = this.assessmentDate;
|
||||
data['VisitTime'] = this.visitTime;
|
||||
data['Status'] = this.status;
|
||||
data['NursingRemarks'] = this.nursingRemarks;
|
||||
data['CreatedOn'] = this.createdOn;
|
||||
data['EditedOn'] = this.editedOn;
|
||||
data['CreatedBy'] = this.createdBy;
|
||||
data['AdmissionClinicID'] = this.admissionClinicID;
|
||||
data['AdmissionClinicName'] = this.admissionClinicName;
|
||||
data['DoctorClinicName'] = this.doctorClinicName;
|
||||
data['DoctorName'] = this.doctorName;
|
||||
data['VisitTypeDesc'] = this.visitTypeDesc;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,80 @@
|
||||
class UpdateNoteReqModel {
|
||||
int projectID;
|
||||
int createdBy;
|
||||
int admissionNo;
|
||||
int lineItemNo;
|
||||
String notes;
|
||||
bool verifiedNote;
|
||||
bool cancelledNote;
|
||||
int languageID;
|
||||
String stamp;
|
||||
String iPAdress;
|
||||
double versionID;
|
||||
int channel;
|
||||
String tokenID;
|
||||
String sessionID;
|
||||
bool isLoginForDoctorApp;
|
||||
bool patientOutSA;
|
||||
int patientTypeID;
|
||||
|
||||
UpdateNoteReqModel(
|
||||
{this.projectID,
|
||||
this.createdBy,
|
||||
this.admissionNo,
|
||||
this.lineItemNo,
|
||||
this.notes,
|
||||
this.verifiedNote,
|
||||
this.cancelledNote,
|
||||
this.languageID,
|
||||
this.stamp,
|
||||
this.iPAdress,
|
||||
this.versionID,
|
||||
this.channel,
|
||||
this.tokenID,
|
||||
this.sessionID,
|
||||
this.isLoginForDoctorApp,
|
||||
this.patientOutSA,
|
||||
this.patientTypeID});
|
||||
|
||||
UpdateNoteReqModel.fromJson(Map<String, dynamic> json) {
|
||||
projectID = json['ProjectID'];
|
||||
createdBy = json['CreatedBy'];
|
||||
admissionNo = json['AdmissionNo'];
|
||||
lineItemNo = json['LineItemNo'];
|
||||
notes = json['Notes'];
|
||||
verifiedNote = json['VerifiedNote'];
|
||||
cancelledNote = json['CancelledNote'];
|
||||
languageID = json['LanguageID'];
|
||||
stamp = json['stamp'];
|
||||
iPAdress = json['IPAdress'];
|
||||
versionID = json['VersionID'];
|
||||
channel = json['Channel'];
|
||||
tokenID = json['TokenID'];
|
||||
sessionID = json['SessionID'];
|
||||
isLoginForDoctorApp = json['IsLoginForDoctorApp'];
|
||||
patientOutSA = json['PatientOutSA'];
|
||||
patientTypeID = json['PatientTypeID'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['ProjectID'] = this.projectID;
|
||||
data['CreatedBy'] = this.createdBy;
|
||||
data['AdmissionNo'] = this.admissionNo;
|
||||
data['LineItemNo'] = this.lineItemNo;
|
||||
data['Notes'] = this.notes;
|
||||
data['VerifiedNote'] = this.verifiedNote;
|
||||
data['CancelledNote'] = this.cancelledNote;
|
||||
data['LanguageID'] = this.languageID;
|
||||
data['stamp'] = this.stamp;
|
||||
data['IPAdress'] = this.iPAdress;
|
||||
data['VersionID'] = this.versionID;
|
||||
data['Channel'] = this.channel;
|
||||
data['TokenID'] = this.tokenID;
|
||||
data['SessionID'] = this.sessionID;
|
||||
data['IsLoginForDoctorApp'] = this.isLoginForDoctorApp;
|
||||
data['PatientOutSA'] = this.patientOutSA;
|
||||
data['PatientTypeID'] = this.patientTypeID;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,278 @@
|
||||
import 'package:doctor_app_flutter/core/model/note/note_model.dart';
|
||||
import 'package:doctor_app_flutter/core/viewModel/patient_view_model.dart';
|
||||
import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart';
|
||||
import 'package:doctor_app_flutter/models/patient/progress_note_request.dart';
|
||||
import 'package:doctor_app_flutter/screens/base/base_view.dart';
|
||||
import 'package:doctor_app_flutter/screens/patients/profile/note/update_note.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/profile/add-order/addNewOrder.dart';
|
||||
import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-header-new-design-app-bar.dart';
|
||||
import 'package:doctor_app_flutter/widgets/patients/profile/patient_profile_header_with_appointment_card_app_bar.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/errors/dr_app_embedded_error.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hexcolor/hexcolor.dart';
|
||||
|
||||
import '../../../../config/shared_pref_kay.dart';
|
||||
import '../../../../config/size_config.dart';
|
||||
import '../../../../models/patient/patiant_info_model.dart';
|
||||
import '../../../../util/dr_app_shared_pref.dart';
|
||||
import '../../../../widgets/shared/app_scaffold_widget.dart';
|
||||
import '../../../../widgets/shared/app_texts_widget.dart';
|
||||
|
||||
DrAppSharedPreferances sharedPref = new DrAppSharedPreferances();
|
||||
|
||||
class ProgressNoteScreen extends StatefulWidget {
|
||||
final int visitType;
|
||||
|
||||
const ProgressNoteScreen({Key key, this.visitType}) : super(key: key);
|
||||
|
||||
@override
|
||||
_ProgressNoteState createState() => _ProgressNoteState();
|
||||
}
|
||||
|
||||
class _ProgressNoteState extends State<ProgressNoteScreen> {
|
||||
List<NoteModel> notesList;
|
||||
var filteredNotesList;
|
||||
final _controller = TextEditingController();
|
||||
var _isInit = true;
|
||||
|
||||
getProgressNoteList(BuildContext context, PatientViewModel model) async {
|
||||
final routeArgs = ModalRoute.of(context).settings.arguments as Map;
|
||||
PatiantInformtion patient = routeArgs['patient'];
|
||||
String token = await sharedPref.getString(TOKEN);
|
||||
String type = await sharedPref.getString(SLECTED_PATIENT_TYPE);
|
||||
|
||||
print(type);
|
||||
ProgressNoteRequest progressNoteRequest = ProgressNoteRequest(
|
||||
visitType: widget.visitType,
|
||||
// if equal 5 then this will return progress note
|
||||
admissionNo: int.parse(patient.admissionNo),
|
||||
projectID: patient.projectId,
|
||||
tokenID: token,
|
||||
patientTypeID: patient.patientType,
|
||||
languageID: 2);
|
||||
model.getPatientProgressNote(progressNoteRequest.toJson()).then((c) {
|
||||
notesList = model.patientProgressNoteList;
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final routeArgs = ModalRoute.of(context).settings.arguments as Map;
|
||||
PatiantInformtion patient = routeArgs['patient'];
|
||||
String arrivalType = routeArgs['arrivalType'];
|
||||
return BaseView<PatientViewModel>(
|
||||
onModelReady: (model) => getProgressNoteList(context, model),
|
||||
builder: (_, model, w) => AppScaffold(
|
||||
baseViewModel: model,
|
||||
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
|
||||
// appBarTitle: TranslationBase.of(context).progressNote,
|
||||
appBar: PatientProfileHeaderNewDesignAppBar(
|
||||
patient, patient.patientType.toString() ?? '0', arrivalType),
|
||||
body: notesList == null || notesList.length == 0
|
||||
? DrAppEmbeddedError(
|
||||
error: TranslationBase.of(context).errorNoProgressNote)
|
||||
: Container(
|
||||
color: Colors.grey[200],
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
AddNewOrder( onTap: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => UpdateNoteOrder(
|
||||
patientModel: model,
|
||||
patient: patient,
|
||||
visitType: widget.visitType,
|
||||
isUpdate: false,
|
||||
)),
|
||||
);
|
||||
},label: 'Add a New Order',),
|
||||
Expanded(
|
||||
child: Container(
|
||||
|
||||
child: ListView.builder(
|
||||
itemCount: notesList.length,
|
||||
itemBuilder: (BuildContext ctxt, int index) {
|
||||
return Column(
|
||||
children: [
|
||||
Container(
|
||||
margin: EdgeInsets.only(
|
||||
left: 10,
|
||||
right: 10,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
padding: EdgeInsets.all(15),
|
||||
child: Column(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceBetween,
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
|
||||
Container(
|
||||
width: MediaQuery.of(context).size.width * 0.65,
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Container(
|
||||
|
||||
child: AppText('Created By: ',
|
||||
fontSize: 12,
|
||||
),
|
||||
margin: EdgeInsets.only(top: 3),
|
||||
),
|
||||
Expanded(
|
||||
child: AppText(
|
||||
notesList[index].doctorName??'',fontWeight: FontWeight.w600),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Column(
|
||||
children: [
|
||||
AppText(
|
||||
notesList[index]
|
||||
.createdOn !=
|
||||
null
|
||||
? DateUtils
|
||||
.getDayMonthYearDateFormatted(
|
||||
DateUtils.getDateTimeFromServerFormat(notesList[index].createdOn))
|
||||
: DateUtils
|
||||
.getDayMonthYearDateFormatted(
|
||||
DateTime.now()),
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 14,
|
||||
),
|
||||
AppText(
|
||||
notesList[index]
|
||||
.createdOn !=
|
||||
null
|
||||
? DateUtils
|
||||
.getHour(
|
||||
DateUtils.getDateTimeFromServerFormat(notesList[index].createdOn ))
|
||||
: DateUtils
|
||||
.getHour(
|
||||
DateTime.now()),
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 14,
|
||||
),
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 8,
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.start,
|
||||
children: [
|
||||
Expanded(
|
||||
child: AppText(
|
||||
notesList[index].notes,
|
||||
fontSize: 10,
|
||||
),
|
||||
),
|
||||
InkWell(
|
||||
onTap: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => UpdateNoteOrder(
|
||||
note: notesList[index],
|
||||
patientModel: model,
|
||||
patient: patient,
|
||||
visitType: widget.visitType,
|
||||
isUpdate: true,
|
||||
|
||||
)),
|
||||
);
|
||||
},
|
||||
child: Icon(
|
||||
DoctorApp.edit,
|
||||
size: 18,
|
||||
))
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
|
||||
),
|
||||
],
|
||||
);
|
||||
}),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
InputDecoration buildInputDecoration(BuildContext context, hint) {
|
||||
return InputDecoration(
|
||||
prefixIcon: Icon(Icons.search, color: Colors.black),
|
||||
filled: true,
|
||||
fillColor: Colors.white,
|
||||
hintText: hint,
|
||||
hintStyle: TextStyle(fontSize: 2 * SizeConfig.textMultiplier),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.all(Radius.circular(10)),
|
||||
borderSide: BorderSide(color: HexColor('#CCCCCC')),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.all(Radius.circular(10.0)),
|
||||
borderSide: BorderSide(color: Colors.grey), //),
|
||||
));
|
||||
}
|
||||
|
||||
// searchData(String str, PatientViewModel model) {
|
||||
// var strExist = str.length > 0 ? true : false;
|
||||
//
|
||||
// if (strExist) {
|
||||
// filteredNotesList = null;
|
||||
// filteredNotesList = model.patientProgressNoteList
|
||||
// .where((note) =>
|
||||
// note["DoctorName"].toString().contains(str.toUpperCase()))
|
||||
// .toList();
|
||||
// setState(() {
|
||||
// notesList = filteredNotesList;
|
||||
// });
|
||||
// } else {
|
||||
// setState(() {
|
||||
// notesList = model.patientProgressNoteList;
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
|
||||
convertDateFormat(String str) {
|
||||
const start = "/Date(";
|
||||
const end = "+0300)";
|
||||
|
||||
final startIndex = str.indexOf(start);
|
||||
final endIndex = str.indexOf(end, startIndex + start.length);
|
||||
|
||||
var date = new DateTime.fromMillisecondsSinceEpoch(
|
||||
int.parse(str.substring(startIndex + start.length, endIndex)));
|
||||
String newDate = date.year.toString() +
|
||||
"-" +
|
||||
date.month.toString().padLeft(2, '0') +
|
||||
"-" +
|
||||
date.day.toString().padLeft(2, '0');
|
||||
|
||||
return newDate.toString();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,174 @@
|
||||
import 'package:doctor_app_flutter/config/shared_pref_kay.dart';
|
||||
import 'package:doctor_app_flutter/config/size_config.dart';
|
||||
import 'package:doctor_app_flutter/core/enum/viewstate.dart';
|
||||
import 'package:doctor_app_flutter/core/model/note/CreateNoteModel.dart';
|
||||
import 'package:doctor_app_flutter/core/model/note/note_model.dart';
|
||||
import 'package:doctor_app_flutter/core/model/note/update_note_model.dart';
|
||||
import 'package:doctor_app_flutter/core/viewModel/patient_view_model.dart';
|
||||
import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart';
|
||||
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
|
||||
import 'package:doctor_app_flutter/models/patient/progress_note_request.dart';
|
||||
import 'package:doctor_app_flutter/screens/base/base_view.dart';
|
||||
import 'package:doctor_app_flutter/screens/patients/profile/soap_update/shared_soap_widgets/bottom_sheet_title.dart';
|
||||
import 'package:doctor_app_flutter/util/helpers.dart';
|
||||
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class UpdateNoteOrder extends StatefulWidget {
|
||||
final NoteModel note;
|
||||
final PatientViewModel patientModel;
|
||||
final PatiantInformtion patient;
|
||||
final int visitType;
|
||||
final bool isUpdate;
|
||||
|
||||
const UpdateNoteOrder(
|
||||
{Key key, this.note, this.patientModel, this.patient, this.visitType, this.isUpdate})
|
||||
: super(key: key);
|
||||
|
||||
@override
|
||||
_UpdateNoteOrderState createState() =>
|
||||
_UpdateNoteOrderState();
|
||||
}
|
||||
|
||||
class _UpdateNoteOrderState extends State<UpdateNoteOrder> {
|
||||
int selectedType;
|
||||
|
||||
TextEditingController progressNoteController = TextEditingController();
|
||||
|
||||
|
||||
setSelectedType(int val) {
|
||||
setState(() {
|
||||
selectedType = val;
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (widget.note != null) {
|
||||
progressNoteController.text = widget.note.notes;
|
||||
}
|
||||
return BaseView<PatientViewModel>(
|
||||
builder: (BuildContext context, PatientViewModel model, Widget child) =>
|
||||
AppScaffold(
|
||||
isShowAppBar: false,
|
||||
backgroundColor: Theme
|
||||
.of(context)
|
||||
.scaffoldBackgroundColor,
|
||||
body: SingleChildScrollView(
|
||||
child: Container(
|
||||
height: MediaQuery
|
||||
.of(context)
|
||||
.size
|
||||
.height * 1.0,
|
||||
child: Padding(
|
||||
padding: EdgeInsets.all(0.0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
BottomSheetTitle(title: 'Add Progress Note',),
|
||||
SizedBox(
|
||||
height: 10.0,
|
||||
),
|
||||
|
||||
Center(
|
||||
child: FractionallySizedBox(
|
||||
widthFactor: 0.9,
|
||||
child: Column(
|
||||
children: [
|
||||
AppTextFieldCustom(
|
||||
hintText: TranslationBase.of(context).addProgressNote,
|
||||
controller: progressNoteController,
|
||||
maxLines: 25,
|
||||
minLines: 7,
|
||||
hasBorder: true,
|
||||
// validationError:complaintsController.text.isEmpty ,
|
||||
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
bottomSheet: Container(
|
||||
margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5),
|
||||
child: Wrap(
|
||||
alignment: WrapAlignment.center,
|
||||
children: <Widget>[
|
||||
AppButton(
|
||||
title: 'Add Progress Note',
|
||||
color: Color(0xff359846),
|
||||
// disabled: progressNoteController.text.isEmpty,
|
||||
fontWeight: FontWeight.w700,
|
||||
onPressed: () async {
|
||||
GifLoaderDialogUtils.showMyDialog(context);
|
||||
Map profile = await sharedPref.getObj(DOCTOR_PROFILE);
|
||||
|
||||
DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile);
|
||||
|
||||
|
||||
if (widget.isUpdate) {
|
||||
UpdateNoteReqModel reqModel = UpdateNoteReqModel(
|
||||
admissionNo: int.parse(widget.patient.admissionNo),
|
||||
cancelledNote: false,
|
||||
lineItemNo: 30,
|
||||
createdBy: widget.note.createdBy,
|
||||
notes: progressNoteController.text
|
||||
|
||||
,
|
||||
verifiedNote: false,
|
||||
|
||||
patientTypeID: widget.patient.patientType,
|
||||
patientOutSA: false,
|
||||
);
|
||||
await model.updatePatientProgressNote(reqModel);
|
||||
} else {
|
||||
CreateNoteModel reqModel = CreateNoteModel(
|
||||
admissionNo: int.parse(widget.patient.admissionNo),
|
||||
createdBy: doctorProfile.doctorID,
|
||||
visitType: widget.visitType,
|
||||
patientID: widget.patient.patientId,
|
||||
nursingRemarks: ' ',
|
||||
patientTypeID: widget.patient.patientType,
|
||||
patientOutSA: false,
|
||||
|
||||
notes: progressNoteController.text
|
||||
);
|
||||
|
||||
await model.createPatientProgressNote(reqModel);
|
||||
}
|
||||
|
||||
if (model.state == ViewState.ErrorLocal) {
|
||||
Helpers.showErrorToast("Error");
|
||||
} else {
|
||||
ProgressNoteRequest progressNoteRequest =
|
||||
ProgressNoteRequest(
|
||||
visitType: widget.visitType,
|
||||
// if equal 5 then this will return progress note
|
||||
admissionNo: int.parse(widget.patient.admissionNo),
|
||||
projectID: widget.patient.projectId,
|
||||
patientTypeID: widget.patient.patientType,
|
||||
languageID: 2);
|
||||
await widget.patientModel.getPatientProgressNote(
|
||||
progressNoteRequest.toJson());
|
||||
}
|
||||
|
||||
GifLoaderDialogUtils.hideDialog(context);
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -1,217 +0,0 @@
|
||||
import 'package:doctor_app_flutter/core/viewModel/patient_view_model.dart';
|
||||
import 'package:doctor_app_flutter/models/patient/progress_note_request.dart';
|
||||
import 'package:doctor_app_flutter/screens/base/base_view.dart';
|
||||
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/errors/dr_app_embedded_error.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/rounded_container_widget.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hexcolor/hexcolor.dart';
|
||||
|
||||
import '../../../config/shared_pref_kay.dart';
|
||||
import '../../../config/size_config.dart';
|
||||
import '../../../models/patient/patiant_info_model.dart';
|
||||
import '../../../util/dr_app_shared_pref.dart';
|
||||
import '../../../widgets/shared/app_scaffold_widget.dart';
|
||||
import '../../../widgets/shared/app_texts_widget.dart';
|
||||
|
||||
DrAppSharedPreferances sharedPref = new DrAppSharedPreferances();
|
||||
|
||||
/*
|
||||
*@author: ibrahim albitar
|
||||
*@Date:15/5/2020
|
||||
*@param: '
|
||||
*@return:
|
||||
*@desc:
|
||||
*/
|
||||
|
||||
class ProgressNoteScreen extends StatefulWidget {
|
||||
@override
|
||||
_ProgressNoteState createState() => _ProgressNoteState();
|
||||
}
|
||||
|
||||
class _ProgressNoteState extends State<ProgressNoteScreen> {
|
||||
var notesList;
|
||||
var filteredNotesList;
|
||||
final _controller = TextEditingController();
|
||||
var _isInit = true;
|
||||
|
||||
/*
|
||||
*@author: ibrahim al bitar
|
||||
*@Date:16/5/2020
|
||||
*@param:
|
||||
*@return:
|
||||
*@desc:
|
||||
*/
|
||||
getProgressNoteList(BuildContext context, PatientViewModel model) async {
|
||||
final routeArgs = ModalRoute.of(context).settings.arguments as Map;
|
||||
PatiantInformtion patient = routeArgs['patient'];
|
||||
String token = await sharedPref.getString(TOKEN);
|
||||
String type = await sharedPref.getString(SLECTED_PATIENT_TYPE);
|
||||
|
||||
print(type);
|
||||
ProgressNoteRequest progressNoteRequest = ProgressNoteRequest(
|
||||
visitType: 5,
|
||||
// if equal 5 then this will return progress note
|
||||
admissionNo: int.parse(patient.admissionNo),
|
||||
projectID: patient.projectId,
|
||||
tokenID: token,
|
||||
patientTypeID: patient.patientType,
|
||||
languageID: 2);
|
||||
model.getPatientProgressNote(progressNoteRequest.toJson()).then((c) {
|
||||
notesList = model.patientProgressNoteList;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BaseView<PatientViewModel>(
|
||||
onModelReady: (model) => getProgressNoteList(context, model),
|
||||
builder: (_, model, w) =>
|
||||
AppScaffold(
|
||||
baseViewModel: model,
|
||||
appBarTitle: TranslationBase
|
||||
.of(context)
|
||||
.progressNote,
|
||||
body: notesList == null || notesList.length == 0
|
||||
? DrAppEmbeddedError(
|
||||
error: TranslationBase
|
||||
.of(context)
|
||||
.errorNoProgressNote)
|
||||
: Column(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
margin: EdgeInsets.all(10),
|
||||
width: SizeConfig.screenWidth * 0.80,
|
||||
child: TextField(
|
||||
controller: _controller,
|
||||
onChanged: (String str) {
|
||||
this.searchData(str, model);
|
||||
},
|
||||
textInputAction: TextInputAction.done,
|
||||
decoration: buildInputDecoration(context,
|
||||
TranslationBase.of(context).searchNote),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Container(
|
||||
margin: EdgeInsets.fromLTRB(
|
||||
SizeConfig.realScreenWidth * 0.05,
|
||||
0,
|
||||
SizeConfig.realScreenWidth * 0.05,
|
||||
0),
|
||||
child: ListView.builder(
|
||||
itemCount: notesList.length,
|
||||
itemBuilder: (BuildContext ctxt, int index) {
|
||||
return RoundedContainer(
|
||||
backgroundColor: Colors.white,
|
||||
child: Column(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
ExpansionTile(
|
||||
title: Container(
|
||||
child: Column(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
AppText(
|
||||
notesList[index]
|
||||
["DoctorName"],
|
||||
marginTop: 10,
|
||||
marginLeft: 10,
|
||||
marginBottom: 5,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
AppText(
|
||||
convertDateFormat(
|
||||
notesList[index]
|
||||
["AssessmentDate"]),
|
||||
marginLeft: 10,
|
||||
color: Colors.grey[600],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
children: <Widget>[
|
||||
Divider(
|
||||
color: Colors.black,
|
||||
height: 20,
|
||||
thickness: 1,
|
||||
indent: 0,
|
||||
endIndent: 0,
|
||||
),
|
||||
Row(mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
AppText(
|
||||
notesList[index]["Notes"],
|
||||
margin: 5,
|
||||
),
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
],
|
||||
));
|
||||
}),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),);
|
||||
}
|
||||
|
||||
InputDecoration buildInputDecoration(BuildContext context, hint) {
|
||||
return InputDecoration(
|
||||
prefixIcon: Icon(Icons.search, color: Colors.black),
|
||||
filled: true,
|
||||
fillColor: Colors.white,
|
||||
hintText: hint,
|
||||
hintStyle: TextStyle(fontSize: 2 * SizeConfig.textMultiplier),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.all(Radius.circular(10)),
|
||||
borderSide: BorderSide(color: HexColor('#CCCCCC')),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.all(Radius.circular(10.0)),
|
||||
borderSide: BorderSide(color: Colors.grey), //),
|
||||
));
|
||||
}
|
||||
|
||||
searchData(String str, PatientViewModel model) {
|
||||
var strExist = str.length > 0 ? true : false;
|
||||
|
||||
if (strExist) {
|
||||
filteredNotesList = null;
|
||||
filteredNotesList = model.patientProgressNoteList
|
||||
.where((note) =>
|
||||
note["DoctorName"].toString().contains(str.toUpperCase()))
|
||||
.toList();
|
||||
setState(() {
|
||||
notesList = filteredNotesList;
|
||||
});
|
||||
} else {
|
||||
setState(() {
|
||||
notesList = model.patientProgressNoteList;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
convertDateFormat(String str) {
|
||||
const start = "/Date(";
|
||||
const end = "+0300)";
|
||||
|
||||
final startIndex = str.indexOf(start);
|
||||
final endIndex = str.indexOf(end, startIndex + start.length);
|
||||
|
||||
var date = new DateTime.fromMillisecondsSinceEpoch(
|
||||
int.parse(str.substring(startIndex + start.length, endIndex)));
|
||||
String newDate = date.year.toString() +
|
||||
"-" +
|
||||
date.month.toString().padLeft(2, '0') +
|
||||
"-" +
|
||||
date.day.toString().padLeft(2, '0');
|
||||
|
||||
return newDate.toString();
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue