diff --git a/src/components/uploadFile/index.js b/src/components/uploadFile/index.js
index f723b4d..2b864a9 100644
--- a/src/components/uploadFile/index.js
+++ b/src/components/uploadFile/index.js
@@ -15,30 +15,11 @@ Component({
type: Array,
value: [],
},
- accept: {
- type: String,
- value: 'media',
- },
- fileTypes: {
- // 上传类型
- type: Array,
- value: ['image', 'video'],
- },
- // 拍照和相机
- sourceType: {
- type: Array,
- value: ['album', 'camera'],
- },
// 是否可以删除
canDelete: {
type: Boolean,
value: true,
},
- // 是否可以下载
- // canDownLoad: {
- // type: Boolean,
- // value: true
- // },
// 最大上传数量, -1为不限制
maxNum: {
type: Number,
@@ -60,6 +41,32 @@ Component({
data: {
Timestamp: app.globalData.Timestamp,
imageUrl: app.globalData.imageUrl,
+
+ show: false,
+ actions: [
+ {
+ id: 1,
+ name: '选择视频或图片',
+ },
+ {
+ id: 2,
+ name: '选择聊天文件',
+ },
+ ],
+
+ fileTypenNum: {
+ image: 1,
+ video: 2,
+ audio: 3,
+ pdf: 4,
+ ppt: 7,
+
+ 1: 'image',
+ 2: 'video',
+ 3: 'audio',
+ 4: 'pdf',
+ 7: 'ppt',
+ },
},
/**
@@ -123,22 +130,12 @@ Component({
title: '附件请到pc端下载!',
icon: 'none',
})
- // wx.saveFile({
- // tempFilePath: res.tempFilePath,
- // success: () => {
- // wx.showToast({
- // title: '下载成功',
- // })
- // },
- // fail(err){
- // console.log(err)
- // },
- // })
}
},
})
},
uploadFile(item) {
+ const { fileTypenNum } = this.data
return new Promise((resolve, resject) => {
let url = `${app.globalData.upFileUrl}?r=file-service/upload-`
if (item.fileType === 'image') {
@@ -147,26 +144,30 @@ Component({
if (item.fileType === 'video') {
url += 'video'
}
- let that = this
+ if (item.fileType === 'file') {
+ url += 'doc'
+ }
wx.uploadFile({
filePath: item.tempFilePath,
name: 'file',
url: url,
- success(res) {
+ success: (res) => {
let data = JSON.parse(res.data)
let expandJson = {
- fileId: '',
- name: data.data.Url,
- size: (item.size / 1024).toFixed(2),
- fileUrl: data.data.Url,
- suffix: that.GetExtensionFileName(data.data.Url),
- type: item.fileType,
+ name: item.name,
+ extend: item.extend,
+ fnum: fileTypenNum[item.fileType],
}
if (item.fileType === 'image') {
- expandJson.imgUrl = data.data.Url
+ expandJson.url = data.data.Url
}
if (item.fileType === 'video') {
- expandJson.imgUrl = data.data.SnapshotUrl
+ expandJson.url = data.data.SnapshotUrl
+ expandJson.videoUrl = data.data.Url
+ expandJson.duration = data.data.Duration
+ }
+ if (item.fileType === 'file') {
+ expandJson.url = data.data.Url
}
resolve(expandJson)
},
@@ -207,25 +208,68 @@ Component({
})
})
},
- selectFile() {
- let { fileList, maxNum, sourceType, fileTypes, count = 0 } = this.properties
- var that = this
+ handleAction() {
+ this.setData({
+ show: true,
+ })
+ },
+ onSelect(e) {
+ if (e.detail.id === 1) {
+ this.setData({
+ show: false,
+ })
+ this.selectMedia()
+ }
+ if (e.detail.id === 2) {
+ this.setData({
+ show: false,
+ })
+ this.selectFiles()
+ }
+ },
+ selectMedia() {
+ let { fileList, maxNum, count = 0 } = this.properties
if (maxNum >= 0 && count == 0) {
count = maxNum - fileList.length
}
- this.triggerEvent('choose')
wx.chooseMedia({
- mediaType: fileTypes,
+ mediaType: ['image', 'video'],
count: count,
- sourceType: sourceType,
+ sourceType: ['album', 'camera'],
sizeType: ['original'],
- success(res) {
+ success: (res) => {
+ res.tempFiles.map((e) => {
+ e.name = e.tempFilePath
+ e.extend = this.GetExtensionFileName(e.tempFilePath)
+ e.tempFilePath = e.tempFilePath
+ e.fileType = e.fileType
+ })
+ this.upFile(res.tempFiles)
+ },
+ })
+ },
+ selectFiles() {
+ let { fileList, maxNum, count = 0 } = this.properties
+ if (maxNum >= 0 && count == 0) {
+ count = maxNum - fileList.length
+ }
+ wx.chooseMessageFile({
+ count: count,
+ type: 'file',
+ extension: ['doc', 'docx', 'pdf', 'xlsx', 'xls', 'ppt', 'pptx'],
+ success: (res) => {
res.tempFiles.map((e) => {
- e.fileType = e.fileType || res.type
+ e.fileType = 'file'
+ e.tempFilePath = e.path
+ e.extend = this.GetExtensionFileName(e.path)
+ console.warn('DEBUGPRINT[62]: index.js:265: e=', e)
})
- that.upFile(res.tempFiles)
+ this.upFile(res.tempFiles)
},
})
},
+ onClose() {
+ this.setData({ show: false })
+ },
},
})
diff --git a/src/components/uploadFile/index.json b/src/components/uploadFile/index.json
index 3f5e2a3..7d14dda 100644
--- a/src/components/uploadFile/index.json
+++ b/src/components/uploadFile/index.json
@@ -2,6 +2,7 @@
"component": true,
"usingComponents": {
"van-icon": "@vant/weapp/icon/index",
- "van-image": "@vant/weapp/image/index"
+ "van-image": "@vant/weapp/image/index",
+ "van-action-sheet": "@vant/weapp/action-sheet/index"
}
}
diff --git a/src/components/uploadFile/index.wxml b/src/components/uploadFile/index.wxml
index d9c6bee..8427eb3 100644
--- a/src/components/uploadFile/index.wxml
+++ b/src/components/uploadFile/index.wxml
@@ -9,7 +9,7 @@
-
+
@@ -17,3 +17,5 @@
+
+
diff --git a/src/patient/pages/casesAdd/index.scss b/src/patient/pages/casesAdd/index.scss
index f894dce..a9821c9 100644
--- a/src/patient/pages/casesAdd/index.scss
+++ b/src/patient/pages/casesAdd/index.scss
@@ -120,7 +120,7 @@ page {
display: flex;
justify-content: space-between;
align-items: center;
- &::before {
+ &:empty:before {
display: inline;
content: attr(data-place);
color: rgba(161, 164, 172, 0.5);
diff --git a/src/patient/pages/casesAdd/index.ts b/src/patient/pages/casesAdd/index.ts
index b462d3b..df1ba59 100644
--- a/src/patient/pages/casesAdd/index.ts
+++ b/src/patient/pages/casesAdd/index.ts
@@ -1,82 +1,268 @@
-const _app = getApp()
+const app = getApp()
Page({
data: {
popupShow: false,
popupType: 'casesAddComplete',
- popupParams: {
- close: true,
- content: '',
- },
+ popupParams: {} as any,
currentFinish: true,
current: 0,
+ // form
+ diagnosisTime: '',
+ weight: '',
+ clottingFactor: '',
+ treatmentPlan: '',
+ fixExposureDay: '',
+
+ beforeFixHistory: '',
+ beforeLiverHistory: '',
+ liverRecord: '',
+ drinkingHistory: '',
+ allergyHistory: '',
+ allergyRecord: '',
+ isNotGlucocorticoid: '',
+ medicalHistoryInfo: '',
+
+ remark: '',
+ bleedingParts: [],
+
+ formKeys: [
+ 'diagnosisTime',
+ 'weight',
+ 'clottingFactor',
+ 'treatmentPlan',
+ 'fixExposureDay',
+ 'beforeFixHistory',
+ 'beforeLiverHistory',
+ 'liverRecord',
+ 'drinkingHistory',
+ 'allergyHistory',
+ 'allergyRecord',
+ 'isNotGlucocorticoid',
+ 'medicalHistoryInfo',
+ 'remark',
+ 'bleedingParts',
+ ],
+
+ dict: {
+ treatmentPlan: {},
+ dataHaveNo: {},
+ drink: {},
+ parts: {} as any,
+ },
parts: [
{
top: '94',
left: '-14',
+ active: false,
},
{
top: '78',
left: '28',
+ active: false,
},
{
top: '88',
left: '72',
+ active: false,
},
{
top: '78',
left: '126',
+ active: false,
},
{
top: '78',
left: '184',
+ active: false,
},
{
top: '88',
left: '238',
+ active: false,
},
{
top: '78',
left: '284',
+ active: false,
},
{
top: '94',
left: '324',
+ active: false,
},
{
top: '194',
left: '122',
+ active: false,
},
{
top: '194',
left: '190',
+ active: false,
},
{
top: '296',
left: '122',
+ active: false,
},
{
top: '296',
left: '190',
+ active: false,
},
{
top: '364',
left: '122',
+ active: false,
},
{
top: '364',
left: '190',
+ active: false,
+ },
+ {
+ top: '396',
+ left: '104',
+ active: false,
+ },
+ {
+ top: '396',
+ left: '206',
+ active: false,
},
],
},
- onLoad() {},
+ onShow() {
+ const casesCache = wx.getStorageSync('casesCache')
+ app.waitLogin().then(() => {
+ this.getDict()
+ if (casesCache) {
+ const { formKeys } = this.data
+ const reset = formKeys.reduce((pre, cur) => {
+ pre[cur] = casesCache[cur] || ''
+ return pre
+ }, {})
+ this.setData({
+ ...reset,
+ })
+ } else {
+ this.getDetail()
+ }
+ })
+ },
+ onUnload() {
+ this.updateSave()
+ },
+ onHide() {
+ this.updateSave()
+ },
+ getDict() {
+ wx.ajax({
+ method: 'GET',
+ url: '?r=wtx/treatment/get-dict',
+ data: {},
+ }).then((res) => {
+ this.setData({
+ dict: res,
+ })
+ })
+ },
+ getDetail() {
+ const { formKeys, parts } = this.data
+ wx.ajax({
+ method: 'GET',
+ url: '?r=wtx/treatment/get-medical-history-info',
+ data: {},
+ }).then((res) => {
+ const reset = formKeys.reduce((pre, cur) => {
+ pre[cur] = res[cur] || ''
+ return pre
+ }, {})
+ const bleedingParts = res.lastBleedingInfo.bleedingPartList.map((item: any) => {
+ parts[item.bleedingPart - 1].active = true
+ return {
+ name: item.bleedingPartName,
+ id: item.bleedingPart,
+ }
+ })
+ this.setData({
+ ...reset,
+ remark: res.lastBleedingInfo.remark,
+ bleedingParts,
+ parts,
+ })
+ })
+ },
+ handleSelect(e) {
+ const { key, value } = e.currentTarget.dataset
+ this.setData({
+ [`${key}`]: value,
+ })
+ },
+ handlePartSelect(e) {
+ const { index } = e.currentTarget.dataset
+ const {
+ dict: { parts: partsDict },
+ parts,
+ } = this.data
+ parts[index].active = !parts[index].active
+ const bleedingParts = parts.reduce((pre, cur, index) => {
+ if (cur.active) {
+ pre.push({
+ name: partsDict[index + 1],
+ id: index + 1,
+ })
+ }
+ return pre
+ }, [] as any)
+ this.setData({
+ parts,
+ bleedingParts,
+ })
+ },
+ updateSave(e = false) {
+ let back = false
+ if (e) {
+ back = (e as any).currentTarget.dataset.back
+ }
+ const { formKeys, ...reset } = this.data
+ const form: any = formKeys.reduce((pre, cur) => {
+ pre[cur] = reset[cur]
+ return pre
+ }, {})
+ wx.setStorageSync('casesCache', form)
+ wx.ajax({
+ method: 'POST',
+ url: '?r=wtx/treatment/save-medical-history-info',
+ data: {
+ ...form,
+ lastBleedingInfo: JSON.stringify({
+ remark: form.remark,
+ bleedingParts: form.bleedingParts.map((item: any) => item.id),
+ }),
+ },
+ }).then(() => {
+ wx.removeStorageSync('casesCache')
+ if (back) {
+ this.setData({
+ popupShow: true,
+ popupType: 'casesAddComplete',
+ popupParams: {},
+ })
+ }
+ })
+ },
handleFinish() {
this.setData({
currentFinish: true,
})
},
+ handleBack() {
+ wx.navigateBack()
+ },
handlePrev() {
if (!this.data.currentFinish) return
this.setData({
@@ -91,6 +277,17 @@ Page({
current: this.data.current + 1,
})
},
+ handlePopupCancel() {
+ const { popupType } = this.data
+ if (popupType === 'casesAddComplete') {
+ wx.navigateBack()
+ this.setData({
+ popupShow: false,
+ popupType: '',
+ popupParams: {},
+ })
+ }
+ },
})
export {}
diff --git a/src/patient/pages/casesAdd/index.wxml b/src/patient/pages/casesAdd/index.wxml
index 03d6f46..057aada 100644
--- a/src/patient/pages/casesAdd/index.wxml
+++ b/src/patient/pages/casesAdd/index.wxml
@@ -39,8 +39,8 @@
确诊时间
-
-
+
+ {{diagnosisTime}}
@@ -48,7 +48,13 @@
您的体重
-
+
kg
@@ -59,7 +65,13 @@
凝血因子
-
+
%
@@ -70,8 +82,16 @@
治疗方案
- 预防治疗
- 按需治疗
+
+ {{item}}
+
@@ -79,7 +99,13 @@
FIX暴露日
-
+
个
在某一天接受1次或多次凝血因子输注,该天计为1个暴露日
@@ -88,7 +114,7 @@
@@ -99,8 +125,16 @@
既往FIX抑制物病史
- 有
- 没有
+
+ {{item}}
+
@@ -108,13 +142,27 @@
既往肝脏疾病病史
- 有
- 没有
+
+ {{item}}
+
-
+
@@ -122,25 +170,40 @@
您是否有饮酒史?
- 从不
- 偶尔
- 经常
- 已戒酒
+
+ {{item}}
+
- 您是否有饮酒史?
+ 您是否有过敏史?
- 有
- 没有
+
+ {{item}}
+
例如高血压、消化性溃疡、精神疾病、青光眼、股骨头坏死等
- 有
- 没有
+
+ {{item}}
+
-
+
@@ -184,15 +261,16 @@
style="background: #fff url({{imageUrl}}body1.png?t={{Timestamp}}) no-repeat top center/345rpx 417rpx"
>
- 左侧手肘
- 右侧手肘
+ {{item.name}}
已选择关节
@@ -207,6 +285,7 @@