/**
* 定义全局变量
*/
var V_WEBBASE = "https://tsch.fromfuture.cn:7714/GZ/dtdocsfconroom/addfollowup?guid=";
//入参
var code = ""; //机构码
var guid = ""; //患者ID
var docguid = ""; //医生ID
var temperature = ""; //体温
var followstate = ""; //血糖
var bloodpressurel = ""; //血压 低
var weight = ""; //体重
var bloodoxygen = ""; //血氧
var heartrate = ""; //心率
var bloodpressureh = ""; //血压 高
var followconclusion = ""; //随访结论
var url = "";
var sickguid = parent.nowsick; //从母页面拿到患者guid
var G_APP_USRGUID = window.localStorage.getItem("XMIDWARE_APP_USRGUID"); //医生
$(function() {
console.log("sickguid="+sickguid);
if(sickguid != "") {
var YEMIAN_DATA = "https://tsch.fromfuture.cn:7714/GZ/v1/cloud/querySfjhToYzs?guid=" + sickguid;
//guid = "581C2CDE7027CD11E050007F0100104D";
try {
$.ajax({
url: YEMIAN_DATA,
type: ‘POST‘,
success: function(result) {
result = result.trim();
result = result.replace(/\n/g, ‘‘);
try {
var regJson = JSON.parse(result);
console.log(result);
//console.log(regJson.data.TEMPERATURE);
if(regJson.code == 000) {
//患者姓名
var usrName = regJson.data.usrName
document.getElementById(‘usrName‘).innerHTML = usrName
//患者性别
var usrSex = regJson.data.usrSex
document.getElementById(‘usrSex‘).innerHTML = usrSex
//患者年龄
var usrAge = regJson.data.usrAge
document.getElementById(‘usrAge‘).innerHTML = usrAge
//随访内容
var followoption = regJson.data.followoption
document.getElementById(‘followoption‘).innerHTML = followoption
//诊断
var zdnam = regJson.data.zdnam
document.getElementById(‘zdnam‘).innerHTML = zdnam
//科室
var deptnam = regJson.data.deptnam
document.getElementById(‘deptnam‘).innerHTML = deptnam
//医生
var name = regJson.data.name
document.getElementById(‘name‘).innerHTML = name
} else {
alert(‘code错误‘);
}
} catch(e) {
console.log("获取数据错误" + e);
alert("获取数据错误" + e);
}
},
error: function(xhr, status, error) {
if(status == "error") {
alert(‘请尝试连接网络‘);
}
}
}) //ajax结束
} catch(e) {
alert("请检查网络连接");
}
}
})
//获取信息
$(‘.getdata‘).click(function() {
var webUrl = "https://tsch.fromfuture.cn:7714/GZ/dtdocsfconroom/getfollowuplist?guid=" + sickguid;
//guid = "AAA9E0A9B207581AE040007F010063F7";
try {
$.ajax({
url: webUrl,
type: ‘POST‘,
timeout: 8000,
success: function(result) {
result = result.trim();
result = result.replace(/\n/g, ‘‘);
try {
var regJson = JSON.parse(result);
console.log(result);
//console.log(regJson.data.TEMPERATURE);
if(regJson.code == 000) {
//体温
var TEMPERATURE = regJson.data.TEMPERATURE
document.getElementById(‘TEMPERATURE‘).value = TEMPERATURE
//心率
var HEARTRATE = regJson.data.HEARTRATE
document.getElementById(‘HEARTRATE‘).value = HEARTRATE
//血压低
var BLOODPRESSUREL = regJson.data.BLOODPRESSUREL
document.getElementById(‘BLOODPRESSUREL‘).value = BLOODPRESSUREL
//血压高
var BLOODPRESSUREH = regJson.data.BLOODPRESSUREH
document.getElementById(‘BLOODPRESSUREH‘).value = BLOODPRESSUREH
//体重
var WEIGHT = regJson.data.WEIGHT
document.getElementById(‘WEIGHT‘).value = WEIGHT
//血糖
var FOLLOWSTATE = regJson.data.FOLLOWSTATE
document.getElementById(‘FOLLOWSTATE‘).value = FOLLOWSTATE
//血氧
var BLOODOXYGEN = regJson.data.BLOODOXYGEN
document.getElementById(‘BLOODOXYGEN‘).value = BLOODOXYGEN
} else {
alert(‘code错误‘);
}
} catch(e) {
console.log("获取数据错误" + e);
alert("获取数据错误" + e);
}
},
error: function(xhr, status, error) {
if(status == "error")
alert(‘请尝试连接网络‘);
}
}) //ajax结束
} catch(e) {
alert("请检查网络连接");
}
})
//保存并且发送ajax请求
$(‘.send‘).click(function() {
//去页面上面的值
var tiwen = $(‘#TEMPERATURE‘).val();
var xinlv = $(‘#HEARTRATE‘).val();
var dixueya = $(‘#BLOODPRESSUREL‘).val();
var gaoxueya = $(‘#BLOODPRESSUREH‘).val();
var tizhong = $(‘#WEIGHT‘).val();
var xuetang = $(‘#FOLLOWSTATE‘).val();
var xueyang = $(‘#BLOODOXYGEN‘).val();
var suifang = $(‘#txt‘).val();
if(tiwen == ‘‘) {
layer.msg(‘体温不能为空!‘);
} else if(xinlv == ‘‘) {
layer.msg(‘心率不能为空!‘);
} else if(dixueya == ‘‘) {
layer.msg(‘血压不能为空!‘);
} else if(tizhong == ‘‘) {
layer.msg(‘体重不能为空!‘);
} else if(xuetang == ‘‘) {
layer.msg(‘血糖不能为空!‘);
} else if(xueyang == ‘‘) {
layer.msg(‘血氧不能为空!‘);
} else if(suifang == ‘‘) {
layer.msg(‘随访记录不能为空!‘);
} else if(gaoxueya = ‘‘) {
layer.msg(‘血压不能为空‘)
} else {
//guid = "AAA9E0A9B207581AE040007F010063F7";
//docguid = "AAA9E0A9B207581AE040007F010063F8";
temperature = $(‘#TEMPERATURE‘).val();
followstate = $(‘#FOLLOWSTATE‘).val();
bloodpressurel = $(‘#BLOODPRESSUREL‘).val();
weight = $(‘#WEIGHT‘).val();
heartrate = $(‘#HEARTRATE‘).val();
bloodpressureh = $(‘#BLOODPRESSUREH‘).val();
followconclusion = $(‘#txt‘).val();
// temperature = "24";
// followstate = "33";
// bloodpressurel = "98";
// weight = "797";
// bloodoxygen = "84";
// heartrate = "98";
// bloodpressureh = "9494";
// followconclusion = "没问题";
url = V_WEBBASE + sickguid;
url += "&docguid=" + G_APP_USRGUID;
url += "&temperature=" + temperature;
url += "&followstate=" + followstate;
url += "&bloodpressurel=" + bloodpressurel;
url += "&weight=" + weight;
url += "&bloodoxygen=" + bloodoxygen;
url += "&heartrate=" + heartrate;
url += "&bloodpressureh=" + bloodpressureh;
url += "&followconclusion=" + followconclusion;
try {
$.ajax({
url: url,
type: ‘POST‘,
timeout: 8000,
success: function(result) {
result = result.trim();
result = result.replace(/\n/g, ‘‘);
try {
var regJson = JSON.parse(result);
console.log(result);
//console.log(regJson.data.TEMPERATURE);
if(regJson.code == 001) {
//alert(‘保存成功‘);
layer.msg(‘保存成功‘);
//alert(url);
} else {
alert(‘code错误‘);
}
} catch(e) {
console.log("获取数据错误" + e);
alert("获取数据错误" + e);
}
},
error: function(xhr, status, error) {
if(status == "error")
alert(‘请尝试连接网络‘);
}
}) //ajax结束
} catch(e) {
alert("请检查网络连接");
}
}
})
$(‘.seed‘).click(function() {
window.open("../seedocrecord.html?sickguid=" + sickguid);
})
$(‘.visit‘).click(function() {
window.open("../visitrecord.html?sickguid=" + sickguid);
})