|
@ -32,6 +32,7 @@ import com.yihu.jw.entity.base.patient.BasePatientBusinessDO;
|
|
|
import com.yihu.jw.entity.base.patient.BasePatientDO;
|
|
|
import com.yihu.jw.entity.base.patient.PatientMedicareCardDO;
|
|
|
import com.yihu.jw.entity.base.sms.SmsTemplateDO;
|
|
|
import com.yihu.jw.entity.base.words.BaseSensitiveDO;
|
|
|
import com.yihu.jw.entity.base.wx.*;
|
|
|
import com.yihu.jw.entity.base.yx.YxTokenMappingDO;
|
|
|
import com.yihu.jw.entity.hospital.consult.WlyyDoctorClinicRoomDO;
|
|
@ -50,6 +51,7 @@ import com.yihu.jw.entity.hospital.prescription.*;
|
|
|
import com.yihu.jw.entity.order.BusinessOrderDO;
|
|
|
import com.yihu.jw.entity.ylzinfo.OauthYlzConfigDO;
|
|
|
import com.yihu.jw.file_upload.FileUploadService;
|
|
|
import com.yihu.jw.hospital.consult.dao.BaseAdviceTreatmentDao;
|
|
|
import com.yihu.jw.hospital.consult.dao.HospitalWaitingRoomDao;
|
|
|
import com.yihu.jw.hospital.consult.dao.WlyyConsultAdviceDao;
|
|
|
import com.yihu.jw.hospital.dict.WlyyChargeDictDao;
|
|
@ -59,6 +61,7 @@ import com.yihu.jw.hospital.doctor.dao.PatientRegisterTimeDao;
|
|
|
import com.yihu.jw.hospital.doctor.dao.WlyyDoctorOnlineTimeDao;
|
|
|
import com.yihu.jw.hospital.drugstore.dao.BaseDrugStoreDao;
|
|
|
import com.yihu.jw.hospital.httplog.dao.WlyyHttpLogDao;
|
|
|
import com.yihu.jw.hospital.httplog.service.BaseOperateLogService;
|
|
|
import com.yihu.jw.hospital.mapping.dao.DoctorMappingDao;
|
|
|
import com.yihu.jw.hospital.mapping.dao.PatientMappingDao;
|
|
|
import com.yihu.jw.hospital.mapping.service.DoctorMappingService;
|
|
@ -113,6 +116,8 @@ import com.ylzinfo.ehc.EhcHandler;
|
|
|
import com.ylzinfo.ehc.common.utils.DateUtils;
|
|
|
import com.ylzinfo.ehc.trans.TransRequest;
|
|
|
import com.ylzinfo.ehc.trans.TransResponse;
|
|
|
import com.zaxxer.hikari.HikariDataSource;
|
|
|
import com.zaxxer.hikari.HikariPoolMXBean;
|
|
|
import jxl.write.*;
|
|
|
import net.sf.json.JSONArray;
|
|
|
import net.sf.json.JSONObject;
|
|
@ -133,15 +138,21 @@ import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
import javax.management.JMX;
|
|
|
import javax.management.MBeanServer;
|
|
|
import javax.management.ObjectName;
|
|
|
import java.io.IOException;
|
|
|
import java.io.OutputStream;
|
|
|
import java.lang.Boolean;
|
|
|
import java.lang.management.ManagementFactory;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.net.URL;
|
|
|
import java.text.DecimalFormat;
|
|
|
import java.text.ParseException;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* Created by Trick on 2019/5/17.
|
|
@ -300,7 +311,14 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
private TnyyEntranceService tnyyEntranceService;
|
|
|
@Autowired
|
|
|
private BaseJpushTemplateDao baseJpushTemplateDao;
|
|
|
|
|
|
/*@Autowired
|
|
|
HikariDataSource dataSource;*/
|
|
|
@Autowired
|
|
|
private BaseSensitiveDao baseSensitiveDao;
|
|
|
@Autowired
|
|
|
private BaseOperateLogService baseOperateLogService;
|
|
|
@Autowired
|
|
|
private BaseAdviceTreatmentDao baseAdviceTreatmentDao;
|
|
|
|
|
|
@Value("${demo.flag}")
|
|
|
private boolean demoFlag;
|
|
@ -326,7 +344,26 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
return null;
|
|
|
}
|
|
|
logger.info("findOutpatientList patNo " + patNo);
|
|
|
return entranceService.BS30025(patNo, null, startTime, endTime, demoFlag,ksdm);
|
|
|
List<WlyyOutpatientVO> wlyyOutpatientVOList = entranceService.BS30025(patNo, null, startTime, endTime, demoFlag,ksdm);
|
|
|
if (StringUtils.isNoneBlank(ksdm)){
|
|
|
if (!ksdm.equalsIgnoreCase("1500010")){
|
|
|
List<WlyyOutpatientVO> wlyyOutpatientVOList1 = entranceService.BS30025(patNo, null, startTime, endTime, demoFlag,"1500010");
|
|
|
if (wlyyOutpatientVOList!=null&&wlyyOutpatientVOList.size()!=0){
|
|
|
if(wlyyOutpatientVOList1!=null&&wlyyOutpatientVOList1.size()!=0){
|
|
|
for (WlyyOutpatientVO wlyyOutpatientVO:wlyyOutpatientVOList1){
|
|
|
logger.info("==="+wlyyOutpatientVO);
|
|
|
if (wlyyOutpatientVO!=null){
|
|
|
wlyyOutpatientVOList.add(wlyyOutpatientVO);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}else {
|
|
|
wlyyOutpatientVOList = new ArrayList<>();
|
|
|
wlyyOutpatientVOList = wlyyOutpatientVOList1;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
return wlyyOutpatientVOList;
|
|
|
}
|
|
|
|
|
|
/**
|
|
@ -627,82 +664,95 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
} else {
|
|
|
prescriptionDOs = prescriptionDao.findByOutpatientId(outpatientId);
|
|
|
}
|
|
|
List<WlyyPrescriptionVO> prescriptionVOs = new ArrayList<>();
|
|
|
List<BusinessOrderDO> businessOrders = new ArrayList<>();
|
|
|
BusinessOrderDO businessOrder = new BusinessOrderDO();
|
|
|
if (prescriptionDOs != null && prescriptionDOs.size() > 0) {
|
|
|
convertToModels(prescriptionDOs, prescriptionVOs, WlyyPrescriptionVO.class);
|
|
|
for (WlyyPrescriptionVO vo : prescriptionVOs) {
|
|
|
List<WlyyPrescriptionCheckDO> prescriptionCheckDO = prescriptionCheckDao.findByPrescriptionId(vo.getId());
|
|
|
//疾病信息
|
|
|
vo.setDiagnosisVOs(findDiagnosisById(vo.getId()));
|
|
|
if(null!=prescriptionCheckDO&&prescriptionCheckDO.size()>0){
|
|
|
vo.setDispUser(prescriptionCheckDO.get(0).getOperate());
|
|
|
vo.setDispUserName(prescriptionCheckDO.get(0).getOperateName());
|
|
|
}
|
|
|
|
|
|
//药品信息
|
|
|
List<WlyyPrescriptionInfoVO> infoVOs = new ArrayList<>();
|
|
|
System.out.println("=====PrescriptionId======"+vo.getId());
|
|
|
convertToModels(prescriptionInfoDao.findByPrescriptionId(vo.getId(), 1), infoVOs, WlyyPrescriptionInfoVO.class);
|
|
|
vo.setInfoVOs(infoVOs);
|
|
|
|
|
|
//检查检验信息
|
|
|
List<WlyyInspectionVO> inspectionVOs = new ArrayList<>();
|
|
|
vo.setInspectionVOs(convertToModels(wlyyInspectionDao.findByPrescriptionId(vo.getId(), 1), inspectionVOs, WlyyInspectionVO.class));
|
|
|
|
|
|
if (wxId.equalsIgnoreCase("xm_zsyy_wx")) {
|
|
|
WlyyPrescriptionEmrDO wlyyPrescriptionEmrDO1 = prescriptionEmrDao.findEmrByPrescriptionId(vo.getId());
|
|
|
if (wlyyPrescriptionEmrDO1 != null) {
|
|
|
vo.setWlyyPrescriptionEmrDO(wlyyPrescriptionEmrDO1);
|
|
|
} else {
|
|
|
WlyyPrescriptionEmrDO wlyyPrescriptionEmrDO = readOutPatientXml(outpatientDO.getOriginRegisterNo());
|
|
|
//电子病历
|
|
|
vo.setWlyyPrescriptionEmrDO(wlyyPrescriptionEmrDO);
|
|
|
if (!"2".equalsIgnoreCase(outpatientDO.getOutpatientType())){
|
|
|
List<WlyyPrescriptionVO> prescriptionVOs = new ArrayList<>();
|
|
|
List<BusinessOrderDO> businessOrders = new ArrayList<>();
|
|
|
BusinessOrderDO businessOrder = new BusinessOrderDO();
|
|
|
if (prescriptionDOs != null && prescriptionDOs.size() > 0) {
|
|
|
convertToModels(prescriptionDOs, prescriptionVOs, WlyyPrescriptionVO.class);
|
|
|
for (WlyyPrescriptionVO vo : prescriptionVOs) {
|
|
|
List<WlyyPrescriptionCheckDO> prescriptionCheckDO = prescriptionCheckDao.findByPrescriptionId(vo.getId());
|
|
|
//疾病信息
|
|
|
vo.setDiagnosisVOs(findDiagnosisById(vo.getId()));
|
|
|
if(null!=prescriptionCheckDO&&prescriptionCheckDO.size()>0){
|
|
|
vo.setDispUser(prescriptionCheckDO.get(0).getOperate());
|
|
|
vo.setDispUserName(prescriptionCheckDO.get(0).getOperateName());
|
|
|
}
|
|
|
} else if (wxId.equalsIgnoreCase("xm_xzzx_wx")) {
|
|
|
WlyyPrescriptionEmrDO wlyyPrescriptionEmrDO1 = prescriptionEmrDao.findEmrByPrescriptionId(vo.getId());
|
|
|
if (wlyyPrescriptionEmrDO1 != null) {
|
|
|
vo.setWlyyPrescriptionEmrDO(wlyyPrescriptionEmrDO1);
|
|
|
} else {
|
|
|
List<WlyyPrescriptionEmrDO> listEmr = xzzxEntranceService.selectHistoryEmr(hisPatient,"");
|
|
|
if (null!=listEmr&&listEmr.size()>0){
|
|
|
vo.setWlyyPrescriptionEmrDO(listEmr.get(0));
|
|
|
|
|
|
//药品信息
|
|
|
List<WlyyPrescriptionInfoVO> infoVOs = new ArrayList<>();
|
|
|
System.out.println("=====PrescriptionId======"+vo.getId());
|
|
|
convertToModels(prescriptionInfoDao.findByPrescriptionId(vo.getId(), 1), infoVOs, WlyyPrescriptionInfoVO.class);
|
|
|
vo.setInfoVOs(infoVOs);
|
|
|
|
|
|
//检查检验信息
|
|
|
List<WlyyInspectionVO> inspectionVOs = new ArrayList<>();
|
|
|
vo.setInspectionVOs(convertToModels(wlyyInspectionDao.findByPrescriptionId(vo.getId(), 1), inspectionVOs, WlyyInspectionVO.class));
|
|
|
|
|
|
if (wxId.equalsIgnoreCase("xm_zsyy_wx")) {
|
|
|
WlyyPrescriptionEmrDO wlyyPrescriptionEmrDO1 = prescriptionEmrDao.findEmrByPrescriptionId(vo.getId());
|
|
|
if (wlyyPrescriptionEmrDO1 != null) {
|
|
|
vo.setWlyyPrescriptionEmrDO(wlyyPrescriptionEmrDO1);
|
|
|
} else {
|
|
|
WlyyPrescriptionEmrDO wlyyPrescriptionEmrDO = readOutPatientXml(outpatientDO.getOriginRegisterNo());
|
|
|
//电子病历
|
|
|
vo.setWlyyPrescriptionEmrDO(wlyyPrescriptionEmrDO);
|
|
|
}
|
|
|
} else if (wxId.equalsIgnoreCase("xm_xzzx_wx")) {
|
|
|
WlyyPrescriptionEmrDO wlyyPrescriptionEmrDO1 = prescriptionEmrDao.findEmrByPrescriptionId(vo.getId());
|
|
|
if (wlyyPrescriptionEmrDO1 != null) {
|
|
|
vo.setWlyyPrescriptionEmrDO(wlyyPrescriptionEmrDO1);
|
|
|
} else {
|
|
|
List<WlyyPrescriptionEmrDO> listEmr = xzzxEntranceService.selectHistoryEmr(hisPatient,"");
|
|
|
if (null!=listEmr&&listEmr.size()>0){
|
|
|
vo.setWlyyPrescriptionEmrDO(listEmr.get(0));
|
|
|
}
|
|
|
}
|
|
|
}else {
|
|
|
WlyyPrescriptionEmrDO wlyyPrescriptionEmrDO1 = prescriptionEmrDao.findEmrByPrescriptionId(vo.getId());
|
|
|
if (wlyyPrescriptionEmrDO1 != null) {
|
|
|
vo.setWlyyPrescriptionEmrDO(wlyyPrescriptionEmrDO1);
|
|
|
}
|
|
|
}
|
|
|
}else {
|
|
|
WlyyPrescriptionEmrDO wlyyPrescriptionEmrDO1 = prescriptionEmrDao.findEmrByPrescriptionId(vo.getId());
|
|
|
if (wlyyPrescriptionEmrDO1 != null) {
|
|
|
vo.setWlyyPrescriptionEmrDO(wlyyPrescriptionEmrDO1);
|
|
|
//支付信息
|
|
|
BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(vo.getId());
|
|
|
if (null!=businessOrderDO){
|
|
|
businessOrders.add(businessOrderDO);
|
|
|
}
|
|
|
}
|
|
|
//支付信息
|
|
|
BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(vo.getId());
|
|
|
if (null!=businessOrderDO){
|
|
|
businessOrders.add(businessOrderDO);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
rs.put("prescriptions", prescriptionVOs);
|
|
|
rs.put("businessOrder", businessOrders);
|
|
|
|
|
|
}
|
|
|
rs.put("prescriptions", prescriptionVOs);
|
|
|
rs.put("businessOrder", businessOrders);
|
|
|
//物流信息
|
|
|
List<WlyyPrescriptionExpressageDO> expressageDOs = prescriptionExpressageDao.findByOutpatientId(outpatientId);
|
|
|
if (expressageDOs != null && expressageDOs.size() > 0) {
|
|
|
rs.put("expressage", convertToModel(expressageDOs.get(0), WlyyPrescriptionExpressageVO.class));
|
|
|
} else {
|
|
|
rs.put("expressage", null);
|
|
|
}
|
|
|
|
|
|
//物流信息
|
|
|
List<WlyyPrescriptionExpressageDO> expressageDOs = prescriptionExpressageDao.findByOutpatientId(outpatientId);
|
|
|
if (expressageDOs != null && expressageDOs.size() > 0) {
|
|
|
rs.put("expressage", convertToModel(expressageDOs.get(0), WlyyPrescriptionExpressageVO.class));
|
|
|
} else {
|
|
|
rs.put("expressage", null);
|
|
|
//物流配送新
|
|
|
List<WlyyPrescriptionExpressageLogDO> expressageLogDOs = prescriptionExpressageLogDao.queryByOutpatientIdOrderByCreateTimeDesc(outpatientId);
|
|
|
List<WlyyPrescriptionExpressageLogVO> expressageLogVOs = new ArrayList<>();
|
|
|
if (expressageLogDOs != null && expressageLogDOs.size() > 0) {
|
|
|
rs.put("expressageLogs", convertToModels(expressageLogDOs, expressageLogVOs, WlyyPrescriptionExpressageLogVO.class));
|
|
|
} else {
|
|
|
rs.put("expressageLogs", null);
|
|
|
}
|
|
|
}else {
|
|
|
List<BaseAdviceTreatmentDO> treatmentDOS=baseAdviceTreatmentDao.findByRelationCode(outpatientId);
|
|
|
if (treatmentDOS!=null&&treatmentDOS.size()>0){
|
|
|
//药品
|
|
|
List<WlyyPrescriptionInfoDO> infoDOList=prescriptionInfoDao.findByPrescriptionId(treatmentDOS.get(0).getId(), 1);
|
|
|
treatmentDOS.get(0).setInfoList(infoDOList);
|
|
|
rs.put("treatments",treatmentDOS.get(0));
|
|
|
}else{
|
|
|
rs.put("treatments","");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//物流配送新
|
|
|
List<WlyyPrescriptionExpressageLogDO> expressageLogDOs = prescriptionExpressageLogDao.queryByOutpatientIdOrderByCreateTimeDesc(outpatientId);
|
|
|
List<WlyyPrescriptionExpressageLogVO> expressageLogVOs = new ArrayList<>();
|
|
|
if (expressageLogDOs != null && expressageLogDOs.size() > 0) {
|
|
|
rs.put("expressageLogs", convertToModels(expressageLogDOs, expressageLogVOs, WlyyPrescriptionExpressageLogVO.class));
|
|
|
} else {
|
|
|
rs.put("expressageLogs", null);
|
|
|
}
|
|
|
|
|
|
//预约记录
|
|
|
List<WlyyPatientRegisterTimeDO> timeDOs = patientRegisterTimeDao.findByOutpatientId(outpatientId);
|
|
@ -922,7 +972,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
WlyyOutpatientDO outpatientDO = objectMapper.readValue(outpatientJson, WlyyOutpatientDO.class);
|
|
|
BasePatientDO patientDO = basePatientDao.findById(outpatientDO.getPatient());
|
|
|
BaseDoctorDO doctorDO = baseDoctorDao.findById(outpatientDO.getDoctor());
|
|
|
|
|
|
outpatientDO.setIsAgree("1");
|
|
|
outpatientDO.setMjz("mz");
|
|
|
outpatientDO.setStatus("0");
|
|
|
outpatientDO.setCreateTime(new Date());
|
|
@ -1499,7 +1549,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
|
|
|
}
|
|
|
|
|
|
logger.info("findDoctorByHospitalAndDept sql:" + sql);
|
|
|
logger.info("v sql:" + sql);
|
|
|
|
|
|
List<Map<String, Object>> list = hibenateUtils.createSQLQuery(sql, params);
|
|
|
|
|
@ -1705,29 +1755,15 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
"\td.req_fee as \"xtzxFee\"\n" +
|
|
|
"FROM\n" +
|
|
|
"\tbase_doctor t\n" +
|
|
|
"LEFT JOIN wlyy_charge_dict m ON t.twfz_charge_type = m.charge_type\n" +
|
|
|
"LEFT JOIN wlyy_charge_dict a ON t.spfz_charge_type = a.charge_type\n" +
|
|
|
"LEFT JOIN wlyy_charge_dict b ON t.spzx_charge_type = b.charge_type\n" +
|
|
|
"LEFT JOIN wlyy_charge_dict v ON t.twzx_charge_type = v.charge_type\n" +
|
|
|
"LEFT JOIN wlyy_charge_dict d ON t.twzx_charge_type = d.charge_type\n" +
|
|
|
" LEFT JOIN wlyy_charge_dict g ON t.jyzx_charge_type = g.charge_type\n" +
|
|
|
"LEFT JOIN wlyy_charge_dict m ON t.twfz_charge_type = m.charge_type and m.is_del='1'\n" +
|
|
|
"LEFT JOIN wlyy_charge_dict a ON t.spfz_charge_type = a.charge_type and a.is_del='1'\n" +
|
|
|
"LEFT JOIN wlyy_charge_dict b ON t.spzx_charge_type = b.charge_type and b.is_del='1'\n" +
|
|
|
"LEFT JOIN wlyy_charge_dict v ON t.twzx_charge_type = v.charge_type and v.is_del='1'\n" +
|
|
|
"LEFT JOIN wlyy_charge_dict d ON t.twzx_charge_type = d.charge_type and d.is_del='1'\n" +
|
|
|
" LEFT JOIN wlyy_charge_dict g ON t.jyzx_charge_type = g.charge_type and g.is_del='1'\n" +
|
|
|
"WHERE t.id = '"+doctor.get("id")+"' ";
|
|
|
chargeDictDOLists = hibenateUtils.createSQLQuery(sqlCharge);
|
|
|
/*if (null!=doctor.get("chargeType")){
|
|
|
String chargeTypeList = doctor.get("chargeType").toString();
|
|
|
if (chargeType.contains(",")){
|
|
|
chargeTypeList = chargeType.replace(",","','");
|
|
|
}
|
|
|
String sqlCharge = "select charge_type as \"chargeType\",charge_name as \"chargeName\"," +
|
|
|
"req_fee as \"reqFee\",zj_fee as \"zjFee\",xt_fee as \"xtFee\",dept_type_code as \"deptTypeCode\" " +
|
|
|
" from wlyy_charge_dict where 1=1";
|
|
|
sqlCharge+=" and charge_type in ( '"+chargeTypeList+"')";
|
|
|
|
|
|
if (StringUtils.isNoneBlank(deptTyepCode)){
|
|
|
sqlCharge+=" and dept_type_code in ( '"+deptTyepCode+"')";
|
|
|
}
|
|
|
chargeDictDOLists = hibenateUtils.createSQLQuery(sqlCharge);
|
|
|
}*/
|
|
|
doctor.put("chargeTypeList",chargeDictDOLists);
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(doctorCode)) {
|
|
@ -3119,24 +3155,24 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
if (StringUtils.isNotBlank(startTime)) {
|
|
|
if ("xm_ykyy_wx".equals(wxId)) {
|
|
|
if (flag){
|
|
|
totalSql += " and e.create_time >= str_to_date('" + startTime + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
|
|
|
totalSql += " and p.create_time >= str_to_date('" + startTime + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
|
|
|
}else {
|
|
|
totalSql += " and e.create_time >= to_date('" + startTime + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
|
|
|
totalSql += " and p.create_time >= to_date('" + startTime + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
|
|
|
}
|
|
|
} else {
|
|
|
totalSql += " AND e.create_time >='" + startTime + " 00:00:00'";
|
|
|
totalSql += " AND p.create_time >='" + startTime + " 00:00:00'";
|
|
|
}
|
|
|
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(endTime)) {
|
|
|
if ("xm_ykyy_wx".equals(wxId)) {
|
|
|
if (flag){
|
|
|
totalSql += " and e.create_time <= str_to_date('" + endTime + " 23:59:59','YYYY-MM-DD HH24:MI:SS')";
|
|
|
totalSql += " and p.create_time <= str_to_date('" + endTime + " 23:59:59','YYYY-MM-DD HH24:MI:SS')";
|
|
|
}else {
|
|
|
totalSql += " and e.create_time <= to_date('" + endTime + " 23:59:59','YYYY-MM-DD HH24:MI:SS')";
|
|
|
totalSql += " and p.create_time <= to_date('" + endTime + " 23:59:59','YYYY-MM-DD HH24:MI:SS')";
|
|
|
}
|
|
|
} else {
|
|
|
totalSql += " AND e.create_time <='" + endTime + " 23:59:59'";
|
|
|
totalSql += " AND p.create_time <='" + endTime + " 23:59:59'";
|
|
|
}
|
|
|
|
|
|
}
|
|
@ -3205,29 +3241,29 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
if (StringUtils.isNotBlank(startTime)) {
|
|
|
if ("xm_ykyy_wx".equals(wxId)) {
|
|
|
if (flag){
|
|
|
sql += " and e.create_time >= str_to_date('" + startTime + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
|
|
|
sql += " and p.create_time >= str_to_date('" + startTime + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
|
|
|
}else {
|
|
|
sql += " and e.create_time >= to_date('" + startTime + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
|
|
|
sql += " and p.create_time >= to_date('" + startTime + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
|
|
|
}
|
|
|
} else {
|
|
|
sql += " AND e.create_time >='" + startTime + " 00:00:00'";
|
|
|
sql += " AND p.create_time >='" + startTime + " 00:00:00'";
|
|
|
}
|
|
|
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(endTime)) {
|
|
|
if ("xm_ykyy_wx".equals(wxId)) {
|
|
|
if (flag){
|
|
|
sql += " and e.create_time <= str_to_date('" + endTime + " 23:59:59','YYYY-MM-DD HH24:MI:SS')";
|
|
|
sql += " and p.create_time <= str_to_date('" + endTime + " 23:59:59','YYYY-MM-DD HH24:MI:SS')";
|
|
|
}else {
|
|
|
sql += " and e.create_time <= to_date('" + endTime + " 23:59:59','YYYY-MM-DD HH24:MI:SS')";
|
|
|
sql += " and p.create_time <= to_date('" + endTime + " 23:59:59','YYYY-MM-DD HH24:MI:SS')";
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
sql += " AND e.create_time <='" + endTime + " 23:59:59'";
|
|
|
sql += " AND p.create_time <='" + endTime + " 23:59:59'";
|
|
|
}
|
|
|
|
|
|
}
|
|
|
sql +=" order by e.create_time desc ";
|
|
|
sql +=" order by p.create_time desc ";
|
|
|
/* sql += " LIMIT " + (page - 1) * size + "," + size + "";*/
|
|
|
List<Map<String, Object>> list = hibenateUtils.createSQLQuery(sql, page, size);
|
|
|
for (Map<String, Object> map : list) {
|
|
@ -3695,7 +3731,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
|
|
|
return rs.size();
|
|
|
}
|
|
|
|
|
|
@Transactional(readOnly = true)
|
|
|
public Map<String, Object> findDoctorInfo(String doctor, String withWork,String patient) {
|
|
|
BaseDoctorDO doctorDO = baseDoctorDao.findById(doctor);
|
|
|
Map<String, Object> rs = new HashedMap();
|
|
@ -3730,39 +3766,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
rs.put("sex",doctorDO.getSex());
|
|
|
rs.put("popularity",doctorDO.getPopularity());
|
|
|
rs.put("qrcode",doctorDO.getQrcode());
|
|
|
//号别
|
|
|
/*String deptTyepCode = "";
|
|
|
if ("xm_zsyy_wx".equalsIgnoreCase(wechatId)){
|
|
|
deptTyepCode = "6";
|
|
|
List<BaseDoctorHospitalDO> depts = baseDoctorHospitalDao.findByDoctorCode(doctor);
|
|
|
if (null!=depts&&depts.size()>0){
|
|
|
BaseDoctorHospitalDO baseDoctorHospitalDO = depts.get(0);
|
|
|
String deptcode = baseDoctorHospitalDO.getDeptCode();
|
|
|
String hosptitalCode = baseDoctorHospitalDO.getOrgCode();
|
|
|
List<DictHospitalDeptDO> dictHospitalDeptDO = dictHospitalDeptDao.findByOrgCodeAndCode(hosptitalCode,deptcode);
|
|
|
if(null!=dictHospitalDeptDO&&dictHospitalDeptDO.size()>0){
|
|
|
if (StringUtils.isNotBlank(dictHospitalDeptDO.get(0).getDeptTypeCode())){
|
|
|
deptTyepCode = dictHospitalDeptDO.get(0).getDeptTypeCode();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}*/
|
|
|
List<Map<String,Object>> chargeDictDOLists = new ArrayList<>();
|
|
|
/*String chargeType = doctorDO.getChargeType();
|
|
|
if (StringUtils.isNotBlank(chargeType)){
|
|
|
if (chargeType.contains(",")){
|
|
|
chargeType = chargeType.replace(",","','");
|
|
|
}
|
|
|
String sqlCharge = "select charge_type as \"chargeType\",charge_name as \"chargeName\"," +
|
|
|
"req_fee as \"reqFee\",zj_fee as \"zjFee\",xt_fee as \"xtFee\",dept_type_code as \"deptTypeCode\" " +
|
|
|
" from wlyy_charge_dict where 1=1";
|
|
|
sqlCharge+=" and charge_type in ( '"+chargeType+"')";
|
|
|
if (StringUtils.isNoneBlank(deptTyepCode)){
|
|
|
sqlCharge+=" and dept_type_code in ( '"+deptTyepCode+"')";
|
|
|
}
|
|
|
chargeDictDOLists = hibenateUtils.createSQLQuery(sqlCharge);
|
|
|
}*/
|
|
|
String sqlCharge = "SELECT\n" +
|
|
|
"\tm.req_fee as \"twfzFee\",\n" +
|
|
|
"\ta.req_fee as \"spfzFee\",\n" +
|
|
@ -3772,14 +3776,15 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
"\td.req_fee as \"xtzxFee\"\n" +
|
|
|
"FROM\n" +
|
|
|
"\tbase_doctor t\n" +
|
|
|
"LEFT JOIN wlyy_charge_dict m ON t.twfz_charge_type = m.charge_type\n" +
|
|
|
"LEFT JOIN wlyy_charge_dict a ON t.spfz_charge_type = a.charge_type\n" +
|
|
|
"LEFT JOIN wlyy_charge_dict b ON t.spzx_charge_type = b.charge_type\n" +
|
|
|
"LEFT JOIN wlyy_charge_dict v ON t.twzx_charge_type = v.charge_type\n" +
|
|
|
"LEFT JOIN wlyy_charge_dict d ON t.xtfz_charge_type = d.charge_type\n" +
|
|
|
" LEFT JOIN wlyy_charge_dict g ON t.jyzx_charge_type = g.charge_type\n" +
|
|
|
"LEFT JOIN wlyy_charge_dict m ON t.twfz_charge_type = m.charge_type and m.is_del='1'\n" +
|
|
|
"LEFT JOIN wlyy_charge_dict a ON t.spfz_charge_type = a.charge_type and a.is_del='1'\n" +
|
|
|
"LEFT JOIN wlyy_charge_dict b ON t.spzx_charge_type = b.charge_type and b.is_del='1'\n" +
|
|
|
"LEFT JOIN wlyy_charge_dict v ON t.twzx_charge_type = v.charge_type and v.is_del='1'\n" +
|
|
|
"LEFT JOIN wlyy_charge_dict d ON t.xtfz_charge_type = d.charge_type and d.is_del='1'\n" +
|
|
|
" LEFT JOIN wlyy_charge_dict g ON t.jyzx_charge_type = g.charge_type and g.is_del='1'\n" +
|
|
|
"WHERE t.id = '"+doctorDO.getId()+"' ";
|
|
|
chargeDictDOLists = hibenateUtils.createSQLQuery(sqlCharge);
|
|
|
//System.out.println(chargeDictDOLists.get(1));
|
|
|
rs.put("chargeTypeList",chargeDictDOLists);
|
|
|
//机构科室信息
|
|
|
List<BaseDoctorHospitalDO> hospitalDOs = baseDoctorHospitalDao.findByDoctorCode(doctorDO.getId());
|
|
@ -3926,6 +3931,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
}
|
|
|
}*/
|
|
|
List<com.alibaba.fastjson.JSONArray> waitinglist = new ArrayList<>();
|
|
|
List<BaseSensitiveDO> listSensitive = (List<BaseSensitiveDO>) baseSensitiveDao.findAll();
|
|
|
if (scoreList != null && scoreList.size() > 0) {
|
|
|
List<String> stringList = new ArrayList<>();
|
|
|
for (Map<String, Object> scorepatient : scoreList) {
|
|
@ -3939,7 +3945,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
}
|
|
|
String content = (String)scorepatient.get("content");
|
|
|
if (StringUtils.isNotEmpty(content)){
|
|
|
String replace = baseSensitiveFilterWordsService.filterSensitiveWords(content);
|
|
|
String replace = baseSensitiveFilterWordsService.filterSensitiveWords(content,listSensitive);
|
|
|
scorepatient.put("content",replace);
|
|
|
}
|
|
|
|
|
@ -4059,13 +4065,13 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
"\td.req_fee as \"xtzxFee\"\n" +
|
|
|
"FROM\n" +
|
|
|
"\tbase_doctor t\n" +
|
|
|
"LEFT JOIN wlyy_charge_dict m ON t.twfz_charge_type = m.charge_type\n" +
|
|
|
"LEFT JOIN wlyy_charge_dict a ON t.spfz_charge_type = a.charge_type\n" +
|
|
|
"LEFT JOIN wlyy_charge_dict b ON t.spzx_charge_type = b.charge_type\n" +
|
|
|
"LEFT JOIN wlyy_charge_dict v ON t.twzx_charge_type = v.charge_type\n" +
|
|
|
"LEFT JOIN wlyy_charge_dict d ON t.xtfz_charge_type = d.charge_type\n" +
|
|
|
" LEFT JOIN wlyy_charge_dict g ON t.jyzx_charge_type = g.charge_type\n" +
|
|
|
"WHERE t.id = '"+doctorDO.getId()+"' ";
|
|
|
"LEFT JOIN wlyy_charge_dict m ON t.twfz_charge_type = m.charge_type and m.is_del='1'\n" +
|
|
|
"LEFT JOIN wlyy_charge_dict a ON t.spfz_charge_type = a.charge_type and a.is_del='1'\n" +
|
|
|
"LEFT JOIN wlyy_charge_dict b ON t.spzx_charge_type = b.charge_type and b.is_del='1'\n" +
|
|
|
"LEFT JOIN wlyy_charge_dict v ON t.twzx_charge_type = v.charge_type and v.is_del='1'\n" +
|
|
|
"LEFT JOIN wlyy_charge_dict d ON t.xtfz_charge_type = d.charge_type and d.is_del='1'\n" +
|
|
|
" LEFT JOIN wlyy_charge_dict g ON t.jyzx_charge_type = g.charge_type and g.is_del='1'\n" +
|
|
|
"WHERE t.id = '"+doctorDO.getId()+"'";
|
|
|
chargeDictDOLists = hibenateUtils.createSQLQuery(sqlCharge);
|
|
|
rs.put("chargeTypeList",chargeDictDOLists);
|
|
|
//机构科室信息
|
|
@ -4178,6 +4184,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
}
|
|
|
else if("2".equalsIgnoreCase(wlyyOutpatientDO.getType())&&"3".equalsIgnoreCase(wlyyOutpatientDO.getOutpatientType())){
|
|
|
type="17";
|
|
|
}else if("2".equalsIgnoreCase(wlyyOutpatientDO.getOutpatientType())){
|
|
|
type="12";
|
|
|
}
|
|
|
description = "居民取消";
|
|
|
if (StringUtils.isNoneBlank(type)){
|
|
@ -4362,23 +4370,32 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
contentMsg = "您发起的视频咨询已被"+outpatientDO.getDoctorName()+"接诊,请留意医生发送的消息。";
|
|
|
first = outpatientDO.getConsumerName() + ",您好!您发起的视频咨询,医生已接诊";
|
|
|
}
|
|
|
if ("12".equals(type)) {
|
|
|
contentMsg = "您发起的专科协同已被"+outpatientDO.getDoctorName()+"接诊,请留意医生发送的消息。";
|
|
|
first = outpatientDO.getConsumerName() + ",您好!您发起的专科协同,医生已接诊";
|
|
|
return;
|
|
|
}
|
|
|
if ("15".equals(type)) {
|
|
|
contentMsg = "您发起的家医咨询已被"+outpatientDO.getDoctorName()+"接诊,请留意医生发送的消息。";
|
|
|
first = outpatientDO.getConsumerName() + ",您好!您发起的家医咨询,医生已接诊";
|
|
|
}
|
|
|
logger.info("doctorPick诊查费支付成功推送模板消息:outpatientId="+outpatientId);
|
|
|
msgUrl="/ims-wx/index.html#/returnVisit/record?outpatientId="+outpatientId;
|
|
|
} else if("doctorRefund".equalsIgnoreCase(titelType)) {
|
|
|
if ("9".equals(type)) {
|
|
|
contentMsg = "您的图文复诊订单已退号。由于订单退号,诊察费将退回就诊卡内余额。";
|
|
|
first = outpatientDO.getConsumerName() + ",您好!您的图文复诊已退号";
|
|
|
contentMsg = "金额已退到门诊预交金。如需退款(15元)请到门诊收费处退款。";
|
|
|
first = outpatientDO.getConsumerName() + ",您好!您发起的图文复诊已退号";
|
|
|
}
|
|
|
if ("16".equals(type)) {
|
|
|
contentMsg = "您的视频复诊订单已退号。由于订单退号,诊察费将退回就诊卡内余额。";
|
|
|
contentMsg = "金额已退到门诊预交金。如需退款(15元)请到门诊收费处退款。";
|
|
|
first = outpatientDO.getConsumerName() + ",您好!您发起的视频复诊已退号";
|
|
|
}
|
|
|
if ("1".equals(type)) {
|
|
|
contentMsg = "您的图文咨询订单已退号。由于订单退号,诊察费将退回就诊卡内余额。";
|
|
|
contentMsg = "金额已退到门诊预交金。如需退款(15元)请到门诊收费处退款。";
|
|
|
first = outpatientDO.getConsumerName() + ",您好!您发起的图文咨询已退号";
|
|
|
}
|
|
|
if ("17".equals(type)) {
|
|
|
contentMsg = "您的视频咨询订单已退号。由于订单退号,诊察费将退回就诊卡内余额。";
|
|
|
contentMsg = "金额已退到门诊预交金。如需退款(15元)请到门诊收费处退款。";
|
|
|
first = outpatientDO.getConsumerName() + ",您好!您发起的视频咨询已退号";
|
|
|
}
|
|
|
logger.info("doctorRefund:outpatientId="+outpatientId);
|
|
@ -4400,17 +4417,20 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
contentMsg = "您发起的视频咨询已被您取消。由于订单取消将不做扣费处理。";
|
|
|
first = outpatientDO.getConsumerName() + ",您好!您的视频咨询已被您取消,您可重新发起";
|
|
|
}
|
|
|
if ("12".equals(type)) {
|
|
|
return;
|
|
|
}
|
|
|
logger.info("patientCancel诊查费支付成功推送模板消息:outpatientId="+outpatientId);
|
|
|
msgUrl="/ims-wx/index.html#/returnVisit/record?outpatientId="+outpatientId;
|
|
|
}else if("systemCancelRemind".equalsIgnoreCase(titelType)){
|
|
|
//超过24小时未接诊,系统取消
|
|
|
if ("9".equals(type)) {
|
|
|
contentMsg = "图文咨询因超时自动取消。您可重新发起。由于订单取消将不做扣费处理。";
|
|
|
first = outpatientDO.getConsumerName() + ",您好!您的图文复诊因超时未接诊已取消";
|
|
|
contentMsg = "由于订单取消将不做扣费处理。如需退款(15元)请到门诊收费处退款。";
|
|
|
first = outpatientDO.getConsumerName() + ",您好!您的图文复诊因超过24小时未接诊已自动取消图文咨询。";
|
|
|
}
|
|
|
if ("16".equals(type)) {
|
|
|
contentMsg = "视频咨询因超时自动取消。您可重新发起。由于订单取消将不做扣费处理。";
|
|
|
first = outpatientDO.getConsumerName() + ",您好!您的视频复诊因超时未接诊已取消";
|
|
|
contentMsg = "由于订单取消将不做扣费处理。如需退款(15元)请到门诊收费处退款。";
|
|
|
first = outpatientDO.getConsumerName() + ",您好!您的视频复诊因超过24小时未接诊已自动取消视频咨询。";
|
|
|
}
|
|
|
logger.info("系统取消接诊入参:outpatientId="+outpatientId);
|
|
|
msgUrl="/ims-wx/index.html#/returnVisit/record?outpatientId="+outpatientId;
|
|
@ -4426,8 +4446,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
first = outpatientDO.getConsumerName() + ",您好!您有一笔未完成的在线问诊订单,请及时处理。";//您有一个视频复诊订单待支付,请及时支付。
|
|
|
msgUrl="/ims-wx/index.html#/returnVisit/record?outpatientId="+outpatientId;
|
|
|
logger.info("视频复诊订单待支付微信消息模板推送开始");
|
|
|
}
|
|
|
if ("1".equals(type)) {
|
|
|
}else if ("1".equals(type)) {
|
|
|
contentMsg = "您有一个图文咨询订单待支付,点击完成支付,如您已支付请忽略本条信息";
|
|
|
msgUrl="/ims-wx/index.html#/returnVisit/record?outpatientId="+outpatientId;
|
|
|
first = outpatientDO.getConsumerName() + ",您好!您有一个图文咨询订单待支付,请及时支付。";
|
|
@ -4437,23 +4456,24 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
msgUrl="/ims-wx/index.html#/returnVisit/record?outpatientId="+outpatientId;
|
|
|
first = outpatientDO.getConsumerName() + ",您好!您有一个视频咨询订单待支付,请及时支付。";
|
|
|
logger.info("视频咨询订单待支付微信消息模板推送开始");
|
|
|
}else {
|
|
|
return;
|
|
|
}
|
|
|
} else if ("paySuccess".equalsIgnoreCase(titelType)) {
|
|
|
if ("9".equals(type)) {
|
|
|
contentMsg = "您已成功发起图文复诊,请耐心等待医生接单。如长时间未接诊,建议选择其他医生";
|
|
|
first = outpatientDO.getConsumerName() + ",您好!您已成功发起图文复诊";
|
|
|
}
|
|
|
if ("16".equals(type)) {
|
|
|
}else if ("16".equals(type)) {
|
|
|
contentMsg = "您已成功发起视频复诊,请耐心等待医生接单。如长时间未接诊,建议选择其他医生";
|
|
|
first = outpatientDO.getConsumerName() + ",您好!您已成功发起视频复诊";
|
|
|
}
|
|
|
if ("1".equals(type)) {
|
|
|
}else if ("1".equals(type)) {
|
|
|
contentMsg = "您已成功发起图文咨询,请耐心等待医生接单。如长时间未接诊,建议选择其他医生";
|
|
|
first = outpatientDO.getConsumerName() + ",您好!您已成功发起图文咨询";
|
|
|
}
|
|
|
if ("17".equals(type)) {
|
|
|
}else if ("17".equals(type)) {
|
|
|
contentMsg = "您已成功发起视频咨询,请耐心等待医生接单。如长时间未接诊,建议选择其他医生";
|
|
|
first = outpatientDO.getConsumerName() + ",您好!您已成功发起视频咨询";
|
|
|
}else {
|
|
|
return;
|
|
|
}
|
|
|
logger.info("paySuccess诊查费支付成功推送模板消息:outpatientId="+outpatientId);
|
|
|
msgUrl="/ims-wx/index.html#/returnVisit/record?outpatientId="+outpatientId;
|
|
@ -4501,18 +4521,17 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
if (consultTeam.getType()!=null&&1==consultTeam.getType()){
|
|
|
first = consultTeam.getName() + ",您好!您有1条图文咨询已结束,请及时对咨询医生进行评价。";
|
|
|
logger.info("图文咨询服务评价微信消息模板推送开始");
|
|
|
}
|
|
|
if (consultTeam.getType()!=null&&9==consultTeam.getType()){
|
|
|
}else if (consultTeam.getType()!=null&&9==consultTeam.getType()){
|
|
|
first = consultTeam.getName() + ",您好!您有1条图文复诊已结束,请及时对咨询医生进行评价。";
|
|
|
logger.info("图文复诊服务评价微信消息模板推送开始");
|
|
|
}
|
|
|
if (consultTeam.getType()!=null&&16==consultTeam.getType()){
|
|
|
}else if (consultTeam.getType()!=null&&16==consultTeam.getType()){
|
|
|
first = consultTeam.getName() + ",您好!您有1条视频复诊已结束,请及时对咨询医生进行评价。";
|
|
|
logger.info("视频复诊服务评价微信消息模板推送开始");
|
|
|
}
|
|
|
if (consultTeam.getType()!=null&&17==consultTeam.getType()){
|
|
|
}else if (consultTeam.getType()!=null&&17==consultTeam.getType()){
|
|
|
first = consultTeam.getName() + ",您好!您有1条视频咨询已结束,请及时对咨询医生进行评价。";
|
|
|
logger.info("视频咨询服务评价微信消息模板推送开始");
|
|
|
}else {
|
|
|
return;
|
|
|
}
|
|
|
contentMsg = "请对" + consDoctorDO.getName() + "医生的服务进行评价";
|
|
|
msgUrl="/ims-wx/index.html#/fuwupingjia?consultCode="+consultTeam.getConsult();
|
|
@ -5083,7 +5102,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
* @query_status 0:图文复诊候诊 1:图文复诊抢单列表
|
|
|
* @dept 部门
|
|
|
*/
|
|
|
public List<Map<String, Object>> findWaitingRoomOutpatientByDoctor(String doctor, Integer type, Integer query_status, String dept,String sex,String keyword,String ageGroup) {
|
|
|
public List<Map<String, Object>> findWaitingRoomOutpatientByDoctor(String doctor, Integer type, Integer query_status, String dept,String sex,String keyword,String ageGroup,String patient) {
|
|
|
|
|
|
String sql = "SELECT " +
|
|
|
"room.outpatient_id AS \"id\"," +
|
|
@ -5164,6 +5183,9 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
}if(StringUtils.isNoneBlank(keyword)){
|
|
|
sql += " AND outpatient.patient_name like '%" + keyword + "%' ";
|
|
|
}
|
|
|
if(StringUtils.isNoneBlank(patient)){
|
|
|
sql += " AND (outpatient.patient= '" + patient + "' or outpatient.consumer ='"+patient+"') ";
|
|
|
}
|
|
|
if(StringUtils.isNoneBlank(ageGroup)){
|
|
|
String[] age = ageGroup.split(",");
|
|
|
Calendar nowBegin = Calendar.getInstance();
|
|
@ -5191,8 +5213,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
//根据身份证计算年龄
|
|
|
for (Map<String, Object> outpatient : list) {
|
|
|
String idcard = (String) outpatient.get("idcard");
|
|
|
int patientAge = 0;
|
|
|
int patientSex = 3;
|
|
|
Integer patientAge = 0;
|
|
|
Integer patientSex = 3;
|
|
|
if (null!=outpatient.get("outPatient")){
|
|
|
BasePatientDO basePatientDO = basePatientDao.findById(outpatient.get("outPatient").toString());
|
|
|
if (null!=basePatientDO){
|
|
@ -5656,6 +5678,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
* @param consutlSort
|
|
|
* @return
|
|
|
*/
|
|
|
@Transactional(readOnly = true)
|
|
|
public MixEnvelop findDoctorByHospitalAndDiseaseAndDept(String iswork, String patientid, String orgCode, String dept,
|
|
|
String diseaseKey, String doctorNameKey,
|
|
|
String jobTitleNameKey, String outpatientType,
|
|
@ -5667,6 +5690,333 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
if (pagesize <= 0) {
|
|
|
pagesize = 10;
|
|
|
}*/
|
|
|
//testHikar();
|
|
|
long statr = new Date().getTime();
|
|
|
String sql = "SELECT " +
|
|
|
" d.id AS \"id\", " +
|
|
|
" d.photo AS \"photo\", " +
|
|
|
" d.name AS \"name\", " +
|
|
|
" d.expertise AS \"expertise\"," +
|
|
|
" d.introduce AS \"introduce\"," +
|
|
|
" d.job_title_code AS \"jobTitleCode\", " +
|
|
|
" d.job_title_name AS \"jobTitleName\"," +
|
|
|
" d.charge_type AS \"chargeType\"," +
|
|
|
" h.dept_code AS \"deptCode\"," +
|
|
|
" h.dept_name AS \"deptName\"," +
|
|
|
" dw.workTotal AS \"workTotal\","+
|
|
|
" d.consult_status AS \"consultStatus\"," +
|
|
|
" d.outpatient_type AS \"outpatientType\"," +
|
|
|
" a.total AS \"consultTotal\"," +
|
|
|
" d.twfz_charge_type AS \"TWFZ_CHARGE_TYPE\"," +
|
|
|
" d.spfz_charge_type AS \"SPFZ_CHARGE_TYPE\"," +
|
|
|
" d.spzx_charge_type AS \"SPZX_CHARGE_TYPE\"," +
|
|
|
" d.xtfz_charge_type AS \"XTFZ_CHARGE_TYPE\"," +
|
|
|
" d.twzx_charge_type AS \"TWZX_CHARGE_TYPE\"," +
|
|
|
" d.jyzx_charge_type AS \"JYZX_CHARGE_TYPE\"," +
|
|
|
" h.org_name AS \"orgName\"," +
|
|
|
" h.org_code AS \"orgCode\" " ;
|
|
|
if(StringUtils.isNoneBlank(patientid)){
|
|
|
sql+=" , follow.id AS \"followid\" " ;
|
|
|
}
|
|
|
sql+=" FROM " +
|
|
|
" base_doctor d " +
|
|
|
" JOIN base_doctor_hospital h ON h.doctor_code = d.id " +
|
|
|
" Left join ( select count(id) as total,doctor from wlyy_outpatient where status = 3 GROUP BY doctor ) a on a.doctor = d.id ";
|
|
|
Map<String, Object> params = new HashedMap();
|
|
|
Date date = new Date();
|
|
|
sql+="LEFT JOIN (SELECT COUNT(t1.doctor) as workTotal, t1.doctor FROM wlyy_doctor_work_time t1 WHERE " +
|
|
|
"t1.start_time <=:startTime AND t1.end_time >=:endTime GROUP BY t1.doctor) dw ON dw.doctor=d.id ";
|
|
|
sql+="LEFT JOIN (\n" +
|
|
|
"\tSELECT\n" +
|
|
|
"\t\tAVG(a.score) AS score,\n" +
|
|
|
"\t\tb.doctor AS doctor\n" +
|
|
|
"\tFROM\n" +
|
|
|
"\t\tbase_evaluate a,\n" +
|
|
|
"\t\tbase_evaluate_score b\n" +
|
|
|
"\tWHERE\n" +
|
|
|
"\t\ta.relation_code = b.id\n" +
|
|
|
"\tGROUP BY\n" +
|
|
|
"\t\tb.doctor\n" +
|
|
|
") evaluate ON evaluate.doctor = d.id";
|
|
|
params.put("startTime", date);
|
|
|
params.put("endTime", date);
|
|
|
if(StringUtils.isNoneBlank(patientid)){
|
|
|
if ("1".equalsIgnoreCase(isAttention)) {
|
|
|
sql += " join base_doctor_patient_follow follow on follow.doctor = d.id and follow.patient ='" + patientid + "' ";
|
|
|
}
|
|
|
if ("0".equalsIgnoreCase(isAttention)) {
|
|
|
sql += " join base_doctor_patient_follow follow on follow.doctor = d.id and follow.patient !='" + patientid + "' ";
|
|
|
}
|
|
|
if (StringUtils.isEmpty(isAttention)) {
|
|
|
sql += " LEFT JOIN base_doctor_patient_follow follow ON follow.patient='" + patientid + "' AND follow.doctor = d.id ";
|
|
|
}
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(diseaseKey)) {
|
|
|
sql += " left join wlyy_doctor_special_disease sp on d.id = sp.doctor_code ";
|
|
|
}
|
|
|
|
|
|
if (StringUtils.isNotBlank(workingTime)) {
|
|
|
sql += " JOIN wlyy_doctor_work_time wk on wk.doctor = d.id ";
|
|
|
}
|
|
|
|
|
|
|
|
|
sql += " WHERE 1=1 and h.del = '1' ";
|
|
|
|
|
|
|
|
|
if (StringUtils.isNotBlank(chargType)) {
|
|
|
if ("all".equals(chargType)) {
|
|
|
//不过滤
|
|
|
} else {
|
|
|
sql += " AND d.charge_type = :chargType";
|
|
|
params.put("chargType", chargType);
|
|
|
}
|
|
|
}
|
|
|
List<WlyyHospitalSysDictDO> wlyyHospitalSysDictDOS = wlyyHospitalSysDictDao.findByDictCode("isDoctorWork");
|
|
|
boolean isNeedDoctorWord = true;
|
|
|
if(wlyyHospitalSysDictDOS!=null&&wlyyHospitalSysDictDOS.size()>0){
|
|
|
for(WlyyHospitalSysDictDO wlyyHospitalSysDictDO:wlyyHospitalSysDictDOS){
|
|
|
if (!"1".equalsIgnoreCase(wlyyHospitalSysDictDO.getDictValue())){
|
|
|
isNeedDoctorWord = false;
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(iswork) && "1".equals(iswork)&&isNeedDoctorWord) {
|
|
|
logger.info("iswork:" + iswork);
|
|
|
sql += " AND (" +
|
|
|
" EXISTS ( " +
|
|
|
" SELECT " +
|
|
|
" 1 " +
|
|
|
" FROM " +
|
|
|
" wlyy_doctor_work_time t " +
|
|
|
" WHERE " +
|
|
|
" t.doctor = d.id " +
|
|
|
" AND t.start_time <=:startTime" +
|
|
|
" AND t.end_time >=:endTime" +
|
|
|
" ) OR " +
|
|
|
" d.consult_status = '1') ";
|
|
|
params.put("startTime", date);
|
|
|
params.put("endTime", date);
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(orgCode)) {
|
|
|
sql += " AND h.org_code =:orgCode";
|
|
|
params.put("orgCode", orgCode);
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(diseaseKey)) {
|
|
|
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) {
|
|
|
sql += " or ";
|
|
|
}
|
|
|
}
|
|
|
sql += " ) ";
|
|
|
} else {
|
|
|
sql += " AND d.outpatient_type like'%" + outpatientType + "%'";
|
|
|
}
|
|
|
} 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);
|
|
|
|
|
|
}
|
|
|
if("xm_ykyy_wx".equalsIgnoreCase(wechatId)){
|
|
|
if (flag){
|
|
|
sql += " and d.del='1' order by d.consult_status DESC ,evaluate.score desc,a.total " + consutlSort;
|
|
|
}else{
|
|
|
sql += " and d.del='1' order by d.consult_status desc nulls last ,evaluate.score desc nulls last ,a.total " + consutlSort;
|
|
|
sql+=" NULLS LAST,\n" +
|
|
|
"\tD.id DESC";
|
|
|
}
|
|
|
}else {
|
|
|
sql += " and d.del='1' order by d.consult_status DESC ,evaluate.score desc,a.total " + consutlSort;
|
|
|
}
|
|
|
String sqlCount = "select count(1) as \"total\" from ( "+sql+" ) t";
|
|
|
List<Map<String, Object>> list = hibenateUtils.createSQLQuery(sql, params, page, pagesize);
|
|
|
List<WlyyHospitalSysDictDO> doctorFrontList = wlyyHospitalSysDictDao.findByDictNameOrderBySort("doctorFrontList",orgCode);
|
|
|
List<Map<String,Object>> frontDoctor = new ArrayList<>();
|
|
|
if ("xm_ykyy_wx".equalsIgnoreCase(wechatId)){
|
|
|
sql= sql.replace("AS \"id\"","AS \"ID\"");
|
|
|
}
|
|
|
String sqlCharge = "SELECT t.id as \"id\",\n" +
|
|
|
"\tm.req_fee as \"twfzFee\",\n" +
|
|
|
"\ta.req_fee as \"spfzFee\",\n" +
|
|
|
"\tb.req_fee as \"spzxFee\",\n" +
|
|
|
"\tv.req_fee as \"twzxFee\",\n" +
|
|
|
"\tg.req_fee as \"jyzxFee\",\n" +
|
|
|
"\td.req_fee as \"xtzxFee\"\n" +
|
|
|
"FROM\n" +
|
|
|
"\t ("+sql+") t \n" +
|
|
|
"LEFT JOIN wlyy_charge_dict m ON t.twfz_charge_type = m.charge_type and m.is_del='1'\n" +
|
|
|
"LEFT JOIN wlyy_charge_dict a ON t.spfz_charge_type = a.charge_type and a.is_del='1'\n" +
|
|
|
"LEFT JOIN wlyy_charge_dict b ON t.spzx_charge_type = b.charge_type and b.is_del='1'\n" +
|
|
|
"LEFT JOIN wlyy_charge_dict v ON t.twzx_charge_type = v.charge_type and v.is_del='1'\n" +
|
|
|
"LEFT JOIN wlyy_charge_dict d ON t.xtfz_charge_type = d.charge_type and d.is_del='1'\n" +
|
|
|
" LEFT JOIN wlyy_charge_dict g ON t.jyzx_charge_type = g.charge_type and g.is_del='1'\n"+
|
|
|
" where t.id is not null";
|
|
|
List<Map<String,Object>> chargeDictDOLists = hibenateUtils.createSQLQuery(sqlCharge, params);
|
|
|
//查询医生各项评价平均分
|
|
|
String sqlscore = "select t.doctor as \"id\" ,sum(t.score)/3 as\"score\" from ("+
|
|
|
"SELECT " +
|
|
|
"AVG(a.score) AS \"score\"," +
|
|
|
"a.score_type AS \"score_type\"," +
|
|
|
"b.doctor as \"doctor\" " +
|
|
|
"FROM ("+sql+") m , base_evaluate a,base_evaluate_score b " +
|
|
|
"WHERE " +
|
|
|
" m.id = b.doctor and " +
|
|
|
"a.relation_code=b.id " +
|
|
|
"GROUP BY a.score_type,b.doctor ORDER BY a.score_type ASC ) t GROUP BY t.doctor";
|
|
|
List<Map<String, Object>> listscore = hibenateUtils.createSQLQuery(sqlscore, params);
|
|
|
|
|
|
/*list.stream().forEach(e->{
|
|
|
if (null==e.get("consultStatus")){
|
|
|
e.put("consultStatus",0);
|
|
|
}
|
|
|
if (null==e.get("workTotal")){
|
|
|
e.put("workTotal",0);
|
|
|
}
|
|
|
});
|
|
|
|
|
|
list.stream().sorted(Comparator.comparing((Map<String, Object> h) -> ((String) h.get("workTotal"))).reversed().thenComparing(Comparator.comparing((Map<String, Object> h) -> ((String) h.get("consultStatus")))).reversed());*/
|
|
|
List<Map<String,Object>> resultList = new ArrayList<>();
|
|
|
resultList.addAll(list) ;
|
|
|
for (Map<String,Object> map:list){
|
|
|
String doctor = map.get("id").toString();
|
|
|
/*List<Map<String,Object>> chargeDictDOLists = new ArrayList<>();
|
|
|
if(null!=map.get("chargeType")){
|
|
|
String chargeType = map.get("chargeType").toString();
|
|
|
if (chargeType.contains(",")){
|
|
|
chargeType = chargeType.replace(",","','");
|
|
|
}
|
|
|
String sqlCharge = "select charge_type as \"chargeType\",charge_name as \"chargeName\"," +
|
|
|
"req_fee as \"reqFee\",zj_fee as \"zjFee\",xt_fee as \"xtFee\",dept_type_code as \"deptTypeCode\" " +
|
|
|
" from wlyy_charge_dict where 1=1";
|
|
|
sqlCharge+=" and charge_type in ( '"+chargeType+"')";
|
|
|
if (StringUtils.isNoneBlank(deptTyepCode)){
|
|
|
sqlCharge+=" and dept_type_code in ( '"+deptTyepCode+"')";
|
|
|
}
|
|
|
chargeDictDOLists = hibenateUtils.createSQLQuery(sqlCharge);
|
|
|
}
|
|
|
map.put("chargeTypeList",chargeDictDOLists);*/
|
|
|
List<Map<String,Object>> doctorChargeDictDOLists = new ArrayList<>();
|
|
|
for (Map<String ,Object> chargMap:chargeDictDOLists){
|
|
|
if(doctor.equalsIgnoreCase(chargMap.get("id").toString())){
|
|
|
doctorChargeDictDOLists.add(chargMap);
|
|
|
}
|
|
|
}
|
|
|
map.put("chargeTypeList",doctorChargeDictDOLists);
|
|
|
|
|
|
|
|
|
Double doctorScore = new Double("0");
|
|
|
|
|
|
if (listscore != null && listscore.size() > 0) {
|
|
|
for (Map<String, Object> _listscore : listscore) {
|
|
|
if (_listscore.get("id").toString().equalsIgnoreCase(doctor)){
|
|
|
doctorScore = Double.parseDouble(_listscore.get("score").toString());
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
map.put("doctorScore", doctorScore);
|
|
|
if (doctorFrontList!=null&&doctorFrontList.size()>0){
|
|
|
for (WlyyHospitalSysDictDO wlyyHospitalSysDictDO:doctorFrontList){
|
|
|
if(doctor.equalsIgnoreCase(wlyyHospitalSysDictDO.getDictCode())){
|
|
|
map.put("doctorFrontSort",wlyyHospitalSysDictDO.getSort());
|
|
|
logger.info("doctorFrontSort"+wlyyHospitalSysDictDO.getSort());
|
|
|
logger.info("doctorId"+wlyyHospitalSysDictDO.getDictCode());
|
|
|
frontDoctor.add(map);
|
|
|
resultList.remove(map);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
List<Map<String, Object>> listCount = hibenateUtils.createSQLQuery(sqlCount, params);
|
|
|
Long count = 0L;
|
|
|
if(listCount!=null){
|
|
|
//mysql 与 Oracle 聚合函数返回类型不一致,需要判断装换
|
|
|
count = hibenateUtils.objTransformLong(listCount.get(0).get("total"));
|
|
|
}
|
|
|
if (frontDoctor!=null&&frontDoctor.size()>0){
|
|
|
frontDoctor.sort(Comparator.comparing((Map<String, Object> h) -> ((Integer) h.get("doctorFrontSort"))));
|
|
|
logger.info("size"+frontDoctor.size());
|
|
|
for (Map<String, Object> map:resultList){
|
|
|
logger.info("id =="+map.get("id").toString());
|
|
|
frontDoctor.add(map);
|
|
|
}
|
|
|
}
|
|
|
logger.info("findDoctorByHospitalAndDiseaseAndDept end:" + DateUtil.dateToStr(new Date(), "yyyy-MM-dd HH:mm:ss:SSS"));
|
|
|
logger.info("sql:" + sql);
|
|
|
MixEnvelop envelop =new MixEnvelop();
|
|
|
envelop.setDetailModelList(frontDoctor);
|
|
|
envelop.setTotalCount(count.intValue());
|
|
|
envelop.setPageSize(pagesize);
|
|
|
envelop.setCurrPage(page);
|
|
|
System.out.println("new"+(new Date().getTime()-statr));
|
|
|
return envelop;
|
|
|
}
|
|
|
/**
|
|
|
* 根据疾病名称,热门部门查询医生
|
|
|
*
|
|
|
* @param orgCode 机构码
|
|
|
* @param dept 部门CODE
|
|
|
* @param diseaseKey 疾病名称
|
|
|
* @param jobTitleNameKey
|
|
|
* @param outpatientType
|
|
|
* @param keyName
|
|
|
* @param workingTime
|
|
|
* @param consutlSort
|
|
|
* @return
|
|
|
*/
|
|
|
@Transactional(readOnly = true)
|
|
|
public MixEnvelop findDoctorByHospitalAndDiseaseAndDept2(String iswork, String patientid, String orgCode, String dept,
|
|
|
String diseaseKey, String doctorNameKey,
|
|
|
String jobTitleNameKey, String outpatientType,
|
|
|
String keyName, String workingTime, String consultStatus, String chargType, String consutlSort, String isAttention, Integer page, Integer pagesize) {
|
|
|
|
|
|
/* if(page >=1){
|
|
|
page --;
|
|
|
|
|
|
if (pagesize <= 0) {
|
|
|
pagesize = 10;
|
|
|
}*/
|
|
|
long statr = new Date().getTime();
|
|
|
String sql = "SELECT " +
|
|
|
" d.id AS \"id\", " +
|
|
|
" d.photo AS \"photo\", " +
|
|
@ -5885,13 +6235,13 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
"\td.req_fee as \"xtzxFee\"\n" +
|
|
|
"FROM\n" +
|
|
|
"\tbase_doctor t\n" +
|
|
|
"LEFT JOIN wlyy_charge_dict m ON t.twfz_charge_type = m.charge_type\n" +
|
|
|
"LEFT JOIN wlyy_charge_dict a ON t.spfz_charge_type = a.charge_type\n" +
|
|
|
"LEFT JOIN wlyy_charge_dict b ON t.spzx_charge_type = b.charge_type\n" +
|
|
|
"LEFT JOIN wlyy_charge_dict v ON t.twzx_charge_type = v.charge_type\n" +
|
|
|
"LEFT JOIN wlyy_charge_dict d ON t.xtfz_charge_type = d.charge_type\n" +
|
|
|
" LEFT JOIN wlyy_charge_dict g ON t.jyzx_charge_type = g.charge_type\n" +
|
|
|
"WHERE t.id = '"+map.get("id")+"' ";
|
|
|
"LEFT JOIN wlyy_charge_dict m ON t.twfz_charge_type = m.charge_type and m.is_del='1'\n" +
|
|
|
"LEFT JOIN wlyy_charge_dict a ON t.spfz_charge_type = a.charge_type and a.is_del='1'\n" +
|
|
|
"LEFT JOIN wlyy_charge_dict b ON t.spzx_charge_type = b.charge_type and b.is_del='1'\n" +
|
|
|
"LEFT JOIN wlyy_charge_dict v ON t.twzx_charge_type = v.charge_type and v.is_del='1'\n" +
|
|
|
"LEFT JOIN wlyy_charge_dict d ON t.xtfz_charge_type = d.charge_type and d.is_del='1'\n" +
|
|
|
" LEFT JOIN wlyy_charge_dict g ON t.jyzx_charge_type = g.charge_type and g.is_del='1'\n" +
|
|
|
"WHERE t.id = '"+map.get("id")+"'";
|
|
|
chargeDictDOLists = hibenateUtils.createSQLQuery(sqlCharge);
|
|
|
map.put("chargeTypeList",chargeDictDOLists);
|
|
|
//查询医生各项评价平均分
|
|
@ -5958,6 +6308,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
envelop.setTotalCount(count.intValue());
|
|
|
envelop.setPageSize(pagesize);
|
|
|
envelop.setCurrPage(page);
|
|
|
System.out.println("old"+(new Date().getTime()-statr));
|
|
|
return envelop;
|
|
|
}
|
|
|
/**
|
|
@ -6304,6 +6655,23 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
BasePatientDO basePatientDO = basePatientDao.findById(patient);
|
|
|
PatientMedicareCardDO patientMedicareCardDO = basePatientMedicareCardDao.findByTypeAndPatientCodeAndDel("A_01", patient, "1");
|
|
|
List<BasePatientWechatDo> patientWechatDos = patientWechatDao.findByWechatIdAndPatientId(wechatId,patient);
|
|
|
List<WlyyHospitalSysDictDO> wlyyHospitalSysDictDOS = wlyyHospitalSysDictDao.findByDictCode("White_list");
|
|
|
if (wlyyHospitalSysDictDOS!=null&&wlyyHospitalSysDictDOS.size()!=0){
|
|
|
WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyHospitalSysDictDOS.get(0);
|
|
|
String text = wlyyHospitalSysDictDO.getDictValue();
|
|
|
String str[] = text.split(",");
|
|
|
List<String> list = new ArrayList<>();
|
|
|
for (int i=0;i<str.length;i++){
|
|
|
list.add(str[i]);
|
|
|
}
|
|
|
if (list.contains(basePatientDO.getIdcard())){
|
|
|
rs.put("flag","1");
|
|
|
}else {
|
|
|
rs.put("flag","0");
|
|
|
}
|
|
|
}else {
|
|
|
rs.put("flag","0");
|
|
|
}
|
|
|
rs.put("id", patient);
|
|
|
rs.put("name", basePatientDO.getName());
|
|
|
rs.put("sex", basePatientDO.getSex());
|
|
@ -6319,6 +6687,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
rs.put("photo", basePatientDO.getPhoto());
|
|
|
rs.put("address", basePatientDO.getAddress());
|
|
|
rs.put("cardType",basePatientDO.getCardType());
|
|
|
rs.put("healthStatus","");
|
|
|
rs.put("diseaseType","");
|
|
|
if (patientMedicareCardDO != null) {
|
|
|
rs.put("ssc", patientMedicareCardDO.getCode());
|
|
|
} else {
|
|
@ -6442,10 +6812,10 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
@Autowired
|
|
|
private FileUploadService fileUploadService;
|
|
|
|
|
|
public Map<String, Object> test() throws Exception {
|
|
|
/* public Map<String, Object> test() throws Exception {
|
|
|
entranceService.MS02014(false);
|
|
|
return null;
|
|
|
}
|
|
|
}*/
|
|
|
|
|
|
public String test2(String no) throws Exception {
|
|
|
TransRequest e = new TransRequest();
|
|
@ -6616,7 +6986,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
return waitCount.toString();
|
|
|
}
|
|
|
|
|
|
public com.alibaba.fastjson.JSONArray getWaitingForVisitVideoPrescriptionByDoctor(String doctor, String wxId,String outpatientType,String keyWord) {
|
|
|
public com.alibaba.fastjson.JSONArray getWaitingForVisitVideoPrescriptionByDoctor(String doctor, String wxId,String outpatientType,String keyWord,String patientId) {
|
|
|
String condition = "";
|
|
|
if ("xm_ykyy_wx".equals(wxId)) {
|
|
|
if(flag){
|
|
@ -6669,12 +7039,17 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
sql+=" AND room.consult_type= 2 and room.reservation_type in (1,2)";
|
|
|
} else if (StringUtils.isNotBlank(outpatientType)&&"4".equalsIgnoreCase(outpatientType)) {
|
|
|
sql+=" AND room.consult_type= 2 and room.reservation_type = 3";
|
|
|
} else {
|
|
|
} else if (StringUtils.isNotBlank(outpatientType)&&"2".equalsIgnoreCase(outpatientType)) {
|
|
|
sql+=" and room.reservation_type = 2 ";
|
|
|
}else {
|
|
|
sql += " AND room.consult_type= 2 ";
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(keyWord)){
|
|
|
sql += " AND outpatient.patient_name like '%"+keyWord+"%'";
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(patientId)){
|
|
|
sql += " AND room.patient_id = '"+patientId+"'";
|
|
|
}
|
|
|
if ("xm_ykyy_wx".equals(wxId)) {
|
|
|
if(flag){
|
|
|
sql += " AND room.reservation_time >= str_to_date('" + DateUtil.dateToStrShort(new Date()) + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
|
|
@ -6698,8 +7073,8 @@ 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));
|
|
|
int patientAge = 0;
|
|
|
int patientSex = 3;
|
|
|
Integer patientAge = 0;
|
|
|
Integer patientSex = 3;
|
|
|
if (null!=outpatient.get("outPatient")){
|
|
|
BasePatientDO basePatientDO = basePatientDao.findById(outpatient.get("outPatient").toString());
|
|
|
if (null!=basePatientDO){
|
|
@ -6826,6 +7201,10 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
wlyyHttpLogDO.setCreateTime(new Date());
|
|
|
wlyyHttpLogDao.save(wlyyHttpLogDO);
|
|
|
}
|
|
|
if ("xm_zsyy_wx".equalsIgnoreCase(wechatId)&&StringUtils.isNoneBlank(wlyyOutpatientDO.getDoctor())){
|
|
|
String msgUrl="https://hlwyy.xmzsh.com/ims-wx/index.html#/returnVisit/record?outpatientId="+wlyyOutpatientDO.getId();
|
|
|
sendZsMsgFlow("OL_PAY_SUCCESS",wlyyOutpatientDO.getId(),"",msgUrl,"已支付问诊费");
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
@ -7109,31 +7488,33 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
"AND outpatient.doctor='" + doctor + "' " +
|
|
|
"AND outpatient.pay_status = 1 " +
|
|
|
"AND outpatient.outpatient_type= '" + outpatient_type + "' ";
|
|
|
if ("1".equals(outpatient_type)||"3".equals(outpatient_type)) {//复诊
|
|
|
sql = sql + " AND outpatient.type= '" + type + "' ";
|
|
|
if ("2".equals(type)) {//视频复诊才需要判断时间,
|
|
|
if (!"xm_ihealth_wx".contains(wxId)){
|
|
|
if ("1".equals(outpatient_type)||"3".equals(outpatient_type)) {//复诊
|
|
|
sql = sql + " AND outpatient.type= '" + type + "' ";
|
|
|
if ("2".equals(type)) {//视频复诊才需要判断时间,
|
|
|
if ("xm_ykyy_wx".equals(wxId)) {
|
|
|
if (flag){
|
|
|
sql += " AND outpatient.register_date is not null and outpatient.register_date >= str_to_date('" + DateUtil.dateToStrShort(new Date()) + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
|
|
|
}else {
|
|
|
sql += " AND outpatient.register_date is not null and outpatient.register_date >= to_date('" + DateUtil.dateToStrShort(new Date()) + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
|
|
|
}
|
|
|
} else {
|
|
|
sql = sql + " AND outpatient.register_date is not null AND outpatient.register_date >= '" + DateUtil.dateToStrShort(new Date()) + " 00:00:00' ";
|
|
|
}
|
|
|
}
|
|
|
} else if ("2".equals(outpatient_type)) {
|
|
|
//协同门诊也需要判断时间
|
|
|
if ("xm_ykyy_wx".equals(wxId)) {
|
|
|
if (flag){
|
|
|
sql += " AND outpatient.register_date is not null and outpatient.register_date >= str_to_date('" + DateUtil.dateToStrShort(new Date()) + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
|
|
|
}else {
|
|
|
sql += " AND outpatient.register_date is not null and outpatient.register_date >= to_date('" + DateUtil.dateToStrShort(new Date()) + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
sql = sql + " AND outpatient.register_date is not null AND outpatient.register_date >= '" + DateUtil.dateToStrShort(new Date()) + " 00:00:00' ";
|
|
|
}
|
|
|
}
|
|
|
} else if ("2".equals(outpatient_type)) {
|
|
|
//协同门诊也需要判断时间
|
|
|
if ("xm_ykyy_wx".equals(wxId)) {
|
|
|
if (flag){
|
|
|
sql += " AND outpatient.register_date is not null and outpatient.register_date >= str_to_date('" + DateUtil.dateToStrShort(new Date()) + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
|
|
|
}else {
|
|
|
sql += " AND outpatient.register_date is not null and outpatient.register_date >= to_date('" + DateUtil.dateToStrShort(new Date()) + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
sql = sql + " AND outpatient.register_date is not null AND outpatient.register_date >= '" + DateUtil.dateToStrShort(new Date()) + " 00:00:00' ";
|
|
|
}
|
|
|
}
|
|
|
logger.info("接口名称:doctorReviewConsultCount-->sql="+sql);
|
|
|
List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(sql);
|
|
@ -7599,6 +7980,12 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
patient.setPassword(MD5.md5Hex(pw + "{" + salt + "}"));
|
|
|
patient.setSalt(salt);
|
|
|
patient.setMobile(mobile);
|
|
|
String sexString =IdCardUtil.getSexForIdcard_new(idcard);
|
|
|
if (StringUtils.isNoneBlank(sexString)){
|
|
|
patient.setSex(Integer.parseInt(sexString));
|
|
|
}else {
|
|
|
patient.setSex(3);
|
|
|
}
|
|
|
patient.setDel("1");
|
|
|
patient.setEnabled(1);
|
|
|
patient.setLocked(0);
|
|
@ -8096,6 +8483,12 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
String pw = mobile.substring(mobile.length() - 6);
|
|
|
|
|
|
patient.setIdcard(archiveVO.getSfzhao());
|
|
|
String sexString =IdCardUtil.getSexForIdcard_new(archiveVO.getSfzhao());
|
|
|
if (StringUtils.isNoneBlank(sexString)){
|
|
|
patient.setSex(Integer.parseInt(sexString));
|
|
|
}else {
|
|
|
patient.setSex(3);
|
|
|
}
|
|
|
patient.setName(archiveVO.getXming0());
|
|
|
patient.setPassword(MD5.md5Hex(pw + "{" + salt + "}"));
|
|
|
patient.setSalt(salt);
|
|
@ -8619,13 +9012,13 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
}
|
|
|
logger.info("进入处方签名");
|
|
|
//处方签名
|
|
|
xzyyPrescriptionService.SOF_SignDataWithExtraInfo(wlyyPrescriptionDO);
|
|
|
String baseSign=xzyyPrescriptionService.SOF_SignDataWithExtraInfo(wlyyPrescriptionDO);
|
|
|
//同步电子病历
|
|
|
WlyyPrescriptionEmrDO prescriptionEmrDO = prescriptionEmrDao.findEmrByPrescriptionId(prescriptionId);
|
|
|
try {
|
|
|
if (prescriptionEmrDO != null) {
|
|
|
logger.info("电子病历同步");
|
|
|
xzzxEntranceService.saveEmrToEntrance(prescriptionId);
|
|
|
xzzxEntranceService.saveEmrToEntrance(prescriptionId,baseSign);
|
|
|
logger.info("电子病历同步");
|
|
|
logger.info("电子病历签名");
|
|
|
xzyyPrescriptionService.SOF_SignDataWithExtraInfoEmr(wlyyPrescriptionDO);
|
|
@ -9172,7 +9565,12 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public net.sf.json.JSON outpatient(String patient) throws Exception {
|
|
|
public net.sf.json.JSON outpatient(String patient,String doctorId) throws Exception {
|
|
|
try {
|
|
|
baseOperateLogService.saveOperateLog(doctorId,patient,"EMR","住院病历","","");
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
PatientMappingDO mappingDO = patientMappingDao.findByPatient(patient);
|
|
|
String url = "";
|
|
|
WlyyHospitalSysDictDO wlyyHospitalSysDictDO = hospitalSysDictDao.findById("HAI_TAI_OUTPATIENT_URL");
|
|
@ -9196,6 +9594,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
XMLSerializer xmlSerializer = new XMLSerializer();
|
|
|
net.sf.json.JSON json = xmlSerializer.read(returnValue);
|
|
|
logger.info("返回json" + json);
|
|
|
|
|
|
return json;
|
|
|
}
|
|
|
|
|
@ -9510,13 +9909,20 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
* @param size
|
|
|
* @return
|
|
|
*/
|
|
|
public PageEnvelop findPatientAllPrescription(String keyName, String status, Integer page, Integer size,String patient,String isSelectDrug) {
|
|
|
public PageEnvelop findPatientAllPrescription(String keyName, String status, Integer page, Integer size,String patient,String isSelectDrug,boolean consumerflag) {
|
|
|
BasePatientDO patientDO = basePatientDao.findById(patient);
|
|
|
if (patientDO==null){
|
|
|
return PageEnvelop.getError("找不到该患者",-1);
|
|
|
}
|
|
|
StringBuffer sql = new StringBuffer(" SELECT DISTINCT b.*, c.oneself_pickup_flg,f.job_title_code,f.job_title_name FROM (SELECT a.* FROM wlyy_prescription a left join wlyy_outpatient o ON o.id=a.outpatient_id WHERE o.consumer = '");
|
|
|
StringBuffer countSql = new StringBuffer("select COUNT(DISTINCT b.id) count FROM (SELECT a.* FROM wlyy_prescription a left join wlyy_outpatient o ON o.id=a.outpatient_id WHERE o.consumer = '");
|
|
|
/*if (consumerflag){
|
|
|
sql.append(" WHERE o.consumer = '");
|
|
|
countSql.append(" WHERE o.consumer = '");
|
|
|
}else{
|
|
|
sql.append(" WHERE o.patient = '");
|
|
|
countSql.append(" WHERE o.patient = '");
|
|
|
}*/
|
|
|
sql.append(patient).append("') b 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(patient).append("') b 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.isNoneBlank(isSelectDrug)){
|
|
@ -9563,14 +9969,14 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
" b.doctor_name LIKE '%" + keyName + "%' " +
|
|
|
" OR b.dept_name LIKE'%" + keyName + "%' " +
|
|
|
" OR b.hospital_name LIKE '%" + keyName + "%' " +
|
|
|
" OR d.drug_name LIKE '%" + keyName + "%' " +
|
|
|
" OR m.drug_name LIKE '%" + keyName + "%' " +
|
|
|
" OR b.real_order LIKE '%" + keyName + "%' " +
|
|
|
")");
|
|
|
countSql.append(" and (" +
|
|
|
" b.doctor_name LIKE '%" + keyName + "%' " +
|
|
|
" OR b.dept_name LIKE'%" + keyName + "%' " +
|
|
|
" OR b.hospital_name LIKE '%" + keyName + "%' " +
|
|
|
" OR d.drug_name LIKE '%" + keyName + "%' " +
|
|
|
" OR m.drug_name LIKE '%" + keyName + "%' " +
|
|
|
" OR b.real_order LIKE '%" + keyName + "%' " +
|
|
|
")");
|
|
|
}
|
|
@ -9954,13 +10360,14 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
return envelop;
|
|
|
}
|
|
|
//应声开具处方管理
|
|
|
public MixEnvelop prescriptionManage(String keyWord,String doctorId,String startTime,String endTime,String checkStatus,Integer page,Integer pageSize){
|
|
|
public MixEnvelop prescriptionManage(String keyWord,String doctorId,String startTime,String endTime,String checkStatus,String status,Integer page,Integer pageSize){
|
|
|
String sql = " select p.create_time as \"createTime\"," +
|
|
|
" p.patient_name as \"patientName\"," +
|
|
|
" o.idcard as \"idcard\"," +
|
|
|
" o.card_no as \"cardNo\"," +
|
|
|
" p.check_status as \"checkStatus\"," +
|
|
|
" p.id as \"id\"," +
|
|
|
" p.status as \"status\"," +
|
|
|
" p.check_reason as \"checkReason\" " +
|
|
|
" from wlyy_prescription p left join wlyy_outpatient o on p.outpatient_id = o.id" +
|
|
|
" where 1=1 ";
|
|
@ -9973,6 +10380,16 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
}else {
|
|
|
sql+=" and p.check_status != 4";
|
|
|
}
|
|
|
if(StringUtils.isNotBlank(status)){
|
|
|
if ("0".equalsIgnoreCase(status)){
|
|
|
sql+=" and p.status = 20";
|
|
|
}else if ("-4".equalsIgnoreCase(status)){
|
|
|
sql+=" and p.status = -4";
|
|
|
} else {
|
|
|
sql+=" and p.status > 20";
|
|
|
}
|
|
|
|
|
|
}
|
|
|
if(StringUtils.isNotBlank(doctorId)){
|
|
|
sql+=" and p.doctor = '"+doctorId+"'";
|
|
|
}
|
|
@ -10068,13 +10485,61 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
prescriptionDO.setStatus(-1);
|
|
|
prescriptionDO.setCheckStatus(4);
|
|
|
prescriptionDO.setCheckReason("已删除");
|
|
|
if("xm_zsyy_wx".equalsIgnoreCase(wechatId)){
|
|
|
/*prescriptionDao.updateCheckStatus(prescriptionId,2,reason,20);*/
|
|
|
logger.info("作废处方开始" + prescriptionDO.getCheckStatus());
|
|
|
WlyyHttpLogDO wlyyHttpLogDO = new WlyyHttpLogDO();
|
|
|
WlyyOutpatientDO outpatientDO = outpatientDao.findById(prescriptionDO.getOutpatientId());
|
|
|
DoctorMappingDO doctorMappingDO = doctorMappingService.findMappingCode(outpatientDO.getDoctor(), outpatientDO.getHospital());
|
|
|
List<WlyyPrescriptionInfoDO> infoDOS = prescriptionInfoDao.findByPrescriptionId(prescriptionId, 1);
|
|
|
List<WlyyInspectionDO> inspectionDOS = wlyyInspectionDao.findByPrescriptionId(prescriptionId, 1);
|
|
|
List<WlyyPrescriptionDiagnosisDO> prescriptionDiagnosisDOS = prescriptionDiagnosisDao.findByPrescriptionId(prescriptionId,1);
|
|
|
List<WlyyPrescriptionExpressageDO> expressageDOS = prescriptionExpressageDao.findByOutpatientId(outpatientDO.getId());
|
|
|
com.alibaba.fastjson.JSONArray jsonData = new com.alibaba.fastjson.JSONArray();
|
|
|
for (WlyyPrescriptionInfoDO info : infoDOS) {
|
|
|
//设置his药品查询条件
|
|
|
setInfoJsonParam(jsonData, doctorMappingDO, outpatientDO, prescriptionDO, info, outpatientDO.getIcd10());
|
|
|
}
|
|
|
for (WlyyInspectionDO ins : inspectionDOS) {
|
|
|
//设置his药品查询条件
|
|
|
setInspectionParam(jsonData, doctorMappingDO, outpatientDO, prescriptionDO, ins, outpatientDO.getIcd10());
|
|
|
}
|
|
|
if (expressageDOS!=null&&expressageDOS.size()!=0){
|
|
|
WlyyPrescriptionExpressageDO prescriptionExpressageDO = expressageDOS.get(0);
|
|
|
if (prescriptionExpressageDO!=null&&prescriptionExpressageDO.getOneselfPickupFlg()==0){
|
|
|
for (int i=0;i<jsonData.size();i++){
|
|
|
com.alibaba.fastjson.JSONObject object = jsonData.getJSONObject(i);
|
|
|
object.put("selfDelivered",0);
|
|
|
}
|
|
|
}else if (prescriptionExpressageDO!=null&&prescriptionExpressageDO.getOneselfPickupFlg()==1){
|
|
|
for (int i=0;i<jsonData.size();i++){
|
|
|
com.alibaba.fastjson.JSONObject object = jsonData.getJSONObject(i);
|
|
|
object.put("selfDelivered",1);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
try {
|
|
|
net.sf.json.JSONObject jsonObject = entranceService.BS10112(jsonData.toJSONString(), demoFlag);
|
|
|
wlyyHttpLogDO.setResponse(jsonObject.toString());
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
return "作废失败";
|
|
|
}
|
|
|
wlyyHttpLogDO.setRequest(jsonData.toJSONString());
|
|
|
wlyyHttpLogDO.setName("作废处方");
|
|
|
wlyyHttpLogDO.setCreateTime(new Date());
|
|
|
wlyyHttpLogDO.setCode(outpatientDO.getId());
|
|
|
wlyyHttpLogDao.save(wlyyHttpLogDO);
|
|
|
}
|
|
|
|
|
|
prescriptionDO.setStatus(-4);
|
|
|
prescriptionDO.setDisableTime(new Date());
|
|
|
prescriptionDO.setCheckStatus(5);
|
|
|
prescriptionDO.setCheckReason("已作废");
|
|
|
prescriptionDao.save(prescriptionDO);
|
|
|
return "删除成功";
|
|
|
return "已作废";
|
|
|
}else {
|
|
|
return "删除失败";
|
|
|
return "作废失败";
|
|
|
}
|
|
|
}
|
|
|
|
|
@ -10331,6 +10796,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
chargeDictDO.setReqFee(twPrcie1);
|
|
|
chargeDictDO.setChargeType(twPrcie+"");
|
|
|
chargeDictDO.setChargeName(twPrcie+"");
|
|
|
chargeDictDO.setIsDel("1");
|
|
|
chargeDictDO = wlyyChargeDictDao.save(chargeDictDO);
|
|
|
}
|
|
|
doctorDO.setTwzxChargeType(chargeDictDO.getChargeType());
|
|
@ -10368,6 +10834,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
chargeDictDO.setReqFee(spPrcie1);
|
|
|
chargeDictDO.setChargeType(spPrcie+"");
|
|
|
chargeDictDO.setChargeName(spPrcie+"");
|
|
|
chargeDictDO.setIsDel("1");
|
|
|
chargeDictDO = wlyyChargeDictDao.save(chargeDictDO);
|
|
|
}
|
|
|
doctorDO.setSpzxChargeType(chargeDictDO.getChargeType());
|
|
@ -10447,6 +10914,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
chargeDictDO.setReqFee(price1);
|
|
|
chargeDictDO.setChargeType(price + "");
|
|
|
chargeDictDO.setChargeName(price + "");
|
|
|
chargeDictDO.setIsDel("1");
|
|
|
chargeDictDO = wlyyChargeDictDao.save(chargeDictDO);
|
|
|
}
|
|
|
doctorDO.setTwzxChargeType(chargeDictDO.getChargeType());
|
|
@ -10466,6 +10934,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
chargeDictDO.setReqFee(price1);
|
|
|
chargeDictDO.setChargeType(price + "");
|
|
|
chargeDictDO.setChargeName(price + "");
|
|
|
chargeDictDO.setIsDel("1");
|
|
|
chargeDictDO = wlyyChargeDictDao.save(chargeDictDO);
|
|
|
}
|
|
|
doctorDO.setSpzxChargeType(chargeDictDO.getChargeType());
|
|
@ -11685,7 +12154,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
}
|
|
|
}
|
|
|
|
|
|
sql += " order by t.appointment_time desc ";
|
|
|
sql += " order by t.create_time desc ";
|
|
|
List<Map<String, Object>> list = hibenateUtils.createSQLQuery(sql, page, pageSize);
|
|
|
List<Map<String, Object>> listCount = hibenateUtils.createSQLQuery(sql);
|
|
|
logger.info("查询数据" + sql);
|
|
@ -11779,17 +12248,14 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
.build())
|
|
|
.build())
|
|
|
.build();
|
|
|
if (extras.get("outpatientId")!=null){
|
|
|
|
|
|
}
|
|
|
try {
|
|
|
PushResult result = jPushClient.sendPush(payload);
|
|
|
logger.info("极光推送返回日志==="+result);
|
|
|
WlyyHttpLogDO httpLogDO = new WlyyHttpLogDO();
|
|
|
httpLogDO.setCode("JPUSH");
|
|
|
httpLogDO.setCreateTime(new Date());
|
|
|
/*httpLogDO.setRequest(jsonObject.toJSONString());
|
|
|
httpLogDO.setResponse(result);*/
|
|
|
httpLogDO.setRequest(extras==null?"":extras.toString());
|
|
|
httpLogDO.setResponse(result==null?"":result.toString());
|
|
|
wlyyHttpLogDao.save(httpLogDO);
|
|
|
logger.info("Got result - " + result);
|
|
|
} catch (APIConnectionException e) {
|
|
@ -12000,6 +12466,52 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
jsonObject.put("type",32);
|
|
|
jsonObject.put("id",prescriptionId);
|
|
|
jsonObject.put("outpatientId",wlyyOutpatientDO.getId());
|
|
|
}else if("remind_doctor_pickup".equalsIgnoreCase(templateCode)){//接诊下消息提醒
|
|
|
BaseJpushTemplateDO baseJpushTemplateDO = baseJpushTemplateDao.findByCode(templateCode);
|
|
|
if(baseJpushTemplateDO!=null){
|
|
|
if ("1".equalsIgnoreCase(wlyyOutpatientDO.getOutpatientType())&&"1".equalsIgnoreCase(wlyyOutpatientDO.getType())){
|
|
|
content = baseJpushTemplateDO.getPushContent().replace("{{咨询类型}}","图文复诊").replace("{{患者姓名}}",wlyyOutpatientDO.getPatientName());
|
|
|
title=baseJpushTemplateDO.getPushHeader().replace("{{咨询类型}}","图文复诊接诊提醒");
|
|
|
jsonObject.put("type",51);
|
|
|
jsonObject.put("patientName",wlyyOutpatientDO.getPatientName());
|
|
|
}else if ("1".equalsIgnoreCase(wlyyOutpatientDO.getOutpatientType())&&"2".equalsIgnoreCase(wlyyOutpatientDO.getType())){
|
|
|
content = baseJpushTemplateDO.getPushContent().replace("{{咨询类型}}","视频复诊").replace("{{患者姓名}}",wlyyOutpatientDO.getPatientName());
|
|
|
content+= "视频复诊预约时间为:"+wlyyOutpatientDO.getRegisterDate();
|
|
|
title=baseJpushTemplateDO.getPushHeader().replace("{{咨询类型}}","视频复诊接诊提醒");
|
|
|
jsonObject.put("type",52);
|
|
|
jsonObject.put("patientName",wlyyOutpatientDO.getPatientName());
|
|
|
}else if ("3".equalsIgnoreCase(wlyyOutpatientDO.getOutpatientType())&&"1".equalsIgnoreCase(wlyyOutpatientDO.getType())){
|
|
|
content = baseJpushTemplateDO.getPushContent().replace("{{咨询类型}}","图文咨询").replace("{{患者姓名}}",wlyyOutpatientDO.getPatientName());
|
|
|
title=baseJpushTemplateDO.getPushHeader().replace("{{咨询类型}}","图文咨询接诊提醒");
|
|
|
jsonObject.put("type",58);
|
|
|
jsonObject.put("patientName",wlyyOutpatientDO.getPatientName());
|
|
|
}else if ("3".equalsIgnoreCase(wlyyOutpatientDO.getOutpatientType())&&"2".equalsIgnoreCase(wlyyOutpatientDO.getType())){
|
|
|
content = baseJpushTemplateDO.getPushContent().replace("{{咨询类型}}","视频咨询").replace("{{患者姓名}}",wlyyOutpatientDO.getPatientName());
|
|
|
title=baseJpushTemplateDO.getPushHeader().replace("{{咨询类型}}","视频咨询接诊提醒");
|
|
|
content+= "视频咨询预约时间为:"+wlyyOutpatientDO.getRegisterDate();
|
|
|
jsonObject.put("type",57);
|
|
|
jsonObject.put("patientName",wlyyOutpatientDO.getPatientName());
|
|
|
}else if ("2".equalsIgnoreCase(wlyyOutpatientDO.getOutpatientType())){
|
|
|
content = baseJpushTemplateDO.getPushContent().replace("{{咨询类型}}","协同复诊").replace("{{患者姓名}}",wlyyOutpatientDO.getPatientName());
|
|
|
title=baseJpushTemplateDO.getPushHeader().replace("{{咨询类型}}","协同复诊接诊提醒");
|
|
|
jsonObject.put("type",53);
|
|
|
jsonObject.put("patientName",wlyyOutpatientDO.getPatientName());
|
|
|
}else if ("3".equalsIgnoreCase(wlyyOutpatientDO.getOutpatientType())&&"3".equalsIgnoreCase(wlyyOutpatientDO.getType())){
|
|
|
content = baseJpushTemplateDO.getPushContent().replace("{{咨询类型}}","家医咨询").replace("{{患者姓名}}",wlyyOutpatientDO.getPatientName());
|
|
|
title=baseJpushTemplateDO.getPushHeader().replace("{{咨询类型}}","家医咨询接诊提醒");
|
|
|
jsonObject.put("type",55);
|
|
|
jsonObject.put("patientName",wlyyOutpatientDO.getPatientName());
|
|
|
}
|
|
|
String sex = IdCardUtil.getSexNameForIdcard_new(wlyyOutpatientDO.getIdcard());
|
|
|
Integer age = IdCardUtil.getAgeForIdcard(wlyyOutpatientDO.getIdcard());
|
|
|
Long createTime = wlyyOutpatientDO.getCreateTime().getTime();
|
|
|
Long nowTime = new Date().getTime();
|
|
|
Long minusts = TimeUnit.MILLISECONDS.toMinutes(nowTime - createTime);
|
|
|
content = content.replace("{{性别年龄}}",sex+age+"岁").replace("{{等待时间}}",minusts.toString());
|
|
|
}
|
|
|
userId = wlyyOutpatientDO.getDoctor();
|
|
|
jsonObject.put("id",wlyyOutpatientDO.getId());
|
|
|
isDoctor="1";
|
|
|
}
|
|
|
|
|
|
return jPushMessage(isDoctor,userId,content,title,jsonObject);
|
|
@ -12143,4 +12655,36 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
}
|
|
|
|
|
|
|
|
|
/*public void testHikar(){
|
|
|
try{
|
|
|
MBeanServer mBeanServer = ManagementFactory.getPlatformMBeanServer();
|
|
|
ObjectName poolName = new ObjectName("com.zaxxer.hikari:type=Pool (" + dataSource.getPoolName() + ")");
|
|
|
HikariPoolMXBean poolProxy = JMX.newMXBeanProxy(mBeanServer, poolName, HikariPoolMXBean.class);
|
|
|
if(poolProxy == null) {
|
|
|
System.out.println("Hikari not initialized,please wait...");
|
|
|
}else {
|
|
|
System.out.println("HikariPoolState = "
|
|
|
+ "Active=[" + String.valueOf(poolProxy.getActiveConnections() + "] "
|
|
|
+ "Idle=[" + String.valueOf(poolProxy.getIdleConnections() + "] "
|
|
|
+ "Wait=["+poolProxy.getThreadsAwaitingConnection()+"] "
|
|
|
+ "Total=["+poolProxy.getTotalConnections()+"]")));
|
|
|
}
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
|
|
|
}*/
|
|
|
public String findDomainUrlInDict(){
|
|
|
try {
|
|
|
WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyHospitalSysDictDao.findById("domainUrl");
|
|
|
if (wlyyHospitalSysDictDO!=null){
|
|
|
return wlyyHospitalSysDictDO.getDictValue();
|
|
|
}else {
|
|
|
return "";
|
|
|
}
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
return "";
|
|
|
}
|
|
|
}
|
|
|
}
|