|
@ -3,6 +3,7 @@ package com.yihu.wlyy.service.app.prescription;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.yihu.wlyy.entity.dict.SystemDict;
|
|
|
import com.yihu.wlyy.entity.doctor.profile.Doctor;
|
|
|
import com.yihu.wlyy.entity.patient.Patient;
|
|
|
import com.yihu.wlyy.entity.patient.prescription.Prescription;
|
|
|
import com.yihu.wlyy.entity.patient.prescription.PrescriptionInfo;
|
|
@ -167,8 +168,7 @@ public class PrescriptionInfoService extends BaseService {
|
|
|
|
|
|
}
|
|
|
|
|
|
public JSONArray getDoctorPrescription(String doctor,String state,String diseases,String startDate,String endDate ){
|
|
|
|
|
|
public JSONArray getDoctorPrescription(Integer teamCode,String state,String diseases,String startDate,String endDate ){
|
|
|
StringBuffer pre_sql = new StringBuffer("SELECT " +
|
|
|
" p.`name`, " +
|
|
|
" TIMESTAMPDIFF(YEAR,p.birthday,SYSDATE()) age, " +
|
|
@ -186,14 +186,14 @@ public class PrescriptionInfoService extends BaseService {
|
|
|
//疾病类型不为空,关联查询疾病类型表
|
|
|
pre_sql.append(" ,wlyy_prescription_diagnosis s " +
|
|
|
" WHERE s.prescription_code = pr.code " +
|
|
|
" AND pr.doctor =? AND s.code = ?");
|
|
|
params.add(doctor);
|
|
|
" AND pr.admin_team_id =? AND s.code = ?");
|
|
|
params.add(teamCode);
|
|
|
params.add(diseases);
|
|
|
setSQL(pre_sql,params,state,startDate,endDate);
|
|
|
}else{
|
|
|
//查询所有疾病类型表
|
|
|
pre_sql.append(" WHERE pr.doctor =?");
|
|
|
params.add(doctor);
|
|
|
pre_sql.append(" WHERE pr.admin_team_id =?");
|
|
|
params.add(teamCode);
|
|
|
setSQL(pre_sql,params,state,startDate,endDate);
|
|
|
}
|
|
|
List<Map<String,Object>> rs = jdbcTemplate.queryForList(pre_sql.toString(),params.toArray());
|
|
@ -215,4 +215,60 @@ public class PrescriptionInfoService extends BaseService {
|
|
|
}
|
|
|
pre_sql.append(" ORDER BY pr.create_time DESC");
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获取续方信息
|
|
|
* @param code
|
|
|
* @return
|
|
|
*/
|
|
|
public JSONObject getContinuedPrescriptionAsDoctor(String code){
|
|
|
Prescription prescription = prescriptionDao.findByCode(code);
|
|
|
List<PrescriptionInfo> prescriptionInfos = prescriptionInfoDao.findByPrescriptionCode(code);
|
|
|
JSONObject rs = new JSONObject();
|
|
|
rs.put("prescription",prescription);
|
|
|
rs.put("prescriptionInfos",prescriptionInfos);
|
|
|
if(prescription!=null&&StringUtils.isNotBlank(prescription.getDoctor())){
|
|
|
rs.put("doctor",doctorDao.findByCode(prescription.getDoctor()));
|
|
|
}else{
|
|
|
rs.put("doctor","");
|
|
|
}
|
|
|
return rs;
|
|
|
}
|
|
|
|
|
|
public int reviewPrescription(String code ,String reason,String state){
|
|
|
if(StringUtils.isNotBlank(state)){
|
|
|
Prescription p = prescriptionDao.findByCode(code);
|
|
|
if("1".equals(state)){
|
|
|
//审核通过
|
|
|
p.setStatus(10);
|
|
|
}else{
|
|
|
//审核不通过
|
|
|
p.setStatus(-1);
|
|
|
p.setReviewedReason(reason);
|
|
|
}
|
|
|
prescriptionDao.save(p);
|
|
|
|
|
|
//患者操作日志
|
|
|
PrescriptionLog log = new PrescriptionLog();
|
|
|
log.setCode(getCode());
|
|
|
log.setStatus(p.getStatus());
|
|
|
log.setType(4);
|
|
|
log.setCreateTime(new Date());
|
|
|
log.setPrescriptionCode(p.getCode());
|
|
|
log.setUserCode(p.getDoctor());
|
|
|
log.setUserName(p.getDoctorName());
|
|
|
log.setHospitalName(p.getHospitalName());
|
|
|
log.setHospital(p.getHospital());
|
|
|
log.setUserType(2);
|
|
|
log.setFlag(1);
|
|
|
log.setRemark("医生审核");
|
|
|
prescriptionLogDao.save(log);
|
|
|
|
|
|
//同步智业接口
|
|
|
upLoadPrescriotionState();
|
|
|
return 1;
|
|
|
}
|
|
|
|
|
|
return 0;
|
|
|
}
|
|
|
}
|