|
|
|
|
import 'package:doctor_app_flutter/models/patient/progress_note_request.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:provider/provider.dart';
|
|
|
|
|
|
|
|
|
|
import '../../../config/shared_pref_kay.dart';
|
|
|
|
|
import '../../../config/size_config.dart';
|
|
|
|
|
import '../../../models/patient/patiant_info_model.dart';
|
|
|
|
|
import '../../../providers/patients_provider.dart';
|
|
|
|
|
import '../../../util/dr_app_shared_pref.dart';
|
|
|
|
|
import '../../../widgets/shared/app_scaffold_widget.dart';
|
|
|
|
|
import '../../../widgets/shared/app_texts_widget.dart';
|
|
|
|
|
import '../../../widgets/shared/dr_app_circular_progress_Indeicator.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> {
|
|
|
|
|
PatientsProvider patientsProv;
|
|
|
|
|
var _isInit = true;
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
*@author: ibrahim al bitar
|
|
|
|
|
*@Date:16/5/2020
|
|
|
|
|
*@param:
|
|
|
|
|
*@return:
|
|
|
|
|
*@desc:
|
|
|
|
|
*/
|
|
|
|
|
getProgressNoteList(context) 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);
|
|
|
|
|
patientsProv.getPatientProgressNote(progressNoteRequest.toJson());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
void didChangeDependencies() {
|
|
|
|
|
super.didChangeDependencies();
|
|
|
|
|
if (_isInit) {
|
|
|
|
|
patientsProv = Provider.of<PatientsProvider>(context);
|
|
|
|
|
getProgressNoteList(context);
|
|
|
|
|
}
|
|
|
|
|
_isInit = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
return AppScaffold(
|
|
|
|
|
appBarTitle: "Progress Note",
|
|
|
|
|
showAppDrawer: false,
|
|
|
|
|
showBottomBar: false,
|
|
|
|
|
body: patientsProv.isLoading
|
|
|
|
|
? DrAppCircularProgressIndeicator()
|
|
|
|
|
: patientsProv.isError
|
|
|
|
|
? DrAppEmbeddedError(error: patientsProv.error)
|
|
|
|
|
: patientsProv.patientProgressNoteList.length == 0
|
|
|
|
|
? DrAppEmbeddedError(
|
|
|
|
|
error: 'You don\'t have any Progress Note')
|
|
|
|
|
: Container(
|
|
|
|
|
margin: EdgeInsets.fromLTRB(
|
|
|
|
|
SizeConfig.realScreenWidth * 0.05,
|
|
|
|
|
0,
|
|
|
|
|
SizeConfig.realScreenWidth * 0.05,
|
|
|
|
|
0),
|
|
|
|
|
child: ListView.builder(
|
|
|
|
|
itemCount:
|
|
|
|
|
patientsProv.patientProgressNoteList.length,
|
|
|
|
|
itemBuilder: (BuildContext ctxt, int index) {
|
|
|
|
|
return RoundedContainer(
|
|
|
|
|
backgroundColor: Colors.yellow[200],
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
AppText(
|
|
|
|
|
patientsProv
|
|
|
|
|
.patientProgressNoteList[index]
|
|
|
|
|
["DoctorName"],
|
|
|
|
|
marginTop: 10,
|
|
|
|
|
marginLeft: 10,
|
|
|
|
|
marginBottom: 5,
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
),
|
|
|
|
|
AppText(
|
|
|
|
|
convertDateFormat(patientsProv
|
|
|
|
|
.patientProgressNoteList[index]
|
|
|
|
|
["AssessmentDate"]),
|
|
|
|
|
marginLeft: 10,
|
|
|
|
|
color: Colors.grey[600],
|
|
|
|
|
),
|
|
|
|
|
Divider(
|
|
|
|
|
color: Colors.black,
|
|
|
|
|
height: 20,
|
|
|
|
|
thickness: 1,
|
|
|
|
|
indent: 0,
|
|
|
|
|
endIndent: 0,
|
|
|
|
|
),
|
|
|
|
|
AppText(
|
|
|
|
|
patientsProv
|
|
|
|
|
.patientProgressNoteList[index]
|
|
|
|
|
["Notes"],
|
|
|
|
|
margin: 10,
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
));
|
|
|
|
|
}),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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();
|
|
|
|
|
}
|
|
|
|
|
}
|