Jelajahi Sumber

优化自助开单直达项目

lighter 1 tahun lalu
induk
melakukan
b6e3da648a

+ 2 - 0
src/main/java/thyyxxk/wxservice_server/api/WxAppletApi.java

@@ -152,6 +152,8 @@ public class WxAppletApi {
                 sb.append(cartId).append(",");
             }
             order.setCartIds(sb.toString());
+        } else {
+            order.setCartIds("");
         }
         appletDao.insertNewOrder(order);
         return ResultVoUtil.success(order);

+ 10 - 0
src/main/java/thyyxxk/wxservice_server/controller/BookableController.java

@@ -26,6 +26,16 @@ public class BookableController {
         this.service.startAutoCancelUnpaidOrderTask();
     }
 
+    @GetMapping("/getDirectBookableItems")
+    public ResultVo<List<BookedYjReq>> getDirectBookableItems() {
+        return service.getDirectBookableItems();
+    }
+
+    @PostMapping("/applyDirectBookableItem")
+    public ResultVo<String> applyDirectBookableItem(@RequestBody BookedYjReq item) {
+        return service.applyDirectBookableItem(item);
+    }
+
     @GetMapping("/getBookableData")
     public ResultVo<List<YjReqItem>> getBookableData(@RequestParam("tableName") String tableName) {
         return service.getBookableData(tableName);

+ 0 - 45
src/main/java/thyyxxk/wxservice_server/controller/CovidVaccinateAppointmentController.java

@@ -1,45 +0,0 @@
-package thyyxxk.wxservice_server.controller;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.*;
-import thyyxxk.wxservice_server.entity.ResultVo;
-import thyyxxk.wxservice_server.entity.covidvaccinate.CovidVaccinate;
-import thyyxxk.wxservice_server.entity.covidvaccinate.ZdCovidVaccinate;
-import thyyxxk.wxservice_server.service.CovidVaccinateAppointmentService;
-
-import java.util.List;
-
-/**
- * @author dj
- */
-@RestController
-@RequestMapping("/covidVaccinateAppointment")
-public class CovidVaccinateAppointmentController {
-    private final CovidVaccinateAppointmentService service;
-
-    @Autowired
-    public CovidVaccinateAppointmentController(CovidVaccinateAppointmentService service) {
-        this.service = service;
-    }
-
-    @GetMapping("/selectVaccinates")
-    public ResultVo<List<ZdCovidVaccinate>> selectVaccinates() {
-        return service.selectVaccinates();
-    }
-
-    @GetMapping("/getPatientInfoAndJobCategories")
-    public ResultVo<CovidVaccinate> getPatientInfoAndJobCategories(@RequestParam("patientId") String patientId) {
-        return service.getPatientInfoAndJobCategories(patientId);
-    }
-
-    @GetMapping("/getNextSevenDaysSources")
-    public ResultVo<int[]> getNextSevenDaysSources(int code) {
-        return service.getNextSevenDaysSources(code);
-    }
-
-    @PostMapping("/submitVaccinateAppointment")
-    public synchronized ResultVo<String> submitVaccinateAppointment(@Validated @RequestBody CovidVaccinate param) {
-        return service.submitVaccinateAppointment(param);
-    }
-}

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

@@ -1,41 +0,0 @@
-package thyyxxk.wxservice_server.controller;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
-import thyyxxk.wxservice_server.entity.ResultVo;
-import thyyxxk.wxservice_server.service.OrderCovidExamService;
-
-/**
- * @author dj
- */
-@RestController
-@RequestMapping("/orderCovid")
-public class OrderCovidController {
-    private final OrderCovidExamService service;
-
-    @Autowired
-    public OrderCovidController(OrderCovidExamService service) {
-        this.service = service;
-    }
-
-    @GetMapping("/setCovidAntigenLimit")
-    public void setCovidAntigenLimit(@RequestParam("needCheck") Boolean needCheck,
-                                     @RequestParam("maxCount") int maxCount) {
-        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);
-    }
-
-    @GetMapping("/timeLimitChanged")
-    public void timeLimitChanged() {
-
-    }
-}

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

@@ -1,8 +1,6 @@
 package thyyxxk.wxservice_server.dao;
 
 import org.apache.ibatis.annotations.*;
-import thyyxxk.wxservice_server.entity.PureCodeName;
-import thyyxxk.wxservice_server.entity.assessment.CovidQuestionnaire;
 import thyyxxk.wxservice_server.entity.appointment.DoctorInfo;
 
 /**
@@ -43,23 +41,6 @@ public interface AppointmentDao {
             "from a_employee_mi with(nolock) where code=#{code}")
     DoctorInfo selectPortraitAndIntroduction(@Param("code") String code);
 
-    @Select("select count(1) from mzy_reqrec where patient_id=#{patientId} and cancel_mark=0 " +
-            "and datediff(day, request_day, getdate())=0")
-    int regNoExist(@Param("patientId") String patientId);
-
-    @Select("select count(1) from mz_yj_req with(nolock) where patient_id=#{patientId} and " +
-            "order_code=#{code} and isnull(del_flag,0)=0 and datediff(day,req_date,getdate())=0")
-    int reqNoExist(@Param("patientId") String patientId,
-                   @Param("code") String code);
-
-    @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);
-
     @Select("select dept_describe from zd_unit_code where code=#{code} ")
     String selectDeptDescription(String code);
 }

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

@@ -18,6 +18,9 @@ import java.util.List;
 @Mapper
 public interface BookableDao {
 
+    @Select("select * from t_wechat_bookable_items order by sort_no")
+    List<BookedYjReq> selectDirectBookableItems();
+
     @Select("select rtrim(code) as code, rtrim(name) as name, rtrim(exec_unit) as execUnit, " +
             "execUnitName=(select rtrim(name) from zd_unit_code with(nolock) where code=exec_unit) " +
             "from ${tableName} with(nolock) where isnull(del_flag,0)!=1 and wx_bookable_flag=1 and isnull(exec_unit,'')!=''")
@@ -31,6 +34,10 @@ public interface BookableDao {
     int reqNoExist(@Param("patientId") String patientId,
                         @Param("code") String code);
 
+    @Select("select count(1) from mz_yj_req with(nolock) where patient_id=#{patientId} and " +
+            "order_code=#{code} and isnull(del_flag,0)=0 and datediff(day,req_date,getdate())=0")
+    int bookableItemExist(@Param("patientId") String patientId, @Param("code") String code);
+
     @Select("select req_no from mz_yj_req with(nolock) where patient_id=#{patientId} and pay_mark=5 and " +
             "order_code=#{code} and isnull(del_flag,0)=0 and req_doctor='99999' and datediff(day,req_date,getdate())<=3")
     Integer selectReqNo(@Param("patientId") String patientId,

+ 0 - 60
src/main/java/thyyxxk/wxservice_server/dao/CovidVaccinateAppointmentDao.java

@@ -1,60 +0,0 @@
-package thyyxxk.wxservice_server.dao;
-
-import org.apache.ibatis.annotations.*;
-import thyyxxk.wxservice_server.entity.PureCodeName;
-import thyyxxk.wxservice_server.entity.covidvaccinate.CovidVaccinate;
-import thyyxxk.wxservice_server.entity.covidvaccinate.ZdCovidVaccinate;
-
-import java.util.Date;
-import java.util.List;
-
-/**
- * @author dj
- */
-@Mapper
-public interface CovidVaccinateAppointmentDao {
-
-    @Select("select name as vaccinateFactory, " +
-            "code as vaccinateCode, " +
-            "vaccinateName=(select name from t_zd_covid_vaccinate with(nolock) where id=vaccinate_id), " +
-            "bookTip=(select book_tip from t_zd_covid_vaccinate with(nolock) where id=vaccinate_id) " +
-            "from t_covid_vaccinate_factory with(nolock) " +
-            "where enable_flag=1")
-    List<ZdCovidVaccinate> selectVaccinates();
-
-    @Select("select top 1 name,phone,social_no from t_wechat_patient_bind with(nolock) where patient_id=#{patientId}")
-    CovidVaccinate selectPatientInfo(@Param("patientId") String patientId);
-
-    @Select("select id as code,name from t_covid_appointment_job_category_dict with(nolock) order by id")
-    List<PureCodeName> selectJobCategories();
-
-    @Update("update t_wechat_patient_bind set phone=#{phone},social_no=#{socialNo} where patient_id=#{patientId}")
-    void updatePhoneAndSocialNo(@Param("patientId") String patientId,
-                                @Param("socialNo") String socialNo,
-                                @Param("phone") String phone);
-
-    @Insert("insert into t_covid_vaccinate_appointment (patient_id, name, sex, phone, social_no, age, corp_name, " +
-            "job_category, create_datetime, execute_date, vaccinate_code, vaccinate_name, vaccinate_factory) values " +
-            "(#{patientId},#{name},#{sex},#{phone},#{socialNo},#{age},#{corpName},#{jobCategory},#{createDatetime}," +
-            "#{executeDate},#{vaccinateCode},#{vaccinateName},#{vaccinateFactory})")
-    void insertNewAppointment(CovidVaccinate param);
-
-    @Select("select count(1) from t_covid_vaccinate_appointment with(nolock) where social_no=#{socialNo} " +
-            "and execute_date=#{executeDate} and isnull(del_flag,0)!=1")
-    int selectValidAppointment(@Param("socialNo") String socialNo,
-                               @Param("executeDate") Date executeDate);
-
-    @Select("select value from t_covid_vaccinate_threshold_new with(nolock) where date=#{date} and code=#{code}")
-    Integer selectThresholdByDateAndCode(@Param("date") String date, @Param("code") Integer code);
-
-    @Select("select count(1) from t_covid_vaccinate_appointment with(nolock) where execute_date=#{executeDate} and " +
-            "isnull(del_flag,0)!=1 and vaccinate_code=#{code}")
-    Integer selectTotalCountByDateAndCode(@Param("executeDate") String executeDate, @Param("code") Integer code);
-
-    @Select("select value from t_covid_vaccinate_threshold_new with(nolock) where date=#{date} and code=#{code}")
-    Integer selectThresholdByDateAndCode2(@Param("date") Date date, @Param("code") Integer code);
-
-    @Select("select count(1) from t_covid_vaccinate_appointment with(nolock) where execute_date=#{executeDate} and " +
-            "isnull(del_flag,0)!=1 and vaccinate_code=#{code}")
-    Integer selectTotalCountByDateAndCode2(@Param("executeDate") Date executeDate, @Param("code") Integer code);
-}

+ 1 - 1
src/main/java/thyyxxk/wxservice_server/entity/covid/MzBlRecord.java → src/main/java/thyyxxk/wxservice_server/entity/bookable/MzBlRecord.java

@@ -1,4 +1,4 @@
-package thyyxxk.wxservice_server.entity.covid;
+package thyyxxk.wxservice_server.entity.bookable;
 
 import lombok.Data;
 

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

@@ -1,7 +1,6 @@
 package thyyxxk.wxservice_server.entity.bookable;
 
 import lombok.Data;
-import thyyxxk.wxservice_server.entity.covid.MzBlRecord;
 
 import java.util.ArrayList;
 import java.util.HashMap;

+ 0 - 35
src/main/java/thyyxxk/wxservice_server/entity/covid/OrderCovidExamParam.java

@@ -1,35 +0,0 @@
-package thyyxxk.wxservice_server.entity.covid;
-
-import lombok.Data;
-import thyyxxk.wxservice_server.constant.Constants;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-
-/**
- * @author dj
- */
-@Data
-public class OrderCovidExamParam {
-    private String patientId;
-    private String visitDeptCode = "1400004";
-    private String doctorCode = "99999";
-    private String inspectPart = "";
-    private String reqComment = "申请核酸检测";
-    private String reqTzComment = "申请核酸检测";
-    private String birthDate;
-    private String icdCode = "ZD001";
-    private String icdText = "申请核酸检测";
-    private Integer jzFlag = 0;
-    private MzBlRecord mzBlRecord = new MzBlRecord();
-    private List<HashMap<String, String>> mzChargeDetailList = new ArrayList<>();
-    private List<HashMap<String, String>> mzYjReqList;
-
-    public void initMzYjReqList() {
-        mzYjReqList = new ArrayList<>();
-        HashMap<String, String> map = new HashMap<>(Constants.Capacity.DEFAULT);
-        map.put("orderCode", "003585");
-        mzYjReqList.add(map);
-    }
-}

