|
@ -29,6 +29,7 @@ import com.yihu.jw.util.http.HttpClientUtil;
|
|
|
import com.yihu.jw.wlyy.service.WlyyBusinessService;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
@ -842,15 +843,15 @@ public class RehabilitationInfoService {
|
|
|
* type 1患者家签列表 2康复下转列表
|
|
|
* doctorCode
|
|
|
*/
|
|
|
public JSONObject getPatientByIdcardOrSsc(String patientInfo, String doctorCode,Integer fromSource) {
|
|
|
public JSONObject getPatientByIdcardOrSsc(String patientInfo, String doctorCode, Integer fromSource) {
|
|
|
//加签列表查询wlyy_patient_discharge表,与type无关。当家签处添加时(即type=1),统一保存type=2的记录
|
|
|
JSONObject data = new JSONObject();
|
|
|
List<BasePatientDO> patientList = patientDao.getPatientByIdcardOrSsc(patientInfo);
|
|
|
BasePatientDO patient = null;
|
|
|
if(patientList.size() > 0){
|
|
|
if (patientList.size() > 0) {
|
|
|
patient = patientList.get(0);
|
|
|
}
|
|
|
if(patient==null){
|
|
|
if (patient == null) {
|
|
|
data.put("status", -1);
|
|
|
data.put("msg", "未查询到患者");
|
|
|
return data;
|
|
@ -858,12 +859,12 @@ public class RehabilitationInfoService {
|
|
|
RehabilitationPatientInfoDO infoDO = new RehabilitationPatientInfoDO();
|
|
|
infoDO.setPatient(patient.getId());
|
|
|
infoDO.setStatus(0);
|
|
|
infoDO.setAge(IdCardUtil.getAgeByBirthdayOrIdcard(patient.getIdcard(),patient.getBirthday()));
|
|
|
infoDO.setAge(IdCardUtil.getAgeByBirthdayOrIdcard(patient.getIdcard(), patient.getBirthday()));
|
|
|
infoDO.setSsc(patient.getSsc());
|
|
|
infoDO.setAddress(patient.getAddress());
|
|
|
infoDO.setCode(UUID.randomUUID().toString().replaceAll("-", ""));
|
|
|
infoDO.setCreateTime(new Date());
|
|
|
if(StringUtils.isNotBlank(doctorCode)){
|
|
|
if (StringUtils.isNotBlank(doctorCode)) {
|
|
|
BaseDoctorDO doctor = doctorDao.findById(doctorCode).orElse(null);
|
|
|
infoDO.setCreateUser(doctor.getId());
|
|
|
infoDO.setCreateUserName(doctor.getName());
|
|
@ -876,7 +877,7 @@ public class RehabilitationInfoService {
|
|
|
rehabilitationPatientInfoDao.save(infoDO);
|
|
|
//判断是否家签 修改
|
|
|
JSONObject isSign = businessService.isSign(patient.getIdcard());
|
|
|
if(isSign!=null&&isSign.getJSONObject("obj")!=null){
|
|
|
if (isSign != null && isSign.getJSONObject("obj") != null) {
|
|
|
infoDO.setSignStatus(1);
|
|
|
rehabilitationPatientInfoDao.save(infoDO);
|
|
|
}
|
|
@ -884,6 +885,7 @@ public class RehabilitationInfoService {
|
|
|
data.put("data", infoDO);
|
|
|
return data;
|
|
|
}
|
|
|
|
|
|
public JSONObject getUnm(String doctor, String patient) {
|
|
|
String sqlMe = "select d.id,d.plan_id as planId,i.code,i.name,p.patient,d.frequency_code from wlyy_rehabilitation_plan_detail d \n" +
|
|
|
"LEFT JOIN wlyy_patient_rehabilitation_plan p ON p.id=d.plan_id\n" +
|
|
@ -1103,7 +1105,7 @@ public class RehabilitationInfoService {
|
|
|
/**
|
|
|
* 获取所有居民的康复计列表
|
|
|
*/
|
|
|
public List<Map<String, Object>> getRehabilitationPatientPlan(String idcard, String doctorId, String finishStatus, Integer page, Integer pagesize) {
|
|
|
public List<Map<String, Object>> getRehabilitationPatientPlan(String idcard, String doctorId, String patientId, String finishStatus, Integer page, Integer pagesize) {
|
|
|
String limitSql = " LIMIT " + (page - 1) * pagesize + "," + pagesize;
|
|
|
String sql = "SELECT * FROM ( " +
|
|
|
"SELECT DISTINCT \n" +
|
|
@ -1116,19 +1118,19 @@ public class RehabilitationInfoService {
|
|
|
" SELECT GROUP_CONCAT(DISTINCT w.plan_doctor_name) FROM wlyy_patient_rehabilitation_plan w WHERE a.id = w.patient \n" +
|
|
|
" ) 'planDoctorListName',\n" +
|
|
|
" (\n" +
|
|
|
" SELECT count(1) FROM wlyy_patient_rehabilitation_plan w \n" +
|
|
|
" SELECT count(1) FROM wlyy_patient_rehabilitation_plan w \n" +
|
|
|
" INNER JOIN wlyy_rehabilitation_plan_detail q ON w.id = q.plan_id \n" +
|
|
|
" WHERE 1 = 1 AND w.patient = a.id \n" +
|
|
|
" WHERE 1 = 1 AND w.patient = a.id \n" +
|
|
|
" )'itemAllCount',\n" +
|
|
|
" (\n" +
|
|
|
" SELECT count(1) FROM wlyy_patient_rehabilitation_plan w \n" +
|
|
|
" SELECT count(1) FROM wlyy_patient_rehabilitation_plan w \n" +
|
|
|
" INNER JOIN wlyy_rehabilitation_plan_detail q ON w.id = q.plan_id \n" +
|
|
|
" WHERE 1 = 1 AND q.`status`='0' AND w.patient = a.id \n" +
|
|
|
" WHERE 1 = 1 AND q.`status`='0' AND w.patient = a.id \n" +
|
|
|
" )'unFinishCount',\n" +
|
|
|
" (\n" +
|
|
|
" SELECT count(1) FROM wlyy_patient_rehabilitation_plan w \n" +
|
|
|
" INNER JOIN wlyy_rehabilitation_plan_detail q ON w.id = q.plan_id \n" +
|
|
|
" WHERE 1 = 1 AND q.`status`='1' AND w.patient = a.id \n" +
|
|
|
" WHERE 1 = 1 AND q.`status`='1' AND w.patient = a.id \n" +
|
|
|
" )'finishCount',\n" +
|
|
|
" 0 'totayTask'\n" +
|
|
|
"FROM\n" +
|
|
@ -1144,6 +1146,12 @@ public class RehabilitationInfoService {
|
|
|
sql += " AND (b.plan_doctor='" + doctorId + "' OR c.doctor='" + doctorId + "' )";
|
|
|
sql += " and c.doctor is not null ";
|
|
|
}
|
|
|
|
|
|
|
|
|
if (StringUtils.isNotBlank(patientId)) {
|
|
|
//康复计划状态 [0已中止,1进行中,2已完成]
|
|
|
sql += " AND a.patientId ='" + patientId + "' ";
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(idcard)) {
|
|
|
//康复计划状态 [0已中止,1进行中,2已完成]
|
|
|
sql += " AND a.idcard like'%" + idcard + "%'";
|
|
@ -1166,6 +1174,9 @@ public class RehabilitationInfoService {
|
|
|
return list;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 还需要代办项目还需要重新join一张新表
|
|
|
*/
|
|
|
public HashMap<String, Object> getRehabilitationPatientPlanCount(String doctorId) {
|
|
|
String sql =
|
|
|
"SELECT DISTINCT \n" +
|
|
@ -1213,7 +1224,7 @@ public class RehabilitationInfoService {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* todayTaskCount 今日任务项,等后面在整
|
|
|
* todo 还需要代办项目还需要重新join一张新表 todayTaskCount 今日任务项,等后面在整
|
|
|
*/
|
|
|
public List<Map<String, Object>> getPatientRehabilitationByPatientId(String patientId) {
|
|
|
String sql = "SELECT DISTINCT \n" +
|
|
@ -1227,7 +1238,7 @@ public class RehabilitationInfoService {
|
|
|
" WHEN c.from_source='3' THEN '扫码添加'\n" +
|
|
|
" END 'fromSourceName',\n" +
|
|
|
" c.ijk_id, c.status, 'patientStatus'," +
|
|
|
" b.adviceContent,\n" +
|
|
|
" b.advice_content 'adviceContent',\n" +
|
|
|
" (SELECT count(1) FROM wlyy_rehabilitation_plan_detail q WHERE 1 = 1 AND q.plan_id = b.id )'itemAllCount',\n" +
|
|
|
" (SELECT count(1) FROM wlyy_rehabilitation_plan_detail q WHERE 1 = 1 AND q.`status`='1' AND q.plan_id = b.id )'finishCount',\n" +
|
|
|
" 0 'todayTaskCount'\n" +
|
|
@ -1271,8 +1282,40 @@ public class RehabilitationInfoService {
|
|
|
}
|
|
|
|
|
|
|
|
|
public List<Map<String, Object>> getPatientPlanItem(String patientId, String planId, String startTime, String endTime, String doctorId, String type) {
|
|
|
String sql = " ";
|
|
|
/**
|
|
|
* 查询病例信息
|
|
|
*/
|
|
|
public List<PatientMedicalRecordsDO> getPatientMedicalRecordsByPatientId(String patientId) {
|
|
|
String sql = "select * from wlyy_patient_medical_records_rehabilitation where patient='" + patientId + "' order by create_time desc ";
|
|
|
List<PatientMedicalRecordsDO> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(PatientMedicalRecordsDO.class));
|
|
|
return list;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 查询康复计划服务项
|
|
|
*/
|
|
|
public List<Map<String, Object>> getPatientPlanItemList(String patientId, String planId) {
|
|
|
String sql = "SELECT\n" +
|
|
|
" b.`name`,\n" +
|
|
|
" a.plan_id \n" +
|
|
|
"FROM\n" +
|
|
|
" wlyy_rehabilitation_plan_detail a\n" +
|
|
|
" INNER JOIN wlyy_rehabilitation_service_item b ON a.hospital_service_item_id = b.id \n" +
|
|
|
"WHERE\n" +
|
|
|
" 1 = 1 \n" +
|
|
|
" AND a.plan_id = '" + planId + "'";
|
|
|
List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
|
|
|
return list;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获取频次服务的信息
|
|
|
* 这个服务项次数还没有-暂时没有
|
|
|
*/
|
|
|
public List<Map<String, Object>> getPatientPlanFrequencyItemList(String patientId, String planId, String startTime, String endTime, String doctorId, String type) {
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|