Browse Source

患者转归插件

19-plugin-turn-over
aBin 4 years ago
parent
commit
857e66ead5
  1. 115
      index.html
  2. 18
      route.js

115
index.html

@ -47,30 +47,44 @@
<!-- 示例插件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-root="p1419895701453938688" class="flex flex-row items-center" style="height:100%;width:100%;">
<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-root="p1419896010171490304" class="flex flex-row items-center" style="height:100%;width:100%;">
<div class="flex-1 title"></div>
<div class="flex flex-nowrap startBtn mr-2">
<button class="bg-green-500 text-xs rounded-full py-1 px-5 text-white" onclick="p1419895701453938688.chooseTime(this)">开始</button>
<button class="bg-blue-500 text-xs rounded-full py-1 px-5 text-white" onclick="p1419896010171490304.show()">选择</button>
</div>
<div class="flex flex-nowrap statusBtn mr-2 font-bold" style="display:none" onclick="p1419895701453938688.jumpDetails(this)">
<span class="mr-3 startTime">10:02</span>
<span class="text-red-500 disparity">+0min</span>
<div class="flex flex-nowrap statusBtn mr-2" style="display: none">
<button class="text-xs rounded-full py-1 px-5 text-white" style="background: #17C432" onclick="p1419896010171490304.show()"></button>
</div>
<div class="flex flex-nowrap statusChoose mr-2 bg-black bg-opacity-50" style="position:absolute;top:0;left:0;width:100%;height:100%;display:none">
<div class="flex flex-col bg-white" style="position:absolute;bottom:0;left:0;width:100%;">
<div class="flex flex-row justify-between px-5 py-4">
<span class="text-gray-400" onclick="p1419896010171490304.hide()">取消</span>
<span class="font-bold">选择</span>
<span class="text-blue-500" onclick="p1419896010171490304.choose()">确定</span>
</div>
<div class="bg-gray-200" style="width:100%;height: 1px"></div>
<ul class="flex flex-col text-center"></ul>
</div>
<div class="flex flex-row-reverse items-center" onclick="p1419895701453938688.jumpDetails(this)">
<img style="height:16px" src="https://www.tall.wiki/staticrec/photos/right.png">
</div>
</div>
</div>
<script>
const p1419895701453938688 = {
const p1419896010171490304 = {
token: '',
dom: '',
lists: [
{value: '住院',choose:true},
{value: '留院观察',choose:true},
{value: '院间转诊',choose:true},
{value: '回家',choose:true},
{value: '其他',choose:true}
],
init() {
this.dom = document.querySelector("div[data-root=p1419895701453938688]");
this.dom = document.querySelector("div[data-root=p1419896010171490304]");
var domBox = this.dom.parentNode;
var title = this.dom.querySelector('.title');
title.innerHTML = domBox.getAttribute('data-tname')
@ -135,50 +149,53 @@
const { dom } = this;
var startBtn = dom.querySelector('.startBtn');
var statusBtn = dom.querySelector('.statusBtn');
var startTime = dom.querySelector('.startTime');
var disparity = dom.querySelector('.disparity');
if(res.status === 0){
startBtn.style.display='block';
statusBtn.style.display='none';
}else if(res.status === 1){
startBtn.style.display='none';
statusBtn.style.display='block';
}else{
startBtn.style.display='none';
statusBtn.style.display='block';
var btn = statusBtn.querySelector('button');
btn.innerHTML = this.lists[res.status-1].value;
}
},
var ms = (+res.startTime) - (+res.planStartTime); //时间差的毫秒数
var morbidityTime = Math.ceil(ms/1000/60);
disparity.innerHTML = morbidityTime + "min"
startTime.innerHTML = this.setTime(res.startTime)
if(morbidityTime >= 0){
disparity.className="text-red-500 disparity"
}else{
disparity.className="text-green-500 disparity"
// 显示选择框
show(){
var statusChoose = this.dom.querySelector('.statusChoose');
statusChoose.style.display='block';
var list = ''
for (let i=0;i < this.lists.length; i++) {
list += `<li class="py-3" onclick="p1419896010171490304.chooseItem(${i})">` + this.lists[i].value + '</li>';
}
var ul = this.dom.querySelector('ul');
ul.innerHTML = list
},
// 转化时间格式
setTime(timestamp) {
let time = new Date(+timestamp)
let year = time.getFullYear()
const month = (time.getMonth() + 1).toString().padStart(2, '0')
const date = (time.getDate()).toString().padStart(2, '0')
const hours = (time.getHours()).toString().padStart(2, '0')
const minute = (time.getMinutes()).toString().padStart(2, '0')
const second = (time.getSeconds()).toString().padStart(2, '0')
return minute + ':' + second
// 选择
chooseItem(index){
var that = this;
var lis = this.dom.querySelectorAll('li');
for (var i = 0; i < lis.length; i++){
var item = lis[i];
if(i === index){
item.classList.add('text-white');
item.style.backgroundColor = '#17C432';
}else{
item.classList.remove('text-white');
item.style.backgroundColor = '#fff';
}
}
},
// 选择时间 添加
chooseTime(){
var that = this
// 确定
choose(){
const that = this;
const params = JSON.stringify({
param: {}
});
fetch('/chooseTime', {
var statusChoose = that.dom.querySelector('.statusChoose');
fetch('/choose', {
method: 'POST',
body: params,
headers: new Headers({
@ -191,22 +208,26 @@
}).then(function(res){
const { success, code, data, msg } = res;
if (success && code === 200) {
alert('添加成功')
that.setDate(data)
statusChoose.style.display='none';
} else {
alert(msg || '添加失败')
for (var i = 0; i < lis.length; i++){
var item = lis[i];
item.classList.remove('text-white');
item.style.backgroundColor = '#fff';
}
}
})
},
// 开始到场
jumpDetails(that) {
console.log(that.parentNode.getAttribute('data-tname'))
console.log(that.parentNode.getAttribute('data-pid'))
location.href = 'https://www.baidu.com'
}
// 取消
hide(){
var statusChoose = this.dom.querySelector('.statusChoose');
statusChoose.style.display='none';
},
}
p1419895701453938688.init()
p1419896010171490304.init()
</script>
</div>
</div>

18
route.js

@ -1,3 +1,11 @@
/*
* @Author: your name
* @Date: 2021-07-28 10:15:53
* @LastEditTime: 2021-07-28 11:37:12
* @LastEditors: Please set LastEditors
* @Description: In User Settings Edit
* @FilePath: \19-plugin-turn-over\route.js
*/
get('/blog').to.json({
code: 200,
msg: 'ok',
@ -11,21 +19,15 @@ post('/getDate').to.json({
msg: 'ok',
data: {
status: 0,
startTime: '1627396856605',
disparity: 0,
planStartTime: '1627360856000'
},
success: true
})
post('/chooseTime').to.json({
post('/choose').to.json({
code: 200,
msg: 'ok',
data: {
status: 1,
startTime: '1627360856000',
disparity: 0,
planStartTime: '1627396856605'
status: 3,
},
success: true
})

Loading…
Cancel
Save