|
@ -4,12 +4,14 @@ import com.yihu.wlyy.entity.dict.SystemDict;
|
|
|
import com.yihu.wlyy.entity.doctor.profile.Doctor;
|
|
|
import com.yihu.wlyy.entity.doctor.team.admin.AdminTeam;
|
|
|
import com.yihu.wlyy.entity.patient.Patient;
|
|
|
import com.yihu.wlyy.entity.patient.SignFamily;
|
|
|
import com.yihu.wlyy.entity.patient.prescription.*;
|
|
|
import com.yihu.wlyy.repository.dict.SystemDictDao;
|
|
|
import com.yihu.wlyy.repository.doctor.DoctorAdminTeamDao;
|
|
|
import com.yihu.wlyy.repository.doctor.DoctorDao;
|
|
|
import com.yihu.wlyy.repository.message.MessageDao;
|
|
|
import com.yihu.wlyy.repository.patient.PatientDao;
|
|
|
import com.yihu.wlyy.repository.patient.SignFamilyDao;
|
|
|
import com.yihu.wlyy.repository.prescription.*;
|
|
|
import com.yihu.wlyy.service.BaseService;
|
|
|
import com.yihu.wlyy.util.DateUtil;
|
|
@ -66,6 +68,8 @@ public class PrescriptionInfoService extends BaseService {
|
|
|
private MessageDao messageDao;
|
|
|
@Autowired
|
|
|
private PrescriptionExpressageDao prescriptionExpressageDao;
|
|
|
@Autowired
|
|
|
private SignFamilyDao signFamilyDao;
|
|
|
|
|
|
private static final Logger logger = LoggerFactory.getLogger(HttpUtil.class);
|
|
|
|
|
@ -224,20 +228,40 @@ public class PrescriptionInfoService extends BaseService {
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
public JSONObject getPrescriptionProcess(String code){
|
|
|
public com.alibaba.fastjson.JSONObject getPrescriptionProcess(String code){
|
|
|
Prescription prescription = prescriptionDao.findByCode(code);
|
|
|
List<PrescriptionInfo> prescriptionInfos = prescriptionInfoDao.findByPrescriptionCode(code);
|
|
|
PrescriptionReviewed reviewed = prescriptionReviewedDao.findByPrescriptionCode(code);
|
|
|
List<PrescriptionAdjust> prescriptionAdjusts = prescriptionAdjustDao.findByPrescriptionCode(code);
|
|
|
JSONObject rs = new JSONObject();
|
|
|
com.alibaba.fastjson.JSONObject rs = new com.alibaba.fastjson.JSONObject();
|
|
|
if(prescription!=null&&StringUtils.isNotBlank(prescription.getPatient())){
|
|
|
Patient p = patientDao.findByCode(prescription.getPatient());
|
|
|
rs.put("patient",p);
|
|
|
Map<String,Object> pp =new HashedMap();
|
|
|
|
|
|
pp.put("code",p.getCode());
|
|
|
pp.put("name",p.getName());
|
|
|
pp.put("idcard",p.getIdcard());
|
|
|
pp.put("ssc",p.getSsc());
|
|
|
pp.put("mobile",p.getMobile());
|
|
|
|
|
|
rs.put("patient",pp);
|
|
|
|
|
|
SignFamily signFamily = signFamilyDao.findByIdcard(p.getIdcard());
|
|
|
Map<String,Object> sf =new HashedMap();
|
|
|
sf.put("doctor",signFamily.getDoctor());
|
|
|
sf.put("hospital",signFamily.getHospital());
|
|
|
sf.put("doctorName",signFamily.getDoctorName());
|
|
|
sf.put("hospitalName",signFamily.getHospitalName());
|
|
|
|
|
|
rs.put("signFamily",sf);
|
|
|
}else{
|
|
|
rs.put("patient","");
|
|
|
rs.put("signFamily","");
|
|
|
}
|
|
|
|
|
|
if(prescription.getStatus()==10){
|
|
|
|
|
|
|
|
|
if(prescription!=null&&prescription.getStatus()==10){
|
|
|
Long s = (prescription.getCreateTime().getTime()-new Date().getTime())/1000;
|
|
|
//rs.put("time",s);
|
|
|
if(s>172800){
|
|
@ -313,15 +337,13 @@ public class PrescriptionInfoService extends BaseService {
|
|
|
//疾病类型不为空,关联查询疾病类型表
|
|
|
pre_sql.append(" ,wlyy_prescription_diagnosis s " +
|
|
|
" WHERE s.prescription_code = pr.code " +
|
|
|
" AND pr.admin_team_id =? AND s.code = ?");
|
|
|
params.add(teamCode);
|
|
|
" AND s.code = ?");
|
|
|
params.add(diseases);
|
|
|
setSQL(pre_sql,params,state,startDate,endDate,nameKeyword,patient,page,size);
|
|
|
setSQL(pre_sql,params,teamCode,state,startDate,endDate,nameKeyword,patient,page,size);
|
|
|
}else{
|
|
|
//查询所有疾病类型表
|
|
|
pre_sql.append(" WHERE pr.admin_team_id =?");
|
|
|
params.add(teamCode);
|
|
|
setSQL(pre_sql,params,state,startDate,endDate,nameKeyword,patient,page,size);
|
|
|
pre_sql.append(" WHERE 1=1 ");
|
|
|
setSQL(pre_sql,params,teamCode,state,startDate,endDate,nameKeyword,patient,page,size);
|
|
|
}
|
|
|
List<Map<String,Object>> rs = jdbcTemplate.queryForList(pre_sql.toString(),params.toArray());
|
|
|
|
|
@ -334,7 +356,11 @@ public class PrescriptionInfoService extends BaseService {
|
|
|
return new JSONArray(rs);
|
|
|
}
|
|
|
|
|
|
public void setSQL(StringBuffer pre_sql,List<Object> params,String state,String startDate,String endDate,String nameKeyword,String patient,Integer page,Integer size){
|
|
|
public void setSQL(StringBuffer pre_sql,List<Object> params,Integer teamCode,String state,String startDate,String endDate,String nameKeyword,String patient,Integer page,Integer size){
|
|
|
if(teamCode!=null&&teamCode>0){
|
|
|
pre_sql.append(" AND pr.admin_team_id =?");
|
|
|
} params.add(teamCode);
|
|
|
|
|
|
if(StringUtils.isNotBlank(state)){
|
|
|
pre_sql.append(" AND pr.status IN ("+state+") ");
|
|
|
}
|
|
@ -605,7 +631,7 @@ public class PrescriptionInfoService extends BaseService {
|
|
|
}
|
|
|
if(StringUtils.isNotBlank(endDate)){
|
|
|
pre_sql.append(" AND pr.create_time <= ? ");
|
|
|
param.add(startDate+" 23:59:59");
|
|
|
param.add(endDate+" 23:59:59");
|
|
|
}
|
|
|
if(StringUtils.isNotBlank(hospital)){
|
|
|
pre_sql.append(" AND e.hospital_code = ? ");
|
|
@ -764,7 +790,7 @@ public class PrescriptionInfoService extends BaseService {
|
|
|
" LEFT JOIN wlyy_patient p ON pr.patient = p.`code` " +
|
|
|
" JOIN wlyy_prescription_expressage e ON pr.code = e.prescription_code " +
|
|
|
" JOIN wlyy_prescription_reviewed r ON pr.code = r.prescription_code " +
|
|
|
" WHERE 1=1 " );
|
|
|
" WHERE r.status=1 " );
|
|
|
List<Object> params = new ArrayList<>();
|
|
|
setDoctorExpressageSql(pre_sql,params, teamCode, nameKey, startDate, endDate, hospital, state,dispensaryType,AllocationType, page, size);
|
|
|
List<Map<String,Object>> rs = jdbcTemplate.queryForList(pre_sql.toString(),params.toArray());
|
|
@ -792,7 +818,7 @@ public class PrescriptionInfoService extends BaseService {
|
|
|
}
|
|
|
if(StringUtils.isNotBlank(endDate)){
|
|
|
pre_sql.append(" AND pr.create_time <= ? ");
|
|
|
param.add(startDate+" 23:59:59");
|
|
|
param.add(endDate+" 23:59:59");
|
|
|
}
|
|
|
if(StringUtils.isNotBlank(hospital)){
|
|
|
pre_sql.append(" AND e.hospital_code = ? ");
|
|
@ -900,4 +926,10 @@ public class PrescriptionInfoService extends BaseService {
|
|
|
}
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
public JSONArray getIcd10Info(String nameKey){
|
|
|
StringBuffer stringBuffer = new StringBuffer(" SELECT t.code,t.name FROM icd10_dict t WHERE t.name LIKE ?");
|
|
|
List<Map<String,Object>> rs = jdbcTemplate.queryForList(stringBuffer.toString(),new Object[]{"%"+nameKey+"%"});
|
|
|
return new JSONArray(rs);
|
|
|
}
|
|
|
}
|