Przeglądaj źródła

新冠疫苗预约需要选择疫苗各类和厂家。

lighter 4 lat temu
rodzic
commit
37d723304b

+ 1 - 1
pom.xml

@@ -10,7 +10,7 @@
     </parent>
     <groupId>thyyxxk</groupId>
     <artifactId>wxservice-server</artifactId>
-    <version>4.9</version>
+    <version>5.0</version>
     <name>wxservice-server</name>
     <description>server for wxservice-web</description>
 

+ 19 - 3
src/main/java/thyyxxk/wxservice_server/controller/CovidVaccinateAppointmentController.java

@@ -4,9 +4,15 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 import thyyxxk.wxservice_server.pojo.ResultVo;
-import thyyxxk.wxservice_server.pojo.covidvaccinate.VaccinatePojo;
+import thyyxxk.wxservice_server.pojo.covidvaccinate.CovidVaccinate;
+import thyyxxk.wxservice_server.pojo.covidvaccinate.ZdCovidVaccinate;
 import thyyxxk.wxservice_server.service.CovidVaccinateAppointmentService;
 
+import java.util.List;
+
+/**
+ * @author dj
+ */
 @RestController
 @RequestMapping("/covidVaccinateAppointment")
 public class CovidVaccinateAppointmentController {
@@ -17,13 +23,23 @@ public class CovidVaccinateAppointmentController {
         this.service = service;
     }
 
+    @GetMapping("/selectVaccinates")
+    public ResultVo<List<ZdCovidVaccinate>> selectVaccinates() {
+        return service.selectVaccinates();
+    }
+
+    @GetMapping("/getVaccinateFactories")
+    public ResultVo<ZdCovidVaccinate> getVaccinateFactories(@RequestParam("id") Integer id) {
+        return service.getVaccinateFactories(id);
+    }
+
     @GetMapping("/getPatientInfoAndJobCategories")
-    public ResultVo<VaccinatePojo> getPatientInfoAndJobCategories(@RequestParam("patientId") String patientId) {
+    public ResultVo<CovidVaccinate> getPatientInfoAndJobCategories(@RequestParam("patientId") String patientId) {
         return service.getPatientInfoAndJobCategories(patientId);
     }
 
     @PostMapping("/submitVaccinateAppointment")
-    public synchronized ResultVo<String> submitVaccinateAppointment(@Validated @RequestBody VaccinatePojo param) {
+    public synchronized ResultVo<String> submitVaccinateAppointment(@Validated @RequestBody CovidVaccinate param) {
         return service.submitVaccinateAppointment(param);
     }
 }

+ 17 - 5
src/main/java/thyyxxk/wxservice_server/dao/CovidVaccinateAppointmentDao.java

@@ -2,7 +2,9 @@ package thyyxxk.wxservice_server.dao;
 
 import org.apache.ibatis.annotations.*;
 import thyyxxk.wxservice_server.pojo.PureCodeName;
-import thyyxxk.wxservice_server.pojo.covidvaccinate.VaccinatePojo;
+import thyyxxk.wxservice_server.pojo.covidvaccinate.CovidVaccinate;
+import thyyxxk.wxservice_server.pojo.covidvaccinate.ZdCovidVaccinate;
+import thyyxxk.wxservice_server.pojo.covidvaccinate.ZdVaccinateFactory;
 
 import java.util.Date;
 import java.util.List;
@@ -10,8 +12,17 @@ import java.util.List;
 @Mapper
 public interface CovidVaccinateAppointmentDao {
 
+    @Select("select * from t_zd_covid_vaccinate where enable_flag=1")
+    List<ZdCovidVaccinate> selectVaccinates();
+
+    @Select("select * from t_zd_covid_vaccinate where id=#{id}")
+    ZdCovidVaccinate selectVaccinatesById(@Param("id") Integer id);
+
+    @Select("select * from t_covid_vaccinate_factory where vaccinate_id=#{id} and enable_flag=1")
+    List<ZdVaccinateFactory> selectFactories(@Param("id") Integer id);
+
     @Select("select top 1 name,phone,social_no from t_wechat_patient_bind where patient_id=#{patientId}")
-    VaccinatePojo selectPatientInfo(@Param("patientId") String patientId);
+    CovidVaccinate selectPatientInfo(@Param("patientId") String patientId);
 
     @Select("select id as code,name from t_covid_appointment_job_category_dict order by id")
     List<PureCodeName> selectJobCategories();
@@ -22,9 +33,10 @@ public interface CovidVaccinateAppointmentDao {
                                 @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) values " +
-            "(#{patientId},#{name},#{sex},#{phone},#{socialNo},#{age},#{corpName},#{jobCategory},#{createDatetime},#{executeDate})")
-    void insertNewAppointment(VaccinatePojo param);
+            "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 where social_no=#{socialNo} and execute_date=#{executeDate} " +
             "and isnull(del_flag,0)!=1")

+ 9 - 1
src/main/java/thyyxxk/wxservice_server/pojo/covidvaccinate/VaccinatePojo.java → src/main/java/thyyxxk/wxservice_server/pojo/covidvaccinate/CovidVaccinate.java

@@ -10,8 +10,16 @@ import javax.validation.constraints.NotNull;
 import java.util.Date;
 import java.util.List;
 
+/**
+ * @author dj
+ */
 @Data
-public class VaccinatePojo {
+public class CovidVaccinate {
+    private Integer vaccinateCode;
+    @NotBlank(message = "请选择疫苗!")
+    private String vaccinateName;
+    @NotBlank(message = "请选择疫苗厂家!")
+    private String vaccinateFactory;
     private String patientId;
     @NotBlank(message = "请填写姓名!")
     private String name;

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

@@ -0,0 +1,18 @@
+package thyyxxk.wxservice_server.pojo.covidvaccinate;
+
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * @author: DingJie
+ * @create: 2021-04-25 17:06:09
+ **/
+@Data
+public class ZdCovidVaccinate {
+    private Integer id;
+    private String name;
+    private String bookTip;
+    private ZdVaccinateFactory factory;
+    private List<ZdVaccinateFactory> factories;
+}

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

@@ -0,0 +1,15 @@
+package thyyxxk.wxservice_server.pojo.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;
+}

+ 22 - 5
src/main/java/thyyxxk/wxservice_server/service/CovidVaccinateAppointmentService.java

@@ -7,7 +7,9 @@ import org.springframework.stereotype.Service;
 import thyyxxk.wxservice_server.config.exception.ExceptionEnum;
 import thyyxxk.wxservice_server.dao.CovidVaccinateAppointmentDao;
 import thyyxxk.wxservice_server.pojo.ResultVo;
-import thyyxxk.wxservice_server.pojo.covidvaccinate.VaccinatePojo;
+import thyyxxk.wxservice_server.pojo.covidvaccinate.CovidVaccinate;
+import thyyxxk.wxservice_server.pojo.covidvaccinate.ZdCovidVaccinate;
+import thyyxxk.wxservice_server.pojo.covidvaccinate.ZdVaccinateFactory;
 import thyyxxk.wxservice_server.pojo.wxapi.PushMessageParam;
 import thyyxxk.wxservice_server.utils.DateUtil;
 import thyyxxk.wxservice_server.utils.IdCardUtil;
@@ -15,6 +17,7 @@ import thyyxxk.wxservice_server.utils.ResultVoUtil;
 import thyyxxk.wxservice_server.utils.StringUtil;
 
 import java.util.Date;
+import java.util.List;
 
 /**
  * @author dj
@@ -31,10 +34,24 @@ public class CovidVaccinateAppointmentService {
         this.wxApiService = wxApiService;
     }
 
-    public ResultVo<VaccinatePojo> getPatientInfoAndJobCategories(String patientId) {
-        VaccinatePojo info = dao.selectPatientInfo(patientId);
+    public ResultVo<List<ZdCovidVaccinate>> selectVaccinates() {
+        return ResultVoUtil.success(dao.selectVaccinates());
+    }
+
+    public ResultVo<ZdCovidVaccinate> getVaccinateFactories(Integer id) {
+        ZdCovidVaccinate vaccinate = dao.selectVaccinatesById(id);
+        List<ZdVaccinateFactory> factories = dao.selectFactories(id);
+        vaccinate.setFactories(factories);
+        if (null != factories && factories.size() == 1) {
+            vaccinate.setFactory(factories.get(0));
+        }
+        return ResultVoUtil.success(vaccinate);
+    }
+
+    public ResultVo<CovidVaccinate> getPatientInfoAndJobCategories(String patientId) {
+        CovidVaccinate info = dao.selectPatientInfo(patientId);
         if (null == info) {
-            info = new VaccinatePojo();
+            info = new CovidVaccinate();
         } else {
             info.setPatientId(patientId);
             String phone = info.getPhone();
@@ -54,7 +71,7 @@ public class CovidVaccinateAppointmentService {
         return ResultVoUtil.success(info);
     }
 
-    public ResultVo<String> submitVaccinateAppointment(VaccinatePojo param) {
+    public ResultVo<String> submitVaccinateAppointment(CovidVaccinate param) {
         param.setCreateDatetime(new Date());
         int age = IdCardUtil.calAgeBySocialNo(param.getSocialNo());
         if (age == -1) {

+ 1 - 1
src/main/resources/application-prod.yml

@@ -1,5 +1,5 @@
 server:
-  port: 8083
+  port: 8085
   servlet:
     context-path: /wxserver
 spring: