|
@ -10,20 +10,19 @@ import com.yihu.jw.entity.door.SignFamily;
|
|
|
import com.yihu.jw.entity.hospital.DmHospitalDO;
|
|
|
import com.yihu.jw.entity.rehabilitation.PatientDischargeDO;
|
|
|
import com.yihu.jw.entity.specialist.rehabilitation.PatientMedicalRecordsDO;
|
|
|
import com.yihu.jw.entity.specialist.rehabilitation.RehabilitationAdviceDO;
|
|
|
import com.yihu.jw.entity.util.TransforSqlUtl;
|
|
|
import com.yihu.jw.hospital.HospitalDao;
|
|
|
import com.yihu.jw.hospital.mapping.dao.DoctorMappingDao;
|
|
|
import com.yihu.jw.hospital.module.rehabilitation.dao.PatientDischargeDao;
|
|
|
import com.yihu.jw.hospital.module.specialist.dao.PatientMedicalRecordsRehabilitationDao;
|
|
|
import com.yihu.jw.hospital.module.system.dao.SystemDictDao;
|
|
|
import com.yihu.jw.hospital.task.PushMsgTask;
|
|
|
import com.yihu.jw.hospital.team.dao.WlyySignFamilyDao;
|
|
|
import com.yihu.jw.hospital.utils.WeiXinAccessTokenUtils;
|
|
|
import com.yihu.jw.hospital.utils.WeiXinOpenIdUtils;
|
|
|
import com.yihu.jw.patient.dao.BasePatientDao;
|
|
|
import com.yihu.jw.patient.service.BasePatientService;
|
|
|
import com.yihu.jw.system.dao.SystemDictDao;
|
|
|
import com.yihu.jw.util.DoctorAssistantUtil;
|
|
|
import com.yihu.jw.hospital.utils.DoctorAssistantUtil;
|
|
|
import com.yihu.jw.util.common.IdCardUtil;
|
|
|
import com.yihu.jw.util.date.DateUtil;
|
|
|
import com.yihu.jw.util.http.HttpClientUtil;
|
|
@ -808,77 +807,77 @@ public class RehabilitationInfoService {
|
|
|
* @param doctorCode
|
|
|
* @return
|
|
|
*/
|
|
|
public JSONObject getPatientByIdcardOrSsc(String patientInfo, Integer type, String doctorCode) {
|
|
|
//加签列表查询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(type==2){
|
|
|
patient = patientService.addPaitentByIdcard(patientInfo);
|
|
|
}
|
|
|
}else{
|
|
|
patient = patientList.get(0);
|
|
|
}
|
|
|
|
|
|
if(patient==null){
|
|
|
data.put("status", -1);
|
|
|
data.put("msg", "未查询到患者");
|
|
|
return data;
|
|
|
}
|
|
|
|
|
|
BaseDoctorDO doctor = doctorDao.findById(doctorCode).orElse(null);
|
|
|
//判断是否添加过该居民
|
|
|
Integer patientDischargeDOS =0;
|
|
|
if (type==2){//查询下转是否存在该患者:sign_status=1(包括type==null,type==2) 1.6.8后新增未家签的也能添加患者 判断条件(d.type=2 and sign_status=0)
|
|
|
String sql = "select count(1) from wlyy_patient_discharge d where d.create_user='"+doctorCode+"' and d.idcard='"+patient.getIdcard()+"'and (sign_status=1 and ( ISNULL(d.type) or d.type=2) or (d.type=2 and sign_status=0))";
|
|
|
patientDischargeDOS = jdbcTemplate.queryForObject(sql,Integer.class);
|
|
|
}
|
|
|
else{//查询加签列表是否存在该患者
|
|
|
String sql = "select count(1) from wlyy_patient_discharge d where d.create_user='"+doctorCode+"' and d.idcard='"+patient.getIdcard()+"'";
|
|
|
patientDischargeDOS = jdbcTemplate.queryForObject(sql,Integer.class);
|
|
|
}
|
|
|
if(patientDischargeDOS > 0){
|
|
|
data.put("status", -1);
|
|
|
data.put("msg", "该患者已添加过,请勿重复添加");
|
|
|
return data;
|
|
|
}
|
|
|
|
|
|
PatientDischargeDO patientDischargeDO = new PatientDischargeDO();
|
|
|
patientDischargeDO.setCode(UUID.randomUUID().toString().replaceAll("-", ""));
|
|
|
patientDischargeDO.setType(2);//统一保存为2
|
|
|
patientDischargeDO.setPatient(patient.getId());
|
|
|
patientDischargeDO.setName(patient.getName());
|
|
|
patientDischargeDO.setIdcard(patient.getIdcard());
|
|
|
patientDischargeDO.setSsc(patient.getSsc());
|
|
|
patientDischargeDO.setAddress(patient.getAddress());
|
|
|
patientDischargeDO.setCreateUser(doctorCode);
|
|
|
patientDischargeDO.setCreateUserName(doctor.getName());
|
|
|
patientDischargeDO.setCreateTime(new Date());
|
|
|
//判断是否家签 修改
|
|
|
SignFamily signFamily = signFamilyDao.getExpensesSignByIdcard(patient.getIdcard());
|
|
|
if(signFamily != null ) {
|
|
|
patientDischargeDO.setSignStatus(1);
|
|
|
patientDischargeDO.setHospital(signFamily.getHospital());
|
|
|
patientDischargeDO.setHospitalName(signFamily.getHospitalName());
|
|
|
patientDischargeDao.save(patientDischargeDO);
|
|
|
}else {
|
|
|
patientDischargeDO.setSignStatus(0);
|
|
|
// if (type == 1){//添加签约患者加签列表
|
|
|
patientDischargeDao.save(patientDischargeDO);
|
|
|
// }else if(type == 2) {
|
|
|
// patientDischargeDao.save(patientDischargeDO);
|
|
|
// data.put("status", -1);
|
|
|
// data.put("msg", "该患者未家签,请家签后重试");
|
|
|
// return data;
|
|
|
// public JSONObject getPatientByIdcardOrSsc(String patientInfo, Integer type, String doctorCode) {
|
|
|
// //加签列表查询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(type==2){
|
|
|
// patient = patientService.addPaitentByIdcard(patientInfo);
|
|
|
// }
|
|
|
}
|
|
|
data.put("status", 200);
|
|
|
data.put("data", patientDischargeDO);
|
|
|
|
|
|
return data;
|
|
|
}
|
|
|
// }else{
|
|
|
// patient = patientList.get(0);
|
|
|
// }
|
|
|
//
|
|
|
// if(patient==null){
|
|
|
// data.put("status", -1);
|
|
|
// data.put("msg", "未查询到患者");
|
|
|
// return data;
|
|
|
// }
|
|
|
//
|
|
|
// BaseDoctorDO doctor = doctorDao.findById(doctorCode).orElse(null);
|
|
|
// //判断是否添加过该居民
|
|
|
// Integer patientDischargeDOS =0;
|
|
|
// if (type==2){//查询下转是否存在该患者:sign_status=1(包括type==null,type==2) 1.6.8后新增未家签的也能添加患者 判断条件(d.type=2 and sign_status=0)
|
|
|
// String sql = "select count(1) from wlyy_patient_discharge d where d.create_user='"+doctorCode+"' and d.idcard='"+patient.getIdcard()+"'and (sign_status=1 and ( ISNULL(d.type) or d.type=2) or (d.type=2 and sign_status=0))";
|
|
|
// patientDischargeDOS = jdbcTemplate.queryForObject(sql,Integer.class);
|
|
|
// }
|
|
|
// else{//查询加签列表是否存在该患者
|
|
|
// String sql = "select count(1) from wlyy_patient_discharge d where d.create_user='"+doctorCode+"' and d.idcard='"+patient.getIdcard()+"'";
|
|
|
// patientDischargeDOS = jdbcTemplate.queryForObject(sql,Integer.class);
|
|
|
// }
|
|
|
// if(patientDischargeDOS > 0){
|
|
|
// data.put("status", -1);
|
|
|
// data.put("msg", "该患者已添加过,请勿重复添加");
|
|
|
// return data;
|
|
|
// }
|
|
|
//
|
|
|
// PatientDischargeDO patientDischargeDO = new PatientDischargeDO();
|
|
|
// patientDischargeDO.setCode(UUID.randomUUID().toString().replaceAll("-", ""));
|
|
|
// patientDischargeDO.setType(2);//统一保存为2
|
|
|
// patientDischargeDO.setPatient(patient.getId());
|
|
|
// patientDischargeDO.setName(patient.getName());
|
|
|
// patientDischargeDO.setIdcard(patient.getIdcard());
|
|
|
// patientDischargeDO.setSsc(patient.getSsc());
|
|
|
// patientDischargeDO.setAddress(patient.getAddress());
|
|
|
// patientDischargeDO.setCreateUser(doctorCode);
|
|
|
// patientDischargeDO.setCreateUserName(doctor.getName());
|
|
|
// patientDischargeDO.setCreateTime(new Date());
|
|
|
// //判断是否家签 修改
|
|
|
// SignFamily signFamily = signFamilyDao.getExpensesSignByIdcard(patient.getIdcard());
|
|
|
// if(signFamily != null ) {
|
|
|
// patientDischargeDO.setSignStatus(1);
|
|
|
// patientDischargeDO.setHospital(signFamily.getHospital());
|
|
|
// patientDischargeDO.setHospitalName(signFamily.getHospitalName());
|
|
|
// patientDischargeDao.save(patientDischargeDO);
|
|
|
// }else {
|
|
|
// patientDischargeDO.setSignStatus(0);
|
|
|
//// if (type == 1){//添加签约患者加签列表
|
|
|
// patientDischargeDao.save(patientDischargeDO);
|
|
|
//// }else if(type == 2) {
|
|
|
//// patientDischargeDao.save(patientDischargeDO);
|
|
|
//// data.put("status", -1);
|
|
|
//// data.put("msg", "该患者未家签,请家签后重试");
|
|
|
//// return data;
|
|
|
//// }
|
|
|
// }
|
|
|
// data.put("status", 200);
|
|
|
// data.put("data", patientDischargeDO);
|
|
|
//
|
|
|
// 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_specialist.wlyy_rehabilitation_plan_detail d \n" +
|