Kaynağa Gözat

预约核酸检测前需要挂简易门诊号

lighter 2 yıl önce
ebeveyn
işleme
0e57342582

+ 5 - 0
src/main/java/thyyxxk/wxservice_server/controller/OrderCovidController.java

@@ -24,6 +24,11 @@ public class OrderCovidController {
         service.setCovidAntigenLimit(needCheck, maxCount);
     }
 
+    @GetMapping("/selectValidRegForCovidExam")
+    public ResultVo<Integer> selectValidRegForCovidExam(@RequestParam("patNo") String patNo) {
+        return service.selectValidRegForCovidExam(patNo);
+    }
+
     @GetMapping("/savePrescription")
     public ResultVo<String> savePrescription(@RequestParam("patientId") String patientId, @RequestParam("type") int type) {
         return type == 1 ? service.applySingleCovidExam(patientId) : service.applyCovidAntigen(patientId);

+ 4 - 0
src/main/java/thyyxxk/wxservice_server/dao/AppointmentDao.java

@@ -55,4 +55,8 @@ public interface AppointmentDao {
     @Select("select count(1) from mz_yj_req with(nolock) where order_code=#{code} " +
             "and isnull(del_flag,0)=0 and datediff(day,req_date,getdate())=0")
     int reqCount(@Param("code") String code);
+
+    @Select("select count(1) from mzy_reqrec where patient_id=#{patNo} and cancel_mark=0 " +
+            "and datediff(hour,request_day,getdate())<=24 ")
+    int selectValidRegForCovidExam(String patNo);
 }

+ 3 - 2
src/main/java/thyyxxk/wxservice_server/dao/WxApiDao.java

@@ -1,6 +1,7 @@
 package thyyxxk.wxservice_server.dao;
 
 import org.apache.ibatis.annotations.*;
+import thyyxxk.wxservice_server.entity.PureCodeName;
 import thyyxxk.wxservice_server.entity.appointment.DoctorInfo;
 import thyyxxk.wxservice_server.entity.electronichealthcard.HisRegister;
 import thyyxxk.wxservice_server.entity.scheduled.TradeNo;
@@ -64,8 +65,8 @@ public interface WxApiDao {
     @Select("select count(1) from mz_deposit_file WITH(NOLOCK) where psordnum=#{tradeNo} and pay_mark=0")
     int alreadyPayed(@Param("tradeNo") String tradeNo);
 
-    @Select("select pay_status from t_wechat_pay_order where trade_no=#{tradeNo} ")
-    Integer selectPayStatus(@Param("tradeNo") String tradeNo);
+    @Select("select pay_status as status,refund_id as name from t_wechat_pay_order where trade_no=#{tradeNo} ")
+    PureCodeName selectPayStatus(@Param("tradeNo") String tradeNo);
 
     @Update("update t_wechat_pay_order set pay_status=4,refund_op_code='99999',refund_reason=#{rea}, " +
             "his_status=0,refund_op_datetime=getdate() where trade_no=#{tradeNo}")

+ 1 - 0
src/main/java/thyyxxk/wxservice_server/entity/PureCodeName.java

@@ -9,6 +9,7 @@ import lombok.Data;
 public class PureCodeName {
     private String code;
     private String name;
+    private Integer status;
 
     public PureCodeName() {
     }

+ 5 - 0
src/main/java/thyyxxk/wxservice_server/service/OrderCovidExamService.java

@@ -39,6 +39,11 @@ public class OrderCovidExamService {
         MAX_COVID_ANTIGEN = maxCount;
     }
 
+    public ResultVo<Integer> selectValidRegForCovidExam(String patNo) {
+        int count = dao.selectValidRegForCovidExam(patNo);
+        return ResultVoUtil.success(count);
+    }
+
     public ResultVo<String> applySingleCovidExam(String patientId) {
         RestTemplate restTemplate = new RestTemplate();
         String url = hrgApiUrl + "/nucleicAcidApplication?patientId=" + patientId;

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

@@ -12,6 +12,7 @@ import thyyxxk.wxservice_server.constant.CardCostTypes;
 import thyyxxk.wxservice_server.constant.TradeState;
 import thyyxxk.wxservice_server.dao.InpatientDao;
 import thyyxxk.wxservice_server.dao.WxApiDao;
+import thyyxxk.wxservice_server.entity.PureCodeName;
 import thyyxxk.wxservice_server.entity.ResultVo;
 import thyyxxk.wxservice_server.entity.appointment.MzyReqrec;
 import thyyxxk.wxservice_server.entity.appointment.SaveAppointmentParam;
@@ -145,9 +146,12 @@ public class SavePayResultService {
             updateHisChargeStatus(hisOrdNum, tradeNo);
             return ResultVoUtil.success("保存门诊缴费信息成功。");
         }
-        Integer status = dao.selectPayStatus(tradeNo);
-        if (null != status && status == TradeState.REFUND.getCode()) {
+        PureCodeName status = dao.selectPayStatus(tradeNo);
+        if (null != status && (status.getStatus() == TradeState.REFUND.getCode() || StringUtil.notBlank(status.getName()))) {
             TradeVectorUtil.removeRefunded(tradeNo);
+            if (status.getStatus() != TradeState.REFUND.getCode()) {
+                dao.updateRefundStatus(tradeNo);
+            }
             return ResultVoUtil.success("因系统原因,订单已退款。请稍后重新缴费或前往一楼收费窗口缴费。");
         }
         if (TradeVectorUtil.tradeNoRefunded(tradeNo)) {