修改2.0
This commit is contained in:
parent
5211e8e3fa
commit
12da9cf3a0
@ -8,6 +8,7 @@ import java.time.LocalDateTime;
|
|||||||
import java.time.LocalTime;
|
import java.time.LocalTime;
|
||||||
import java.time.ZoneId;
|
import java.time.ZoneId;
|
||||||
import java.time.ZonedDateTime;
|
import java.time.ZonedDateTime;
|
||||||
|
import java.time.temporal.ChronoUnit;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import org.apache.commons.lang3.time.DateFormatUtils;
|
import org.apache.commons.lang3.time.DateFormatUtils;
|
||||||
|
|
||||||
|
|||||||
@ -3,6 +3,7 @@ package com.zhyc.module.base.mapper;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.zhyc.module.base.domain.BasSheep;
|
import com.zhyc.module.base.domain.BasSheep;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -11,6 +12,7 @@ import org.apache.ibatis.annotations.Param;
|
|||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
* @date 2025-07-15
|
* @date 2025-07-15
|
||||||
*/
|
*/
|
||||||
|
@Mapper
|
||||||
public interface BasSheepMapper
|
public interface BasSheepMapper
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -88,7 +88,6 @@ public class DiagnosisController extends BaseController
|
|||||||
@PostMapping("/adds")
|
@PostMapping("/adds")
|
||||||
public AjaxResult adds(@RequestBody Diagnosis diagnosis)
|
public AjaxResult adds(@RequestBody Diagnosis diagnosis)
|
||||||
{
|
{
|
||||||
System.out.println(diagnosis);
|
|
||||||
return toAjax(diagnosisService.insertDiagnosisList(diagnosis));
|
return toAjax(diagnosisService.insertDiagnosisList(diagnosis));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,11 +1,14 @@
|
|||||||
package com.zhyc.module.biosafety.domain;
|
package com.zhyc.module.biosafety.domain;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import com.zhyc.common.annotation.Excel;
|
import com.zhyc.common.annotation.Excel;
|
||||||
import com.zhyc.common.core.domain.BaseEntity;
|
import com.zhyc.common.core.domain.BaseEntity;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 药品使用记录详情对象 sw_medicine_usage_details
|
* 药品使用记录详情对象 sw_medicine_usage_details
|
||||||
*
|
*
|
||||||
@ -46,6 +49,11 @@ public class SwMedicineUsageDetails extends BaseEntity
|
|||||||
@Excel(name = "使用方法")
|
@Excel(name = "使用方法")
|
||||||
private String usageId;
|
private String usageId;
|
||||||
|
|
||||||
|
/** 使用时间 */
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@Excel(name = "使用时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private Date usetime;
|
||||||
|
|
||||||
/** 生产厂家 */
|
/** 生产厂家 */
|
||||||
@Excel(name = "生产厂家")
|
@Excel(name = "生产厂家")
|
||||||
private String manufacturer;
|
private String manufacturer;
|
||||||
|
|||||||
@ -89,6 +89,10 @@ public class Treatment extends BaseEntity
|
|||||||
/** 兽医 */
|
/** 兽医 */
|
||||||
@Excel(name = "兽医")
|
@Excel(name = "兽医")
|
||||||
private String veterinary;
|
private String veterinary;
|
||||||
|
/** 治疗状态 */
|
||||||
|
@Excel(name = "治疗状态")
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
|
||||||
/** 药品使用记录id */
|
/** 药品使用记录id */
|
||||||
@Excel(name = "药品使用记录id")
|
@Excel(name = "药品使用记录id")
|
||||||
|
|||||||
@ -63,4 +63,7 @@ public interface TreatmentMapper
|
|||||||
public int deleteTreatmentByIds(Long[] ids);
|
public int deleteTreatmentByIds(Long[] ids);
|
||||||
|
|
||||||
int insertTreatmentList(List<Treatment> treatments);
|
int insertTreatmentList(List<Treatment> treatments);
|
||||||
|
|
||||||
|
|
||||||
|
List<Treatment> selectTreatmentStatus(Long sheepId);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
package com.zhyc.module.biosafety.service.impl;
|
package com.zhyc.module.biosafety.service.impl;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
@ -9,13 +10,18 @@ import com.zhyc.module.base.domain.BasSheep;
|
|||||||
import com.zhyc.module.base.domain.SheepFile;
|
import com.zhyc.module.base.domain.SheepFile;
|
||||||
import com.zhyc.module.base.mapper.BasSheepMapper;
|
import com.zhyc.module.base.mapper.BasSheepMapper;
|
||||||
import com.zhyc.module.base.mapper.SheepFileMapper;
|
import com.zhyc.module.base.mapper.SheepFileMapper;
|
||||||
|
import com.zhyc.module.biosafety.domain.Treatment;
|
||||||
import com.zhyc.module.biosafety.mapper.DiagnosisMapper;
|
import com.zhyc.module.biosafety.mapper.DiagnosisMapper;
|
||||||
|
import com.zhyc.module.biosafety.mapper.TreatmentMapper;
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.zhyc.module.biosafety.domain.Diagnosis;
|
import com.zhyc.module.biosafety.domain.Diagnosis;
|
||||||
import com.zhyc.module.biosafety.service.IDiagnosisService;
|
import com.zhyc.module.biosafety.service.IDiagnosisService;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 诊疗结果Service业务层处理
|
* 诊疗结果Service业务层处理
|
||||||
*
|
*
|
||||||
@ -31,6 +37,8 @@ public class DiagnosisServiceImpl implements IDiagnosisService
|
|||||||
private SheepFileMapper sheepFileMapper;
|
private SheepFileMapper sheepFileMapper;
|
||||||
@Autowired
|
@Autowired
|
||||||
private BasSheepMapper sheepMapper;
|
private BasSheepMapper sheepMapper;
|
||||||
|
@Autowired
|
||||||
|
private TreatmentMapper treatmentMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询诊疗结果
|
* 查询诊疗结果
|
||||||
@ -75,21 +83,85 @@ public class DiagnosisServiceImpl implements IDiagnosisService
|
|||||||
String username = SecurityUtils.getLoginUser().getUser().getNickName();
|
String username = SecurityUtils.getLoginUser().getUser().getNickName();
|
||||||
diagnosis.setCreateBy(username);
|
diagnosis.setCreateBy(username);
|
||||||
diagnosis.setCreateTime(DateUtils.getNowDate());
|
diagnosis.setCreateTime(DateUtils.getNowDate());
|
||||||
if (!Objects.equals(sheepFile.getSheepfoldId(), diagnosis.getSheepfoldId())){
|
|
||||||
|
if (diagnosis.getSheepfoldId() != null)
|
||||||
|
if (!Objects.equals(sheepFile.getSheepfoldId(), diagnosis.getSheepfoldId())) {
|
||||||
BasSheep basSheep = new BasSheep();
|
BasSheep basSheep = new BasSheep();
|
||||||
basSheep.setId(diagnosis.getSheepId());
|
basSheep.setId(diagnosis.getSheepId());
|
||||||
basSheep.setSheepfoldId(diagnosis.getSheepfoldId());
|
basSheep.setSheepfoldId(diagnosis.getSheepfoldId());
|
||||||
sheepMapper.updateBasSheep(basSheep);
|
sheepMapper.updateBasSheep(basSheep);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 更改治疗记录的状态
|
||||||
|
Treatment treatment = new Treatment();
|
||||||
|
treatment.setId(diagnosis.getTreatId());
|
||||||
|
if (diagnosis.getResult().equals("0")){
|
||||||
|
treatment.setStatus("-1");
|
||||||
|
treatmentMapper.updateTreatment(treatment);
|
||||||
|
}else if (diagnosis.getResult().equals("1")){
|
||||||
|
treatment.setStatus("2");
|
||||||
|
treatmentMapper.updateTreatment(treatment);
|
||||||
|
}
|
||||||
// 转入其他羊舍
|
// 转入其他羊舍
|
||||||
return diagnosisMapper.insertDiagnosis(diagnosis);
|
return diagnosisMapper.insertDiagnosis(diagnosis);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional
|
||||||
public int insertDiagnosisList(Diagnosis diagnosis) {
|
public int insertDiagnosisList(Diagnosis diagnosis) {
|
||||||
|
if (diagnosis.getTreatIds() != null && diagnosis.getTreatIds().length > 0){
|
||||||
|
for (Integer treatId : diagnosis.getTreatIds()) {
|
||||||
|
System.out.println(treatId);
|
||||||
|
Treatment treatment = treatmentMapper.selectTreatmentById(Long.valueOf(treatId));
|
||||||
|
System.out.println(treatment);
|
||||||
|
// BasSheep basSheep = sheepMapper.selectBasSheepById(treatment.getSheepId());
|
||||||
|
|
||||||
return 0;
|
Diagnosis diag = new Diagnosis();
|
||||||
|
BeanUtils.copyProperties(treatment,diag);
|
||||||
|
diag.setResult(diagnosis.getResult());
|
||||||
|
diag.setParity(String.valueOf(treatment.getParity()));
|
||||||
|
|
||||||
|
|
||||||
|
// treatment 和 diagnosis 是你的两个实体对象
|
||||||
|
Date start = treatment.getDatetime(); // 已经是 Date
|
||||||
|
Date end = diagnosis.getDatetime(); // 已经是 Date
|
||||||
|
diag.setBegindate(start);
|
||||||
|
diag.setEnddate(end);
|
||||||
|
long oneDayMillis = 24 * 60 * 60 * 1000L;
|
||||||
|
long days = (end.getTime() / oneDayMillis) - (start.getTime() / oneDayMillis);
|
||||||
|
if (days<0){
|
||||||
|
days=0;
|
||||||
|
}
|
||||||
|
|
||||||
|
diag.setTreatDay(days);
|
||||||
|
diag.setTreatId(treatment.getId());
|
||||||
|
|
||||||
|
|
||||||
|
String username = SecurityUtils.getLoginUser().getUser().getNickName();
|
||||||
|
diag.setCreateBy(username);
|
||||||
|
diag.setCreateTime(DateUtils.getNowDate());
|
||||||
|
diagnosisMapper.insertDiagnosis(diag);
|
||||||
|
treatment.setDiagId(diag.getId());
|
||||||
|
|
||||||
|
// 更改治疗记录的状态
|
||||||
|
if (diagnosis.getResult().equals("0")){
|
||||||
|
treatment.setStatus("-1");
|
||||||
|
treatmentMapper.updateTreatment(treatment);
|
||||||
|
}else if (diagnosis.getResult().equals("1")){
|
||||||
|
treatment.setStatus("2");
|
||||||
|
treatmentMapper.updateTreatment(treatment);
|
||||||
|
}
|
||||||
|
if (diagnosis.getSheepfoldId() != null){
|
||||||
|
BasSheep basSheep = new BasSheep();
|
||||||
|
basSheep.setId(diagnosis.getSheepId());
|
||||||
|
basSheep.setSheepfoldId(diagnosis.getSheepfoldId());
|
||||||
|
sheepMapper.updateBasSheep(basSheep);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -7,8 +7,10 @@ import com.zhyc.common.utils.SecurityUtils;
|
|||||||
import com.zhyc.common.utils.bean.BeanUtils;
|
import com.zhyc.common.utils.bean.BeanUtils;
|
||||||
import com.zhyc.module.base.domain.SheepFile;
|
import com.zhyc.module.base.domain.SheepFile;
|
||||||
import com.zhyc.module.base.mapper.SheepFileMapper;
|
import com.zhyc.module.base.mapper.SheepFileMapper;
|
||||||
|
import com.zhyc.module.biosafety.domain.Diagnosis;
|
||||||
import com.zhyc.module.biosafety.domain.SwMedicineUsage;
|
import com.zhyc.module.biosafety.domain.SwMedicineUsage;
|
||||||
import com.zhyc.module.biosafety.domain.SwMedicineUsageDetails;
|
import com.zhyc.module.biosafety.domain.SwMedicineUsageDetails;
|
||||||
|
import com.zhyc.module.biosafety.mapper.DiagnosisMapper;
|
||||||
import com.zhyc.module.biosafety.mapper.SwMedicineUsageMapper;
|
import com.zhyc.module.biosafety.mapper.SwMedicineUsageMapper;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@ -34,6 +36,8 @@ public class TreatmentServiceImpl implements ITreatmentService
|
|||||||
private SwMedicineUsageMapper medicineUsageMapper;
|
private SwMedicineUsageMapper medicineUsageMapper;
|
||||||
@Autowired
|
@Autowired
|
||||||
private SheepFileMapper sheepFileMapper;
|
private SheepFileMapper sheepFileMapper;
|
||||||
|
@Autowired
|
||||||
|
private DiagnosisMapper diagnosisMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询治疗记录
|
* 查询治疗记录
|
||||||
@ -47,7 +51,9 @@ public class TreatmentServiceImpl implements ITreatmentService
|
|||||||
Treatment treatment = treatmentMapper.selectTreatmentById(id);
|
Treatment treatment = treatmentMapper.selectTreatmentById(id);
|
||||||
// 获取药品使用记录
|
// 获取药品使用记录
|
||||||
SwMedicineUsage swMedicineUsage = medicineUsageService.selectSwMedicineUsageById(treatment.getUsageId());
|
SwMedicineUsage swMedicineUsage = medicineUsageService.selectSwMedicineUsageById(treatment.getUsageId());
|
||||||
|
if (swMedicineUsage!=null){
|
||||||
treatment.setUsageDetails(swMedicineUsage.getSwMedicineUsageDetailsList());
|
treatment.setUsageDetails(swMedicineUsage.getSwMedicineUsageDetailsList());
|
||||||
|
}
|
||||||
return treatment;
|
return treatment;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -176,4 +182,21 @@ public class TreatmentServiceImpl implements ITreatmentService
|
|||||||
{
|
{
|
||||||
return treatmentMapper.deleteTreatmentById(id);
|
return treatmentMapper.deleteTreatmentById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void updateTreatmentStatus(Long sheepId) {
|
||||||
|
List<Treatment> treatments=treatmentMapper.selectTreatmentStatus(sheepId);
|
||||||
|
Diagnosis diagnosis = new Diagnosis();
|
||||||
|
for (Treatment treatment : treatments) {
|
||||||
|
if (treatment.getDiagId()!=null){
|
||||||
|
diagnosis.setId(treatment.getDiagId());
|
||||||
|
diagnosis.setResult("-1");
|
||||||
|
diagnosisMapper.updateDiagnosis(diagnosis);
|
||||||
|
if (treatment.getDiagId()!=null){
|
||||||
|
Treatment treat = new Treatment();
|
||||||
|
treat.setId(treatment.getId());
|
||||||
|
treatmentMapper.updateTreatment(treat);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,11 +3,17 @@ package com.zhyc.module.produce.breed.service.impl;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import com.zhyc.common.utils.DateUtils;
|
import com.zhyc.common.utils.DateUtils;
|
||||||
|
import com.zhyc.module.biosafety.domain.Diagnosis;
|
||||||
|
import com.zhyc.module.biosafety.domain.Treatment;
|
||||||
|
import com.zhyc.module.biosafety.mapper.DiagnosisMapper;
|
||||||
|
import com.zhyc.module.biosafety.mapper.TreatmentMapper;
|
||||||
|
import com.zhyc.module.biosafety.service.impl.TreatmentServiceImpl;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.zhyc.module.produce.breed.mapper.ScSheepDeathMapper;
|
import com.zhyc.module.produce.breed.mapper.ScSheepDeathMapper;
|
||||||
import com.zhyc.module.produce.breed.domain.ScSheepDeath;
|
import com.zhyc.module.produce.breed.domain.ScSheepDeath;
|
||||||
import com.zhyc.module.produce.breed.service.IScSheepDeathService;
|
import com.zhyc.module.produce.breed.service.IScSheepDeathService;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 羊只死淘记录Service业务层处理
|
* 羊只死淘记录Service业务层处理
|
||||||
@ -20,6 +26,13 @@ public class ScSheepDeathServiceImpl implements IScSheepDeathService
|
|||||||
{
|
{
|
||||||
@Autowired
|
@Autowired
|
||||||
private ScSheepDeathMapper scSheepDeathMapper;
|
private ScSheepDeathMapper scSheepDeathMapper;
|
||||||
|
@Autowired
|
||||||
|
private DiagnosisMapper diagnosisMapper;
|
||||||
|
@Autowired
|
||||||
|
private TreatmentServiceImpl treatmentService;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询羊只死淘记录
|
* 查询羊只死淘记录
|
||||||
@ -100,6 +113,7 @@ public class ScSheepDeathServiceImpl implements IScSheepDeathService
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional
|
||||||
public int insertScSheepDeath(ScSheepDeath scSheepDeath)
|
public int insertScSheepDeath(ScSheepDeath scSheepDeath)
|
||||||
{
|
{
|
||||||
// 设置事件类型默认为"死亡"
|
// 设置事件类型默认为"死亡"
|
||||||
@ -110,11 +124,15 @@ public class ScSheepDeathServiceImpl implements IScSheepDeathService
|
|||||||
// 如果有管理耳号,查询并设置羊只ID
|
// 如果有管理耳号,查询并设置羊只ID
|
||||||
if (scSheepDeath.getManageTags() != null && !scSheepDeath.getManageTags().isEmpty()) {
|
if (scSheepDeath.getManageTags() != null && !scSheepDeath.getManageTags().isEmpty()) {
|
||||||
Map<String, Object> sheepInfo = selectSheepFileByManageTags(scSheepDeath.getManageTags());
|
Map<String, Object> sheepInfo = selectSheepFileByManageTags(scSheepDeath.getManageTags());
|
||||||
|
|
||||||
if (sheepInfo != null) {
|
if (sheepInfo != null) {
|
||||||
scSheepDeath.setSheepId(sheepInfo.get("sheepId") != null ? Long.valueOf(sheepInfo.get("sheepId").toString()) : null);
|
scSheepDeath.setSheepId(sheepInfo.get("sheepId") != null ? Long.valueOf(sheepInfo.get("sheepId").toString()) : null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
treatmentService.updateTreatmentStatus(scSheepDeath.getSheepId());
|
||||||
scSheepDeath.setCreateTime(DateUtils.getNowDate());
|
scSheepDeath.setCreateTime(DateUtils.getNowDate());
|
||||||
|
|
||||||
return scSheepDeathMapper.insertScSheepDeath(scSheepDeath);
|
return scSheepDeathMapper.insertScSheepDeath(scSheepDeath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -31,6 +31,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<result property="dosage" column="dosage" />
|
<result property="dosage" column="dosage" />
|
||||||
<result property="unit" column="unit" />
|
<result property="unit" column="unit" />
|
||||||
<result property="usageId" column="usageId" />
|
<result property="usageId" column="usageId" />
|
||||||
|
<result property="usetime" column="usetime" />
|
||||||
<result property="manufacturer" column="manufacturer" />
|
<result property="manufacturer" column="manufacturer" />
|
||||||
<result property="batchNumber" column="batch_number" />
|
<result property="batchNumber" column="batch_number" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
@ -63,7 +64,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectSwMedicineUsageDetailsList" resultMap="SwMedicineUsageDetailsResult">
|
<select id="selectSwMedicineUsageDetailsList" resultMap="SwMedicineUsageDetailsResult">
|
||||||
select smud.id, medi_usage, medi_id, dosage, unit, usageId, manufacturer, batch_number,
|
select smud.id, medi_usage, medi_id, dosage, unit, usageId,usetime, manufacturer, batch_number,
|
||||||
sm.name
|
sm.name
|
||||||
from sw_medicine_usage_details smud
|
from sw_medicine_usage_details smud
|
||||||
join sw_medicine sm on smud.medi_id = sm.id
|
join sw_medicine sm on smud.medi_id = sm.id
|
||||||
@ -133,9 +134,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
<insert id="batchSwMedicineUsageDetails">
|
<insert id="batchSwMedicineUsageDetails">
|
||||||
insert into sw_medicine_usage_details( id, medi_usage, medi_id, dosage, unit, usageId, manufacturer, batch_number) values
|
insert into sw_medicine_usage_details( id, medi_usage, medi_id, dosage, unit, usageId,usetime, manufacturer, batch_number) values
|
||||||
<foreach item="item" index="index" collection="list" separator=",">
|
<foreach item="item" index="index" collection="list" separator=",">
|
||||||
( #{item.id}, #{item.mediUsage}, #{item.mediId}, #{item.dosage}, #{item.unit}, #{item.usageId}, #{item.manufacturer}, #{item.batchNumber})
|
( #{item.id}, #{item.mediUsage}, #{item.mediId}, #{item.dosage}, #{item.unit}, #{item.usageId}, #{item.usetime},#{item.manufacturer}, #{item.batchNumber})
|
||||||
</foreach>
|
</foreach>
|
||||||
</insert>
|
</insert>
|
||||||
</mapper>
|
</mapper>
|
||||||
@ -24,6 +24,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<result property="diseasePName" column="disease_pname"/>
|
<result property="diseasePName" column="disease_pname"/>
|
||||||
<result property="veterinary" column="veterinary" />
|
<result property="veterinary" column="veterinary" />
|
||||||
<result property="usageId" column="usage_id" />
|
<result property="usageId" column="usage_id" />
|
||||||
|
<result property="status" column="status"/>
|
||||||
<result property="comment" column="comment" />
|
<result property="comment" column="comment" />
|
||||||
<result property="updateBy" column="update_by" />
|
<result property="updateBy" column="update_by" />
|
||||||
<result property="updateTime" column="update_time" />
|
<result property="updateTime" column="update_time" />
|
||||||
@ -32,7 +33,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectTreatmentVo">
|
<sql id="selectTreatmentVo">
|
||||||
select t.id, diag_id, sheep_id, variety, sheep_type, month_age, t.gender, t.parity, breed, lact_day, gest_day, datetime, disease_id, disease_pid, veterinary, usage_id, t.comment, t.update_by, t.update_time, t.create_by, t.create_time,
|
select t.id, diag_id, sheep_id, variety, sheep_type, month_age, t.gender, t.parity, breed, lact_day, gest_day, datetime, disease_id, disease_pid, veterinary, usage_id,status, t.comment, t.update_by, t.update_time, t.create_by, t.create_time,
|
||||||
bs.manage_tags,
|
bs.manage_tags,
|
||||||
sd.name disease_name,
|
sd.name disease_name,
|
||||||
sd2.name disease_pname
|
sd2.name disease_pname
|
||||||
@ -48,6 +49,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<if test="sheepId != null "> and sheep_id = #{sheepId}</if>
|
<if test="sheepId != null "> and sheep_id = #{sheepId}</if>
|
||||||
<if test="params.beginDatetime != null and params.beginDatetime != '' and params.endDatetime != null and params.endDatetime != ''"> and datetime between #{params.beginDatetime} and #{params.endDatetime}</if>
|
<if test="params.beginDatetime != null and params.beginDatetime != '' and params.endDatetime != null and params.endDatetime != ''"> and datetime between #{params.beginDatetime} and #{params.endDatetime}</if>
|
||||||
<if test="diseaseId != null "> and disease_id = #{diseaseId}</if>
|
<if test="diseaseId != null "> and disease_id = #{diseaseId}</if>
|
||||||
|
<if test="status != null and status !=''"> and status = #{status}</if>
|
||||||
<if test="veterinary != null and veterinary != ''"> and veterinary = #{veterinary}</if>
|
<if test="veterinary != null and veterinary != ''"> and veterinary = #{veterinary}</if>
|
||||||
</where>
|
</where>
|
||||||
ORDER BY datetime DESC
|
ORDER BY datetime DESC
|
||||||
@ -57,6 +59,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<include refid="selectTreatmentVo"/>
|
<include refid="selectTreatmentVo"/>
|
||||||
where t.id = #{id}
|
where t.id = #{id}
|
||||||
</select>
|
</select>
|
||||||
|
<select id="selectTreatmentStatus" resultMap="TreatmentResult">
|
||||||
|
select * from sw_treatment where sheep_id = #{sheepId} and status in (0, 1)
|
||||||
|
</select>
|
||||||
|
|
||||||
<insert id="insertTreatment" parameterType="Treatment" useGeneratedKeys="true" keyProperty="id">
|
<insert id="insertTreatment" parameterType="Treatment" useGeneratedKeys="true" keyProperty="id">
|
||||||
insert into sw_treatment
|
insert into sw_treatment
|
||||||
@ -76,6 +81,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<if test="diseasePid != null">disease_pid,</if>
|
<if test="diseasePid != null">disease_pid,</if>
|
||||||
<if test="veterinary != null">veterinary,</if>
|
<if test="veterinary != null">veterinary,</if>
|
||||||
<if test="usageId != null">usage_id,</if>
|
<if test="usageId != null">usage_id,</if>
|
||||||
|
<if test="status != null">status,</if>
|
||||||
<if test="comment != null">comment,</if>
|
<if test="comment != null">comment,</if>
|
||||||
<if test="updateBy != null">update_by,</if>
|
<if test="updateBy != null">update_by,</if>
|
||||||
<if test="updateTime != null">update_time,</if>
|
<if test="updateTime != null">update_time,</if>
|
||||||
@ -98,6 +104,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<if test="diseasePid != null">#{diseasePid},</if>
|
<if test="diseasePid != null">#{diseasePid},</if>
|
||||||
<if test="veterinary != null">#{veterinary},</if>
|
<if test="veterinary != null">#{veterinary},</if>
|
||||||
<if test="usageId != null">#{usageId},</if>
|
<if test="usageId != null">#{usageId},</if>
|
||||||
|
<if test="status != null">#{status},</if>
|
||||||
<if test="comment != null">#{comment},</if>
|
<if test="comment != null">#{comment},</if>
|
||||||
<if test="updateBy != null">#{updateBy},</if>
|
<if test="updateBy != null">#{updateBy},</if>
|
||||||
<if test="updateTime != null">#{updateTime},</if>
|
<if test="updateTime != null">#{updateTime},</if>
|
||||||
@ -110,14 +117,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
insert into sw_treatment
|
insert into sw_treatment
|
||||||
(diag_id, sheep_id, variety, sheep_type, month_age, gender,
|
(diag_id, sheep_id, variety, sheep_type, month_age, gender,
|
||||||
parity, breed, lact_day, gest_day, datetime,
|
parity, breed, lact_day, gest_day, datetime,
|
||||||
disease_id, disease_pid, veterinary, usage_id,
|
disease_id, disease_pid, veterinary, usage_id,status ,
|
||||||
comment, update_by, update_time, create_by, create_time)
|
comment, update_by, update_time, create_by, create_time)
|
||||||
values
|
values
|
||||||
<foreach collection="list" item="t" separator=",">
|
<foreach collection="list" item="t" separator=",">
|
||||||
(#{t.diagId}, #{t.sheepId}, #{t.variety}, #{t.sheepType},
|
(#{t.diagId}, #{t.sheepId}, #{t.variety}, #{t.sheepType},
|
||||||
#{t.monthAge}, #{t.gender}, #{t.parity}, #{t.breed},
|
#{t.monthAge}, #{t.gender}, #{t.parity}, #{t.breed},
|
||||||
#{t.lactDay}, #{t.gestDay}, #{t.datetime}, #{t.diseaseId},
|
#{t.lactDay}, #{t.gestDay}, #{t.datetime}, #{t.diseaseId},
|
||||||
#{t.diseasePid}, #{t.veterinary},#{t.usageId}, #{t.comment},
|
#{t.diseasePid}, #{t.veterinary},#{t.usageId}, #{t.status}, #{t.comment},
|
||||||
#{t.updateBy}, #{t.updateTime},#{t.createBy}, #{t.createTime})
|
#{t.updateBy}, #{t.updateTime},#{t.createBy}, #{t.createTime})
|
||||||
</foreach>
|
</foreach>
|
||||||
</insert>
|
</insert>
|
||||||
@ -140,6 +147,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<if test="diseasePid != null">disease_pid = #{diseasePid},</if>
|
<if test="diseasePid != null">disease_pid = #{diseasePid},</if>
|
||||||
<if test="veterinary != null">veterinary = #{veterinary},</if>
|
<if test="veterinary != null">veterinary = #{veterinary},</if>
|
||||||
<if test="usageId != null">usage_id = #{usageId},</if>
|
<if test="usageId != null">usage_id = #{usageId},</if>
|
||||||
|
<if test="status != null">status = #{status},</if>
|
||||||
<if test="comment != null">comment = #{comment},</if>
|
<if test="comment != null">comment = #{comment},</if>
|
||||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user