user
parent
b77874e504
commit
ef9032ee46
|
|
@ -1,3 +1,4 @@
|
||||||
ENV = 'production'
|
ENV = 'production'
|
||||||
|
|
||||||
VUE_APP_BASE_API = 'http://www.xbzt.cc'
|
#VUE_APP_BASE_API = 'http://www.xbzt.cc'
|
||||||
|
VUE_APP_BASE_API = 'http://local.medical-record.host'
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
<IfModule mod_rewrite.c>
|
<IfModule mod_rewrite.c>
|
||||||
RewriteEngine On
|
RewriteEngine On
|
||||||
RewriteBase /h5/
|
RewriteBase /client/
|
||||||
RewriteRule ^index\.html$ - [L]
|
RewriteRule ^index\.html$ - [L]
|
||||||
RewriteCond %{REQUEST_FILENAME} !-f
|
RewriteCond %{REQUEST_FILENAME} !-f
|
||||||
RewriteCond %{REQUEST_FILENAME} !-d
|
RewriteCond %{REQUEST_FILENAME} !-d
|
||||||
RewriteRule . /h5/index.html [L]
|
RewriteRule . /client/index.html [L]
|
||||||
</IfModule>
|
</IfModule>
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
location /h5 {
|
location /client {
|
||||||
try_files $uri $uri/h5 /h5/index.html?$query_string;
|
try_files $uri $uri/client /client/index.html?$query_string;
|
||||||
}
|
}
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
const gender = {
|
const gender = {
|
||||||
none: { value: 0, text: '未知' },
|
none: { value: 0, text: '无' },
|
||||||
male: { value: 1, text: '男' },
|
male: { value: 1, text: '男' },
|
||||||
female: { value: 2, text: '女' },
|
female: { value: 2, text: '女' },
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,35 +13,21 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/login/login",
|
"path": "pages/login/index",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "登录"
|
"navigationBarTitleText": "登录"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/patient/index",
|
"path": "pages/register/index",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "病人管理",
|
"navigationBarTitleText": "注册"
|
||||||
"enablePullDownRefresh": true
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/patient/detail",
|
"path": "pages/user/index",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "病人详细",
|
"navigationBarTitleText": "账户信息"
|
||||||
"enablePullDownRefresh": true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"path": "pages/patient/form",
|
|
||||||
"style": {
|
|
||||||
"navigationBarTitleText": "病人表单"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"path": "pages/record/form",
|
|
||||||
"style": {
|
|
||||||
"navigationBarTitleText": "病历表单"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
<view class="page">
|
<view class="page">
|
||||||
<view class="info">
|
<view class="info">
|
||||||
<u-cell-group>
|
<u-cell-group>
|
||||||
<u-cell :title="info.name">
|
<u-cell :title="info.name" url="/pages/user/index" isLink>
|
||||||
<view slot="icon">
|
<view slot="icon">
|
||||||
<u-avatar :src="info.avatar" />
|
<u-avatar :src="info.avatar" />
|
||||||
</view>
|
</view>
|
||||||
|
|
@ -16,7 +16,7 @@
|
||||||
:icon="item.image"
|
:icon="item.image"
|
||||||
:text="item.name"
|
:text="item.name"
|
||||||
size="large"
|
size="large"
|
||||||
@click="itemClick(item.id)"
|
@click="itemClick(item.patient_id)"
|
||||||
/>
|
/>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
@ -39,21 +39,24 @@
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
init() {
|
init() {
|
||||||
this.$ajax.get('/admin-api/api/category/permission-list', {custom: { loading: true }}).then(res => {
|
this.$ajax.get('/api/client/user/profile').then(res => {
|
||||||
if (res.status == 0) {
|
|
||||||
this.list = res.data.items
|
|
||||||
}
|
|
||||||
})
|
|
||||||
this.$ajax.get('/admin-api/current-user').then(res => {
|
|
||||||
if (res.status == 0) {
|
if (res.status == 0) {
|
||||||
this.info = res.data
|
this.info = res.data
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
this.$ajax.get('/api/client/patient').then(res => {
|
||||||
|
if (res.status == 0) {
|
||||||
|
this.list = res.data.map(item => {
|
||||||
|
const type = item.type
|
||||||
|
type.patient_id = item.id
|
||||||
|
return type
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
},
|
},
|
||||||
itemClick(e) {
|
itemClick(e) {
|
||||||
uni.setStorageSync('medical_record_treat_type_id', e)
|
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: '/pages/patient/index'
|
url: `/pages/record/index?type_id=${e}`
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
logout() {
|
logout() {
|
||||||
|
|
@ -62,10 +65,10 @@
|
||||||
content: '是否确定?',
|
content: '是否确定?',
|
||||||
success: (e) => {
|
success: (e) => {
|
||||||
if (e.confirm) {
|
if (e.confirm) {
|
||||||
this.$ajax.get('/admin-api/logout').then(res => {
|
this.$ajax.get('/api/client/logout').then(res => {
|
||||||
if (res.status == 0) {
|
if (res.status == 0) {
|
||||||
uni.removeStorageSync('medical_record_client_auth_token')
|
uni.removeStorageSync('medical_record_client_auth_token')
|
||||||
uni.reLaunch({ url: '/pages/login/login' })
|
uni.reLaunch({ url: '/pages/login/index' })
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ export default {
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
uni.reLaunch({
|
uni.reLaunch({
|
||||||
url: '/pages/login/login'
|
url: '/pages/login/index'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -12,22 +12,18 @@
|
||||||
</u-row>
|
</u-row>
|
||||||
</view>
|
</view>
|
||||||
<u--form :model="user" ref="form" labelWidth="70">
|
<u--form :model="user" ref="form" labelWidth="70">
|
||||||
<u-form-item label="用户名" prop="username" ref="username" :required="true">
|
<u-form-item label="手机号" prop="username" ref="username" :required="true">
|
||||||
<u--input v-model="user.username" :focus="true" border="bottom" placeholder="请填写用户名" />
|
<u--input v-model="user.username" :focus="true" border="bottom" placeholder="请填写手机号" />
|
||||||
</u-form-item>
|
</u-form-item>
|
||||||
<u-form-item label="密码" prop="password" ref="password" :required="true">
|
<u-form-item label="密码" prop="password" ref="password" :required="true">
|
||||||
<u--input v-model="user.password" border="bottom" placeholder="请填写密码" password />
|
<u--input v-model="user.password" border="bottom" placeholder="请填写密码" password />
|
||||||
</u-form-item>
|
</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>
|
</u--form>
|
||||||
<view class="button">
|
<view class="button">
|
||||||
<u-button text="登录" type="primary" @click="submit"></u-button>
|
<u-button text="登录" type="primary" @click="submit" />
|
||||||
|
</view>
|
||||||
|
<view class="button">
|
||||||
|
<u-button text="注册" type="error" @click="register" />
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="icp">
|
<view class="icp">
|
||||||
|
|
@ -43,15 +39,13 @@ export default {
|
||||||
user: {
|
user: {
|
||||||
username: '',
|
username: '',
|
||||||
password: '',
|
password: '',
|
||||||
captcha: '',
|
|
||||||
sys_captcha: '',
|
|
||||||
openid: '',
|
openid: '',
|
||||||
open_type: '',
|
open_type: '',
|
||||||
},
|
},
|
||||||
rules: {
|
rules: {
|
||||||
username: {
|
username: {
|
||||||
required: true,
|
required: true,
|
||||||
message: '用户名必填',
|
message: '手机号必填',
|
||||||
trigger: ['blur', 'change']
|
trigger: ['blur', 'change']
|
||||||
},
|
},
|
||||||
password: {
|
password: {
|
||||||
|
|
@ -59,17 +53,8 @@ export default {
|
||||||
message: '密码必填',
|
message: '密码必填',
|
||||||
trigger: ['blur', 'change']
|
trigger: ['blur', 'change']
|
||||||
},
|
},
|
||||||
captcha: {
|
|
||||||
required: false,
|
|
||||||
message: '验证码必填',
|
|
||||||
trigger: ['blur', 'change']
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
setting: {
|
setting: {},
|
||||||
login_captcha: false,
|
|
||||||
web_icp: ''
|
|
||||||
},
|
|
||||||
captcha: '',
|
|
||||||
logo: '',
|
logo: '',
|
||||||
appName: '',
|
appName: '',
|
||||||
|
|
||||||
|
|
@ -88,10 +73,6 @@ export default {
|
||||||
this.setting = res.data
|
this.setting = res.data
|
||||||
this.logo = this.setting.logo
|
this.logo = this.setting.logo
|
||||||
this.appName = this.setting.app_name
|
this.appName = this.setting.app_name
|
||||||
if (this.setting.login_captcha) {
|
|
||||||
this.rules.captcha.required = true
|
|
||||||
this.getCaptcha()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
@ -99,7 +80,7 @@ export default {
|
||||||
submit() {
|
submit() {
|
||||||
this.$refs['form'].validate().then(res => {
|
this.$refs['form'].validate().then(res => {
|
||||||
uni.showLoading()
|
uni.showLoading()
|
||||||
this.$ajax.post('/admin-api/login', this.user).then(res => {
|
this.$ajax.post('/api/client/login', this.user).then(res => {
|
||||||
uni.hideLoading()
|
uni.hideLoading()
|
||||||
if (res.status == 0) {
|
if (res.status == 0) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
|
|
@ -114,18 +95,13 @@ export default {
|
||||||
})
|
})
|
||||||
}).catch(error => {})
|
}).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() {
|
handleIcp() {
|
||||||
// #ifdef H5
|
// #ifdef H5
|
||||||
window.open('https://beian.miit.gov.cn', '_blank')
|
window.open('https://beian.miit.gov.cn', '_blank')
|
||||||
// #endif
|
// #endif
|
||||||
|
},
|
||||||
|
register() {
|
||||||
|
uni.navigateTo({ url: `/pages/register/index?openid=${this.user.openid}&open_type=${this.user.open_type}` })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,356 +0,0 @@
|
||||||
<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>
|
|
||||||
|
|
@ -1,326 +0,0 @@
|
||||||
<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>
|
|
||||||
|
|
@ -1,202 +0,0 @@
|
||||||
<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>
|
|
||||||
|
|
@ -1,73 +1,15 @@
|
||||||
<template>
|
<template>
|
||||||
<view class="page">
|
<view class="page">
|
||||||
<u-cell-group :border="false">
|
<u-cell-group :border="false">
|
||||||
<u-cell
|
<u-cell title="姓名" :value="this.info.patient ? this.info.patient.name : ''" />
|
||||||
title="姓名"
|
<u-cell title="类别" :value="info.type ? info.type.name : ''" />
|
||||||
:value="this.info.patient ? this.info.patient.name : ''"
|
<u-cell title="病种" :value="info.illness_type ? info.illness_type.name : ''" />
|
||||||
/>
|
<u-cell :title="`${type.text}时间`" :value="info.treat_at | date" />
|
||||||
<u-cell
|
<u-cell title="划线价" :value="info.origin_price" />
|
||||||
title="类别"
|
<u-cell title="实收价" :value="info.sell_price" />
|
||||||
:value="type.text"
|
<u-cell title="收费情况" :value="info.order_status" />
|
||||||
/>
|
<u-cell :title="`${type.text}医师`" :value="info.doctor ? info.doctor.name : ''" />
|
||||||
<u-cell
|
<u-cell :title="`${type.text}情况`">
|
||||||
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">
|
<view slot="value">
|
||||||
<!-- <rich-text :nodes="info.illness" /> -->
|
<!-- <rich-text :nodes="info.illness" /> -->
|
||||||
<text>{{info.content}}</text>
|
<text>{{info.content}}</text>
|
||||||
|
|
@ -75,115 +17,20 @@
|
||||||
</u-cell>
|
</u-cell>
|
||||||
<u-cell title="图片资料">
|
<u-cell title="图片资料">
|
||||||
<view slot="value">
|
<view slot="value">
|
||||||
<cu-image ref="images" @update="updateImages" />
|
<u-album :urls="info.images" />
|
||||||
</view>
|
</view>
|
||||||
</u-cell>
|
</u-cell>
|
||||||
<u-cell
|
<u-cell
|
||||||
title="下次就诊时间"
|
title="下次就诊时间"
|
||||||
:value="info.next_treat_at | date"
|
: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>
|
</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>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<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 {
|
export default {
|
||||||
components: {SelectAdminUser, CuEditor, CuImage},
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
id: '',
|
id: '',
|
||||||
|
|
@ -195,266 +42,38 @@ export default {
|
||||||
notify_remarks: '',
|
notify_remarks: '',
|
||||||
is_notified: 0,
|
is_notified: 0,
|
||||||
},
|
},
|
||||||
adminUser: {
|
|
||||||
key: '',
|
|
||||||
doctor_name: '',
|
|
||||||
notify_user_name: ''
|
|
||||||
},
|
|
||||||
type: {
|
type: {
|
||||||
text: '',
|
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) {
|
onLoad(e) {
|
||||||
this.id = e.id
|
this.id = e.id
|
||||||
this.init()
|
this.loadData()
|
||||||
},
|
},
|
||||||
onPullDownRefresh() {
|
onPullDownRefresh() {
|
||||||
this.loadData()
|
this.loadData()
|
||||||
},
|
},
|
||||||
methods: {
|
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() {
|
async loadData() {
|
||||||
if (!this.id) {
|
if (!this.id) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
uni.showLoading()
|
uni.showLoading()
|
||||||
const params = { _action: 'getData' }
|
let res = await this.$ajax.get(`/api/client/record/${this.id}`)
|
||||||
let res = await this.$ajax.get(`/admin-api/record/${this.id}`, { params })
|
|
||||||
uni.stopPullDownRefresh()
|
uni.stopPullDownRefresh()
|
||||||
if (res.status == 0) {
|
if (res.status == 0) {
|
||||||
this.info = {
|
this.info = res.data
|
||||||
...res.data,
|
// this.info = {
|
||||||
treat_at: res.data.treat_at ? res.data.treat_at.replaceAll('-', '/') : '',
|
// ...res.data,
|
||||||
next_treat_at: res.data.next_treat_at ? res.data.next_treat_at.replaceAll('-', '/') : '',
|
// treat_at: res.data.treat_at ? res.data.treat_at.replaceAll('-', '/') : '',
|
||||||
notify_at: res.data.notify_at ? res.data.notify_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 => {
|
this.type.text = this.info.type.name
|
||||||
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>
|
</script>
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,8 @@
|
||||||
<template>
|
<template>
|
||||||
<view class="page">
|
<view class="page">
|
||||||
<view class="add-button">
|
|
||||||
<u-button type="primary" icon="plus" shape="circle" size="large" @click="add" />
|
|
||||||
</view>
|
|
||||||
<view class="list">
|
<view class="list">
|
||||||
<u-list :height="listHeight" @scrolltolower="reachBottom">
|
<u-list :height="listHeight" @scrolltolower="reachBottom">
|
||||||
<u-swipe-action>
|
|
||||||
<u-list-item v-for="item in list" :key="item.id">
|
<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}`">
|
<u-cell size="large" :url="`/pages/record/detail?id=${item.id}`">
|
||||||
<view slot="title" class="title">
|
<view slot="title" class="title">
|
||||||
<view class="list-item-title">医师: {{ item.doctor ? item.doctor.name : '' }}</view>
|
<view class="list-item-title">医师: {{ item.doctor ? item.doctor.name : '' }}</view>
|
||||||
|
|
@ -23,19 +18,9 @@
|
||||||
时间: {{ item.treat_at }}
|
时间: {{ item.treat_at }}
|
||||||
</view>
|
</view>
|
||||||
</u-cell>
|
</u-cell>
|
||||||
</u-swipe-action-item>
|
|
||||||
</u-list-item>
|
</u-list-item>
|
||||||
</u-swipe-action>
|
|
||||||
</u-list>
|
</u-list>
|
||||||
</view>
|
</view>
|
||||||
<u-action-sheet
|
|
||||||
:actions="option.list"
|
|
||||||
:title="option.title"
|
|
||||||
:show="option.show"
|
|
||||||
:closeOnClickOverlay="true"
|
|
||||||
@close="closeOption"
|
|
||||||
@select="chooseOption"
|
|
||||||
/>
|
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
@ -43,9 +28,8 @@
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
patient_id: '',
|
type: '',
|
||||||
patient: {},
|
page: 1,
|
||||||
typeIndex: 0,
|
|
||||||
perPage: 20,
|
perPage: 20,
|
||||||
typeList: [],
|
typeList: [],
|
||||||
list: [],
|
list: [],
|
||||||
|
|
@ -66,43 +50,26 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad(e) {
|
onLoad(e) {
|
||||||
this.patient_id = e.patient
|
this.type = e.type
|
||||||
uni.getSystemInfo({
|
uni.getSystemInfo({
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
this.listHeight = res.safeArea.height - 20
|
this.listHeight = res.safeArea.height - 20
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
this.init()
|
this.loadData(true)
|
||||||
},
|
},
|
||||||
onPullDownRefresh() {
|
onPullDownRefresh() {
|
||||||
this.loadData(true)
|
this.loadData(true)
|
||||||
},
|
},
|
||||||
methods: {
|
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) {
|
loadData(refresh) {
|
||||||
if (refresh) {
|
if (refresh) {
|
||||||
this.list = []
|
this.list = []
|
||||||
this.page = 1
|
this.page = 1
|
||||||
}
|
}
|
||||||
uni.showLoading()
|
uni.showLoading()
|
||||||
const params = { _action: 'getData', page: this.page, perPage: this.perPage, patient_id: this.patient_id }
|
const params = { page: this.page, perPage: this.perPage, type_id: this.type }
|
||||||
this.$ajax.get('/admin-api/record', { params }).then(res => {
|
this.$ajax.get('/api/client/record', { params }).then(res => {
|
||||||
uni.stopPullDownRefresh()
|
uni.stopPullDownRefresh()
|
||||||
if (res.status == 0) {
|
if (res.status == 0) {
|
||||||
this.list = this.list.concat(res.data.items)
|
this.list = this.list.concat(res.data.items)
|
||||||
|
|
@ -118,55 +85,6 @@ export default {
|
||||||
this.loadData()
|
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>
|
</script>
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,224 @@
|
||||||
|
<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="phone" :required="true">
|
||||||
|
<u--input v-model="user.phone" :focus="true" border="bottom" placeholder="请填写手机号" />
|
||||||
|
</u-form-item>
|
||||||
|
<u-form-item label="密码" prop="password" :required="true">
|
||||||
|
<u--input v-model="user.password" border="bottom" placeholder="请填写密码" password />
|
||||||
|
</u-form-item>
|
||||||
|
<u-form-item label="姓名" prop="name">
|
||||||
|
<u--input v-model="user.name" border="bottom" placeholder="请填写姓名" />
|
||||||
|
</u-form-item>
|
||||||
|
<u-form-item label="性别" prop="sex" @click="openGender">
|
||||||
|
<view class="input-text">
|
||||||
|
<text>{{ gender.text }}</text>
|
||||||
|
<u-icon name="arrow-right" />
|
||||||
|
</view>
|
||||||
|
</u-form-item>
|
||||||
|
<u-form-item label="生日" prop="birthday" @click="openBirthday">
|
||||||
|
<view class="input-text">
|
||||||
|
<text :class="{'input-placeholder': !user.birthday}">{{ birthday.text }}</text>
|
||||||
|
<u-icon name="arrow-right" />
|
||||||
|
</view>
|
||||||
|
</u-form-item>
|
||||||
|
<u-form-item label="住址" prop="address">
|
||||||
|
<u--input v-model="user.address" border="bottom" placeholder="请填写地址" />
|
||||||
|
</u-form-item>
|
||||||
|
</u--form>
|
||||||
|
<view class="button">
|
||||||
|
<u-button text="注册" type="error" @click="submit"></u-button>
|
||||||
|
</view>
|
||||||
|
<u-action-sheet
|
||||||
|
:show="gender.show"
|
||||||
|
:actions="gender.options"
|
||||||
|
:closeOnClickOverlay="true"
|
||||||
|
@close="closeGender"
|
||||||
|
@select="selectGender"
|
||||||
|
/>
|
||||||
|
<u-datetime-picker
|
||||||
|
v-model="birthday.value"
|
||||||
|
mode="date"
|
||||||
|
:show="birthday.show"
|
||||||
|
:closeOnClickOverlay="true"
|
||||||
|
:minDate="birthday.minDate"
|
||||||
|
@close="openBirthday"
|
||||||
|
@cancel="closeBirthday"
|
||||||
|
@confirm="selectBirthday"
|
||||||
|
/>
|
||||||
|
</view>
|
||||||
|
<view class="icp">
|
||||||
|
<text @click="handleIcp">{{ setting.web_icp }}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import gender from '../../enums/gender'
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
user: {
|
||||||
|
phone: '',
|
||||||
|
password: '',
|
||||||
|
openid: '',
|
||||||
|
open_type: '',
|
||||||
|
name: '',
|
||||||
|
sex: gender.none.value,
|
||||||
|
address: '',
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
phone: {
|
||||||
|
required: true,
|
||||||
|
message: '手机号必填',
|
||||||
|
trigger: ['blur', 'change']
|
||||||
|
},
|
||||||
|
password: {
|
||||||
|
required: true,
|
||||||
|
message: '密码必填',
|
||||||
|
trigger: ['blur', 'change']
|
||||||
|
},
|
||||||
|
},
|
||||||
|
setting: {},
|
||||||
|
logo: '',
|
||||||
|
appName: '',
|
||||||
|
|
||||||
|
openid: '',
|
||||||
|
open_type: '',
|
||||||
|
|
||||||
|
gender: {
|
||||||
|
show: false,
|
||||||
|
text: gender.none.text,
|
||||||
|
options: gender.options
|
||||||
|
},
|
||||||
|
birthday: {
|
||||||
|
show: false,
|
||||||
|
text: '请选择生日',
|
||||||
|
value: (new Date).getTime(),
|
||||||
|
minDate: (new Date('1900/1/1')).getTime()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
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
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
submit() {
|
||||||
|
this.$refs['form'].validate().then(res => {
|
||||||
|
uni.showLoading()
|
||||||
|
this.$ajax.post('/api/client/register', this.user).then(res => {
|
||||||
|
uni.hideLoading()
|
||||||
|
if (res.status == 0) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '注册成功',
|
||||||
|
icon: 'success'
|
||||||
|
})
|
||||||
|
setTimeout(() => {
|
||||||
|
uni.setStorageSync('medical_record_client_auth_token', res.data.token)
|
||||||
|
uni.redirectTo({
|
||||||
|
url: '/pages/index/index'
|
||||||
|
})
|
||||||
|
}, 800);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}).catch(error => {})
|
||||||
|
},
|
||||||
|
handleIcp() {
|
||||||
|
// #ifdef H5
|
||||||
|
window.open('https://beian.miit.gov.cn', '_blank')
|
||||||
|
// #endif
|
||||||
|
},
|
||||||
|
openGender() {
|
||||||
|
this.gender.show = true
|
||||||
|
},
|
||||||
|
closeGender() {
|
||||||
|
this.gender.show = false
|
||||||
|
},
|
||||||
|
selectGender(e) {
|
||||||
|
this.gender.text = e.name
|
||||||
|
this.user.sex = e.value
|
||||||
|
},
|
||||||
|
openBirthday() {
|
||||||
|
this.birthday.show = true
|
||||||
|
},
|
||||||
|
closeBirthday() {
|
||||||
|
this.birthday.show = false
|
||||||
|
},
|
||||||
|
selectBirthday(e) {
|
||||||
|
this.user.birthday = this.birthday.text = uni.$u.timeFormat(e.value, 'yyyy-mm-dd')
|
||||||
|
this.closeBirthday()
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</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;
|
||||||
|
}
|
||||||
|
.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;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
@ -0,0 +1,166 @@
|
||||||
|
<template>
|
||||||
|
<view class="page">
|
||||||
|
<u-cell-group>
|
||||||
|
<u-cell title="手机号" :value="info.phone" />
|
||||||
|
<u-cell title="头像" isLink @click="handleAvatar">
|
||||||
|
<u-avatar slot="value" :src="info.avatar" />
|
||||||
|
</u-cell>
|
||||||
|
<u-cell title="姓名" :value="info.name" isLink @click="openModal('姓名', 'name')" />
|
||||||
|
<u-cell title="性别" :value="info.sex_text" isLink @click="openGender" />
|
||||||
|
<u-cell title="生日" :value="info.birthday_format" isLink @click="openBirthday" />
|
||||||
|
<u-cell title="住址" :value="info.address" isLink @click="openModal('住址', 'address')" />
|
||||||
|
</u-cell-group>
|
||||||
|
<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="gender.show"
|
||||||
|
:actions="gender.options"
|
||||||
|
:closeOnClickOverlay="true"
|
||||||
|
@close="closeGender"
|
||||||
|
@select="selectGender"
|
||||||
|
/>
|
||||||
|
<u-datetime-picker
|
||||||
|
v-model="birthday.value"
|
||||||
|
mode="date"
|
||||||
|
:show="birthday.show"
|
||||||
|
:closeOnClickOverlay="true"
|
||||||
|
:minDate="birthday.minDate"
|
||||||
|
@close="openBirthday"
|
||||||
|
@cancel="closeBirthday"
|
||||||
|
@confirm="selectBirthday"
|
||||||
|
/>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import gender from '../../enums/gender'
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
info: {},
|
||||||
|
modal: {
|
||||||
|
show: false,
|
||||||
|
title: '',
|
||||||
|
key: '',
|
||||||
|
value: ''
|
||||||
|
},
|
||||||
|
gender: {
|
||||||
|
show: false,
|
||||||
|
options: gender.options
|
||||||
|
},
|
||||||
|
birthday: {
|
||||||
|
show: false,
|
||||||
|
value: (new Date).getTime(),
|
||||||
|
minDate: (new Date('1900/1/1')).getTime()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onLoad() {
|
||||||
|
this.init()
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
init() {
|
||||||
|
this.$ajax.get('/api/client/user/profile').then(res => {
|
||||||
|
if (res.status == 0) {
|
||||||
|
this.info = res.data
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
handleAvatar() {
|
||||||
|
uni.chooseImage({
|
||||||
|
count: 1,
|
||||||
|
success: async (res) => {
|
||||||
|
let res1 = await this.$ajax.upload('/api/web/upload', {
|
||||||
|
filePath: res.tempFilePaths[0],
|
||||||
|
custom: { toast: false, loading: false },
|
||||||
|
name: 'file'
|
||||||
|
})
|
||||||
|
uni.showLoading()
|
||||||
|
if (res1.status == 0) {
|
||||||
|
let res2 = await this.update({ avatar: res1.data.file })
|
||||||
|
if (res2.status == 0) {
|
||||||
|
this.info.avatar = res1.data.file
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
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
|
||||||
|
},
|
||||||
|
openGender() {
|
||||||
|
this.gender.show = true
|
||||||
|
},
|
||||||
|
closeGender() {
|
||||||
|
this.gender.show = false
|
||||||
|
},
|
||||||
|
selectGender(e) {
|
||||||
|
this.update({ sex: e.value }).then(res => {
|
||||||
|
if (res.status == 0) {
|
||||||
|
this.info.sex_text = e.name
|
||||||
|
this.info.sex = e.value
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
openBirthday() {
|
||||||
|
// if (this.info.birthday) {
|
||||||
|
// this.birthday.value = (new Date(this.info.birthday.replaceAll('-', '/'))).getTime()
|
||||||
|
// }
|
||||||
|
this.birthday.show = true
|
||||||
|
},
|
||||||
|
closeBirthday() {
|
||||||
|
this.birthday.show = false
|
||||||
|
},
|
||||||
|
selectBirthday(e) {
|
||||||
|
const value = uni.$u.timeFormat(e.value, 'yyyy-mm-dd')
|
||||||
|
this.update({ birthday: value }).then(res => {
|
||||||
|
if (res.status == 0) {
|
||||||
|
this.info.birthday = this.info.birthday_format = value
|
||||||
|
this.closeBirthday()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
update(params) {
|
||||||
|
return this.$ajax.post('/api/client/user/profile', params, { custom: { loading: true } })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.page {
|
||||||
|
padding: 20px 0;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
.page ::v-deep .u-cell-group {
|
||||||
|
background: white;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
@ -14,7 +14,7 @@ module.exports = () => {
|
||||||
// 请求拦截
|
// 请求拦截
|
||||||
uni.$u.http.interceptors.request.use(
|
uni.$u.http.interceptors.request.use(
|
||||||
(config) => {
|
(config) => {
|
||||||
const token = uni.getStorageSync('medical_record_auth_token')
|
const token = uni.getStorageSync('medical_record_client_auth_token')
|
||||||
if (token) {
|
if (token) {
|
||||||
config.header['Authorization'] = `Bearer ${token}`
|
config.header['Authorization'] = `Bearer ${token}`
|
||||||
}
|
}
|
||||||
|
|
@ -41,9 +41,9 @@ module.exports = () => {
|
||||||
showCancel: false
|
showCancel: false
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
if (res.code == 401) {
|
if (res.status == 401) {
|
||||||
uni.reLaunch({
|
uni.reLaunch({
|
||||||
url: '/pages/login/login'
|
url: '/pages/login/index'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue