master
panliang 2023-10-14 16:13:13 +08:00
commit b77874e504
38 changed files with 15471 additions and 0 deletions

3
.env.development 100644
View File

@ -0,0 +1,3 @@
ENV = 'development'
VUE_APP_BASE_API = 'http://local.medical-record.host'

3
.env.production 100644
View File

@ -0,0 +1,3 @@
ENV = 'production'
VUE_APP_BASE_API = 'http://www.xbzt.cc'

23
.gitignore vendored 100644
View File

@ -0,0 +1,23 @@
.DS_Store
node_modules/
unpackage/
dist/
# local env files
.env.local
.env.*.local
# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Editor directories and files
.project
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw*

1
.npmrc 100644
View File

@ -0,0 +1 @@
shamefully-hoist=true

19
README.md 100644
View File

@ -0,0 +1,19 @@
# 宝芝堂-客户端
- `pnpm install`
## 修改 uview-ui
### node_modules\uview-ui\components\u-datetime-picker\u-datetime-picker.vue
```vue
<script>
export default {
watch: {
value(newValue) {
this.updateColumnValue(newValue)
},
}
}
</script>
```

81
babel.config.js 100644
View File

@ -0,0 +1,81 @@
const webpack = require('webpack')
const plugins = []
if (process.env.UNI_OPT_TREESHAKINGNG) {
plugins.push(require('@dcloudio/vue-cli-plugin-uni-optimize/packages/babel-plugin-uni-api/index.js'))
}
if (
(
process.env.UNI_PLATFORM === 'app-plus' &&
process.env.UNI_USING_V8
) ||
(
process.env.UNI_PLATFORM === 'h5' &&
process.env.UNI_H5_BROWSER === 'builtin'
)
) {
const path = require('path')
const isWin = /^win/.test(process.platform)
const normalizePath = path => (isWin ? path.replace(/\\/g, '/') : path)
const input = normalizePath(process.env.UNI_INPUT_DIR)
try {
plugins.push([
require('@dcloudio/vue-cli-plugin-hbuilderx/packages/babel-plugin-console'),
{
file (file) {
file = normalizePath(file)
if (file.indexOf(input) === 0) {
return path.relative(input, file)
}
return false
}
}
])
} catch (e) { }
}
process.UNI_LIBRARIES = process.UNI_LIBRARIES || ['@dcloudio/uni-ui']
process.UNI_LIBRARIES.forEach(libraryName => {
plugins.push([
'import',
{
'libraryName': libraryName,
'customName': (name) => {
return `${libraryName}/lib/${name}/${name}`
}
}
])
})
if (process.env.UNI_PLATFORM !== 'h5') {
plugins.push('@babel/plugin-transform-runtime')
}
const config = {
presets: [
[
'@vue/app',
{
modules: webpack.version[0] > 4 ? 'auto' : 'commonjs',
useBuiltIns: process.env.UNI_PLATFORM === 'h5' ? 'usage' : 'entry'
}
]
],
plugins
}
const UNI_H5_TEST = '**/@dcloudio/uni-h5/dist/index.umd.min.js'
if (process.env.NODE_ENV === 'production') {
config.overrides = [{
test: UNI_H5_TEST,
compact: true,
}]
} else {
config.ignore = [UNI_H5_TEST]
}
module.exports = config

107
package.json 100644
View File

@ -0,0 +1,107 @@
{
"name": "uniapp",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "npm run dev:h5",
"build": "npm run build:h5",
"build:app-plus": "cross-env NODE_ENV=production UNI_PLATFORM=app-plus vue-cli-service uni-build",
"build:custom": "cross-env NODE_ENV=production uniapp-cli custom",
"build:h5": "cross-env NODE_ENV=production UNI_PLATFORM=h5 vue-cli-service uni-build",
"build:mp-360": "cross-env NODE_ENV=production UNI_PLATFORM=mp-360 vue-cli-service uni-build",
"build:mp-alipay": "cross-env NODE_ENV=production UNI_PLATFORM=mp-alipay vue-cli-service uni-build",
"build:mp-baidu": "cross-env NODE_ENV=production UNI_PLATFORM=mp-baidu vue-cli-service uni-build",
"build:mp-jd": "cross-env NODE_ENV=production UNI_PLATFORM=mp-jd vue-cli-service uni-build",
"build:mp-kuaishou": "cross-env NODE_ENV=production UNI_PLATFORM=mp-kuaishou vue-cli-service uni-build",
"build:mp-lark": "cross-env NODE_ENV=production UNI_PLATFORM=mp-lark vue-cli-service uni-build",
"build:mp-qq": "cross-env NODE_ENV=production UNI_PLATFORM=mp-qq vue-cli-service uni-build",
"build:mp-toutiao": "cross-env NODE_ENV=production UNI_PLATFORM=mp-toutiao vue-cli-service uni-build",
"build:mp-weixin": "cross-env NODE_ENV=production UNI_PLATFORM=mp-weixin vue-cli-service uni-build",
"build:mp-xhs": "cross-env NODE_ENV=production UNI_PLATFORM=mp-xhs vue-cli-service uni-build",
"build:quickapp-native": "cross-env NODE_ENV=production UNI_PLATFORM=quickapp-native vue-cli-service uni-build",
"build:quickapp-webview": "cross-env NODE_ENV=production UNI_PLATFORM=quickapp-webview vue-cli-service uni-build",
"build:quickapp-webview-huawei": "cross-env NODE_ENV=production UNI_PLATFORM=quickapp-webview-huawei vue-cli-service uni-build",
"build:quickapp-webview-union": "cross-env NODE_ENV=production UNI_PLATFORM=quickapp-webview-union vue-cli-service uni-build",
"dev:app-plus": "cross-env NODE_ENV=development UNI_PLATFORM=app-plus vue-cli-service uni-build --watch",
"dev:custom": "cross-env NODE_ENV=development uniapp-cli custom",
"dev:h5": "cross-env NODE_ENV=development UNI_PLATFORM=h5 vue-cli-service uni-serve",
"dev:mp-360": "cross-env NODE_ENV=development UNI_PLATFORM=mp-360 vue-cli-service uni-build --watch",
"dev:mp-alipay": "cross-env NODE_ENV=development UNI_PLATFORM=mp-alipay vue-cli-service uni-build --watch",
"dev:mp-baidu": "cross-env NODE_ENV=development UNI_PLATFORM=mp-baidu vue-cli-service uni-build --watch",
"dev:mp-jd": "cross-env NODE_ENV=development UNI_PLATFORM=mp-jd vue-cli-service uni-build --watch",
"dev:mp-kuaishou": "cross-env NODE_ENV=development UNI_PLATFORM=mp-kuaishou vue-cli-service uni-build --watch",
"dev:mp-lark": "cross-env NODE_ENV=development UNI_PLATFORM=mp-lark vue-cli-service uni-build --watch",
"dev:mp-qq": "cross-env NODE_ENV=development UNI_PLATFORM=mp-qq vue-cli-service uni-build --watch",
"dev:mp-toutiao": "cross-env NODE_ENV=development UNI_PLATFORM=mp-toutiao vue-cli-service uni-build --watch",
"dev:mp-weixin": "cross-env NODE_ENV=development UNI_PLATFORM=mp-weixin vue-cli-service uni-build --watch",
"dev:mp-xhs": "cross-env NODE_ENV=development UNI_PLATFORM=mp-xhs vue-cli-service uni-build --watch",
"dev:quickapp-native": "cross-env NODE_ENV=development UNI_PLATFORM=quickapp-native vue-cli-service uni-build --watch",
"dev:quickapp-webview": "cross-env NODE_ENV=development UNI_PLATFORM=quickapp-webview vue-cli-service uni-build --watch",
"dev:quickapp-webview-huawei": "cross-env NODE_ENV=development UNI_PLATFORM=quickapp-webview-huawei vue-cli-service uni-build --watch",
"dev:quickapp-webview-union": "cross-env NODE_ENV=development UNI_PLATFORM=quickapp-webview-union vue-cli-service uni-build --watch",
"info": "node node_modules/@dcloudio/vue-cli-plugin-uni/commands/info.js",
"serve:quickapp-native": "node node_modules/@dcloudio/uni-quickapp-native/bin/serve.js",
"test:android": "cross-env UNI_PLATFORM=app-plus UNI_OS_NAME=android jest -i",
"test:h5": "cross-env UNI_PLATFORM=h5 jest -i",
"test:ios": "cross-env UNI_PLATFORM=app-plus UNI_OS_NAME=ios jest -i",
"test:mp-baidu": "cross-env UNI_PLATFORM=mp-baidu jest -i",
"test:mp-weixin": "cross-env UNI_PLATFORM=mp-weixin jest -i"
},
"dependencies": {
"@dcloudio/uni-app": "^2.0.2-3061420221215001",
"@dcloudio/uni-app-plus": "^2.0.2-3061420221215001",
"@dcloudio/uni-h5": "^2.0.2-3061420221215001",
"@dcloudio/uni-i18n": "^2.0.2-3061420221215001",
"@dcloudio/uni-mp-360": "^2.0.2-3061420221215001",
"@dcloudio/uni-mp-alipay": "^2.0.2-3061420221215001",
"@dcloudio/uni-mp-baidu": "^2.0.2-3061420221215001",
"@dcloudio/uni-mp-jd": "^2.0.2-3061420221215001",
"@dcloudio/uni-mp-kuaishou": "^2.0.2-3061420221215001",
"@dcloudio/uni-mp-lark": "^2.0.2-3061420221215001",
"@dcloudio/uni-mp-qq": "^2.0.2-3061420221215001",
"@dcloudio/uni-mp-toutiao": "^2.0.2-3061420221215001",
"@dcloudio/uni-mp-vue": "^2.0.2-3061420221215001",
"@dcloudio/uni-mp-weixin": "^2.0.2-3061420221215001",
"@dcloudio/uni-mp-xhs": "^2.0.2-3061420221215001",
"@dcloudio/uni-quickapp-native": "^2.0.2-3061420221215001",
"@dcloudio/uni-quickapp-webview": "^2.0.2-3061420221215001",
"@dcloudio/uni-stacktracey": "^2.0.2-3061420221215001",
"@dcloudio/uni-stat": "^2.0.2-3061420221215001",
"@vue/shared": "^3.0.0",
"core-js": "^3.8.3",
"flyio": "^0.6.2",
"uview-ui": "^2.0.36",
"vue": ">= 2.6.14 < 2.7",
"vuex": "^3.2.0"
},
"devDependencies": {
"@dcloudio/types": "^3.3.2",
"@dcloudio/uni-automator": "^2.0.2-3061420221215001",
"@dcloudio/uni-cli-i18n": "^2.0.2-3061420221215001",
"@dcloudio/uni-cli-shared": "^2.0.2-3061420221215001",
"@dcloudio/uni-helper-json": "*",
"@dcloudio/uni-migration": "^2.0.2-3061420221215001",
"@dcloudio/uni-template-compiler": "^2.0.2-3061420221215001",
"@dcloudio/vue-cli-plugin-hbuilderx": "^2.0.2-3061420221215001",
"@dcloudio/vue-cli-plugin-uni": "^2.0.2-3061420221215001",
"@dcloudio/vue-cli-plugin-uni-optimize": "^2.0.2-3061420221215001",
"@dcloudio/webpack-uni-mp-loader": "^2.0.2-3061420221215001",
"@dcloudio/webpack-uni-pages-loader": "^2.0.2-3061420221215001",
"@vue/cli-plugin-babel": "~5.0.0",
"@vue/cli-service": "~5.0.0",
"babel-plugin-import": "^1.11.0",
"cross-env": "^7.0.2",
"jest": "^25.4.0",
"postcss-comment": "^2.0.0",
"sass": "^1.66.1",
"sass-loader": "10",
"vue-template-compiler": ">= 2.6.14 < 2.7"
},
"browserslist": [
"Android >= 4.4",
"ios >= 9"
],
"uni-app": {
"scripts": {}
}
}

