-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
536db51
commit 2d3df9a
Showing
13 changed files
with
221 additions
and
221 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,41 @@ | ||
# MQTT API | ||
|
||
给药逻辑: | ||
## 绑定药盒和可穿戴设备 | ||
|
||
### 陀螺仪端和药盒端: | ||
|
||
1. 想一个随机字符串作为id(例如:a1b2c3d4) | ||
2. 把ClientId写死进代码里 | ||
- 药盒的clientId:box_id(box_a1b2c3d4) | ||
- 陀螺仪的clientId:gyroscope_id(gyroscope_a1b2c3d4) | ||
3. 根据id生成二维码([二维码生成在线工具](https://cli.im/)) | ||
4. 把二维码打印下来贴在药盒上 | ||
|
||
## | ||
### 小程序端 | ||
|
||
1. 扫码获取id(a1b2c3d4) | ||
2. 算出药盒的clientId:box_id(box_a1b2c3d4) | ||
3. 算出陀螺仪的clientId:gyroscope_id(gyroscope_a1b2c3d4) | ||
|
||
## 监听老人跌倒信息 | ||
|
||
### 陀螺仪端: | ||
|
||
若监测到老人跌倒,则发布到主题 `drug/id/slip` | ||
|
||
```json | ||
{ | ||
// 写死在代码里的id | ||
"id": "a1b2c3d4", | ||
"code": 400, | ||
"message": "监测到患者摔倒", | ||
// 时间戳(精度:秒) | ||
"timestamp": 1721804282 | ||
} | ||
``` | ||
|
||
### 小程序端 | ||
|
||
绑定好设备后,订阅主题 `drug/id/slip` | ||
|
||
若获取到code=400的消息,则弹窗提醒,消息就是message里的内容。 |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
我现在大概能理清药物逻辑了: | ||
|
||
每个药物有下面几个参数: | ||
|
||
- id: string, // 唯一标识 | ||
- drugName: string, // 药品名称 | ||
- dosage: string, // 给药剂量 | ||
- form: string, // 药物剂型 | ||
- dose: string, // 给药方式 | ||
- interval: string, // 给药间隔 | ||
- time: string, // 初次给药 | ||
- startDate: string, // 开始日期 | ||
- stopDate: string, // 结束日期 | ||
|
||
drug.id用「创建该药物时的timestamp」代替,理论上是不会重复的。 | ||
|
||
创建药物时填入这几个参数,程序会自动计算出用药方案,并推算出之后**开始日期~结束日期**之间的每一次给药。(但是将来的每一次用药都是根据所有用药方案实时推算出来,不存入任何全局变量中) | ||
|
||
小程序打开时会计算出「现在之前所有漏掉的服药」。计算方式是从「每种药的用药记录」中“最新的那项”开始,根据该药物的给药间隔,算出到现在为止漏掉的服药。然后就每次漏掉的服药询问——是否已经服药or是否跳过这次,并将这次服药加入「用药记录」中。**注意不管是否跳过服药都会加入用药记录,跳过则record.skip=true**。用药记录永远记录的是「已经结束的」服药计划,是个数组,其中的每个元素有下面这些参数: | ||
|
||
- public id: string, // 唯一标识 | ||
- public drugName: string, // 药品名称 | ||
- public dosage: string, // 给药剂量 | ||
- public form: string, // 药物剂型 | ||
- public dose: string, // 给药方式 | ||
- public date: string, // 服药日期 | ||
- public time: string, // 服药时间 | ||
- public skip: Boolean, // 是否跳过 (默认为false) | ||
|
||
其中用药记录的id就是该药物的id,用于通过用药记录定位到这个药物。总结一下: | ||
|
||
- 如果患者按时服药,即小程序端启动时虽然计算出了很多漏掉的服药记录,但是马上接收到了药盒端传过来的服药记录,则消除所有漏掉的服药记录。 | ||
- 如果患者没有按时服药,则同理,监护人就能在小程序端看到患者的服药情况,提醒患者服药。 | ||
- 如果监护人在用药计划中更改某个药物的间隔、开始时间、结束时间等,会立刻生效,但是「已经结束的服药记录」完全不变,只会改变将来的那些服药计划。比如将来的某次服药时间 = 该药物最新的服药记录的时间 + 更改后的服药间隔。 | ||
- 如果监护人在用药计划中删除某个药物,可能会因为药物记录的id找不到而报错,这个也是待解决。 | ||
- 如果患者同一个药物有多次用药记录缺失,则理论上会弹出所有缺失的记录,让监护人选择是否服药。监护人此时不能因为看到这些缺失的记录就给患者喂药,不然一次性计量超标会出人命的,这个如何解决还没想好。 | ||
|
||
|
||
旺:每次到点提醒时,患者点击触摸屏上的按钮“打开药箱”,打开箱子取药,这个事件表示已经服药,自动记录到用药记录里;提醒超过一定时间还没打开药箱那就默认没吃药,也记录进去。每次服药时不需要询问是否已经用药。 | ||
尧:也不冲突,在「一定时间」内患者没有服用时,监护人打开小程序就能看到这个提醒,正好可以提醒患者服药。每种药物最多出现一个提醒,使用体验也会好一些。 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,10 @@ | ||
.root | ||
display: flex | ||
flex-direction: column | ||
align-items: center | ||
.content | ||
margin: 30px | ||
.text | ||
display: inline-block | ||
.link | ||
color: blue | ||
text-decoration: underline | ||
cursor: pointer | ||
display: inline-block |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,57 @@ | ||
<template> | ||
<view class="root"> | ||
<text>你好</text> | ||
</view> | ||
<scroll-view class="root" scroll-y> | ||
<View class="headline">关于「药白慧」</View> | ||
<View class="content"> | ||
<View class="text"> | ||
欢迎使用我们的智能药箱小程序——“药白慧”! | ||
我们致力于为用户提供便捷、智能的用药管理服务,帮助您和您的家人更好地管理药物、监测健康状况。 | ||
</View> | ||
</View> | ||
<View class="panel-title">版本信息</View> | ||
<View class="content"> | ||
<View class="text">当前版本:v1.0.0</View> | ||
<View class="text">发布时间:2024年7月</View> | ||
</View> | ||
<View class="panel-title">开发团队</View> | ||
<View class="content"> | ||
<View class="text" style="font-weight: bold">医心二意队</View> | ||
<View class="text"> | ||
团队成员拥有丰富的软件开发和医疗领域经验,致力于为您提供最好的用户体验和最优质的服务。 | ||
</View> | ||
</View> | ||
<View class="panel-title">联系我们</View> | ||
<View class="content"> | ||
<View class="text"> | ||
如果您有任何建议、意见或问题,欢迎随时联系我们。您可以通过以下方式与我们取得联系: | ||
</View> | ||
|
||
<ul class="content"> | ||
<li> | ||
<View class="text">· 邮件:</View> | ||
<View class="link">[email protected]</View> | ||
</li> | ||
<li> | ||
<View class="text">· 电话:</View> | ||
<View class="link">15888888888</View> | ||
</li> | ||
<li> | ||
<View class="text">· 地址:</View> | ||
<View class="link">四川大学江安校区</View> | ||
</li> | ||
</ul> | ||
</View> | ||
<View class="panel-title">隐私政策</View> | ||
<View class="content"> | ||
<View class="text"> | ||
我们非常重视用户的隐私和数据安全。在使用“药白慧”小程序的过程中,我们会严格遵守相关隐私法规,并采取各种措施保护您的个人信息。您可以在设置页面查看我们的隐私政策,了解我们如何收集、使用和保护您的数据。 | ||
</View> | ||
</View> | ||
<View class="content"> | ||
<View class="text"> | ||
感谢您选择“药白慧”!希望我们的小程序能为您带来便利和帮助。祝您健康快乐! | ||
</View> | ||
</View> | ||
</scroll-view> | ||
</template> | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.