Forráskód Böngészése

现在可以获取到不同就诊次数的门诊待缴费处方了。

lighter 4 éve
szülő
commit
c88846105c

+ 1 - 1
pom.xml

@@ -10,7 +10,7 @@
     </parent>
     <groupId>thyyxxk</groupId>
     <artifactId>web-server</artifactId>
-    <version>6.9</version>
+    <version>7.0</version>
     <name>web-server</name>
     <description>server for yibao-web</description>
 

+ 1 - 1
src/main/java/thyyxxk/webserver/constants/ExternalAddr.java

@@ -15,7 +15,7 @@ public class ExternalAddr {
 
     public static final String PAY_CHARGE_DETAIL_FORM_DBZSF = "http://webhis.thyy.cn:81/thmz/api/v1/payChargeDetailFormDbzsf";
 
-    public static final String CREATE_ORDER_FOR_MZ_GUIDE_BILL = "http://192.168.200.3:8805/wxserver/wxApi/createOrderForMzGuideBill";
+    public static final String GEN_MZ_PAY_QRCODE = "http://192.168.200.3:8805/wxserver/wxApi/genMzPayQrcode";
 
     public static final String HTML_TO_IMAGE = "http://192.168.200.3:8805/htmlToImage/healthCardImage/execute";
 }

+ 3 - 3
src/main/java/thyyxxk/webserver/controller/markmtfees/MarkMtFeesController.java

@@ -8,6 +8,7 @@ import thyyxxk.webserver.entity.ResultVo;
 import thyyxxk.webserver.entity.markmtfees.*;
 import thyyxxk.webserver.service.markmtfees.MarkMtFeesService;
 
+import java.util.List;
 import java.util.Map;
 
 @RestController
@@ -31,9 +32,8 @@ public class MarkMtFeesController {
     }
 
     @GetMapping("/getMtReceipts")
