gx
chenyc
2025-08-08 ace0cfcd61927780dda4bd4a86c7b742ce9d48c2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
 
import { defineStore } from 'pinia'
import { ref } from 'vue'
import { ajaxPost} from '@/utils/axios'
// 使用示例一:函数式定义【个人推荐】
export const userInfoStore = defineStore('userInfo', () => {
    const info = ref({
        openid:'',
        headimgurl:'',
        nickname:'',
    })
    const patient=ref({
        patientInfo:{
            age:0,
            code:'',
            id:'',
            patientCardNo:'',
            patientOpenId:'',
            patientIdentityNo:'',
            patientName:'',
            patientTelNo:'',
            patientAvatarIcon:'',
            patientCreditValue:0,
            patientAddress:'',
            clientCode:'',
        },
        pressure:'',
        weight:''
    })
 
    const 最近体重血压 = ref({
        血压: '',
        体重: ''
    })
    function setInfo(userInfo:{openid:string, headimgurl:string,nickname:string}) {
        info.value.openid=userInfo.openid
        info.value.headimgurl=userInfo.headimgurl
        info.value.nickname=userInfo.nickname
    }
    function setPatient(userInfo:any) {
        patient.value=userInfo
        set最近体重血压(userInfo.patientInfo.code)
    }
    const setPatientApi= async()=>{
        const res= await ajaxPost('/patient/info/getPatientInfo','')
        setPatient(res)
    }
    const set最近体重血压 = async(patientCode:any)=>{
        const data= await ajaxPost('/patient/info/getPatientBodyWeightBloodPressure?patientCode='+patientCode,'')
        console.log(data,'最近体重血压数据')
        最近体重血压.value = {
            血压: data.透前血压,
            体重: data.透前称重
        }
        console.log(最近体重血压.value,'最近体重血压数据')
    }
 
    return { info,patient,最近体重血压,setPatient, setInfo,setPatientApi }
})