更新小程序仓库
This commit is contained in:
@@ -0,0 +1,301 @@
|
||||
// pages/selectPatient/selectPatient.js
|
||||
const app = getApp()
|
||||
import {family,addfamily} from "../../api/familyDoc"
|
||||
import {throttle} from "../../utils/util"
|
||||
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
doctor_id:'',
|
||||
chat_id:'',
|
||||
inquiry_type:'',
|
||||
show:false,
|
||||
sex:null,
|
||||
height:970,
|
||||
currentFamilyId:'',
|
||||
showPicker:false,
|
||||
realName:'',
|
||||
idCard:'',//'',
|
||||
phoneNumber:'',
|
||||
relation:"",
|
||||
relationId:"",
|
||||
family:[],
|
||||
img_host:'https://oss.prod.applets.igandanyiyuan.com/applet/patient/static',
|
||||
columns:[
|
||||
{text:"本人",value:1},
|
||||
{text:"父母",value:2},
|
||||
{text:"爱人",value:3},
|
||||
{text:"子女",value:4},
|
||||
{text:"亲戚",value:5},
|
||||
{text:"其他 ",value:6}
|
||||
]
|
||||
},
|
||||
addFamily(){
|
||||
let {realName,idCard,phoneNumber,relationId}=this.data;
|
||||
addfamily({
|
||||
card_name:realName,
|
||||
type:1,
|
||||
id_number:idCard,
|
||||
mobile:phoneNumber,
|
||||
is_default:0,
|
||||
relation:relationId
|
||||
}).then((data)=>{
|
||||
|
||||
this.getFamily();
|
||||
this.setData({
|
||||
currentFamilyId:data.family_id,
|
||||
realName:'',
|
||||
idCard:'',
|
||||
phoneNumber:'',
|
||||
relationId:'',
|
||||
relation:'',
|
||||
show:false
|
||||
|
||||
})
|
||||
// let {currentFamilyId,doctor_id,chat_id,inquiry_type,sex}=this.data;
|
||||
// app.method.navigateTo({
|
||||
// url: '../writeSick/writeSick?doctor_id='+doctor_id+"&family_id="+currentFamilyId+"&chat_id="+chat_id+"&sex="+sex+"&inquiry_type="+inquiry_type
|
||||
// })
|
||||
})
|
||||
},
|
||||
selectPatient(e){
|
||||
let currentFamilyId=e.currentTarget.dataset.familyid;
|
||||
let sex=e.currentTarget.dataset.sex;
|
||||
this.setData({
|
||||
currentFamilyId:currentFamilyId,
|
||||
sex:sex
|
||||
})
|
||||
},
|
||||
getFamily(){
|
||||
family().then((data)=>{
|
||||
this.setData({
|
||||
family:this.transforpage(data)
|
||||
})
|
||||
})
|
||||
},
|
||||
goBack(){
|
||||
wx.navigateBack({
|
||||
delta: 1,
|
||||
})
|
||||
},
|
||||
addPatient(){
|
||||
this.setData({
|
||||
show:true,
|
||||
currentFamilyId:"",
|
||||
sex:""
|
||||
})
|
||||
},
|
||||
transforpage(arr) {
|
||||
const pages = []
|
||||
let newArr=arr.concat([{
|
||||
type:"add"
|
||||
}])
|
||||
newArr.forEach((item, index) => {
|
||||
const page = Math.floor(index / 2)
|
||||
if (!pages[page]) {
|
||||
pages[page] = []
|
||||
}
|
||||
pages[page].push(item)
|
||||
});
|
||||
return pages
|
||||
},
|
||||
onClose(){
|
||||
this.setData({
|
||||
show:false
|
||||
})
|
||||
},
|
||||
onConfirm(event) {
|
||||
const { value} = event.detail;
|
||||
this.setData({
|
||||
relationId: `${value.value}`,
|
||||
relation:`${value.text}`,
|
||||
showPicker:false
|
||||
});
|
||||
},
|
||||
|
||||
openPicker(){
|
||||
this.setData({
|
||||
showPicker:true
|
||||
})
|
||||
},
|
||||
closePicker(){
|
||||
this.setData({
|
||||
showPicker:false
|
||||
})
|
||||
},
|
||||
|
||||
inputChange(e){
|
||||
this.setData({
|
||||
[e.target.dataset.id]: e.detail.value
|
||||
})
|
||||
},
|
||||
//获取身份证号信息
|
||||
getIdInfo(IdCard){
|
||||
var reg = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/;
|
||||
if(reg.test(IdCard)){
|
||||
let sex
|
||||
if (parseInt(IdCard.substr(16, 1)) % 2 === 1) {
|
||||
sex = '1'
|
||||
} else {
|
||||
sex = '2'
|
||||
}
|
||||
var ageDate = new Date()
|
||||
var month = ageDate.getMonth() + 1
|
||||
var day = ageDate.getDate()
|
||||
var age = ageDate.getFullYear() - IdCard.substring(6, 10) - 1
|
||||
if (IdCard.substring(10, 12) < month || (IdCard.substring(10, 12) === month && IdCard.substring(12, 14) <= day)) {
|
||||
age++
|
||||
}
|
||||
if (age <= 0) {
|
||||
age = 1
|
||||
}
|
||||
return { sex, age}
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
},
|
||||
handleThrottleNext:throttle(function(){
|
||||
this.goNext()
|
||||
}),
|
||||
goNext(){
|
||||
let url='';
|
||||
let {doctor_id,currentFamilyId,chat_id,inquiry_type,sex}=this.data;
|
||||
if(this.data.doctor_id){
|
||||
url='/pages/writeSick/writeSick?doctor_id='+doctor_id+"&family_id="+currentFamilyId+"&chat_id="+chat_id+"&inquiry_type="+inquiry_type+"&sex="+sex
|
||||
}else{
|
||||
url='/pages/writeSick/writeSick?family_id='+currentFamilyId+"&inquiry_type="+inquiry_type+"&sex="+sex
|
||||
}
|
||||
app.method.navigateTo({
|
||||
url: url
|
||||
})
|
||||
},
|
||||
handleThrottleSick:throttle(function(){
|
||||
this.goSick()
|
||||
}),
|
||||
goSick(){
|
||||
if (!/^([\u4e00-\u9fa5\·]{2,10})$/.test(this.data.realName)) {
|
||||
wx.showToast({
|
||||
title: `姓名要求在2-10个汉字`,
|
||||
icon: 'none',
|
||||
});
|
||||
return false;
|
||||
};
|
||||
if (!/(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/.test(this.data.idCard)){
|
||||
wx.showToast({
|
||||
title: `请输入有效的身份证号`,
|
||||
icon: 'none',
|
||||
});
|
||||
return false;
|
||||
};
|
||||
if(this.data.phoneNumber){
|
||||
if(!/^1[3456789]\d{9}$/.test(this.data.phoneNumber)){
|
||||
wx.showToast({
|
||||
title: `请输入有效的手机号码!`,
|
||||
icon: 'none',
|
||||
});
|
||||
return false;
|
||||
}
|
||||
};
|
||||
// if(!this.data.relationId){
|
||||
// wx.showToast({
|
||||
// title: `请选择与患者的关系`,
|
||||
// icon: 'none',
|
||||
// });
|
||||
// return false;
|
||||
// };
|
||||
let idInfo=this.getIdInfo(this.data.idCard);
|
||||
if(idInfo.age<6){
|
||||
wx.showToast({
|
||||
title: `六岁以下儿童不支持线上问诊`,
|
||||
icon: 'none',
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
this.setData({
|
||||
sex:idInfo.sex
|
||||
})
|
||||
this.addFamily()
|
||||
|
||||
},
|
||||
onfocus(event){
|
||||
this.setData({
|
||||
height:970+event.height+120
|
||||
})
|
||||
},
|
||||
onblur(event){
|
||||
this.setData({
|
||||
height:970
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad(options) {
|
||||
if(options.doctor_id){
|
||||
this.setData({
|
||||
doctor_id:options.doctor_id,
|
||||
chat_id:options.chat_id,
|
||||
|
||||
})
|
||||
}
|
||||
if(options.inquiry_type){
|
||||
this.setData({
|
||||
inquiry_type:options.inquiry_type
|
||||
})
|
||||
}
|
||||
this.getFamily();
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow() {
|
||||
this.setData({
|
||||
img_host:app.hostConfig().imghost
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
|
||||
})
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"usingComponents": {
|
||||
"van-popup": "@vant/weapp/popup/index",
|
||||
"van-picker": "@vant/weapp/picker/index",
|
||||
"nav":"../../components/nav/nav"
|
||||
},
|
||||
"navigationStyle":"custom",
|
||||
"navigationBarTitleText": "肝胆相照互联网医院"
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
<!--pages/selectPatient/selectPatient.wxml-->
|
||||
<nav navName="选择患者"></nav>
|
||||
<view class="contant">
|
||||
<view class="contain">
|
||||
<view class="card">
|
||||
<image src="{{img_host+'/patienthead.png'}}"></image>
|
||||
<view class="right">
|
||||
<view class="name">请选择患者</view>
|
||||
<view class="desc">请如实填写患者信息,辅助医生准确判断病情</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="personbox">
|
||||
<view class="row" wx:for-item="itemName" wx:for="{{family}}" wx:for-index="index" wx:key="index">
|
||||
<view class="cell" wx:for-item="item" wx:for="{{itemName}}" wx:key="family_id">
|
||||
<view class="cellinner" wx:if="{{!item.type}}" bindtap="selectPatient" data-familyId="{{item.family_id}}" data-sex="{{item.sex}}" data-name="{{item.card_name}}" data-age='{{item.age}}'>
|
||||
<view class="person">
|
||||
<view class="name">{{item.card_name}}</view>
|
||||
<view class="tag" wx:if="{{item.relation==1}}">本人</view>
|
||||
<view class="tag" wx:elif="{{item.relation==2}}">父母</view>
|
||||
<view class="tag" wx:elif="{{item.relation==3}}">爱人</view>
|
||||
<view class="tag" wx:elif="{{item.relation==4}}">子女</view>
|
||||
<view class="tag" wx:elif="{{item.relation==5}}">亲戚</view>
|
||||
<view class="tag" wx:elif="{{item.relation==6}}">其他</view>
|
||||
</view>
|
||||
<view class="desc">
|
||||
<view class="sex" wx:if="{{item.sex===0}}">性别未知</view>
|
||||
<view class="sex" wx:elif="{{item.sex==1}}">男</view>
|
||||
<view class="sex" wx:else>女</view>
|
||||
<view class="age">{{item.age}}岁</view>
|
||||
</view>
|
||||
<image src="{{img_host+'/gou.png'}}" class="gou" wx:if="{{item.family_id==currentFamilyId}}"></image>
|
||||
</view>
|
||||
<view class="celladd" bindtap="addPatient" wx:elif="{{item.type}}">
|
||||
+新建患者
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
<button class="button" plain="true" disabled="{{currentFamilyId?false:true}}" bindtap="handleThrottleNext">
|
||||
下一步
|
||||
</button>
|
||||
<van-popup show="{{ show }}" round closeable position="bottom" custom-style="height:{{height}}rpx" bind:close="onClose">
|
||||
<view class="infobox">
|
||||
<view class="title">新建患者</view>
|
||||
<view class="info">
|
||||
<view class="name">真实姓名<text>*</text></view>
|
||||
<input value="{{realName}}" type="text" bindinput="inputChange" placeholder="请输入真实姓名" data-id="realName" />
|
||||
</view>
|
||||
<view class="info">
|
||||
<view class="name">身份证号<text>*</text></view>
|
||||
<input value="{{idCard}}" type="idcard" bindinput="inputChange" cursor-spacing="70" placeholder="请输入真实身份证号" data-id="idCard" />
|
||||
</view>
|
||||
<view class="info">
|
||||
<view class="name">联系电话</view>
|
||||
<input value="{{phoneNumber}}" type="digit" bindblur="onblur" bindfocus="onfocus" cursor-spacing="100" bindinput="inputChange" placeholder="请输入联系电话" data-id="phoneNumber" />
|
||||
</view>
|
||||
<view class="info" bindtap="openPicker">
|
||||
<view class="name">患者关系</view>
|
||||
<input type="text" value="{{relation}}" placeholder="请选择与患者的关系" disabled="true" />
|
||||
</view>
|
||||
<view class="tip">
|
||||
<view class="warntitle">温馨提示:</view>
|
||||
<view class="warn">
|
||||
<view>1、根据国家卫健委要求,就医实行实名制,请如实填写患者信息。</view>
|
||||
<view>2、信息受隐私保护,仅接诊医生可见。
|
||||
</view>
|
||||
<view>3、6岁以下儿童不支持线上问诊,请到线下就诊。
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<button class="next" bindtap="handleThrottleSick" plain="true">
|
||||
确定
|
||||
</button>
|
||||
</view>
|
||||
</van-popup>
|
||||
<van-popup show="{{ showPicker }}" round position="bottom" custom-style="height:auto" bind:close="closePicker">
|
||||
<van-picker show-toolbar title="选择与患者之间的关系" columns="{{ columns }}" bind:cancel="closePicker" bind:confirm="onConfirm" />
|
||||
</van-popup>
|
||||
</view>
|
||||
@@ -0,0 +1,242 @@
|
||||
/* pages/selectPatient/selectPatient.wxss */
|
||||
.contant {
|
||||
min-height: 100%;
|
||||
background: #F2F2F2;
|
||||
}
|
||||
|
||||
.card {
|
||||
padding: 20rpx;
|
||||
background-color: #fff;
|
||||
margin-top: 212rpx;
|
||||
display: flex;
|
||||
border-radius: 10rpx;
|
||||
}
|
||||
.cellinner{
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
height:120rpx;
|
||||
}
|
||||
.card image {
|
||||
width: 104rpx;
|
||||
height: 104rpx;
|
||||
}
|
||||
|
||||
.card .right {
|
||||
display: flex;
|
||||
margin-left: 30rpx;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.card .right .name {
|
||||
color: #333333;
|
||||
font-size: 34rpx;
|
||||
}
|
||||
|
||||
.card .right .desc {
|
||||
color: #666666;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
.celladd{
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 120rpx;
|
||||
}
|
||||
.personbox {
|
||||
margin-top: 40rpx;
|
||||
border-radius: 10rpx;
|
||||
background-color: #fff;
|
||||
padding: 40rpx 20rpx;
|
||||
}
|
||||
|
||||
.personbox .row {
|
||||
margin-top: 30rpx;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
|
||||
}
|
||||
|
||||
.personbox .row:first-child {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.personbox .row .cell {
|
||||
position: relative;
|
||||
width: 47%;
|
||||
height: 120rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
|
||||
border-radius: 10rpx;
|
||||
border: 1px solid #CCCCCC;
|
||||
}
|
||||
|
||||
.personbox .row .cell:first-child {
|
||||
margin-left: 0rpx;
|
||||
}
|
||||
|
||||
.personbox .person {
|
||||
display: flex;
|
||||
margin: 0 25rpx;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.personbox .tag {
|
||||
margin-left: 32rpx;
|
||||
font-size: 24rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
line-height: 24rpx;
|
||||
justify-content: center;
|
||||
color: #666666;
|
||||
width: 80rpx;
|
||||
height: 32rpx;
|
||||
border-radius: 4rpx;
|
||||
transform: rotateZ(360deg);
|
||||
border: 1rpx solid #979797;
|
||||
}
|
||||
|
||||
.personbox .desc {
|
||||
display: flex;
|
||||
margin: 0 25rpx;
|
||||
font-size: 28rpx;
|
||||
color: #666;
|
||||
margin-top: 3px;
|
||||
}
|
||||
|
||||
.personbox .name {
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
max-width: 200rpx;
|
||||
text-overflow: ellipsis;
|
||||
font-size: 34rpx;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.personbox .age {
|
||||
|
||||
margin-left: 12rpx;
|
||||
}
|
||||
|
||||
.cell .gou {
|
||||
position: absolute;
|
||||
bottom: -1rpx;
|
||||
right: 0rpx;
|
||||
width: 66rpx;
|
||||
height: 53.7rpx;
|
||||
}
|
||||
|
||||
.add {
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
font-size: 34rpx;
|
||||
color: #333;
|
||||
}
|
||||
.button{
|
||||
outline: none;
|
||||
position: absolute;
|
||||
border: none!important;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
height: 94rpx;
|
||||
font-size: 36rpx;
|
||||
left: 30rpx;
|
||||
right: 30rpx;
|
||||
border-radius: 47rpx;
|
||||
bottom: 30rpx;
|
||||
color: #fff!important;
|
||||
background: #3CC7C0!important;
|
||||
}
|
||||
.button[disabled]{
|
||||
color: #000000!important;
|
||||
background:rgba(0,0,0,0.1)!important;
|
||||
}
|
||||
|
||||
|
||||
.next{
|
||||
outline: none;
|
||||
border: none!important;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
height: 94rpx;
|
||||
font-size: 36rpx;
|
||||
margin:0 32rpx;
|
||||
border-radius: 47rpx;
|
||||
color: #fff!important;
|
||||
margin-bottom: 40rpx;
|
||||
background: #3CC7C0!important;
|
||||
}
|
||||
.next[disabled]{
|
||||
background: rgba(0,0,0,0.1)!important;
|
||||
color:#333!important;
|
||||
}
|
||||
.van-icon-cross {
|
||||
color: #333;
|
||||
font-size: 40rpx !important;
|
||||
}
|
||||
|
||||
.infobox {
|
||||
margin-top: 40rpx;
|
||||
}
|
||||
|
||||
.info {
|
||||
position: relative;
|
||||
border-bottom: 1rpx solid #E7E7E7;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
height: 112rpx;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
.infobox .title {
|
||||
border-bottom: 1rpx solid #E7E7E7;
|
||||
text-align: center;
|
||||
font-size: 34rpx;
|
||||
padding-bottom: 35rpx;
|
||||
}
|
||||
|
||||
.info .name {
|
||||
white-space: nowrap;
|
||||
width: 180rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-left: 52rpx;
|
||||
color: #333333;
|
||||
font-size: 34rpx;
|
||||
}
|
||||
|
||||
.info text {
|
||||
margin-top: 20rpx;
|
||||
color:#E34D59;
|
||||
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
.info input {
|
||||
margin-left: 15rpx;
|
||||
margin-right: 52rpx;
|
||||
flex: 1;
|
||||
}
|
||||
.input-placeholder {
|
||||
color: #999999;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
.tip{
|
||||
padding:30rpx 52rpx 20rpx;
|
||||
}
|
||||
.warntitle{
|
||||
color: #E34D59;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
.warn{
|
||||
margin-top: 20rpx;
|
||||
font-size: 24rpx;
|
||||
line-height: 36rpx;
|
||||
color: #666666;
|
||||
}
|
||||
Reference in New Issue
Block a user