You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
71 lines
2.6 KiB
71 lines
2.6 KiB
package com.ynxbd.common.dao;
|
|
|
|
import com.ynxbd.common.bean.chronic.Chronic;
|
|
import com.ynxbd.common.bean.chronic.DictChronic;
|
|
import com.ynxbd.common.bean.record.Record;
|
|
import com.ynxbd.common.config.db.DataBase;
|
|
import freemarker.core.ReturnInstruction;
|
|
|
|
import java.util.List;
|
|
|
|
/**
|
|
* @author 李进才
|
|
* @ClassName ChronicDao
|
|
* @Description TODO
|
|
* @date 2023/08/16 09:39:00
|
|
*/
|
|
|
|
public class ChronicDao {
|
|
/**
|
|
* 预约慢病
|
|
* @param chronic 慢病信息
|
|
* @return 是否新增成功
|
|
*/
|
|
public Boolean insert(Chronic chronic){
|
|
String sql = "insert into chronic(ApplyName, ApplyTime, ReserveTime, PatientId, OpenId, Idcard, TreatId, PatientType, DiagProve, IdcardFont, IdcardBack, InHospProve, ChronicName, ChronicCode, Phone, Address) values (?,now(),?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
|
|
return DataBase.insert(sql,ps -> {
|
|
ps.setString(1,chronic.getApplyName());
|
|
ps.setString(2,chronic.getReserveTime());
|
|
ps.setString(3,chronic.getPatientId());
|
|
ps.setString(4,chronic.getOpenId());
|
|
ps.setString(5,chronic.getIdcard());
|
|
ps.setString(6,chronic.getTreatId());
|
|
ps.setInt(7,chronic.getPatientType());
|
|
ps.setString(8,chronic.getDiagProve());
|
|
ps.setString(9,chronic.getIdcardFont());
|
|
ps.setString(10,chronic.getIdcardBack());
|
|
ps.setString(11,chronic.getInHospProve());
|
|
ps.setString(12,chronic.getChronicName());
|
|
ps.setString(13,chronic.getChronicCode());
|
|
ps.setString(14,chronic.getPhone());
|
|
ps.setString(15,chronic.getAddress());
|
|
})>0;
|
|
}
|
|
|
|
/**
|
|
* 获取该患者申请的慢病预约
|
|
* @param patientId 患者id
|
|
* @return 预约列表
|
|
*/
|
|
public List<Chronic> selectByPatientId(String patientId){
|
|
String sql ="select * from chronic where PatientId = ? ";
|
|
return DataBase.select(sql, Chronic.class, ps -> {
|
|
ps.setString(1,patientId);
|
|
});
|
|
}
|
|
|
|
public List<DictChronic> selectDict(Integer chronicType){
|
|
String sql ="select * from dict_chronic where ChronicType = ? ";
|
|
return DataBase.select(sql, DictChronic.class, ps -> {
|
|
ps.setInt(1,chronicType);
|
|
});
|
|
}
|
|
|
|
public Boolean selectIfApply(Integer patientType, String treatId){
|
|
String sql = "select * from chronic where PatientType = ? and TreatId = ? and RejectTime is null and DeleteTime is null and CheckTime is null";
|
|
return !DataBase.select(sql, Chronic.class, ps -> {
|
|
ps.setInt(1,patientType);
|
|
ps.setString(2,treatId);
|
|
}).isEmpty();
|
|
}
|
|
}
|
|
|