meical report changes

merge-requests/672/head
mosazaid 5 years ago
parent 9e80a1879e
commit deb126fdd5

@ -47,7 +47,7 @@ class BaseAppClient {
if (body['EditedBy'] == '') {
body.remove("EditedBy");
}
body['TokenID'] = token ?? '';
body['TokenID'] = body.containsKey('TokenID') ? body['TokenID'] : token ?? '';
String lang = await sharedPref.getString(APP_Language);
if (lang != null && lang == 'ar')
body['LanguageID'] = 1;

@ -285,6 +285,7 @@ const GET_MY_OUT_PATIENT =
const PATIENT_MEDICAL_REPORT_GET_LIST = "Services/Patients.svc/REST/DAPP_ListMedicalReport";
const PATIENT_MEDICAL_REPORT_GET_TEMPLATE = "Services/Patients.svc/REST/DAPP_GetTemplateByID";
const PATIENT_MEDICAL_REPORT_INSERT = "Services/Patients.svc/REST/DAPP_InsertMedicalReport";
const PATIENT_MEDICAL_REPORT_VERIFIED = "Services/Patients.svc/REST/DAPP_VerifiedMedicalReport";

@ -1,10 +1,12 @@
import 'package:doctor_app_flutter/config/config.dart';
import 'package:doctor_app_flutter/core/service/base/base_service.dart';
import 'package:doctor_app_flutter/models/patient/MedicalReport/MedicalReportTemplate.dart';
import 'package:doctor_app_flutter/models/patient/MedicalReport/MeidcalReportModel.dart';
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
class PatientMedicalReportService extends BaseService {
List<MedicalReportModel> medicalReportList = [];
List<MedicalReportTemplate> medicalReportTemplate = [];
Future getMedicalReportList(PatiantInformtion patient) async {
hasError = false;
@ -28,6 +30,28 @@ class PatientMedicalReportService extends BaseService {
}, body: body, patient: patient);
}
Future getMedicalReportTemplate() async {
hasError = false;
Map<String, dynamic> body = Map();
body['TokenID'] = "@dm!n";
body['SetupID'] = "91877";
body['TemplateID'] = 43;
await baseAppClient.post(PATIENT_MEDICAL_REPORT_GET_TEMPLATE,
onSuccess: (dynamic response, int statusCode) {
medicalReportTemplate.clear();
if (response['DAPP_GetTemplateByIDList'] != null) {
response['DAPP_GetTemplateByIDList'].forEach((v) {
medicalReportTemplate.add(MedicalReportTemplate.fromJson(v));
});
}
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error.toString();
}, body: body);
}
Future insertMedicalReport(PatiantInformtion patient, String htmlText) async {
hasError = false;
Map<String, dynamic> body = Map();

@ -1,6 +1,7 @@
import 'package:doctor_app_flutter/core/enum/viewstate.dart';
import 'package:doctor_app_flutter/core/service/patient_medical_file/medical_report/PatientMedicalReportService.dart';
import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart';
import 'package:doctor_app_flutter/models/patient/MedicalReport/MedicalReportTemplate.dart';
import 'package:doctor_app_flutter/models/patient/MedicalReport/MeidcalReportModel.dart';
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
@ -11,6 +12,9 @@ class PatientMedicalReportViewModel extends BaseViewModel {
List<MedicalReportModel> get medicalReportList => _service.medicalReportList;
List<MedicalReportTemplate> get medicalReportTemplate =>
_service.medicalReportTemplate;
Future getMedicalReportList(PatiantInformtion patient) async {
setState(ViewState.Busy);
await _service.getMedicalReportList(patient);
@ -21,7 +25,17 @@ class PatientMedicalReportViewModel extends BaseViewModel {
setState(ViewState.Idle);
}
Future insertMedicalReport(PatiantInformtion patient, String htmlText)async {
Future getMedicalReportTemplate() async {
setState(ViewState.Busy);
await _service.getMedicalReportTemplate();
if (_service.hasError) {
error = _service.error;
setState(ViewState.Error);
} else
setState(ViewState.Idle);
}
Future insertMedicalReport(PatiantInformtion patient, String htmlText) async {
setState(ViewState.Busy);
await _service.insertMedicalReport(patient, htmlText);
if (_service.hasError) {
@ -31,7 +45,8 @@ class PatientMedicalReportViewModel extends BaseViewModel {
setState(ViewState.Idle);
}
Future verifyMedicalReport(PatiantInformtion patient, MedicalReportModel medicalReport) async {
Future verifyMedicalReport(
PatiantInformtion patient, MedicalReportModel medicalReport) async {
setState(ViewState.Busy);
await _service.verifyMedicalReport(patient, medicalReport);
if (_service.hasError) {

@ -0,0 +1,60 @@
class MedicalReportTemplate {
String setupID;
int projectID;
int templateID;
String procedureID;
int reportType;
String templateName;
String templateNameN;
String templateText;
String templateTextN;
bool isActive;
String templateTextHtml;
String templateTextNHtml;
MedicalReportTemplate(
{this.setupID,
this.projectID,
this.templateID,
this.procedureID,
this.reportType,
this.templateName,
this.templateNameN,
this.templateText,
this.templateTextN,
this.isActive,
this.templateTextHtml,
this.templateTextNHtml});
MedicalReportTemplate.fromJson(Map<String, dynamic> json) {
setupID = json['SetupID'];
projectID = json['ProjectID'];
templateID = json['TemplateID'];
procedureID = json['ProcedureID'];
reportType = json['ReportType'];
templateName = json['TemplateName'];
templateNameN = json['TemplateNameN'];
templateText = json['TemplateText'];
templateTextN = json['TemplateTextN'];
isActive = json['IsActive'];
templateTextHtml = json['TemplateTextHtml'];
templateTextNHtml = json['TemplateTextNHtml'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['SetupID'] = this.setupID;
data['ProjectID'] = this.projectID;
data['TemplateID'] = this.templateID;
data['ProcedureID'] = this.procedureID;
data['ReportType'] = this.reportType;
data['TemplateName'] = this.templateName;
data['TemplateNameN'] = this.templateNameN;
data['TemplateText'] = this.templateText;
data['TemplateTextN'] = this.templateTextN;
data['IsActive'] = this.isActive;
data['TemplateTextHtml'] = this.templateTextHtml;
data['TemplateTextNHtml'] = this.templateTextNHtml;
return data;
}
}

@ -66,6 +66,7 @@ class _AddVerifyMedicalReportState extends State<AddVerifyMedicalReport> {
MedicalReportStatus status = routeArgs['status'];
return BaseView<PatientMedicalReportViewModel>(
onModelReady: (model) => model.getMedicalReportTemplate(),
builder: (_, model, w) => AppScaffold(
baseViewModel: model,
isShowAppBar: true,

@ -1,4 +1,5 @@
import 'package:doctor_app_flutter/config/size_config.dart';
import 'package:doctor_app_flutter/core/enum/viewstate.dart';
import 'package:doctor_app_flutter/core/viewModel/PatientMedicalReportViewModel.dart';
import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart';
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
@ -11,6 +12,7 @@ import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-head
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/card_with_bg_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/errors/error_message.dart';
import 'package:eva_icons_flutter/eva_icons_flutter.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
@ -23,8 +25,8 @@ class MedicalReportPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
final routeArgs = ModalRoute.of(context).settings.arguments as Map;
PatiantInformtion patient = routeArgs['patient'];
String patientType = routeArgs['patientType'];
PatiantInformtion patient = routeArgs['patient'];
String patientType = routeArgs['patientType'];
String arrivalType = routeArgs['arrivalType'];
ProjectViewModel projectViewModel = Provider.of(context);
@ -33,7 +35,11 @@ class MedicalReportPage extends StatelessWidget {
builder: (_, model, w) => AppScaffold(
baseViewModel: model,
isShowAppBar: true,
appBar: PatientProfileHeaderNewDesignAppBar(patient, patientType, arrivalType,),
appBar: PatientProfileHeaderNewDesignAppBar(
patient,
patientType,
arrivalType,
),
body: SingleChildScrollView(
physics: BouncingScrollPhysics(),
child: Column(
@ -61,7 +67,8 @@ class MedicalReportPage extends StatelessWidget {
),
AddNewOrder(
onTap: () {
Navigator.of(context).pushNamed(PATIENT_MEDICAL_REPORT_INSERT, arguments: {
Navigator.of(context)
.pushNamed(PATIENT_MEDICAL_REPORT_INSERT, arguments: {
'patient': patient,
'patientType': patientType,
'arrivalType': arrivalType,
@ -70,69 +77,78 @@ class MedicalReportPage extends StatelessWidget {
},
label: TranslationBase.of(context).createNewMedicalReport,
),
...List.generate(
/*model.patientLabOrdersList.length,*/1,
(index) => CardWithBgWidget(
hasBorder: false,
bgColor: 0==0? Colors.red[700]:Colors.green[700],
widget: Column(
children: [
Row(
children: [
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
AppText('On Hold',color: Colors.red,),
AppText(
"Jammal" ?? "",
fontSize: 15,
bold: true,
),
],
)),
Expanded(
if (model.state == ViewState.ErrorLocal)
Container(
child: ErrorMessage(error: model.error),
),
if (model.state != ViewState.ErrorLocal)
...List.generate(
/*model.patientLabOrdersList.length,*/
1,
(index) => CardWithBgWidget(
hasBorder: false,
bgColor: 0 == 0 ? Colors.red[700] : Colors.green[700],
widget: Column(
children: [
Row(
children: [
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
AppText(
'${AppDateUtils.getDayMonthYearDateFormatted(DateTime.now(), isArabic: projectViewModel.isArabic)}',
color: Colors.black,
fontWeight: FontWeight.w600,
fontSize: 14,
),
AppText(
'${AppDateUtils.getHour(DateTime.now())}',
fontWeight: FontWeight.w600,
color: Colors.grey[700],
fontSize: 14,
),
],
crossAxisAlignment: CrossAxisAlignment.start,
children: [
AppText(
'On Hold',
color: Colors.red,
),
),
],
),
Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Container(
child: LargeAvatar(
name: "Jammal",
url: null,
AppText(
"Jammal" ?? "",
fontSize: 15,
bold: true,
),
width: 55,
height: 55,
],
)),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
AppText(
'${AppDateUtils.getDayMonthYearDateFormatted(DateTime.now(), isArabic: projectViewModel.isArabic)}',
color: Colors.black,
fontWeight: FontWeight.w600,
fontSize: 14,
),
AppText(
'${AppDateUtils.getHour(DateTime.now())}',
fontWeight: FontWeight.w600,
color: Colors.grey[700],
fontSize: 14,
),
],
),
Expanded(child: AppText("")),
Icon(
EvaIcons.eye,
)
],
),
],
),
),
],
),
Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Container(
child: LargeAvatar(
name: "Jammal",
url: null,
),
width: 55,
height: 55,
),
Expanded(child: AppText("")),
Icon(
EvaIcons.eye,
)
],
),
],
),
)
),
),
],
),
),

Loading…
Cancel
Save