Browse Source

门诊发票查询优化

hurugang 4 years ago
parent
commit
8d504fe794

+ 28 - 0
src/main/java/cn/hnthyy/thmz/controller/mz/MzChargeDetailController.java

@@ -899,12 +899,35 @@ public class MzChargeDetailController {
             List<Map<String, Object>> mzChargeDetailList = mzChargeDetailService.queryChargeListByPatient(chargeFeeParamsVo.getHisData(), "%" + chargeFeeParamsVo.getPatientId() + "%", null, null, chargeFeeParamsVo.getBeginDate(), chargeFeeParamsVo.getEndDate());
             List<Map<String, Object>> data = new ArrayList<>();
             if (mzChargeDetailList != null) {
+                StringBuilder sbf = new StringBuilder();
+                List<String> receiptBillList = new ArrayList<>();
+                int index =0;
                 for (Map<String, Object> map : mzChargeDetailList) {
                     if (map != null) {
                         Integer realNo = (Integer) map.get("real_no");
                         data.addAll(mzChargeDetailService.queryChargeDetailByPatient(chargeFeeParamsVo.getHisData(), chargeFeeParamsVo.getPatientId(), realNo.toString()));
+                        MzReceiptSerial mzReceiptSerial = mzReceiptSerialService.queryReceiptDetailsByReceiptSn(realNo);
+                        if(mzReceiptSerial!=null && StringUtils.isNotBlank(mzReceiptSerial.getReceiptBill())){
+                            if(sbf.length()==0){
+                                sbf.append(mzReceiptSerial.getReceiptBill());
+                            }else {
+                                sbf.append(",").append(mzReceiptSerial.getReceiptBill());
+                            }
+                            //每6个发票号换一次行
+                            index++;
+                            if(index%6==0){
+                                receiptBillList.add(sbf.toString());
+                                sbf.setLength(0);
+                            }
+                        }
                     }
                 }
+                if(sbf.toString().length()>0){
+                    receiptBillList.add(sbf.toString());
+                }
+                if(sbf.length()>0){
+                    resultMap.put("receiptBillList", receiptBillList);
+                }
             }
             BigDecimal totalPriceCount = BigDecimal.ZERO;
             totalPriceCount = getBigDecimal(data, totalPriceCount);
@@ -1247,6 +1270,11 @@ public class MzChargeDetailController {
                 DecodedJWT decodedJWT = TokenUtil.parseJWT(token);
                 User tokenUser = (User) JsonUtil.jsontoObject(decodedJWT.getSubject(), User.class);
                 PayInfo result= tsmzService.uploadFees(tokenUser.getUserIdCode(), mzChargeDetailYb.getPatientId(),mzChargeDetailYb.getTimes(),mzChargeDetailYb.getReceiptNo());
+                if(result.getCode()!=0){
+                    resultMap.put("code", -1);
+                    resultMap.put("message", result.getErrorMessage());
+                    return resultMap;
+                }
                 resultMap.put("data", result);
             }
             resultMap.put("code", 0);

+ 3 - 0
src/main/java/cn/hnthyy/thmz/entity/his/mz/MzReceiptSerial.java

@@ -126,6 +126,9 @@ public class MzReceiptSerial implements Serializable {
     public MzReceiptSerial() {
     }
 
+    public MzReceiptSerial(String receiptBill) {
+        this.receiptBill = receiptBill;
+    }
     public MzReceiptSerial(String patientId, Integer times) {
         this.patientId = patientId;
         this.times = times;

+ 21 - 2
src/main/java/cn/hnthyy/thmz/mapper/his/mz/MzReceiptSerialMapper.java

@@ -173,6 +173,25 @@ public interface MzReceiptSerialMapper {
     List<MzReceiptSerial> selectSerialForThisTime(@Param(value = "patientId") String patientId, @Param("times") Integer times, @Param("receiptNo") Integer receiptNo);
 
 
+
+    /**
+     * 根据病人编号和就诊次数查询其当前就诊次数对应的真实发票
+     *
+     * @param patientId
+     * @param times
+     * @param receiptNo
+     * @return
+     */
+    @Select({"<script>",
+            "select rtrim(patient_id) patient_id,times,receipt_no,serial_no,rtrim(operator_id) operator_id,charge1,charge2,charge3,charge4,charge5,charge6,charge7,charge8,charge9,",
+            "charge10,charge11,charge12,charge13,charge14,charge15,charge16,charge17,charge18,charge19,charge20,rtrim(pay_mark) pay_mark,total_charge,charge_date,rtrim(receipt_bill) receipt_bill,",
+            "receipt_sn,dcount_date,rtrim(windows_no) windows_no,dcount_no,serial_yb,rtrim(fp_flag) fp_flag,rtrim(responce_type) responce_type,rtrim(cheque_type) cheque_type,cheque_no," +
+                    "rtrim(tf_flag) tf_flag,dept_no,rtrim(pay_id) pay_id,charge_dcount_date,charge_dcount_no",
+            "from ${tableName} where  patient_id=#{patientId,jdbcType=CHAR} and times = #{times,jdbcType=INTEGER} and receipt_no = #{receiptNo,jdbcType=INTEGER} and receipt_bill is not null",
+            "</script>"})
+    MzReceiptSerial selectReceiptBillForThisTime(@Param(value = "patientId") String patientId, @Param("times") Integer times, @Param("receiptNo") Short receiptNo,@Param(value = "tableName") String tableName);
+
+
     /**
      * 根据机制号查询发票信息
      *
@@ -269,9 +288,9 @@ public interface MzReceiptSerialMapper {
             "charge10,charge11,charge12,charge13,charge14,charge15,charge16,charge17,charge18,charge19,charge20,rtrim(pay_mark) pay_mark,total_charge,charge_date,rtrim(receipt_bill) receipt_bill,",
             "receipt_sn,dcount_date,rtrim(windows_no) windows_no,dcount_no,serial_yb,rtrim(fp_flag) fp_flag,rtrim(responce_type) responce_type,rtrim(cheque_type) cheque_type,cheque_no," +
                     "rtrim(tf_flag) tf_flag,dept_no,rtrim(pay_id) pay_id,charge_dcount_date,charge_dcount_no",
-            "from mz_receipt_serial where receipt_sn =#{receiptSn}  and receipt_bill is not null and receipt_bill  <![CDATA[<>]]>  '' ",
+            "from ${tableName} where receipt_sn =#{receiptSn}  and receipt_bill is not null and receipt_bill  <![CDATA[<>]]>  '' ",
             "</script>"})
-    MzReceiptSerial selectReceiptDetailsByReceiptSn(@Param(value = "receiptSn") Integer receiptSn);
+    MzReceiptSerial selectReceiptDetailsByReceiptSn(@Param(value = "receiptSn") Integer receiptSn,@Param("tableName") String tableName);
 
 
 

+ 0 - 0
src/main/java/cn/hnthyy/thmz/service/his/zy/zyLedgerFileService.java → src/main/java/cn/hnthyy/thmz/service/his/zy/ZyLedgerFileService.java


+ 0 - 0
src/main/java/cn/hnthyy/thmz/service/impl/his/zy/zyLedgerFileServiceImpl.java → src/main/java/cn/hnthyy/thmz/service/impl/his/zy/ZyLedgerFileServiceImpl.java


+ 19 - 0
src/main/java/cn/hnthyy/thmz/service/impl/thmz/TsmzServiceImpl.java

@@ -46,6 +46,7 @@ public class TsmzServiceImpl implements TsmzService {
             if((int)resultJSONO.get("code")==0){
                 return getPayInfo(resultJSONO);
             }else if((int)resultJSONO.get("code")==99){
+                //已经上传过
                 realUrl =tsmzServiceUrl+"/calculateCost";
                 result= HttpUtil.sendHttpPost(realUrl, jsonObj.toString());
                 if(StringUtils.isBlank(result)){
@@ -57,7 +58,15 @@ public class TsmzServiceImpl implements TsmzService {
                 }
                 if((int)resultJSONO.get("code")==0){
                     return getPayInfo(resultJSONO);
+                }else if((int)resultJSONO.get("code")==-1){
+                    PayInfo payInfo= new PayInfo();
+                    payInfo.setCode(-1);
+                    payInfo.setErrorMessage("该患者暂未读卡,请到医保卡进行读卡操作!");
                 }
+            }else if((int)resultJSONO.get("code")==-1){
+                PayInfo payInfo= new PayInfo();
+                payInfo.setCode(-1);
+                payInfo.setErrorMessage("该患者暂未读卡,请到医保卡进行读卡操作!");
             }
             return null;
         } catch (Exception e) {
@@ -70,6 +79,7 @@ public class TsmzServiceImpl implements TsmzService {
     private PayInfo getPayInfo(JSONObject resultJSONO) {
         JSONObject tempJSONO=(JSONObject)resultJSONO.get("payInfo");
         PayInfo payInfo= new PayInfo();
+        payInfo.setCode(0);
         String  fundPay= (String) tempJSONO.get("fundPay");
         String  selfPay= (String) tempJSONO.get("selfPay");
         String  totalCost= (String) tempJSONO.get("totalCost");
@@ -102,6 +112,7 @@ public class TsmzServiceImpl implements TsmzService {
             if((int)resultJSONO.get("code")==0){
                 return getPayInfo(resultJSONO);
             }else if((int)resultJSONO.get("code")==98){
+                //已经取消过
                 realUrl =tsmzServiceUrl+"/calculateCost";
                 result= HttpUtil.sendHttpPost(realUrl, jsonObj.toString());
                 if(StringUtils.isBlank(result)){
@@ -113,7 +124,15 @@ public class TsmzServiceImpl implements TsmzService {
                 }
                 if((int)resultJSONO.get("code")==0){
                     return getPayInfo(resultJSONO);
+                }else if((int)resultJSONO.get("code")==-1){
+                    PayInfo payInfo= new PayInfo();
+                    payInfo.setCode(-1);
+                    payInfo.setErrorMessage("该患者暂未读卡,请到医保卡进行读卡操作!");
                 }
+            }else if((int)resultJSONO.get("code")==-1){
+                PayInfo payInfo= new PayInfo();
+                payInfo.setCode(-1);
+                payInfo.setErrorMessage("该患者暂未读卡,请到医保卡进行读卡操作!");
             }
             return null;
         } catch (Exception e) {

+ 11 - 0
src/main/resources/static/js/charge_list.js

@@ -396,6 +396,8 @@ function fitfymx(patientId, serialNo) {
 
 
 function formatMx(res) {
+    $("#receiptBillList").empty();
+    $("#receiptBillList").append('<div style="font-weight: 700;margin-left: 8px;padding-top: 4px;padding-bottom: 4px;"><span style="margin-left: 32px;font-size: 13px;">发票:</span><span id="receipt_no" style="margin-left: 50px;"></span></div>');
     if (res.data != null && res.data.length > 0) {
         $("#serialNo_t").html("机制号:" + res.data[0].real_no);
         $("#doctor").html("医生:" + res.data[0].doctor_code);
@@ -436,6 +438,15 @@ function formatMx(res) {
         }else {
             $("#receipt_no").html("");
         }
+        if (res.receiptBillList!=null && res.receiptBillList.length>0){
+            for (var i=0;i<res.receiptBillList.length;i++){
+                if(i==0){
+                    $("#receipt_no").html(res.receiptBillList[0]);
+                }else if (i>0){
+                    $("#receiptBillList").append('<div style="font-weight: 700;margin-left: 8px;padding-top: 4px;padding-bottom: 4px;"><span style="margin-left: 32px;font-size: 13px;color: white;">发票:</span><span style="margin-left: 50px;">'+res.receiptBillList[i]+'</span></div>');
+                }
+            }
+        }
         $("#opId_print").html(res.user.userName);
         $("#total_count").html(res.totalPriceCount.toFixed(2));
         canPrint = true;

+ 1 - 1
src/main/resources/templates/charge_list.html

@@ -137,7 +137,7 @@
                             <div style="float: left;font-weight: 700;margin-left: 8px;"><span>打印日期:</span><span id="print_date" style="margin-left: 50px;"></span></div>
                             <div style="float: right;font-weight: 700;"><span>操作人:</span><span id="opId_print" style="margin-left: 50px;"></span></div>
                         </div>
-                        <div>
+                        <div id="receiptBillList">
                             <div style="font-weight: 700;margin-left: 8px;padding-top: 4px;padding-bottom: 4px;"><span style="margin-left: 32px;font-size: 13px;">发票:</span><span id="receipt_no" style="margin-left: 50px;"></span></div>
                         </div>
                     </div>