|
@ -14,7 +14,6 @@ import com.yihu.jw.entity.base.servicePackage.ServicePackageRecordDO;
|
|
|
import com.yihu.jw.entity.base.servicePackage.ServicePackageSignRecordDO;
|
|
|
import com.yihu.jw.entity.care.apply.PatientBedApplyDo;
|
|
|
import com.yihu.jw.entity.care.archive.ArchiveDO;
|
|
|
import com.yihu.jw.entity.care.sign.CapacityAssessmentRecordDO;
|
|
|
import com.yihu.jw.im.util.ImUtil;
|
|
|
import com.yihu.jw.patient.dao.BasePatientDao;
|
|
|
import com.yihu.jw.patient.service.BasePatientMedicardCardService;
|
|
@ -87,11 +86,11 @@ public class ServicePackageService extends BaseJpaService<ServicePackageDO, Serv
|
|
|
"FROM " +
|
|
|
" base_service_package_sign_record sr, " +
|
|
|
" base_service_package_record r, " +
|
|
|
" base_service_package_item i, " +
|
|
|
" base_service_package i, " +
|
|
|
" base_org o " +
|
|
|
"WHERE " +
|
|
|
" sr.id = r.sign_id and sr.status=1 and sr.patient = '"+patient+"' " +
|
|
|
"AND r.service_package_id = i.service_package_id " +
|
|
|
"AND r.service_package_id = i.id " +
|
|
|
"AND i.del = 1 " +
|
|
|
"and i.org_code = o.code " +
|
|
|
"AND sr.`status` = 1 ";
|
|
@ -120,12 +119,12 @@ public class ServicePackageService extends BaseJpaService<ServicePackageDO, Serv
|
|
|
"FROM " +
|
|
|
" base_service_package_sign_record sr, " +
|
|
|
" base_service_package_record r, " +
|
|
|
" base_service_package_item i, " +
|
|
|
" base_service_package i, " +
|
|
|
" base_team_member m,base_doctor d " +
|
|
|
"WHERE " +
|
|
|
" sr.id = r.sign_id and sr.status=1 and sr.patient = '"+patient+"'" +
|
|
|
" AND r.service_package_id = i.service_package_id " +
|
|
|
"AND i.del = 1 and m.team_code = i.team_code and m.doctor_code = d.id " +
|
|
|
" AND r.service_package_id = i.id " +
|
|
|
"AND i.del = 1 and m.team_code = r.team_code and sr.id=r.sign_id and m.doctor_code = d.id " +
|
|
|
" and m.del = '1'";
|
|
|
if(StringUtils.isNoneBlank(orgCode)){
|
|
|
sql += " and i.org_code = '"+orgCode+"' " ;
|
|
@ -134,39 +133,6 @@ public class ServicePackageService extends BaseJpaService<ServicePackageDO, Serv
|
|
|
return list;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获取居民签约的服务项
|
|
|
* @param patientId
|
|
|
* @return
|
|
|
*/
|
|
|
public List<String> getPatientServiceItems(String patientId){
|
|
|
String key = "serviceItem:"+patientId;
|
|
|
List<String> res;
|
|
|
if(redisTemplate.hasKey(key)){
|
|
|
long size = redisTemplate.opsForList().size(key);
|
|
|
res = redisTemplate.opsForList().range(key,0,size);
|
|
|
}else{
|
|
|
res = fingServiceItemsCodeByPatientId(patientId);
|
|
|
redisTemplate.opsForList().leftPushAll(key,res);
|
|
|
}
|
|
|
return res;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 每次修改服务项重新设置res的服务项值
|
|
|
* @param patientId
|
|
|
*/
|
|
|
public void setPatientServiceItems(String patientId){
|
|
|
String key = "serviceItem:"+patientId;
|
|
|
if(redisTemplate.hasKey(key)){
|
|
|
redisTemplate.delete(key);
|
|
|
}
|
|
|
List<String> res = fingServiceItemsCodeByPatientId(patientId);
|
|
|
if(res!=null&&res.size()>0){
|
|
|
redisTemplate.opsForList().leftPushAll(key,res);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 查找居民的签约服务项
|
|
@ -174,7 +140,7 @@ public class ServicePackageService extends BaseJpaService<ServicePackageDO, Serv
|
|
|
* @return
|
|
|
*/
|
|
|
public List<Map<String,Object>> fingServiceItemsByPatientId(String patientId){
|
|
|
String sql = "SELECT DISTINCT i.code,i.name,i.team_code from base_service_package_sign_record sr,base_service_package_record r, " +
|
|
|
String sql = "SELECT DISTINCT i.code,i.name,r.team_code from base_service_package_sign_record sr,base_service_package_record r, " +
|
|
|
" base_service_package_item i where sr.id = r.sign_id and sr.status=1 and r.service_package_id = i.service_package_id " +
|
|
|
" and i.del = 1 and sr.`status`=1 and sr.patient = '"+patientId+"' ";
|
|
|
return jdbcTemplate.queryForList(sql);
|
|
@ -216,10 +182,8 @@ public class ServicePackageService extends BaseJpaService<ServicePackageDO, Serv
|
|
|
* @param signId
|
|
|
*/
|
|
|
public List<Map<String,Object>> fingdDoctorBySignId(String signId,Integer level){
|
|
|
String sql = "SELECT DISTINCT d.id,d.name from base_service_package_sign_record sr,base_service_package_record r, " +
|
|
|
"base_service_package_item i,base_team_member m,base_doctor d " +
|
|
|
"WHERE sr.id = r.sign_id and sr.status=1 and r.service_package_id = i.service_package_id " +
|
|
|
"and i.del = 1 and m.team_code = i.team_code and m.doctor_code = d.id " +
|
|
|
String sql = "SELECT DISTINCT d.id,d.name from base_service_package_sign_record sr,base_service_package_record r,base_team_member m,base_doctor d " +
|
|
|
"WHERE sr.status=1 and m.team_code = r.team_code and sr.id=r.sign_id and m.doctor_code = d.id " +
|
|
|
"and m.del = '1' and d.doctor_level = " + level+
|
|
|
" and sr.id = '"+signId+"' ";
|
|
|
return jdbcTemplate.queryForList(sql);
|
|
@ -229,29 +193,13 @@ public class ServicePackageService extends BaseJpaService<ServicePackageDO, Serv
|
|
|
* 根据居民和服务项查找医生
|
|
|
* @param patientId
|
|
|
*/
|
|
|
public List<Map<String,Object>> fingdDoctorByPaitenId(String patientId,String serviceItem){
|
|
|
String sql = "SELECT DISTINCT d.id,d.name from base_service_package_sign_record sr,base_service_package_record r, " +
|
|
|
" base_service_package_item i,base_team_member m,base_doctor d " +
|
|
|
" WHERE sr.id = r.sign_id and sr.status=1 and r.service_package_id = i.service_package_id " +
|
|
|
" and i.del = 1 and m.team_code = i.team_code and m.doctor_code = d.id " +
|
|
|
" and m.del = '1' and sr.patient = '"+patientId+"' " +
|
|
|
"and i.`code` = '"+serviceItem+"'";
|
|
|
public List<Map<String,Object>> fingdDoctorByPaitenId(String patientId){
|
|
|
String sql = "SELECT DISTINCT d.id,d.name from base_service_package_sign_record sr,base_service_package_record r,base_team_member m,base_doctor d " +
|
|
|
" WHERE sr.status=1 and m.team_code = r.team_code and sr.id=r.sign_id and m.doctor_code = d.id " +
|
|
|
" and m.del = '1' and sr.patient = '"+patientId+"' " ;
|
|
|
return jdbcTemplate.queryForList(sql);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 根据服务包id查找医生/助老员
|
|
|
* @param packageId
|
|
|
*/
|
|
|
public List<Map<String,Object>> fingdDoctorByPackageId(String packageId,Integer level){
|
|
|
String sql = "SELECT DISTINCT d.id,d.name from base_service_package_record r, " +
|
|
|
"base_service_package_item i,base_team_member m,base_doctor d " +
|
|
|
"WHERE r.service_package_id = i.service_package_id " +
|
|
|
"and i.del = 1 and m.team_code = i.team_code and m.doctor_code = d.id " +
|
|
|
"and m.del = '1' and d.doctor_level = " + level+
|
|
|
" and r.id = '"+packageId+"' ";
|
|
|
return jdbcTemplate.queryForList(sql);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 根据签约记录查找服务包
|
|
@ -277,11 +225,9 @@ public class ServicePackageService extends BaseJpaService<ServicePackageDO, Serv
|
|
|
String sql = "SELECT DISTINCT sr.patient,sr.id,sr.start_time,p.name,p.sex,p.idcard,p.openid,p.photo ";
|
|
|
String countSql = "SELECT count(DISTINCT sr.patient) ";
|
|
|
|
|
|
String filters = " from base_service_package_sign_record sr,base_service_package_record r, " +
|
|
|
"base_service_package_item i,base_team_member m,base_patient p " +
|
|
|
"WHERE sr.id = r.sign_id and sr.status=1 and r.service_package_id = i.service_package_id " +
|
|
|
"and i.del = 1 and m.team_code = i.team_code and p.id = sr.patient " +
|
|
|
"and m.doctor_code = '"+doctorId+"' and m.del = '1' and sr.`status`=1 ";
|
|
|
String filters = " from base_service_package_sign_record sr,base_service_package_record r,base_team_member m,base_patient p " +
|
|
|
"WHERE sr.status=1 and m.team_code = r.team_code and sr.id=r.sign_id and p.id = sr.patient " +
|
|
|
"and m.doctor_code = '"+doctorId+"' and m.del = '1' ";
|
|
|
|
|
|
if(!StringUtil.isEmpty(name)){
|
|
|
filters += " and sr.name like '%"+name+"%' ";
|
|
@ -309,11 +255,9 @@ public class ServicePackageService extends BaseJpaService<ServicePackageDO, Serv
|
|
|
* @return
|
|
|
*/
|
|
|
public int getSignTotal(String doctorId){
|
|
|
String sql = "SELECT COUNT(DISTINCT sr.patient) from base_service_package_sign_record sr,base_service_package_record r, " +
|
|
|
"base_service_package_item i,base_team_member m " +
|
|
|
"WHERE sr.id = r.sign_id and sr.status=1 and r.service_package_id = i.service_package_id " +
|
|
|
"and i.del = 1 and m.team_code = i.team_code " +
|
|
|
"and m.doctor_code = '"+doctorId+"' and m.del = '1' and sr.`status`=1 ";
|
|
|
String sql = "SELECT COUNT(DISTINCT sr.patient) from base_service_package_sign_record sr,base_service_package_record r,base_team_member m " +
|
|
|
"WHERE sr.status=1 and m.team_code = r.team_code and sr.id=r.sign_id" +
|
|
|
"and m.doctor_code = '"+doctorId+"' and m.del = '1' ";
|
|
|
|
|
|
return jdbcTemplate.queryForObject(sql,Integer.class);
|
|
|
}
|
|
@ -324,11 +268,12 @@ public class ServicePackageService extends BaseJpaService<ServicePackageDO, Serv
|
|
|
* @param doctorId
|
|
|
*/
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public JSONObject servicePackageSign(String jsonData,String doctorId,String patientId) throws Exception{
|
|
|
public JSONObject servicePackageSign(String jsonData,String doctorId,String patientId,String signYear) throws Exception{
|
|
|
BasePatientDO patientDO = patientDao.findById(patientId);
|
|
|
JSONObject result = new JSONObject();
|
|
|
ServicePackageSignRecordDO signRecordDO = objectMapper.readValue(jsonData, ServicePackageSignRecordDO.class);
|
|
|
signRecordDO.setPatient(patientId);
|
|
|
signRecordDO.setName(patientDO.getName());
|
|
|
List<ServicePackageRecordDO> recordDOList = signRecordDO.getRecordDOList();
|
|
|
String signId = signRecordDO.getId();
|
|
|
List<String> idList = new ArrayList<>();
|
|
@ -338,9 +283,15 @@ public class ServicePackageService extends BaseJpaService<ServicePackageDO, Serv
|
|
|
BaseDoctorDO doctorDO = doctorDao.findById(doctorId);
|
|
|
//需要新增签约记录
|
|
|
signRecordDO.setStatus(1);
|
|
|
int year;
|
|
|
if("0".equals(signYear)){
|
|
|
year = 100;
|
|
|
}else{
|
|
|
year = Integer.valueOf(signYear);
|
|
|
}
|
|
|
signRecordDO.setStartTime(new Date());
|
|
|
Calendar cal = Calendar.getInstance();
|
|
|
cal.add(Calendar.YEAR,1);
|
|
|
cal.add(Calendar.YEAR,year);
|
|
|
signRecordDO.setEndTime(cal.getTime());
|
|
|
signRecordDO.setSignDoctor(doctorId);
|
|
|
signRecordDO.setSignDoctorName(doctorDO.getName());
|
|
@ -354,15 +305,24 @@ public class ServicePackageService extends BaseJpaService<ServicePackageDO, Serv
|
|
|
archiveDao.save(archiveDO);
|
|
|
}
|
|
|
}else{
|
|
|
ArchiveDO archiveDO = archiveDao.findByPatientAndDoctorCode(patientId,doctorId);
|
|
|
if(archiveDO!=null){
|
|
|
archiveDO.setSignStatus(1);
|
|
|
archiveDao.save(archiveDO);
|
|
|
}
|
|
|
signId = signRecordDOs.get(0).getId();
|
|
|
List<ServicePackageRecordDO> existList = servicePackageRecordDao.findBySignId(signId);
|
|
|
idList = existList.stream().map(ServicePackageRecordDO::getServicePackageId).collect(Collectors.toList());
|
|
|
//不能重复签约
|
|
|
result.put(ResponseContant.resultFlag, ResponseContant.fail);
|
|
|
result.put(ResponseContant.resultMsg,"请勿重复签约");
|
|
|
return result;
|
|
|
// ArchiveDO archiveDO = archiveDao.findByPatientAndDoctorCode(patientId,doctorId);
|
|
|
// if(archiveDO!=null){
|
|
|
// archiveDO.setSignStatus(1);
|
|
|
// archiveDao.save(archiveDO);
|
|
|
// }
|
|
|
// signId = signRecordDOs.get(0).getId();
|
|
|
// List<ServicePackageRecordDO> existList = servicePackageRecordDao.findBySignId(signId);
|
|
|
// idList = existList.stream().map(ServicePackageRecordDO::getServicePackageId).collect(Collectors.toList());
|
|
|
}
|
|
|
}else{
|
|
|
//不能重复签约
|
|
|
result.put(ResponseContant.resultFlag, ResponseContant.fail);
|
|
|
result.put(ResponseContant.resultMsg,"请勿重复签约");
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
//服务项目 emergencyAssistance 只能签约一个
|
|
@ -376,12 +336,12 @@ public class ServicePackageService extends BaseJpaService<ServicePackageDO, Serv
|
|
|
ServicePackageRecordDO recordDO = iterator.next();
|
|
|
recordDO.setPatient(patientId);
|
|
|
recordDO.setSignId(signId);
|
|
|
if (idList.contains(recordDO.getServicePackageId())) {
|
|
|
iterator.remove();//使用迭代器的删除方法删除
|
|
|
}
|
|
|
// if (idList.contains(recordDO.getServicePackageId())) {
|
|
|
// iterator.remove();//使用迭代器的删除方法删除
|
|
|
// }
|
|
|
|
|
|
}
|
|
|
if(recordDOList.size()>0){
|
|
|
/* if(recordDOList.size()>0){
|
|
|
List<String> packages = recordDOList.stream().map(ServicePackageRecordDO::getServicePackageId).collect(Collectors.toList());
|
|
|
String packagesId = packages.stream().map(String::valueOf).collect(Collectors.joining("','"));
|
|
|
sqlItem = "select item.`code`,item.name from base_service_package_item item " +
|
|
@ -392,10 +352,10 @@ public class ServicePackageService extends BaseJpaService<ServicePackageDO, Serv
|
|
|
String message = "重复签约服务项目:"+newItem.get("emergencyAssistance").get(0).get("name").toString();
|
|
|
throw new Exception(message);
|
|
|
}
|
|
|
}
|
|
|
CapacityAssessmentRecordDO capacityAssessmentRecordDO = capacityAssessmentRecordService.findAssessmentByPatientId(patientId);
|
|
|
capacityAssessmentRecordDO.setServicePackageStatus(1);
|
|
|
capacityAssessmentRecordService.save(capacityAssessmentRecordDO);
|
|
|
}*/
|
|
|
// CapacityAssessmentRecordDO capacityAssessmentRecordDO = capacityAssessmentRecordService.findAssessmentByPatientId(patientId);
|
|
|
// capacityAssessmentRecordDO.setServicePackageStatus(1);
|
|
|
// capacityAssessmentRecordService.save(capacityAssessmentRecordDO);
|
|
|
servicePackageRecordDao.save(recordDOList);
|
|
|
|
|
|
//修改床位生请状态为已完成
|
|
@ -410,15 +370,31 @@ public class ServicePackageService extends BaseJpaService<ServicePackageDO, Serv
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
public List<ServicePackageDO> findServicePackageByOrgCode( String orgCode){
|
|
|
String sql = "SELECT p.* ";
|
|
|
|
|
|
String filters = "from base_service_package p " +
|
|
|
"WHERE p.del = 1 ";
|
|
|
if(!StringUtil.isBlank(orgCode)){
|
|
|
filters += " and p.org_code = '"+orgCode+"'";
|
|
|
}
|
|
|
|
|
|
filters += " ORDER BY p.create_time DESC ";
|
|
|
|
|
|
List<ServicePackageDO> list = jdbcTemplate.query(sql+filters,new BeanPropertyRowMapper<>(ServicePackageDO.class));
|
|
|
return list;
|
|
|
}
|
|
|
|
|
|
public PageEnvelop<List<Map<String,Object>>> servicePackagePage(int page, int size){
|
|
|
|
|
|
public PageEnvelop<List<Map<String,Object>>> servicePackagePage(int page, int size,String orgCode){
|
|
|
String sql = "SELECT p.id,p.`name`,p.type,p.introduce,p.num ";
|
|
|
String countSql = "SELECT count(*) ";
|
|
|
|
|
|
String filters = "from base_service_package p " +
|
|
|
"WHERE p.del = 1 ";
|
|
|
|
|
|
if(!StringUtil.isBlank(orgCode)){
|
|
|
filters += " and p.org_code = '"+orgCode+"'";
|
|
|
}
|
|
|
|
|
|
String orderBy = " ORDER BY p.create_time DESC " +
|
|
|
"LIMIT "+ (page - 1) * size + "," + size;
|
|
@ -428,10 +404,6 @@ public class ServicePackageService extends BaseJpaService<ServicePackageDO, Serv
|
|
|
String id = map.get("id").toString();
|
|
|
List<ServicePackageItemDO> itemDOList = servicePackageItemDao.findByServicePackageId(id);
|
|
|
map.put("detail",itemDOList);
|
|
|
List<Map<String,Object>> doctorList = fingdDoctorByPackageId(id,1);
|
|
|
List<Map<String,Object>> helperList = fingdDoctorByPackageId(id,2);
|
|
|
map.put("doctorList",doctorList);
|
|
|
map.put("helperList",helperList);
|
|
|
}
|
|
|
Long count = jdbcTemplate.queryForObject(countSql+filters,Long.class);
|
|
|
return PageEnvelop.getSuccessListWithPage("success",list,page,size,count);
|
|
@ -501,8 +473,7 @@ public class ServicePackageService extends BaseJpaService<ServicePackageDO, Serv
|
|
|
|
|
|
public List<Map<String, Object>> servicePackageByTopicType(String patient, String topicType)
|
|
|
{
|
|
|
String sql="\n" +
|
|
|
"select DISTINCT item.code serverItem,item.name,pack.introduce,pack.type packageType,pack.`name` packageName \n" +
|
|
|
String sql="select DISTINCT item.code serverItem,item.name,pack.introduce,pack.type packageType,pack.`name` packageName \n" +
|
|
|
"from base_service_package_record re, base_service_package_item item,base_service_package pack \n" +
|
|
|
"where re.service_package_id = item.service_package_id and item.service_package_id = pack.id\n" +
|
|
|
" and pack.del=1 and item.topic_item='"+topicType+"' and re.sign_id in (\n" +
|
|
@ -511,24 +482,11 @@ public class ServicePackageService extends BaseJpaService<ServicePackageDO, Serv
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
public List<Map<String,Object>> getServerDoctorByPackage(String packageId,String serverItem){
|
|
|
String sql="select DISTINCT doc.id doctor,CONCAT(doc.`name`,\n" +
|
|
|
"CASE WHEN doc.doctor_level=1 THEN '(社区医生)' ELSE '(助老员)' END) as name,doc.photo,doc.mobile\n" +
|
|
|
"from base_service_package_item item ,base_service_package pack,base_team_member mem,base_doctor doc\n" +
|
|
|
"where item.`code`='"+serverItem+"' and item.service_package_id='"+packageId+"' and item.service_package_id = pack.id " +
|
|
|
"and item.team_code = mem.team_code and mem.doctor_code = doc.id and mem.del=1 and pack.del=1 ";
|
|
|
List<Map<String,Object>>result = jdbcTemplate.queryForList(sql);
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
public List<Map<String,Object>> getServerDoctorAll(String patient,String onlineFlag){
|
|
|
String sql="select DISTINCT doc.id doctor,CONCAT(doc.`name`,CASE WHEN doc.doctor_level=1 THEN '(社区医生)' ELSE '(助老员)' END) as name,doc.photo,doc.mobile,0 as onLineFlag\n" +
|
|
|
"from base_service_package_item item ,base_service_package pack,base_team_member mem,base_doctor doc\n" +
|
|
|
"where item.service_package_id in (\n" +
|
|
|
"SELECT spc.service_package_id FROM base_service_package_record spc ,base_service_package_sign_record spsr\n" +
|
|
|
"WHERE spc.patient = '"+patient+"' AND spsr.status = 1 AND spsr.patient = spc.patient\n" +
|
|
|
") and item.service_package_id = pack.id\n" +
|
|
|
"and item.team_code = mem.team_code and mem.doctor_code = doc.id and mem.del=1 and pack.del=1 and item.del = 1";
|
|
|
String sql="select DISTINCT doc.id doctor,CONCAT(doc.`name`,CASE WHEN doc.doctor_level=1 THEN '(社区医生)' ELSE '(助老员)' END) as name,doc.photo,doc.mobile,0 as onLineFlag " +
|
|
|
"from base_service_package_sign_record spsr,base_service_package_record r,base_team_member mem,base_doctor doc " +
|
|
|
"WHERE spsr.patient = '"+patient+"' AND spsr.status = 1 " +
|
|
|
"and r.team_code = mem.team_code and spsr.id=r.sign_id and mem.doctor_code = doc.id and mem.del=1 ";
|
|
|
List<Map<String,Object>>result = jdbcTemplate.queryForList(sql);
|
|
|
if ("1".equals(onlineFlag)){//展示是否在线
|
|
|
String listStr = imUtil.getOnlineListByType("helper");
|
|
@ -582,4 +540,72 @@ public class ServicePackageService extends BaseJpaService<ServicePackageDO, Serv
|
|
|
}
|
|
|
return jdbcTemplate.queryForList(sql);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 查找居民签约记录
|
|
|
* @param patient
|
|
|
*/
|
|
|
public List<Map<String,Object>> findPatientSignList(String patient){
|
|
|
String sql = "SELECT r.id,r.team_code teamCode,sr.id signId, DATE_FORMAT(sr.create_time,'%Y-%m-%d %H:%i:%S') createTime, " +
|
|
|
" DATE_FORMAT(sr.start_time,'%Y-%m-%d %H:%i:%S') startTime, " +
|
|
|
" DATE_FORMAT(sr.end_time,'%Y-%m-%d %H:%i:%S') endTime,p.name,sr.`status`,p.org_code orgCode,p.org_name orgName " +
|
|
|
"FROM " +
|
|
|
" base_service_package_sign_record sr, " +
|
|
|
" base_service_package_record r, " +
|
|
|
" base_service_package p " +
|
|
|
"WHERE " +
|
|
|
" sr.id = r.sign_id and r.service_package_id = p.id " +
|
|
|
"AND sr.patient = '"+patient+"' ORDER BY sr.create_time desc";
|
|
|
List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
|
|
|
String doctorSql = "SELECT d.name from base_team_member t,base_doctor d WHERE t.team_code = ? and t.doctor_code = d.id and d.del = 1 and t.del =1";
|
|
|
for(Map<String,Object> map:list){
|
|
|
List<String> doctorList = new ArrayList<>();
|
|
|
if(map.get("teamCode")!=null){
|
|
|
String teamCode = map.get("teamCode")+"";
|
|
|
try {
|
|
|
doctorList = jdbcTemplate.queryForList(doctorSql,String.class, teamCode);
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
|
|
|
}
|
|
|
map.put("doctorList",doctorList);
|
|
|
}
|
|
|
return list;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 签约服务包详情
|
|
|
* @param id
|
|
|
*/
|
|
|
public Map<String,Object> signPackageDetail(String id){
|
|
|
String orgSql = "SELECT o.id,o.code,o.name,o.address,o.photo FROM " +
|
|
|
" base_org o, " +
|
|
|
" base_service_package_record r, " +
|
|
|
" base_service_package p " +
|
|
|
"WHERE " +
|
|
|
" p.org_code = o.code and r.service_package_id = p.id " +
|
|
|
"AND r.id = '"+id+"' ";
|
|
|
|
|
|
String doctorSql = "SELECT d.* from base_team_member t,base_doctor d,base_service_package_record r,base_service_package_sign_record sr" +
|
|
|
" WHERE r.id = '"+id+"' and r.sign_id=sr.id and t.team_code = r.team_code and t.doctor_code = d.id and d.del = 1 and t.del =1";
|
|
|
List<Map<String,Object>> list = jdbcTemplate.queryForList(orgSql);
|
|
|
Map<String,Object> result = list.get(0);
|
|
|
List<BaseDoctorDO> doctorDOList = jdbcTemplate.query(doctorSql, new BeanPropertyRowMapper(BaseDoctorDO.class));
|
|
|
result.put("doctorDOList",doctorDOList);
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 签约服务包医生列表
|
|
|
*/
|
|
|
public List<Map<String,Object>> signPackageDoctorList(String pateint){
|
|
|
String sql = "SELECT d.id,d.name,d.photo,r.id detailId,h.org_code orgCode,h.org_name orgName,d.job_title_code jobTitleCode,d.job_title_name jobTitleName" +
|
|
|
" from base_team_member t,base_doctor d,base_service_package_record r,base_service_package_sign_record sr" +
|
|
|
",base_doctor_hospital h" +
|
|
|
" WHERE sr.patient = '"+pateint+"'and sr.status=1 and r.sign_id=sr.id and t.team_code = r.team_code " +
|
|
|
" and t.doctor_code = d.id and d.del = 1 and t.del =1 and h.doctor_code = d.id and h.del=1";
|
|
|
List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
|
|
|
return list;
|
|
|
}
|
|
|
}
|