chenbin vor 3 Monaten
Ursprung
Commit
ceaa61840e

+ 32 - 0
src/main/java/com/qizhen/healsphere/repository/mapper/IsolateMapper.java

@@ -0,0 +1,32 @@
+package com.qizhen.healsphere.repository.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.qizhen.healsphere.web.param.Isolate;
+import com.qizhen.healsphere.web.vo.InputVO;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
+
+import java.util.Date;
+import java.util.List;
+
+public interface IsolateMapper extends BaseMapper<Isolate> {
+    @Select("<script>" +
+            "SELECT COUNT(*) FROM public.isolate WHERE 1=1 " +
+            "<if test='constellation != null and constellation.size() > 0'>" +
+            "   AND clade IN <foreach collection='constellation' item='item' open='(' separator=',' close=')'>#{item}</foreach>" +
+            "</if>" +
+            "<if test='subtype != null and subtype != \"\"'>" +
+            "   AND subtype = #{subtype}" +
+            "</if>" +
+            "<if test='isChina != null'>" +
+            "   AND is_china = #{isChina}" +
+            "</if>" +
+            "<if test='startDate != null'>" +
+            "   AND collection_date &gt;= #{startDate}" +
+            "</if>" +
+            "<if test='endDate != null'>" +
+            "   AND collection_date &lt;= #{endDate}" +
+            "</if>" +
+            "</script>")
+    int selectCount(@Param("constellation") List<String> constellation, @Param("subtype") String subtype, @Param("isChina") Integer isChina, @Param("startDate") Date startDate, @Param("endDate") Date endDate);
+}

+ 73 - 0
src/main/java/com/qizhen/healsphere/web/param/ChinaProvinceCoordinates.java

@@ -0,0 +1,73 @@
+package com.qizhen.healsphere.web.param;
+
+public enum ChinaProvinceCoordinates {
+    BEIJING("+39.9042", "+116.4074"),
+    TIANJIN("+39.0852", "+117.2069"),
+    HEBEI("+38.0426", "+114.5086"),
+    SHANXI("+37.8707", "+112.5493"),
+    NEIMENGGU("+40.8184", "+111.6701"),
+    LIAONING("+41.7967", "+123.4290"),
+    JILIN("+43.8961", "+125.3245"),
+    HEILONGJIANG("+45.7588", "+126.6424"),
+    SHANGHAI("+31.2304", "+121.4737"),
+    JIANGSU("+32.0415", "+118.7674"),
+    ZHEJIANG("+30.2741", "+120.1551"),
+    ANHUI("+31.8257", "+117.2264"),
+    FUJIAN("+26.0789", "+119.3062"),
+    JIANGXI("+28.6764", "+115.8921"),
+    SHANDONG("+36.6519", "+117.1901"),
+    HENAN("+34.7565", "+113.6654"),
+    HUBEI("+30.5928", "+114.3055"),
+    HUNAN("+28.2184", "+112.9823"),
+    GUANGDONG("+23.1291", "+113.2644"),
+    GUANGXI("+22.8240", "+108.2402"),
+    HAINAN("+20.0169", "+110.3498"),
+    CHONGQING("+29.5630", "+106.5504"),
+    SICHUAN("+30.5728", "+104.0668"),
+    GUIZHOU("+26.5783", "+106.7134"),
+    YUNNAN("+25.0406", "+102.7122"),
+    TIBET("+29.6442", "+91.1327"),
+    SHANXI_WEST("+34.2632", "+108.9480"),
+    GANSU("+36.0581", "+103.8343"),
+    QINGHAI("+36.6250", "+101.7789"),
+    NINGXIA("+38.4864", "+106.2324"),
+    XINJIANG("+43.8258", "+87.6178"),
+    HONG_KONG("+22.3193", "+114.1694"),
+    MACAO("+22.1987", "+113.5439"),
+    TAIWAN("+23.6978", "+120.9605");
+
+    private final String latitude;
+    private final String longitude;
+
+    // 构造函数
+    ChinaProvinceCoordinates(String latitude, String longitude) {
+        this.latitude = latitude;
+        this.longitude = longitude;
+    }
+
+    // 获取纬度
+    public String getLatitude() {
+        return latitude;
+    }
+
+    // 获取经度
+    public String getLongitude() {
+        return longitude;
+    }
+
+    // 根据省级行政区名称获取枚举实例
+    public static ChinaProvinceCoordinates fromName(String name) {
+        for (ChinaProvinceCoordinates province : ChinaProvinceCoordinates.values()) {
+            if (province.name().equalsIgnoreCase(name)) {
+                return province;
+            }
+        }
+        throw new IllegalArgumentException("Unknown province: " + name);
+    }
+
+    // 重写 toString 方法,方便打印
+    @Override
+    public String toString() {
+        return name() + " - Latitude: " + latitude + ", Longitude: " + longitude;
+    }
+}

+ 114 - 0
src/main/java/com/qizhen/healsphere/web/param/Isolate.java

@@ -0,0 +1,114 @@
+package com.qizhen.healsphere.web.param;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.annotation.IdType;
+import java.time.LocalDate;
+import com.baomidou.mybatisplus.annotation.TableId;
+import java.io.Serializable;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+/**
+ * <p>
+ * 病毒分离物核心信息
+ * </p>
+ *
+ * @author chenbin
+ * @since 2025-04-24
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@TableName("isolate")
+public class Isolate implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键
+     */
+    @TableId(value = "isolate_id", type = IdType.AUTO)
+    private String isolateId;
+
+    /**
+     * 病毒名称
+     */
+    @TableField("isolate_name")
+    private String isolateName;
+
+    /**
+     * 采集日期
+     */
+    @TableField("collection_date")
+    private LocalDate collectionDate;
+
+    /**
+     * 提交日期
+     */
+    @TableField("submission_date")
+    private LocalDate submissionDate;
+
+    /**
+     * 更新日期
+     */
+    @TableField("update_date")
+    private LocalDate updateDate;
+
+    /**
+     * 亚型
+     */
+    @TableField("subtype")
+    private String subtype;
+
+    /**
+     * 基因型
+     */
+    @TableField("genotype")
+    private String genotype;
+
+    /**
+     * 谱系
+     */
+    @TableField("lineage")
+    private String lineage;
+
+    /**
+     * 进化分支
+     */
+    @TableField("clade")
+    private String clade;
+
+    /**
+     * 地理来源
+     */
+    @TableField("location")
+    private String location;
+
+    /**
+     * 宿主外键
+     */
+    @TableField("host_id")
+    private Integer hostId;
+
+    /**
+     * 提交实验室外键
+     */
+    @TableField("submitting_lab_id")
+    private Integer submittingLabId;
+
+    /**
+     * 原始实验室外键
+     */
+    @TableField("originating_lab_id")
+    private Integer originatingLabId;
+
+    /**
+     * 是否为中国
+     */
+    @TableField("is_china")
+    private Integer isChina;
+
+
+}