12175
pnpm-lock.yaml 100644

File diff suppressed because it is too large Load Diff

27
postcss.config.js 100644
View File

@ -0,0 +1,27 @@
const path = require('path')
const webpack = require('webpack')
const config = {
parser: require('postcss-comment'),
plugins: [
require('postcss-import')({
resolve (id, basedir, importOptions) {
if (id.startsWith('~@/')) {
return path.resolve(process.env.UNI_INPUT_DIR, id.substr(3))
} else if (id.startsWith('@/')) {
return path.resolve(process.env.UNI_INPUT_DIR, id.substr(2))
} else if (id.startsWith('/') && !id.startsWith('//')) {
return path.resolve(process.env.UNI_INPUT_DIR, id.substr(1))
}
return id
}
}),
require('autoprefixer')({
remove: process.env.UNI_PLATFORM !== 'h5'
}),
require('@dcloudio/vue-cli-plugin-uni/packages/postcss')
]
}
if (webpack.version[0] > 4) {
delete config.parser
}
module.exports = config

8
public/.htaccess 100644
View File

@ -0,0 +1,8 @@
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /h5/
RewriteRule ^index\.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /h5/index.html [L]
</IfModule>

25
public/index.html 100644
View File

@ -0,0 +1,25 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>
<%= htmlWebpackPlugin.options.title %>
</title>
<script>
var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') || CSS.supports('top: constant(a)'))
document.write('<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' + (coverSupport ? ', viewport-fit=cover' : '') + '" />')
</script>
<link rel="stylesheet" href="<%= BASE_URL %>static/index.<%= VUE_APP_INDEX_CSS_HASH %>.css" />
</head>
<body>
<noscript>
<strong>Please enable JavaScript to continue.</strong>
</noscript>
<div id="app"></div>
<!-- built files will be auto injected -->
</body>
</html>

View File

@ -0,0 +1,3 @@
location /h5 {
try_files $uri $uri/h5 /h5/index.html?$query_string;
}

11
shims-uni.d.ts vendored 100644
View File

@ -0,0 +1,11 @@
/// <reference types='@dcloudio/types' />
import Vue from 'vue'
declare module "vue/types/options" {
type Hooks = App.AppInstance & Page.PageInstance;
interface ComponentOptions<V extends Vue> extends Hooks {
/**
*
*/
mpType?: string;
}
}

4
shims-vue.d.ts vendored 100644
View File

@ -0,0 +1,4 @@
declare module "*.vue" {
import Vue from 'vue'
export default Vue
}

20
src/App.vue 100644
View File

@ -0,0 +1,20 @@
<style lang="scss">
/* 注意要写在第一行同时给style标签加入lang="scss"属性 */
@import "uview-ui/index.scss";
body {
background-color: $u-bg-color;
}
</style>
<script>
export default {
onLaunch: function() {
console.log('App Launch')
},
onShow: function() {
console.log('App Show')
},
onHide: function() {
console.log('App Hide')
}
}
</script>

View File

@ -0,0 +1,52 @@
<template>
<u-modal :show="show" showCancelButton @cancel="close" @confirm="confirm">
<!-- <editor id="editor" placeholder="请输入内容" @ready="onEditorReady" /> -->
<textarea v-model="value" />
</u-modal>
</template>
<script>
export default {
name: 'CuEditor',
data() {
return {
value: '',
show: false,
editor: ''
}
},
methods: {
onEditorReady() {
uni.createSelectorQuery().select('#editor').context((res) => {
this.editor = res.context
if (this.value) {
this.editor.setContents({
html: this.value
})
}
}).exec()
},
open(value) {
this.value = value
this.show = true
},
close() {
this.show = false
},
confirm() {
if (this.editor) {
this.editor.getContents({
success: (e) => {
this.$emit('confirm', e.html)
this.close()
}
})
} else {
this.$emit('confirm', this.value)
this.close()
}
},
}
}
</script>

View File

@ -0,0 +1,82 @@
<template>
<u-upload
ref="cu-upload"
:fileList="fileList"
:maxCount="count"
:multiple="multiple"
previewFullImage
@afterRead="afterRead"
@delete="deletePic"
/>
</template>
<script>
export default {
name: 'CuImage',
props: {
count: {
type: Number,
default: 5
},
multiple: {
type: Boolean,
default: false
}
},
data() {
return {
fileList: []
}
},
methods: {
deletePic(event) {
uni.showModal({
title: '删除图片',
content: '是否确定?',
success: (res) => {
if (res.confirm) {
this.fileList.splice(event.index, 1)
this.$emit('update', this.fileList)
}
}
})
},
async afterRead(event) {
let lists = [].concat(event.file)
let fileListLen = this.fileList.length
lists.map((item) => {
this.fileList.push({
...item,
status: 'uploading',
message: '上传中'
})
})
for (let i = 0; i < lists.length; i++) {
const res = await this.upload(lists[i])
let item = this.fileList[fileListLen]
this.fileList.splice(fileListLen, 1, Object.assign(item, {
status: res.status == 0 ? 'success' : 'failed',
message: res.msg,
url: res.status == 0 ? res.data.value : lists[i].url
}))
fileListLen++
}
this.$emit('update', this.fileList)
},
upload(file) {
return this.$ajax.upload('/admin-api/upload_image', {
params: { 'full-url': 1 },
filePath: file.url,
custom: { toast: false, loading: false },
name: 'file'
})
},
getList() {
return this.fileList
},
setList(list) {
this.fileList = list
},
}
}
</script>

View File

@ -0,0 +1,108 @@
<template>
<u-popup :show="show" mode="right" :safeAreaInsetTop="true" @close="close" @open="open">
<u-search
v-model="search"
placeholder="输入姓名搜索"
:clearabled="true"
:showAction="false"
margin="10px 0"
@search="load(true)"
@change="changeSearch"
/>
<u-list :width="300" :height="listHeight" @scrolltolower="reachBottom">
<u-list-item v-for="(item, index) in list" :key="item.id">
<u-cell
:title="item.name"
:icon="item.avatar"
:name="index"
clickable
@click="click"
/>
</u-list-item>
</u-list>
<view v-if="loading" class="loading">
<u-loadmore :status="status" />
</view>
</u-popup>
</template>
<script>
export default {
name: "SelectAdminUser",
data () {
return {
search: '',
show: false,
list: [],
page: 1,
perPage: 20,
loading: true,
// 'loading', 'nomore', 'loadmore'
status: 'loadmore',
listHeight: 0,
}
},
created() {
this.load(true)
uni.getSystemInfo({
success: (res) => {
this.listHeight = res.safeArea.height - 54
}
})
},
methods: {
open() {
this.show = true
},
close() {
this.show = false
},
click(e) {
this.$emit('select', this.list[e.name])
},
load(refresh) {
if (refresh) {
this.page = 1
this.list = []
this.status = 'loadmore'
}
if (this.status == 'nomore') {
return ;
}
this.loading = true
this.status = 'loading'
// uni.showLoading()
const params = {_action: 'getData', page: this.page, perPage: this.perPage, keyword: this.search}
this.$ajax.get('/admin-api/system/admin_users', { params }).then(res => {
this.loading = false
if (res.status == 0) {
this.list = this.list.concat(res.data.items)
if (this.list.length >= res.data.total) {
this.status = 'nomore'
}
}
}).catch(error => {
this.loading = false
this.status = 'nomore'
})
},
reachBottom() {
this.page++
this.load()
},
changeSearch(value) {
if (!value) {
this.load(true)
}
},
}
}
</script>
<style scoped>
.loading {
position: fixed;
bottom: 0;
background-color: white;
width: 300px;
}
</style>

View File

@ -0,0 +1,115 @@
<template>
<u-popup :show="show" mode="right" :safeAreaInsetTop="true" @close="close" @open="open">
<u-search
v-model="search"
placeholder="输入 姓名/手机号 搜索"
:clearabled="true"
:showAction="false"
margin="10px 0"
@search="load(true)"
@change="changeSearch"
/>
<u-list :width="300" :height="listHeight" @scrolltolower="reachBottom">
<u-list-item v-for="(item, index) in list" :key="item.id">
<u-cell
:title="item.name"
:name="index"
:value="item.phone"
clickable
@click="click"
/>
</u-list-item>
</u-list>
<view v-if="loading" class="loading">
<u-loadmore :status="status" />
</view>
</u-popup>
</template>
<script>
export default {
name: "SelectAdminUser",
props: ['type'],
data () {
return {
search: '',
show: false,
list: [],
page: 1,
perPage: 20,
loading: true,
// 'loading', 'nomore', 'loadmore'
status: 'loadmore',
listHeight: 0,
}
},
created() {
this.load(true)
uni.getSystemInfo({
success: (res) => {
this.listHeight = res.safeArea.height - 54
}
})
},
methods: {
open() {
this.show = true
},
close() {
this.show = false
},
click(e) {
this.$emit('select', this.list[e.name])
},
load(refresh) {
if (refresh) {
this.page = 1
this.list = []
this.status = 'loadmore'
}
if (this.status == 'nomore') {
return ;
}
this.loading = true
this.status = 'loading'
// uni.showLoading()
const params = {
_action: 'getData',
page: this.page,
perPage: this.perPage,
keyword: this.search,
ignore_type_id: this.type ? this.type : uni.getStorageSync('medical_record_treat_type_id')
}
this.$ajax.get('/admin-api/user', { params }).then(res => {
this.loading = false
if (res.status == 0) {
this.list = this.list.concat(res.data.items)
if (this.list.length >= res.data.total) {
this.status = 'nomore'
}
}
}).catch(error => {
this.loading = false
this.status = 'nomore'
})
},
reachBottom() {
this.page++
this.load()
},
changeSearch(value) {
if (!value) {
this.load(true)
}
},
}
}
</script>
<style scoped>
.loading {
position: fixed;
bottom: 0;
background-color: white;
width: 300px;
}
</style>

View File

@ -0,0 +1,16 @@
const gender = {
none: { value: 0, text: '未知' },
male: { value: 1, text: '男' },
female: { value: 2, text: '女' },
}
gender.options = []
gender.map = {}
Object.keys(gender).forEach(key => {
if (gender[key] !== undefined && gender[key].value !== undefined) {
gender.options.push({ name: gender[key].text, value: gender[key].value })
gender.map[gender[key].value] = gender[key].text
}
})
export default gender

View File

@ -0,0 +1,15 @@
const orderStatus = {
none: { value: 0, text: '未收' },
success: { value: 1, text: '已收' },
}
orderStatus.options = []
orderStatus.map = {}
Object.keys(orderStatus).forEach(key => {
if (orderStatus[key] !== undefined && orderStatus[key].value !== undefined) {
orderStatus.options.push({ name: orderStatus[key].text, value: orderStatus[key].value })
orderStatus.map[orderStatus[key].value] = orderStatus[key].text
}
})
export default orderStatus

28
src/main.js 100644
View File

@ -0,0 +1,28 @@
import Vue from 'vue'
import App from './App'
import './uni.promisify.adaptor'
import uView from "uview-ui"
import { formatDate } from './utils/index'
Vue.config.productionTip = false
Vue.use(uView);
Vue.filter('date', function (value, format) {
if (!format) {
format = 'yyyy-MM-dd HH:mm:ss'
}
return formatDate(value, format)
})
Vue.config.productionTip = false
App.mpType = 'app'
const app = new Vue({
...App
})
require('@/utils/request.js')()
Vue.prototype.$ajax = uni.$u.http
app.$mount()

86
src/manifest.json 100644
View File

@ -0,0 +1,86 @@
{
"name" : "宝芝堂",
"appid" : "__UNI__828F200",
"description" : "",
"versionName" : "1.0.0",
"versionCode" : "100",
"transformPx" : false,
"app-plus" : {
/* 5+App */
"usingComponents" : true,
"splashscreen" : {
"alwaysShowBeforeRender" : true,
"waiting" : true,
"autoclose" : true,
"delay" : 0
},
"modules" : {},
/* */
"distribute" : {
/* */
"android" : {
/* android */
"permissions" : [
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
"<uses-permission android:name=\"android.permission.READ_CONTACTS\"/>",
"<uses-permission android:name=\"android.permission.VIBRATE\"/>",
"<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
"<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
"<uses-permission android:name=\"android.permission.WRITE_CONTACTS\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",
"<uses-permission android:name=\"android.permission.CAMERA\"/>",
"<uses-permission android:name=\"android.permission.RECORD_AUDIO\"/>",
"<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",
"<uses-permission android:name=\"android.permission.MODIFY_AUDIO_SETTINGS\"/>",
"<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
"<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
"<uses-permission android:name=\"android.permission.CALL_PHONE\"/>",
"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_COARSE_LOCATION\"/>",
"<uses-feature android:name=\"android.hardware.camera\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_FINE_LOCATION\"/>",
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
]
},
"ios" : {},
/* ios */
"sdkConfigs" : {}
}
},
/* SDK */
"quickapp" : {},
/* */
"mp-weixin" : {
/* */
"appid" : "",
"setting" : {
"urlCheck" : false
},
"usingComponents" : true
},
"mp-alipay" : {
"usingComponents" : true
},
"mp-baidu" : {
"usingComponents" : true
},
"mp-toutiao" : {
"usingComponents" : true
},
"mp-qq" : {
"usingComponents" : true
},
"h5" : {
"title" : "宝芝堂",
"router" : {
"mode" : "history",
"base" : "/client/"
},
"devServer" : {
"https" : false
}
}
}

74
src/pages.json 100644
View File

@ -0,0 +1,74 @@
{
"pages": [
{
"path": "pages/index/index",
"style": {
"navigationBarTitleText": "宝芝堂"
}
},
{
"path": "pages/index/welcome",
"style": {
"navigationBarTitleText": "宝芝堂"
}
},
{
"path": "pages/login/login",
"style": {
"navigationBarTitleText": "登录"
}
},
{
"path": "pages/patient/index",
"style": {
"navigationBarTitleText": "病人管理",
"enablePullDownRefresh": true
}
},
{
"path": "pages/patient/detail",
"style": {
"navigationBarTitleText": "病人详细",
"enablePullDownRefresh": true
}
},
{
"path": "pages/patient/form",
"style": {
"navigationBarTitleText": "病人表单"
}
},
{
"path": "pages/record/form",
"style": {
"navigationBarTitleText": "病历表单"
}
},
{
"path": "pages/record/index",
"style": {
"navigationBarTitleText": "病历记录",
"enablePullDownRefresh": true
}
},
{
"path": "pages/record/detail",
"style": {
"navigationBarTitleText": "病历详细",
"enablePullDownRefresh": true
}
}
],
"globalStyle": {
"navigationBarTextStyle": "black",
"navigationBarTitleText": "宝芝堂",
"navigationBarBackgroundColor": "#F8F8F8",
"backgroundColor": "#F8F8F8"
// #ifdef H5
,"navigationStyle": "custom"
// #endif
},
"easycom": {
"^u-(.*)": "uview-ui/components/u-$1/u-$1.vue"
}
}

View File

@ -0,0 +1,99 @@
<template>
<view class="page">
<view class="info">
<u-cell-group>
<u-cell :title="info.name">
<view slot="icon">
<u-avatar :src="info.avatar" />
</view>
</u-cell>
</u-cell-group>
</view>
<view class="btns">
<u-empty v-if="list.length == 0" mode="list" text="暂无分类" />
<view class="btn" v-for="item in list" :key="item.id">
<u-button
:icon="item.image"
:text="item.name"
size="large"
@click="itemClick(item.id)"
/>
</view>
</view>
<view class="footer">
<u-button text="退出登录" type="error" @click="logout" />
</view>
</view>
</template>
<script>
export default {
data() {
return {
info: {},
list: []
}
},
onLoad() {
this.init()
},
methods: {
init() {
this.$ajax.get('/admin-api/api/category/permission-list', {custom: { loading: true }}).then(res => {
if (res.status == 0) {
this.list = res.data.items
}
})
this.$ajax.get('/admin-api/current-user').then(res => {
if (res.status == 0) {
this.info = res.data
}
})
},
itemClick(e) {
uni.setStorageSync('medical_record_treat_type_id', e)
uni.navigateTo({
url: '/pages/patient/index'
})
},
logout() {
uni.showModal({
title: '退出登录',
content: '是否确定?',
success: (e) => {
if (e.confirm) {
this.$ajax.get('/admin-api/logout').then(res => {
if (res.status == 0) {
uni.removeStorageSync('medical_record_client_auth_token')
uni.reLaunch({ url: '/pages/login/login' })
}
})
}
}
})
}
}
}
</script>
<style scoped>
.page {
padding: 20px 10px;
box-sizing: border-box;
}
.info {
background: white;
}
.btns {
margin-top: 300rpx;
display: flex;
flex-direction: column;
align-items: center;
}
.btns .btn {
width: 100%;
margin-top: 20px;
}
.footer {
margin-top: 100rpx;
}
</style>

View File

@ -0,0 +1,26 @@
<template>
</template>
<script>
export default {
data() {
return {}
},
onLoad(e) {
if (e.token) {
uni.setStorageSync('medical_record_client_auth_token', e.token)
uni.reLaunch({
url: '/pages/index/index'
})
} else if (e.reLaunch) {
uni.reLaunch({
url: e.reLaunch
})
} else {
uni.reLaunch({
url: '/pages/login/login'
})
}
},
}
</script>

View File

@ -0,0 +1,169 @@
<template>
<view class="page">
<view class="form">
<view class="title">
<u-row justify="space-between">
<u-col span="6">
<u--image :src="logo" width="40" height="40" />
</u-col>
<u-col span="6" textAlign="right">
<text class="app-name">{{ appName }}</text>
</u-col>
</u-row>
</view>
<u--form :model="user" ref="form" labelWidth="70">
<u-form-item label="用户名" prop="username" ref="username" :required="true">
<u--input v-model="user.username" :focus="true" border="bottom" placeholder="请填写用户名" />
</u-form-item>
<u-form-item label="密码" prop="password" ref="password" :required="true">
<u--input v-model="user.password" border="bottom" placeholder="请填写密码" password />
</u-form-item>
<u-form-item v-if="setting.login_captcha" label="验证码" prop="captcha" ref="captcha" :required="true">
<u-input v-model="user.captcha" border="bottom" placeholder="请填写验证码">
<view slot="suffix">
<u--image :src="captcha" width="100" height="40" @click="getCaptcha" />
</view>
</u-input>
</u-form-item>
</u--form>
<view class="button">
<u-button text="登录" type="primary" @click="submit"></u-button>
</view>
</view>
<view class="icp">
<text @click="handleIcp">{{ setting.web_icp }}</text>
</view>
</view>
</template>
<script>
export default {
data() {
return {
user: {
username: '',
password: '',
captcha: '',
sys_captcha: '',
openid: '',
open_type: '',
},
rules: {
username: {
required: true,
message: '用户名必填',
trigger: ['blur', 'change']
},
password: {
required: true,
message: '密码必填',
trigger: ['blur', 'change']
},
captcha: {
required: false,
message: '验证码必填',
trigger: ['blur', 'change']
}
},
setting: {
login_captcha: false,
web_icp: ''
},
captcha: '',
logo: '',
appName: '',
openid: '',
open_type: '',
}
},
onLoad(e) {
this.user.openid = e.openid
this.user.open_type = e.open_type
},
onReady() {
this.$refs['form'].setRules(this.rules)
this.$ajax.get('/admin-api/_settings').then(res => {
if (res.status == 0) {
this.setting = res.data
this.logo = this.setting.logo
this.appName = this.setting.app_name
if (this.setting.login_captcha) {
this.rules.captcha.required = true
this.getCaptcha()
}
}
})
},
methods: {
submit() {
this.$refs['form'].validate().then(res => {
uni.showLoading()
this.$ajax.post('/admin-api/login', this.user).then(res => {
uni.hideLoading()
if (res.status == 0) {
uni.showToast({
title: '登录成功',
icon: 'success'
})
uni.setStorageSync('medical_record_client_auth_token', res.data.token)
uni.redirectTo({
url: '/pages/index/index'
})
}
})
}).catch(error => {})
},
getCaptcha() {
this.$ajax.get('/admin-api/captcha').then(res => {
if (res.status == 0) {
this.captcha = res.data.captcha_img
this.user.sys_captcha = res.data.sys_captcha
}
})
},
handleIcp() {
// #ifdef H5
window.open('https://beian.miit.gov.cn', '_blank')
// #endif
}
}
}
</script>
<style lang="scss" scoped>
.page {
background: linear-gradient(200deg, rgb(198, 225, 255) 0%, rgb(64, 128, 255) 100%);
height: 100vh;
display: flex;
flex-direction: column;
justify-content: center;
}
.buttom-image {
position: absolute;
width: 100%;
height: 200px;
bottom: 0;
top: 80%;
}
.form {
padding: 10px 20px;
background-color: white;
margin: 0 10px;
border-radius: 10px;
}
.title {
margin: 10px 0;
}
.button {
margin-top: 10px
}
.app-name {
font-size: 20px;
}
.icp {
margin-top: 50px;
text-align: center;
color: white;
}
</style>

View File

@ -0,0 +1,356 @@
<template>
<view class="page">
<u-cell-group :border="false">
<u-cell title="类别" :value="info.type ? info.type.name : ''" />
<u-cell title="客户" :value="info.user ? info.user.phone : ''" />
<u-cell
title="姓名"
:value="info.name"
isLink
rightIcon="edit-pen"
@click="openModal('姓名', 'name')"
/>
<u-cell
title="性别"
:value="info.sex_text"
isLink
rightIcon="edit-pen"
@click="toggleGender"
/>
<u-cell isLink>
<view slot="icon" @click="handleCall(info.phone)">
<u-icon name="phone" />
</view>
<view slot="title" @click="openModal('联系方式', 'phone')">联系方式</view>
<view slot="value" @click="openModal('联系方式', 'phone')">{{ info.phone }}</view>
<view slot="right-icon" @click="openModal('联系方式', 'phone')">
<u-icon name="edit-pen" />
</view>
</u-cell>
<u-cell
title="地址"
:value="info.address"
clickable
isLink
rightIcon="edit-pen"
@click="openModal('地址', 'address')"
/>
<u-cell
title="出生年月"
:value="info.birthday | date('yyyy-MM-dd')"
isLink
rightIcon="edit-pen"
@click="toggleBirthday('birthday')"
/>
<u-cell
title="初诊时间"
:value="info.treat_at | date('yyyy-MM-dd')"
isLink
rightIcon="edit-pen"
@click="toggleBirthday('treat_at')"
/>
<u-cell
title="初诊医生"
:value="info.doctor?info.doctor.name : ''"
isLink
rightIcon="edit-pen"
@click="opendDoctor('doctor')"
/>
<u-cell
title="邀请人"
:value="info.inviter?info.inviter.name : ''"
isLink
rightIcon="edit-pen"
@click="opendDoctor('inviter')"
/>
<u-cell
title="业务员"
:value="info.saler?info.saler.name : ''"
isLink
rightIcon="edit-pen"
@click="opendDoctor('saler')"
/>
<u-cell
title="病情描述"
isLink
rightIcon="edit-pen"
@click="openEditor"
>
<view slot="value">
<!-- <rich-text :nodes="info.illness" /> -->
<text>{{info.illness}}</text>
</view>
</u-cell>
<u-cell title="图片资料">
<view slot="value">
<cu-image ref="images" @update="updateImages" />
</view>
</u-cell>
<u-cell title="录入时间" :value="info.created_at"/>
</u-cell-group>
<div class="btn">
<u-button text="添加病历" type="primary" @click="addRecord" />
<u-button text="病历记录" type="success" @click="listRecord" />
<u-button text="删除病人" type="error" @click="deletePatient" />
</div>
<u-modal
:show="modal.show"
:title="modal.title"
:showCancelButton="true"
:closeOnClickOverlay="true"
:asyncClose="true"
@confirm="confirmModal"
@cancel="closeModal"
@close="closeModal"
>
<u--input v-model="modal.value" border="surround" />
</u-modal>
<u-action-sheet
:show="genderSheet.show"
:actions="gender.options"
:closeOnClickOverlay="true"
@close="toggleGender"
@select="selectGender"
/>
<u-datetime-picker
v-model="datePicker.value"
mode="date"
:show="datePicker.show"
:closeOnClickOverlay="true"
:minDate="datePicker.minDate"
@close="toggleBirthday"
@cancel="toggleBirthday"
@confirm="selectBirthday"
/>
<select-admin-user ref="select-admin-user" @select="selectDoctor" />
<cu-editor ref="editor" @confirm="confirmEditor" />
</view>
</template>
<script>
import gender from '../../enums/gender'
import SelectAdminUser from '../../components/select-admin-user'
import CuEditor from '../../components/cu-editor'
import CuImage from '../../components/cu-image'
export default {
components: {SelectAdminUser, CuEditor, CuImage},
data() {
return {
id: '',
info: {
images: [],
doctor_id: '',
doctor: {},
},
modal: {
type: 'text',
show: false,
title: '',
key: '',
value: ''
},
gender: gender,
genderSheet: {
show: false,
},
datePicker: {
show: false,
name: '',
value: (new Date).getTime(),
minDate: (new Date('1900/1/1')).getTime()
},
adminUser: {
key: ''
}
}
},
onLoad(e) {
this.id = e.id
this.loadData()
},
onPullDownRefresh() {
this.loadData()
},
methods: {
loadData() {
if (!this.id) {
return
}
uni.showLoading()
const params = {_action: 'getData'}
this.$ajax.get(`/admin-api/patient/${this.id}`, { params }).then(res => {
uni.stopPullDownRefresh()
if (res.status == 0) {
this.info = {
...res.data,
birthday: res.data.birthday ? res.data.birthday.replaceAll('-', '/') : '',
treat_at: res.data.treat_at ? res.data.treat_at.replaceAll('-', '/') : '',
}
if (res.data.images) {
this.$refs['images'].setList(res.data.images.map(value => {
return { url: value }
}))
}
uni.setNavigationBarTitle({ title: this.info.name })
}
}).catch(error => {
uni.stopPullDownRefresh()
})
},
openModal(title, name) {
this.modal.title = title
this.modal.key = name
this.modal.show = true
this.modal.value = this.info[name]
},
confirmModal() {
const key = this.modal.key
const value = this.modal.value
const params = {}
params[key] = value
this.update(params).then(res => {
this.modal.show = false
if (res.status == 0) {
this.info[key] = value
}
})
},
closeModal() {
this.modal.show = false
},
openEditor() {
this.$refs['editor'].open(this.info.illness)
},
confirmEditor(e) {
this.update({ illness: e }).then(res => {
if (res.status == 0) {
this.info.illness = e
}
})
},
toggleGender() {
this.genderSheet.show = !this.genderSheet.show
},
selectGender(e) {
this.update({ sex: e.value }).then(res => {
if (res.status == 0) {
this.info.sex = e.value
this.info.sex_text = e.name
}
})
},
toggleBirthday(name) {
if (name) {
this.datePicker.name = name
this.datePicker.value = new Date(this.info[name]).getTime()
}
this.datePicker.show = !this.datePicker.show
},
selectBirthday(e) {
const time = Math.floor(e.value / 1000)
const key = this.datePicker.name
const params = {}
params[key] = time
this.update(params).then(res => {
if (res.status == 0) {
this.info[key] = e.value
this.toggleBirthday()
}
})
},
opendDoctor(key) {
this.adminUser.key = key
this.$refs['select-admin-user'].open()
},
closeDoctor() {
this.$refs['select-admin-user'].close()
},
selectDoctor(e) {
const key = this.adminUser.key
const params = {}
params[`${key}_id`] = e.id
this.update(params).then(res => {
if (res.status == 0) {
this.info[`${key}_id`] = e.id
this.info[key] = { id: e.id, name: e.name }
}
})
this.closeDoctor()
},
updateImages(e) {
const list = e.map(item => item.url)
this.update({ images: list }).then(res => {
if (res.status == 0) {
console.log(res)
}
})
},
addRecord() {
return uni.navigateTo({ url: `/pages/record/form?patient=${this.id}` })
},
listRecord() {
return uni.navigateTo({ url: `/pages/record/index?patient=${this.id}` })
},
deletePatient() {
uni.showModal({
title: '删除 ' + this.info.name,
content: '是否确定?',
success: (result) => {
if (result.confirm) {
this.delete(this.info.id)
}
}
})
},
update(data) {
const params = Object.assign({id: this.id}, data)
return this.$ajax.put(`/admin-api/patient/${this.id}`, params, { custom: { loading: true } })
},
delete(id) {
uni.showLoading()
this.$ajax.delete(`/admin-api/patient/${id}`).then(res => {
if (res.status == 0) {
uni.showToast({
title: '删除成功',
icon: 'success'
})
setTimeout(() => {
uni.navigateBack()
}, 1000)
}
})
},
handleCall(phone) {
if (phone) {
window.open(`tel:${phone}`, '_blank')
} else {
this.openModal('联系方式', 'phone')
}
// uni.makePhoneCall({
// phoneNumber: phone
// });
}
}
}
</script>
<style scoped>
.page {
padding: 20px;
background: white;
}
.u-cell-group {
background: white;
}
.btn {
padding: 0 10px;
}
.btn .u-button {
margin-top: 20px;
}
.page ::v-deep .u-upload__wrap {
justify-content: flex-end;
}
.text-gray {color: gray}
</style>

View File

