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.
1053 lines
48 KiB
1053 lines
48 KiB
3 months ago
|
(function(exports){
|
||
|
var curWwwPath = window.document.location.href;
|
||
|
var pathName = window.document.location.pathname;
|
||
|
var pos = curWwwPath.indexOf(pathName);
|
||
|
var localhostPaht = curWwwPath.substring(0, pos);
|
||
|
var projectName = pathName.substring(0, pathName.substr(1).indexOf('/')+1);
|
||
|
var realPath = localhostPaht+projectName;
|
||
|
|
||
|
var hcData ={};//宏定义
|
||
|
var proceData={
|
||
|
get : function(x){
|
||
|
return this.x;
|
||
|
},
|
||
|
set : function(prop,x){
|
||
|
this[prop] = x
|
||
|
}
|
||
|
};//其他信息,如病程记录的信息
|
||
|
var eventData = {
|
||
|
}
|
||
|
|
||
|
|
||
|
var dataToJSONArray = function(data){
|
||
|
var returnData ={};
|
||
|
if(data instanceof Array){
|
||
|
var rowCount=data.length
|
||
|
if(rowCount>0){
|
||
|
returnData.BorderVisible=true;
|
||
|
returnData.RowCount=data.length;
|
||
|
//这里可以根据医院的需求来设置显示多少列。默认全部取出
|
||
|
|
||
|
let cellsCount=Object.keys(data[0]).length;
|
||
|
|
||
|
var rows=new Array();
|
||
|
for(let i=0;i<rowCount;i++){
|
||
|
var cells = data[i];
|
||
|
var cellArr = Object.keys(cells);
|
||
|
var cellsLength = cellArr.length;
|
||
|
var cols =new Array();
|
||
|
for(let j=0;j<cellsLength;j++){
|
||
|
cols[j]={
|
||
|
Text:cells[cellArr[j]]
|
||
|
}
|
||
|
}
|
||
|
var col={
|
||
|
Cells:cols
|
||
|
}
|
||
|
rows[i]=col;
|
||
|
}
|
||
|
returnData.Rows=rows;
|
||
|
returnData.ColCount = cellsCount;
|
||
|
let colsArr = new Array();
|
||
|
for(let m =0;m<cellsCount;m++){
|
||
|
if(m == 0){
|
||
|
colsArr.push("20%");
|
||
|
}else {
|
||
|
colsArr.push("10%");
|
||
|
}
|
||
|
}
|
||
|
returnData.ColWidths=colsArr;
|
||
|
|
||
|
}
|
||
|
return returnData;
|
||
|
}
|
||
|
};
|
||
|
/* 遍历编辑器中的数据元时,每遍历到一个数据元触发
|
||
|
此方法参数使用编辑器内置的原生Item对象,注意相关的属性大小写
|
||
|
tag:
|
||
|
domainStack:.peek
|
||
|
stop:
|
||
|
停止解析,return true;
|
||
|
*/
|
||
|
function traverseFun_wat(data, itemNo, tag, domainStack, stop) {
|
||
|
//首先判断是否是同一份病历或者病程。
|
||
|
//对emrView._saveEmrData={};对象进行装饰。
|
||
|
//{
|
||
|
// "emrId":{
|
||
|
// "主诉::"",
|
||
|
// }
|
||
|
// }
|
||
|
console.log("解析:"+itemNo);
|
||
|
|
||
|
let vItem = data.Items[itemNo];
|
||
|
var Index = vItem.Index;//获得属性ID
|
||
|
var emrId = "";
|
||
|
if(emrView._isProc){
|
||
|
console.log("当前解析是病程");
|
||
|
}else{
|
||
|
emrId=emrView.InnerView.GetValue(EmrProp.EmrId);
|
||
|
if(emrView._saveEmrData.emrId==undefined||emrView._saveEmrData.emrId!=emrId){
|
||
|
emrView._saveEmrData.emrId=emrId;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
var code = vItem.Code;
|
||
|
|
||
|
if (vItem.StyleNo == TItemStyle.Domain) { // 数据组
|
||
|
if (vItem.IsProcBegin){
|
||
|
emrId = vItem.Index;
|
||
|
emrView._saveEmrData.emrId=emrId;
|
||
|
console.log("病程开始--------唯一标识:" + vItem.Index);
|
||
|
emrView._dataMark = true;
|
||
|
emrView._currentDataGroup=Index;
|
||
|
emrView._saveEmrData[Index]={};
|
||
|
emrView._saveEmrData[Index].parentId=emrView._saveEmrData.emrId;
|
||
|
emrView._saveEmrData[Index].dataStr="";
|
||
|
}
|
||
|
else if (vItem.IsProcEnd){
|
||
|
console.log("病程结束--------唯一标识:" + vItem.Index);
|
||
|
|
||
|
if(emrView._dataMark){
|
||
|
console.log("病程 Index:"+vItem.Index+":"+emrView._dataStr);
|
||
|
emrView._dataMark=false;
|
||
|
emrView._currentDataGroup=""
|
||
|
}
|
||
|
|
||
|
}
|
||
|
else if (vItem.MarkType == 0){
|
||
|
if(emrView._dataMark){
|
||
|
console.log("数据组开始--------Index:" + vItem.Index,vItem.Name);
|
||
|
emrView._saveEmrData[Index]={};
|
||
|
emrView._saveEmrData[Index].parentId=emrView._currentDataGroup;
|
||
|
emrView._currentDataGroup=Index;
|
||
|
emrView._saveEmrData[Index].dataStr="";
|
||
|
emrView._saveEmrData[Index].name=vItem.GetValue(TDeProp.Name);
|
||
|
emrView._dataStr ="";
|
||
|
}else{
|
||
|
emrView._dataMark = true;
|
||
|
console.log("数据组开始--------Index:" + vItem.Index,vItem.Name);
|
||
|
emrView._currentDataGroup=Index;
|
||
|
emrView._saveEmrData[Index]={};
|
||
|
emrView._saveEmrData[Index].parentId=emrView._saveEmrData.emrId;
|
||
|
emrView._saveEmrData[Index].dataStr="";
|
||
|
emrView._saveEmrData[Index].name=vItem.GetValue(TDeProp.Name);
|
||
|
}
|
||
|
|
||
|
|
||
|
}
|
||
|
else{
|
||
|
console.log("数据组结束--------Index:" + vItem.Index);
|
||
|
if(emrView._dataMark){
|
||
|
|
||
|
console.log("数据组 Index:"+vItem.Index+":"+emrView._dataStr);
|
||
|
let deElement = new Object();
|
||
|
deElement.Index = vItem.Index;
|
||
|
deElement.Name = vItem.GetValue(TDeProp.Name);
|
||
|
deElement.Text = emrView._saveEmrData[Index].dataStr;
|
||
|
deElement.Value = "";
|
||
|
deElement.ParentIndex = emrView._saveEmrData[Index].parentId;
|
||
|
emrView._emrDataElement_wat.push(deElement);
|
||
|
// if(emrView._EmrData.hasOwnProperty(code)){
|
||
|
// emrView._saveEmrData[Index].dataStr+=emrView._dataStr;
|
||
|
// }
|
||
|
if(emrView._saveEmrData[Index].parentId!=emrView._saveEmrData.emrId){
|
||
|
emrView._saveEmrData[emrView._saveEmrData[Index].parentId].dataStr+=emrView._saveEmrData[Index].dataStr;
|
||
|
emrView._currentDataGroup=emrView._saveEmrData[Index].parentId;
|
||
|
}else{
|
||
|
emrView._dataMark=false;
|
||
|
emrView._currentDataGroup=""
|
||
|
|
||
|
}
|
||
|
|
||
|
}
|
||
|
}
|
||
|
|
||
|
}
|
||
|
else if (vItem.StyleNo > TItemStyle.Null) { // 文本
|
||
|
if (vItem.IsElement){
|
||
|
|
||
|
console.log("数据元 Index:" + vItem.Index + " Text:" + vItem.Text,vItem.GetValue(TDeProp.Name),vItem.AllocValue);
|
||
|
if(emrView._dataMark){
|
||
|
if(vItem.AllocValue){//已经赋值
|
||
|
emrView._dataStr+=vItem.Text;
|
||
|
emrView._saveEmrData[emrView._currentDataGroup].dataStr += vItem.Text;
|
||
|
}
|
||
|
}
|
||
|
let deElement = new Object();
|
||
|
deElement.Index = vItem.Index;
|
||
|
deElement.Name = vItem.GetValue(TDeProp.Name);
|
||
|
deElement.Text = vItem.Text;
|
||
|
deElement.Code = vItem.Code;
|
||
|
deElement.Value = "";
|
||
|
emrView._emrDataElement_wat.push(deElement);
|
||
|
if(!vItem.AllocValue){
|
||
|
emrView._nullEmrDataArray.push(vItem.Index+"#"+vItem.Name);
|
||
|
}
|
||
|
|
||
|
|
||
|
}
|
||
|
else{
|
||
|
console.log("自然文本 Text:" + vItem.Text); // 原生Item文本属性Text(大写T开始)
|
||
|
|
||
|
if(emrView._dataMark){
|
||
|
emrView._dataStr+=vItem.Text;
|
||
|
emrView._saveEmrData[emrView._currentDataGroup].dataStr += vItem.Text;
|
||
|
}
|
||
|
let deElement = new Object();
|
||
|
deElement.Index = vItem.Index;
|
||
|
deElement.Name = vItem.GetValue(TDeProp.Name);
|
||
|
deElement.Text = vItem.Text;
|
||
|
deElement.Code = vItem.Code;
|
||
|
deElement.Value = "";
|
||
|
emrView._emrDataElement_wat.push(deElement);
|
||
|
}
|
||
|
|
||
|
}
|
||
|
else if (vItem.StyleNo == TItemStyle.CheckBox){
|
||
|
console.log("勾选框 Text:" + vItem.Text);
|
||
|
if(emrView._dataMark){
|
||
|
emrView._dataStr+=vItem.Text;
|
||
|
emrView._saveEmrData[emrView._currentDataGroup].dataStr += vItem.Text;
|
||
|
}
|
||
|
let deElement = new Object();
|
||
|
deElement.Index = vItem.Index;
|
||
|
deElement.Name = vItem.GetValue(TDeProp.Name);
|
||
|
deElement.Text = vItem.Text;
|
||
|
deElement.Code = vItem.Code;
|
||
|
deElement.Value = "";
|
||
|
emrView._emrDataElement_wat.push(deElement);
|
||
|
}
|
||
|
|
||
|
|
||
|
else if (vItem.StyleNo == TItemStyle.Combobox){
|
||
|
console.log("下拉框 Text" + vItem.Text);
|
||
|
if(emrView._dataMark){
|
||
|
emrView._dataStr+=vItem.Text;
|
||
|
emrView._saveEmrData[emrView._currentDataGroup].dataStr += vItem.Text;
|
||
|
}
|
||
|
let deElement = new Object();
|
||
|
deElement.Index = vItem.Index;
|
||
|
deElement.Name = vItem.GetValue(TDeProp.Name);
|
||
|
deElement.Text = vItem.Text;
|
||
|
deElement.Code = vItem.Code;
|
||
|
deElement.Value = "";
|
||
|
emrView._emrDataElement_wat.push(deElement);
|
||
|
}
|
||
|
|
||
|
else if (vItem.StyleNo == TItemStyle.Edit){
|
||
|
console.log("文本框 Text" + vItem.Text);
|
||
|
if(emrView._dataMark){
|
||
|
emrView._dataStr+=vItem.Text;
|
||
|
emrView._saveEmrData[emrView._currentDataGroup].dataStr += vItem.Text;
|
||
|
}
|
||
|
let deElement = new Object();
|
||
|
deElement.Index = vItem.Index;
|
||
|
deElement.Name = vItem.GetValue(TDeProp.Name);
|
||
|
deElement.Text = vItem.Text;
|
||
|
deElement.Code = vItem.Code;
|
||
|
deElement.Value = "";
|
||
|
emrView._emrDataElement_wat.push(deElement);
|
||
|
}
|
||
|
|
||
|
else if (vItem.StyleNo == TItemStyle.DateTimePicker){
|
||
|
console.log("日期时间 Text" + vItem.Text);
|
||
|
if(emrView._dataMark){
|
||
|
emrView._dataStr+=vItem.Text;
|
||
|
emrView._saveEmrData[emrView._currentDataGroup].dataStr += vItem.Text;
|
||
|
}
|
||
|
let deElement = new Object();
|
||
|
deElement.Index = vItem.Index;
|
||
|
deElement.Name = vItem.GetValue(TDeProp.Name);
|
||
|
deElement.Text = vItem.Text;
|
||
|
deElement.Code = vItem.Code;
|
||
|
deElement.Value = "";
|
||
|
emrView._emrDataElement_wat.push(deElement);
|
||
|
}
|
||
|
|
||
|
else if (vItem.StyleNo == TItemStyle.RadioGroup){
|
||
|
console.log("RadioGroup Text" + vItem.Text);
|
||
|
let deElement = new Object();
|
||
|
deElement.Index = vItem.Index;
|
||
|
deElement.Name = vItem.GetValue("Name");
|
||
|
deElement.Text = vItem.Text;
|
||
|
deElement.Value = "";
|
||
|
deElement.ParentIndex = "";
|
||
|
let tList = vItem.FItems;
|
||
|
for(let i =0 ;i<tList.length;i++){
|
||
|
if(tList[i].FChecked == true){//被选中
|
||
|
deElement.Value= tList[i].TextValue;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
if(""!=emrView._currentDataGroup){
|
||
|
deElement.ParentIndex = emrView._currentDataGroup;
|
||
|
}
|
||
|
emrView._emrDataElement_wat.push(deElement);
|
||
|
if(emrView._dataMark){
|
||
|
emrView._dataStr+=vItem.Text;
|
||
|
emrView._saveEmrData[emrView._currentDataGroup].dataStr += vItem.Text;
|
||
|
}
|
||
|
// let deElement = new Object();
|
||
|
// deElement.Index = vItem.Index;
|
||
|
// deElement.Name = vItem.GetValue(TDeProp.Name);
|
||
|
// deElement.Text = vItem.Text;
|
||
|
// deElement.Code = vItem.Code;
|
||
|
// deElement.Value = "";
|
||
|
// emrView._emrDataElement_wat.push(deElement);
|
||
|
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
var watToEMREvents = {
|
||
|
"emrInit":function(data){//初始化病历
|
||
|
// console.log("emrInit:"+JSON.stringify(data));
|
||
|
// console.log(data.emrContent);
|
||
|
try{
|
||
|
var type = data.type;//新建还是编辑
|
||
|
if(data.emrId==undefined){
|
||
|
}else{
|
||
|
var _EmrEditor={};
|
||
|
_EmrEditor[EmrEditor.USER]=data._user;//非序列化属性【当前医生id】
|
||
|
_EmrEditor[EmrEditor.OPERATOR]=data._operator;//经治医师【elemr_patients】
|
||
|
_EmrEditor[EmrEditor.DIRECTOR]=data._director;//主治医师【elemr_patients】
|
||
|
_EmrEditor[EmrEditor.LEADER]=data._leader;//主任医师【elemr_patients】
|
||
|
_EmrEditor[EmrProp.EditorType]=data.editortype;//当前操作员是护士还是医生
|
||
|
_EmrEditor[EmrEditor.QCR] = data.qcr;//病历书写人
|
||
|
_EmrEditor[EmrEditor.USERNAME]=data._username;
|
||
|
var _Emr ={};
|
||
|
_Emr[EmrProp.OPERATORSIGN]=data.operatorsign;
|
||
|
_Emr[EmrProp.DIRECTORSIGN]=data.directorsign;
|
||
|
_Emr[EmrProp.LEADERSIGN]=data.leadersign;
|
||
|
|
||
|
emrView._EmrEditor=_EmrEditor;
|
||
|
emrView._Emr=_Emr;
|
||
|
}
|
||
|
|
||
|
hcData =data.hcData;
|
||
|
eventData = data.eventDataElement;
|
||
|
var dataByte = new Uint8Array(data.emrContent);
|
||
|
if(dataByte.length==0){
|
||
|
|
||
|
}else{
|
||
|
if(type=="new"){
|
||
|
proceData.set("DE09.00.053.00",data.operatortime);
|
||
|
}
|
||
|
emrView.ReadOnly=false;
|
||
|
emrView.LoadFromBytes(dataByte);
|
||
|
|
||
|
}
|
||
|
if(data.emrId==undefined){
|
||
|
|
||
|
}else{
|
||
|
let evData =data.eventData;
|
||
|
if(type=="new"){
|
||
|
emrView.InnerView.SetValue(EmrProp.EmrId, data.emrId);//病历附加属性[病历id]
|
||
|
emrView.InnerView.SetValue(EmrProp.QCR, data.qcr);//新建病历的人【起草人】
|
||
|
emrView.InnerView.SetValue(EmrProp.Choscode, data.choscode);//医院编码
|
||
|
emrView.InnerView.SetValue(EmrProp.EditorType, data.editortype);//护士还是医生写的。
|
||
|
}
|
||
|
if(emrView.ProcCount>0){
|
||
|
emrView.EditProcIndex = data.emrId;
|
||
|
emrView.ScrollToProc(emrView.EditProcIndex);
|
||
|
if(evData){
|
||
|
evData.forEach(
|
||
|
(item) =>{emrView.SetProcDeGroupByText(emrView.EditProcIndex,item.Index, item.Text);}
|
||
|
)
|
||
|
}
|
||
|
}else{
|
||
|
if(evData){
|
||
|
evData.forEach(
|
||
|
(item) =>{emrView.SetDeGroupByText(item.Index, item.Text);}
|
||
|
)
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}finally{
|
||
|
if(data.type=="newrecord"){
|
||
|
//save病历
|
||
|
var sectionData =data.sectionData;
|
||
|
for(prop in sectionData){
|
||
|
emrView.SetDeGroupByText(prop, sectionData[prop]);
|
||
|
}
|
||
|
|
||
|
var steamData = emrView.SaveToBytes();
|
||
|
var emrData = new EmrToWatData("B","saveEMRByte",steamData);
|
||
|
window.parent.top.DxURLPage.action(GetQueryString('strwinid'),GetQueryString('strctrid'),JSON.stringify(emrData),true);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
},
|
||
|
"emrMZBaseInit":function(data){//初始化门诊病历首页
|
||
|
|
||
|
var index = layer.load(0, {shade: [0.1,'#ff0']});
|
||
|
try{
|
||
|
var type = data.type;//新建还是编辑
|
||
|
var _EmrEditor={};
|
||
|
_EmrEditor[EmrEditor.USER]=data._user;//非序列化属性【当前医生id】
|
||
|
_EmrEditor[EmrEditor.OPERATOR]=data._operator;//经治医师【elemr_patients】
|
||
|
_EmrEditor[EmrEditor.DIRECTOR]=data._director;//主治医师【elemr_patients】
|
||
|
_EmrEditor[EmrEditor.LEADER]=data._leader;//主任医师【elemr_patients】
|
||
|
_EmrEditor[EmrProp.EditorType]=data.editortype;//当前操作员是护士还是医生
|
||
|
_EmrEditor[EmrEditor.QCR] = data.qcr;//病历书写人
|
||
|
_EmrEditor[EmrEditor.USERNAME]=data._username;
|
||
|
var _Emr ={};
|
||
|
_Emr[EmrProp.OPERATORSIGN]=data.operatorsign;
|
||
|
_Emr[EmrProp.DIRECTORSIGN]=data.directorsign;
|
||
|
_Emr[EmrProp.LEADERSIGN]=data.leadersign;
|
||
|
|
||
|
emrView._EmrEditor=_EmrEditor;
|
||
|
emrView._Emr=_Emr;
|
||
|
|
||
|
hcData =data.hcData;
|
||
|
var dataByte = new Uint8Array(data.emrContent);
|
||
|
if(dataByte.length==0){
|
||
|
|
||
|
}else{
|
||
|
emrView.ReadOnly=false;
|
||
|
emrView.LoadFromBytes(dataByte);//LoadFromBytes
|
||
|
}
|
||
|
//设置emrView.InnerView.FPropertys,必须在字节流加载完成之后,切记
|
||
|
if(type=="new"){
|
||
|
proceData.set("DE09.00.053.00",data.operatortime);
|
||
|
emrView.InnerView.SetValue(EmrProp.EmrId, data.emrId);//病历附加属性[病历id]
|
||
|
emrView.InnerView.SetValue(EmrProp.QCR, data.qcr);//新建病历的人【起草人】
|
||
|
emrView.InnerView.SetValue(EmrProp.Choscode, data.choscode);//医院编码
|
||
|
emrView.InnerView.SetValue(EmrProp.EditorType, data.editortype);//护士还是医生写的。
|
||
|
}
|
||
|
|
||
|
//医生未签名是,设置辅助检查结果等信息
|
||
|
if("1"!=emrView._Emr[EmrProp.OPERATORSIGN]){
|
||
|
var inSpection = data.inspection;
|
||
|
console.log(inSpection);
|
||
|
var meDicalTreatment = data.meDicalTreatment;
|
||
|
var inSpectionData = dataToJSONArray(inSpection);
|
||
|
var meDicalTreatmentData = dataToJSONArray(meDicalTreatment);
|
||
|
var westDrug = data.westDrug;
|
||
|
var westDrugData = dataToJSONArray(westDrug);
|
||
|
var diagnoseInfo = data.diagnoseInfo
|
||
|
|
||
|
var chineseDrug = data.chineseDrug;
|
||
|
var chineseDrugData = dataToJSONArray(chineseDrug);
|
||
|
let evData =data.eventData
|
||
|
if(evData){
|
||
|
evData.forEach((item) =>{
|
||
|
emrView.SetDeGroupByText(item.Index, item.Text);
|
||
|
})
|
||
|
}
|
||
|
|
||
|
|
||
|
if (emrView.InnerView.SetCaretToPageDeGroupStart("S4513")){
|
||
|
if(inSpection){//检验检查
|
||
|
if(inSpection instanceof Array){
|
||
|
emrView.SetDeGroupByText("S4513", "");
|
||
|
emrView.InsertDeTable(
|
||
|
inSpectionData
|
||
|
);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
if(emrView.InnerView.SetCaretToPageDeGroupStart("S5561")){
|
||
|
if(meDicalTreatment){//项目
|
||
|
if(meDicalTreatment instanceof Array){
|
||
|
emrView.SetDeGroupByText("S5561", "");
|
||
|
emrView.InsertDeTable(
|
||
|
meDicalTreatmentData
|
||
|
);
|
||
|
}
|
||
|
|
||
|
}
|
||
|
}
|
||
|
if(emrView.InnerView.SetCaretToPageDeGroupStart("S5560")){
|
||
|
if(westDrug){//药品
|
||
|
if(westDrug instanceof Array){
|
||
|
emrView.SetDeGroupByText("S5560", "");
|
||
|
emrView.InsertDeTable(
|
||
|
westDrugData
|
||
|
);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
if(emrView.InnerView.SetCaretToPageDeGroupStart("S5559")){
|
||
|
if(chineseDrug){
|
||
|
if(chineseDrug instanceof Array){
|
||
|
emrView.SetDeGroupByText("S5559", "");
|
||
|
emrView.InsertDeTable(
|
||
|
chineseDrugData
|
||
|
);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
}
|
||
|
if(emrView.InnerView.SetCaretToPageDeGroupStart("S5558")){//诊断
|
||
|
if(diagnoseInfo){
|
||
|
if(diagnoseInfo instanceof Array){
|
||
|
emrView.SetDeGroupByText("S5558", "");
|
||
|
let diagStr ="";
|
||
|
for(let i =0;i<diagnoseInfo.length;i++){
|
||
|
if(i==(diagnoseInfo.length-1)){
|
||
|
diagStr +=diagnoseInfo[i][0]
|
||
|
}else{
|
||
|
diagStr +=diagnoseInfo[i][0]+"\r\n";
|
||
|
}
|
||
|
|
||
|
}
|
||
|
emrView.SetDeGroupByText("S5558",diagStr);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
}finally{
|
||
|
layer.close(index);
|
||
|
//save病历
|
||
|
var steamData = emrView.SaveToBytes();
|
||
|
var emrData = new EmrToWatData("B","saveEMRByte",steamData);
|
||
|
return window.parent.top.DxURLPage.action(GetQueryString('strwinid'),GetQueryString('strctrid'),JSON.stringify(emrData),false);
|
||
|
|
||
|
}
|
||
|
|
||
|
|
||
|
},
|
||
|
"emrShowInit": function(data){
|
||
|
// emrView.Clear();
|
||
|
emrView.ReadOnly=false;
|
||
|
if(data.emrContent&&data.emrContent.length>0){
|
||
|
var dataByte = new Uint8Array(data.emrContent);
|
||
|
emrView.LoadFromBytes(dataByte);
|
||
|
emrView.ReadOnly=true;
|
||
|
}else{
|
||
|
emrView.Clear();
|
||
|
}
|
||
|
|
||
|
},
|
||
|
"emrProcessInit":function(data){//初始化病程
|
||
|
// console.log("emrInit:"+JSON.stringify(data));
|
||
|
// console.log(data.emrContent);
|
||
|
try{
|
||
|
|
||
|
var _EmrEditor={};
|
||
|
|
||
|
var _Emr ={};
|
||
|
|
||
|
emrView._EmrEditor=_EmrEditor;
|
||
|
emrView._Emr=_Emr;
|
||
|
var dataByte = new Uint8Array(data.emrContent);
|
||
|
hcData =data.hcData;
|
||
|
|
||
|
if (dataByte.length > 0) { // 模板有内容,创建病历
|
||
|
emrView.BeginUpdate(); // 开启批量更新,提高效率
|
||
|
try {
|
||
|
emrView.ReadOnly = false; // 取消只读
|
||
|
emrView.Clear();
|
||
|
let vFirstProc = emrView.ProcCount == 0; // 插入的病程是不是病历第一个病程
|
||
|
var vPropertys = ""; //
|
||
|
emrView.InsertProc(data.emrId, vPropertys, ""); // 插入病程标识
|
||
|
emrView.EditProcIndex = data.emrId; // 当前可编辑病程为新病程的唯一ID(字符型)
|
||
|
proceData.set("DE09.00.053.00",data.operatortime);
|
||
|
if (vFirstProc) { // 是病历首次新建内容,需要加载页眉页脚
|
||
|
emrView.LoadHeaderFromBytes(dataByte, true); // true加载纸张大小和页边距
|
||
|
emrView.LoadFooterFromBytes(dataByte, false);
|
||
|
}
|
||
|
|
||
|
emrView.SetProcByFileSteam(emrView.EditProcIndex, dataByte); // 设置新建的病程内容
|
||
|
emrView.ClearUndo(); // 清除撤销恢复记录,防止新建后用户撤销
|
||
|
emrView.InnerView.ResetActiveSectionMargin(); // 重新格式化
|
||
|
} finally {
|
||
|
emrView.EndUpdate();
|
||
|
}
|
||
|
|
||
|
emrView.ScrollToProc(emrView.EditProcIndex); // 滚动到新建的病程位置,便于书写
|
||
|
}
|
||
|
//save病历
|
||
|
var sectionData =data.sectionData;
|
||
|
for(prop in sectionData){
|
||
|
emrView.SetDeGroupByText(prop, sectionData[prop]);
|
||
|
}
|
||
|
var consultation = data.consultation;
|
||
|
for(prop in consultation){
|
||
|
emrView.SetDeGroupByText(prop, consultation[prop]);
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
}finally{
|
||
|
//save病历
|
||
|
// var steamData = emrView.SaveToBytes();
|
||
|
// var emrData = new EmrToWatData("B","saveEMRByte",steamData);
|
||
|
// return window.parent.top.DxURLPage.action(GetQueryString('strwinid'),GetQueryString('strctrid'),JSON.stringify(emrData),false);
|
||
|
}
|
||
|
},
|
||
|
|
||
|
"emrLiteInit" :function(data){//初始化关键词
|
||
|
|
||
|
if(data.emrContent==undefined){
|
||
|
|
||
|
}else{
|
||
|
// emrView.InnerView.Clear();
|
||
|
var dataByte = new Uint8Array(data.emrContent);
|
||
|
if(dataByte.length>0){
|
||
|
emrView.InsertLiteBytes(dataByte);
|
||
|
}else{
|
||
|
alert("当前文档不存在");
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
},
|
||
|
|
||
|
"insertDeItem":function(data){
|
||
|
console.log("InsertDeItem:"+data);
|
||
|
console.log("InsertDeItem:"+JSON.stringify(data));
|
||
|
emrView.InsertDeItem(data);
|
||
|
},
|
||
|
"insertDeGroup":function(data){
|
||
|
console.log("insertDeGroup:"+JSON.stringify(data));
|
||
|
emrView.InsertDeGroup(data);
|
||
|
},
|
||
|
"insertDeDateTime":function(data){//插入日期时间
|
||
|
console.log("insertDeDateTime:"+JSON.stringify(data));
|
||
|
emrView.InsertDeItem(data);
|
||
|
},
|
||
|
"insertText":function(data){
|
||
|
console.log("insertText:"+JSON.stringify(data));
|
||
|
console.log("insertText:"+data.text);
|
||
|
emrView.InsertText(data.text);
|
||
|
},
|
||
|
"insertDeRadioGroup":function(data){
|
||
|
console.log("insertDeRadioGroup:"+JSON.stringify(data));
|
||
|
emrView.InsertDeRadioGroup(data);
|
||
|
},
|
||
|
"insertDeCheckBox":function(data){
|
||
|
console.log("insertDeCheckBox:"+JSON.stringify(data));
|
||
|
emrView.InsertDeCheckBox(data);
|
||
|
},
|
||
|
"insertDeCheckBoxList":function(data){
|
||
|
console.log("insertDeCheckBox:"+JSON.stringify(data));
|
||
|
if(data instanceof Array){
|
||
|
data.forEach(function(item,i){
|
||
|
console.log(item.event);
|
||
|
if(item.event =="insertDeRadioGroup"){
|
||
|
console.log(item.data);
|
||
|
emrView.InsertDeRadioGroup(item.data);
|
||
|
}
|
||
|
|
||
|
});
|
||
|
}
|
||
|
},
|
||
|
"insertDeEdit": function(data) {//插入Edit控件
|
||
|
let edit = emrView.InsertDeEdit(data);
|
||
|
edit.PrintOnlyText = false;
|
||
|
edit.BorderSides.remove(1 << 1);
|
||
|
edit.BorderSides.remove(1 << 2);
|
||
|
edit.BorderSides.remove(1);
|
||
|
// emrView.InnerView.ActiveSection.ReFormatActiveItem();
|
||
|
// emrView.InnerView.EndUpdate();
|
||
|
},
|
||
|
"insertDeImage":function(data){//插入签名图片
|
||
|
console.log("insertDeImage:"+JSON.stringify(data));
|
||
|
emrView.InsertDeImage(data);
|
||
|
},
|
||
|
"insertProc":function(data){//插入病程
|
||
|
try{
|
||
|
console.log("insertProc:"+JSON.stringify(data));
|
||
|
var bytes =new Uint8Array(data.emrContent);
|
||
|
console.log(bytes);
|
||
|
if (bytes.length == 0)
|
||
|
return;
|
||
|
// 病程时间,实际业务应该取服务端时间
|
||
|
var vDate = new Date();
|
||
|
var vDateTime = data.operatortime;
|
||
|
|
||
|
// 病程属性,可添加病程控制相关的属性,每个属性是一个键值对,多个属性以\r\n分隔
|
||
|
var vPropertys = ""+EmrProp.OPERATOR+"="+data._operator+"\r\n"+EmrProp.OPERATORTIME+"=" + vDateTime+"\r\n"+EmrProp.OPERATORSIGN+"="
|
||
|
+data.operatorsign+"\r\n"+EmrProp.Choscode+"="+data.choscode+"\r\n"+EmrProp.QCR+"="+data.qcr; // 用户jt,日期vDateTime
|
||
|
//设置病程的属性。
|
||
|
proceData.set("DE02.01.039.00",data._operator);
|
||
|
proceData.set("DE09.00.053.00",vDateTime);
|
||
|
// 病程唯一ID,这里使用了当前时间,实际业务使用时可换为业务里的病程唯一ID生成规则
|
||
|
var vProcIndex = data.emrId;
|
||
|
|
||
|
// 在指定的病程(ID为vBeforProcIndex)前面插入新病程,如为""表示在最后插入病程
|
||
|
var vBeforProcIndex = data.preEmrProcessId;//通过后台计算得到的preEmrProcessId
|
||
|
|
||
|
// 当前病历是否没有病程,即要插入的病程是否为整个病历的第一个病程
|
||
|
var vFirstProc = emrView.ProcCount == 0;
|
||
|
|
||
|
emrView.ReadOnly = false; // 病历切换为非只读
|
||
|
emrView.InsertProcing = true; // 插入病程正在进行中
|
||
|
try {
|
||
|
// 插入病程标识
|
||
|
if (emrView.InsertProc(vProcIndex, vPropertys, vBeforProcIndex)) { // 插入病程标识成功
|
||
|
console.log("插入病程,标识为:" + vProcIndex);
|
||
|
emrView.EditProcIndex = vProcIndex; // 当前编辑的病程为新插入的病程
|
||
|
emrView.SetProcBytes(vProcIndex, bytes); // 设置当前病程的内容s
|
||
|
if (vFirstProc) { // 是整个病历的第一个病程
|
||
|
emrView.BeginUpdate(); // 开启批量更新,提高效率
|
||
|
try {
|
||
|
emrView.LoadHeaderFromBytes(bytes); // 加载页眉
|
||
|
emrView.LoadFooterFromBytes(bytes); // 加载页脚
|
||
|
} finally {
|
||
|
emrView.EndUpdate();
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
} finally {
|
||
|
emrView.InsertProcing = false; // 病程插入完成了
|
||
|
//插入病程完成后,初始化会诊意见相关的数据组。
|
||
|
var consultationOpinionsData = data.consultationOpinionsData;
|
||
|
for(prop in consultationOpinionsData){
|
||
|
emrView.SetDeGroupByText(prop, consultationOpinionsData[prop]);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
emrView.ClearUndo(); // 清空撤销记录,防止用户把新插入的病程撤销了
|
||
|
}finally{
|
||
|
//save病历
|
||
|
var steamData = emrView.SaveToBytes();
|
||
|
var emrData = new EmrToWatData("B","saveEMRByte",steamData);
|
||
|
return window.parent.top.DxURLPage.action(GetQueryString('strwinid'),GetQueryString('strctrid'),JSON.stringify(emrData),false);
|
||
|
}
|
||
|
|
||
|
|
||
|
},
|
||
|
|
||
|
"delCaretProcInfo":function(data){//删除病程
|
||
|
console.log("删除病程记录id:"+data.emrId);
|
||
|
try{
|
||
|
// emrView.DeleteProc(data.emrId);
|
||
|
emrView.ReadOnly=false;
|
||
|
emrView.EditProcIndex = emrView.CaretProcInfo.Index;
|
||
|
emrView.DeleteProc(emrView.CaretProcInfo.Index);
|
||
|
}finally{
|
||
|
//删除病程之后需要调保存病历
|
||
|
var steamData = emrView.SaveToBytes();
|
||
|
var emrData = new EmrToWatData("B","saveEMRByte",steamData);
|
||
|
return window.parent.top.DxURLPage.action(GetQueryString('strwinid'),GetQueryString('strctrid'),JSON.stringify(emrData),false);
|
||
|
}
|
||
|
},
|
||
|
"locationEmrId":function(data){
|
||
|
console.log("定位病程记录Id:"+data.emrId);
|
||
|
emrView.ScrollToProc(data.emrId);
|
||
|
},
|
||
|
"cancelSignatureGraphic":function(data){
|
||
|
try{
|
||
|
console.log("取消签名:"+data.emrId);
|
||
|
//取消签名后将病程图片清除掉,要修改病程自带的属性。
|
||
|
if(""!=emrView.CaretProcInfo.Index){//病程
|
||
|
emrView.SetProcProperty(data.emrId, EmrProp.OPERATORSIGN, data.operatorSign);//
|
||
|
}else{
|
||
|
emrView._Emr[EmrProp.OPERATORSIGN]=data.operatorSign;
|
||
|
}
|
||
|
|
||
|
}finally{
|
||
|
var steamData = emrView.SaveToBytes();
|
||
|
var emrData = new EmrToWatData("B","saveEMRByte",steamData);
|
||
|
return window.parent.top.DxURLPage.action(GetQueryString('strwinid'),GetQueryString('strctrid'),JSON.stringify(emrData),false);
|
||
|
}
|
||
|
|
||
|
},
|
||
|
"insertDiagnose":function(data){
|
||
|
var diagArr = data.diagnose;
|
||
|
var index = data.selectId;
|
||
|
console.log(diagArr);
|
||
|
var diagStr ="";
|
||
|
var separator=" ";
|
||
|
if(diagArr instanceof Array){
|
||
|
diagArr.forEach(function(item,index){
|
||
|
var itemstr=item.split("=");
|
||
|
var key = itemstr[0];
|
||
|
var value =itemstr[1];
|
||
|
console.log(typeof key);
|
||
|
for(var i =0;i<key;i++){
|
||
|
diagStr= diagStr+separator;
|
||
|
}
|
||
|
if(index==diagArr.length-1){
|
||
|
diagStr=diagStr+value;
|
||
|
}else{
|
||
|
diagStr=diagStr+value+"\r\n";
|
||
|
}
|
||
|
|
||
|
|
||
|
});
|
||
|
console.log(diagStr);
|
||
|
try{
|
||
|
emrView.SetCaretDeGroupByText(diagStr);
|
||
|
}finally{
|
||
|
var steamData = emrView.SaveToBytes();
|
||
|
var emrData = new EmrToWatData("B","saveEMRByte",steamData);
|
||
|
return window.parent.top.DxURLPage.action(GetQueryString('strwinid'),GetQueryString('strctrid'),JSON.stringify(emrData),false);
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
},
|
||
|
"getCopyText": function(){//获取复制的内容
|
||
|
var emrData = new EmrToWatData("S","getCopyText",emrView.InnerView.SaveSelectToText());
|
||
|
return window.parent.top.DxURLPage.action(GetQueryString('strwinid'),GetQueryString('strctrid'),JSON.stringify(emrData),false);
|
||
|
|
||
|
},
|
||
|
|
||
|
"insertCopyText": function(data){//插入复制内容
|
||
|
emrView.InsertText(data);
|
||
|
},
|
||
|
|
||
|
"editDeItem": function(data){//设置数据元属性
|
||
|
var index = data.Index;
|
||
|
// console.log("数据元id====:"+data.Code);
|
||
|
//console.log("数据元id:"+index+","+data.Code+","+data.Name+","+data.Unit+","+data.HideUnit+","+data.PreFormat);
|
||
|
emrView.SetDeItemProperty(index, "Code", data.Code==undefined?"":data.Code);
|
||
|
emrView.SetDeItemProperty(index, "Name", data.Name==undefined?"":data.Name);
|
||
|
emrView.SetDeItemProperty(index, "Unit", data.Unit==undefined?"":data.Unit);
|
||
|
emrView.SetDeItemProperty(index, "HideUnit", data.HideUnit==undefined?"":data.HideUnit);
|
||
|
emrView.SetDeItemProperty(index, "PreFormat", data.PreFormat==undefined?"":data.PreFormat);
|
||
|
emrView.SetDeItemProperty(index, "Raw", data.Raw==undefined?"":data.Raw);
|
||
|
emrView.SetDeItemProperty(index, "CMV", data.CMV==undefined?"":data.CMV);
|
||
|
emrView.SetDeItemProperty(index, "CMVVCode", data.CMVVCode==undefined?"":data.CMVVCode);
|
||
|
emrView.SetDeItemProperty(index, "Trace", data.Trace==undefined?"":data.Trace);
|
||
|
emrView.SetDeItemProperty(index, "Secret", data.Secret==undefined?"":data.Secret);
|
||
|
emrView.SetDeItemProperty(index, "Text", data.Name==undefined?"":data.Name);
|
||
|
emrView.SetDeItemProperty(index, "ItemMutex", data.ItemMutex==undefined?"":data.ItemMutex);
|
||
|
emrView.SetDeItemProperty(index, "Frmtp", data.Frmtp==undefined?"":data.Frmtp);
|
||
|
emrView.SetDeItemProperty(index, "MutexYes", data.MutexYes==undefined?"":data.MutexYes);
|
||
|
emrView.SetDeItemProperty(index, "MutexNo", data.MutexNo==undefined?"":data.MutexNo);
|
||
|
},
|
||
|
|
||
|
"editDeGroup": function(data){//设置数据元属性
|
||
|
var index = data.Index;
|
||
|
console.log("数据元id====:"+data.Code);
|
||
|
emrView.setDeGroupText("S0025", "Code");
|
||
|
//console.log("数据元id:"+index+","+data.Code+","+data.Name+","+data.Unit+","+data.HideUnit+","+data.PreFormat);
|
||
|
emrView.SetDeGroupProperty(index, "Code", data.Code==undefined?"":data.Code);
|
||
|
emrView.SetDeGroupProperty(index, "Name", data.Name==undefined?"":data.Name);
|
||
|
|
||
|
},
|
||
|
|
||
|
"setDeGroupText": function(data){//设置数据元属性
|
||
|
var index = data.Index;
|
||
|
// console.log("数据元id====:"+data.Code);
|
||
|
//console.log("数据元id:"+index+","+data.Code+","+data.Name+","+data.Unit+","+data.HideUnit+","+data.PreFormat);
|
||
|
emrView.setDeGroupText("333682957418893312", "Code");
|
||
|
|
||
|
},
|
||
|
|
||
|
"saveEmrContent": function(){//设置数据元属性
|
||
|
feedbackEmrStreamToWat(true);
|
||
|
},
|
||
|
|
||
|
"traverseElement": function(){
|
||
|
let vAreas = new Set([]);
|
||
|
// vAreas.add(1);
|
||
|
vAreas.add(2);
|
||
|
// vAreas.add(4);
|
||
|
emrView._emrDataElement = new Array();
|
||
|
emrView.TraverseElement(traverseFun, vAreas, 0);
|
||
|
var emrData = new EmrToWatData("json","traverseElement",emrView._emrDataElement);
|
||
|
return window.parent.top.DxURLPage.action(GetQueryString('strwinid'),GetQueryString('strctrid'),JSON.stringify(emrData),false);
|
||
|
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
}
|
||
|
|
||
|
|
||
|
exports.watToEMREvent=function(data){
|
||
|
return watToEMREvents[data.event](data.data);
|
||
|
}
|
||
|
exports.emrToWatEvent=function(data,isasyn){
|
||
|
var asyn = false;
|
||
|
if(isasyn != undefined) {
|
||
|
asyn = isasyn;
|
||
|
}
|
||
|
window.parent.top.DxURLPage.action(GetQueryString('strwinid'),GetQueryString('strctrid'),JSON.stringify(data),asyn);
|
||
|
}
|
||
|
|
||
|
exports.getDeItemDomain= function(data,url){
|
||
|
var request = new XMLHttpRequest();
|
||
|
var respData;
|
||
|
request.open('POST', url, false);
|
||
|
request.setRequestHeader("Content-type","application/json");
|
||
|
request.onload = function(e){
|
||
|
console.log("请求成功")
|
||
|
if (request.status === 200) {
|
||
|
console.log('设置回调事件成功!');
|
||
|
var b = request.responseText;
|
||
|
respData = JSON.parse(b);
|
||
|
}
|
||
|
else{
|
||
|
alert('设置失败,请重试!');
|
||
|
|
||
|
}
|
||
|
}
|
||
|
request.send(JSON.stringify(data));
|
||
|
// request.onerror = function(e){
|
||
|
// alert('请求失败')
|
||
|
// }
|
||
|
// request.onprocess = function(e){
|
||
|
// console.log("正在请求");
|
||
|
// }
|
||
|
return respData;
|
||
|
}
|
||
|
exports.getOperatorSignPic= function(data,url){
|
||
|
var xhr = new XMLHttpRequest();
|
||
|
xhr.open("POST", url, true);
|
||
|
// xhr.responseType = "arraybuffer";
|
||
|
xhr.onload = function(e) {
|
||
|
if (xhr.status == 200) {
|
||
|
try{
|
||
|
var respData = JSON.parse(xhr.response);
|
||
|
var operatorsign = respData.operatorsign;//是否签字
|
||
|
var emrId = respData.emrId;//病程id
|
||
|
var code = respData.code;//签名对应的cda编码
|
||
|
var signPic = respData.signPic;//签名字节流
|
||
|
var signName = respData.signName;//签名
|
||
|
var operator = respData.operator;//签名
|
||
|
var index = respData.signPicId;//签名图片对应的Index
|
||
|
var uInt8Array = new Uint8Array(signPic);
|
||
|
var i = uInt8Array.length;
|
||
|
var binaryString = new Array(i);
|
||
|
while (i--){
|
||
|
binaryString[i] = String.fromCharCode(uInt8Array[i]);
|
||
|
}
|
||
|
var data = binaryString.join('');
|
||
|
//如果没有对应的医生签名,则插入数据元
|
||
|
if(data == ""){
|
||
|
emrView.InsertDeItem({
|
||
|
Index: "sign_"+operator, // 数据元唯一ID
|
||
|
Name: signName, // 数据元名称
|
||
|
Text: signName, // 默认内容,注意设置默认内容后数据元的是否填写过值为true 如果想置为false,需要设置 AllocValue: "0"
|
||
|
Code: code
|
||
|
});
|
||
|
//设置当前病历为已签名
|
||
|
if(""!=emrView.CaretProcInfo.Index){//病程
|
||
|
emrView.SetProcProperty(emrId, EmrProp.OPERATORSIGN, operatorsign);
|
||
|
}else{
|
||
|
emrView.InnerView.SetValue(EmrProp.OPERATORSIGN, operatorsign);
|
||
|
emrView._Emr[EmrProp.OPERATORSIGN]=operatorsign;
|
||
|
}
|
||
|
var steamData = emrView.SaveToBytes();
|
||
|
var emrData = new EmrToWatData("B","saveEMRByte",steamData);
|
||
|
window.parent.top.DxURLPage.action(GetQueryString('strwinid'),GetQueryString('strctrid'),JSON.stringify(emrData),false);
|
||
|
}else{
|
||
|
var base64 = window.btoa(data);
|
||
|
// var dataUrl = "data:" + (outputFormat || "image/png") + ";base64," + base64;
|
||
|
emrView.InsertDeImage({
|
||
|
Index: "sign_"+operator,
|
||
|
Name: signName,
|
||
|
Code: code,
|
||
|
Base64: base64,
|
||
|
Width:60,
|
||
|
Height:35,
|
||
|
ImageType: "png",
|
||
|
CanResize: false, // 不允许手动缩放改变大小
|
||
|
LoadedEvent: function () {
|
||
|
console.log("替换图片完成!");
|
||
|
//设置当前病历为已签名
|
||
|
if(""!=emrView.CaretProcInfo.Index){//病程
|
||
|
emrView.SetProcProperty(emrId, EmrProp.OPERATORSIGN, operatorsign);
|
||
|
}else{
|
||
|
emrView.InnerView.SetValue(EmrProp.OPERATORSIGN, operatorsign);
|
||
|
emrView._Emr[EmrProp.OPERATORSIGN]=operatorsign;
|
||
|
}
|
||
|
//加载完成后保存文件
|
||
|
var steamData = emrView.SaveToBytes();
|
||
|
var emrData = new EmrToWatData("B","saveEMRByte",steamData);
|
||
|
window.parent.top.DxURLPage.action(GetQueryString('strwinid'),GetQueryString('strctrid'),JSON.stringify(emrData),false);
|
||
|
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
|
||
|
|
||
|
}finally{
|
||
|
|
||
|
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
}
|
||
|
|
||
|
xhr.send(JSON.stringify(data));
|
||
|
}
|
||
|
exports.getLiteByte= function(data,url){
|
||
|
var xhr = new XMLHttpRequest();
|
||
|
xhr.open("POST", url, true);
|
||
|
// xhr.responseType = "arraybuffer";
|
||
|
xhr.onload = function(e) {
|
||
|
if (xhr.status == 200) {
|
||
|
try{
|
||
|
var respData = JSON.parse(xhr.response);
|
||
|
|
||
|
var liteByte = respData.liteByte;
|
||
|
var uInt8Array = new Uint8Array(liteByte);
|
||
|
emrView.SetActiveItemExtraByBytes(uInt8Array);
|
||
|
|
||
|
}finally{
|
||
|
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
}
|
||
|
|
||
|
xhr.send(JSON.stringify(data));
|
||
|
}
|
||
|
exports.getHcData=function(){
|
||
|
return hcData;
|
||
|
}
|
||
|
exports.getProceData = function(){
|
||
|
return proceData;
|
||
|
}
|
||
|
exports.getEventData = function(){
|
||
|
return eventData;
|
||
|
}
|
||
|
|
||
|
exports.setIntervalSave= function(){
|
||
|
setTimeout(function(){
|
||
|
var steamData = emrView.SaveToBytes();
|
||
|
var emrData = new EmrToWatData("B","saveEMRByte",steamData);
|
||
|
window.parent.top.DxURLPage.action(GetQueryString('strwinid'),GetQueryString('strctrid'),JSON.stringify(emrData),false);
|
||
|
setTimeout(arguments.callee,5000)
|
||
|
},5000);
|
||
|
}
|
||
|
// 遍历编辑器中的数据元
|
||
|
exports.traverseElement_wat = function(){
|
||
|
/*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._dataStr ="";//用来保存待解析的数据
|
||
|
emrView._dataMark=false;//解析数据组和字符串
|
||
|
emrView._saveEmrData={};//
|
||
|
emrView._nullEmrDataArray=[];//用来存储未填写的数据元
|
||
|
emrView._emrDataElement_wat =[];//用来存储病历中的数据元,加后缀防止污染框架内变量
|
||
|
emrView._currentDataGroup="";
|
||
|
emrView._emrId="";
|
||
|
emrView.TraverseElement(traverseFun_wat, vAreas, 0);
|
||
|
console.log(emrView._emrDataElement_wat);
|
||
|
console.log(emrView._saveEmrData);
|
||
|
//如果遍历中有修改数据,需要重新排版
|
||
|
// emrView.InnerView.FormatData();
|
||
|
}
|
||
|
|
||
|
exports.url=realPath+"/emreventaction";
|
||
|
})(this.watEvents={});
|