+ 0 - 43
src/main/java/thyyxxk/wxservice_server/entity/covidvaccinate/CovidVaccinate.java

@@ -1,43 +0,0 @@
-package thyyxxk.wxservice_server.entity.covidvaccinate;
-
-import com.fasterxml.jackson.annotation.JsonFormat;
-import lombok.Data;
-import org.springframework.format.annotation.DateTimeFormat;
-import thyyxxk.wxservice_server.entity.PureCodeName;
-
-import javax.validation.constraints.NotBlank;
-import javax.validation.constraints.NotNull;
-import java.util.Date;
-import java.util.List;
-
-/**
- * @author dj
- */
-@Data
-public class CovidVaccinate {
-    private Integer vaccinateCode;
-    @NotBlank(message = "请选择疫苗!")
-    private String vaccinateName;
-    @NotBlank(message = "请选择疫苗厂家!")
-    private String vaccinateFactory;
-    private String patientId;
-    @NotBlank(message = "请填写姓名!")
-    private String name;
-    private Integer sex;
-    @NotBlank(message = "请填写手机号!")
-    private String phone;
-    @NotBlank(message = "请填写身份证号!")
-    private String socialNo;
-    private Integer age;
-    @NotBlank(message = "请填写工作单位,没有工作单位请填‘无’!")
-    private String corpName;
-    @NotNull(message = "请选择工作性质,如不确定请选‘其他人员’,如无工作请选择‘家务及待业人员’")
-    private Integer jobCategory;
-    private Date createDatetime;
-    @NotNull(message = "请选择预约接种的日期!")
-    @DateTimeFormat(pattern = "yyyy-MM-dd")
-    @JsonFormat(pattern = "yyyy-MM-dd")
-    private Date executeDate;
-
-    private List<PureCodeName> jobCategories;
-}

+ 0 - 18
src/main/java/thyyxxk/wxservice_server/entity/covidvaccinate/ZdCovidVaccinate.java

@@ -1,18 +0,0 @@
-package thyyxxk.wxservice_server.entity.covidvaccinate;
-
-import lombok.Data;
-
-import java.util.List;
-
-/**
- * @author: DingJie
- * @create: 2021-04-25 17:06:09
- **/
-@Data
-public class ZdCovidVaccinate {
-    private Integer vaccinateCode;
-    private String vaccinateName;
-    private String bookTip;
-    private String vaccinateFactory;
-    private Integer minLeftNum;
-}

+ 0 - 15
src/main/java/thyyxxk/wxservice_server/entity/covidvaccinate/ZdVaccinateFactory.java

@@ -1,15 +0,0 @@
-package thyyxxk.wxservice_server.entity.covidvaccinate;
-
-import lombok.Data;
-
-/**
- * @author: DingJie
- * @create: 2021-04-25 17:35:57
- **/
-@Data
-public class ZdVaccinateFactory {
-    private Integer code;
-    private String specification;
-    private Double price;
-    private String name;
-}

+ 33 - 4
src/main/java/thyyxxk/wxservice_server/service/BookableService.java

@@ -11,10 +11,7 @@ import thyyxxk.wxservice_server.config.exception.ExceptionEnum;
 import thyyxxk.wxservice_server.constant.Constants;
 import thyyxxk.wxservice_server.dao.BookableDao;
 import thyyxxk.wxservice_server.entity.ResultVo;
-import thyyxxk.wxservice_server.entity.bookable.YjReqItem;
-import thyyxxk.wxservice_server.entity.bookable.BookedYjReq;
-import thyyxxk.wxservice_server.entity.bookable.Prescription;
-import thyyxxk.wxservice_server.entity.bookable.RejectedYjReq;
+import thyyxxk.wxservice_server.entity.bookable.*;
 import thyyxxk.wxservice_server.entity.hrgresponse.HrgCommonResponse;
 import thyyxxk.wxservice_server.entity.hrgresponse.SaveMzFeeResponse;
 import thyyxxk.wxservice_server.entity.wxapi.WxPayOrder;
@@ -47,6 +44,38 @@ public class BookableService {
         this.refundService = refundService;
     }
 
+    public ResultVo<List<BookedYjReq>> getDirectBookableItems() {
+        return ResultVoUtil.success(dao.selectDirectBookableItems());
+    }
+
+    public ResultVo<String> applyDirectBookableItem(BookedYjReq item) {
+        int reqNoExist = dao.bookableItemExist(item.getPatientId(), item.getCode());
+        if (reqNoExist > 0) {
+            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "您今日已经下单过" +
+                    item.getName() + ",无法继续下单,敬请谅解。");
+        }
+        return executeOrderDirectBookableItem(item);
+    }
+
+    private ResultVo<String> executeOrderDirectBookableItem(BookedYjReq yjReq) {
+        Prescription book = new Prescription();
+        book.initMzYjReqList(yjReq);
+        book.getMzBlRecord().setEmrChiefComplaint("申请" + yjReq.getName());
+        book.getMzBlRecord().setEmrPe("申请" + yjReq.getName());
+        book.getMzBlRecord().setEmrFzjc("申请" + yjReq.getName());
+        book.getMzBlRecord().setEmrProcess("申请" + yjReq.getName());
+        RestTemplate restTemplate = new RestTemplate();
+        SaveMzFeeResponse hrgResponse = restTemplate.postForObject(hrgApiUrl + "/savePrescription", book, SaveMzFeeResponse.class);
+        log.info("自助开单预约:\n参数:{}\n结果:{}", JSONObject.toJSONString(book), JSONObject.toJSONString(hrgResponse));
+        if (null == hrgResponse) {
+            return ResultVoUtil.fail(ExceptionEnum.NETWORK_ERROR);
+        }
+        if (-1 == hrgResponse.getResultCode()) {
+            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, hrgResponse.getResultMessage());
+        }
+        return ResultVoUtil.success();
+    }
+
     public ResultVo<List<YjReqItem>> getBookableData(String tableName) {
         return ResultVoUtil.success(dao.getBookableData(tableName));
     }

+ 0 - 144
src/main/java/thyyxxk/wxservice_server/service/CovidVaccinateAppointmentService.java