@ -0,0 +1,326 @@
<template>
<view class="page">
<u--form :model="form" ref="form" labelWidth="70">
<u-form-item prop="user_id" label="客户" required @click="openUser">
<view class="input-text">
<text v-if="form.user_id">{{ user.text }}</text>
<text v-else class="input-placeholder">请选择客户</text>
<u-icon name="arrow-right" />
</view>
</u-form-item>
<u-form-item prop="name" label="姓名" :required="true">
<u--input v-model="form.name" border="bottom" placeholder="请输入姓名" />
</u-form-item>
<u-form-item prop="sex" label="性别" @click="toggleGender">
<view class="input-text">
<text>{{ genderSelect }}</text>
<u-icon name="arrow-right" />
</view>
</u-form-item>
<u-form-item prop="phone" label="联系方式">
<u--input v-model="form.phone" border="bottom" placeholder="请输入联系方式" />
</u-form-item>
<u-form-item prop="address" label="地址">
<u--input v-model="form.address" border="bottom" placeholder="请输入地址" />
</u-form-item>
<u-form-item prop="birthday" label="出生年月" @click="toggleBirthday('birthday')">
<view class="input-text">
<text v-if="form.birthday">{{ form.birthday | date('yyyy-MM-dd') }}</text>
<text v-else class="input-placeholder">请选择出生日期</text>
<u-icon name="arrow-right" />
</view>
</u-form-item>
<u-form-item prop="treat_at" label="初诊日期" @click="toggleBirthday('treat_at')">
<view class="input-text">
<text v-if="form.treat_at">{{ form.treat_at | date('yyyy-MM-dd') }}</text>
<text v-else class="input-placeholder">请选择初诊日期</text>
<u-icon name="arrow-right" />
</view>
</u-form-item>
<u-form-item prop="doctor_id" label="坐诊医生" @click="opendDoctor('doctor')">
<view class="input-text">
<text v-if="form.doctor_id">{{ adminUser.doctor.text }}</text>
<text v-else class="input-placeholder">请选择坐诊医生</text>
<u-icon name="arrow-right" />
</view>
</u-form-item>
<u-form-item prop="inviter_id" label="推荐人" @click="opendDoctor('inviter')">
<view class="input-text">
<text v-if="form.inviter_id">{{ adminUser.inviter.text }}</text>
<text v-else class="input-placeholder">请选择推荐人</text>
<u-icon name="arrow-right" />
</view>
</u-form-item>
<u-form-item prop="saler_id" label="业务员" @click="opendDoctor('saler')">
<view class="input-text">
<text v-if="form.saler_id">{{ adminUser.saler.text }}</text>
<text v-else class="input-placeholder">请选择业务员</text>
<u-icon name="arrow-right" />
</view>
</u-form-item>
<u-form-item label="病情描述" prop="illness" @click="openEditor">
<view class="input-text">
<!-- <rich-text v-if="form.illness" :nodes="form.illness" /> -->
<text v-if="form.illness">{{ form.illness }}</text>
<text v-else class="input-placeholder">点击修改</text>
<u-icon name="arrow-right" />
</view>
</u-form-item>
<u-form-item label="图片资料" prop="images" borderBottom>
<cu-image ref="images" />
</u-form-item>
<view class="button">
<u-button text="提交" type="primary" @click="submit"></u-button>
</view>
</u--form>
<u-datetime-picker
v-model="datePicker.value"
mode="date"
:show="datePicker.show"
:closeOnClickOverlay="true"
:minDate="datePicker.minDate"
@close="toggleBirthday"
@cancel="toggleBirthday"
@confirm="selectBirthday"
/>
<select-admin-user ref="select-admin-user" @select="selectDoctor" />
<u-action-sheet
:show="genderShow"
:actions="gender.options"
:closeOnClickOverlay="true"
@close="toggleGender"
@select="selectGender"
/>
<cu-editor ref="editor" @confirm="confirmEditor" />
<select-user ref="select-user" @select="selectUser" />
</view>
</template>
<script>
import gender from '../../enums/gender'
import SelectAdminUser from '../../components/select-admin-user'
import CuEditor from '../../components/cu-editor'
import CuImage from '../../components/cu-image'
import SelectUser from '../../components/select-user'
export default {
components: {SelectAdminUser, CuEditor, CuImage, SelectUser},
data() {
return {
id: '',
form: {
type_id: '',
user_id: '',
name: '',
sex: gender.none.value,
phone: '',
birthday: '',
address: '',
treat_at: '',
doctor_id: '',
inviter_id: '',
saler_id: '',
illness: '',
images: []
},
rules: {
name: {
required: true,
message: '姓名必填',
trigger: ['blur', 'change']
}
},
gender: gender,
genderShow: false,
genderSelect: gender.none.text,
datePicker: {
show: false,
name: '',
value: (new Date).getTime(),
minDate: (new Date('1900/1/1')).getTime()
},
adminUser: {
key: '',
doctor: {
text: '',
value: '',
},
inviter: {
text: '',
value: '',
},
saler: {
text: '',
value: '',
},
},
user: {
value: '',
text: ''
}
}
},
onLoad(e) {
this.form.type_id = uni.getStorageSync('medical_record_treat_type_id')
if (!e.id) {
uni.setNavigationBarTitle({
title: '添加病人'
})
} else {
this.id = e.id
uni.showLoading()
const params = {_action: 'getData'}
this.$ajax.get(`/admin-api/patient/${e.id}`, { params }).then(res => {
if (res.status == 0) {
this.form = {
id: res.data.id,
name: res.data.name,
sex: res.data.sex,
phone: res.data.phone,
birthday: res.data.birthday ? res.data.birthday.replaceAll('-', '/') : '',
address: res.data.address,
treat_at: res.data.treat_at ? res.data.treat_at.replaceAll('-', '/') : '',
doctor_id: res.data.doctor_id,
illness: res.data.illness
}
this.genderSelect = res.data.sex_text
if (res.data.doctor) {
this.doctor = {
text: res.data.doctor.name,
value: res.data.doctor.id,
}
}
uni.setNavigationBarTitle({ title: this.form.name })
}
})
}
},
onReady() {
this.$refs['form'].setRules(this.rules)
},
methods: {
toggleGender() {
this.genderShow = !this.genderShow
},
toggleBirthday(name) {
if (name) {
this.datePicker.name = name
this.datePicker.value = this.form[name] ? Math.floor(this.form[name] * 1000) : (new Date).getTime()
}
this.datePicker.show = !this.datePicker.show
},
selectGender(e) {
this.genderSelect = e.name
this.form.sex = e.value
},
selectBirthday(e) {
this.form[this.datePicker.name] = uni.$u.timeFormat(e.value, 'yyyy-mm-dd')
this.toggleBirthday()
},
opendDoctor(key) {
this.adminUser.key = key
this.$refs['select-admin-user'].open()
},
closeDoctor() {
this.$refs['select-admin-user'].close()
},
selectDoctor(e) {
const key = this.adminUser.key
this.form[`${key}_id`] = e.id
this.adminUser[key] = {
value: e.id,
text: e.name
}
this.closeDoctor()
},
openEditor() {
this.$refs['editor'].open(this.form.illness)
},
confirmEditor(e) {
this.form.illness = e
},
openUser() {
this.$refs['select-user'].open()
},
closeUser() {
this.$refs['select-user'].close()
},
selectUser(e) {
this.user = {
value: e.id,
text: e.phone
}
this.form.user_id = e.id
this.form.name = e.name
this.form.phone = e.phone
this.form.address = e.address
this.selectGender({
name: e.sex_text,
value: e.sex
})
this.form.birthday = e.birthday_format
this.closeUser()
},
submit() {
this.form.images = this.$refs['images'].getList().map(item => item.url)
this.$refs['form'].validate().then(res => {
uni.showLoading()
if (this.id) {
this.update()
} else {
this.create()
}
}).catch(error => {})
},
update() {
this.$ajax.put(`/admin-api/patient/${this.id}`, this.form).then(res => {
if (res.status == 0) {
uni.showToast({
title: '保存成功',
icon: 'success'
})
setTimeout(() => {
uni.navigateBack()
}, 1500);
}
})
},
create() {
this.$ajax.post('/admin-api/patient', this.form).then(res => {
if (res.status == 0) {
uni.showToast({
title: '提交成功',
icon: 'success'
})
// setTimeout(() => {
// uni.navigateBack()
// }, 1500);
}
})
}
}
}
</script>
<style scoped>
.page {
padding: 20px;
background: white;
}
.input-text {
color: #303133;
font-size: 15px;
padding: 6px 9px;
border-bottom: 1px solid #dadbde;
width: 100%;
display: flex;
justify-content: space-between;
}
.input-placeholder {
color: #c0c0c0;
}
.button {
width: 100%;
margin: 20px 0;
}
</style>

View File

@ -0,0 +1,202 @@
<template>
<view class="page">
<u-search
v-model="search"
bgColor="white"
:showAction="false"
margin="10px 0"
placeholder="姓名/联系方式"
@search="loadData(true)"
@change="changeSearch"
/>
<view class="add-button">
<u-button type="primary" icon="plus" shape="circle" size="large" @click="add" />
</view>
<view class="list">
<u-list :height="listHeight" @scrolltolower="reachBottom">
<u-swipe-action>
<u-list-item v-for="(item, index) in list" :key="item.id">
<u-swipe-action-item :options="swipeOption" :name="index" @click="swipeClick">
<u-cell
:title="item.name + (item.age != '' ? `(${item.age})` : '')"
:label="item.phone ? item.phone : '暂无联系方式'"
:clickable="true"
:isLink="false"
:url=" `/pages/patient/detail?id=${item.id}`"
/>
</u-swipe-action-item>
</u-list-item>
</u-swipe-action>
</u-list>
</view>
<u-action-sheet
:actions="option.list"
:title="option.title"
:show="option.show"
:closeOnClickOverlay="true"
@close="closeOption"
@select="chooseOption"
/>
</view>
</template>
<script>
export default {
data() {
return {
typeId: '',
list: [],
page: 1,
perPage: 20,
total: 0,
search: '',
option: {
id: '',
show: false,
list: [
{ name: "详细", color: '#4cd964', action: 'detail'},
{ name: "修改", color: "#007aff", action: 'edit' },
{ name: "添加病历", color: "#f0ad4e", action: 'record-add' },
{ name: "查看病历", color: "#4cd964", action: 'record' },
{ name: "删除", color: "#dd524d", action: 'delete' },
],
title: '',
},
swipeOption: [
{ text: '删除', style: {backgroundColor: '#dd524d'} }
],
listHeight: 0,
}
},
onLoad() {
this.typeId = uni.getStorageSync('medical_record_treat_type_id')
uni.getSystemInfo({
success: (res) => {
this.listHeight = res.safeArea.height - 54
}
})
},
onShow() {
this.loadData(true)
},
onPullDownRefresh() {
this.loadData(true)
},
methods: {
loadData(refresh) {
if (refresh) {
this.list = []
this.page = 1
}
uni.showLoading()
const params = {
_action: 'getData',
page: this.page,
perPage: this.perPage,
keyword: this.search,
type_id: this.typeId,
}
this.$ajax.get('/admin-api/patient', { params }).then(res => {
uni.stopPullDownRefresh()
if (res.status == 0) {
this.list = this.list.concat(res.data.items)
this.total = res.data.total
}
}).catch(error => {
uni.stopPullDownRefresh()
})
},
reachBottom() {
if (this.list.length < this.total) {
this.page++
this.loadData()
}
},
changeSearch(value) {
if (!value) {
this.loadData(true)
}
},
add() {
uni.navigateTo({
url: '/pages/patient/form'
})
},
openOption(index) {
const item = this.list[index]
this.option.title = item.name
this.option.id = item.id
this.option.show = true
},
closeOption() {
this.option.show = false
},
chooseOption(e) {
const id = this.option.id
if (e.action == 'detail') {
return uni.navigateTo({ url: `/pages/patient/detail?id=${id}` })
}
if (e.action == 'edit') {
return uni.navigateTo({ url: `/pages/patient/form?id=${id}` })
}
if (e.action == 'delete') {
return uni.showModal({
title: '删除 ' + this.option.title,
content: '是否确定?',
success: (result) => {
if (result.confirm) {
this.delete(id)
}
}
})
}
if (e.action == 'record-add') {
return uni.navigateTo({ url: `/pages/record/form?patient=${id}` })
}
if (e.action == 'record') {
return uni.navigateTo({ url: `/pages/record/index?patient=${id}` })
}
},
swipeClick(e) {
const action = e.index
const item = this.list[e.name]
if (action == 0) {
return uni.showModal({
title: '删除 ' + item.name,
content: '是否确定?',
success: (result) => {
if (result.confirm) {
this.delete(item.id)
}
}
})
}
},
delete(id) {
uni.showLoading()
this.$ajax.delete(`/admin-api/patient/${id}`).then(res => {
if (res.status == 0) {
uni.showToast({
title: '删除成功',
icon: 'success'
})
setTimeout(() => {
this.loadData(true)
}, 1000)
}
})
}
}
}
</script>
<style scoped>
.list {
background-color: white;
}
.add-button {
position: absolute;
bottom: 100px;
right: 50px;
z-index: 999;
}
</style>

