|
@ -4,6 +4,7 @@ import com.yihu.wlyy.entity.address.Country;
|
|
|
import com.yihu.wlyy.entity.address.Street;
|
|
|
import com.yihu.wlyy.entity.address.Town;
|
|
|
import com.yihu.wlyy.entity.charge.WlyyCharge;
|
|
|
import com.yihu.wlyy.entity.concern.ConcernDO;
|
|
|
import com.yihu.wlyy.entity.consult.Consult;
|
|
|
import com.yihu.wlyy.entity.dict.SystemDict;
|
|
|
import com.yihu.wlyy.entity.doctor.profile.Doctor;
|
|
@ -17,6 +18,7 @@ import com.yihu.wlyy.repository.address.CountryDao;
|
|
|
import com.yihu.wlyy.repository.address.StreetDao;
|
|
|
import com.yihu.wlyy.repository.address.TownDao;
|
|
|
import com.yihu.wlyy.repository.charge.ChargeDao;
|
|
|
import com.yihu.wlyy.repository.concern.ConcernDao;
|
|
|
import com.yihu.wlyy.repository.consult.ConsultDao;
|
|
|
import com.yihu.wlyy.repository.consult.ConsultTeamDao;
|
|
|
import com.yihu.wlyy.repository.doctor.DoctorAdminTeamMemberDao;
|
|
@ -130,6 +132,8 @@ public class SignWebService extends BaseService {
|
|
|
private ElasticsearchUtil elasticsearchUtil;
|
|
|
@Autowired
|
|
|
private WechatTemplateConfigDao templateConfigDao;
|
|
|
@Autowired
|
|
|
private ConcernDao concernDao;
|
|
|
/**
|
|
|
* 厦门市
|
|
|
*/
|
|
@ -1051,23 +1055,19 @@ public class SignWebService extends BaseService {
|
|
|
return object;
|
|
|
}
|
|
|
|
|
|
public JSONObject getSignServiceInfo(String signCode) throws Exception{
|
|
|
SignFamily signFamily = signFamilyDao.findByCode(signCode);
|
|
|
if (signFamily == null) {
|
|
|
return new JSONObject();
|
|
|
}
|
|
|
String doctorHealth = signFamily.getDoctorHealth();
|
|
|
String doctor = signFamily.getDoctor();
|
|
|
Patient p = patientService.findByCode(signFamily.getPatient());
|
|
|
String patient = p.getCode();
|
|
|
String yearBegin = DateUtil.dateToStrShort(signFamily.getBegin()) + " 00:00:00";
|
|
|
String yearEnd = DateUtil.dateToStrShort(signFamily.getEnd()) + " 23:59:59";
|
|
|
public JSONObject getSignServiceInfo(String doctor,String patient) throws Exception{
|
|
|
|
|
|
// ConcernDO concernDO = concernDao.findByPatientAndDoctor(patient,doctor);
|
|
|
// Patient p = patientService.findByCode(patient);
|
|
|
|
|
|
// String yearBegin = DateUtil.dateToStrShort(concernDO.getCreateTime()) + " 00:00:00";
|
|
|
// String yearEnd = DateUtil.dateToStrShort(DateUtil.getNow()) + " 23:59:59";
|
|
|
//获取咨询
|
|
|
String consult_sql = "select w.consult,w.symptoms,w.czrq,w.status,1 as type from wlyy_consult_team w where w.doctor = ? and w.patient =? and w.czrq>='"+yearBegin+"' and w.czrq<'"+yearEnd+"'";
|
|
|
String consult_sql = "select w.consult,w.symptoms,w.czrq,w.status,1 as type from wlyy_consult_team w where w.doctor = ? and w.patient =? ";
|
|
|
//获取随访
|
|
|
String followup_sql = "select w.id,w.followup_type,w.followup_class,w.followup_date as czrq,w.followup_manager_status,w.status,2 as type from wlyy_followup w where (w.doctor_code = ? or w.doctor_code =?) and w.patient_code =? and w.create_time>='"+yearBegin+"' and w.create_time<'"+yearEnd+"' and w.followup_class is not null";
|
|
|
String followup_sql = "select w.id,w.followup_type,w.followup_class,w.followup_date as czrq,w.followup_manager_status,w.status,2 as type from wlyy_followup w where w.doctor_code =? and w.patient_code =? and w.followup_class is not null";
|
|
|
//获取待预约
|
|
|
String reservation_sql = "select w.code,w.id, w.doctor_name,w.doctor_code,w.doctor_job,w.doctor,w.dname,w.org_code,w.status,w.start_time as czrq,3 as type from wlyy_patient_reservation w where (w.doctor = ? or w.doctor =?) and w.patient =? and w.czrq>='"+yearBegin+"' and w.czrq<'"+yearEnd+"'";
|
|
|
// String reservation_sql = "select w.code,w.id, w.doctor_name,w.doctor_code,w.doctor_job,w.doctor,w.dname,w.org_code,w.status,w.start_time as czrq,3 as type from wlyy_patient_reservation w where w.doctor =? and w.patient =? and w.czrq>='"+yearBegin+"' and w.czrq<'"+yearEnd+"'";
|
|
|
//获取健康教育
|
|
|
// String article_sql = "select w.id,w.article,w2.title,w2.summary,w.czrq,w.doctor,w.doctor_name,w.is_read,4 as type from wlyy_health_edu_article_patient w,wlyy_health_edu_article w2 where w.article = w2.code and (w.doctor = ? or w.doctor =?) and w.patient =? and YEAR(w.czrq) = ? ";
|
|
|
// Date startTime = DateUtil.getBeginDayOfYear();
|
|
@ -1075,21 +1075,21 @@ public class SignWebService extends BaseService {
|
|
|
|
|
|
// String startDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(startTime);
|
|
|
// String endDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(endTime);
|
|
|
String start = elasticsearchUtil.changeTime(yearBegin);
|
|
|
String end = elasticsearchUtil.changeTime(yearEnd);
|
|
|
String article_sql = "SELECT id,articleId as article,articleTitle as title,createTime as czrq,doctorCode as doctor,doctorName as doctor_name,isRead as is_read,articleContent as content FROM "+esIndex+" where userType='1' and patientCode='"+patient+"' and (doctorCode='"+doctorHealth+"' or doctorCode='"+doctor+"') and createTime>='"+start+"' and createTime<'"+end+"'";
|
|
|
// String start = elasticsearchUtil.changeTime(yearBegin);
|
|
|
// String end = elasticsearchUtil.changeTime(yearEnd);
|
|
|
String article_sql = "SELECT id,articleId as article,articleTitle as title,createTime as czrq,doctorCode as doctor,doctorName as doctor_name,isRead as is_read,articleContent as content FROM "+esIndex+" where userType='1' and patientCode='"+patient+"' and doctorCode='"+doctor+"'";
|
|
|
|
|
|
//获取健康指导
|
|
|
String guidance_sql = "select w.id,w.doctor,w.content,w.czrq,w.read_status,5 as type from wlyy_patient_health_guidance w where (w.doctor = ? or w.doctor =?) and w.patient =? and w.czrq>='"+yearBegin+"' and w.czrq<'"+yearEnd+"'";
|
|
|
String guidance_sql = "select w.id,w.doctor,w.content,w.czrq,w.read_status,5 as type from wlyy_patient_health_guidance w where w.doctor =? and w.patient =? ";
|
|
|
|
|
|
Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("GMT+08:00"));
|
|
|
int year = calendar.get(Calendar.YEAR);
|
|
|
//咨询量
|
|
|
List<Map<String, Object>> consultResult = jdbcTemplate.queryForList(consult_sql, new Object[]{doctorHealth, patient});
|
|
|
List<Map<String, Object>> consultResult = jdbcTemplate.queryForList(consult_sql, new Object[]{doctor, patient});
|
|
|
//随访量
|
|
|
List<Map<String, Object>> followupResult = jdbcTemplate.queryForList(followup_sql, new Object[]{doctorHealth, doctor, patient});
|
|
|
List<Map<String, Object>> followupResult = jdbcTemplate.queryForList(followup_sql, new Object[]{ doctor, patient});
|
|
|
//待预约量
|
|
|
List<Map<String, Object>> reservationResult = jdbcTemplate.queryForList(reservation_sql, new Object[]{doctorHealth, doctor, patient});
|
|
|
// List<Map<String, Object>> reservationResult = jdbcTemplate.queryForList(reservation_sql, new Object[]{doctor, patient});
|
|
|
//健康教育量
|
|
|
// List<Map<String, Object>> articleResult = jdbcTemplate.queryForList(article_sql, new Object[]{doctorHealth, doctor, patient, year});
|
|
|
// List<HealthEduArticleES> esList = elasticsearchUtil.excute(article_sql, HealthEduArticleES.class, esIndex, esType);
|
|
@ -1103,13 +1103,14 @@ public class SignWebService extends BaseService {
|
|
|
map.put("summary",str!=null?(str.length()>40?str.substring(0,40):str):"");
|
|
|
}
|
|
|
//健康指导量
|
|
|
List<Map<String, Object>> guidanceResult = jdbcTemplate.queryForList(guidance_sql, new Object[]{doctorHealth, doctor, patient});
|
|
|
List<Map<String, Object>> guidanceResult = jdbcTemplate.queryForList(guidance_sql, new Object[]{doctor, patient});
|
|
|
List<JSONObject> objects = new ArrayList<>();
|
|
|
int amount = consultResult.size() + followupResult.size() + reservationResult.size() + articleResult.size() + guidanceResult.size();
|
|
|
// int amount = consultResult.size() + followupResult.size() + reservationResult.size() + articleResult.size() + guidanceResult.size();
|
|
|
int amount = consultResult.size() + followupResult.size() + articleResult.size() + guidanceResult.size();
|
|
|
int activeAmount = 0;
|
|
|
objects.addAll(convertResult(consultResult));
|
|
|
objects.addAll(convertResult(followupResult));
|
|
|
objects.addAll(convertResult(reservationResult));
|
|
|
// objects.addAll(convertResult(reservationResult));
|
|
|
objects.addAll(convertResult(articleResult));
|
|
|
objects.addAll(convertResult(guidanceResult));
|
|
|
for (JSONObject object : objects) {
|