|
|
@@ -1109,7 +1109,7 @@ function loadCardList() {
|
|
|
} else {
|
|
|
var printFlag = isEmpty(mzyReqrecVo.mzyReqrec.printerId);
|
|
|
if(fpVsesionNo == 1){
|
|
|
- html += ' <button type="button" class="registration-no-color-foot-button" title="打印并上传电子发票" onclick="prn1Print(\'' + mzyReqrecVo.mzyReqrec.patientId + '\',' + mzyReqrecVo.mzyReqrec.times + ')">';
|
|
|
+ html += ' <button type="button" class="registration-no-color-foot-button" title="打印并上传电子发票" onclick="prn1PrintAndQRCode(\'' + mzyReqrecVo.mzyReqrec.patientId + '\',' + mzyReqrecVo.mzyReqrec.times +',\'' + mzyReqrecVo.mzyReqrec.serialNo + '\'' + ')">';
|
|
|
}
|
|
|
else if (printFlag && fpVsesionNo == 0) {
|
|
|
html += ' <button type="button" class="registration-no-color-foot-button" title="打印" onclick="prn1Print(\'' + mzyReqrecVo.mzyReqrec.patientId + '\',' + mzyReqrecVo.mzyReqrec.times + ')">';
|
|
|
@@ -1170,7 +1170,7 @@ function loadCardList() {
|
|
|
} else {
|
|
|
var printFlag = isEmpty(mzyReqrecVo.mzyReqrec.printerId);
|
|
|
if(fpVsesionNo == 1){
|
|
|
- html += ' <button type="button" class="registration-no-color-foot-button" title="打印并上传电子发票" onclick="prn1Print(\'' + mzyReqrecVo.mzyReqrec.patientId + '\',' + mzyReqrecVo.mzyReqrec.times + ')">';
|
|
|
+ html += ' <button type="button" class="registration-no-color-foot-button" title="打印并上传电子发票" onclick="prn1PrintAndQRCode(\'' + mzyReqrecVo.mzyReqrec.patientId + '\',' + mzyReqrecVo.mzyReqrec.times +',\'' + mzyReqrecVo.mzyReqrec.serialNo + '\'' + ')">';
|
|
|
}
|
|
|
else if (printFlag && fpVsesionNo ==0) {
|
|
|
html += ' <button type="button" class="registration-no-color-foot-button" title="打印" onclick="prn1Print(\'' + mzyReqrecVo.mzyReqrec.patientId + '\',' + mzyReqrecVo.mzyReqrec.times + ')">';
|
|
|
@@ -1420,7 +1420,7 @@ function loadTableList() {
|
|
|
} else {
|
|
|
var printFlag = isEmpty(row.mzyReqrec.printerId);
|
|
|
if(fpVsesionNo == 1){
|
|
|
- html += ' <button type="button" class="registration-no-color-foot-button" title="打印并上传电子发票" onclick="prn1Print(\'' + row.mzyReqrec.patientId + '\',' + row.mzyReqrec.times + ')">';
|
|
|
+ html += ' <button type="button" class="registration-no-color-foot-button" title="打印并上传电子发票" onclick="prn1PrintAndQRCode(\'' + row.mzyReqrec.patientId + '\',' + row.mzyReqrec.times +',\'' + row.mzyReqrec.serialNo + '\'' + ')">';
|
|
|
}
|
|
|
else if (printFlag && fpVsesionNo == 0) {
|
|
|
html += ' <button type="button" class="registration-no-color-foot-button" title="打印" onclick="prn1Print(\'' + row.mzyReqrec.patientId + '\',' + row.mzyReqrec.times + ')">';
|
|
|
@@ -1453,7 +1453,7 @@ function loadTableList() {
|
|
|
} else {
|
|
|
var printFlag = isEmpty(row.mzyReqrec.printerId);
|
|
|
if(fpVsesionNo == 1){
|
|
|
- html += ' <button type="button" class="registration-no-color-foot-button" title="打印并上传电子发票" onclick="prn1Print(\'' + row.mzyReqrec.patientId + '\',' + row.mzyReqrec.times + ')">';
|
|
|
+ html += ' <button type="button" class="registration-no-color-foot-button" title="打印并上传电子发票" onclick="prn1PrintAndQRCode(\'' + row.mzyReqrec.patientId + '\',' + row.mzyReqrec.times +',\'' + row.mzyReqrec.serialNo + '\'' + ')">';
|
|
|
}
|
|
|
else if (printFlag && fpVsesionNo == 0) {
|
|
|
html += ' <button type="button" class="registration-no-color-foot-button" title="打印" onclick="prn1Print(\'' + row.mzyReqrec.patientId + '\',' + row.mzyReqrec.times + ')">';
|
|
|
@@ -1770,16 +1770,23 @@ function openDzfpDownModal(patientId,times,serialNo) {
|
|
|
* @param type 1 打印二维码 2 下载pdf
|
|
|
*/
|
|
|
function downOrPrintDzfp(type) {
|
|
|
- downloadInvoice(dzfp_patientId,dzfp_times,dzfp_serialNo)
|
|
|
+ downloadInvoice(dzfp_patientId,dzfp_times,dzfp_serialNo,type)
|
|
|
}
|
|
|
|
|
|
//下载电子发票
|
|
|
-function downloadInvoice(patientId,times,serialNo) {
|
|
|
+function downloadInvoice(patientId,times,serialNo,type) {
|
|
|
+//createInMemoryQR()
|
|
|
setPrint();
|
|
|
postAjaxJsonHttpRequst("/thmz/selectDzfpUploadAboutSerialNo",{patientId:patientId,times:times,serialNo:serialNo,},true,function (res) {
|
|
|
if(res.code == 0){
|
|
|
+// $("#dzfpDownModal").modal("hide");
|
|
|
if(res.data.resUrl){
|
|
|
- window.open(res.data.resUrl)
|
|
|
+
|
|
|
+ if(type == 2 || !stringNotBlank(type)){
|
|
|
+ window.open(res.data.resUrl)
|
|
|
+ }else {
|
|
|
+ //打印二维码
|
|
|
+ }
|
|
|
} else {
|
|
|
errorMesage("未获取到电子发票,请重新上传发票!");
|
|
|
}
|
|
|
@@ -1789,7 +1796,115 @@ function downloadInvoice(patientId,times,serialNo) {
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
+//获取电子发票地址base64
|
|
|
+function getInvoiceBase64(patientId,times,serialNo) {
|
|
|
+ var imgsrc = ""
|
|
|
+ postAjaxJsonHttpRequst("/thmz/selectDzfpUploadAboutSerialNo",{patientId:patientId,times:times,serialNo:serialNo},true,function (res) {
|
|
|
+ if(res.code == 0){
|
|
|
+ if(res.data.resUrl){
|
|
|
+//
|
|
|
+ return createInMemoryQR(res.data.resUrl);
|
|
|
+
|
|
|
+ } else {
|
|
|
+ errorMesage("未获取到电子发票,请重新上传发票!");
|
|
|
+ }
|
|
|
|
|
|
+ }else {
|
|
|
+ errorMesage(res)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ console.log("imgsrc",imgsrc)
|
|
|
+ return imgsrc;
|
|
|
+}
|
|
|
+
|
|
|
+function createInMemoryQR(url) {
|
|
|
+try {
|
|
|
+ // 创建不可见的临时容器
|
|
|
+ const tempContainer = document.createElement('div');
|
|
|
+ tempContainer.style.display = 'none';
|
|
|
+ document.body.appendChild(tempContainer);
|
|
|
+
|
|
|
+ // 在临时容器中生成二维码
|
|
|
+ new QRCode(tempContainer, {
|
|
|
+ text: url,
|
|
|
+ width: 200,
|
|
|
+ height: 200,
|
|
|
+ margin: 2,
|
|
|
+ color: {
|
|
|
+ dark: '#1a2980',
|
|
|
+ light: '#ffffff'
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ // 等待一小段时间确保二维码生成完成
|
|
|
+ // 注意:这是一个简化处理,实际生产环境中可能需要更可靠的检测机制
|
|
|
+ let attempts = 0;
|
|
|
+ while (!tempContainer.querySelector('canvas') && attempts < 10) {
|
|
|
+ attempts++;
|
|
|
+ // 短暂延迟
|
|
|
+ for (let i = 0; i < 1000000; i++);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 获取生成的二维码canvas
|
|
|
+ const qrCanvas = tempContainer.querySelector('canvas');
|
|
|
+ if (!qrCanvas) {
|
|
|
+ throw new Error('二维码生成失败');
|
|
|
+ }
|
|
|
+
|
|
|
+ // 创建内存中的canvas并复制内容
|
|
|
+ const canvas = document.createElement('canvas');
|
|
|
+ canvas.width = qrCanvas.width;
|
|
|
+ canvas.height = qrCanvas.height;
|
|
|
+ const ctx = canvas.getContext('2d');
|
|
|
+ ctx.drawImage(qrCanvas, 0, 0);
|
|
|
+
|
|
|
+ // 清理临时容器
|
|
|
+ document.body.removeChild(tempContainer);
|
|
|
+
|
|
|
+ // 返回Base64数据
|
|
|
+ return canvas.toDataURL('image/png');
|
|
|
+} catch (error) {
|
|
|
+ alert('生成失败: ' + error.message);
|
|
|
+ return null;
|
|
|
+}
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+//function createInMemoryQR() {
|
|
|
+// const canvas = document.createElement('canvas');
|
|
|
+// new QRCode(canvas, {
|
|
|
+// text: "http://einvoice.jsczt.cn/d/473012378d11a2052bf",
|
|
|
+// width: 200,
|
|
|
+// height: 200
|
|
|
+// });
|
|
|
+// // 显示二维码(可选)
|
|
|
+// const img = document.createElement('img');
|
|
|
+// img.src = canvas.toDataURL('image/png');
|
|
|
+// img.alt = '生成的二维码';
|
|
|
+// document.getElementById('qrcodeImg').appendChild(img);
|
|
|
+//// try {
|
|
|
+//// // 创建内存中的canvas
|
|
|
+//// const canvas = document.createElement('canvas');
|
|
|
+////
|
|
|
+//// // 直接在canvas上生成二维码
|
|
|
+//// new QRCode(canvas, {
|
|
|
+//// text: "http://einvoice.jsczt.cn/d/473012378d11a2052bf",
|
|
|
+//// width: 200,
|
|
|
+//// height: 200,
|
|
|
+//// margin: 2,
|
|
|
+//// color: {
|
|
|
+//// dark: '#1a2980',
|
|
|
+//// light: '#ffffff'
|
|
|
+//// }
|
|
|
+//// });
|
|
|
+////
|
|
|
+//// // 直接从canvas获取Base64数据
|
|
|
+// return canvas.toDataURL('image/png');
|
|
|
+//// } catch (error) {
|
|
|
+//// alert('生成失败: ' + error.message);
|
|
|
+//// return null;
|
|
|
+//// }
|
|
|
+//}
|
|
|
|
|
|
/**
|
|
|
* 直接打印发票
|
|
|
@@ -1819,6 +1934,7 @@ function prn1Print(patientId, times) {
|
|
|
if (res.data == null || res.data.length == 0) {
|
|
|
return;
|
|
|
}
|
|
|
+// getInvoiceBase64();
|
|
|
// countReceiot++;
|
|
|
LODOP = getLodop();
|
|
|
var temp = res.data;
|
|
|
@@ -1868,8 +1984,128 @@ function prn1Print(patientId, times) {
|
|
|
LODOP.ADD_PRINT_TEXT("42mm", "3mm", "50mm", "3mm", "号段:" + temp.ampm);
|
|
|
LODOP.ADD_PRINT_TEXT("48mm", "3mm", "50mm", "3mm", "号别:" + temp.chargeType);
|
|
|
LODOP.ADD_PRINT_TEXT("54mm", "3mm", "50mm", "3mm", "收费员:"+res.user.userName);//收费员
|
|
|
+ LODOP.ADD_PRINT_TEXT("60mm", "3mm", "60mm", "3mm", "发票二维码");
|
|
|
+// LODOP.ADD_PRINT_IMAGE("70mm", "3mm", "50mm", "50mm", createInMemoryQR("http://einvoice.jsczt.cn/d/473012378d11a2052bf"));
|
|
|
+// console.log("img",createInMemoryQR("http://einvoice.jsczt.cn/d/473012378d11a2052bf"))
|
|
|
+ }
|
|
|
+ LODOP.PREVIEW();
|
|
|
+ if(fpVsesionNo == 1){
|
|
|
+ //上传电子发票
|
|
|
+ uploadBlueInvoice(patientId, times)
|
|
|
+ }
|
|
|
+ if (times > 0) {
|
|
|
+ loadTableCount();
|
|
|
+ loadRegistrationList(true);
|
|
|
+ }
|
|
|
+ } else if (res.code == -1) {
|
|
|
+ new PNotify({
|
|
|
+ title: '错误提示',
|
|
|
+ text: res.message,
|
|
|
+ type: 'error',
|
|
|
+ hide: true,
|
|
|
+ styling: 'bootstrap3'
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+};
|
|
|
+
|
|
|
+/**
|
|
|
+ * 直接打印发票
|
|
|
+ * @param patientId
|
|
|
+ */
|
|
|
+function prn1PrintAndQRCode(patientId, times,serialNo) {
|
|
|
+ getInvoiceBase64(patientId,times,serialNo)
|
|
|
+ setPrint();
|
|
|
+ var height = "93.15mm";
|
|
|
+ var bkimgWidth = "120mm"
|
|
|
+ if(fpVsesionNo == 1){
|
|
|
+ height = "60mm"
|
|
|
+ bkimgWidth = "110mm"
|
|
|
+ }
|
|
|
+ $.ajax({
|
|
|
+ type: "GET",
|
|
|
+ url: '/thmz/printMzyReqrecRecept?patientId=' + patientId + "×=" + times,
|
|
|
+ contentType: "application/json;charset=UTF-8",
|
|
|
+ dataType: "json",
|
|
|
+ headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
|
|
|
+ async: false,
|
|
|
+ success: function (res) {
|
|
|
+ if (res == '401' || res == 401) {
|
|
|
+ window.location.href = '/thmz/login/view'
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (res.code == 0) {
|
|
|
+ if (res.data == null || res.data.length == 0) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ // countReceiot++;
|
|
|
+ LODOP = getLodop();
|
|
|
+ var temp = res.data;
|
|
|
+ LODOP.PRINT_INITA(6, 0, bkimgWidth, height, "铭和门诊发票打印");
|
|
|
+ //设置默认打印机
|
|
|
+ LODOP.SET_PRINTER_INDEX(printIndex);
|
|
|
+ LODOP.SET_SHOW_MODE("BKIMG_WIDTH", bkimgWidth);
|
|
|
+ LODOP.SET_SHOW_MODE("BKIMG_HEIGHT", height);
|
|
|
+ LODOP.SET_PRINT_PAGESIZE(1,bkimgWidth, height, "CreateCustomPage");
|
|
|
+ LODOP.SET_PRINT_MODE("CREATE_CUSTOM_PAGE_NAME", "门诊发票");//对新建的纸张重命名
|
|
|
+ LODOP.SET_PRINT_STYLE("FontSize", 11); //字体大小
|
|
|
+ LODOP.ADD_PRINT_TEXT("6mm", "0mm", "55mm", "3mm", hospitalName);
|
|
|
+ if(fpVsesionNo == 0){
|
|
|
+ LODOP.ADD_PRINT_TEXT("6mm", "59mm", "30mm", "3mm", "流水号:");
|
|
|
+ LODOP.ADD_PRINT_TEXT("6mm", "72mm", "20mm", "3mm", temp.serialNo);
|
|
|
+ LODOP.ADD_PRINT_TEXT("19mm", "0mm", "35mm", "3mm", temp.receiptBill);
|
|
|
+ LODOP.ADD_PRINT_TEXT("25mm", "7mm", "50mm", "3mm", temp.name);
|
|
|
+ LODOP.ADD_PRINT_TEXT("25mm", "61mm", "27mm", "3mm", patientId);
|
|
|
+ LODOP.ADD_PRINT_TEXT("32mm", "6mm", "50mm", "3mm", "就诊科室:" + temp.unitCode);
|
|
|
+ LODOP.ADD_PRINT_TEXT("32mm", "56mm", "50mm", "3mm", "地点:" + res.officePos);
|
|
|
+ LODOP.ADD_PRINT_TEXT("37mm", "6mm", "50mm", "3mm", "看诊医生:" + temp.doctorCode);
|
|
|
+ LODOP.ADD_PRINT_TEXT("37mm", "56mm", "50mm", "3mm", "号段:" + temp.ampm);
|
|
|
+ LODOP.ADD_PRINT_TEXT("42mm", "6mm", "50mm", "3mm", "号别:" + temp.chargeType);
|
|
|
+ LODOP.ADD_PRINT_TEXT("42mm", "56mm", "50mm", "3mm", "挂号费:" + temp.reqFee);
|
|
|
+ LODOP.ADD_PRINT_TEXT("47mm", "6mm", "50mm", "3mm", "诊查费:" + temp.clinicFee);
|
|
|
+ LODOP.ADD_PRINT_TEXT("47mm", "56mm", "50mm", "3mm", "其他:" + temp.othFee);
|
|
|
+ var blbFee=temp.blbFee;
|
|
|
+ if(blbFee==null){
|
|
|
+ blbFee=0;
|
|
|
+ }
|
|
|
+ if (temp.zlkFee != null) {
|
|
|
+ blbFee = blbFee + temp.zlkFee;
|
|
|
+ }
|
|
|
+ LODOP.ADD_PRINT_TEXT("52mm", "6mm", "50mm", "3mm", "工本费:" + blbFee);
|
|
|
+ LODOP.ADD_PRINT_TEXT("65mm", "21mm", "60mm", "3mm", res.totalFee + " 元");
|
|
|
+ LODOP.ADD_PRINT_TEXT("72mm", "19mm", "60mm", "3mm", res.totalFeeStr);
|
|
|
+ LODOP.ADD_PRINT_TEXT("79mm", "0mm", "15mm", "3mm", res.year);//年
|
|
|
+ LODOP.ADD_PRINT_TEXT("79mm", "13mm", "10mm", "3mm", res.month);//月
|
|
|
+ LODOP.ADD_PRINT_TEXT("79mm", "25mm", "10mm", "3mm", res.day);//日
|
|
|
+ LODOP.ADD_PRINT_TEXT("79mm", "53mm", "23mm", "3mm", res.user.userName);//收费员
|
|
|
+ LODOP.PREVIEW();
|
|
|
+ }else {
|
|
|
+ postAjaxJsonHttpRequst("/thmz/selectDzfpUploadAboutSerialNo",{patientId:patientId,times:times,serialNo:serialNo},true,function (dzfp) {
|
|
|
+ if(dzfp.code == 0){
|
|
|
+ if(dzfp.data.resUrl){
|
|
|
+ // LODOP.ADD_PRINT_TEXT("12mm", "3mm", "50mm", "3mm", "姓名:"+temp.name);
|
|
|
+ LODOP.ADD_PRINT_TEXT("18mm", "3mm", "50mm", "3mm", "门诊号:"+patientId);
|
|
|
+ LODOP.ADD_PRINT_TEXT("24mm", "3mm", "50mm", "3mm", "就诊科室:" + temp.unitCode);
|
|
|
+ LODOP.ADD_PRINT_TEXT("30mm", "3mm", "70mm", "3mm", "地点:" + res.officePos);
|
|
|
+ LODOP.ADD_PRINT_TEXT("36mm", "3mm", "50mm", "3mm", "看诊医生:" + temp.doctorCode);
|
|
|
+ LODOP.ADD_PRINT_TEXT("42mm", "3mm", "50mm", "3mm", "号段:" + temp.ampm);
|
|
|
+ LODOP.ADD_PRINT_TEXT("48mm", "3mm", "50mm", "3mm", "号别:" + temp.chargeType);
|
|
|
+ LODOP.ADD_PRINT_TEXT("54mm", "3mm", "50mm", "3mm", "收费员:"+res.user.userName);//收费员
|
|
|
+ LODOP.ADD_PRINT_TEXT("60mm", "3mm", "60mm", "3mm", "发票二维码");
|
|
|
+ LODOP.ADD_PRINT_IMAGE("70mm", "3mm", "50mm", "50mm", createInMemoryQR(dzfp.data.resUrl));
|
|
|
+ LODOP.PREVIEW();
|
|
|
+ console.log("img",createInMemoryQR(dzfp.data.resUrl))
|
|
|
+
|
|
|
+ } else {
|
|
|
+ errorMesage("未获取到电子发票,请重新上传发票!");
|
|
|
+ }
|
|
|
+
|
|
|
+ }else {
|
|
|
+ errorMesage(res)
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
- LODOP.PRINT();
|
|
|
if(fpVsesionNo == 1){
|
|
|
//上传电子发票
|
|
|
uploadBlueInvoice(patientId, times)
|