|
@ -431,7 +431,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
* @param outpatientId
|
|
|
* @return
|
|
|
*/
|
|
|
public com.alibaba.fastjson.JSONObject findReOutpatientInfo(String outpatientId,String prescriptionId){
|
|
|
public com.alibaba.fastjson.JSONObject findReOutpatientInfo(String outpatientId,String prescriptionId) throws Exception {
|
|
|
com.alibaba.fastjson.JSONObject rs = new com.alibaba.fastjson.JSONObject();
|
|
|
|
|
|
//复诊信息
|
|
@ -476,8 +476,9 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
List<WlyyInspectionVO> inspectionVOs = new ArrayList<>();
|
|
|
vo.setInspectionVOs(convertToModels(wlyyInspectionDao.findByPrescriptionId(vo.getId(),1),inspectionVOs,WlyyInspectionVO.class));
|
|
|
|
|
|
WlyyPrescriptionEmrDO wlyyPrescriptionEmrDO = readOutPatientXml(outpatientDO.getOriginRegisterNo());
|
|
|
//电子病历
|
|
|
vo.setWlyyPrescriptionEmrDO(prescriptionEmrDao.findEmrByPrescriptionId(vo.getId()));
|
|
|
vo.setWlyyPrescriptionEmrDO(wlyyPrescriptionEmrDO);
|
|
|
}
|
|
|
}
|
|
|
rs.put("prescriptions",prescriptionVOs);
|
|
@ -2958,6 +2959,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
rs.put("doctorAge","");
|
|
|
}
|
|
|
rs.put("doctor",doctorDO.getName());
|
|
|
rs.put("fee",doctorDO.getFee());
|
|
|
rs.put("jobTitleCode",doctorDO.getJobTitleCode());
|
|
|
rs.put("jobTitleName",doctorDO.getJobTitleName());
|
|
|
rs.put("chargeType",doctorDO.getChargeType());
|
|
@ -3014,12 +3016,12 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
rs.put("registerCount",0);
|
|
|
}
|
|
|
//医生问诊量
|
|
|
// List<WlyyOutpatientDO> wlyyOutpatientDOs = outpatientDao.findByDoctorAndStatus(doctor,"2");
|
|
|
// if(wlyyOutpatientDOs!=null&&wlyyOutpatientDOs.size()>0){
|
|
|
// rs.put("outpatientCount",wlyyOutpatientDOs.size());
|
|
|
// }else{
|
|
|
// rs.put("outpatientCount",0);
|
|
|
// }
|
|
|
List<WlyyOutpatientDO> wlyyOutpatientDOs = outpatientDao.findByDoctorList(doctor);
|
|
|
if(wlyyOutpatientDOs!=null&&wlyyOutpatientDOs.size()>0){
|
|
|
rs.put("outpatientCount",wlyyOutpatientDOs.size());
|
|
|
}else{
|
|
|
rs.put("outpatientCount",0);
|
|
|
}
|
|
|
//
|
|
|
// //协同门诊量
|
|
|
// Integer coordinationCout = outpatientDao.countByDoctorAndStatusAndOutpatientType(doctor,"2","2");
|
|
@ -4337,6 +4339,62 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
|
|
|
return list;
|
|
|
}
|
|
|
|
|
|
public String generalDoctorWaitingNumber(String doctor,String wxId,String outpatientId){
|
|
|
String condition = "";
|
|
|
if("xm_ykyy_wx".equals(wxId)){
|
|
|
condition+= "to_char(room.reservation_time,'YYYY-MM-DD hh24:mi:ss') AS \"time\",";
|
|
|
condition+= "to_char(room.reservation_time,'YYYY-MM-DD') AS \"group_date\",";
|
|
|
}else{
|
|
|
condition += "date_format(room.reservation_time ,'%Y-%m-%d %H:%i:%S' ) AS \"time\",";
|
|
|
condition += "date_format(room.reservation_time ,'%Y-%m-%d' ) AS \"group_date\",";
|
|
|
}
|
|
|
String sql ="SELECT " +
|
|
|
"room.outpatient_id AS \"id\"," +
|
|
|
"room.patient_id AS \"patient_id\"," +
|
|
|
"room.patient_name AS \"name\"," +
|
|
|
"patient.sex AS \"sex\"," +
|
|
|
"patient.idcard AS \"idcard\"," +
|
|
|
"patient.photo AS \"photo\"," +
|
|
|
"patient.birthday AS \"birthday\"," +
|
|
|
"patient.mobile AS \"mobile\"," +
|
|
|
"outpatient.mobile AS \"outpatient_mobile\"," +
|
|
|
"room.consult_type AS \"consult_type\"," +condition+
|
|
|
"room.reservation_type AS \"reservation_type\"," +
|
|
|
"outpatient.disease_img AS \"disease_img\"," +
|
|
|
"outpatient.description AS \"description\"," +
|
|
|
"outpatient.origin_con_no AS \"origin_con_no\", " +
|
|
|
"room.reservation_type AS \"reservation_type\" " +
|
|
|
"FROM " +
|
|
|
"wlyy_hospital_waiting_room room," +
|
|
|
"base_patient patient," +
|
|
|
"wlyy_outpatient outpatient " +
|
|
|
"WHERE " +
|
|
|
"room.patient_id=patient.id " +
|
|
|
"AND room.outpatient_id=outpatient.id " +
|
|
|
"AND outpatient.status = 0 " +
|
|
|
"AND outpatient.pay_status = 1 " +
|
|
|
"AND room.doctor='"+doctor+"' " +
|
|
|
"AND room.reservation_time is not null " +
|
|
|
"AND room.consult_type= 2 ";/* +
|
|
|
"AND room.reservation_time >= '"+DateUtil.dateToStrShort(new Date())+" 00:00:00' order by room.reservation_time ASC ";
|
|
|
// "AND room.reservation_time>='"+DateUtil.getStringDate("yyyy-MM-dd")+" 00:00:00"+"' ";*/
|
|
|
|
|
|
if("xm_ykyy_wx".equals(wxId)){
|
|
|
sql+=" AND room.reservation_time >= to_date('"+DateUtil.dateToStrShort(new Date())+" 00:00:00','YYYY-MM-DD HH24:MI:SS')";
|
|
|
}else {
|
|
|
sql +=" AND room.reservation_time >= '"+DateUtil.dateToStrShort(new Date())+" 00:00:00' ";
|
|
|
}
|
|
|
sql+=" order by room.reservation_time ASC ";
|
|
|
List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
|
|
|
Integer waitCount =1;
|
|
|
for (Map<String,Object> map:list){
|
|
|
if (!map.get("id").toString().equalsIgnoreCase(outpatientId)){
|
|
|
waitCount+=1;
|
|
|
}
|
|
|
}
|
|
|
return waitCount.toString();
|
|
|
}
|
|
|
|
|
|
public com.alibaba.fastjson.JSONArray getWaitingForVisitVideoPrescriptionByDoctor(String doctor,String wxId) {
|
|
|
String condition = "";
|
|
@ -5167,7 +5225,11 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
|
|
|
return rs;
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 查询医生所有可抢单的数量
|
|
|
* @param doctor
|
|
@ -5536,7 +5598,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
}
|
|
|
|
|
|
public void followOrgByPatient(String patientid, String doctorid, String type) {
|
|
|
List<BaseDoctorPatientFollowDO> list =baseOrgPatientDao.findByDoctorAndPatient(patientid,doctorid);
|
|
|
List<BaseDoctorPatientFollowDO> list =baseOrgPatientDao.findByDoctorAndPatient(doctorid,patientid);
|
|
|
if("1".equals(type)){//关注
|
|
|
if(list.isEmpty()){
|
|
|
BaseDoctorPatientFollowDO baseOrgPatientFollowDO = new BaseDoctorPatientFollowDO();
|
|
@ -5544,13 +5606,14 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
baseOrgPatientFollowDO.setPatient(patientid);
|
|
|
baseOrgPatientDao.save(baseOrgPatientFollowDO);
|
|
|
}
|
|
|
}else if("0".equals(type)){//取消关注
|
|
|
}
|
|
|
if("0".equals(type)){//取消关注
|
|
|
if(!list.isEmpty()){
|
|
|
for (BaseDoctorPatientFollowDO baseOrgPatientFollowDO:list){
|
|
|
baseOrgPatientDao.delete(baseOrgPatientFollowDO.getId());
|
|
|
}
|
|
|
}
|
|
|
}else{}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public List<Map<String,Object>> findDeptByKeyWord(String keyWord,Integer page,Integer pagesize) {
|
|
@ -5780,6 +5843,11 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
setInspectionParam(jsonData, doctorMappingDO, outpatientDO, wlyyPrescriptionDO, ins, outpatientDO.getIcd10());
|
|
|
}
|
|
|
Map<String,Object> map = sendHisDiagnosis(jsonData, outpatientDO, wlyyPrescriptionDO);
|
|
|
//同步电子病历
|
|
|
WlyyPrescriptionEmrDO prescriptionEmrDO = prescriptionEmrDao.findEmrByPrescriptionId(prescriptionId);
|
|
|
if (prescriptionEmrDO!=null){
|
|
|
writeOutPatient(outpatientDO.getRegisterNo(),prescriptionEmrDO.getComplaint(),prescriptionEmrDO.getMedicalHistory(),prescriptionEmrDO.getPastHistory(),prescriptionEmrDO.getPhysicalExamination(),prescriptionEmrDO.getAssistExamination());
|
|
|
}
|
|
|
if (map.get("code").toString().equalsIgnoreCase("0")){
|
|
|
// * @param applyDepaName @param applyDoctorName
|
|
|
WlyyPrescriptionDO prescriptionDO = prescriptionDao.findOne(prescriptionId);
|
|
@ -5801,8 +5869,11 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
if (patientMappingDO!=null){
|
|
|
userNo = patientMappingDO.getMappingCode();
|
|
|
}
|
|
|
PatientMedicareCardDO patientMedicareCardDO = patientMedicareCardDao.findByTypeAndPatientCodeAndDel("A_01",patientCode,"1");
|
|
|
ylzPayService.msgPush("01",patientMedicareCardDO.getCode(),"01",patientDO.getMobile(),"03",userNo,userName,idcard,realerOrder,applyDepaName,applyDoctorName,recipeTime,free,"1");
|
|
|
String cardNo = null;
|
|
|
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");
|
|
|
}
|
|
|
//sendHisDiagnosis(jsonData, outpatientDO, wlyyPrescriptionDO);
|
|
|
|
|
@ -6172,7 +6243,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public String readOutPatientXml(String registerSn) throws Exception {
|
|
|
public WlyyPrescriptionEmrDO readOutPatientXml(String registerSn) throws Exception {
|
|
|
WlyyPrescriptionEmrDO wlyyPrescriptionEmrDO = new WlyyPrescriptionEmrDO();
|
|
|
String url = "";
|
|
|
WlyyHospitalSysDictDO wlyyHospitalSysDictDO = hospitalSysDictDao.findById("HAI_TAI_URL");
|
|
|
if (wlyyHospitalSysDictDO!=null){
|
|
@ -6181,7 +6253,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
String xmlStr = "<?xml version=\"1.0\" encoding=\"GBK\"?>\n" +
|
|
|
"<HtRequest>\n";
|
|
|
xmlStr+="<REGISTER_SN>"+registerSn+"</REGISTER_SN>";
|
|
|
String reqTime = DateUtil.dateToStr(new Date(),"yyyyMMddHHmmssSSS");
|
|
|
xmlStr+="<SEARCH_IDS>CHIEF_COMPLAINT,HPI,ELAPSEMHIS,BODYCHECK,ASSISTANTCHECK</SEARCH_IDS>";
|
|
|
String reqTime = DateUtil.dateToStr(new Date(),"yyyyMMddHHmmss");
|
|
|
xmlStr+="<REQ_TIME>"+reqTime+"</REQ_TIME>";
|
|
|
xmlStr+="</HtRequest>";
|
|
|
String returnValue = "";
|
|
@ -6197,8 +6270,13 @@ 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.toString();
|
|
|
com.alibaba.fastjson.JSONObject object = com.alibaba.fastjson.JSONObject.parseObject(json.toString());
|
|
|
wlyyPrescriptionEmrDO.setComplaint(object.getString("CHIEF_COMPLAINT"));
|
|
|
wlyyPrescriptionEmrDO.setMedicalHistory(object.getString("HPI"));
|
|
|
wlyyPrescriptionEmrDO.setPastHistory(object.getString("ELAPSEMHIS"));
|
|
|
wlyyPrescriptionEmrDO.setPhysicalExamination(object.getString("BODYCHECK"));
|
|
|
wlyyPrescriptionEmrDO.setAssistExamination(object.getString("ASSISTANTCHECK"));
|
|
|
return wlyyPrescriptionEmrDO;
|
|
|
}
|
|
|
|
|
|
public String writeOutPatient(String registerSn,String chiefComplaint,String hpi,String elapsemhis,String bodycheck,String assistanTcheck) throws Exception {
|
|
@ -6210,7 +6288,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
String xmlStr = "<?xml version=\"1.0\" encoding=\"GBK\"?>\n" +
|
|
|
"<HtRequest>\n";
|
|
|
xmlStr+="<REGISTER_SN>"+registerSn+"</REGISTER_SN>";
|
|
|
String reqTime = DateUtil.dateToStr(new Date(),"yyyyMMddHHmmssSSS");
|
|
|
String reqTime = DateUtil.dateToStr(new Date(),"yyyyMMddHHmmss");
|
|
|
xmlStr+="<REQ_TIME>"+reqTime+"</REQ_TIME>";
|
|
|
xmlStr+="<OUTPATIENT_INFO>";
|
|
|
xmlStr+="<CHIEF_COMPLAINT>"+chiefComplaint+"</CHIEF_COMPLAINT>";
|
|
@ -6516,7 +6594,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
}
|
|
|
|
|
|
|
|
|
public MixEnvelop selectByUrl(String prescriptionId,String wxId) throws Exception {
|
|
|
public MixEnvelop selectByUrl(String oupatientId,String prescriptionId,String wxId) throws Exception {
|
|
|
WxWechatDO wxWechatDO = wechatDao.findById(wxId);
|
|
|
if (wxWechatDO==null){
|
|
|
throw new Exception("微信配置不存在!");
|
|
@ -6530,11 +6608,16 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
throw new Exception("openid不存在!");
|
|
|
}
|
|
|
BasePatientWechatDo patientWechatDo = patientWechatDos.get(0);
|
|
|
PatientMedicareCardDO patientMedicareCardDO = patientMedicareCardDao.findByTypeAndPatientCodeAndDel("A_01",prescriptionDO.getPatientCode(),"1");
|
|
|
if (patientMedicareCardDO==null){
|
|
|
|
|
|
WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(oupatientId);
|
|
|
String idcard=null;
|
|
|
if (wlyyOutpatientDO!=null){
|
|
|
idcard=wlyyOutpatientDO.getCardNo();
|
|
|
}
|
|
|
if (!StringUtils.isNoneBlank(idcard)){
|
|
|
throw new Exception("就诊卡不存在!");
|
|
|
}
|
|
|
String url = ylzPayService.createSicardPayUrl(wxWechatDO.getAppOriginId(),patientWechatDo.getOpenid(),patientMedicareCardDO.getCode(),"WX");
|
|
|
String url = ylzPayService.createSicardPayUrl(wxWechatDO.getAppOriginId(),patientWechatDo.getOpenid(),idcard,"WX");
|
|
|
com.alibaba.fastjson.JSONObject object = com.alibaba.fastjson.JSONObject.parseObject(url);
|
|
|
return MixEnvelop.getSuccess(IotRequestMapping.Common.message_success_find,object);
|
|
|
}
|