You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1418 lines
68 KiB
1418 lines
68 KiB
3 months ago
|
<!DOCTYPE html>
|
||
|
<html>
|
||
|
|
||
|
<head>
|
||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||
|
<title>HCEmrViewLib Demo</title>
|
||
|
<style>
|
||
|
.dateTimeLayer {
|
||
|
background: transparent !important;
|
||
|
|
||
|
}
|
||
|
.layui-layer-title {
|
||
|
font-weight: bolder;
|
||
|
height: 32px!important;
|
||
|
line-height: 32px!important;
|
||
|
}
|
||
|
</style>
|
||
|
<script type="text/javascript" src="./HCEmrViewLib.min.js?v=5"></script>
|
||
|
<script type="text/javascript" src="./WatEvent.js?v=22"></script>
|
||
|
<script src="./select/js/jquery_3.3.1.min.js"></script>
|
||
|
<script language="javascript" type="text/javascript" src="./layer/layer.js"></script>
|
||
|
<script type="text/javascript">
|
||
|
|
||
|
var TItemStyle = {
|
||
|
Null: -1,
|
||
|
Image: -2, // 图片
|
||
|
Table: -3, // 表格
|
||
|
Tab: -4, // TAB键
|
||
|
Line: -5, // 直线
|
||
|
Express: -6, // 公式
|
||
|
Vector: -7, // 矢量图
|
||
|
Domain: -8, // 域
|
||
|
PageBreak: -9, // 分页
|
||
|
CheckBox: -10, // 勾选框
|
||
|
Gif: -11, // GIF动画
|
||
|
Control: -12, // 控件
|
||
|
Edit: -13, // Edit 文本框
|
||
|
Combobox: -14, // Combobox 下拉弹出框
|
||
|
QRCode: -15, // 二维码
|
||
|
BarCode: -16, // 一维码
|
||
|
Fraction: -17, // 分数
|
||
|
DateTimePicker: -18, // 日期时间控件
|
||
|
RadioGroup: -19, // RadioGroup 单选、多选控件
|
||
|
SupSubScript: -20, // 同时上下标
|
||
|
Button: -21, // 按钮控件
|
||
|
FloatLine: -101, // 浮动直线
|
||
|
FloatBarCode: -102, // 浮动一维码
|
||
|
Custom: -1000
|
||
|
}
|
||
|
|
||
|
// 数据元属性
|
||
|
var TDeProp = {
|
||
|
Index: "Index", // 唯一索引
|
||
|
Code: "Code", // 编码
|
||
|
Name: "Name", // 名称
|
||
|
Frmtp: "Frmtp", // 类别,见TDeFrmtp枚举
|
||
|
Unit: "Unit", // 单位
|
||
|
HideUnit: "HdUnit", // 是否隐藏单位,比如血压的收缩压不显示单位
|
||
|
PreFormat: "PRFMT", // 表示格式
|
||
|
Raw: "Raw", // 原始数据
|
||
|
CMV: "CMV", // 受控词汇表(值域代码)
|
||
|
CMVVCode: "CMVVCode", // 受控词汇编码(值编码)
|
||
|
Trace: "Trace", // 痕迹信息
|
||
|
/** * 删除痕迹信息 */
|
||
|
TraceDel: "TcDel",
|
||
|
/** * 添加痕迹信息 */
|
||
|
TraceAdd: "TcAdd",
|
||
|
/** * 删除痕迹的级别 */
|
||
|
TraceDelLevel: "TcDelL",
|
||
|
/** * 添加痕迹的级别 */
|
||
|
TraceAddLevel: "TcAddL",
|
||
|
Secret: "Secret", // 是否属于隐私信息
|
||
|
ItemEditValue: "EdtVal" // 选项值直接编辑,不通过弹出框处理
|
||
|
}
|
||
|
|
||
|
// 数据元类型
|
||
|
var TDeFrmtp = {
|
||
|
Radio: "RS", // 单选
|
||
|
Multiselect: "MS", // 多选
|
||
|
Number: "N", // 数值
|
||
|
String: "S", // 文本
|
||
|
Date: "D", // 日期
|
||
|
Time: "T", // 时间
|
||
|
DateTime: "DT" // 日期和时间
|
||
|
}
|
||
|
// 痕迹级别
|
||
|
var TDeTraceLevel = {
|
||
|
/** * 无医师级别 */
|
||
|
None: "",
|
||
|
/** * 住院医师 */
|
||
|
One: "1",
|
||
|
/** * 主治医师 */
|
||
|
Two: "2",
|
||
|
/** * 主任医师 */
|
||
|
Three: "3"
|
||
|
}
|
||
|
// 痕迹样式
|
||
|
var TDeTraceStyle = {
|
||
|
None: 0, // 无
|
||
|
Del: 1, // 删除
|
||
|
Add: 2 // 添加
|
||
|
}
|
||
|
|
||
|
|
||
|
var TGroupProp = {
|
||
|
Index: "Index",
|
||
|
Name: "Name",
|
||
|
Code: "Code",
|
||
|
SubType: "RT",
|
||
|
Propertys: "Propertys"
|
||
|
}
|
||
|
var EmrProp = {//电子病历属性
|
||
|
EmrId:"emrId",//电子病历的id.
|
||
|
EmrName:"name",//电子病历名称。
|
||
|
OPERATORSIGN:"operatorsign",//签字状态:经治医师签字 0,未签字 1签字确认, 2接收审签,3,审签退回
|
||
|
DIRECTORSIGN:"directorsign",//主治医师签名
|
||
|
LEADERSIGN:"leadersign",//主任医师签名
|
||
|
OPERATOR:"operator",//经治医师
|
||
|
DIRECTOR:"director",//主治医师
|
||
|
LEADER:"leader",//主任医师
|
||
|
Choscode:"choscode",//医院编码
|
||
|
QCR:"qcr",//创建病历人
|
||
|
OPERATORTIME:"operatortime",//书写时间
|
||
|
EmrProcessId:"emrProcessId",//病程id
|
||
|
EmrProcessContent:"emrProcessContent",//病程内容
|
||
|
EmrContent:"emrContent",//病历内容
|
||
|
EmrDiagnose:"DE05.01.024.00",//诊断数据组
|
||
|
EmrSignature:"DE02.01.039.00",//签名数据组
|
||
|
EditorType:"_editortype",//当前书写是护士还医生
|
||
|
|
||
|
}
|
||
|
var EmrEditor={//病历操作人属性,非序列化属性。
|
||
|
USER:"_user",//当前操作用户。
|
||
|
OPERATOR:"_operator",//经治医师
|
||
|
DIRECTOR:"_director",//主治医师
|
||
|
LEADER:"_leader",//主任医师
|
||
|
QCR:"_qcr",//起草人,病历新建人
|
||
|
USERNAME:"_username"//当前用户的姓名
|
||
|
}
|
||
|
|
||
|
var emrView;
|
||
|
|
||
|
function appendLine(s) {
|
||
|
var textArea = document.getElementById("textBox");
|
||
|
if (textArea)
|
||
|
textArea.value += "\r\n" + s;
|
||
|
}
|
||
|
|
||
|
function getBase64ByUrl (data,src, callback, outputFormat) {
|
||
|
var xhr = new XMLHttpRequest();
|
||
|
xhr.open("GET", src, true);
|
||
|
|
||
|
xhr.responseType = "arraybuffer";
|
||
|
|
||
|
xhr.onload = function(e) {
|
||
|
if (xhr.status == 200) {
|
||
|
var uInt8Array = new Uint8Array(xhr.response);
|
||
|
var i = uInt8Array.length;
|
||
|
var binaryString = new Array(i);
|
||
|
while (i--)
|
||
|
binaryString[i] = String.fromCharCode(uInt8Array[i]);
|
||
|
|
||
|
var data = binaryString.join('');
|
||
|
var base64 = window.btoa(data);
|
||
|
var dataUrl = "data:" + (outputFormat || "image/png") + ";base64," + base64;
|
||
|
callback.call(this, dataUrl);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
xhr.send(JSON.stringify(data));
|
||
|
}
|
||
|
|
||
|
function getFileAsBytes(src, callback) {
|
||
|
var xhr = new XMLHttpRequest();
|
||
|
xhr.open("GET", src, true);
|
||
|
xhr.responseType = "arraybuffer";
|
||
|
xhr.onload = function(e) {
|
||
|
if (xhr.status == 200) {
|
||
|
var vBytes = new Uint8Array(xhr.response);
|
||
|
callback.call(this, vBytes);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
xhr.send();
|
||
|
}
|
||
|
|
||
|
function load() {
|
||
|
emrView = new THCEmrViewLib({
|
||
|
debug: false,
|
||
|
// hcServer: "http://139.9.152.193:12880/", // HC服务端IP
|
||
|
//hcServer: "http://192.168.1.122:12880/",
|
||
|
//hcServer: "http://192.168.5.104:12880/",
|
||
|
//hcServer: "http://192.168.20.100:12880/",
|
||
|
hcServer: "http://127.0.0.1:12880/",
|
||
|
//hcServer: "http://192.168.20.100:12880/", // HC服务端IP
|
||
|
baseUrl: "./", // 编辑器需要的资源路径
|
||
|
el: "divHCEmrView", // 编辑器父容器的ID
|
||
|
defaultFontSize: "小四", // 编辑器默认字号,默认小四
|
||
|
defaultFontFamily: "宋体", // 编辑器默认字体,默认宋体
|
||
|
paperSize: "A4", // 纸张大小
|
||
|
paperOrientation: 0, // 纸张方向 0纵向 1横向,默认0
|
||
|
designMode: false, // 是否设计模式,也可以使用emrView.designMode = true;
|
||
|
multItemEditValue: true, // 多选数据元选项上屏后,再次点击直接编辑内容,使用右键菜单重新选择
|
||
|
//deUnDoneColor: "#FF8C00", // 没选过选项或没写过内容时数据元背景色
|
||
|
//deDoneColor: "#AFEEEE", // 填写或选择过选项的数据元背景色
|
||
|
//deHotColor: "#87CEFA", // 鼠标移动上去时的颜色
|
||
|
traceInfoAnnotate: true, // 痕迹以批注形式显示
|
||
|
useScript: false, // 开启解析执行脚本(对运行效率有影响)
|
||
|
// 工具条
|
||
|
toolBar: {
|
||
|
visible: true, // 是否整体显示顶部工具条,也可以使用emrView.toolBar.visible = false;
|
||
|
//height: 35, // 设置工具栏高度
|
||
|
// 文件按钮
|
||
|
btnFile: {
|
||
|
visible: 1
|
||
|
},
|
||
|
|
||
|
// 打印按钮
|
||
|
btnPrint: {
|
||
|
visible: true,
|
||
|
},
|
||
|
|
||
|
// 外部自定义按钮
|
||
|
btnCustoms: [
|
||
|
{
|
||
|
text: "替换",
|
||
|
image:"./images/emr/findreplace.gif",
|
||
|
exec: function() {
|
||
|
emrView.ShowSearch();
|
||
|
}
|
||
|
},{
|
||
|
text:"导出",
|
||
|
textVisible:true,
|
||
|
// exec: function() { emrView.ExportPDF(); },
|
||
|
menu:[
|
||
|
{
|
||
|
text: "导出为pdf",
|
||
|
exec: function() {
|
||
|
emrView.ExportPDF();
|
||
|
},
|
||
|
},
|
||
|
// {
|
||
|
// text: "导出为xml",
|
||
|
// exec: function() {
|
||
|
// emrView.ExportXML();
|
||
|
// },
|
||
|
// },
|
||
|
]
|
||
|
|
||
|
}
|
||
|
]
|
||
|
},
|
||
|
|
||
|
// 右键菜单中添加自定义菜单
|
||
|
contextMenu: [
|
||
|
|
||
|
],
|
||
|
|
||
|
// 事件
|
||
|
event: {
|
||
|
// 编辑器状态变化时触发:从未修改状态变为修改状态,或从修改状态变为未修改状态,
|
||
|
onChangedSwitch: function() {
|
||
|
if (emrView.IsChanged)
|
||
|
console.log("onChangedSwitch 文档状态变为修改");
|
||
|
else
|
||
|
console.log("onChangedSwitch 文档状态变为未修改");
|
||
|
},
|
||
|
|
||
|
onCaretItemChanged: function() {
|
||
|
|
||
|
},
|
||
|
|
||
|
// 点击了编辑器工具栏上的保存按钮时触发
|
||
|
onSave: function() {
|
||
|
console.log("onSave 事件触发");
|
||
|
var waitInfo = emrView.WaitMessage("正在保存病历数据...", function() { // 创建一个等待提示
|
||
|
try {
|
||
|
setTraceInfo();//这个必须写在上面
|
||
|
feedbackEmrStreamToWat();
|
||
|
|
||
|
} finally {
|
||
|
emrView.EndWaitMessage(waitInfo); // 关闭等待提示
|
||
|
}
|
||
|
});
|
||
|
},
|
||
|
|
||
|
// 鼠标点击数据元触发,如果数据元的信息有变化,可以这里重新赋值
|
||
|
onPopupGetDeItemInfo: function(item) {
|
||
|
//console.log("onPopupGetDeItemInfo 点击数据元触发 参数:{" + item.ToJSONString() + "}");
|
||
|
//var data = new EmrToWatData("S","EMR004","{"+item.ToJSONString()+"}");
|
||
|
//return watEvents.getDeItemDomain(data,watEvents.url);
|
||
|
},
|
||
|
|
||
|
// 单选或多选数据元获鼠标点击后,显示选项时触发,可在这里把选项传递到编辑器中
|
||
|
onPopupGetDeItemDomain: function(cmv) {
|
||
|
console.log("onPopupGetDeItemDomain 选项类数据元点击时请求选项 参:" + cmv);
|
||
|
var data = new EmrToWatData("S","EMR004",cmv);//编辑器初始化完成
|
||
|
var vs = watEvents.getDeItemDomain(data,watEvents.url);
|
||
|
//var vs = '{"cv": [{"value": "皮疹", "code": "1", "id": 689, "py": "PZ", "content": ""},'
|
||
|
// + '{"value": "皮下出血", "code": "2", "id": 690, "py": "PZCX", "content": ""}'
|
||
|
// + ']}';
|
||
|
|
||
|
return vs;
|
||
|
|
||
|
|
||
|
},
|
||
|
|
||
|
// 数据元选项有扩展内容时,获取扩展内容
|
||
|
onPopupGetDomainItemExtraLib: function(item, cvvid) {
|
||
|
// if (item.Index == 495) { // 性别
|
||
|
// if (cvvid == 3683) { // 选择了带内容的
|
||
|
// emrView.SetActiveItemExtraWithJSON({
|
||
|
|
||
|
// });
|
||
|
// }
|
||
|
// }
|
||
|
var data = new EmrToWatData("S","getLiteByte",item.Index);//编辑器初始化完成
|
||
|
watEvents.getLiteByte(data,watEvents.url);
|
||
|
},
|
||
|
|
||
|
// 当编辑器在加载文档或插入了新的Item时触发,便于外部替换数据元的值
|
||
|
onInserItemSync: function(sender, data, item) {
|
||
|
//debugger;
|
||
|
console.log(item.Code+","+item.StyleNo,+","+item.Index);
|
||
|
if(item.Index!=""){
|
||
|
var hcdata =watEvents.getHcData();
|
||
|
for(prop in hcdata){
|
||
|
if(undefined!=item.Code&&""!=item.Code){
|
||
|
if(item.Code.toUpperCase()==prop){
|
||
|
if(item.GetValue(TDeProp.HideUnit)){
|
||
|
item.Text = hcdata[prop] ;
|
||
|
}else{
|
||
|
item.Text = hcdata[prop] +item.GetValue(TDeProp.Unit);
|
||
|
}
|
||
|
|
||
|
item.AllocValue = true; // 该元素填写过值了
|
||
|
}
|
||
|
}
|
||
|
|
||
|
}
|
||
|
var proceData = watEvents.getProceData();
|
||
|
for(prop in proceData){
|
||
|
if(item.Code==prop){
|
||
|
item.Text = proceData[prop];
|
||
|
item.AllocValue = true; // 该元素填写过值了
|
||
|
}
|
||
|
}
|
||
|
var eventData = watEvents.getEventData();
|
||
|
for(prop in eventData){
|
||
|
if(item.Index==prop){
|
||
|
item.Text = eventData[prop];
|
||
|
item.AllocValue = true; // 该元素填写过值了
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
},
|
||
|
//控制菜单显示
|
||
|
onViewMenuPopup: function(menus) {
|
||
|
for (var i = 0; i < menus.count; i++) {
|
||
|
// if (menus[i].tag == 1) { //
|
||
|
var selectItem = emrView.GetActiveItem();
|
||
|
var curUser = emrView._EmrEditor[EmrEditor.USER];//当前用户
|
||
|
if(""==emrView.CaretProcInfo.Index){//病历
|
||
|
if(menus[i].text == "插入病程"){
|
||
|
menus[i].visible=false;
|
||
|
}else if(menus[i].text == "删除病程"){
|
||
|
menus[i].visible=false;
|
||
|
}
|
||
|
var operatorsign = emrView._Emr[EmrProp.OPERATORSIGN];
|
||
|
|
||
|
|
||
|
if("1"==operatorsign){
|
||
|
if(selectItem.Index.length==32||selectItem.Index=='sign_'+curUser){
|
||
|
if(menus[i].text == "取消签名"){
|
||
|
menus[i].visible=true;
|
||
|
}
|
||
|
}else{
|
||
|
if(menus[i].text == "取消签名"){
|
||
|
menus[i].visible=false;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
if(menus[i].text == "复制引用"){
|
||
|
menus[i].visible=false;
|
||
|
}
|
||
|
else if(menus[i].text == "医学公式"){
|
||
|
menus[i].visible=false;
|
||
|
}
|
||
|
else if(menus[i].text == "申请编辑"){
|
||
|
menus[i].visible=true;
|
||
|
}
|
||
|
|
||
|
}else{
|
||
|
if(menus[i].text == "取消签名"){
|
||
|
menus[i].visible=false;
|
||
|
}
|
||
|
else if(menus[i].text == "复制引用"){
|
||
|
menus[i].visible=true;
|
||
|
}
|
||
|
else if(menus[i].text == "医学公式"){
|
||
|
menus[i].visible=true;
|
||
|
}
|
||
|
else if(menus[i].text == "申请编辑"){
|
||
|
menus[i].visible=false;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
}else{
|
||
|
if(menus[i].text == "插入病程"){
|
||
|
menus[i].visible=true;
|
||
|
}else if(menus[i].text == "删除病程"){
|
||
|
menus[i].visible=true;
|
||
|
}
|
||
|
var operatorsign = emrView.GetProcProperty(emrView.CaretProcInfo.Index, EmrProp.OPERATORSIGN);
|
||
|
var qcr = emrView.GetProcProperty(emrView.CaretProcInfo.Index, EmrProp.QCR);
|
||
|
if("1"==operatorsign){
|
||
|
let index = selectItem.Index;
|
||
|
let nameId = index.split("sign_")[1];
|
||
|
if(index.length==32||nameId==curUser||curUser==qcr){
|
||
|
if(menus[i].text == "取消签名"){
|
||
|
menus[i].visible=true;
|
||
|
}
|
||
|
}else{
|
||
|
if(menus[i].text == "取消签名"){
|
||
|
menus[i].visible=false;
|
||
|
}
|
||
|
}
|
||
|
if(menus[i].text == "复制引用"){
|
||
|
menus[i].visible=false;
|
||
|
}
|
||
|
else if(menus[i].text == "医学公式"){
|
||
|
menus[i].visible=false;
|
||
|
}
|
||
|
else if(menus[i].text == "申请编辑"){
|
||
|
menus[i].visible=true;
|
||
|
}
|
||
|
}else{
|
||
|
if(menus[i].text == "取消签名"){
|
||
|
menus[i].visible=false;
|
||
|
}
|
||
|
else if(menus[i].text == "复制引用"){
|
||
|
menus[i].visible=true;
|
||
|
}
|
||
|
else if(menus[i].text == "医学公式"){
|
||
|
menus[i].visible=true;
|
||
|
}
|
||
|
else if(menus[i].text == "申请编辑"){
|
||
|
menus[i].visible=false;
|
||
|
}
|
||
|
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
if(menus[i].text == "另存为子模板"){
|
||
|
menus[i].visible=true;
|
||
|
}
|
||
|
else if(menus[i].text == "日期时间"){
|
||
|
menus[i].visible=true;
|
||
|
}
|
||
|
|
||
|
else if(menus[i].text == "+存为示范词句"){
|
||
|
menus[i].visible=true;
|
||
|
}
|
||
|
else if(menus[i].text == "批注"){
|
||
|
menus[i].visible=true;
|
||
|
}
|
||
|
else if(menus[i].text == "签名组"){
|
||
|
menus[i].visible=true;
|
||
|
}
|
||
|
|
||
|
// }
|
||
|
}
|
||
|
},
|
||
|
// 当编辑器中的Combobox控件点击了下拉按钮,显示选项时触发
|
||
|
onDeComboboxPopup: function(cmbxItem) {
|
||
|
if (cmbxItem.Index == 495) { // 是性别
|
||
|
if (!cmbxItem.SaveItem) { // combobox自己没有保存选项
|
||
|
if (cmbxItem.Items.count > 0)
|
||
|
cmbxItem.Clear();
|
||
|
|
||
|
cmbxItem.AddItem("男", "1");
|
||
|
cmbxItem.AddItem("女", "2");
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
|
||
|
// 判断当前情况下是否能编辑,此事件在引起内容变化的时候触发,较频繁,所以不要写复杂的业务
|
||
|
onCanEdit: function(data) {
|
||
|
if (emrView.EditProcIndex != "") // 当前指定了要编辑的病程
|
||
|
return emrView.CaretProcInfo.Index == emrView.EditProcIndex; // 光标所在病程和当前允许编辑的病程Index相同
|
||
|
else
|
||
|
return true;
|
||
|
},
|
||
|
|
||
|
// 数据元右键菜单中的 更新引用 点击后触发的事件
|
||
|
onDeItemGetSyncValue: function(item) {
|
||
|
if (item.Index == "494") // 姓名
|
||
|
return "李四福";
|
||
|
},
|
||
|
onPrintProcess: function(printType, printFun) {
|
||
|
printFun();
|
||
|
},
|
||
|
|
||
|
// 点了打印并在浏览器里显示了要打印的文件
|
||
|
onPrinted: function(type) {
|
||
|
// type 0打印全部或1-n页,1按行续打,2选中范围续打
|
||
|
console.log(type == 0 ? "打印" : "续打");
|
||
|
//打印之前进行内容质控。
|
||
|
print(type);
|
||
|
|
||
|
|
||
|
},
|
||
|
onInitialization: function(){
|
||
|
console.log("初始化完成");
|
||
|
var jsonData = new EmrToWatData("S","EMR001","emr001");//编辑器初始化完成
|
||
|
feedbackDataToWat(JSON.stringify(jsonData));
|
||
|
|
||
|
},
|
||
|
onSetDeItemText: function(item, text) {//
|
||
|
var vT = text.replace(new RegExp(item.GetValue(TDeProp.Unit), "g"), ""); // 体温值去掉单位
|
||
|
var vN = parseFloat(vT);
|
||
|
var max = parseFloat(item.GetValue('Max'));
|
||
|
var min = parseFloat(item.GetValue('Min'));
|
||
|
item.OutOfRang = (vN < min || vN > max);
|
||
|
},
|
||
|
//鼠标放在控件上事件
|
||
|
//onMouseUp: function(e, item){
|
||
|
//console.log("鼠标放在控件上事件:"+item.Code);
|
||
|
//if (emrView.HCL.keyDownStates[17] && (item.HyperLink != "")){ // ctrl键按下,链接不为空
|
||
|
//window.open(item.HyperLink); // 跳转到链接
|
||
|
//}
|
||
|
//},
|
||
|
// 编辑器中插入了新的Item时触发,也可创建后赋值emrView.OnInserItemSync
|
||
|
onSectionInsertItem: function(section, data, item) {
|
||
|
if (item.StyleNo == TItemStyle.RadioGroup)
|
||
|
item.OnSetItemChecked = function(radiogroup) {
|
||
|
//console.log("radiogroup 有选项勾选状态变化");
|
||
|
let viewData = emrView.InnerView.ActiveSectionTopLevelData();
|
||
|
if (viewData) {
|
||
|
//if (viewData.Script != "")
|
||
|
{
|
||
|
let vItemNo = viewData.GetItemNo(radiogroup);
|
||
|
//vFn = new Function("view", "data", "itemNo", "action", viewData.Script);
|
||
|
vFn = new Function("view", "data", "itemNo", "action",
|
||
|
"if (action == 0) { " +
|
||
|
"let vDomainInfo = data.GetItemDomain(itemNo);" +
|
||
|
"let curDeGroupIndex = data.Items[vDomainInfo.beginNo].Index;"+
|
||
|
"for (let i = vDomainInfo.beginNo + 1; i < vDomainInfo.endNo; i++) {" +
|
||
|
"if (data.Items[i].StyleNo == -19 &&i != itemNo && !data.Items[i].MultSelect ){" + // -19可根据脚本运行环境决定是否替换为THCStyle.RadioGroup或TItemStyle.RadioGroup
|
||
|
|
||
|
"let vDomainInfoTemp = data.GetItemDomain(i);" +
|
||
|
"if (vDomainInfoTemp.beginNo >= 0 && data.Items[vDomainInfoTemp.beginNo].Index == curDeGroupIndex ) {" +
|
||
|
"data.Items[i].SetAllChecked(false);" +
|
||
|
"}"+
|
||
|
"}" +
|
||
|
"}" +
|
||
|
"}"
|
||
|
);
|
||
|
try {
|
||
|
vFn(emrView, viewData, vItemNo, 0);
|
||
|
} catch (e) {
|
||
|
console.log(e.message); // 显示脚本错误信息
|
||
|
}
|
||
|
|
||
|
vFn = null;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
|
||
|
// 编辑器双击事件
|
||
|
onDblClick: function() {
|
||
|
var deGroupCode = emrView.GetCaretDeGroupProperty(TDeProp.Code);
|
||
|
var deGroupIndex = emrView.GetCaretDeGroupProperty(TDeProp.Index);
|
||
|
var propertys = emrView.GetCaretDeGroupProperty("Propertys","json");//json对象
|
||
|
console.log(propertys.isSave);
|
||
|
if (deGroupCode == EmrProp.EmrDiagnose){//诊断
|
||
|
console.log("编辑器双击事件onDblClick 光标处数据组:" + deGroupCode);
|
||
|
var param={
|
||
|
selectId:deGroupIndex//被选中的数据组id
|
||
|
};
|
||
|
var jsonData = new EmrToWatData("S","diagnosis",param);
|
||
|
watEvents.emrToWatEvent(jsonData);
|
||
|
|
||
|
|
||
|
}else if(deGroupCode == EmrProp.EmrSignature) {//医生签名
|
||
|
console.log("医生签名");
|
||
|
var curUser = emrView._EmrEditor[EmrEditor.USER];//当前用户
|
||
|
var operator = emrView. _EmrEditor[EmrEditor.OPERATOR];
|
||
|
var director = emrView. _EmrEditor[EmrEditor.DIRECTOR];
|
||
|
var leader = emrView. _EmrEditor[EmrEditor.LEADER];
|
||
|
if(""!=emrView.CaretProcInfo.Index){//病程
|
||
|
//右键直接签名,
|
||
|
console.log("当前病程id:"+emrView.CaretProcInfo.Index);
|
||
|
console.log("获得病程属性:"+emrView.GetProcProperty(emrView.CaretProcInfo.Index,"Propertys"));
|
||
|
var qcr=emrView.GetProcProperty(emrView.CaretProcInfo.Index, EmrProp.QCR);
|
||
|
var choscode=emrView.GetProcProperty(emrView.CaretProcInfo.Index, EmrProp.Choscode);
|
||
|
var operatorsign = emrView.GetProcProperty(emrView.CaretProcInfo.Index, EmrProp.OPERATORSIGN);
|
||
|
//emrView.SetProcProperty(emrView.CaretProcInfo.Index, EmrProp.OPERATORSIGN, "0");//容错用
|
||
|
if((qcr==curUser||curUser==operator)){//有权限的医生才能签名
|
||
|
if("1"!=operatorsign){//未签名
|
||
|
var param={
|
||
|
emrId:emrView.CaretProcInfo.Index,
|
||
|
operator:curUser,
|
||
|
choscode:choscode
|
||
|
};
|
||
|
var data = new EmrToWatData("JSON","setSignatureGraphic",param);
|
||
|
watEvents.getOperatorSignPic(data,watEvents.url);
|
||
|
}
|
||
|
}else{
|
||
|
alert("当前用户没有权限签名!");
|
||
|
}
|
||
|
}else{//病历
|
||
|
var operator = emrView. _EmrEditor[EmrEditor.OPERATOR];
|
||
|
var director = emrView. _EmrEditor[EmrEditor.DIRECTOR];
|
||
|
var leader = emrView. _EmrEditor[EmrEditor.LEADER];
|
||
|
var operatorsign = emrView._Emr[EmrProp.OPERATORSIGN];
|
||
|
var directorsign = emrView._Emr[EmrProp.DIRECTORSIGN];
|
||
|
var leadersign = emrView._Emr[EmrProp.LEADERSIGN];
|
||
|
var qcr = emrView.InnerView.GetValue(EmrProp.QCR);
|
||
|
var choscode = emrView.InnerView.GetValue(EmrProp.Choscode);
|
||
|
if((qcr==curUser||curUser==operator)){//有权限的医生才能签名
|
||
|
if("1"!=operatorsign){//经治医师未签名
|
||
|
var data = new EmrToWatData("JSON","setSignatureGraphic",param);
|
||
|
watEvents.getOperatorSignPic(data,watEvents.url);
|
||
|
}else{
|
||
|
alert("当前病历已签名!");
|
||
|
}
|
||
|
}else{
|
||
|
alert("当前用户没有权限签名!");
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
|
||
|
}else{//双击数据组
|
||
|
/*
|
||
|
var param={
|
||
|
Pcode:emrView.GetCaretDeGroupProperty("Pcode")//被选中的数据组Pcode
|
||
|
};
|
||
|
var jsonData = new EmrToWatData("S","selectDeGroup",param);
|
||
|
watEvents.emrToWatEvent(jsonData);
|
||
|
*/
|
||
|
var deGroupInfo = emrView.GetCaretDeGroupProperty(TDeProp.Index);
|
||
|
if (deGroupInfo != "") {
|
||
|
var propertys = emrView.GetCaretDeGroupProperty("Propertys","json");//json对象
|
||
|
var data = new EmrToWatData("S","DeGroupInfo",propertys);
|
||
|
watEvents.emrToWatEvent(data);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
}
|
||
|
});
|
||
|
|
||
|
//打印方法
|
||
|
function print(type){
|
||
|
if(emrView.ProcCount>0){//如果是病程的话。
|
||
|
if(type == 0){
|
||
|
var emrProcIds = emrView.InnerView.GetAllProcIndex();
|
||
|
var jsonData = new EmrToWatData("S","print",emrProcIds);
|
||
|
watEvents.emrToWatEvent(jsonData);
|
||
|
}
|
||
|
}else{//如果是病历
|
||
|
if(type == 0){//
|
||
|
var emrId = emrView.InnerView.GetValue(EmrProp.EmrId);
|
||
|
if(emrId!==null&&undefined!=emrId){
|
||
|
var emrIds= new Array();
|
||
|
emrIds.push(emrId);
|
||
|
var jsonData = new EmrToWatData("S","print",emrIds);
|
||
|
watEvents.emrToWatEvent(jsonData);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
// 向工具栏中添加按钮
|
||
|
// emrView.AddToolButton(
|
||
|
// [
|
||
|
// {
|
||
|
// text: "自定义",
|
||
|
// exec: function() {
|
||
|
// alert("点击了自定义按钮2");
|
||
|
// }
|
||
|
// }
|
||
|
// ]
|
||
|
// );
|
||
|
|
||
|
// 向编辑器的右键菜单中添加菜单
|
||
|
emrView.AddContextMenu(
|
||
|
[
|
||
|
{
|
||
|
text: "取消签名",
|
||
|
exec: function() {
|
||
|
|
||
|
console.log("当前病程id:"+emrView.CaretProcInfo.Index);
|
||
|
console.log("当前操作员"+emrView._EmrEditor[EmrEditor.USER]);
|
||
|
var curUser = emrView. _EmrEditor[EmrEditor.USER];//当前用户
|
||
|
var operator = emrView. _EmrEditor[EmrEditor.OPERATOR];
|
||
|
var director = emrView. _EmrEditor[EmrEditor.DIRECTOR];
|
||
|
var leader = emrView. _EmrEditor[EmrEditor.LEADER];
|
||
|
|
||
|
if("" != emrView.CaretProcInfo.Index){//病程
|
||
|
emrView.EditProcIndex=emrView.CaretProcInfo.Index;
|
||
|
var qm=emrView.GetProcProperty(emrView.CaretProcInfo.Index, EmrProp.OPERATOR);
|
||
|
var choscode=emrView.GetProcProperty(emrView.CaretProcInfo.Index, EmrProp.Choscode);
|
||
|
var operatorsign = emrView.GetProcProperty(emrView.CaretProcInfo.Index, EmrProp.OPERATORSIGN);
|
||
|
var qcr = emrView.GetProcProperty(emrView.CaretProcInfo.Index, EmrProp.QCR);
|
||
|
if("1"==operatorsign&&(operator==curUser||qcr==curUser)){//签名
|
||
|
console.log("取消签名:");
|
||
|
console.log("当前光标处的病程id:"+emrView.CaretProcInfo.Index);
|
||
|
var param={
|
||
|
emrId:emrView.CaretProcInfo.Index,
|
||
|
operator:curUser,
|
||
|
choscode:choscode,
|
||
|
};
|
||
|
emrView.ReadOnly=false;
|
||
|
emrView.EditProcIndex = emrView.CaretProcInfo.Index;
|
||
|
emrView.DeleteActiveItem();
|
||
|
var data = new EmrToWatData("JSON","cancelSignatureGraphic",param);
|
||
|
watEvents.emrToWatEvent(data);
|
||
|
|
||
|
}
|
||
|
|
||
|
}else{
|
||
|
var qcr = emrView. _EmrEditor[EmrEditor.QCR];
|
||
|
console.log("经治医师签名:"+emrView._Emr[EmrProp.OPERATORSIGN]);
|
||
|
var operatorsign = emrView._Emr[EmrProp.OPERATORSIGN];
|
||
|
if((qcr==curUser||curUser==operator)){//有权限的医生才能签名
|
||
|
if("1"==operatorsign){//
|
||
|
console.log("病历取消签名:");
|
||
|
var param={
|
||
|
emrId: emrView.InnerView.GetValue(EmrProp.EmrId),//病历附加属性[病历id]
|
||
|
operator:curUser,
|
||
|
choscode:emrView.InnerView.GetValue(EmrProp.Choscode),
|
||
|
};
|
||
|
var data = new EmrToWatData("JSON","cancelSignatureGraphic",param);
|
||
|
watEvents.emrToWatEvent(data);
|
||
|
emrView.ReadOnly=false;
|
||
|
emrView.DeleteActiveItem();
|
||
|
}
|
||
|
}else{
|
||
|
alert("当前用户没有权限[取消签名]!");
|
||
|
}
|
||
|
|
||
|
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
text:"插入病程",
|
||
|
exec: function() {
|
||
|
console.log("插入病程");
|
||
|
},
|
||
|
// 子菜单
|
||
|
subMenu: [
|
||
|
{
|
||
|
index: "2-1",
|
||
|
text: "在文档末",
|
||
|
exec: function() {
|
||
|
var emrProcessId = emrView.CaretProcInfo.Index;
|
||
|
insertProcToWat("");
|
||
|
},
|
||
|
},
|
||
|
|
||
|
{
|
||
|
text: "当前病程前",
|
||
|
exec: function() {
|
||
|
var emrProcessId = emrView.CaretProcInfo.Index;
|
||
|
insertProcToWat(emrProcessId);
|
||
|
},
|
||
|
}
|
||
|
]
|
||
|
},
|
||
|
|
||
|
|
||
|
{
|
||
|
text:"另存为子模板",
|
||
|
exec: function() {
|
||
|
console.log("另存为子模板");
|
||
|
saveChildTemplet();
|
||
|
},
|
||
|
},
|
||
|
{
|
||
|
text:"删除病程",
|
||
|
exec: function(){
|
||
|
emrView.EditProcIndex = emrView.CaretProcInfo.Index;
|
||
|
var curUser = emrView._EmrEditor[EmrEditor.USER];//当前用户
|
||
|
var operatorsign = emrView.GetProcProperty(emrView.EditProcIndex, EmrProp.OPERATORSIGN);
|
||
|
var qcr = emrView.GetProcProperty(emrView.EditProcIndex, EmrProp.QCR);
|
||
|
if("1"==operatorsign){
|
||
|
alert("当前病程记录已经签名,请取消签名后删除!");
|
||
|
return;
|
||
|
}
|
||
|
//if(qcr != curUser){
|
||
|
// alert("当前用户没有权限删除该病程记录!");
|
||
|
//return;
|
||
|
//}
|
||
|
let con = confirm("确认要删除当选病程?删除后将无法恢复!");
|
||
|
if(con==false){
|
||
|
return;
|
||
|
}
|
||
|
console.log("删除病程");
|
||
|
console.log("当前编辑位置:"+emrView.EditProcIndex);
|
||
|
console.log("当前病程位置:"+emrView.CaretProcInfo.Index);
|
||
|
|
||
|
emrView.EditProcIndex=emrView.CaretProcInfo.Index;
|
||
|
//如果当前要删除的病程没有签名,并且和可编辑的病程id一致的:直接删除
|
||
|
//如果当前要删除的病程没有签名,与可编辑的病程id不一致:先把当前病程emrView.CaretProcInfo.Index=emrView.EditProcIndex,然后再删除。
|
||
|
//如果当前要删除的病程已经签名,则不能删除。
|
||
|
if(emrView.EditProcIndex==emrView.CaretProcInfo.Index){
|
||
|
console.log("删除病程:"+emrView.CaretProcInfo.Index);
|
||
|
var emrData = new EmrToWatData("S","delCaretProcInfo",emrView.CaretProcInfo.Index);
|
||
|
watEvents.emrToWatEvent(emrData);
|
||
|
}
|
||
|
|
||
|
// if(emrView.CaretProcInfo.Index){
|
||
|
|
||
|
// console.log("删除病程:"+emrView.CaretProcInfo.Index);
|
||
|
// var emrData = new EmrToWatData("S","delCaretProcInfo",emrView.CaretProcInfo.Index);
|
||
|
// watEvents.emrToWatEvent(emrData);
|
||
|
// }else{
|
||
|
|
||
|
// }
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
text:"复制引用",
|
||
|
exec: function() {
|
||
|
|
||
|
var emrData = new EmrToWatData("S","copyEMRContent","");
|
||
|
watEvents.emrToWatEvent(emrData);
|
||
|
|
||
|
},
|
||
|
},
|
||
|
{
|
||
|
text:"+存为示范词句",
|
||
|
exec: function() {
|
||
|
//把病历文本以流的形式保存
|
||
|
var emrData = new EmrToWatData("B","demonstrationWords",emrView.SaveSelectToBytes());
|
||
|
watEvents.emrToWatEvent(emrData);
|
||
|
|
||
|
},
|
||
|
},
|
||
|
{
|
||
|
text:"医学公式",
|
||
|
exec: function(){
|
||
|
|
||
|
},
|
||
|
// 子菜单
|
||
|
subMenu: [
|
||
|
{
|
||
|
index: "3-1",
|
||
|
text: "+恒牙标注",
|
||
|
exec: function() {
|
||
|
layer.open({
|
||
|
type: 2,
|
||
|
title: "恒牙标注",
|
||
|
shadeClose: true,
|
||
|
shade: 0.4,
|
||
|
area: ['550px', '450px'],
|
||
|
content: ['select/hySelect.html', 'no'],
|
||
|
btn: ['确定','关闭'],
|
||
|
yes: function(index){
|
||
|
//当点击‘确定’按钮的时候,获取弹出层返回的值
|
||
|
var map = window["layui-layer-iframe" + index].callbackdata();
|
||
|
emrView.InsertToothItem({
|
||
|
"LeftTop":map.get("leftTop"),
|
||
|
"RightTop":map.get("rightTop"),
|
||
|
"LeftBottom":map.get("leftBottom"),
|
||
|
"RightBottom":map.get("rightBotton")
|
||
|
});
|
||
|
|
||
|
// console.log(map);
|
||
|
//最后关闭弹出层
|
||
|
layer.close(index);
|
||
|
},
|
||
|
cancel: function(){
|
||
|
//右上角关闭回调
|
||
|
}
|
||
|
});
|
||
|
},
|
||
|
},
|
||
|
|
||
|
{
|
||
|
index: "3-2",
|
||
|
text: "+乳牙标注",
|
||
|
exec: function() {
|
||
|
layer.open({
|
||
|
type: 2,
|
||
|
title: "乳牙标注",
|
||
|
shadeClose: true,
|
||
|
shade: 0.4,
|
||
|
area: ['550px', '450px'],
|
||
|
content: ['select/rySelect.html', 'no'],
|
||
|
btn: ['确定','关闭'],
|
||
|
yes: function(index){
|
||
|
//当点击‘确定’按钮的时候,获取弹出层返回的值
|
||
|
var map = window["layui-layer-iframe" + index].callbackdata();
|
||
|
emrView.InsertToothItem({
|
||
|
"LeftTop":map.get("leftTop"),
|
||
|
"RightTop":map.get("rightTop"),
|
||
|
"LeftBottom":map.get("leftBottom"),
|
||
|
"RightBottom":map.get("rightBotton")
|
||
|
});
|
||
|
|
||
|
// console.log(map);
|
||
|
//最后关闭弹出层
|
||
|
layer.close(index);
|
||
|
},
|
||
|
cancel: function(){
|
||
|
//右上角关闭回调
|
||
|
}
|
||
|
});
|
||
|
},
|
||
|
},
|
||
|
{
|
||
|
index: "3-3",
|
||
|
text: "+胎心标注",
|
||
|
exec: function() {
|
||
|
layer.open({
|
||
|
type: 2,
|
||
|
title: "胎心标注",
|
||
|
shadeClose: true,
|
||
|
shade: 0.4,
|
||
|
area: ['550px', '450px'],
|
||
|
content: ['select/txSelect.html', 'no'],
|
||
|
btn: ['确定','关闭'],
|
||
|
yes: function(index){
|
||
|
//当点击‘确定’按钮的时候,获取弹出层返回的值
|
||
|
var map = window["layui-layer-iframe" + index].callbackdata();
|
||
|
emrView.InsertToothItem({
|
||
|
"LeftTop":map.get("leftTop"),
|
||
|
"RightTop":map.get("rightTop"),
|
||
|
"LeftBottom":map.get("leftBottom"),
|
||
|
"RightBottom":map.get("rightBotton")
|
||
|
});
|
||
|
|
||
|
// console.log(map);
|
||
|
//最后关闭弹出层
|
||
|
layer.close(index);
|
||
|
},
|
||
|
cancel: function(){
|
||
|
//右上角关闭回调
|
||
|
}
|
||
|
});
|
||
|
},
|
||
|
},
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
text:"+视频链接",
|
||
|
exec: function() {
|
||
|
layer.open({
|
||
|
type: 2,
|
||
|
title: "视频链接",
|
||
|
shadeClose: true,
|
||
|
shade: 0.4,
|
||
|
area: ['550px', '350px'],
|
||
|
content: ['select/videoInput.html', 'no'],
|
||
|
btn: ['确定','关闭'],
|
||
|
yes: function(index){
|
||
|
//当点击‘确定’按钮的时候,获取弹出层返回的值
|
||
|
var url = window["layui-layer-iframe" + index].callbackdata();
|
||
|
emrView.InsertHyperLink({
|
||
|
Text: url.split("#")[1],
|
||
|
HyperLink: url.split("#")[0],
|
||
|
});
|
||
|
|
||
|
// console.log(map);
|
||
|
//最后关闭弹出层
|
||
|
layer.close(index);
|
||
|
},
|
||
|
cancel: function(){
|
||
|
//右上角关闭回调
|
||
|
}
|
||
|
});
|
||
|
},
|
||
|
},
|
||
|
{
|
||
|
text:"日期时间",
|
||
|
exec: function() {
|
||
|
let date=new Date();
|
||
|
let newdate=date.toLocaleString('chinese', { hour12: false }); //获取24小时制,中国时间,打印出 2019/01/03/ 08:40:3
|
||
|
// console.log("日期时间:"+newdate);
|
||
|
// console.log("年:"+date.getFullYear());
|
||
|
// console.log("月:"+date.getMonth());
|
||
|
// console.log("日:"+date.getDate());
|
||
|
// console.log("时:"+date.getHours());
|
||
|
// console.log("分:"+date.getMinutes());
|
||
|
// console.log("long:"+Date.now().toString(36));
|
||
|
// emrView.InsertDeDateTime({
|
||
|
// Index: Date.now().toString(36),
|
||
|
// Name: date.getFullYear()+"-"+(date.getMonth()+1)+"-"+date.getDate()+" "+date.getHours()+":"+date.getMinutes()
|
||
|
// });
|
||
|
emrView.InsertDeItem({
|
||
|
Index: Date.now().toString(36),
|
||
|
Frmtp: "DT",
|
||
|
Name: date.getFullYear()+"-"+(date.getMonth()+1)+"-"+date.getDate()+" "+date.getHours()+":"+date.getMinutes()
|
||
|
});
|
||
|
|
||
|
},
|
||
|
},
|
||
|
{
|
||
|
text:"签名组",
|
||
|
exec: function(){
|
||
|
emrView.InsertDeGroup({
|
||
|
Index: "S4155",
|
||
|
Name: "医师签名",
|
||
|
Code: "DE02.01.039.00"
|
||
|
});
|
||
|
}
|
||
|
|
||
|
},
|
||
|
{
|
||
|
text:"申请编辑",
|
||
|
exec: function() {
|
||
|
emrView.Trace = true;
|
||
|
emrView.ReadOnly = false;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
]
|
||
|
);
|
||
|
|
||
|
// // 插入普通文本
|
||
|
// emrView.InsertText("姓名:");
|
||
|
|
||
|
// // 插入性别数据元,如果有赋值onInserItemSync方法,会在其中替换为实际的患者姓名
|
||
|
// var vDeItem = emrView.InsertDeItem({
|
||
|
// Index: "494",
|
||
|
// Name: "姓名",
|
||
|
// });
|
||
|
// //vDeItem.SetValue(); // 设置数据元的属性
|
||
|
|
||
|
// // 插入DeCombobox示例
|
||
|
// var vDeCombobox = emrView.InsertDeCombobox({
|
||
|
// Index: "4955",
|
||
|
// Name: "性别",
|
||
|
// Static: true, // 是否只能通过选项赋值(不能输入内容),true是,false否
|
||
|
// ReadOnly: false, // 是否只读,只读后不能修改内容
|
||
|
// SaveItem: true, // 是否保存选项(保存选项会增加文件体积)
|
||
|
// PrintOnlyText: true, // 打印时只打印文字,不打印按钮
|
||
|
// Items: [ // 插入时添加选项,注意如果要将选项保存到病历文件中,需要设置vDeCombobx.SaveItem = true;
|
||
|
// {
|
||
|
// Text: "男性",
|
||
|
// TextValue: "1",
|
||
|
// Checked: true,
|
||
|
// },
|
||
|
|
||
|
// {
|
||
|
// Text: "女性",
|
||
|
// TextValue: "2",
|
||
|
// Checked: false,
|
||
|
// },
|
||
|
// ]
|
||
|
// });
|
||
|
|
||
|
// // 插入RadioGroup示例
|
||
|
// var vDeRadioGroup = emrView.InsertDeRadioGroup({
|
||
|
|
||
|
// });
|
||
|
|
||
|
// // 插入表格示例
|
||
|
// var vDeTable = emrView.InsertDeTable({
|
||
|
// });
|
||
|
|
||
|
// var vMuDeItem = emrView.InsertDeItem({
|
||
|
|
||
|
// });
|
||
|
}
|
||
|
|
||
|
function applyTextStyle(style) {
|
||
|
// 设置选中的文本设置样式
|
||
|
emrView.ApplyTextStyle(style);
|
||
|
}
|
||
|
|
||
|
function applyParaAlignHorz(align) {
|
||
|
// 设置当前光标所在的段水平对齐
|
||
|
emrView.ApplyParaAlignHorz(align);
|
||
|
}
|
||
|
|
||
|
function LoadFromBytes(bytes) { // 二进制数组
|
||
|
// 加载文件,文件数据是byte数组
|
||
|
emrView.LoadFromBytes(bytes);
|
||
|
}
|
||
|
|
||
|
function SaveToBytes() {
|
||
|
// 保存文件,返回文件数据的byte数组
|
||
|
console.log("SaveToBytes存二进制文件");
|
||
|
return emrView.SaveToBytes();
|
||
|
}
|
||
|
|
||
|
|
||
|
function insertDeItem() {
|
||
|
// 插入数据元
|
||
|
emrView.InsertDeItem(
|
||
|
// {
|
||
|
// Index: "499",
|
||
|
// Name: "静脉曲张",
|
||
|
// //Text: "静脉无曲张",
|
||
|
// //CMVVCode: "1",
|
||
|
// Frmtp: TDeFrmtp.Multiselect,
|
||
|
// CMV: "299"
|
||
|
// }
|
||
|
{
|
||
|
"CMV": "1000000062",
|
||
|
// "CMVVCode": "",
|
||
|
// "code": "",
|
||
|
"Frmtp": "MS",
|
||
|
// "hideUnit": "",
|
||
|
"Index": "1000000062",
|
||
|
"Name": "皮肤颜色",
|
||
|
// "preFormat": "",
|
||
|
// "raw": "",
|
||
|
// "secret": "",
|
||
|
// "trace": "",
|
||
|
// "unit": ""
|
||
|
}
|
||
|
);
|
||
|
}
|
||
|
|
||
|
function getDeItemText(index) {
|
||
|
|
||
|
console.log("emrView.getDeItem:"+emrView.getDeItem(index));
|
||
|
|
||
|
}
|
||
|
|
||
|
function getDeItemProperty(index, propName) {
|
||
|
// 获取指定index的数据元的指定属性内容
|
||
|
var vInfo = emrView.GetDeItemProperty(index, propName);
|
||
|
if (vInfo.result) // 取到了
|
||
|
console.log("取到数据元属性:" + vInfo.text); // 取到的内容
|
||
|
else
|
||
|
console.log("未取到数据元属性内容");
|
||
|
}
|
||
|
|
||
|
function insertDeGroup(index, name) {
|
||
|
// 插入数据组
|
||
|
emrView.InsertDeGroup({
|
||
|
Index: index,
|
||
|
Name: name,
|
||
|
});
|
||
|
}
|
||
|
|
||
|
function setDeGroupText(index, s) {
|
||
|
emrView.SetDeGroupText(index, s);
|
||
|
}
|
||
|
|
||
|
function getDeGroupText(index) {
|
||
|
console.log(index + "数据组内容:" + emrView.GetDeGroupText(index));
|
||
|
}
|
||
|
|
||
|
function insertDeImage(index, name) {
|
||
|
// 仅插入空白占位图片,实际业务中再替换成相应的图片
|
||
|
emrView.InsertDeImage({
|
||
|
Index: index,
|
||
|
Name: name
|
||
|
});
|
||
|
|
||
|
// 直接插入图片
|
||
|
// getBase64ByUrl("./image/qm.png", function(base64) {
|
||
|
// emrView.InsertDeImage({
|
||
|
// Index: index,
|
||
|
// Name: name,
|
||
|
// Base64: base64,
|
||
|
// ImageType: "png"
|
||
|
// });
|
||
|
// });
|
||
|
}
|
||
|
|
||
|
function setSignatureGraphic(index) {
|
||
|
// 替换签名图片
|
||
|
getBase64ByUrl("./image/qm.png", function(base64) {
|
||
|
emrView.SetDeImage({
|
||
|
Index: index,
|
||
|
Base64: base64
|
||
|
});
|
||
|
});
|
||
|
}
|
||
|
function traverseFunByIndex(data, itemNo, tag, domainStack, stop){
|
||
|
let vItem = data.Items[itemNo];
|
||
|
var Index = vItem.Index;//获得属性ID
|
||
|
if(vItem.MarkType == 0 && vItem.Index =='1082'){
|
||
|
emrView.InnerView.setFocus()
|
||
|
emrView.InnerView.Style.UpdateInfoReScroll();
|
||
|
data.ItemSetCaretRequest(itemNo,2)
|
||
|
emrView.InnerView.killFocus()
|
||
|
return true
|
||
|
}
|
||
|
}
|
||
|
function traverseElementByIndex(_index){
|
||
|
/*emrView.TraverseElement(fun, areas, tag)需要3个参数
|
||
|
fun表示每遍历到一个元素时触发的事件
|
||
|
areas是个集合,表示要遍历的文档区域,集合的成员是1:页眉、2:正文、4:页脚,areas为null时表示全部区域(正文,页眉,页脚)
|
||
|
tag遍历标识,用于区域本次遍历是完成什么业务,可根据需要赋值
|
||
|
*/
|
||
|
console.log("开始遍历文档-----------------------------");
|
||
|
if(emrView.ProcCount>0){//病程
|
||
|
emrView._isProc=true;
|
||
|
}else{//病历
|
||
|
emrView._isProc=false;
|
||
|
}
|
||
|
let vAreas = new Set([]);
|
||
|
// vAreas.add(1);
|
||
|
vAreas.add(2);
|
||
|
// vAreas.add(4);
|
||
|
emrView.TraverseElement((data, itemNo, tag, domainStack, stop) =>{
|
||
|
let vItem = data.Items[itemNo];
|
||
|
if(vItem.MarkType == 0 && vItem.Index ==_index){
|
||
|
emrView.InnerView.setFocus()
|
||
|
emrView.InnerView.Style.UpdateInfoReScroll();
|
||
|
data.ItemSetCaretRequest(itemNo,2)
|
||
|
// emrView.InnerView.killFocus()
|
||
|
return true
|
||
|
}
|
||
|
else if (vItem.StyleNo > TItemStyle.Null) { // 文本
|
||
|
if (vItem.IsElement){
|
||
|
if( vItem.Index ==_index){//已经赋值
|
||
|
emrView.InnerView.setFocus()
|
||
|
emrView.InnerView.Style.UpdateInfoReScroll();
|
||
|
data.ItemSetCaretRequest(itemNo,2)
|
||
|
// emrView.InnerView.killFocus()
|
||
|
return true
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}, vAreas, 0);
|
||
|
|
||
|
}
|
||
|
|
||
|
// 取指定Inex的病程内容
|
||
|
function getProc() {
|
||
|
var procIndex = document.getElementById("procIndex").value;
|
||
|
//var text = emrView.GetProcAsText(procIndex); // 返回病程内容文本
|
||
|
//var bytes = emrView.GetProcAsBytes(procIndex); // 返回病程内容Byte数组(二进制)
|
||
|
var html = emrView.GetProcAsHtml(procIndex); // 返回病程内容Html格式
|
||
|
var vWindow = window.open("", "", "width=" + emrView.ActiveSection.PaperWidthPix);
|
||
|
vWindow.document.write(html);
|
||
|
vWindow.focus();
|
||
|
}
|
||
|
|
||
|
// 编辑光标处病程
|
||
|
function editCaretProc() {
|
||
|
emrView.EditProcIndex = emrView.CaretProcInfo.Index;
|
||
|
}
|
||
|
|
||
|
// 取病程属性信息
|
||
|
function getProcProperty() {
|
||
|
var procIndex = document.getElementById("procIndex").value;
|
||
|
// 取病程所有属性信息
|
||
|
//appendLine("病程" + procIndex + "的属性信息:" + emrView.GetProcProperty(procIndex, TGroupProp.Propertys));
|
||
|
// 取病程Name属性
|
||
|
console.log("病程" + procIndex + "的属性信息:" + emrView.GetProcProperty(procIndex, TGroupProp.Name));
|
||
|
}
|
||
|
|
||
|
// 开启关闭痕迹
|
||
|
function setTrace() {
|
||
|
emrView.Trace = !emrView.Trace;
|
||
|
if (emrView.Trace)
|
||
|
document.getElementById("btnTrace").innerHTML = "关闭留痕";
|
||
|
else
|
||
|
document.getElementById("btnTrace").innerHTML = "开启留痕";
|
||
|
}
|
||
|
|
||
|
// 在留痕模式下,对新痕迹添加痕迹信息
|
||
|
function setTraceInfo() {
|
||
|
// 痕迹时间,实际业务应该取服务端时间
|
||
|
var vDate = new Date();
|
||
|
var vDateTime = vDate.getFullYear() + "-" + (vDate.getMonth() + 1).toString()
|
||
|
+ "-" + vDate.getDate() + " " + vDate.getHours() + ":" + vDate.getMinutes() + ":" + vDate.getSeconds();
|
||
|
var vDeItem;
|
||
|
|
||
|
if (emrView.Trace) { // 当前是留痕模式
|
||
|
var vAreas = new Set([]);
|
||
|
vAreas.add(2);
|
||
|
emrView.TraverseElement(
|
||
|
function (data, itemNo, tag, domainStack, stop) {
|
||
|
vDeItem = data.Items[itemNo];
|
||
|
var curUser = emrView._EmrEditor[EmrEditor.USER];//当前用户
|
||
|
var curUserName = emrView._EmrEditor[EmrEditor.USERNAME]
|
||
|
if (vDeItem.StyleNo > -1) { // 是文本
|
||
|
if (vDeItem.TraceStyles.value != 0) {
|
||
|
if (vDeItem.TraceStyles.has(TDeTraceStyle.Add) &&
|
||
|
vDeItem.GetValue(TDeProp.TraceAdd) == "")
|
||
|
{
|
||
|
|
||
|
// 新的添加痕迹
|
||
|
vDeItem.SetValue(TDeProp.TraceAddLevel, TDeTraceLevel.Three); // 痕迹的医师级别,不需要可以不赋值
|
||
|
vDeItem.SetValue(TDeProp.TraceAdd, curUserName + "( " + vDateTime + ")添加");
|
||
|
}
|
||
|
|
||
|
if (vDeItem.TraceStyles.has(TDeTraceStyle.Del) &&
|
||
|
vDeItem.GetValue(TDeProp.TraceDel) == "")
|
||
|
{
|
||
|
// 新的删除痕迹
|
||
|
vDeItem.SetValue(TDeProp.TraceDelLevel, TDeTraceLevel.Three); // 痕迹的医师级别,不需要可以不赋值
|
||
|
vDeItem.SetValue(TDeProp.TraceDel, curUserName + "( " + vDateTime + ")删除");
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
vAreas, 0);
|
||
|
} else
|
||
|
console.log("当前不是留痕模式");
|
||
|
}
|
||
|
function insertAnnotate(title,content){
|
||
|
emrView.InsertAnnotate(title,content);
|
||
|
}
|
||
|
function addAnnotateToWat(data){
|
||
|
var emrData = new EmrToWatData("JSON","addAnnotation",data);
|
||
|
feedbackDataToWat(JSON.stringify(emrData));
|
||
|
}
|
||
|
/**------------------------------------------------------------xgf 2020年7月23日 10:18:45 begin -------------------------------------------------**/
|
||
|
function GetQueryString(name){
|
||
|
var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
|
||
|
var r = window.location.search.substr(1).match(reg);
|
||
|
if(r!=null){
|
||
|
return unescape(r[2]);
|
||
|
}
|
||
|
return null;
|
||
|
}
|
||
|
//保存数据返回给平台[add by xgf 2020年7月23日 10:13:13]
|
||
|
function feedbackDataToWat(data){
|
||
|
//console.log("二进制数据:"+data,"strwinid:"+GetQueryString('strwinid'),+"strctrid:"+GetQueryString('strctrid'));
|
||
|
return window.parent.top.DxURLPage.action(GetQueryString('strwinid'),GetQueryString('strctrid'),data);
|
||
|
}
|
||
|
//病历二进制数据返回给平台,以及解析数据到平台。
|
||
|
function feedbackEmrStreamToWat(asyn){
|
||
|
|
||
|
console.log(emrView.InnerView.FPropertys);
|
||
|
try {
|
||
|
watEvents.traverseElement_wat();
|
||
|
} catch (error) {
|
||
|
console.log("解析出错了:"+error);
|
||
|
}finally{
|
||
|
let saveData = emrView._saveEmrData;
|
||
|
let deElements = emrView._emrDataElement_wat;
|
||
|
let steamData = SaveToBytes();
|
||
|
|
||
|
let data = {
|
||
|
saveData:saveData,
|
||
|
deElements:deElements,
|
||
|
steamData:steamData
|
||
|
}
|
||
|
var emrData = new EmrToWatData("B","saveDataEMRByte",data);
|
||
|
watEvents.emrToWatEvent(emrData,asyn);
|
||
|
}
|
||
|
}
|
||
|
//病历xml数据返回给平台
|
||
|
function feedbackEmrXmlToWat(){
|
||
|
var xmlData = emrView.SaveToXml();
|
||
|
console.log(xmlData);
|
||
|
var emrData = new EmrToWatData("B","saveEMRXml",xmlData);
|
||
|
watEvents.emrToWatEvent(emrData);
|
||
|
}
|
||
|
//另存为子模板
|
||
|
function saveChildTemplet(){
|
||
|
var steamData ="";
|
||
|
if(emrView.ProcCount>0){//如果是病程的话。
|
||
|
var emrProcId = emrView.InnerView.GetAllProcIndex()[0];
|
||
|
//这个方法接收两个参数。第一个参数是病程的id,第二个参数是boolean,true:带页眉页脚,false:不带页眉页脚
|
||
|
steamData = emrView.SaveProcToBytes(emrProcId, true);
|
||
|
}else{
|
||
|
steamData = SaveToBytes();
|
||
|
}
|
||
|
var emrData = new EmrToWatData("B","saveChildTemplet",steamData);
|
||
|
watEvents.emrToWatEvent(emrData);
|
||
|
}
|
||
|
function insertProcToWat(emrProcessId){
|
||
|
var emrData = new EmrToWatData("S","insertProc",emrProcessId);
|
||
|
watEvents.emrToWatEvent(emrData);
|
||
|
}
|
||
|
|
||
|
|
||
|
function watResultToIFrame(data){
|
||
|
var jsonData = JSON.parse(data);
|
||
|
console.log("平台传入的数据event:"+jsonData.event);
|
||
|
//debugger;
|
||
|
// console.log("平台传入的数据data:"+jsonData.data);
|
||
|
watEvents.watToEMREvent(jsonData);
|
||
|
}
|
||
|
|
||
|
|
||
|
//数据传递对象
|
||
|
/**
|
||
|
接受平台数据
|
||
|
{
|
||
|
dataType:"",//数据类型,
|
||
|
event:""//数据来源,类别。业务类别,emr001=编辑器init完成。
|
||
|
data:{}
|
||
|
}
|
||
|
**/
|
||
|
function EmrToWatData(dataType,event,data){
|
||
|
this.dataType = dataType;//
|
||
|
this.event = event;
|
||
|
this.data = data
|
||
|
|
||
|
}
|
||
|
|
||
|
/**------------------------------------------------------------xgf 2020年7月23日 10:18:45 end -------------------------------------------------**/
|
||
|
|
||
|
</script>
|
||
|
</head>
|
||
|
|
||
|
<body style="height: 100%;" onload="load()">
|
||
|
|
||
|
<div id="divHCEmrView" style="left: 2px; top: 0px; position: fixed; width: 100%; height:100%; background: lightgray;"></div>
|
||
|
</body>
|
||
|
|
||
|
</html>
|