|
@ -2,11 +2,13 @@ package com.yihu.jw.hospital.prescription.service;
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
import com.yihu.jw.dict.dao.DictDeptDescDao;
|
|
|
import com.yihu.jw.dict.dao.DictHospitalDeptDao;
|
|
|
import com.yihu.jw.doctor.dao.BaseDoctorDao;
|
|
|
import com.yihu.jw.doctor.dao.BaseDoctorHospitalDao;
|
|
|
import com.yihu.jw.doctor.dao.BaseDoctorPatientDao;
|
|
|
import com.yihu.jw.doctor.service.BaseDoctorInfoService;
|
|
|
import com.yihu.jw.entity.base.dict.DictDeptDescDO;
|
|
|
import com.yihu.jw.entity.base.dict.DictHospitalDeptDO;
|
|
|
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
|
|
|
import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
|
|
@ -58,6 +60,8 @@ import com.yihu.jw.patient.dao.BasePatientDao;
|
|
|
import com.yihu.jw.patient.dao.BasePatientMedicareCardDao;
|
|
|
import com.yihu.jw.restmodel.base.dict.DictHospitalDeptVO;
|
|
|
import com.yihu.jw.restmodel.base.org.BaseOrgVO;
|
|
|
import com.yihu.jw.restmodel.base.wx.WxGraphicMessageVO;
|
|
|
import com.yihu.jw.restmodel.base.wx.WxReplySceneVO;
|
|
|
import com.yihu.jw.restmodel.hospital.archive.ArchiveVO;
|
|
|
import com.yihu.jw.restmodel.hospital.consult.WlyyHospitalSysDictVO;
|
|
|
import com.yihu.jw.restmodel.hospital.doctor.WlyyDoctorWorkTimeVO;
|
|
@ -236,6 +240,9 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
@Autowired
|
|
|
private XzzxEntranceService xzzxEntranceService;
|
|
|
|
|
|
@Autowired
|
|
|
private DictDeptDescDao dictDeptDescDao;
|
|
|
|
|
|
|
|
|
@Value("${demo.flag}")
|
|
|
private boolean demoFlag;
|
|
@ -682,7 +689,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
public WlyyPrescriptionDO findPrescriptionDo(String prescriptionId){
|
|
|
return prescriptionDao.findOne(prescriptionId);
|
|
|
}
|
|
|
|
|
|
|
|
|
public Map<String,Object> findPrescriptionInfo(String prescriptionId){
|
|
|
//续方信息
|
|
|
Map<String,Object> rs = new HashedMap();
|
|
@ -746,7 +753,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
WlyyOutpatientDO outpatient = outpatientDao.save(outpatientDO);
|
|
|
Double price = 0.0;
|
|
|
if(doctorDO!=null&&StringUtils.isNoneBlank(doctorDO.getFee())){
|
|
|
price = Double.parseDouble(doctorDO.getFee());
|
|
|
price = Double.parseDouble(doctorDO.getFee());
|
|
|
}
|
|
|
if(price==0.0){
|
|
|
outpatientDO.setPayStatus(1);
|
|
@ -1036,6 +1043,10 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
return rs;
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 获取医生列表.
|
|
|
*
|
|
@ -2264,7 +2275,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
if ("0".equals(rs)) {
|
|
|
String admNo = jsonObject.getString("@ADM_NO");
|
|
|
String realOrder = jsonObject.getString("@real_order");
|
|
|
|
|
|
String voucherNo = jsonObject.getString("@xtgzh0");
|
|
|
prescription.setAdmNo(admNo);
|
|
|
prescription.setRealOrder(realOrder);
|
|
|
prescriptionDao.save(prescription);
|
|
@ -2272,6 +2283,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
outpatientDao.save(outpatientDO);
|
|
|
|
|
|
result.put("code", 1);
|
|
|
result.put("voucherNo",voucherNo);
|
|
|
result.put("mes", "开方提交成功");
|
|
|
|
|
|
return result;
|
|
@ -2475,7 +2487,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
}else{
|
|
|
sql =sql+ "date_format(e.create_time,'%Y-%m-%d %H:%i:%S' ) AS \"createTime\",";
|
|
|
}
|
|
|
sql=sql+" e.name as \"name\", " +
|
|
|
sql=sql+" e.name as \"name\", " +
|
|
|
" e.oneself_pickup_flg AS \"oneselfPickupFlg\", " +
|
|
|
" o.id AS \"outpatientId\", " +
|
|
|
" o.icd10_name AS \"icd10Name\", " +
|
|
@ -3002,21 +3014,21 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
//机构科室信息
|
|
|
List<BaseDoctorHospitalDO> hospitalDOs = baseDoctorHospitalDao.findByDoctorCode(doctorDO.getId());
|
|
|
if(hospitalDOs!=null&&hospitalDOs.size()>0){
|
|
|
rs.put("hospital",hospitalDOs.get(0));
|
|
|
BaseOrgDO org = baseOrgDao.findByCode(hospitalDOs.get(0).getOrgCode());
|
|
|
rs.put("winNo",org.getWinNo());
|
|
|
rs.put("deptName",hospitalDOs.get(0).getDeptName());
|
|
|
rs.put("dept",hospitalDOs.get(0).getDeptCode());
|
|
|
|
|
|
if(StringUtils.isNotBlank(withWork)&&"1".equals(withWork)){
|
|
|
List<WlyyDoctorWorkTimeVO> times = findDoctorWorkTime(doctor,hospitalDOs.get(0).getOrgCode());
|
|
|
rs.put("workTime",times);
|
|
|
}
|
|
|
rs.put("hospital",hospitalDOs.get(0));
|
|
|
BaseOrgDO org = baseOrgDao.findByCode(hospitalDOs.get(0).getOrgCode());
|
|
|
rs.put("winNo",org.getWinNo());
|
|
|
rs.put("deptName",hospitalDOs.get(0).getDeptName());
|
|
|
rs.put("dept",hospitalDOs.get(0).getDeptCode());
|
|
|
|
|
|
if(StringUtils.isNotBlank(withWork)&&"1".equals(withWork)){
|
|
|
List<WlyyDoctorWorkTimeVO> times = findDoctorWorkTime(doctor,hospitalDOs.get(0).getOrgCode());
|
|
|
rs.put("workTime",times);
|
|
|
}
|
|
|
}else{
|
|
|
rs.put("hospital",null);
|
|
|
rs.put("winNo",null);
|
|
|
rs.put("deptName",null);
|
|
|
rs.put("dept",null);
|
|
|
rs.put("hospital",null);
|
|
|
rs.put("winNo",null);
|
|
|
rs.put("deptName",null);
|
|
|
rs.put("dept",null);
|
|
|
rs.put("workTime",null);
|
|
|
}
|
|
|
|
|
@ -3067,13 +3079,13 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
//专家咨询
|
|
|
String zjCountsql = "SELECT id AS \"id\" FROM wlyy_consult_team WHERE doctor='"+doctor+"' AND (type=1 OR type=15)";
|
|
|
List<Map<String,Object>> zjList = jdbcTemplate.queryForList(zjCountsql);
|
|
|
|
|
|
|
|
|
if(zjList!=null&&zjList.size()>0){
|
|
|
rs.put("zjCount",zjList.size());
|
|
|
}else{
|
|
|
rs.put("zjCount",0);
|
|
|
}
|
|
|
|
|
|
|
|
|
//查询医生各项评价平均分
|
|
|
String sqlscore = "SELECT " +
|
|
|
"AVG(a.score) AS \"score\"," +
|
|
@ -3084,9 +3096,9 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
"AND b.doctor='"+doctor+"' " +
|
|
|
"GROUP BY a.score_type ORDER BY a.score_type ASC ";
|
|
|
List<Map<String,Object>> listscore = jdbcTemplate.queryForList(sqlscore);
|
|
|
|
|
|
|
|
|
Double doctorScore = new Double("0");
|
|
|
|
|
|
|
|
|
if(listscore!=null&&listscore.size()>0){
|
|
|
for(Map<String,Object> _listscore :listscore){
|
|
|
doctorScore += Double.parseDouble(_listscore.get("score").toString());
|
|
@ -3094,13 +3106,13 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
}
|
|
|
doctorScore = doctorScore/3;
|
|
|
rs.put("doctorScore",doctorScore);
|
|
|
|
|
|
|
|
|
if(listscore!=null&&listscore.size()>0){
|
|
|
rs.put("scoreDoctor",listscore);
|
|
|
}else{
|
|
|
rs.put("scoreDoctor",null);
|
|
|
}
|
|
|
|
|
|
|
|
|
//查询评价明细
|
|
|
String sqlScoreList = "SELECT " +
|
|
|
"a.score as \"score\"," +
|
|
@ -3119,21 +3131,21 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
"LEFT JOIN wlyy_consult_team c ON c.consult=b.relation_code AND c.doctor='"+doctor+"' " +
|
|
|
"WHERE a.relation_code=b.id AND b.doctor='"+doctor+"' ";
|
|
|
List<Map<String,Object>> scoreList = jdbcTemplate.queryForList(sqlScoreList);
|
|
|
|
|
|
|
|
|
if(scoreList!=null&&scoreList.size()>0){
|
|
|
|
|
|
|
|
|
// Set<String> datelist = new HashSet<>();
|
|
|
|
|
|
|
|
|
HashMap<String,List<Map<String,Object>>> waitinglist = new HashMap<>();
|
|
|
|
|
|
|
|
|
if(scoreList!=null&&scoreList.size()>0){
|
|
|
for(Map<String,Object> scorepatient :scoreList){
|
|
|
String id = (String)scorepatient.get("id");
|
|
|
|
|
|
|
|
|
if(id == null){
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
|
|
|
if(waitinglist.keySet().contains(id)){
|
|
|
waitinglist.get(id).add(scorepatient);
|
|
|
}else{
|
|
@ -3179,6 +3191,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
BaseOrgDO org = baseOrgDao.findByCode(orgCode);
|
|
|
if (org!=null){
|
|
|
doctorHospitalDO.setWinNo(org.getWinNo());
|
|
|
doctorHospitalDO.setHisId(org.getHisId());
|
|
|
hospitalDOList.add(doctorHospitalDO);
|
|
|
}
|
|
|
}
|
|
@ -3230,7 +3243,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
|
|
|
return rs;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 居民取消复诊或者医生拒绝接诊
|
|
|
* @param outPatientId
|
|
@ -3295,8 +3308,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
String msg="";
|
|
|
if ("1".equalsIgnoreCase(wlyyOutpatientDO.getType())){
|
|
|
data.put("type","9");
|
|
|
msg+=wlyyOutpatientDO.getPatientName()+",您好! 您有一个图文复诊已被医生取消,取消原因:"+cancelValue+"。取消说明:"+cancelRemark+"。";
|
|
|
sendWxTemplateMsg(wechatId,wlyyOutpatientDO,"9");
|
|
|
msg+=wlyyOutpatientDO.getPatientName()+",您好! 您有一个图文复诊已被医生取消,取消原因:"+cancelValue+"。取消说明:"+cancelRemark+"。";
|
|
|
sendWxTemplateMsg(wechatId,wlyyOutpatientDO,"9");
|
|
|
}
|
|
|
if ("2".equalsIgnoreCase(wlyyOutpatientDO.getType())){
|
|
|
data.put("type","16");
|
|
@ -3488,7 +3501,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
}
|
|
|
return times;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 医生可接单列表(图文复诊、视频复诊、协同门诊)
|
|
|
* @param doctor
|
|
@ -3498,7 +3511,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
* @return
|
|
|
*/
|
|
|
public List<Map<String,Object>> findWaitingRoomOutpatientByDoctor(String doctor, Integer type,Integer query_status,String dept) {
|
|
|
|
|
|
|
|
|
String sql ="SELECT " +
|
|
|
"room.outpatient_id AS \"id\"," +
|
|
|
"room.patient_id AS \"patient_id\"," +
|
|
@ -3538,9 +3551,9 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
//图文复诊医生抢单列表
|
|
|
sql += "AND room.doctor IS NULL ";
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
//协同门诊
|
|
|
if(3 == type){
|
|
|
sql += " AND room.reservation_type=2 ";
|
|
@ -3548,13 +3561,13 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
//在线复诊
|
|
|
sql += " AND room.reservation_type=1 AND room.consult_type="+type ;
|
|
|
}
|
|
|
|
|
|
|
|
|
if(StringUtils.isNoneBlank(dept)){
|
|
|
sql += " AND outpatient.dept='"+dept+"' ";
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
|
|
|
if(list!=null&&list.size()>0){
|
|
|
//根据身份证计算年龄
|
|
@ -3563,12 +3576,12 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
outpatient.put("age",DateUtil.getAgeForIdcard(idcard));
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
return list;
|
|
|
}
|
|
|
|
|
|
|
|
|
public List<Map<String,Object>> findWaitingRoomPatient(String dept, Integer type) {
|
|
|
|
|
|
|
|
|
String sql ="SELECT " +
|
|
|
"patient.id AS \"id\"," +
|
|
|
"patient.name AS \"name\"," +
|
|
@ -3582,7 +3595,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
"wlyy_hospital_waiting_room waitingroom," +
|
|
|
"base_patient patient " +
|
|
|
"WHERE waitingroom.consult_type=2 AND doctor IS NOT NULL ";
|
|
|
|
|
|
|
|
|
List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
|
|
|
if(list!=null&&list.size()>0){
|
|
|
//根据身份证计算年龄
|
|
@ -3591,12 +3604,12 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
roompatient.put("age",DateUtil.getAgeForIdcard(idcard));
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
return list;
|
|
|
}
|
|
|
|
|
|
|
|
|
public JSONObject findWaitingRoomStatusCount(String dept,String wxId) {
|
|
|
|
|
|
|
|
|
String totalSql = "SELECT count(id) AS \"total\" FROM wlyy_hospital_waiting_room WHERE visit_status=1 ";
|
|
|
if("xm_ykyy_wx".equals(wxId)){
|
|
|
totalSql +=" and reservation_time >= to_date('"+DateUtil.dateToStrShort(new Date())+" 00:00:00','YYYY-MM-DD HH24:MI:SS')";
|
|
@ -3610,38 +3623,38 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
if (rstotal != null && rstotal.size() > 0) {
|
|
|
count = (Long) rstotal.get(0).get("total");
|
|
|
}
|
|
|
|
|
|
|
|
|
JSONObject result = new JSONObject();
|
|
|
result.put("waiting_count",count);
|
|
|
result.put("outpatient_count",count);
|
|
|
result.put("waiting_count_difference",count);
|
|
|
result.put("outpatient_count_difference",count);
|
|
|
result.put("yesterday_waiting_count",count);
|
|
|
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
|
|
|
public List<JSONObject> findClinicRoomList(String dept,String date,String consult_status,String wxId) {
|
|
|
if(StringUtils.isBlank(date)){
|
|
|
date = DateUtil.getStringDateShort();
|
|
|
}
|
|
|
|
|
|
|
|
|
//获取今天的排班列表
|
|
|
String doctorsql ="SELECT doctor AS \"doctor\",doctor_name as \"doctor_name\",dept as \"dept\",dept_name as \"dept_name\" FROM wlyy_doctor_work_time WHERE work_date='"+date+"'";
|
|
|
|
|
|
|
|
|
if(StringUtils.isNoneBlank(dept)){
|
|
|
doctorsql = doctorsql + " and dept = '"+dept+"' ";
|
|
|
}
|
|
|
doctorsql = doctorsql+ " GROUP BY doctor,doctor_name,dept,dept_name";
|
|
|
|
|
|
|
|
|
List<Map<String,Object>> doctorlist = jdbcTemplate.queryForList(doctorsql);
|
|
|
|
|
|
|
|
|
HashMap<String ,JSONObject> result = new HashMap<>();
|
|
|
|
|
|
|
|
|
for (int i = 0; i < doctorlist.size(); i++) {
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
jsonObject.put("id",(String)doctorlist.get(0).get("doctor"));
|
|
|
|
|
|
|
|
|
if(StringUtils.isNoneBlank((String)doctorlist.get(0).get("doctor_name"))){
|
|
|
jsonObject.put("doctor_name",(String)doctorlist.get(0).get("doctor_name"));
|
|
|
jsonObject.put("dept_name",(String)doctorlist.get(0).get("dept_name"));
|
|
@ -3655,10 +3668,10 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
jsonObject.put("waiting_count",0);
|
|
|
jsonObject.put("patient_name","");
|
|
|
jsonObject.put("time_cost",0);
|
|
|
|
|
|
|
|
|
result.put((String)doctorlist.get(0).get("doctor"),jsonObject);
|
|
|
}
|
|
|
|
|
|
|
|
|
//获取预约了今天的候诊居民
|
|
|
String waitingSql ="SELECT count(op.id) AS \"waitCount\"," +
|
|
|
"room.doctor AS \"doctor\", " +
|
|
@ -3703,7 +3716,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
//获取进行中的居民
|
|
|
String onlineSql ="SELECT " +
|
|
|
"room.outpatient_id AS \"id\"," +
|
|
@ -3719,7 +3732,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
}else{
|
|
|
onlineSql = onlineSql + "date_format(room.reservation_time,'%Y-%m-%d %H:%i:%S' ) AS \"time\",TIMESTAMPDIFF(MINUTE, room.reservation_time,NOW()) AS \"time_cost\",";
|
|
|
}
|
|
|
onlineSql=onlineSql+"room.doctor AS \"doctor\", " +
|
|
|
onlineSql=onlineSql+"room.doctor AS \"doctor\", " +
|
|
|
"room.doctor_name AS \"doctorName\" " +
|
|
|
"FROM " +
|
|
|
"wlyy_hospital_waiting_room room," +
|
|
@ -3772,7 +3785,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
}else{
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
jsonObject.put("id",doctor);
|
|
|
|
|
|
|
|
|
if(StringUtils.isNoneBlank((String) onlineObj.get("doctorName"))){
|
|
|
jsonObject.put("doctor_name",(String) onlineObj.get("doctorName"));
|
|
|
}else{
|
|
@ -3787,15 +3800,15 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
List<JSONObject> finalresult = new ArrayList<>();
|
|
|
|
|
|
|
|
|
for (JSONObject jsonObject : result.values()) {
|
|
|
|
|
|
//离线:在线状态=离线
|
|
|
//空闲:在线状态=在线 and 接诊状态=空闲
|
|
|
//接诊中:在线状态=在线 and 接诊状态=接诊中
|
|
|
|
|
|
|
|
|
//过滤空闲或者接诊中的居民
|
|
|
if(StringUtils.isBlank(consult_status)){
|
|
|
finalresult.add(jsonObject);
|
|
@ -3822,10 +3835,10 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
jsonObject.put("room_name",roomname);
|
|
|
room_no ++;
|
|
|
}
|
|
|
|
|
|
|
|
|
return finalresult;
|
|
|
}
|
|
|
|
|
|
|
|
|
public WlyyDoctorClinicRoomDO findClinicRoomStatus(String id) {
|
|
|
return wlyyDoctorClinicRoomDao.findOne(id);
|
|
|
}
|
|
@ -3859,7 +3872,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
}
|
|
|
return times;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 根据疾病名称,热门部门查询医生
|
|
|
* @param orgCode 机构码
|
|
@ -3884,7 +3897,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
if (pagesize <= 0) {
|
|
|
pagesize = 10;
|
|
|
}*/
|
|
|
|
|
|
|
|
|
String sql ="SELECT " +
|
|
|
" d.id AS \"id\", " +
|
|
|
" d.photo AS \"photo\", " +
|
|
@ -3966,28 +3979,28 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
sql+=" AND sp.disease_name like :diseaseKey";
|
|
|
params.put("diseaseKey","%"+diseaseKey+"%");
|
|
|
}
|
|
|
|
|
|
|
|
|
if(StringUtils.isNotBlank(doctorNameKey)){
|
|
|
sql+=" AND d.name like :doctorNameKey";
|
|
|
params.put("doctorNameKey","%"+doctorNameKey+"%");
|
|
|
}
|
|
|
|
|
|
|
|
|
if(StringUtils.isNotBlank(dept)){
|
|
|
sql+=" AND h.dept_code = :dept ";
|
|
|
params.put("dept",dept);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
if(StringUtils.isNotBlank(jobTitleNameKey)){
|
|
|
sql+=" AND d.job_title_name = :jobTitleNameKey ";
|
|
|
params.put("jobTitleNameKey",jobTitleNameKey);
|
|
|
}
|
|
|
|
|
|
|
|
|
if(StringUtils.isNotBlank(outpatientType)){
|
|
|
if(outpatientType.contains("or")){
|
|
|
String[] outpatientTypeArray = outpatientType.split("or");
|
|
|
sql+= " AND ( ";
|
|
|
|
|
|
|
|
|
for (int i = 0; i < outpatientTypeArray.length; i++) {
|
|
|
sql +=" d.outpatient_type like'%"+outpatientTypeArray[i]+"%'";
|
|
|
if(i != outpatientTypeArray.length -1){
|
|
@ -4001,23 +4014,23 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
}else{
|
|
|
sql+=" AND d.outpatient_type is not null ";
|
|
|
}
|
|
|
|
|
|
|
|
|
if(StringUtils.isNotBlank(keyName)){
|
|
|
sql+=" AND (h.dept_name like '%"+keyName+"%' or d.name like '%"+keyName+"%' or d.expertise like '%"+keyName+"%' )";
|
|
|
}
|
|
|
|
|
|
|
|
|
if(StringUtils.isNotBlank(workingTime)){
|
|
|
sql+=" AND wk.work_date = :workingTime ";
|
|
|
params.put("workingTime",workingTime);
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(StringUtils.isNotBlank(consultStatus)){
|
|
|
sql+=" AND d.consult_status = :consultStatus ";
|
|
|
params.put("consultStatus",consultStatus);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
sql += " and d.del='1' order by a.total "+ consutlSort;
|
|
|
|
|
|
List<Map<String,Object>> list = hibenateUtils.createSQLQuery(sql,params,page,pagesize);
|
|
@ -4098,7 +4111,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
List<Map<String,Object>> doctors = jdbcTemplate.queryForList(sql);
|
|
|
List<WlyyDoctorWorkTimeDO> workTimeDOs =makeDoctorWorkTimeDOList(doctors,wlyyDoctorWorkTimeDOs);
|
|
|
saveDoctorWorkTime(workTimeDOs,date,doctors);
|
|
|
//科室
|
|
|
//科室
|
|
|
}else if("2".equals(type)){
|
|
|
|
|
|
String sql ="SELECT " +
|
|
@ -4514,7 +4527,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 获取正在进行中的视频复诊/协同门诊
|
|
|
* @param doctor
|
|
@ -4561,8 +4574,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
sql = sql +"AND room.general_doctor='"+general_doctor+"' " +
|
|
|
"AND room.consult_type= 2";
|
|
|
}else{}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
|
|
|
if(list!=null&&list.size()>0){
|
|
|
//根据身份证计算年龄
|
|
@ -4570,19 +4583,19 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
String idcard = (String)outpatient.get("idcard");
|
|
|
String patient_id = (String)outpatient.get("patient_id");
|
|
|
outpatient.put("age",DateUtil.getAgeForIdcard(idcard));
|
|
|
|
|
|
|
|
|
String outpatient_id = (String)outpatient.get("id");
|
|
|
|
|
|
String isAlert = redisTemplate.opsForValue().get("patient_alert_"+patient_id);
|
|
|
if(StringUtils.isBlank(isAlert)){
|
|
|
outpatient.put("alert_tag",0);//已提醒
|
|
|
}else{
|
|
|
outpatient.put("alert_tag",1);//未提醒
|
|
|
}
|
|
|
|
|
|
String isAlert = redisTemplate.opsForValue().get("patient_alert_"+patient_id);
|
|
|
if(StringUtils.isBlank(isAlert)){
|
|
|
outpatient.put("alert_tag",0);//已提醒
|
|
|
}else{
|
|
|
outpatient.put("alert_tag",1);//未提醒
|
|
|
}
|
|
|
outpatient.put("online_tag",1);//未提醒
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
return list;
|
|
|
}
|
|
|
|
|
@ -4643,7 +4656,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
}
|
|
|
return waitCount.toString();
|
|
|
}
|
|
|
|
|
|
|
|
|
public com.alibaba.fastjson.JSONArray getWaitingForVisitVideoPrescriptionByDoctor(String doctor,String wxId) {
|
|
|
String condition = "";
|
|
|
if("xm_ykyy_wx".equals(wxId)){
|
|
@ -4691,20 +4704,20 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
}
|
|
|
sql+=" order by room.reservation_time ASC ";
|
|
|
List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
|
|
|
|
|
|
|
|
|
Set<String> datelist = new HashSet<>();
|
|
|
|
|
|
|
|
|
HashMap<String,List<Map<String,Object>>> waitinglist = new HashMap<>();
|
|
|
|
|
|
|
|
|
if(list!=null&&list.size()>0){
|
|
|
//根据身份证计算年龄
|
|
|
for(Map<String,Object> outpatient :list){
|
|
|
String idcard = (String)outpatient.get("idcard");
|
|
|
String patient_id = (String)outpatient.get("patient_id");
|
|
|
outpatient.put("age",DateUtil.getAgeForIdcard(idcard));
|
|
|
|
|
|
|
|
|
String group_date = (String)outpatient.get("group_date");
|
|
|
|
|
|
|
|
|
if(waitinglist.keySet().contains(group_date)){
|
|
|
waitinglist.get(group_date).add(outpatient);
|
|
|
}else{
|
|
@ -4712,7 +4725,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
_cu.add(outpatient);
|
|
|
waitinglist.put(group_date,_cu);
|
|
|
}
|
|
|
|
|
|
|
|
|
//全科医生来源
|
|
|
outpatient.put("general_doctor_info","");//全科医生名字
|
|
|
outpatient.put("general_doctor_hospital","");//全科医生社区
|
|
@ -4722,24 +4735,24 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
}else{
|
|
|
outpatient.put("alert_tag",1);//未提醒
|
|
|
}
|
|
|
|
|
|
|
|
|
outpatient.put("online_tag",1);//在线状态
|
|
|
|
|
|
|
|
|
String outpatient_mobile = (String)outpatient.get("outpatient_mobile");
|
|
|
if(StringUtils.isNoneBlank(outpatient_mobile)){
|
|
|
outpatient.put("mobile",outpatient_mobile);//复诊有手机号,传递复诊手机号
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
Collection<String> keyset= waitinglist.keySet();
|
|
|
List<String> _list = new ArrayList<String>(keyset);
|
|
|
|
|
|
|
|
|
//对key键值按字典升序排序
|
|
|
Collections.sort(_list);
|
|
|
com.alibaba.fastjson.JSONArray result = new com.alibaba.fastjson.JSONArray();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < _list.size(); i++) {
|
|
|
com.alibaba.fastjson.JSONObject object = new com.alibaba.fastjson.JSONObject();
|
|
|
if(_list.get(i).equals(DateUtil.getStringDateShort())){
|
|
@ -4752,7 +4765,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 医生抢单(视频)
|
|
|
* @param outpatientCode
|
|
@ -4763,9 +4776,9 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
List<WlyyHospitalWaitingRoomDO> roomDOs =hospitalWaitingRoomDao.findByOutpatientId(outpatientCode);
|
|
|
if(roomDOs!=null&&roomDOs.size()>0){
|
|
|
for(WlyyHospitalWaitingRoomDO roomDO:roomDOs){
|
|
|
roomDO.setDoctor(doctor);
|
|
|
roomDO.setDoctorName(baseDoctorDO.getName());
|
|
|
hospitalWaitingRoomDao.save(roomDO);
|
|
|
roomDO.setDoctor(doctor);
|
|
|
roomDO.setDoctorName(baseDoctorDO.getName());
|
|
|
hospitalWaitingRoomDao.save(roomDO);
|
|
|
}
|
|
|
}
|
|
|
WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findOne(outpatientCode);
|
|
@ -4774,7 +4787,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
outpatientDao.save(wlyyOutpatientDO);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 复诊视频咨询人数, 协同门诊人数
|
|
|
* @param doctor
|
|
@ -4782,8 +4795,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
* @return
|
|
|
*/
|
|
|
public Long doctorIndexConsultCount(String doctor,String outpatient_type) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String sql ="SELECT " +
|
|
|
"count(room.outpatient_id) AS total " +
|
|
|
"FROM " +
|
|
@ -4802,19 +4815,19 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
sql = sql + " AND room.consult_type= 2 ";
|
|
|
}else if("2".equals(outpatient_type)){
|
|
|
}else{}
|
|
|
|
|
|
|
|
|
List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(sql);
|
|
|
|
|
|
|
|
|
Long videoOnlineCount = 0l;
|
|
|
if (rstotal != null && rstotal.size() > 0) {
|
|
|
videoOnlineCount = Long.parseLong(rstotal.get(0).get("total").toString()) ;
|
|
|
}
|
|
|
|
|
|
|
|
|
return videoOnlineCount;
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 根据门诊唯一号,处方号,到顺丰下单,下单成功返回面单信息
|
|
|
* @param admNo 门诊唯一号
|
|
@ -4822,14 +4835,14 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
* @return
|
|
|
*/
|
|
|
public Object getSFExpressInfo(String admNo,String realOrder,String wxId)throws Exception {
|
|
|
|
|
|
|
|
|
//根据门诊唯一号取就诊记录
|
|
|
// List<WlyyOutpatientDO> wlyyOutpatientDOs = outpatientDao.findByAdmNo(admNo);
|
|
|
|
|
|
WlyyPrescriptionDO wlyyPrescriptionDOS = prescriptionDao.findByAdmNoAndRealOrder(admNo,realOrder);
|
|
|
|
|
|
|
|
|
Object result = "";
|
|
|
|
|
|
|
|
|
System.out.println("获取顺丰物流面单信息:wlyyPrescriptionDOS != null="+wlyyPrescriptionDOS != null);
|
|
|
if(wlyyPrescriptionDOS != null){
|
|
|
List<WlyyPrescriptionExpressageDO> expressageDOList = sfexpressService.findByField("outpatientId",wlyyPrescriptionDOS.getOutpatientId());
|
|
@ -4862,19 +4875,19 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
// }
|
|
|
//--2020.05.20--顺丰V2.0接口已不提供查询接口,直接单下单--END
|
|
|
|
|
|
//请求顺丰接口下单,成功下单后,返回快递单号
|
|
|
//请求顺丰接口下单,成功下单后,返回快递单号
|
|
|
sfexpress_obj = sfexpressService.postSFOrderService(sfexpress_obj);
|
|
|
System.out.println("获取顺丰物流面单信息:5");
|
|
|
//保存快递单号和增加处方物流记录为配送
|
|
|
sfexpressService.updatePrescriptionExpressage(sfexpress_obj);
|
|
|
System.out.println("获取顺丰物流面单信息:6");
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
if(sfexpress_obj != null && StringUtils.isNoneBlank(sfexpress_obj.getMailno())){
|
|
|
System.out.println("获取顺丰物流面单信息:7");
|
|
|
com.alibaba.fastjson.JSONObject sfJsonObject = new com.alibaba.fastjson.JSONObject();
|
|
|
|
|
|
|
|
|
sfJsonObject.put("mailno", sfexpress_obj.getMailno());
|
|
|
sfJsonObject.put("mailtype", "标准快递");
|
|
|
sfJsonObject.put("destcode", "592");
|
|
@ -4910,7 +4923,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
System.out.println("获取顺丰物流面单信息:9");
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 根据类型获取候诊居民数量
|
|
|
* @param doctor
|
|
@ -4948,12 +4961,12 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
}
|
|
|
}
|
|
|
List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(sql);
|
|
|
|
|
|
|
|
|
Long waitVideoCount = 0l;
|
|
|
if (rstotal != null && rstotal.size() > 0) {
|
|
|
waitVideoCount = Long.parseLong(rstotal.get(0).get("total").toString());
|
|
|
}
|
|
|
|
|
|
|
|
|
return waitVideoCount;
|
|
|
}
|
|
|
|
|
@ -5486,10 +5499,10 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
* @return
|
|
|
*/
|
|
|
public com.alibaba.fastjson.JSONObject findWaitingRoomOutpatientNumberByDoctor(String doctor,String dept) {
|
|
|
|
|
|
|
|
|
com.alibaba.fastjson.JSONObject object = new com.alibaba.fastjson.JSONObject();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//总数
|
|
|
String sqlAll = "SELECT " +
|
|
|
" COUNT(room.outpatient_id) AS \"total\" " +
|
|
@ -5499,16 +5512,16 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
"WHERE " +
|
|
|
" room.outpatient_id=outpatient.id " +
|
|
|
"AND outpatient.status = 0 AND room.doctor IS NULL AND outpatient.dept='"+dept+"' ";
|
|
|
|
|
|
|
|
|
List<Map<String, Object>> alltotal = jdbcTemplate.queryForList(sqlAll);
|
|
|
|
|
|
|
|
|
Long totalsqlAll = 0l;
|
|
|
if (alltotal != null && alltotal.size() > 0) {
|
|
|
totalsqlAll = Long.parseLong(alltotal.get(0).get("total").toString());
|
|
|
}
|
|
|
|
|
|
|
|
|
object.put("all",totalsqlAll);
|
|
|
|
|
|
|
|
|
//图文复诊
|
|
|
String imgAll = "SELECT " +
|
|
|
" COUNT(room.outpatient_id) AS \"total\" " +
|
|
@ -5518,16 +5531,16 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
"WHERE " +
|
|
|
" room.outpatient_id=outpatient.id " +
|
|
|
"AND outpatient.status = 0 AND room.doctor IS NULL AND room.reservation_type=1 AND room.consult_type=1 AND outpatient.dept='"+dept+"' ";
|
|
|
|
|
|
|
|
|
List<Map<String, Object>> imgtotal = jdbcTemplate.queryForList(imgAll);
|
|
|
|
|
|
|
|
|
Long twCount = 0l;
|
|
|
if (imgtotal != null && imgtotal.size() > 0) {
|
|
|
twCount = Long.parseLong(imgtotal.get(0).get("total").toString());
|
|
|
}
|
|
|
|
|
|
|
|
|
object.put("twCount",twCount);
|
|
|
|
|
|
|
|
|
//视频复诊
|
|
|
String spsql = "SELECT " +
|
|
|
" COUNT(room.outpatient_id) AS \"total\" " +
|
|
@ -5537,17 +5550,17 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
"WHERE " +
|
|
|
" room.outpatient_id=outpatient.id " +
|
|
|
"AND outpatient.status = 0 AND room.doctor IS NULL AND room.reservation_type=1 AND room.consult_type=2 AND outpatient.dept='"+dept+"' ";
|
|
|
|
|
|
|
|
|
List<Map<String, Object>> sptotal = jdbcTemplate.queryForList(spsql);
|
|
|
|
|
|
|
|
|
Long spcount = 0l;
|
|
|
if (sptotal != null && sptotal.size() > 0) {
|
|
|
spcount = Long.parseLong(sptotal.get(0).get("total").toString());
|
|
|
}
|
|
|
|
|
|
|
|
|
object.put("spCount",spcount);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//协同门诊
|
|
|
String xtsql = "SELECT " +
|
|
|
" COUNT(room.outpatient_id) AS \"total\" " +
|
|
@ -5557,21 +5570,21 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
"WHERE " +
|
|
|
" room.outpatient_id=outpatient.id " +
|
|
|
"AND outpatient.status = 0 AND room.doctor IS NULL AND room.reservation_type=2 AND outpatient.dept='"+dept+"' ";
|
|
|
|
|
|
|
|
|
List<Map<String, Object>> xttotal = jdbcTemplate.queryForList(xtsql);
|
|
|
|
|
|
|
|
|
Long xtcount = 0l;
|
|
|
if (xttotal != null && xttotal.size() > 0) {
|
|
|
xtcount = Long.parseLong(xttotal.get(0).get("total").toString());
|
|
|
}
|
|
|
|
|
|
|
|
|
object.put("xtCount",xtcount);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return object;
|
|
|
}
|
|
|
|
|
|
public Map<String,Object> refuseOutpatientByDoctor(String outPatientId, String cancelType, String cancelValue, String cancelRemark) {
|
|
|
|
|
|
public Map<String,Object> refuseOutpatientByDoctor(String outPatientId, String cancelType, String cancelValue, String cancelRemark) {
|
|
|
Map<String,Object> rs = new HashedMap();
|
|
|
//判断医生是否接诊
|
|
|
List<WlyyHospitalWaitingRoomDO> roomDOs =hospitalWaitingRoomDao.findByOutpatientId(outPatientId);
|
|
@ -5587,7 +5600,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
//更改门诊状态
|
|
|
WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findOne(outPatientId);
|
|
|
wlyyOutpatientDO.setStatus("-1");
|
|
@ -5595,26 +5608,26 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
wlyyOutpatientDO.setDoctorCancelType(cancelType);
|
|
|
wlyyOutpatientDO.setDoctorCancelValue(cancelValue);
|
|
|
outpatientDao.save(wlyyOutpatientDO);
|
|
|
|
|
|
|
|
|
//删除门诊号源
|
|
|
List<WlyyPatientRegisterTimeDO> list = patientRegisterTimeDao.findByOutpatientId(wlyyOutpatientDO.getId());
|
|
|
if(list!=null&&list.size()>0){
|
|
|
patientRegisterTimeDao.delete(list);
|
|
|
}
|
|
|
|
|
|
|
|
|
rs.put("code",1);
|
|
|
rs.put("mes","取消成功");
|
|
|
return rs;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获取居民当日就诊列表
|
|
|
* @param patient
|
|
|
* @return
|
|
|
*/
|
|
|
public List<Map<String,Object>> getTodayOutpatinetList(String patient,String wxId) {
|
|
|
public List<Map<String,Object>> getTodayOutpatinetList(String patient,String wxId) {
|
|
|
|
|
|
String condition = "";
|
|
|
String condition = "";
|
|
|
if("xm_ykyy_wx".equals(wxId)){
|
|
|
condition = "to_char(p.register_date,'YYYY-MM-DD hh24:mi:ss') AS \"time\",";
|
|
|
}else{
|
|
@ -5632,7 +5645,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
}
|
|
|
List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
|
|
|
return list;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获取doctormappingcode
|
|
@ -5679,10 +5692,10 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
ArchiveVO archiveVO = objectMapper.readValue(json,ArchiveVO.class);
|
|
|
if(archiveVO!=null){
|
|
|
if(StringUtils.isBlank(archiveVO.getBrnl00())){
|
|
|
archiveVO.setBrnl00(IdCardUtil.getAgeForIdcard(archiveVO.getSfzhao())+"");
|
|
|
archiveVO.setBrnl00(IdCardUtil.getAgeForIdcard(archiveVO.getSfzhao())+"");
|
|
|
}
|
|
|
if(StringUtils.isBlank(archiveVO.getCsrq00())){
|
|
|
archiveVO.setCsrq00(DateUtil.dateToStr(IdCardUtil.getBirthdayForIdcard(archiveVO.getSfzhao()),"yyyyMMdd"));
|
|
|
archiveVO.setCsrq00(DateUtil.dateToStr(IdCardUtil.getBirthdayForIdcard(archiveVO.getSfzhao()),"yyyyMMdd"));
|
|
|
}
|
|
|
//1为需要同步建档
|
|
|
if("1".equals(type)){
|
|
@ -5739,7 +5752,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
if(StringUtils.isNotBlank(patient)){
|
|
|
patientId = patientMappingService.findHisPatNoByPatient(patient);
|
|
|
}
|
|
|
return entranceService.BS10008(idcard,patientId,admitNum,ybcard,demoFlag);
|
|
|
return entranceService.BS10008(idcard,patientId,admitNum,ybcard,demoFlag);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@ -5845,7 +5858,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
}
|
|
|
return list;
|
|
|
}
|
|
|
|
|
|
|
|
|
public void followOrgByPatient(String patientid, String doctorid, String type) {
|
|
|
List<BaseDoctorPatientFollowDO> list =baseOrgPatientDao.findByDoctorAndPatient(doctorid,patientid);
|
|
|
if("1".equals(type)){//关注
|
|
@ -5864,9 +5877,9 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
public List<Map<String,Object>> findDeptByKeyWord(String keyWord,Integer page,Integer pagesize) {
|
|
|
|
|
|
|
|
|
String sql ="SELECT " +
|
|
|
"dept.code AS \"deptCode\"," +
|
|
|
"dept.name AS \"deptName\"," +
|
|
@ -5877,7 +5890,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
"base_org org " +
|
|
|
"WHERE org.CODE=dept.org_code " +
|
|
|
"AND org.del=1 ";
|
|
|
|
|
|
|
|
|
if(StringUtils.isNoneBlank(keyWord)){
|
|
|
sql = sql + "AND dept.NAME LIKE '%"+keyWord+"%' ";
|
|
|
}
|
|
@ -5950,10 +5963,10 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
}else{
|
|
|
sql = sql + "date_format(p.create_time,'%Y-%m-%d %H:%i:%S' ) AS \"createTime\",";
|
|
|
}
|
|
|
sql +="\tp.status as \"status\",\n" +
|
|
|
"\tp.check_status as \"checkStatus\",\n" +
|
|
|
"\tp.check_reason as \"checkReason\",\n" +
|
|
|
"\tp.pay_type as \"payType\"\n" +
|
|
|
sql +="\tp.status as \"status\",\n" +
|
|
|
"\tp.check_status as \"checkStatus\",\n" +
|
|
|
"\tp.check_reason as \"checkReason\",\n" +
|
|
|
"\tp.pay_type as \"payType\"\n" +
|
|
|
"FROM\n" +
|
|
|
"\twlyy_prescription P\n" +
|
|
|
"WHERE\n" +
|
|
@ -6106,7 +6119,12 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
String realerOrder = prescriptionDO.getRealOrder();
|
|
|
String free = prescriptionDO.getDrugFee()+"";
|
|
|
String recipeTime = DateUtil.dateToStr(prescriptionDO.getCreateTime(),"yyyyMMddHHmmss");
|
|
|
String applyDepaName = prescriptionDO.getDeptName();
|
|
|
List<BaseDoctorHospitalDO> doctorHospitalDOS = baseDoctorHospitalDao.findByDoctorCode(prescriptionDO.getDoctor());
|
|
|
String applyDepaName = null;
|
|
|
if (doctorHospitalDOS!=null&&doctorHospitalDOS.size()!=0){
|
|
|
applyDepaName = doctorHospitalDOS.get(0).getDeptName();
|
|
|
}
|
|
|
String voucherNo = map.get("voucherNo")+"";
|
|
|
String applyDoctorName = prescriptionDO.getDoctorName();
|
|
|
BasePatientDO patientDO = basePatientDao.findById(patientCode);
|
|
|
String userName = null;
|
|
@ -6121,10 +6139,11 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
userNo = patientMappingDO.getMappingCode();
|
|
|
}
|
|
|
String cardNo = null;
|
|
|
if (!StringUtils.isNoneBlank(outpatientDO.getCardNo())){
|
|
|
if (StringUtils.isNoneBlank(outpatientDO.getCardNo())){
|
|
|
cardNo = outpatientDO.getCardNo();
|
|
|
}
|
|
|
ylzPayService.msgPush("01",cardNo,"01",patientDO.getMobile(),"03",userNo,userName,idcard,realerOrder,applyDepaName,applyDoctorName,recipeTime,free,"1");
|
|
|
logger.info("cardNo:"+cardNo);
|
|
|
ylzPayService.msgPush("01",cardNo,"01",patientDO.getMobile(),"00",userNo,userName,idcard,voucherNo,applyDepaName,applyDoctorName,recipeTime,free,"1");
|
|
|
}
|
|
|
//sendHisDiagnosis(jsonData, outpatientDO, wlyyPrescriptionDO);
|
|
|
|
|
@ -6138,6 +6157,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
wlyyPrescriptionDO.setCheckReason(reason);
|
|
|
wlyyPrescriptionDO.setStatus(20);
|
|
|
wlyyPrescriptionDO.setPrescribeTime(new Date());
|
|
|
wlyyPrescriptionDO.setId(prescriptionId);
|
|
|
|
|
|
//发送系统消息 处方支付提醒
|
|
|
SystemMessageDO messageDO = new SystemMessageDO();
|
|
@ -6168,6 +6188,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
}
|
|
|
|
|
|
}else{
|
|
|
wlyyPrescriptionDO.setId(prescriptionId);
|
|
|
wlyyPrescriptionDO.setCheckStatus(status);
|
|
|
wlyyPrescriptionDO.setCheckReason(reason);
|
|
|
wlyyPrescriptionDO.setStatus(11);
|
|
@ -6544,7 +6565,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
String reqTime = DateUtil.dateToStr(new Date(),"yyyyMMddHHmmss");
|
|
|
xmlStr+="<REQ_TIME>"+reqTime+"</REQ_TIME>";
|
|
|
xmlStr+="<TREAT_DOCTOR_ID>"+doctorId+"</TREAT_DOCTOR_ID>";
|
|
|
xmlStr+="<TREAT_DOCTOR_NAME>"+doctorName+"</REAT_DOCTOR_NAME>";
|
|
|
xmlStr+="<TREAT_DOCTOR_NAME>"+doctorName+"</TREAT_DOCTOR_NAME>";
|
|
|
xmlStr+="<IS_SGIN>Y</IS_SGIN>";
|
|
|
xmlStr+="<OUTPATIENT_INFO>";
|
|
|
xmlStr+="<CHIEF_COMPLAINT>"+chiefComplaint+"</CHIEF_COMPLAINT>";
|
|
@ -6781,9 +6802,9 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
*/
|
|
|
public PageEnvelop findPatientAllPrescription(String keyName,String status,Integer page, Integer size) {
|
|
|
String uid = userAgent.getUID();
|
|
|
StringBuffer sql = new StringBuffer("SELECT b.*, c.oneself_pickup_flg,f.job_title_code,f.job_title_name FROM (SELECT a.* FROM wlyy_prescription a WHERE a.patient_code = '");
|
|
|
StringBuffer sql = new StringBuffer(" SELECT b.*, c.oneself_pickup_flg,f.job_title_code,f.job_title_name FROM (SELECT a.* FROM wlyy_prescription a WHERE a.patient_code = '");
|
|
|
StringBuffer countSql = new StringBuffer("select COUNT(b.id) count FROM (SELECT a.* FROM wlyy_prescription a WHERE a.patient_code = '");
|
|
|
sql.append(uid).append("') b LEFT JOIN wlyy_prescription_info d ON b.id = d.prescription_id LEFT JOIN wlyy_prescription_expressage c ON c.outpatient_id = b.outpatient_id LEFT JOIN base_doctor f ON b.doctor=f.id ");
|
|
|
sql.append(uid).append("') b LEFT JOIN wlyy_prescription_info d ON b.id = d.prescription_id LEFT JOIN wlyy_prescription_expressage c ON c.outpatient_id = b.outpatient_id LEFT JOIN base_doctor f ON b.doctor=f.id ");
|
|
|
countSql.append(uid).append("') b LEFT JOIN wlyy_prescription_info d ON b.id = d.prescription_id LEFT JOIN wlyy_prescription_expressage c ON c.outpatient_id = b.outpatient_id LEFT JOIN base_doctor f ON b.doctor=f.id ");
|
|
|
|
|
|
if (StringUtils.isNotEmpty(status)){
|
|
@ -6811,8 +6832,39 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
" OR b.real_order LIKE '%"+keyName+"%' " +
|
|
|
")");
|
|
|
}
|
|
|
sql.append(" order by b.prescribe_time DESC limit ").append((page-1)*size).append(",").append(size);
|
|
|
List<WlyyPrescriptionVO> list = jdbcTemplate.query(sql.toString(), new BeanPropertyRowMapper<>(WlyyPrescriptionVO.class));
|
|
|
|
|
|
sql.append(" order by b.prescribe_time DESC ");
|
|
|
|
|
|
List<WlyyPrescriptionVO> list=null;
|
|
|
if ("xm_ykyy_wx".equalsIgnoreCase(wechatId)){
|
|
|
String oracleSql="SELECT\n" +
|
|
|
"\t*\n" +
|
|
|
"FROM\n" +
|
|
|
"\t(\n" +
|
|
|
"\t\tSELECT\n" +
|
|
|
"\t\t\tA .*\n" +
|
|
|
"\t\tFROM\n" +
|
|
|
"\t\t\t(";
|
|
|
|
|
|
oracleSql+=sql.toString();
|
|
|
|
|
|
oracleSql+="\t\t\t) A\n" +
|
|
|
"\t\tWHERE\n" +
|
|
|
" ROWNUM <="+page*size +
|
|
|
"\t) \n" +
|
|
|
"WHERE\n" +
|
|
|
"\tROWNUM >= "+(page-1)*size;
|
|
|
logger.info("oracleSql="+oracleSql);
|
|
|
list = jdbcTemplate.query(oracleSql, new BeanPropertyRowMapper<>(WlyyPrescriptionVO.class));
|
|
|
}else {
|
|
|
// sql+=" LIMIT " + (page - 1) * size + "," + size + "";
|
|
|
sql.append(" limit ").append((page-1)*size).append(",").append(size);
|
|
|
list = jdbcTemplate.query(sql.toString(), new BeanPropertyRowMapper<>(WlyyPrescriptionVO.class));
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// List<WlyyPrescriptionVO> list = jdbcTemplate.query(sql.toString(), new BeanPropertyRowMapper<>(WlyyPrescriptionVO.class));
|
|
|
List<Map<String, Object>> mapList = jdbcTemplate.queryForList(countSql.toString());
|
|
|
long count = Long.parseLong(mapList.get(0).get("count").toString());
|
|
|
logger.info("sql="+sql.toString());
|
|
@ -6897,4 +6949,32 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
}
|
|
|
return MixEnvelop.getSuccess(IotRequestMapping.Common.message_success_find,openid);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 查询科室简介
|
|
|
* @param orgCode
|
|
|
* @param deptCode
|
|
|
* @return
|
|
|
*/
|
|
|
public MixEnvelop findDeptDesc(String orgCode, String deptCode) {
|
|
|
DictDeptDescDO deptDescDO = dictDeptDescDao.findByDeptCodeAndOrgCode(deptCode, orgCode);
|
|
|
if (deptDescDO!=null){
|
|
|
return MixEnvelop.getSuccess(IotRequestMapping.Common.message_success_find,deptDescDO);
|
|
|
}else {
|
|
|
return MixEnvelop.getError("无该科室简介");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 查询机构科室
|
|
|
* @param orgCode
|
|
|
* @return
|
|
|
*/
|
|
|
public MixEnvelop findDeptByOrgCode(String orgCode) {
|
|
|
List<DictDeptDescDO> deptDescDOList = dictDeptDescDao.findByOrgCode(orgCode);
|
|
|
if (deptDescDOList==null || deptDescDOList.size()==0){
|
|
|
return MixEnvelop.getError("无科室信息");
|
|
|
}
|
|
|
return MixEnvelop.getSuccess(IotRequestMapping.Common.message_success_find,deptDescDOList);
|
|
|
}
|
|
|
}
|