|
@ -13,13 +13,19 @@ import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
|
|
|
import com.yihu.jw.entity.base.doctor.BaseDoctorRoleDO;
|
|
|
import com.yihu.jw.entity.base.patient.BasePatientDO;
|
|
|
import com.yihu.jw.entity.door.SignFamily;
|
|
|
import com.yihu.jw.entity.hospital.DmHospitalDO;
|
|
|
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
|
|
|
import com.yihu.jw.entity.hospital.doctor.Frequency;
|
|
|
import com.yihu.jw.entity.hospital.message.SystemMessageDO;
|
|
|
import com.yihu.jw.entity.hospital.team.WlyyAdminTeamDO;
|
|
|
import com.yihu.jw.entity.patient.Patient;
|
|
|
import com.yihu.jw.entity.specialist.DoctorPatientRelationDO;
|
|
|
import com.yihu.jw.entity.specialist.SpecialistPatientRelationDO;
|
|
|
import com.yihu.jw.entity.specialist.rehabilitation.*;
|
|
|
import com.yihu.jw.entity.util.TransforSqlUtl;
|
|
|
import com.yihu.jw.hospital.HospitalDao;
|
|
|
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
|
|
|
import com.yihu.jw.hospital.team.dao.WlyyAdminTeamDao;
|
|
|
import com.yihu.jw.im.util.ImUtil;
|
|
|
import com.yihu.jw.patient.dao.BasePatientDao;
|
|
|
import com.yihu.jw.rehabilitation.*;
|
|
@ -111,9 +117,15 @@ public class RehabilitationManageService {
|
|
|
@Autowired
|
|
|
private RehabilitationInfoService rehabilitationInfoService;
|
|
|
@Autowired
|
|
|
private WlyyHospitalSysDictDao wlyyHospitalSysDictDao;
|
|
|
@Autowired
|
|
|
private ObjectMapper objectMapper;
|
|
|
@Value("${demo.flag}")
|
|
|
private Boolean demoFlag;
|
|
|
@Autowired
|
|
|
private WlyyAdminTeamDao wlyyAdminTeamDao;
|
|
|
@Autowired
|
|
|
private HospitalDao hospitalDao;
|
|
|
/**
|
|
|
* 预约协诊
|
|
|
* @param doctor
|
|
@ -162,6 +174,13 @@ public class RehabilitationManageService {
|
|
|
doctorType = 2;
|
|
|
}
|
|
|
}
|
|
|
String orgName="";
|
|
|
String deptName="";
|
|
|
List<BaseDoctorHospitalDO> orgs = baseDoctorHospitalDao.findByDoctorCode(doctorCode);
|
|
|
if(orgs!=null&&orgs.size()>0){
|
|
|
orgName=orgs.get(0).getOrgName();
|
|
|
deptName=orgs.get(0).getDeptName();
|
|
|
}
|
|
|
String sql = " select DISTINCT p.* " +
|
|
|
" from wlyy_rehabilitation_plan_detail a INNER JOIN wlyy_patient_rehabilitation_plan p " +
|
|
|
" on a.plan_id = p.id " ;
|
|
@ -206,20 +225,41 @@ public class RehabilitationManageService {
|
|
|
|
|
|
for(Map<String,Object> one:patientRehabilitationPlanDOList){
|
|
|
Map<String,Object> resultMap = new HashMap<>();
|
|
|
String onePlanType=one.get("plan_type")==null?"":one.get("plan_type").toString();
|
|
|
if ("2".equalsIgnoreCase(onePlanType)){
|
|
|
String adminTeam=one.get("admin_team_code")==null?"":one.get("admin_team_code").toString();
|
|
|
if (StringUtils.isNoneBlank(adminTeam)){
|
|
|
WlyyAdminTeamDO wlyyAdminTeamDO =wlyyAdminTeamDao.findOne(Integer.valueOf(adminTeam));
|
|
|
if (wlyyAdminTeamDO!=null){
|
|
|
DmHospitalDO dmHospitalDO = hospitalDao.findByCode(wlyyAdminTeamDO.getOrgCode());
|
|
|
if (dmHospitalDO!=null){
|
|
|
resultMap.put("location",dmHospitalDO.getName());
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}else {
|
|
|
resultMap.put("location",orgName);
|
|
|
}
|
|
|
resultMap.put("diseaseName",one.get("disease_name"));
|
|
|
resultMap.put("deptName",deptName);
|
|
|
// Integer age = IdCardUtil.getAgeForIdcard(one.get("idcard")+"");
|
|
|
// String sex = IdCardUtil.getSexForIdcard_new(one.get("idcard")+"");
|
|
|
// resultMap.put("age",age);
|
|
|
resultMap.put("hospitalName",one.get("hospital_name"));
|
|
|
// resultMap.put("sex","1".equals(sex)?"男":("2".equals(sex)?"女":"未知"));
|
|
|
resultMap.put("patientName",one.get("patientName"));
|
|
|
resultMap.put("patientName",one.get("name"));
|
|
|
resultMap.put("patientCode",one.get("patient"));
|
|
|
patient = basePatientDao.findById(one.get("patient").toString());
|
|
|
|
|
|
if (patient!=null){
|
|
|
resultMap.put("photo",patient!=null?patient.getPhoto():"");
|
|
|
Integer age = IdCardUtil.getAgeForIdcard(patient.getIdcard());
|
|
|
String sex = IdCardUtil.getSexForIdcard_new(patient.getIdcard());
|
|
|
resultMap.put("age",age);
|
|
|
|
|
|
resultMap.put("sex","1".equals(sex)?"男":("2".equals(sex)?"女":"未知"));
|
|
|
resultMap.put("age",age);
|
|
|
SignFamily signFamily = signFamilyDao.findByPatient(one.get("patient").toString());
|
|
|
if (signFamily != null){
|
|
|
resultMap.put("hospitalName",signFamily.getHospitalName());
|
|
@ -1581,46 +1621,62 @@ public class RehabilitationManageService {
|
|
|
* @param planDeatilId
|
|
|
* @return
|
|
|
*/
|
|
|
public Map<String,Object> updateNodeAndRelationRecordImg(String node,String image,String status,String planDeatilId,String relationCode)throws Exception{
|
|
|
public Map<String,Object> updateNodeAndRelationRecordImg(String node,String image,String status,String planDeatilId,String relationCode,String recordId)throws Exception{
|
|
|
Map<String,Object> resultMap = new HashedMap();
|
|
|
try{
|
|
|
RehabilitationDetailDO detailDO = rehabilitationDetailDao.findById(planDeatilId);
|
|
|
detailDO.setStatus(1);
|
|
|
if (StringUtils.isNoneBlank(status)){
|
|
|
detailDO.setStatus(Integer.parseInt(status));
|
|
|
}
|
|
|
detailDO.setUpdateTime(new Date());
|
|
|
if (StringUtils.isNoneBlank(relationCode)){
|
|
|
detailDO.setRelationCode(relationCode);
|
|
|
}
|
|
|
rehabilitationDetailDao.save(detailDO);
|
|
|
if (StringUtils.isNoneBlank(image)&&StringUtils.isNoneBlank(node)){
|
|
|
int j = rehabilitationOperateRecordsDao.updateNodeAndRelationRecordImg(node,image,planDeatilId);
|
|
|
}
|
|
|
else if (StringUtils.isNoneBlank(node)){
|
|
|
int j = rehabilitationOperateRecordsDao.updateNodeByPlanDetailId(node,planDeatilId);
|
|
|
}
|
|
|
else if (StringUtils.isNoneBlank(image)){//
|
|
|
int j = rehabilitationOperateRecordsDao.updateImagByPlanDetailId(image,planDeatilId);
|
|
|
}
|
|
|
else{//跟新为已完成
|
|
|
int j = rehabilitationOperateRecordsDao.updateStatus(1,planDeatilId);
|
|
|
}
|
|
|
//如果整个计划的服务项都完成了,整个计划也完成了
|
|
|
String allSql ="SELECT * FROM wlyy_rehabilitation_plan_detail where plan_id = (SELECT plan_id FROM `wlyy_rehabilitation_plan_detail` WHERE id='"+planDeatilId+"')";
|
|
|
allSql = TransforSqlUtl.wlyy_rehabilitation_plan_detailAll(allSql);
|
|
|
List<RehabilitationDetailDO> rehabilitationDetailDOList = jdbcTemplate.query(allSql,new BeanPropertyRowMapper<>(RehabilitationDetailDO.class));
|
|
|
int allCount=0;
|
|
|
String planId="";
|
|
|
for (RehabilitationDetailDO rehabilitationDetailDO : rehabilitationDetailDOList){
|
|
|
if (rehabilitationDetailDO.getStatus()==1){
|
|
|
allCount++;
|
|
|
if (!StringUtils.isNoneBlank(recordId)){
|
|
|
RehabilitationDetailDO detailDO = rehabilitationDetailDao.findById(planDeatilId);
|
|
|
detailDO.setStatus(1);
|
|
|
if (StringUtils.isNoneBlank(status)){
|
|
|
detailDO.setStatus(Integer.parseInt(status));
|
|
|
}
|
|
|
detailDO.setUpdateTime(new Date());
|
|
|
if (StringUtils.isNoneBlank(relationCode)){
|
|
|
detailDO.setRelationCode(relationCode);
|
|
|
}
|
|
|
rehabilitationDetailDao.save(detailDO);
|
|
|
if (StringUtils.isNoneBlank(image)&&StringUtils.isNoneBlank(node)){
|
|
|
int j = rehabilitationOperateRecordsDao.updateNodeAndRelationRecordImg(node,image,planDeatilId);
|
|
|
}
|
|
|
else if (StringUtils.isNoneBlank(node)){
|
|
|
int j = rehabilitationOperateRecordsDao.updateNodeByPlanDetailId(node,planDeatilId);
|
|
|
}
|
|
|
else if (StringUtils.isNoneBlank(image)){//
|
|
|
int j = rehabilitationOperateRecordsDao.updateImagByPlanDetailId(image,planDeatilId);
|
|
|
}
|
|
|
else{//跟新为已完成
|
|
|
int j = rehabilitationOperateRecordsDao.updateStatus(1,planDeatilId);
|
|
|
}
|
|
|
//如果整个计划的服务项都完成了,整个计划也完成了
|
|
|
String allSql ="SELECT * FROM wlyy_rehabilitation_plan_detail where plan_id = (SELECT plan_id FROM `wlyy_rehabilitation_plan_detail` WHERE id='"+planDeatilId+"')";
|
|
|
allSql = TransforSqlUtl.wlyy_rehabilitation_plan_detailAll(allSql);
|
|
|
List<RehabilitationDetailDO> rehabilitationDetailDOList = jdbcTemplate.query(allSql,new BeanPropertyRowMapper<>(RehabilitationDetailDO.class));
|
|
|
int allCount=0;
|
|
|
String planId="";
|
|
|
for (RehabilitationDetailDO rehabilitationDetailDO : rehabilitationDetailDOList){
|
|
|
if (rehabilitationDetailDO.getStatus()==1){
|
|
|
allCount++;
|
|
|
}
|
|
|
}
|
|
|
if (rehabilitationDetailDOList.size()>0 && rehabilitationDetailDOList.size()==allCount){
|
|
|
planId = rehabilitationDetailDOList.get(0).getPlanId();
|
|
|
patientRehabilitationPlanDao.updateStatusAndTimeById(2,planId, new Date());
|
|
|
}
|
|
|
}else {
|
|
|
if (StringUtils.isNoneBlank(image)&&StringUtils.isNoneBlank(node)){
|
|
|
int j = rehabilitationOperateRecordsDao.updateNodeAndRelationRecordImgById(node,image,recordId);
|
|
|
}
|
|
|
else if (StringUtils.isNoneBlank(node)){
|
|
|
int j = rehabilitationOperateRecordsDao.updateNodeByPlanDetailIdById(node,recordId);
|
|
|
}
|
|
|
else if (StringUtils.isNoneBlank(image)){//
|
|
|
int j = rehabilitationOperateRecordsDao.updateImagByPlanDetailIdById(image,recordId);
|
|
|
}
|
|
|
else{//跟新为已完成
|
|
|
int j = rehabilitationOperateRecordsDao.updateStatusById(1,recordId);
|
|
|
}
|
|
|
}
|
|
|
if (rehabilitationDetailDOList.size()>0 && rehabilitationDetailDOList.size()==allCount){
|
|
|
planId = rehabilitationDetailDOList.get(0).getPlanId();
|
|
|
patientRehabilitationPlanDao.updateStatusAndTimeById(2,planId, new Date());
|
|
|
}
|
|
|
|
|
|
}catch (Exception e){
|
|
|
throw new Exception("更新服务状态失败!");
|
|
|
}
|
|
@ -1781,12 +1837,32 @@ public class RehabilitationManageService {
|
|
|
PatientRehabilitationPlanDO p =patientRehabilitationPlanDao.findById(planId);
|
|
|
List<DoctorPatientRelationDO> doctorPatientRelationDO= doctorPatientRelationDao.findByDoctorAndPatient(p.getCreateUser(),p.getPatient());
|
|
|
List<RehabilitationDetailDO> details=rehabilitationDetailDao.findByPlanId(planId);
|
|
|
List<WlyyHospitalSysDictDO> dicts=wlyyHospitalSysDictDao.findByDictName("healthCondition");
|
|
|
String doctor="";
|
|
|
String doctorName="";
|
|
|
List<Map<String,Object>> doctorMaps=new ArrayList<>();
|
|
|
if (details!=null&&details.size()>0){
|
|
|
doctor=details.get(0).getDoctor();
|
|
|
doctorName=details.get(0).getDoctorName();
|
|
|
for (RehabilitationDetailDO rehabilitationDetailDO:details){
|
|
|
Map<String,Object> doctorMap = new HashMap<>();
|
|
|
doctor=rehabilitationDetailDO.getDoctor();
|
|
|
doctorName=rehabilitationDetailDO.getDoctorName();
|
|
|
List<BaseDoctorHospitalDO> baseDoctorHospitalDOTo = baseDoctorHospitalDao.findByDoctorCode(doctor);
|
|
|
BaseDoctorDO baseDoctorDO = baseDoctorDao.findById(doctor);
|
|
|
if (baseDoctorDO!=null){
|
|
|
doctorMap.put("photo",baseDoctorDO.getPhoto());
|
|
|
doctorMap.put("jobTitle",baseDoctorDO.getJobTitleName());
|
|
|
}
|
|
|
if (baseDoctorHospitalDOTo!=null&&baseDoctorHospitalDOTo.size()>0){
|
|
|
doctorMap.put("doctorName",doctorName);
|
|
|
doctorMap.put("doctor",doctor);
|
|
|
doctorMap.put("doctorDept",baseDoctorHospitalDOTo.get(0).getDeptCode());
|
|
|
doctorMap.put("doctorDeptName",baseDoctorHospitalDOTo.get(0).getDeptName());
|
|
|
}
|
|
|
doctorMaps.add(doctorMap);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
resultMap.put("doctorMaps",doctorMaps);
|
|
|
resultMap.put("allCount",allCount);
|
|
|
resultMap.put("finishedCount",finishedCount);
|
|
|
resultMap.put("specialistPatientRelationDO",doctorPatientRelationDO);
|
|
@ -1794,6 +1870,12 @@ public class RehabilitationManageService {
|
|
|
resultMap.put("disease",p.getDisease());
|
|
|
resultMap.put("planType",p.getPlanType());
|
|
|
resultMap.put("healthStatusCode",p.getHealthStatusCode());
|
|
|
for (WlyyHospitalSysDictDO wlyyHospitalSysDictDO:dicts){
|
|
|
if (p.getHealthStatusCode().equalsIgnoreCase(wlyyHospitalSysDictDO.getDictCode())){
|
|
|
resultMap.put("healthStatusName",wlyyHospitalSysDictDO.getDictValue());
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
resultMap.put("diseaseName",p.getDiseaseName());
|
|
|
resultMap.put("createUser",p.getCreateUser());
|
|
|
resultMap.put("planTitle",p.getTitle());
|
|
@ -1810,21 +1892,13 @@ public class RehabilitationManageService {
|
|
|
resultMap.put("createUserDept",baseDoctorHospitalDO.get(0).getDeptCode());
|
|
|
resultMap.put("createUserDeptName",baseDoctorHospitalDO.get(0).getDeptName());
|
|
|
}
|
|
|
List<BaseDoctorHospitalDO> baseDoctorHospitalDOTo = baseDoctorHospitalDao.findByDoctorCode(doctor);
|
|
|
BaseDoctorDO baseDoctorDO = baseDoctorDao.findById(doctor);
|
|
|
if (baseDoctorDO!=null){
|
|
|
resultMap.put("photo",baseDoctorDO.getPhoto());
|
|
|
resultMap.put("jobTitle",baseDoctorDO.getJobTitleName());
|
|
|
}
|
|
|
if (baseDoctorHospitalDOTo!=null&&baseDoctorHospitalDOTo.size()>0){
|
|
|
resultMap.put("doctorName",doctorName);
|
|
|
resultMap.put("doctor",doctor);
|
|
|
resultMap.put("doctorDept",baseDoctorHospitalDOTo.get(0).getDeptCode());
|
|
|
resultMap.put("doctorDeptName",baseDoctorHospitalDOTo.get(0).getDeptName());
|
|
|
}
|
|
|
PatientMedicalRecordsDO patientMedicalRecordsDO = patientMedicalRecordsDao.findByCode(p.getMedicalRecordsCode());
|
|
|
resultMap.put("patientMedicalRecordsDO",patientMedicalRecordsDO);
|
|
|
}
|
|
|
Date beginTime = DateUtil.strToDateLong(DateUtil.getStringDateShort()+ " "+"00:00:00");
|
|
|
Date endTime = DateUtil.strToDateLong(DateUtil.getStringDateShort()+ " "+"23:59:59");
|
|
|
Integer todayBacklogCount = rehabilitationDetailDao.todayBacklogCount(planId,beginTime,endTime);
|
|
|
resultMap.put("todayBacklogCount",todayBacklogCount);//今日待办总数
|
|
|
BasePatientDO basePatientDO = basePatientDao.findById(patientCode);
|
|
|
Integer age = IdCardUtil.getAgeForIdcard(basePatientDO.getIdcard());
|
|
|
String sex = IdCardUtil.getSexForIdcard_new(basePatientDO.getIdcard());
|