Browse Source

患者转归接口

19-plugin-turn-over
aBin 4 years ago
parent
commit
ba87a13a33
  1. 91
      index.html

91
index.html

@ -47,7 +47,7 @@
<!-- 示例插件2 id=100-->
<button class="bg-blue-500 py-2 px-5 rounded text-white" onclick="p100.show()">测试组建2</button>
<div data-tname="患者转归" data-pid="1402932548627206144" data-uid="1323567842540523520" data-rid="rid333" data-tid="tid444" data-did="did555" style="height:50px;width:100%">
<div data-tname="患者转归" data-pid="1420652719055839232" data-uid="1217647686598135808" data-rid="rid333" data-tid="tid444" data-did="did555" style="height:50px;width:100%">
<!-- 患者转归插件 -->
<div data-root="p1419896010171490304" class="flex flex-row items-center" style="height:100%;width:100%;">
<div class="flex-1 title"></div>
@ -74,6 +74,7 @@
<script>
const p1419896010171490304 = {
token: '',
projectId: '',
dom: '',
lists: [
{value: '住院',choose:true},
@ -82,6 +83,7 @@
{value: '回家',choose:true},
{value: '其他',choose:true}
],
currentIndex: '',
init() {
this.dom = document.querySelector("div[data-root=p1419896010171490304]");
@ -92,6 +94,7 @@
console.log('初始化');
// 获取父元素携带的参数
var userId = domBox.getAttribute("data-uid");
this.projectId = domBox.getAttribute("data-pid");
// 初始化的时候 获取token
this.getTokenByUserId(userId);
},
@ -107,7 +110,7 @@
const { success, code, data, msg } = res;
if (success && code === 200) {
that.token = data.token;
// 查询当前项目的最新消息
// 批量查询患者急救记录
that.getFirstAidRecord()
} else {
alert(msg || '获取失败')
@ -116,15 +119,18 @@
},
/**
* 查询到场人员信息
* 批量查询患者急救记录
* @param {string} projectId 项目id
* @param {Array} codeList
*/
getFirstAidRecord() {
var that = this
var timer = null;
const params = JSON.stringify({
param: {}
param: { projectId: that.projectId, codeList: ['HZZG'] }
});
fetch('/getDate', {
var url = 'http://www.tall.wiki/gateway/qcp/v3.0/patient/queryAidRecord';
fetch(url, {
method: 'POST',
body: params,
headers: new Headers({
@ -137,29 +143,14 @@
}).then(function(res){
const { success, code, data, msg } = res;
if (success && code === 200) {
that.setDate(data)
console.log('data: ', data);
that.setDate(data.record.HZZG)
} else {
alert(msg || '查询失败')
}
})
},
// 界面渲染
setDate(res) {
const { dom } = this;
var startBtn = dom.querySelector('.startBtn');
var statusBtn = dom.querySelector('.statusBtn');
if(res.status === 0){
startBtn.style.display='block';
statusBtn.style.display='none';
}else{
startBtn.style.display='none';
statusBtn.style.display='block';
var btn = statusBtn.querySelector('button');
btn.innerHTML = this.lists[res.status-1].value;
}
},
// 显示选择框
show(){
var statusChoose = this.dom.querySelector('.statusChoose');
@ -174,7 +165,8 @@
// 选择
chooseItem(index){
var that = this;
this.answer = this.lists[index].value;
this.currentIndex = index;
var lis = this.dom.querySelectorAll('li');
for (var i = 0; i < lis.length; i++){
var item = lis[i];
@ -188,14 +180,27 @@
}
},
// 确定
/**
* 确定 批量提交急救信息
* @param { Array } codeAndAnswerList code和答案
* @param { String } projectId 项目ID
* @param { Number } codeAndAnswerList 提交人类型(0平车 1人)
*/
choose(){
const that = this;
const params = JSON.stringify({
param: {}
param: {
codeAndAnswerList: [
{
answer: that.answer,
questionCode: 'HZZG'
}
],
projectId: that.projectId,
userType: 0
}
});
var statusChoose = that.dom.querySelector('.statusChoose');
fetch('/choose', {
fetch('http://www.tall.wiki/gateway/qcp/v3.0/patient/aidRecord', {
method: 'POST',
body: params,
headers: new Headers({
@ -208,19 +213,35 @@
}).then(function(res){
const { success, code, data, msg } = res;
if (success && code === 200) {
that.setDate(data)
statusChoose.style.display='none';
that.setDate()
} else {
alert(msg || '添加失败')
for (var i = 0; i < lis.length; i++){
var item = lis[i];
item.classList.remove('text-white');
item.style.backgroundColor = '#fff';
}
// var lis = that.dom.querySelectorAll('li');
// for (var i = 0; i < lis.length; i++){
// var item = lis[i];
// item.classList.remove('text-white');
// item.style.backgroundColor = '#fff';
// }
}
that.hide()
})
},
// 界面渲染
setDate(res) {
const { dom } = this;
var startBtn = dom.querySelector('.startBtn');
var statusBtn = dom.querySelector('.statusBtn');
startBtn.style.display='none';
statusBtn.style.display='block';
var btn = statusBtn.querySelector('button');
if(!res){
btn.innerHTML = this.lists[this.currentIndex].value;
}else{
btn.innerHTML = res;
}
},
// 取消
hide(){
var statusChoose = this.dom.querySelector('.statusChoose');

Loading…
Cancel
Save