View File

@ -0,0 +1,475 @@
<template>
<view class="page">
<u-cell-group :border="false">
<u-cell
title="姓名"
:value="this.info.patient ? this.info.patient.name : ''"
/>
<u-cell
title="类别"
:value="type.text"
/>
<u-cell
title="病种"
:value="illnessType.label"
isLink
rightIcon="edit-pen"
@click="openIllnessType"
/>
<u-cell
:title="`${type.text}时间`"
:value="info.treat_at | date"
isLink
rightIcon="edit-pen"
@click="toggleDatePicker('treat_at')"
/>
<u-cell
title="划线价"
:value="info.origin_price"
isLink
rightIcon="edit-pen"
@click="openModal('划线价', 'origin_price', 'number')"
/>
<u-cell
title="实收价"
:value="info.sell_price"
isLink
rightIcon="edit-pen"
@click="openModal('实收价', 'sell_price', 'number')"
/>
<u-cell
title="收费情况"
:value="orderStatus.text"
isLink
rightIcon="edit-pen"
@click="toggleOrderStatus"
/>
<u-cell
:title="`${type.text}医师`"
:value="adminUser.doctor_name"
:label="`提成金额: ${info.doctor_money}`"
isLink
rightIcon="edit-pen"
@click="opendAdminUser('doctor')"
/>
<u-cell
title="邀请人"
:value="info.inviter ? info.inviter.name : ''"
:label="`提成金额: ${info.inviter_money}`"
/>
<u-cell
title="业务员"
:value="info.saler ? info.saler.name : ''"
:label="`提成金额: ${info.saler_money}`"
/>
<u-cell
:title="`${type.text}情况`"
isLink
rightIcon="edit-pen"
@click="openEditor"
>
<view slot="value">
<!-- <rich-text :nodes="info.illness" /> -->
<text>{{info.content}}</text>
</view>
</u-cell>
<u-cell title="图片资料">
<view slot="value">
<cu-image ref="images" @update="updateImages" />
</view>
</u-cell>
<u-cell
title="下次就诊时间"
:value="info.next_treat_at | date"
isLink
rightIcon="edit-pen"
@click="toggleDatePicker('next_treat_at', 'datetime')"
/>
<u-cell title="开启通知">
<view slot="value">
<u-switch v-model="info.is_notified" :activeValue="0" :inactiveValue="1" asyncChange @change="updateSwitch" />
</view>
</u-cell>
<u-cell
v-if="info.is_notified == 0"
title="通知医师"
:value="adminUser.notify_user_name"
isLink
rightIcon="edit-pen"
@click="opendAdminUser('notify_user')"
/>
<u-cell
v-if="info.is_notified == 0"
title="通知时间"
:value="info.notify_at | date('yyyy-MM-dd')"
isLink
rightIcon="edit-pen"
@click="toggleDatePicker('notify_at', 'date')"
/>
<!-- <u-cell
title="通知备注"
:value="info.notify_remarks"
isLink
rightIcon="edit-pen"
@click="openModal('通知备注', 'notify_remarks', 'text')"
/> -->
<u-cell
title="录入时间"
:value="info.created_at"
/>
</u-cell-group>
<div class="btn">
<u-button text="病人信息" type="primary" @click="patientDetail" />
<u-button text="删除病历" type="error" @click="deleteRecord" />
</div>
<select-admin-user ref="select-admin-user" @select="selectAdminUser" />
<u-action-sheet
:title="type.title"
:show="type.show"
:actions="type.options"
:closeOnClickOverlay="true"
@close="toggleType"
@select="selectType"
/>
<u-datetime-picker
v-model="datePicker.value"
:mode="datePicker.mode"
:show="datePicker.show"
:closeOnClickOverlay="true"
:minDate="datePicker.minDate"
@close="toggleDatePicker"
@cancel="toggleDatePicker"
@confirm="selectDatePicker"
/>
<u-modal
:show="modal.show"
:title="modal.title"
:showCancelButton="true"
:closeOnClickOverlay="true"
:asyncClose="false"
@confirm="confirmModal"
@cancel="closeModal"
@close="closeModal"
>
<u--input v-if="modal.type == 'text'" v-model="modal.value" border="surround" />
<u--input v-if="modal.type == 'number'" v-model="modal.value" type="number" border="surround" />
<u--textarea v-if="modal.type == 'textarea'" v-model="modal.value" :showConfirmBar="false" />
</u-modal>
<u-action-sheet
:title="orderStatus.title"
:show="orderStatus.show"
:actions="orderStatus.options"
:closeOnClickOverlay="true"
@close="toggleOrderStatus"
@select="selectOrderStatus"
/>
<cu-editor ref="editor" @confirm="confirmEditor" />
<u-picker
:show="illnessType.show"
:columns="illnessType.list"
keyName="label"
closeOnClickOverlay
@close="closeIllnessType"
@cancel="closeIllnessType"
@confirm="confirmIllnessType"
/>
</view>
</template>
<script>
import CuEditor from '../../components/cu-editor'
import SelectAdminUser from '../../components/select-admin-user'
import orderStatus from '../../enums/order_status'
import CuImage from '../../components/cu-image'
export default {
components: {SelectAdminUser, CuEditor, CuImage},
data() {
return {
id: '',
info: {
patient_id: '',
type_id: '',
origin_price: '',
sell_price: '',
notify_remarks: '',
is_notified: 0,
},
adminUser: {
key: '',
doctor_name: '',
notify_user_name: ''
},
type: {
text: '',
title: '类别',
show: false,
options: []
},
datePicker: {
show: false,
mode: 'datetime',
name: '',
value: (new Date).getTime(),
minDate: (new Date('1900/1/1')).getTime()
},
modal: {
type: 'text',
show: false,
title: '',
key: '',
value: ''
},
orderStatus: {
title: '收费情况',
show: false,
text: '',
options: orderStatus.options,
},
illnessType: {
show: false,
value: '',
label: '',
list: []
},
}
},
onLoad(e) {
this.id = e.id
this.init()
},
onPullDownRefresh() {
this.loadData()
},
methods: {
async init() {
let res
// res = await this.$ajax.get('/admin-api/category', { params: { _action: 'getData' } })
// if (res.status == 0) {
// this.type.options = res.data.items
// }
await this.loadData()
res = await this.$ajax.get('/admin-api/api/keywords/list', { params: { type_key: 'illness_type', value: this.info?.type?.key } })
if (res.status == 0) {
this.illnessType.list = [res.data]
}
},
async loadData() {
if (!this.id) {
return
}
uni.showLoading()
const params = { _action: 'getData' }
let res = await this.$ajax.get(`/admin-api/record/${this.id}`, { params })
uni.stopPullDownRefresh()
if (res.status == 0) {
this.info = {
...res.data,
treat_at: res.data.treat_at ? res.data.treat_at.replaceAll('-', '/') : '',
next_treat_at: res.data.next_treat_at ? res.data.next_treat_at.replaceAll('-', '/') : '',
notify_at: res.data.notify_at ? res.data.notify_at.replaceAll('-', '/') : '',
}
if (res.data.images) {
this.$refs['images'].setList(res.data.images.map(value => {
return { url: value }
}))
}
this.type.text = this.info.type ? this.info.type.name : ''
this.adminUser.doctor_name = this.info.doctor ? this.info.doctor.name : ''
this.orderStatus.text = orderStatus.map[this.info.order_status]
this.adminUser.notify_user_name = this.info.notify_user ? this.info.notify_user.name : ''
if (res.data.illness_type) {
const illness = res.data.illness_type
this.illnessType.label = illness.name
this.illnessType.value = illness.id
}
}
},
update(key, value) {
const params = {
id: this.id,
}
params[key] = value
return this.$ajax.put(`/admin-api/record/${this.id}`, params, {custom: { loading: true }})
},
opendAdminUser(name) {
this.adminUser.key = name
this.$refs['select-admin-user'].open()
},
closeAdminUser() {
this.adminUser.key = ''
this.$refs['select-admin-user'].close()
},
selectAdminUser(e) {
const key = this.adminUser.key
const value = e.id
this.update(`${key}_id`, value).then(res => {
this.closeAdminUser()
if (res.status == 0) {
this.info[`${key}_id`] = value
this.adminUser[`${key}_name`] = e.name
}
})
},
toggleType() {
this.type.show = !this.type.show
},
selectType(e) {
this.update('type_id', e.id).then(res => {
if (res.status == 0) {
this.type.text = e.name
this.info.type_id = e.id
}
})
},
toggleDatePicker(name, mode) {
if (name) {
this.datePicker.name = name
const value = this.info[name]
if (value) {
this.datePicker.value = (new Date(value)).getTime()
}
}
if (mode) {
this.datePicker.mode = mode
}
this.datePicker.show = !this.datePicker.show
},
selectDatePicker(e) {
const value = Math.floor(e.value / 1000)
const key = this.datePicker.name
this.update(key, value).then(res => {
if (res.status == 0) {
this.info[key] = value
this.toggleDatePicker()
}
})
},
openModal(title, name, type) {
this.modal.type = type ? type : 'text'
this.modal.title = title
this.modal.key = name
this.modal.show = true
this.modal.value = this.info[name]
},
confirmModal() {
const key = this.modal.key
const value = this.modal.value
this.update(key, value).then(res => {
this.closeModal()
if (res.status == 0) {
this.info[key] = value
}
})
},
closeModal() {
this.modal.show = false
},
toggleOrderStatus() {
this.orderStatus.show = !this.orderStatus.show
},
selectOrderStatus(e) {
const key = 'order_status'
const value = e.value
const text = e.name
this.update(key, value).then(res => {
if (res.status == 0) {
this.orderStatus.text = text
this.info[key] = value
}
})
},
openEditor() {
this.$refs['editor'].open(this.info.content)
},
confirmEditor(e) {
const value = e
const key = 'content'
this.update(key, value).then(res => {
if (res.status == 0) {
this.info[key] = value
}
})
},
updateImages(e) {
const list = e.map(item => item.url)
this.update('images', list).then(res => {
if (res.status == 0) {
console.log(res)
}
})
},
updateSwitch(e) {
this.update('is_notified', e).then(res => {
if (res.status == 0) {
this.info.is_notified = e
}
})
},
deleteRecord() {
uni.showModal({
title: '删除病历记录',
content: '是否确定?',
success: (result) => {
if (result.confirm) {
this.handleDelete(this.id)
}
}
})
},
handleDelete(id) {
uni.showLoading()
this.$ajax.delete(`/admin-api/record/${id}`).then(res => {
if (res.status == 0) {
uni.showToast({
title: '删除成功',
icon: 'success'
})
setTimeout(() => {
uni.navigateBack()
}, 1000)
}
})
},
patientDetail() {
return uni.navigateTo({ url: `/pages/patient/detail?id=${this.info.patient_id}` })
},
openIllnessType() {
this.illnessType.show = true
},
closeIllnessType() {
this.illnessType.show = false
},
confirmIllnessType(e) {
const item = e.value[0]
if (!item) {
return
}
this.closeIllnessType()
this.update('illness_type_id', item.value).then(res => {
if (res.status == 0) {
this.info.illness_type_id = item.value
this.illnessType.value = item.value
this.illnessType.label = item.label
}
})
}
}
}
</script>
<style scoped>
.page {
padding: 20px;
background: white;
}
.btn {
padding: 0 10px;
}
.btn .u-button {
margin-top: 20px;
}
.text-gray {
color: gray;
}
</style>