@@ -1,144 +0,0 @@
-package thyyxxk.wxservice_server.service;
-
-import com.alibaba.fastjson.JSONObject;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import thyyxxk.wxservice_server.config.exception.ExceptionEnum;
-import thyyxxk.wxservice_server.constant.Constants;
-import thyyxxk.wxservice_server.dao.CovidVaccinateAppointmentDao;
-import thyyxxk.wxservice_server.entity.ResultVo;
-import thyyxxk.wxservice_server.entity.covidvaccinate.CovidVaccinate;
-import thyyxxk.wxservice_server.entity.covidvaccinate.ZdCovidVaccinate;
-import thyyxxk.wxservice_server.entity.wxapi.PushMessageParam;
-import thyyxxk.wxservice_server.utils.DateUtil;
-import thyyxxk.wxservice_server.utils.IdCardUtil;
-import thyyxxk.wxservice_server.utils.ResultVoUtil;
-import thyyxxk.wxservice_server.utils.StringUtil;
-
-import java.util.Date;
-import java.util.List;
-
-/**
- * @author dj
- */
-@Slf4j
-@Service
-public class CovidVaccinateAppointmentService {
-    private final CovidVaccinateAppointmentDao dao;
-    private final PushWxMessageService pushWxMessageService;
-
-    @Autowired
-    public CovidVaccinateAppointmentService(CovidVaccinateAppointmentDao dao, PushWxMessageService pushWxMessageService) {
-        this.dao = dao;
-        this.pushWxMessageService = pushWxMessageService;
-    }
-
-    public ResultVo<List<ZdCovidVaccinate>> selectVaccinates() {
-        List<ZdCovidVaccinate> list = dao.selectVaccinates();
-        if (null != list && !list.isEmpty()) {
-            String[] nextSevenDate = DateUtil.getDatesInOneWeek();
-            list.forEach(item -> {
-                for (String date : nextSevenDate) {
-                    Integer max = dao.selectThresholdByDateAndCode(date, item.getVaccinateCode());
-                    max = null == max ? 0 : max;
-                    Integer count = dao.selectTotalCountByDateAndCode(date, item.getVaccinateCode());
-                    count = null == count ? 0 : count;
-                    int offset = max - count;
-                    item.setMinLeftNum(offset);
-                    if (offset > 0) {
-                        break;
-                    }
-                }
-            });
-        }
-        return ResultVoUtil.success(list);
-    }
-
-    public ResultVo<CovidVaccinate> getPatientInfoAndJobCategories(String patientId) {
-        CovidVaccinate info = dao.selectPatientInfo(patientId);
-        if (null == info) {
-            info = new CovidVaccinate();
-        } else {
-            info.setPatientId(patientId);
-            String phone = info.getPhone();
-            String socialNo = info.getSocialNo();
-            if (null != phone) {
-                if (phone.length() != Constants.CommonLength.PHONE) {
-                    info.setPhone(null);
-                }
-            }
-            if (null != socialNo) {
-                if (socialNo.startsWith(Constants.Exception.ILLEGAL_ID_START) ||
-                        socialNo.length() != Constants.CommonLength.ID_CARD) {
-                    info.setSocialNo(null);
-                }
-            }
-        }
-        info.setJobCategories(dao.selectJobCategories());
-        return ResultVoUtil.success(info);
-    }
-
-    public ResultVo<int[]> getNextSevenDaysSources(int code) {
-        int[] result = new int[7];
-        String[] nextSevenDate = DateUtil.getDatesInOneWeek();
-        for (int i = 0; i < nextSevenDate.length; i++) {
-            String date = nextSevenDate[i];
-            Integer max = dao.selectThresholdByDateAndCode(date, code);
-            max = null == max ? 0 : max;
-            Integer count = dao.selectTotalCountByDateAndCode(date, code);
-            count = null == count ? 0 : count;
-            result[i] = max - count;
-        }
-        return ResultVoUtil.success(result);
-    }
-
-    public ResultVo<String> submitVaccinateAppointment(CovidVaccinate param) {
-        param.setCreateDatetime(new Date());
-        if (!IdCardUtil.isValidatedIdCard(param.getSocialNo())) {
-            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "您在我院绑定的身份证号不是有效的身份证号," +
-                    "请前往【个人中心 - 我的就诊人 - 就诊人信息】进行修改。");
-        }
-        int age = IdCardUtil.getAgeByIdCard(param.getSocialNo());
-        if (age < 18 || age > 70) {
-            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "可接种的年龄区间为【18岁 - 70岁】," +
-                    "您的年龄不满足此条件,敬请谅解。");
-        }
-        param.setAge(age);
-        param.setSex(IdCardUtil.getGenderByIdCard(param.getSocialNo()).getCode());
-        String dateFormatted = DateUtil.formatDatetime(param.getExecuteDate(), "yyyy-MM-dd");
-        if (dao.selectValidAppointment(param.getSocialNo(), param.getExecuteDate()) > 0) {
-            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "您在【" + dateFormatted + "】已存在有效的预约,请勿重复预约。");
-        }
-        Integer threshold = dao.selectThresholdByDateAndCode2(param.getExecuteDate(), param.getVaccinateCode());
-        if (null == threshold) {
-            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "【" + dateFormatted + "】没有可预约的疫苗,请选择其他预约日期。");
-        }
-        Integer count = dao.selectTotalCountByDateAndCode2(param.getExecuteDate(), param.getVaccinateCode());
-        count = null == count ? 0 : count;
-        if (count >= threshold) {
-            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "【" + dateFormatted + "】的预约名额已满,请选择其他预约日期。");
-        }
-        dao.insertNewAppointment(param);
-        if (StringUtil.notBlank(param.getPatientId())) {
-            dao.updatePhoneAndSocialNo(param.getPatientId(), param.getSocialNo(), param.getPhone());
-            String msgContent = "{\"touser\":\"\",\"data\":" +
-                    "{\"keyword2\":{\"color\":\"#173177\",\"value\":\"" + dateFormatted + "\"}," +
-                    "\"keyword1\":{\"color\":\"#173177\",\"value\":\"" + param.getName() + "\"}," +
-                    "\"keyword3\":{\"color\":\"#173177\",\"value\":\"" + (++count) + "\"}," +
-                    "\"remark\":{\"color\":\"#FF0000\",\"value\":\"感谢您的使用,祝您健康!\"}," +
-                    "\"first\":{\"color\":\"#FF0000\",\"value\":\"您已成功预约新冠疫苗接种服务。" +
-                    "请于【" + dateFormatted + "】凭本人身份证在【泰和医院门诊大楼五楼体检中心】接种新冠疫苗。\"}}," +
-                    "\"template_id\":\"zVSzbYLmdqq_h1IcTPSwi6X4qFm0j9aTVeLZPxR03Bs\"," +
-                    "\"url\":\"\"}";
-            PushMessageParam pojo = new PushMessageParam();
-            pojo.setCardNo(param.getPatientId());
-            pojo.setCardNoPatientId(true);
-            pojo.setMsgContext(JSONObject.parseObject(msgContent));
-            pushWxMessageService.pushMessage2(pojo);
-        }
-        log.info("预约新冠疫苗接种:{}", JSONObject.toJSONStringWithDateFormat(param, "yyyy-MM-dd HH:mm:ss"));
-        return ResultVoUtil.success("您已成功预约新冠疫苗接种服务。请于【" + dateFormatted + "】" +
-                "凭本人身份证在【泰和医院门诊大楼五楼体检中心】接种新冠疫苗。");
-    }
-}

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

