luolei 5 лет назад
Родитель
Сommit
5f723c17f8

+ 1 - 1
build/webpack.dev.conf.js

@@ -29,7 +29,7 @@ const devWebpackConfig = merge(baseWebpackConfig, {
       ],
     },
     hot: true,
-    openPage:'?hospitalCode=A001&hospitalDeptCode=D01&doctorCode=YS001&patientCode=1600&recordId=44',//携带参数
+    // openPage:'?hospitalCode=A001&hospitalDeptCode=D01&doctorCode=YS001&patientCode=1600&recordId=44',//携带参数
     contentBase: false, // since we use CopyWebpackPlugin.
     compress: true,
     // host: HOST || config.dev.host,

+ 1 - 0
src/common/Submit.vue

@@ -112,6 +112,7 @@ export default {
 .submitFail {
   width: 6rem;
   height: 0.88rem;
+  font-size:.3rem;
   line-height: 0.88rem;
   z-index: 999;
   position: absolute;

+ 27 - 8
src/components/Department.vue

@@ -2,14 +2,14 @@
     <div class="department">
         <div class="departmentView">
             <div class="content">
-                <div class="list" @click="goStart">
+                <div class="list" v-for="(item,index) in departmentLis" @click="goStart(index)" :key="item.recordTime">
                     <div class="top">
-                        <p>挂号科室:急诊科 <img src="../images/right.png" alt=""></p>
+                        <p>挂号科室:{{item.hospitalDeptName}} <img src="../images/right.png" alt=""></p>
                     </div>
                     <div class="main">
-                        <p>预约时间:2019-8-18 14:00</p>
-                        <p>病历号:1234567</p>
-                        <p>挂号信息:1234567</p>
+                        <p>预约时间:{{item.recordTime}}</p>
+                        <p>病历号:{{item.recordId}}</p>
+                        <p>挂号信息:{{item.registerNum}}</p>
                     </div>
                 </div>
                 <div class="list">
@@ -33,18 +33,37 @@
         name: "Department",
         data(){
             return {
-                scroll:null
+                scroll:null,
+                departmentLis:[]
             }
         },
+        created(){
+            this.departmentLis = this.$route.params.result
+        },
         mounted(){
+            if(JSON.stringify(this.$route.params) == '{}'){
+                this.$router.replace({path:'/login'})
+                return
+            }
             this.$nextTick(()=>{
                 let scroll = setScroll(BScroll,true,'.departmentView')
                 this.scroll = scroll
             })
         },
         methods:{
-            goStart(){
-                this.$router.replace({path:'/'})
+            goStart(num){
+                let msg = this.departmentLis[num]
+                let params = {
+                    hospitalCode:msg.hospitalCode,
+                    hospitalDeptCode:msg.hospitalDeptCode,
+                    doctorCode:msg.doctorCode,
+                    patientCode:msg.patientCode,
+                    recordId:msg.recordId
+                }
+                this.$router.replace({
+                    path:'/',
+                    query:params
+                })
             }
         }
     }

+ 73 - 21
src/components/Login.vue

@@ -9,31 +9,42 @@
                 <p @click="handleShow">{{name}} <img src="../images/down.png" /></p>
                 <div class="slideType" v-if="show">
                     <ul>
-                        <li @click="handleType('手机号',1)">手机号</li>
-                        <li @click="handleType('身份证号',2)">身份证号</li>
-                        <li @click="handleType('病历号',3)">病历号</li>
-                        <li @click="handleType('市民卡号',4)" style="border:0 none">市民卡号</li>
+                        <li @click="handleType('手机号',103)">手机号</li>
+                        <li @click="handleType('身份证号',101)">身份证号</li>
+                        <li @click="handleType('病历号',102)">病历号</li>
+                        <li @click="handleType('市民卡号',104)" style="border:0 none">市民卡号</li>
                     </ul>
                 </div>
             </div>
             <div class="iptWrap number">
-                <input @blur="blur" :maxlength="type==1?11:type==2?18:type==3?7:type==4?9:30" v-model="value" @input="changeVal" :type="type!=2?'tel':'text'" class="input" type="text" :placeholder="'请输入'+name" >
+                <input @blur="blur" :maxlength="type==103?11:type==101?18:type==102?7:type==104?9:30" v-model="value" @input="changeVal" :type="type==101||type==104?'text':'tel'" class="input" type="text" :placeholder="'请输入'+name" >
             </div>
             <div :class="['btn',value?'btnClick':'btnDis']" @click="handleDepart">进入预问诊</div>
         </div>
         <div class="tip">
             注:建议您可先输入病情情况,方便医生提前了解情况
         </div>
+      <Submit
+        v-if="submit"
+        :showType="showType"
+        :fail="failMsg"
+        @showSubmit="showSubmit"
+      ></Submit>
     </div>
 </template>
 <script>
-    import {phoneTest,identify} from '@utils/tools.js';
+    import {phoneTest,identify,jgpattern} from '@utils/tools.js';
+    import Submit from '../common/Submit';
+    import api from '@utils/api.js';
     export default {
         name: "Login",
         data(){
             return {
+                showType: 'fail',
+                failMsg:'',
+                submit:false,
                 show:false,
-                type:'1',
+                type:'103',
                 name:'手机号',
                 value:''
             }
@@ -60,28 +71,69 @@
             },
             changeVal(){
                 document.activeElement.scrollIntoViewIfNeeded(true);
-                if(this.type != 2){
-                    this.value=this.value.replace(/[^\d]/g,'')
+                const {type,value} = this
+                if(type == 102||type == 103){
+                    this.value=value.replace(/[^\d]/g,'')
+                }else if(type == 101 || type == 104){
+                    this.value=value.replace(/[\u4e00-\u9fa5]/g,'')
                 }
             },
+            defaultWaring(msg){
+                this.$store.commit('handleToggleShow', false);
+                this.showType = 'fail'
+                this.failMsg = msg
+                this.submit = true
+                let timer = setTimeout(() => {
+                    this.submit = false
+                    clearTimeout(timer)
+                }, 2000);
+            },
+            showSubmit(flg) {
+                this.submit = flg
+            },
             handleDepart(){
                 const {type,value} = this
-                if(type == 1){
-                    console.log(phoneTest.test(value))
-                    if(!phoneTest.test(value)){//验证不通过
-
-                    }
-                }else if(type == 2){
 
-                }else if(type == 3){
-
-                }else if(type == 4){
-
-                }
                 if(value){
-                    this.$router.replace({path:'/department'})
+                  if(type == 103){
+                      console.log(phoneTest.test(value))
+                      if(!phoneTest.test(value)){//验证不通过
+                          this.defaultWaring('请输入正确的11位手机号码')
+                          return
+                      }
+                  }else if(type == 101){//身份证
+                      if(!identify.test(value)){//验证不通过
+                          this.defaultWaring('请输入正确的身份证号')
+                          return
+                      }
+                  }else if(type == 104){//病历号
+                      if(!jgpattern.test(value)){//验证不通过
+                          this.defaultWaring('请输入正确的市民卡号')
+                          return
+                      }
+                  }
+                  const param = {
+                      "patientInfo": this.value,
+                      "patientInfoType": this.type
+                  }
+                  api.signIn(param).then((res) => {
+                      const result = res.data;
+                      if (result.code == 0) {
+                          if(result.data.length>1){
+                              this.$router.replace({
+                                  name:'Department',
+                                  params:{"result":result.data}
+                              })
+                          }
+                      }else{
+                        this.defaultWaring(res)
+                      }
+                  })
                 }
             }
+        },
+        components:{
+          Submit
         }
     }
 </script>

+ 15 - 6
src/components/PathInfo.vue

@@ -107,12 +107,19 @@
     },
     methods:{
       getPathInfo(){
+        let query = this.$route.query
+        let hasQuery = JSON.stringify(query) == '{}'
         const params = {
-          'hospitalCode':getUrlArgObject('hospitalCode'),
-          'hospitalDeptCode':getUrlArgObject('hospitalDeptCode'),
-          'doctorCode':getUrlArgObject('doctorCode'),
-          'patientCode':getUrlArgObject('patientCode'),
-          'recordId':getUrlArgObject('recordId')
+          // 'hospitalCode':getUrlArgObject('hospitalCode'),
+          // 'hospitalDeptCode':getUrlArgObject('hospitalDeptCode'),
+          // 'doctorCode':getUrlArgObject('doctorCode'),
+          // 'patientCode':getUrlArgObject('patientCode'),
+          // 'recordId':getUrlArgObject('recordId')
+          'hospitalCode':!hasQuery&&query.hospitalCode||'',
+          'hospitalDeptCode':!hasQuery&&query.hospitalDeptCode||'',
+          'doctorCode':!hasQuery&&query.doctorCode||'',
+          'patientCode':!hasQuery&&query.patientCode||'',
+          'recordId':!hasQuery&&query.recordId||''
         }
         api.getPathInfo(params).then((res)=>{
           const result = res.data;
@@ -125,8 +132,10 @@
         })
       },
       getSysConfig(){
+        let query = this.$route.query
+        let hasQuery = JSON.stringify(query) == '{}'
         const param = {
-          'hospitalCode':getUrlArgObject('hospitalCode')
+          'hospitalCode':!hasQuery&&query.hospitalCode||'',
         }
         api.getSysConfig(param).then((res)=>{
           const result = res.data;

+ 4 - 0
src/utils/api.js

@@ -12,6 +12,7 @@ const urls = {
   uploadImageThum:'/api/prec/file/uploadImageThum',//单个文件上传同时生成缩略图
   uploadImageThums:'/api/prec/file/uploadImageThums',//多个文件上传同时生成缩略图
   getTagInfos:'/api/prec/retrieval/getTagInfos',//检索
+  signIn:'/api/prec/patientInfo/signIn',//登录
   // uploadImageThums:'http://192.168.3.1:8849/file/uploadImageThums',//多个文件上传同时生成缩略图
 }
 
@@ -49,4 +50,7 @@ export default {
   saveInquiry(param){
     return axios.post(urls.saveInquiry,param)
   },
+  signIn(param){
+    return axios.post(urls.signIn,param)
+  },
 }

+ 4 - 2
src/utils/tools.js

@@ -111,7 +111,8 @@ const patt = /\$\{[^\]]+\}/g;
 const phoneTest = /^[1]([3-9])[0-9]{9}$/;
 //身份证验证
 const identify =/(^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$)|(^[1-9]\d{5}\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}$)/;
-
+//只能是数字和字母
+const jgpattern =/^[A-Za-z0-9]+$/; 
 
 const getAllStr = (allData) =>{//获取界面数据,拼接字符串
   // console.log(allData,777777)
@@ -309,7 +310,8 @@ module.exports =  {
   setScroll,
   isWX,
   phoneTest,
-  identify
+  identify,
+  jgpattern
 }