View File

@ -0,0 +1,347 @@
<template>
<view class="page">
<u--form :model="form" ref="form" labelWidth="80" :borderBottom="false">
<u-form-item prop="patient_id" label="姓名" :borderBottom="true">
<view class="input-text">
<text>{{ patient.name }}</text>
</view>
</u-form-item>
<!-- <u-form-item prop="type_id" label="类别" :required="true" :borderBottom="true" @click="toggleType">
<u-radio-group v-model="form.type_id" @change="typeChange">
<u-radio v-for="item in typeList" :key="item.id" :label="item.name" :name="item.id" />
</u-radio-group>
</u-form-item> -->
<u-form-item prop="form.illness_type_id" label="病种" :required="true" :borderBottom="true" @click="openIllnessType">
<view class="input-text">
<text v-if="form.illness_type_id">{{ illnessType.label }}</text>
<text v-else class="input-placeholder">请选择病种</text>
<u-icon name="arrow-right" />
</view>
</u-form-item>
<u-form-item prop="form.treat_at" :label="`${typeName}时间`" :required="true" :borderBottom="true" @click="toggleDatePicker('treat_at', 'datetime')">
<view class="input-text">
<text v-if="form.treat_at">{{ form.treat_at | date }}</text>
<text v-else class="input-placeholder">请选择{{ typeName }}时间</text>
<u-icon name="arrow-right" />
</view>
</u-form-item>
<u-form-item prop="form.doctor_id" :label="`${typeName}医师`" :required="true" :borderBottom="true" @click="opendAdminUser('doctor')">
<view class="input-text">
<text v-if="form.doctor_id">{{ adminUser.doctor_name }}</text>
<text v-else class="input-placeholder">请选择{{ typeName }}医生</text>
<u-icon name="arrow-right" />
</view>
</u-form-item>
<u-form-item prop="form.origin_price" label="划线价" :required="true" :borderBottom="true">
<input type="number" v-model="form.origin_price" placeholder="输入划线价" />
</u-form-item>
<u-form-item prop="form.sell_price" label="实收价" :required="true" :borderBottom="true">
<input type="number" v-model="form.sell_price" placeholder="输入实收价" />
</u-form-item>
<u-form-item prop="order_status" label="收费情况" :required="true" :borderBottom="true">
<u-radio-group v-model="form.order_status">
<u-radio v-for="item in orderStatus.options" :key="item.value" :label="item.name" :name="item.value" />
</u-radio-group>
</u-form-item>
<u-form-item :label="`${typeName}情况`" prop="content" :borderBottom="true" @click="openEditor">
<view class="input-text">
<!-- <rich-text v-if="form.illness" :nodes="form.illness" /> -->
<text v-if="form.content">{{ form.content }}</text>
<text v-else class="input-placeholder">点击修改</text>
<u-icon name="arrow-right" />
</view>
</u-form-item>
<u-form-item label="图片资料" prop="images" borderBottom>
<cu-image ref="images" />
</u-form-item>
<u-form-item prop="next_treat_at" label="下次就诊时间" :borderBottom="true" @click="toggleDatePicker('next_treat_at', 'datetime')">
<view class="input-text">
<text v-if="form.next_treat_at">{{ form.next_treat_at | date }}</text>
<text v-else class="input-placeholder">请选择下次就诊时间</text>
<u-icon name="arrow-right" />
</view>
</u-form-item>
<u-form-item label="开启通知" prop="is_notified" borderBottom>
<u-switch v-model="form.is_notified" :activeValue="0" :inactiveValue="1" asyncChange @change="updateSwitch" />
</u-form-item>
<u-form-item v-if="form.is_notified == 0" prop="notify_user_id" label="通知医师" :borderBottom="true" @click="opendAdminUser('notify_user')">
<view class="input-text">
<text v-if="form.notify_user_id">{{ adminUser.notify_user_name }}</text>
<text v-else class="input-placeholder">请选择通知人</text>
<u-icon name="arrow-right" />
</view>
</u-form-item>
<u-form-item v-if="form.is_notified == 0" prop="notify_at" label="通知时间" :borderBottom="true" @click="toggleDatePicker('notify_at', 'date')">
<view class="input-text">
<text v-if="form.notify_at">{{ form.notify_at | date('yyyy-MM-dd') }}</text>
<text v-else class="input-placeholder">请选择通知时间</text>
<u-icon name="arrow-right" />
</view>
</u-form-item>
<!-- <u-form-item prop="notify_remarks" label="通知备注" :borderBottom="true">
<u--input v-model="form.notify_remarks" placeholder="请输入通知备注" border="none" />
</u-form-item> -->
<u-form-item label="操作人" :borderBottom="true">
<view class="input-text">{{ currentUser.name }}</view>
</u-form-item>
<view class="button">
<u-button text="提交" type="primary" @click="submit"></u-button>
</view>
</u--form>
<u-datetime-picker
v-model="datePicker.value"
:mode="datePicker.mode"
:show="datePicker.show"
:closeOnClickOverlay="true"
:minDate="datePicker.minDate"
@close="toggleDatePicker"
@cancel="toggleDatePicker"
@confirm="selectDatePicker"
/>
<select-admin-user ref="select-admin-user" @select="selectAdminUser" />
<cu-editor ref="editor" @confirm="confirmEditor" />
<u-picker
:show="illnessType.show"
:columns="illnessType.list"
keyName="label"
closeOnClickOverlay
@close="closeIllnessType"
@cancel="closeIllnessType"
@confirm="confirmIllnessType"
/>
</view>
</template>
<script>
import CuEditor from '../../components/cu-editor'
import SelectAdminUser from '../../components/select-admin-user'
import orderStatus from '../../enums/order_status'
import CuImage from '../../components/cu-image'
export default {
components: {SelectAdminUser, CuEditor, CuImage},
data() {
return {
id: '',
info: {},
form: {
patient_id: '',
doctor_id: '',
treat_at: Math.floor((new Date).getTime() / 1000),
origin_price: '',
sell_price: '',
order_status: orderStatus.success.value,
content: '',
next_treat_at: '',
notify_user_id: '',
notify_at: '',
notify_remarks: '',
is_notified: 1,
illness_type_id: '',
},
typeList: [],
patient: {},
datePicker: {
mode: 'datetime',
show: false,
name: '',
value: (new Date).getTime(),
minDate: (new Date('1900/1/1')).getTime()
},
adminUser: {
key: ''
},
orderStatus: orderStatus,
currentUser: {},
illnessType: {
show: false,
value: '',
label: '',
list: []
},
typeName: '',
}
},
onLoad(e) {
this.id = e.id
this.form.patient_id = e.patient
this.init()
},
methods: {
async init() {
let res
res = await this.$ajax.get('/admin-api/current-user')
if (res.status == 0) {
this.currentUser = res.data
this.form.doctor_id = this.currentUser.id
this.adminUser.doctor_name = this.currentUser.name
this.form.notify_user_id = this.currentUser.id
this.adminUser.notify_user_name = this.currentUser.name
}
if (this.id) {
uni.setNavigationBarTitle({
title: '修改病历'
})
res = await this.$ajax.get(`/admin-api/record/${this.id}`, { params: {_action: 'getData'}})
if (res.status == 0) {
this.info = res.data
this.patient = res.data.patient
this.form = {
patient_id: this.info.patient_id,
type_id: this.info.type_id,
doctor_id: this.info.doctor_id,
treat_at: this.info.treat_at ? this.info.treat_at.replaceAll('-', '/') : '',
origin_price: this.info.origin_price,
sell_price: this.info.sell_price,
order_status: this.info.order_status,
content: this.info.content,
next_treat_at: this.info.next_treat_at ? this.info.next_treat_at.replaceAll('-', '/') : '',
notify_user_id: this.info.notify_user_id,
notify_at: this.info.notify_at ? this.info.notify_at.replaceAll('-', '/') : '',
notify_remarks: this.info.notify_remarks
}
}
} else {
uni.setNavigationBarTitle({
title: '添加病历'
})
if (!this.form.patient_id) {
return uni.showModal({
title: '请选择病人',
showCancel: false,
success: () => {
uni.navigateBack()
}
})
}
const params = { _action: 'getData' }
res = await this.$ajax.get(`/admin-api/patient/${this.form.patient_id}`, { params })
if (res.status == 0) {
this.patient = res.data
this.form.content = this.patient.type.content
this.typeName = this.patient.type.name
}
}
res = await this.$ajax.get('/admin-api/api/keywords/list', { params: { type_key: 'illness_type', value: this.patient?.type?.key} })
if (res.status == 0) {
this.illnessType.list = [res.data]
}
},
submit() {
this.form.images = this.$refs['images'].getList().map(item => item.url)
uni.showLoading()
if (this.id) {
this.update()
} else {
this.create()
}
},
update() {
this.form.id = this.id
this.$ajax.put(`/admin-api/record/${this.id}`, this.form).then(res => {
if (res.status == 0) {
uni.showToast({
title: '保存成功',
icon: 'success'
})
setTimeout(() => {
uni.navigateBack()
}, 1500);
}
})
},
create() {
this.$ajax.post('/admin-api/record', this.form).then(res => {
if (res.status == 0) {
uni.showToast({
title: '提交成功',
icon: 'success'
})
setTimeout(() => {
uni.navigateBack()
}, 1500);
}
})
},
toggleDatePicker(name, mode) {
if (name) {
this.datePicker.name = name
this.datePicker.value = this.form[name] ? Math.floor(this.form[name] * 1000) : (new Date).getTime()
}
if (mode) {
this.datePicker.mode = mode
}
this.datePicker.show = !this.datePicker.show
},
selectDatePicker(e) {
this.form[this.datePicker.name] = Math.floor(e.value / 1000)
this.toggleDatePicker()
},
opendAdminUser(name) {
this.adminUser.key = name
this.$refs['select-admin-user'].open()
},
closeAdminUser() {
this.adminUser.key = ''
this.$refs['select-admin-user'].close()
},
selectAdminUser(e) {
const key = this.adminUser.key
this.form[`${key}_id`] = e.id
this.adminUser[`${key}_name`] = e.name
this.closeAdminUser()
},
openEditor() {
this.$refs['editor'].open(this.form.content)
},
confirmEditor(e) {
this.form.content = e
},
updateSwitch(e) {
this.form.is_notified = e
},
openIllnessType() {
this.illnessType.show = true
},
closeIllnessType() {
this.illnessType.show = false
},
confirmIllnessType(e) {
const item = e.value[0]
if (!item) {
return
}
this.illnessType.value = item.value
this.illnessType.label = item.label
this.form.illness_type_id = item.value
this.closeIllnessType()
}
}
}
</script>
<style scoped>
.page {
padding: 20px;
background: white;
}
.input-text {
color: #303133;
font-size: 15px;
padding: 6px 0;
width: 100%;
display: flex;
justify-content: space-between;
}
.input-placeholder {
color: #c0c0c0;
}
.button {
width: 100%;
margin-top: 20px;
}
.page ::v-deep .u-radio-group .u-radio:nth-child(even) {
margin-left: 10px;
}
</style>

View File

@ -0,0 +1,200 @@
<template>
<view class="page">
<view class="add-button">
<u-button type="primary" icon="plus" shape="circle" size="large" @click="add" />
</view>
<view class="list">
<u-list :height="listHeight" @scrolltolower="reachBottom">
<u-swipe-action>
<u-list-item v-for="item in list" :key="item.id">
<u-swipe-action-item :options="swipeOption" :name="item.id" @click="swipeClick">
<u-cell size="large" :url="`/pages/record/detail?id=${item.id}`">
<view slot="title" class="title">
<view class="list-item-title">医师: {{ item.doctor ? item.doctor.name : '' }}</view>
<view class="list-item-price">
<text style="color: #dd524d;font-size: 19px">
<u-icon name="rmb" color="#dd524d" size="19px" />
{{ item.sell_price }}
</text>
<text style="color: #c0c0c0;text-decoration: line-through;">{{ item.origin_price }}</text>
</view>
</view>
<view slot="label" class="label">
时间: {{ item.treat_at }}
</view>
</u-cell>
</u-swipe-action-item>
</u-list-item>
</u-swipe-action>
</u-list>
</view>
<u-action-sheet
:actions="option.list"
:title="option.title"
:show="option.show"
:closeOnClickOverlay="true"
@close="closeOption"
@select="chooseOption"
/>
</view>
</template>
<script>
export default {
data() {
return {
patient_id: '',
patient: {},
typeIndex: 0,
perPage: 20,
typeList: [],
list: [],
option: {
id: '',
show: false,
list: [
{ name: "详细", color: '#4cd964', action: 'detail' },
{ name: "修改", color: "#007aff", action: 'edit' },
{ name: "删除", color: "#dd524d", action: 'delete' },
],
title: '',
},
swipeOption: [
{ text: '删除', style: {backgroundColor: '#dd524d'} }
],
listHeight: 0
}
},
onLoad(e) {
this.patient_id = e.patient
uni.getSystemInfo({
success: (res) => {
this.listHeight = res.safeArea.height - 20
}
})
this.init()
},
onPullDownRefresh() {
this.loadData(true)
},
methods: {
async init() {
let res
res = await this.$ajax.get(`/admin-api/patient/${this.patient_id}`, { params: {_action: 'getData'}})
if (res.status == 0) {
this.patient = res.data
uni.setNavigationBarTitle({ title: `${this.patient.name}-病历记录` })
}
// res = await this.$ajax.get('/admin-api/category', { params: {_action: 'getData'}})
// if (res.status == 0) {
// this.typeList = res.data.items
// }
this.loadData(true)
},
changeType(e) {
this.typeIndex = e
this.loadData(true)
},
loadData(refresh) {
if (refresh) {
this.list = []
this.page = 1
}
uni.showLoading()
const params = { _action: 'getData', page: this.page, perPage: this.perPage, patient_id: this.patient_id }
this.$ajax.get('/admin-api/record', { params }).then(res => {
uni.stopPullDownRefresh()
if (res.status == 0) {
this.list = this.list.concat(res.data.items)
this.total = res.data.total
}
}).catch(error => {
uni.stopPullDownRefresh()
})
},
reachBottom() {
if (this.list.length < this.total) {
this.page++
this.loadData()
}
},
openOption(index) {
const item = this.list[index]
this.option.title = item.name
this.option.id = item.id
this.option.show = true
},
closeOption() {
this.option.show = false
},
chooseOption(e) {
const id = this.option.id
if (e.action == 'detail') {
return uni.navigateTo({ url: `/pages/record/detail?id=${id}` })
}
if (e.action == 'edit') {
return uni.navigateTo({ url: `/pages/record/form?id=${id}&patient=${this.patient_id}` })
}
},
swipeClick(e) {
const action = e.index
if (action == 0) {
return uni.showModal({
title: '删除病历记录',
content: '是否确定?',
success: (result) => {
if (result.confirm) {
this.handleDelete(e.name)
}
}
})
}
},
handleDelete(id) {
uni.showLoading()
this.$ajax.delete(`/admin-api/record/${id}`).then(res => {
if (res.status == 0) {
uni.showToast({
title: '删除成功',
icon: 'success'
})
setTimeout(() => {
this.loadData(true)
}, 1000)
}
})
},
add() {
return uni.navigateTo({ url: `/pages/record/form?patient=${this.patient_id}` })
}
}
}
</script>
<style scoped>
.page {
padding-top: 20px;
}
.list {
background: white;
}
.list .title {
display: flex;
flex-direction: row;
justify-content: space-between;
font-size: 18px;
}
.list .label {
color: gray;
margin-top: 10px;
}
.list-item-price ::v-deep .u-icon {
display: inline-block;
}
.add-button {
position: absolute;
bottom: 100px;
right: 50px;
z-index: 999;
}
</style>

BIN
src/static/logo.png 100644

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

View File

@ -0,0 +1,10 @@
uni.addInterceptor({
returnValue (res) {
if (!(!!res && (typeof res === "object" || typeof res === "function") && typeof res.then === "function")) {
return res;
}
return new Promise((resolve, reject) => {
res.then((res) => res[0] ? reject(res[0]) : resolve(res[1]));
});
},
});

77
src/uni.scss 100644
View File

@ -0,0 +1,77 @@
/**
* uni-app
*
* uni-app https://ext.dcloud.net.cn使
* 使scss使 import 便App
*
*/
@import 'uview-ui/theme.scss';
/**
* App使
*
* 使scss scss 使 import
*/
/* 颜色变量 */
/* 行为相关颜色 */
$uni-color-primary: #007aff;
$uni-color-success: #4cd964;
$uni-color-warning: #f0ad4e;
$uni-color-error: #dd524d;
/* 文字基本颜色 */
$uni-text-color: #333; //
$uni-text-color-inverse: #fff; //
$uni-text-color-grey: #999; //
$uni-text-color-placeholder: #808080;
$uni-text-color-disable: #c0c0c0;
/* 背景颜色 */
$uni-bg-color: #fff;
$uni-bg-color-grey: #f8f8f8;
$uni-bg-color-hover: #f1f1f1; //
$uni-bg-color-mask: rgba(0, 0, 0, 0.4); //
/* 边框颜色 */
$uni-border-color: #c8c7cc;
/* 尺寸变量 */
/* 文字尺寸 */
$uni-font-size-sm: 14px;
$uni-font-size-base: 16px;
$uni-font-size-lg: 18px;
/* 图片尺寸 */
$uni-img-size-sm: 20px;
$uni-img-size-base: 26px;
$uni-img-size-lg: 40px;
/* Border Radius */
$uni-border-radius-sm: 2px;
$uni-border-radius-base: 3px;
$uni-border-radius-lg: 6px;
$uni-border-radius-circle: 50%;
/* 水平间距 */
$uni-spacing-row-sm: 5px;
$uni-spacing-row-base: 10px;
$uni-spacing-row-lg: 15px;
/* 垂直间距 */
$uni-spacing-col-sm: 4px;
$uni-spacing-col-base: 8px;
$uni-spacing-col-lg: 12px;
/* 透明度 */
$uni-opacity-disabled: 0.3; //
/* 文章场景相关 */
$uni-color-title: #2c405a; //
$uni-font-size-title: 20px;
$uni-color-subtitle: #555; //
$uni-font-size-subtitle: 18px;
$uni-color-paragraph: #3f536e; //
$uni-font-size-paragraph: 15px;

40
src/utils/index.js 100644
View File

@ -0,0 +1,40 @@
export function formatDate(dateTime = null, formatStr = 'yyyy-MM-dd HH:mm:ss') {
if (!dateTime) return ''
let date
// 若传入时间为假值,则取当前时间
if (!dateTime) {
date = new Date()
} else if (/^\d{10}$/.test(dateTime.toString().trim())) {
date = new Date(dateTime * 1000)
} else if (typeof dateTime === 'string' && /^\d+$/.test(dateTime.trim())) {
date = new Date(Number(dateTime))
} else {
date = new Date(
typeof dateTime === 'string' ?
dateTime.replace(/-/g, '/') :
dateTime
)
}
const timeSource = {
'y': date.getFullYear().toString(), // 年
'M': (date.getMonth() + 1).toString().padStart(2, '0'), // 月
'd': date.getDate().toString().padStart(2, '0'), // 日
'H': date.getHours().toString().padStart(2, '0'), // 时
'm': date.getMinutes().toString().padStart(2, '0'), // 分
's': date.getSeconds().toString().padStart(2, '0') // 秒
}
for (const key in timeSource) {
const [ret] = new RegExp(`${key}+`).exec(formatStr) || []
if (ret) {
const beginIndex = key === 'y' && ret.length === 2 ? 2 : 0
formatStr = formatStr.replace(ret, timeSource[key].slice(beginIndex))
}
}
return formatStr
}
export default {formatDate}

View File

@ -0,0 +1,58 @@
// http 网络请求
module.exports = () => {
// 全局配置
uni.$u.http.setConfig((config) => {
config.baseURL = process.env.VUE_APP_BASE_API
config.custom = {
toast: true,
loading: false
}
return config
})
// 请求拦截
uni.$u.http.interceptors.request.use(
(config) => {
const token = uni.getStorageSync('medical_record_auth_token')
if (token) {
config.header['Authorization'] = `Bearer ${token}`
}
config.header['Accept'] = 'application/json'
if (config.custom.loading) {
uni.showLoading()
}
return config
},
config => {
return Promise.reject(config)
}
)
// 响应拦截
uni.$u.http.interceptors.response.use(
(response) => {
uni.hideLoading()
const res = response.data
if (response.config.custom.toast && res.status != 0 && res.doNotDisplayToast != 1) {
uni.showModal({
title: res.msg,
showCancel: false
})
}
if (res.code == 401) {
uni.reLaunch({
url: '/pages/login/login'
})
}
return res
},
(response) => {
uni.hideLoading()
return Promise.reject(response)
}
)
}