|
@@ -15,6 +15,7 @@ import 'package:vitalapp/components/dropdown_button.dart';
|
|
|
import 'package:vitalapp/components/no_data_view.dart';
|
|
|
import 'package:vitalapp/components/select.dart';
|
|
|
import 'package:vitalapp/managers/interfaces/exam.dart';
|
|
|
+import 'package:vitalapp/managers/interfaces/report_template.dart';
|
|
|
import 'package:vitalapp/pages/medical/controller.dart';
|
|
|
import 'package:vitalapp/pages/medical/models/worker.dart';
|
|
|
import 'package:vitalapp/pages/medical/widgets/device_status_position.dart';
|
|
@@ -52,8 +53,10 @@ class EcgResultViewState extends State<EcgResultView> {
|
|
|
final _tAxisController = TextEditingController();
|
|
|
final _pDurController = TextEditingController();
|
|
|
final _tDurController = TextEditingController();
|
|
|
- double paperSpeed = 25.0;
|
|
|
- int gain = 5;
|
|
|
+ double _paperSpeed = 25.0;
|
|
|
+ int _gain = 5;
|
|
|
+ List<ReportTemplateDTO> _templates = [];
|
|
|
+ ReportTemplateDTO _currentSelectedTemplate = ReportTemplateDTO();
|
|
|
|
|
|
/// 初始时的心电初始数据
|
|
|
List<int> _initEcgDatas = [];
|
|
@@ -62,6 +65,17 @@ class EcgResultViewState extends State<EcgResultView> {
|
|
|
void initState() {
|
|
|
String examData = widget.recordInfo.examData ?? '';
|
|
|
if (examData.isNotEmpty) {
|
|
|
+ Get.find<IReportTemplateManager>()
|
|
|
+ .getReportTemplatePage(
|
|
|
+ businessType: ReportTemplateBusinessTypeEnum.HEIECG)
|
|
|
+ .then((result) {
|
|
|
+ setState(() {
|
|
|
+ _templates = result.pageData ?? [];
|
|
|
+ if (_templates.isNotEmpty) {
|
|
|
+ _currentSelectedTemplate = _templates.first;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
Map<String, dynamic> examDatas = jsonDecode(examData);
|
|
|
if (examDatas.containsKey("ECG_POINT12")) {
|
|
|
String exgPoint12Url = examDatas["ECG_POINT12"].toString();
|
|
@@ -204,21 +218,21 @@ class EcgResultViewState extends State<EcgResultView> {
|
|
|
id: "twelve_ecg_view",
|
|
|
builder: (_) {
|
|
|
return FullScreenEcgDataDialog(
|
|
|
- height: kIsWeb ? 560 : 655,
|
|
|
+ height: kIsWeb ? 560 : 610,
|
|
|
showHeader: false,
|
|
|
widthScale: 1,
|
|
|
hintFontSize: 14,
|
|
|
);
|
|
|
}),
|
|
|
Positioned(
|
|
|
- top: 90,
|
|
|
- left: 40,
|
|
|
+ top: 70,
|
|
|
+ left: 20,
|
|
|
child: Row(
|
|
|
children: [
|
|
|
SizedBox(width: 25),
|
|
|
_buildKeyValue(
|
|
|
"",
|
|
|
- "1.6-2.0 Hz",
|
|
|
+ "1.6Hz",
|
|
|
fontSize: 14,
|
|
|
),
|
|
|
SizedBox(width: 15),
|
|
@@ -273,7 +287,6 @@ class EcgResultViewState extends State<EcgResultView> {
|
|
|
_hrController.text = heartRate12;
|
|
|
}
|
|
|
}
|
|
|
- final gapHeight = 5.0;
|
|
|
return Row(
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
children: [
|
|
@@ -281,7 +294,6 @@ class EcgResultViewState extends State<EcgResultView> {
|
|
|
child: Column(
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
children: [
|
|
|
- SizedBox(height: gapHeight),
|
|
|
Row(
|
|
|
children: [
|
|
|
SizedBox(width: 10),
|
|
@@ -296,11 +308,11 @@ class EcgResultViewState extends State<EcgResultView> {
|
|
|
itemToString: (v) {
|
|
|
return v.toString();
|
|
|
},
|
|
|
- initialValue: paperSpeed,
|
|
|
+ initialValue: _paperSpeed,
|
|
|
onChanged: (value) {
|
|
|
- paperSpeed = value;
|
|
|
+ _paperSpeed = value;
|
|
|
Get.find<TwelveEcgViewController>()
|
|
|
- .changeHorizontalRatio(paperSpeed / 25);
|
|
|
+ .changeHorizontalRatio(_paperSpeed / 25);
|
|
|
},
|
|
|
),
|
|
|
Text(
|
|
@@ -322,10 +334,10 @@ class EcgResultViewState extends State<EcgResultView> {
|
|
|
itemToString: (v) {
|
|
|
return v.toString();
|
|
|
},
|
|
|
- initialValue: gain,
|
|
|
+ initialValue: _gain,
|
|
|
onChanged: (value) {
|
|
|
- gain = value;
|
|
|
- int radio = gain ~/ 5;
|
|
|
+ _gain = value;
|
|
|
+ int radio = _gain ~/ 5;
|
|
|
List<int> tempDatas = [];
|
|
|
for (int p in _initEcgDatas) {
|
|
|
tempDatas.add(p * radio);
|
|
@@ -350,6 +362,47 @@ class EcgResultViewState extends State<EcgResultView> {
|
|
|
SizedBox(width: 10),
|
|
|
],
|
|
|
),
|
|
|
+ Row(
|
|
|
+ children: [
|
|
|
+ SizedBox(width: 10),
|
|
|
+ _buildKeyValue("姓名:", widget.recordInfo.patientName ?? ''),
|
|
|
+ SizedBox(width: 10),
|
|
|
+ _buildKeyValue("性别:",
|
|
|
+ patientGenderConvertAge(widget.recordInfo.patientGender)),
|
|
|
+ SizedBox(width: 10),
|
|
|
+ _buildKeyValue(
|
|
|
+ "年龄:", birthDayConvertAge(widget.recordInfo.birthday)),
|
|
|
+ SizedBox(width: 10),
|
|
|
+ if (_templates.isNotEmpty) ...[
|
|
|
+ Text(
|
|
|
+ "模板:",
|
|
|
+ style: TextStyle(fontSize: 20),
|
|
|
+ ),
|
|
|
+ GenericDropdownButton<ReportTemplateDTO>(
|
|
|
+ items: _templates,
|
|
|
+ initialValue: _currentSelectedTemplate,
|
|
|
+ itemToString: (t) {
|
|
|
+ return t.reportTemplateName ?? '';
|
|
|
+ },
|
|
|
+ onChanged: (v) {
|
|
|
+ _currentSelectedTemplate = v;
|
|
|
+ },
|
|
|
+ ),
|
|
|
+ ],
|
|
|
+ SizedBox(
|
|
|
+ width: 40,
|
|
|
+ ),
|
|
|
+ SizedBox(
|
|
|
+ child: Text(
|
|
|
+ "若需要更改图像截取范围,请滑动下方的滑动条",
|
|
|
+ style: TextStyle(
|
|
|
+ fontSize: 15,
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ //SizedBox(height: 5,)
|
|
|
],
|
|
|
),
|
|
|
),
|
|
@@ -358,15 +411,51 @@ class EcgResultViewState extends State<EcgResultView> {
|
|
|
children: [
|
|
|
Text(
|
|
|
"诊断提示:",
|
|
|
- style: TextStyle(fontSize: 20),
|
|
|
+ style: TextStyle(fontSize: 16),
|
|
|
),
|
|
|
- Expanded(child: SizedBox()),
|
|
|
],
|
|
|
),
|
|
|
],
|
|
|
);
|
|
|
}
|
|
|
|
|
|
+ String patientGenderConvertAge(GenderEnum patientGender) {
|
|
|
+ switch (patientGender) {
|
|
|
+ case GenderEnum.Male:
|
|
|
+ return "男";
|
|
|
+ case GenderEnum.Female:
|
|
|
+ return "女";
|
|
|
+ default:
|
|
|
+ return "";
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ String birthDayConvertAge(DateTime? birthday) {
|
|
|
+ if (birthday == null) {
|
|
|
+ return "";
|
|
|
+ }
|
|
|
+ // 获取当前日期
|
|
|
+ DateTime now = DateTime.now();
|
|
|
+
|
|
|
+ // 计算年龄
|
|
|
+ int age = calculateAge(birthday, now);
|
|
|
+
|
|
|
+ return age.toString();
|
|
|
+ }
|
|
|
+
|
|
|
+ int calculateAge(DateTime birthDate, DateTime now) {
|
|
|
+ // 计算年份差
|
|
|
+ int age = now.year - birthDate.year;
|
|
|
+
|
|
|
+ // 检查生日是否已经过了当前年份
|
|
|
+ if (now.month < birthDate.month ||
|
|
|
+ (now.month == birthDate.month && now.day < birthDate.day)) {
|
|
|
+ age--;
|
|
|
+ }
|
|
|
+
|
|
|
+ return age;
|
|
|
+ }
|
|
|
+
|
|
|
Widget _buildKeyValue(
|
|
|
String key,
|
|
|
String value, {
|