-    public ResultVo<Map<String, Object>> getMtReceipts(@RequestParam("patientId") String patientId,
-                                                       @RequestParam("times") Integer times) {
-        return service.getMtReceipts(patientId, times);
+    public ResultVo<List<Map<String, Object>>> getMtReceipts(@RequestParam("patientId") String patientId) {
+        return service.getMtReceipts(patientId);
     }
 
     @PostMapping("/insertMtFees")

+ 3 - 0
src/main/java/thyyxxk/webserver/controller/mzpayqrcode/MzPayQrcodeController.java

@@ -11,6 +11,9 @@ import thyyxxk.webserver.service.mzpayqrcode.MzPayQrcodeService;
 import java.util.List;
 import java.util.Map;
 
+/**
+ * @author dj
+ */
 @RestController
 @RequestMapping("/mzPayQrCode")
 public class MzPayQrcodeController {

+ 3 - 0
src/main/java/thyyxxk/webserver/controller/wxapi/WxApiController.java

@@ -11,6 +11,9 @@ import thyyxxk.webserver.service.wxapi.WxApiService;
 import javax.servlet.http.HttpServletResponse;
 import java.util.Map;
 
+/**
+ * @author dj
+ */
 @RestController
 @RequestMapping("/wxRefund")
 public class WxApiController {

+ 3 - 4
src/main/java/thyyxxk/webserver/dao/his/markmtfees/MarkMtFeesDao.java

@@ -83,14 +83,13 @@ public interface MarkMtFeesDao {
     @Select("SELECT a.patient_id,a.social_no,a.name,a.lv_date,a.sex,a.response_type,a.charge_type,a.times,a.age," +
             "a.birth_day,responce_name=b.name,address=a.adress,phone_no=a.phone_no FROM " +
             "mz_patient_mi a,mz_zd_responce_type b,mz_visit_table c WHERE a.patient_id=#{patientId} and " +
-            "a.patient_id=c.patient_id and c.times=#{times} and c.responce_type=b.code " +
+            "a.patient_id=c.patient_id and c.responce_type=b.code " +
             "union " +
             "SELECT a.patient_id,a.social_no,a.name,a.lv_date,a.sex,a.response_type,a.charge_type,a.times,a.age," +
             "a.birth_day,responce_name=b.name,address=a.adress,phone_no=a.phone_no FROM " +
             "mz_patient_mi_b a,mz_zd_responce_type b,mz_visit_table_b c WHERE a.patient_id=#{patientId} and " +
-            "a.patient_id=c.patient_id and c.times=#{times} and c.responce_type=b.code order by lv_date desc")
-    List<MzPatient> selectMzPatient(@Param("patientId") String patientId,
-                              @Param("times") Integer times);
+            "a.patient_id=c.patient_id and c.responce_type=b.code order by lv_date desc")
+    List<MzPatient> selectMzPatient(@Param("patientId") String patientId);
 
     @Select("SELECT patient_id,times,visit_dept_code, " +
             "visitDeptName=(select rtrim(name) from zd_unit_code where code=visit_dept_code), " +

+ 113 - 111
src/main/java/thyyxxk/webserver/service/markmtfees/MarkMtFeesService.java

@@ -7,7 +7,7 @@ import org.springframework.stereotype.Service;
 import org.springframework.web.client.RestTemplate;
 import thyyxxk.webserver.config.exception.ExceptionEnum;
 import thyyxxk.webserver.constants.Capacity;
-import thyyxxk.webserver.constants.HrgAddr;
+import thyyxxk.webserver.constants.ExternalAddr;
 import thyyxxk.webserver.constants.ResponceType;
 import thyyxxk.webserver.dao.his.markmtfees.MarkMtFeesDao;
 import thyyxxk.webserver.entity.ResultVo;
@@ -116,137 +116,139 @@ public class MarkMtFeesService {
         return ResultVoUtil.success();
     }
 
-    public ResultVo<Map<String, Object>> getMtReceipts(String patientId, Integer times) {
-        Map<String, Object> map = new HashMap<>(Capacity.FOUR);
-        List<MzPatient> mzPatients = dao.selectMzPatient(patientId, times);
+    public ResultVo<List<Map<String, Object>>> getMtReceipts(String patientId) {
+        List<MzPatient> mzPatients = dao.selectMzPatient(patientId);
         if (null == mzPatients || mzPatients.isEmpty()) {
-            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "【门诊号:" + patientId + ",就诊次数:" +
-                    times + "】未找到此患者的本次就诊信息,请核实。");
+            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "【门诊号:" + patientId + "】未找到此患者的个人基本信息,请核实。");
         }
-        MzVisit mzVisit = dao.selectMzVisit(patientId, times);
-        if (null == mzVisit) {
-            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "【门诊号:" + patientId + ",就诊次数:" +
-                    times + "】未找到此患者的本次就诊信息,请核实。");
-        }
-        map.put("mzPatient", mzPatients.get(0));
-        map.put("mzVisit", mzVisit);
         JSONObject queryMzChargeList = new JSONObject();
         queryMzChargeList.put("patCardType", 21);
         queryMzChargeList.put("patCardNo", patientId);
         queryMzChargeList.put("hisOrdNum", "");
         RestTemplate template = new RestTemplate();
-        Map<String, Object> mzChargeListMap = template.postForObject(HrgAddr.GET_MZ_CHARGE_DETAIL_FOR_UN_PAID, queryMzChargeList, Map.class);
+        Map<String, Object> mzChargeListMap = template.postForObject(ExternalAddr.GET_MZ_CHARGE_DETAIL_FOR_UN_PAID, queryMzChargeList, Map.class);
         if (null == mzChargeListMap) {
             return ResultVoUtil.fail(ExceptionEnum.NETWORK_ERROR);
         }
         if (0 != (int) mzChargeListMap.get("resultCode")) {
             return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, mzChargeListMap.get("resultMessage").toString());
         }
+
+        List<Map<String, Object>> finalResult = new ArrayList<>();
         List<Map<String, String>> mzChargeList = FilterUtil.cast(mzChargeListMap.get("data"));
-        List<Map<String, Object>> mzChargeDetailList = new ArrayList<>();
-        mzChargeList.forEach(item -> {
+
+        for (Map<String, String> item : mzChargeList) {
             String hisOrdNum = item.get("hisOrdNum");
             if (null != hisOrdNum) {
                 String[] hisOrdNumParts = hisOrdNum.split("_");
-                if (Integer.parseInt(hisOrdNumParts[1]) == times) {
-                    JSONObject queryMzChargeDetail = new JSONObject();
-                    queryMzChargeDetail.put("patientId", patientId);
-                    queryMzChargeDetail.put("times", times);
-                    queryMzChargeDetail.put("receiptNo", hisOrdNumParts[2]);
-                    Map<String, Object> mzChargeDetailMap = template.postForObject(HrgAddr.UN_PAID_TO_FULL_CHARGE_DETAIL,
-                            queryMzChargeDetail, Map.class);
-                    if (null != mzChargeDetailMap && 0 == (int) mzChargeDetailMap.get("resultCode")) {
-                        List<Map<String, Object>> detail = FilterUtil.cast(mzChargeDetailMap.get("data"));
-                        mzChargeDetailList.addAll(detail);
-                    }
-                }
-            }
-        });
-        mzChargeDetailList.removeIf(item -> "TC".equals(item.get("billItemCode")) ||
-                !"5".equals(item.get("payMark")) || "BILL99".equals(item.get("chargeItemCode")) ||
-                "四舍五入".equals(item.get("tcName")));
-        if (mzChargeDetailList.isEmpty()) {
-            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "未查询到此患者的待缴费处方。");
-        }
-        Map<Integer, List<MzReceipt>> orderReceiptsMap = new HashMap<>(Capacity.DEFAULT);
-        String doctorName = dao.selectDoctorName(mzChargeDetailList.get(0).get("doctorCode").toString());
-        mzChargeDetailList.forEach(item -> {
-            MzReceipt receipt = new MzReceipt();
-            receipt.setChecked(!item.get("tcName").toString().contains("外送艾迪康"));
-            receipt.setPatientId(patientId);
-            receipt.setTimes(times);
-            receipt.setReceiptNo((int) item.get("receiptNo"));
-            receipt.setOrderNo((int) item.get("orderNo"));
-            receipt.setItemNo((int) item.get("itemNo"));
-            receipt.setDrugName(item.get("tcName").toString());
-            receipt.setChargeItemCode(item.get("chargeItemCode").toString());
-            receipt.setPriceTime(DateUtil.formatPriceTime(item.get("priceTime").toString()));
-            receipt.setUnitPrice(new BigDecimal(item.get("unitPrice").toString()).setScale(4, BigDecimal.ROUND_HALF_UP));
-            receipt.setQuantity((double) item.get("quantity"));
-            receipt.setDrugWin((int) item.get("drugWin"));
-            receipt.setDoctorCode(item.get("doctorCode").toString());
-            receipt.setDoctorName(doctorName);
-            receipt.setSerialNo(item.get("serialNo").toString());
-            receipt.setGroupNo(item.get("groupNo").toString());
-            receipt.setBillItemCode(item.get("billItemCode").toString());
-            receipt.setChargeBillCode(item.get("chargeBillCode").toString());
-            if (null != item.get("instructionText")) {
-                receipt.setInstructionText(item.get("instructionText").toString());
-            }
-            if (null != item.get("specification")) {
-                receipt.setSpecification(item.get("specification").toString());
-            }
-            if (null != item.get("frequency")) {
-                receipt.setFrequency(item.get("frequency").toString());
-            }
-            if (null != item.get("drugQuan")) {
-                receipt.setDrugQuan((Double) item.get("drugQuan"));
-            }
-            if (null != item.get("orderDays")) {
-                receipt.setOrderDays((Integer) item.get("orderDays"));
-            }
-            // groupNo:00-项目;其他-药品
-            if ("00".equals(receipt.getGroupNo())) {
-                receipt.setDrugUnit(dao.selectXmChargeUnit(receipt.getChargeItemCode()));
-            } else {
-                if (null != item.get("serial")) {
-                    receipt.setSerial(item.get("serial").toString());
-                    receipt.setSpecification(dao.selectSpecification(receipt.getChargeItemCode(), receipt.getSerial()));
+                int times = Integer.parseInt(hisOrdNumParts[1]);
+                MzVisit mzVisit = dao.selectMzVisit(patientId, times);
+                if (null == mzVisit) {
+                    continue;
                 }
-                if (null != item.get("supplyCode")) {
-                    receipt.setSupplyCode(dao.selectSupplyName(item.get("supplyCode").toString()));
-                }
-                if (null != item.get("drugUnit")) {
-                    receipt.setDrugUnit(dao.selectDrugUnit(item.get("drugUnit").toString()));
+                Map<String, Object> childResult = new HashMap<>(Capacity.FIVE);
+                childResult.put("times", times);
+                childResult.put("mzPatient", mzPatients.get(0));
+                childResult.put("mzVisit", mzVisit);
+                JSONObject queryMzChargeDetail = new JSONObject();
+                queryMzChargeDetail.put("patientId", patientId);
+                queryMzChargeDetail.put("times", times);
+                queryMzChargeDetail.put("receiptNo", hisOrdNumParts[2]);
+                mzVisit.setReceiptNo(Integer.parseInt(hisOrdNumParts[2]));
+                Map<String, Object> mzChargeDetailMap = template.postForObject(ExternalAddr.UN_PAID_TO_FULL_CHARGE_DETAIL,
+                        queryMzChargeDetail, Map.class);
+                if (null != mzChargeDetailMap && 0 == (int) mzChargeDetailMap.get("resultCode")) {
+                    List<Map<String, Object>> mzChargeDetailList = FilterUtil.cast(mzChargeDetailMap.get("data"));
+
+                    mzChargeDetailList.removeIf(detail -> "TC".equals(detail.get("billItemCode")) ||
+                            !"5".equals(detail.get("payMark")) || "BILL99".equals(detail.get("chargeItemCode")) ||
+                            "四舍五入".equals(detail.get("tcName")));
+                    if (mzChargeDetailList.isEmpty()) {
+                        continue;
+                    }
+                    Map<Integer, List<MzReceipt>> orderReceiptsMap = new HashMap<>(Capacity.DEFAULT);
+                    String doctorName = dao.selectDoctorName(mzChargeDetailList.get(0).get("doctorCode").toString());
+                    mzChargeDetailList.forEach(detail -> {
+                        MzReceipt receipt = new MzReceipt();
+                        receipt.setChecked(!detail.get("tcName").toString().contains("外送艾迪康"));
+                        receipt.setPatientId(patientId);
+                        receipt.setTimes(times);
+                        receipt.setReceiptNo((int) detail.get("receiptNo"));
+                        receipt.setOrderNo((int) detail.get("orderNo"));
+                        receipt.setItemNo((int) detail.get("itemNo"));
+                        receipt.setDrugName(detail.get("tcName").toString());
+                        receipt.setChargeItemCode(detail.get("chargeItemCode").toString());
+                        receipt.setPriceTime(DateUtil.formatPriceTime(detail.get("priceTime").toString()));
+                        receipt.setUnitPrice(new BigDecimal(detail.get("unitPrice").toString()).setScale(4, BigDecimal.ROUND_HALF_UP));
+                        receipt.setQuantity((double) detail.get("quantity"));
+                        receipt.setDrugWin((int) detail.get("drugWin"));
+                        receipt.setDoctorCode(detail.get("doctorCode").toString());
+                        receipt.setDoctorName(doctorName);
+                        receipt.setSerialNo(detail.get("serialNo").toString());
+                        receipt.setGroupNo(detail.get("groupNo").toString());
+                        receipt.setBillItemCode(detail.get("billItemCode").toString());
+                        receipt.setChargeBillCode(detail.get("chargeBillCode").toString());
+                        if (null != detail.get("instructionText")) {
+                            receipt.setInstructionText(detail.get("instructionText").toString());
+                        }
+                        if (null != detail.get("specification")) {
+                            receipt.setSpecification(detail.get("specification").toString());
+                        }
+                        if (null != detail.get("frequency")) {
+                            receipt.setFrequency(detail.get("frequency").toString());
+                        }
+                        if (null != detail.get("drugQuan")) {
+                            receipt.setDrugQuan((Double) detail.get("drugQuan"));
+                        }
+                        if (null != detail.get("orderDays")) {
+                            receipt.setOrderDays((Integer) detail.get("orderDays"));
+                        }
+                        // groupNo:00-项目;其他-药品
+                        if ("00".equals(receipt.getGroupNo())) {
+                            receipt.setDrugUnit(dao.selectXmChargeUnit(receipt.getChargeItemCode()));
+                        } else {
+                            if (null != detail.get("serial")) {
+                                receipt.setSerial(detail.get("serial").toString());
+                                receipt.setSpecification(dao.selectSpecification(receipt.getChargeItemCode(), receipt.getSerial()));
+                            }
+                            if (null != detail.get("supplyCode")) {
+                                receipt.setSupplyCode(dao.selectSupplyName(detail.get("supplyCode").toString()));
+                            }
+                            if (null != detail.get("drugUnit")) {
+                                receipt.setDrugUnit(dao.selectDrugUnit(detail.get("drugUnit").toString()));
+                            }
+                        }
+                        if (!orderReceiptsMap.containsKey(receipt.getOrderNo())) {
+                            List<MzReceipt> list = new ArrayList<>();
+                            list.add(receipt);
+                            orderReceiptsMap.put(receipt.getOrderNo(), list);
+                        } else {
+                            orderReceiptsMap.get(receipt.getOrderNo()).add(receipt);
+                        }
+                    });
+                    List<OrderNo> orderNos = new ArrayList<>();
+                    for (Map.Entry<Integer, List<MzReceipt>> entry : orderReceiptsMap.entrySet()) {
+                        OrderNo orderNo = new OrderNo();
+                        orderNo.setPatientId(patientId);
+                        orderNo.setTimes(times);
+                        orderNo.setReceiptNo(entry.getValue().get(0).getReceiptNo());
+                        orderNo.setOrderNo(entry.getKey());
+                        BigDecimal total = new BigDecimal("0.00");
+                        for (MzReceipt receipt : entry.getValue()) {
+                            total = total.add(receipt.getChargeFee());
+                        }
+                        orderNo.setTotalFee(total);
+                        int count = dao.selectFeeCount(patientId, times, mzVisit.getReceiptNo(), entry.getKey());
+                        orderNo.setStatus(count > 0);
+                        orderNos.add(orderNo);
+                    }
+                    childResult.put("orderNos", orderNos);
+                    childResult.put("mzReceipts", orderReceiptsMap);
+                    finalResult.add(childResult);
                 }
             }
-            if (!orderReceiptsMap.containsKey(receipt.getOrderNo())) {
-                List<MzReceipt> list = new ArrayList<>();
-                list.add(receipt);
-                orderReceiptsMap.put(receipt.getOrderNo(), list);
-            } else {
-                orderReceiptsMap.get(receipt.getOrderNo()).add(receipt);
-            }
-        });
-        List<OrderNo> orderNos = new ArrayList<>();
-        for (Map.Entry<Integer, List<MzReceipt>> entry : orderReceiptsMap.entrySet()) {
-            OrderNo orderNo = new OrderNo();
-            orderNo.setPatientId(patientId);
-            orderNo.setTimes(times);
-            orderNo.setReceiptNo(entry.getValue().get(0).getReceiptNo());
-            orderNo.setOrderNo(entry.getKey());
-            BigDecimal total = new BigDecimal("0.00");
-            for (MzReceipt item : entry.getValue()) {
-                total = total.add(item.getChargeFee());
-            }
-            orderNo.setTotalFee(total);
-            int count = dao.selectFeeCount(patientId, times, mzVisit.getReceiptNo(), entry.getKey());
-            orderNo.setStatus(count > 0);
-            orderNos.add(orderNo);
         }
-        map.put("orderNos", orderNos);
-        map.put("mzReceipts", orderReceiptsMap);
-        return ResultVoUtil.success(map);
+        return ResultVoUtil.success(finalResult);
     }
 
     public ResultVo<String> insertMtFees(MarkMtFeeParam param) {

+ 1 - 2
src/main/java/thyyxxk/webserver/service/mzpayqrcode/MzPayQrcodeService.java

@@ -77,7 +77,6 @@ public class MzPayQrcodeService {
         pObj.put("patCardType", 21);
         pObj.put("patCardNo", param.getPatientId());
         pObj.put("hisOrdNum", param.getHisOrdNum());
-
         RestTemplate template = new RestTemplate();
         HrgResponse hrgRes = template.postForObject(ExternalAddr.GET_CHARGE_DETAIL_BY_HIS_ORD_NUM, pObj, HrgResponse.class);
         if (null == hrgRes || null == hrgRes.getResultCode()) {
@@ -90,7 +89,7 @@ public class MzPayQrcodeService {
         JSONObject retObj = new JSONObject();
         retObj.put("list", makeSimpleData(list));
         RestTemplate restTemplate = new RestTemplate();
-        ResultVo<String> qrResult = restTemplate.postForObject(ExternalAddr.CREATE_ORDER_FOR_MZ_GUIDE_BILL, param, ResultVo.class);
+        ResultVo<String> qrResult = restTemplate.postForObject(ExternalAddr.GEN_MZ_PAY_QRCODE, param, ResultVo.class);
         if (null == qrResult || qrResult.getCode() != ExceptionEnum.SUCCESS.getCode()) {
             return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "请求微信支付二维码失败,请联系管理员。");
         }