@@ -1,101 +0,0 @@
-package thyyxxk.wxservice_server.service;
-
-import com.alibaba.fastjson.JSONObject;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.stereotype.Service;
-import org.springframework.web.client.RestTemplate;
-import thyyxxk.wxservice_server.config.exception.ExceptionEnum;
-import thyyxxk.wxservice_server.dao.AppointmentDao;
-import thyyxxk.wxservice_server.entity.ResultVo;
-import thyyxxk.wxservice_server.entity.bookable.BookedYjReq;
-import thyyxxk.wxservice_server.entity.bookable.Prescription;
-import thyyxxk.wxservice_server.entity.hrgresponse.SaveMzFeeResponse;
-import thyyxxk.wxservice_server.utils.ResultVoUtil;
-
-/**
- * @author dj
- */
-@Slf4j
-@Service
-public class OrderCovidExamService {
-    private final AppointmentDao dao;
-    private final ElectronicHealthCardService healthCardService;
-    private static Boolean CHECK_MAX_COVID_ANTIGEN = true;
-    private static Integer MAX_COVID_ANTIGEN = 100;
-
-    @Value("${hrgApiUrl}")
-    private String hrgApiUrl;
-
-    @Autowired
-    public OrderCovidExamService(AppointmentDao dao, ElectronicHealthCardService healthCardService) {
-        this.dao = dao;
-        this.healthCardService = healthCardService;
-    }
-
-    public void setCovidAntigenLimit(Boolean needCheck, int maxCount) {
-        CHECK_MAX_COVID_ANTIGEN = needCheck;
-        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;
-        SaveMzFeeResponse hrgResponse = restTemplate.getForObject(url, SaveMzFeeResponse.class);
-        log.info("【单人单管】快速下单核酸检测:患者:{},结果:{}", patientId, hrgResponse);
-        if (null == hrgResponse) {
-            return ResultVoUtil.fail(ExceptionEnum.NETWORK_ERROR);
-        }
-        if (0 == hrgResponse.getResultCode()) {
-            healthCardService.reportHisData(patientId, "01010111", null, null);
-            return ResultVoUtil.success();
-        }
-        return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, hrgResponse.getResultMessage());
-    }
-
-    public ResultVo<String> applyCovidAntigen(String patientId) {
-        if (CHECK_MAX_COVID_ANTIGEN && dao.reqCount("004651") >= MAX_COVID_ANTIGEN) {
-            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "今日新冠抗原检测已售罄,无法继续下单,敬请谅解。");
-        }
-        int regNoExist = dao.regNoExist(patientId);
-        if (regNoExist == 0) {
-            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "您今日没有有效的挂号信息,无法继续下单,敬请谅解。");
-        }
-        int reqNoExist = dao.reqNoExist(patientId, "004651");
-        if (reqNoExist > 0) {
-            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "您今日已经下单过新型冠状病毒抗原检测,无法继续下单,敬请谅解。");
-        }
-        BookedYjReq req = new BookedYjReq();
-        req.setPatientId(patientId);
-        req.setCode("004651");
-        req.setName("新型冠状病毒抗原检测");
-        return orderCovidAntigen(req);
-    }
-
-    private ResultVo<String> orderCovidAntigen(BookedYjReq param) {
-        Prescription book = new Prescription();
-        book.initMzYjReqList(param);
-        book.getMzBlRecord().setEmrChiefComplaint("申请新型冠状病毒抗原检测");
-        book.getMzBlRecord().setEmrPe("申请新型冠状病毒抗原检测");
-        book.getMzBlRecord().setEmrFzjc("申请新型冠状病毒抗原检测");
-        book.getMzBlRecord().setEmrProcess("申请新型冠状病毒抗原检测");
-        log.info("自助开单预约:{}", JSONObject.toJSONString(book));
-        RestTemplate restTemplate = new RestTemplate();
-        SaveMzFeeResponse hrgResponse = restTemplate.postForObject(hrgApiUrl + "/savePrescription", book, SaveMzFeeResponse.class);
-        log.info("自助开单:{},结果:{}", param, hrgResponse);
-        if (null == hrgResponse) {
-            return ResultVoUtil.fail(ExceptionEnum.NETWORK_ERROR);
-        }
-        if (-1 == hrgResponse.getResultCode()) {
-            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, hrgResponse.getResultMessage());
-        }
-        return ResultVoUtil.success();
-    }
-
-}

+ 4 - 2
src/main/resources/application.yml

@@ -32,9 +32,11 @@ mybatis:
   configuration:
     map-underscore-to-camel-case: true
 
-hrgApiUrl: http://172.16.30.119:8089/thmz/api/v1
+#hrgApiUrl: http://172.16.30.119:8089/thmz/api/v1
+#appletThmzUrl: http://172.16.30.119:8089/thmz
 
-appletThmzUrl: http://172.16.30.119:8089/thmz
+hrgApiUrl: http://172.16.30.26:8089/thmz/api/v1
+appletThmzUrl: http://172.16.30.26:8089/thmz
 
 inspectionUrl: http://172.16.32.178:622/pushservice.asmx?wsdl
 physicalCheck: http://172.16.32.183:8888/bdp/dataservice/api/