ソースを参照

专家挂号直达,取消自动退款

lighter 3 ヶ月 前
コミット
ae2bc80045

+ 29 - 0
src/main/java/thyyxxk/wxservice_server/controller/WeChatRedirectController.java

@@ -7,9 +7,11 @@ import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 import thyyxxk.wxservice_server.config.auth.PassToken;
 import thyyxxk.wxservice_server.dao.selfmachine.LoginDao;
+import thyyxxk.wxservice_server.utils.DateUtil;
 
 import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
+import java.util.List;
 
 /**
  * @author dj
@@ -96,4 +98,31 @@ public class WeChatRedirectController {
             throw new RuntimeException(e);
         }
     }
+
+    @PassToken
+    @GetMapping("/expertReg")
+    public void expertReg(@RequestParam("doc") String doc, HttpServletResponse response) {
+        String today = DateUtil.today();
+        String docDept = dao.getDocDept(doc);
+        List<String> mzyList = dao.getMzrDeptList(doc);
+        String dept;
+        if (null == mzyList || mzyList.isEmpty()) {
+            dept = docDept;
+        } else {
+            if (mzyList.contains(docDept)) {
+                dept = docDept;
+            } else {
+                dept = mzyList.get(0);
+            }
+        }
+
+        String path = "doctorArrangement_" + today + "_" + dept + "_" + doc;
+        try {
+            response.sendRedirect("https://open.weixin.qq.com/connect/oauth2/authorize?" +
+                    "appid=wxbde6b16acad84204&redirect_uri=http://staticweb.hnthyy.cn/wxserver/redirect/page2?" +
+                    "to=" + path + "&response_type=code&scope=snsapi_base&state=1#wechat_redirect");
+        } catch (IOException e) {
+            throw new RuntimeException(e);
+        }
+    }
 }

+ 7 - 0
src/main/java/thyyxxk/wxservice_server/dao/selfmachine/LoginDao.java

@@ -33,4 +33,11 @@ public interface LoginDao {
             "rtrim(social_no) as socialNo from mz_patient_mi " +
             "with(nolock) where social_no=#{idCard} and isnull(del_flag,0)=0")
     List<OutpatientCard> getPatientCardListByIdCard(String idCard);
+
+    @Select("select rtrim(dept_code) from a_employee_mi where code=#{code}")
+    String getDocDept(String code);
+
+    @Select("select distinct unit_code from mzy_request_new where " +
+            "datediff(day,request_day,getdate())=0 and doctor_code=#{code}")
+    List<String> getMzrDeptList(String code);
 }

+ 2 - 12
src/main/java/thyyxxk/wxservice_server/service/SavePayResultService.java

@@ -120,12 +120,7 @@ public class SavePayResultService {
             dao.couponUsed(order.getCouponId());
             return payTime;
         }
-        String refund = refundService.autoRefund(order.getTradeNo(), response);
-        if (!refund.startsWith("ERROR:")) {
-            dao.refundOrder(order.getTradeNo(), response);
-            return response;
-        }
-        throw new BizException(ExceptionEnum.LOGICAL_ERROR, "保存挂号信息失败,自动退款失败,请联系服务中心进行退款。");
+        throw new BizException(ExceptionEnum.LOGICAL_ERROR, "保存挂号信息失败,请前往收费窗口或联系服务中心进行退款。");
     }
 
     public String saveMzChargeInfo(WxPayOrder order, String payTime) throws Exception {
@@ -174,12 +169,7 @@ public class SavePayResultService {
             updateAppletHisChargeplStatus(hisOrdNum, tradeNo, order.getCouponId(), order.getCashpayAmt());
             return payTime;
         }
-        String refund = refundService.autoRefund(tradeNo, saveMzPayResponse.getMessage());
-        if (!refund.startsWith("ERROR:")) {
-            dao.refundOrder(tradeNo, saveMzPayResponse.getMessage());
-            return "ERROR:【" + saveMzPayResponse.getMessage() +  "】已为您自动退款,请留意到账信息。";
-        }
-        return "ERROR:【" + saveMzPayResponse.getMessage() +  "】自动退款失败,请联系服务中心进行退款。";
+        throw new BizException(ExceptionEnum.LOGICAL_ERROR, "保存处方失败,请前往收费窗口或联系服务中心进行退款。");
     }
 
     private void updateAppletHisChargeplStatus(String hisOrdNum, String tradeNo, String couponId, BigDecimal cashpayAmt) {

+ 1 - 1
src/main/java/thyyxxk/wxservice_server/utils/DateUtil.java

@@ -17,7 +17,7 @@ public class DateUtil {
 
     public static String today() {
         Date date = new Date();
-        SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
         return sdf.format(date);
     }
 

+ 3 - 4
src/main/java/thyyxxk/wxservice_server/utils/PhysicalCheckPDFUtil.java

@@ -35,10 +35,9 @@ public class PhysicalCheckPDFUtil {
     }
 
     public static ResultVo<String> savePdfToDisk(JSONObject tjIndex, JSONObject tjResult) {
-        String today = DateUtil.today();
-        String fileName = today
-                + UUID.randomUUID().toString().replaceAll("-", "")
-                + ".pdf";
+        String today = DateUtil.today().replaceAll("-", "");
+        String uid = UUID.randomUUID().toString().replaceAll("-", "");
+        String fileName = today + uid + ".pdf";
         try {
             File pdfFile = new File(PDF_PATH + fileName);
             if (pdfFile.exists()) {