|
@ -70,8 +70,12 @@ import com.ylzinfo.ehc.trans.TransResponse;
|
|
|
import jxl.write.*;
|
|
|
import net.sf.json.JSONArray;
|
|
|
import net.sf.json.JSONObject;
|
|
|
import net.sf.json.xml.XMLSerializer;
|
|
|
import org.apache.commons.collections.map.HashedMap;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.jsoup.Jsoup;
|
|
|
import org.jsoup.nodes.Document;
|
|
|
import org.jsoup.select.Elements;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@ -489,10 +493,10 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
* @param size
|
|
|
* @return
|
|
|
*/
|
|
|
public MixEnvelop findPrescriptionList(String patient, String status,String startTime, String endTime, Integer page, Integer size){
|
|
|
public MixEnvelop findPrescriptionList(String patient, String status,String startTime, String endTime, Integer page, Integer size,String wxId){
|
|
|
|
|
|
String totalSql ="SELECT " +
|
|
|
" count(1) AS total " +
|
|
|
" count(1) AS \"total\" " +
|
|
|
" FROM " +
|
|
|
" wlyy_prescription p ";
|
|
|
totalSql += " WHERE 1=1 ";
|
|
@ -503,10 +507,20 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
totalSql+=" AND p.status IN ("+status+")";
|
|
|
}
|
|
|
if(StringUtils.isNotBlank(startTime)){
|
|
|
totalSql += " AND create_time >='"+startTime+" 00:00:00'";
|
|
|
if("xm_ykyy_wx".equals(wxId)){
|
|
|
totalSql +=" and create_time >= to_date('"+startTime+" 00:00:00','YYYY-MM-DD HH24:MI:SS')";
|
|
|
}else {
|
|
|
totalSql += " AND create_time >='"+startTime+" 00:00:00'";
|
|
|
}
|
|
|
|
|
|
}
|
|
|
if(StringUtils.isNotBlank(endTime)){
|
|
|
totalSql += " AND create_time <='"+endTime+" 23:59:59'";
|
|
|
if("xm_ykyy_wx".equals(wxId)){
|
|
|
totalSql +=" and create_time <= to_date('"+startTime+" 23:59:59','YYYY-MM-DD HH24:MI:SS')";
|
|
|
}else {
|
|
|
totalSql += " AND create_time <='"+endTime+" 23:59:59'";
|
|
|
}
|
|
|
|
|
|
}
|
|
|
List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(totalSql);
|
|
|
|
|
@ -516,48 +530,48 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
}
|
|
|
|
|
|
String sql ="SELECT " +
|
|
|
" p.id, " +
|
|
|
" p.real_order AS realOrder," +
|
|
|
" p.origin_real_order AS originRealOrder," +
|
|
|
" p.adm_no AS admNo," +
|
|
|
" p.origin_adm_no AS originAdmNo," +
|
|
|
" p.serial_no AS serialNo," +
|
|
|
" p.type AS type, " +
|
|
|
" p.patient_code AS patientCode, " +
|
|
|
" p.patient_name AS patientName, " +
|
|
|
" p.ssc AS ssc, " +
|
|
|
" p.doctor AS doctor, " +
|
|
|
" p.doctor_name AS doctorName, " +
|
|
|
" p.`status` AS `status`, " +
|
|
|
" p.mk_fail_reason AS mkFailReason, " +
|
|
|
" p.mk_time AS mk_time, " +
|
|
|
" p.prescribe_reason AS prescribeReason, " +
|
|
|
" p.prescribe_time AS prescribeTime, " +
|
|
|
" p.pay_time AS payTime, " +
|
|
|
" p.dosage_time AS dosageTime, " +
|
|
|
" p.finish_time AS finishTime, " +
|
|
|
" p.create_time AS createTime, " +
|
|
|
" p.dept AS dept, " +
|
|
|
" p.dept_name AS deptName, " +
|
|
|
" p.hospital AS hospital, " +
|
|
|
" p.hospital_name AS hospitalName, " +
|
|
|
" p.consult AS consult, " +
|
|
|
" p.dispensary_type AS dispensaryType, " +
|
|
|
" p.reason AS reason, " +
|
|
|
" p.remark AS remark, " +
|
|
|
" p.cancel_reason AS cancelReason, " +
|
|
|
" p.ca_cert_data AS caCertData, " +
|
|
|
" p.ca_message AS caMessage, " +
|
|
|
" p.digital_sign_no AS digitalSignNo, " +
|
|
|
" p.original_data_abstract AS originalDataAbstract, " +
|
|
|
" p.str_original_data AS strOriginalData, " +
|
|
|
" p.his_dept_code AS hisDeptCode, " +
|
|
|
" p.his_doctor_code AS hisDoctorCode, " +
|
|
|
" p.his_gister_type_code AS hisGisterTypeCode, " +
|
|
|
" p.his_rate_type_code AS hisRateTypeCode, " +
|
|
|
" p.his_hospital AS hisHospital, " +
|
|
|
" p.his_register_fee AS hisRegisterFee, " +
|
|
|
" p.pay_status AS payStatus " +
|
|
|
" p.id as \"id\", " +
|
|
|
" p.real_order AS \"realOrder\"," +
|
|
|
" p.origin_real_order AS \"originRealOrder\"," +
|
|
|
" p.adm_no AS \"admNo\"," +
|
|
|
" p.origin_adm_no AS \"originAdmNo\"," +
|
|
|
" p.serial_no AS \"serialNo\"," +
|
|
|
" p.type AS \"type\", " +
|
|
|
" p.patient_code AS \"patientCode\", " +
|
|
|
" p.patient_name AS \"patientName\", " +
|
|
|
" p.ssc AS \"ssc\", " +
|
|
|
" p.doctor AS \"doctor\", " +
|
|
|
" p.doctor_name AS \"doctorName\", " +
|
|
|
" p.status AS \"status\", " +
|
|
|
" p.mk_fail_reason AS \"mkFailReason\", " +
|
|
|
" p.mk_time AS \"mk_time\", " +
|
|
|
" p.prescribe_reason AS \"prescribeReason\", " +
|
|
|
" p.prescribe_time AS \"prescribeTime\", " +
|
|
|
" p.pay_time AS \"payTime\", " +
|
|
|
" p.dosage_time AS \"dosageTime\", " +
|
|
|
" p.finish_time AS \"finishTime\", " +
|
|
|
" p.create_time AS \"createTime\", " +
|
|
|
" p.dept AS \"dept\", " +
|
|
|
" p.dept_name AS \"deptName\", " +
|
|
|
" p.hospital AS \"hospital\", " +
|
|
|
" p.hospital_name AS \"hospitalName\", " +
|
|
|
" p.consult AS \"consult\", " +
|
|
|
" p.dispensary_type AS \"dispensaryType\", " +
|
|
|
" p.reason AS \"reason\", " +
|
|
|
" p.remark AS \"remark\", " +
|
|
|
" p.cancel_reason AS \"cancelReason\", " +
|
|
|
" p.ca_cert_data AS \"caCertData\", " +
|
|
|
" p.ca_message AS \"caMessage\", " +
|
|
|
" p.digital_sign_no AS \"digitalSignNo\", " +
|
|
|
" p.original_data_abstract AS \"originalDataAbstract\", " +
|
|
|
" p.str_original_data AS \"strOriginalData\", " +
|
|
|
" p.his_dept_code AS \"hisDeptCode\", " +
|
|
|
" p.his_doctor_code AS \"hisDoctorCode\", " +
|
|
|
" p.his_gister_type_code AS \"hisGisterTypeCode\", " +
|
|
|
" p.his_rate_type_code AS \"hisRateTypeCode\", " +
|
|
|
" p.his_hospital AS \"hisHospital\", " +
|
|
|
" p.his_register_fee AS \"hisRegisterFee\", " +
|
|
|
" p.pay_status AS \"payStatus\" " +
|
|
|
" FROM " +
|
|
|
" wlyy_prescription p " +
|
|
|
" WHERE 1=1 ";
|
|
@ -568,10 +582,18 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
sql+=" AND p.status IN ("+status+")";
|
|
|
}
|
|
|
if(StringUtils.isNotBlank(startTime)){
|
|
|
sql += " AND create_time >='"+startTime+" 00:00:00'";
|
|
|
if("xm_ykyy_wx".equals(wxId)){
|
|
|
sql +=" and create_time >= to_date('"+startTime+" 00:00:00','YYYY-MM-DD HH24:MI:SS')";
|
|
|
}else {
|
|
|
sql += " AND create_time >='"+startTime+" 00:00:00'";
|
|
|
}
|
|
|
}
|
|
|
if(StringUtils.isNotBlank(endTime)){
|
|
|
sql += " AND create_time <='"+endTime+" 23:59:59'";
|
|
|
if("xm_ykyy_wx".equals(wxId)){
|
|
|
sql +=" and create_time <= to_date('"+startTime+" 23:59:59','YYYY-MM-DD HH24:MI:SS')";
|
|
|
}else {
|
|
|
sql += " AND create_time <='"+endTime+" 23:59:59'";
|
|
|
}
|
|
|
}
|
|
|
sql += " LIMIT " + (page - 1) * size + "," + size + "";
|
|
|
List<WlyyPrescriptionVO> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper(WlyyPrescriptionVO.class));
|
|
@ -3336,14 +3358,14 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
public List<Map<String,Object>> findWaitingRoomPatient(String dept, Integer type) {
|
|
|
|
|
|
String sql ="SELECT " +
|
|
|
"patient.id AS id," +
|
|
|
"patient.name AS name," +
|
|
|
"patient.sex AS sex," +
|
|
|
"patient.idcard AS idcard," +
|
|
|
"patient.photo AS photo," +
|
|
|
"waitingroom.reservation_type AS type," +
|
|
|
"waitingroom.consult_type AS consult_type," +
|
|
|
"waitingroom.reservation_time AS reservation_time " +
|
|
|
"patient.id AS \"id\"," +
|
|
|
"patient.name AS \"name\"," +
|
|
|
"patient.sex AS \"sex\"," +
|
|
|
"patient.idcard AS \"idcard\"," +
|
|
|
"patient.photo AS \"photo\"," +
|
|
|
"waitingroom.reservation_type AS \"type\"," +
|
|
|
"waitingroom.consult_type AS \"consult_type\"," +
|
|
|
"waitingroom.reservation_time AS \"reservation_time\" " +
|
|
|
"FROM " +
|
|
|
"wlyy_hospital_waiting_room waitingroom," +
|
|
|
"base_patient patient " +
|
|
@ -3361,11 +3383,16 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
return list;
|
|
|
}
|
|
|
|
|
|
public JSONObject findWaitingRoomStatusCount(String dept) {
|
|
|
public JSONObject findWaitingRoomStatusCount(String dept,String wxId) {
|
|
|
|
|
|
String totalSql = "SELECT count(id) AS total FROM wlyy_hospital_waiting_room WHERE visit_status=1 ";
|
|
|
totalSql += " AND reservation_time >='"+DateUtil.dateToStrShort(new Date())+" 00:00:00'";
|
|
|
totalSql += " AND reservation_time <='"+DateUtil.dateToStrShort(new Date())+" 23:59:59'";
|
|
|
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')";
|
|
|
totalSql +=" and reservation_time <= to_date('"+DateUtil.dateToStrShort(new Date())+" 23:59:59','YYYY-MM-DD HH24:MI:SS')";
|
|
|
}else {
|
|
|
totalSql += " AND reservation_time >='"+DateUtil.dateToStrShort(new Date())+" 00:00:00'";
|
|
|
totalSql += " AND reservation_time <='"+DateUtil.dateToStrShort(new Date())+" 23:59:59'";
|
|
|
}
|
|
|
List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(totalSql);
|
|
|
Long count = 0L;
|
|
|
if (rstotal != null && rstotal.size() > 0) {
|
|
@ -3382,7 +3409,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
public List<JSONObject> findClinicRoomList(String dept,String date,String consult_status) {
|
|
|
public List<JSONObject> findClinicRoomList(String dept,String date,String consult_status,String wxId) {
|
|
|
if(StringUtils.isBlank(date)){
|
|
|
date = DateUtil.getStringDateShort();
|
|
|
}
|
|
@ -3421,24 +3448,30 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
}
|
|
|
|
|
|
//获取预约了今天的候诊居民
|
|
|
String waitingSql ="SELECT count(op.id) AS waitCount," +
|
|
|
"room.doctor AS doctor, " +
|
|
|
"room.doctor_name AS doctorName " +
|
|
|
String waitingSql ="SELECT count(op.id) AS \"waitCount\"," +
|
|
|
"room.doctor AS \"doctor\", " +
|
|
|
"room.doctor_name AS \"doctorName\" " +
|
|
|
"FROM wlyy_outpatient op,wlyy_hospital_waiting_room room " +
|
|
|
"WHERE op.status=0 AND room.outpatient_id=op.id AND room.consult_type=2 " +
|
|
|
"AND room.doctor IS NOT NULL ";
|
|
|
if(StringUtils.isNoneBlank(dept)){
|
|
|
waitingSql = waitingSql + " and op.dept = '"+dept+"' ";
|
|
|
}
|
|
|
waitingSql = waitingSql + "AND room.reservation_time>='"+date+" 00:00:00' AND room.reservation_time<='"+date+" 23:59:59' GROUP BY room.doctor; ";
|
|
|
|
|
|
|
|
|
if("xm_ykyy_wx".equals(wxId)){
|
|
|
waitingSql +=" AND room.reservation_time >= to_date('"+date+" 00:00:00','YYYY-MM-DD HH24:MI:SS')";
|
|
|
waitingSql +=" AND room.reservation_time <= to_date('"+date+" 23:59:59','YYYY-MM-DD HH24:MI:SS') GROUP BY room.doctor,room.doctor_name";
|
|
|
}else {
|
|
|
waitingSql = waitingSql + "AND room.reservation_time>='"+date+" 00:00:00' AND room.reservation_time<='"+date+" 23:59:59' GROUP BY room.doctor,room.doctor_name; ";
|
|
|
}
|
|
|
|
|
|
List<Map<String,Object>> waitinglist = jdbcTemplate.queryForList(waitingSql);
|
|
|
if(waitinglist!=null&&waitinglist.size()>0){
|
|
|
//根据身份证计算年龄
|
|
|
for(Map<String,Object> waitObj :waitinglist){
|
|
|
String doctor = (String) waitObj.get("doctor");
|
|
|
if(StringUtils.isNoneBlank(doctor)){
|
|
|
Long waitCount = (Long) waitObj.get("waitCount");
|
|
|
Long waitCount = Long.parseLong(waitObj.get("waitCount").toString()) ;
|
|
|
if(result.keySet().contains(doctor)){
|
|
|
result.get(doctor).put("waiting_count",waitCount);
|
|
|
}else{
|
|
@ -3461,18 +3494,21 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
|
|
|
//获取进行中的居民
|
|
|
String onlineSql ="SELECT " +
|
|
|
"room.outpatient_id AS id," +
|
|
|
"room.patient_id AS patient_id," +
|
|
|
"room.patient_name AS patient_name," +
|
|
|
"patient.sex AS sex," +
|
|
|
"patient.idcard AS idcard," +
|
|
|
"patient.photo AS photo," +
|
|
|
"patient.birthday AS birthday," +
|
|
|
"room.consult_type AS consult_type," +
|
|
|
"date_format(room.reservation_time ,'%Y-%m-%d %H:%i:%S' ) AS time," +
|
|
|
"TIMESTAMPDIFF(MINUTE, room.reservation_time,NOW()) AS time_cost," +
|
|
|
"room.doctor AS doctor, " +
|
|
|
"room.doctor_name AS doctorName " +
|
|
|
"room.outpatient_id AS \"id\"," +
|
|
|
"room.patient_id AS \"patient_id\"," +
|
|
|
"room.patient_name AS \"patient_name\"," +
|
|
|
"patient.sex AS \"sex\"," +
|
|
|
"patient.idcard AS \"idcard\"," +
|
|
|
"patient.photo AS \"photo\"," +
|
|
|
"patient.birthday AS \"birthday\"," +
|
|
|
"room.consult_type AS \"consult_type\",";
|
|
|
if("xm_ykyy_wx".equals(wxId)){
|
|
|
onlineSql = onlineSql + "to_char(room.reservation_time,'YYYY-MM-DD hh24:mi:ss') AS \"time\",ROUND(TO_NUMBER(to_date(room.reservation_time,'yyyy-mm-dd hh24:mi:ss')-sysdate ) * 24 * 60) as \"time_cost\",";
|
|
|
}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\", " +
|
|
|
"room.doctor_name AS \"doctorName\" " +
|
|
|
"FROM " +
|
|
|
"wlyy_hospital_waiting_room room," +
|
|
|
"base_patient patient," +
|
|
@ -3487,18 +3523,40 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
if(StringUtils.isNoneBlank(dept)){
|
|
|
onlineSql = onlineSql + " and outpatient.dept = '"+dept+"' ";
|
|
|
}
|
|
|
|
|
|
/*
|
|
|
onlineSql = onlineSql+ "AND room.reservation_time>='"+date+" 00:00:00' AND room.reservation_time<='"+date+" 23:59:59' GROUP BY room.doctor";
|
|
|
|
|
|
*/
|
|
|
if("xm_ykyy_wx".equalsIgnoreCase(wxId)){
|
|
|
onlineSql +=" AND room.reservation_time >= to_date('"+date+" 00:00:00','YYYY-MM-DD HH24:MI:SS')";
|
|
|
onlineSql +=" AND room.reservation_time <= to_date('"+date+" 23:59:59','YYYY-MM-DD HH24:MI:SS') ";
|
|
|
}else {
|
|
|
onlineSql = onlineSql+ "AND room.reservation_time>='"+date+" 00:00:00' AND room.reservation_time<='"+date+" 23:59:59' ";
|
|
|
}
|
|
|
List<Map<String,Object>> onlinelist = jdbcTemplate.queryForList(onlineSql);
|
|
|
if(onlinelist!=null&&onlinelist.size()>0){
|
|
|
//根据身份证计算年龄
|
|
|
for(Map<String,Object> onlineObj :onlinelist){
|
|
|
List<String> doctors = new ArrayList<>();
|
|
|
List<Map<String,Object>> onlines = new ArrayList<>();
|
|
|
for (Map<String,Object> onlineObj :onlinelist){
|
|
|
String doctor = (String) onlineObj.get("doctor");
|
|
|
if (doctors!=null&&doctors.size()!=0){
|
|
|
if (!doctors.contains(doctor)){
|
|
|
doctors.add(doctor);
|
|
|
onlines.add(onlineObj);
|
|
|
}
|
|
|
}else {
|
|
|
doctors.add(doctor);
|
|
|
onlines.add(onlineObj);
|
|
|
}
|
|
|
}
|
|
|
for(Map<String,Object> onlineObj :onlines){
|
|
|
String doctor = (String) onlineObj.get("doctor");
|
|
|
if(StringUtils.isNoneBlank(doctor)){
|
|
|
if(result.keySet().contains(doctor)){
|
|
|
result.get(doctor).put("visit_status",2);
|
|
|
result.get(doctor).put("patient_name",(String) onlineObj.get("patient_name"));
|
|
|
result.get(doctor).put("time_cost",(Long) onlineObj.get("time_cost"));
|
|
|
result.get(doctor).put("time_cost",Long.parseLong(onlineObj.get("time_cost").toString()));
|
|
|
}else{
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
jsonObject.put("id",doctor);
|
|
@ -3511,7 +3569,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
jsonObject.put("visit_status",2);
|
|
|
jsonObject.put("waiting_count",0);
|
|
|
jsonObject.put("patient_name",(String) onlineObj.get("patient_name"));
|
|
|
jsonObject.put("time_cost",(Long) onlineObj.get("time_cost"));
|
|
|
jsonObject.put("time_cost",Long.parseLong(onlineObj.get("time_cost").toString()));
|
|
|
result.put(doctor,jsonObject);
|
|
|
}
|
|
|
}
|
|
@ -3978,12 +4036,18 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
}
|
|
|
|
|
|
|
|
|
public Map<String,Object> updatePatientInfo(String patient,String name,String idcard,String ssc){
|
|
|
public Map<String,Object> updatePatientInfo(String patient,String name,String idcard,String ssc,Integer sex,String townCode,String townName,String committeeCode,String committeeName,String address){
|
|
|
Map<String,Object> rs = new HashedMap();
|
|
|
BasePatientDO basePatientDO = basePatientDao.findById(patient);
|
|
|
PatientMedicareCardDO patientMedicareCardDO = basePatientMedicareCardDao.findByTypeAndPatientCodeAndDel("A_01",patient,"1");
|
|
|
basePatientDO.setName(name);
|
|
|
basePatientDO.setIdcard(idcard);
|
|
|
basePatientDO.setSex(sex);
|
|
|
basePatientDO.setTownCode(townCode);
|
|
|
basePatientDO.setTownName(townName);
|
|
|
basePatientDO.setCommitteeCode(committeeCode);
|
|
|
basePatientDO.setCommitteeName(committeeName);
|
|
|
basePatientDO.setAddress(address);
|
|
|
basePatientDO = basePatientDao.save(basePatientDO);
|
|
|
if (patientMedicareCardDO!=null){
|
|
|
patientMedicareCardDO.setCode(ssc);
|
|
@ -4298,7 +4362,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
|
|
|
Long videoOnlineCount = 0l;
|
|
|
if (rstotal != null && rstotal.size() > 0) {
|
|
|
videoOnlineCount = (Long) rstotal.get(0).get("total");
|
|
|
videoOnlineCount = Long.parseLong(rstotal.get(0).get("total").toString()) ;
|
|
|
}
|
|
|
|
|
|
return videoOnlineCount;
|
|
@ -4409,9 +4473,9 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
* @param type 1图文 2视频
|
|
|
* @return
|
|
|
*/
|
|
|
public Long getWaitVideoCount(String doctor,String type,String outpatient_type) {
|
|
|
public Long getWaitVideoCount(String doctor,String type,String outpatient_type,String wxId) {
|
|
|
String sql ="SELECT " +
|
|
|
"count(outpatient.id) AS total " +
|
|
|
"count(outpatient.id) AS \"total\" " +
|
|
|
"FROM " +
|
|
|
"wlyy_outpatient outpatient," +
|
|
|
"base_patient patient " +
|
|
@ -4424,11 +4488,19 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
if("1".equals(outpatient_type)){//复诊
|
|
|
sql = sql + " AND outpatient.type= '"+type+"' ";
|
|
|
if("2".equals(type)){//视频复诊才需要判断时间,
|
|
|
sql = sql + " AND outpatient.register_date is not null AND outpatient.register_date >= '"+DateUtil.dateToStrShort(new Date())+" 00:00:00' ";
|
|
|
if("xm_ykyy_wx".equals(wxId)){
|
|
|
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)){
|
|
|
//协同门诊也需要判断时间
|
|
|
sql = sql + " AND outpatient.register_date is not null AND outpatient.register_date >= '"+DateUtil.dateToStrShort(new Date())+" 00:00:00' ";
|
|
|
if("xm_ykyy_wx".equals(wxId)){
|
|
|
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' ";
|
|
|
}
|
|
|
}
|
|
|
List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(sql);
|
|
|
|
|
@ -4729,7 +4801,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
* @param status
|
|
|
* @return
|
|
|
*/
|
|
|
public Envelop findByGeneralDoctor(String generalDoctor,String startDate,String endDate,String status,String sort,Integer page,Integer size){
|
|
|
public Envelop findByGeneralDoctor(String generalDoctor,String startDate,String endDate,String status,String sort,Integer page,Integer size,String wxId){
|
|
|
|
|
|
String sqlTotal ="SELECT " +
|
|
|
" count(1) AS total "+
|
|
@ -4738,10 +4810,20 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
" WHERE " +
|
|
|
" o.general_doctor = '"+generalDoctor+"'";
|
|
|
if(StringUtils.isNotBlank(startDate)){
|
|
|
sqlTotal += " AND o.register_date >='"+startDate+" 00:00:00' ";
|
|
|
|
|
|
if("xm_ykyy_wx".equals(wxId)){
|
|
|
sqlTotal +=" and o.register_date >= to_date('"+startDate+" 00:00:00','YYYY-MM-DD HH24:MI:SS')";
|
|
|
}else {
|
|
|
sqlTotal += " AND o.register_date >='"+startDate+" 00:00:00' ";
|
|
|
}
|
|
|
|
|
|
}
|
|
|
if(StringUtils.isNotBlank(endDate)){
|
|
|
sqlTotal += " AND o.register_date <='"+endDate+" 23:59:59' ";
|
|
|
if("xm_ykyy_wx".equals(wxId)){
|
|
|
sqlTotal +=" and o.register_date <= to_date('"+endDate+" 23:59:59','YYYY-MM-DD HH24:MI:SS')";
|
|
|
}else {
|
|
|
sqlTotal += " AND o.register_date <='"+endDate+" 23:59:59' ";
|
|
|
}
|
|
|
}
|
|
|
if(StringUtils.isNotBlank(status)){
|
|
|
sqlTotal += " AND o.status ='"+status+"'";
|
|
@ -4751,66 +4833,74 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
|
|
|
Long total = 0l;
|
|
|
if (rstotal != null && rstotal.size() > 0) {
|
|
|
total = (Long) rstotal.get(0).get("total");
|
|
|
total = Long.parseLong(rstotal.get(0).get("total").toString());
|
|
|
}
|
|
|
String sql ="SELECT " +
|
|
|
" o.id AS id, " +
|
|
|
" o.adm_no AS admNo, " +
|
|
|
" o.origin_adm_no AS originAdmNo, " +
|
|
|
" o.register_no AS registerNo, " +
|
|
|
" o.origin_register_no AS originRegisterNo, " +
|
|
|
" o.origin_con_no AS originConNo, " +
|
|
|
" o.con_no AS conNo, " +
|
|
|
" o.outpatient_type AS outpatientType, " +
|
|
|
" o.type AS type, " +
|
|
|
" o.hospital AS hospital, " +
|
|
|
" o.hospital_name AS hospitalName, " +
|
|
|
" o.win_no AS winNo, " +
|
|
|
" o.dept AS dept, " +
|
|
|
" o.dept_name AS deptName, " +
|
|
|
" o.patient AS patient, " +
|
|
|
" o.patient_name AS patientName, " +
|
|
|
" o.doctor AS doctor, " +
|
|
|
" o.doctor_name AS doctorName, " +
|
|
|
" o.general_doctor AS generalDoctor, " +
|
|
|
" o.general_doctor_name AS generalDoctorName, " +
|
|
|
" o.idcard AS idcard, " +
|
|
|
" o.card_no AS cardNo, " +
|
|
|
" o.mjz AS mjz, " +
|
|
|
" o.icd10 AS icd10, "+
|
|
|
" o.icd10_name AS icd10Name, " +
|
|
|
" o.advice AS advice, " +
|
|
|
" o.adm_date AS admDate, " +
|
|
|
" o.description AS description, " +
|
|
|
" o.disease_img AS diseaseImg, " +
|
|
|
" o.create_time AS createTime, " +
|
|
|
" o.con_date AS conDate, " +
|
|
|
" o.patient_cancel_type AS patientCancelType, " +
|
|
|
" o.patient_cancel_value AS patientCancelValue, " +
|
|
|
" o.patient_cancel_remark AS patientCancelRemark, " +
|
|
|
" o.register_date AS registerDate, " +
|
|
|
" o.`status` AS STATUS, " +
|
|
|
" o.evaluate_status AS evaluateStatus " +
|
|
|
" o.id AS \"id\", " +
|
|
|
" o.adm_no AS \"admNo\", " +
|
|
|
" o.origin_adm_no AS \"originAdmNo\", " +
|
|
|
" o.register_no AS \"registerNo\", " +
|
|
|
" o.origin_register_no AS \"originRegisterNo\", " +
|
|
|
" o.origin_con_no AS \"originConNo\", " +
|
|
|
" o.con_no AS \"conNo\", " +
|
|
|
" o.outpatient_type AS \"outpatientType\", " +
|
|
|
" o.type AS \"type\", " +
|
|
|
" o.hospital AS \"hospital\", " +
|
|
|
" o.hospital_name AS \"hospitalName\", " +
|
|
|
" o.win_no AS \"winNo\", " +
|
|
|
" o.dept AS \"dept\", " +
|
|
|
" o.dept_name AS \"deptName\", " +
|
|
|
" o.patient AS \"patient\", " +
|
|
|
" o.patient_name AS \"patientName\", " +
|
|
|
" o.doctor AS \"doctor\", " +
|
|
|
" o.doctor_name AS \"doctorName\", " +
|
|
|
" o.general_doctor AS \"generalDoctor\", " +
|
|
|
" o.general_doctor_name AS \"generalDoctorName\", " +
|
|
|
" o.idcard AS \"idcard\", " +
|
|
|
" o.card_no AS \"cardNo\", " +
|
|
|
" o.mjz AS \"mjz\", " +
|
|
|
" o.icd10 AS \"icd10\", "+
|
|
|
" o.icd10_name AS \"icd10Name\", " +
|
|
|
" o.advice AS \"advice\", " +
|
|
|
" o.adm_date AS \"admDate\", " +
|
|
|
" o.description AS \"description\", " +
|
|
|
" o.disease_img AS \"diseaseImg\", " +
|
|
|
" o.create_time AS \"createTime\", " +
|
|
|
" o.con_date AS \"conDate\", " +
|
|
|
" o.patient_cancel_type AS \"patientCancelType\", " +
|
|
|
" o.patient_cancel_value AS \"patientCancelValue\", " +
|
|
|
" o.patient_cancel_remark AS \"patientCancelRemark\", " +
|
|
|
" o.register_date AS \"registerDate\", " +
|
|
|
" o.status AS \"STATUS\", " +
|
|
|
" o.evaluate_status AS \"evaluateStatus\" " +
|
|
|
" FROM " +
|
|
|
" wlyy_outpatient o " +
|
|
|
" WHERE " +
|
|
|
" o.general_doctor = '"+generalDoctor+"'";
|
|
|
if(StringUtils.isNotBlank(startDate)){
|
|
|
sql+=" AND o.register_date >='"+startDate+" 00:00:00'";
|
|
|
if("xm_ykyy_wx".equals(wxId)){
|
|
|
sql +=" and o.register_date >= to_date('"+startDate+" 00:00:00','YYYY-MM-DD HH24:MI:SS')";
|
|
|
}else {
|
|
|
sql += " AND o.register_date >='"+startDate+" 00:00:00' ";
|
|
|
}
|
|
|
}
|
|
|
if(StringUtils.isNotBlank(endDate)){
|
|
|
sql+=" AND o.register_date <='"+endDate+" 23:59:59'";
|
|
|
if("xm_ykyy_wx".equals(wxId)){
|
|
|
sql +=" and o.register_date <= to_date('"+endDate+" 23:59:59','YYYY-MM-DD HH24:MI:SS')";
|
|
|
}else {
|
|
|
sql += " AND o.register_date <='"+endDate+" 23:59:59' ";
|
|
|
}
|
|
|
}
|
|
|
if(StringUtils.isNotBlank(status)){
|
|
|
sql+=" AND o.status ='"+status+"'";
|
|
|
}
|
|
|
if(StringUtils.isNotBlank(sort)){
|
|
|
sql += " ORDER BY o.register_date "+sort+" LIMIT " + (page - 1) * size + "," + size + "";
|
|
|
sql += " ORDER BY o.register_date "+sort;
|
|
|
}else{
|
|
|
sql += " ORDER BY o.register_date ASC LIMIT " + (page - 1) * size + "," + size + "";
|
|
|
sql += " ORDER BY o.register_date ASC ";
|
|
|
}
|
|
|
|
|
|
List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
|
|
|
List<Map<String,Object>> list = hibenateUtils.createSQLQuery(sql,page,size);
|
|
|
//List<WlyyOutpatientDO> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper(WlyyOutpatientDO.class));
|
|
|
return MixEnvelop.getSuccessListWithPage(BaseHospitalRequestMapping.Prescription.api_success, list, page, size, total);
|
|
|
}
|
|
@ -4848,7 +4938,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
|
|
|
//统计科预约医生
|
|
|
String sql = "SELECT " +
|
|
|
" COUNT(1) AS total " +
|
|
|
" COUNT(1) AS \"total\" " +
|
|
|
" FROM " +
|
|
|
" base_doctor d " +
|
|
|
" JOIN base_doctor_role r ON d.id = r.doctor_code " +
|
|
@ -4867,7 +4957,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
|
|
|
//统计在线医生
|
|
|
String onlineSql="SELECT " +
|
|
|
" COUNT(1) AS total " +
|
|
|
" COUNT(1) AS \"total\" " +
|
|
|
" FROM " +
|
|
|
" base_doctor d " +
|
|
|
" JOIN base_doctor_role r ON d.id = r.doctor_code " +
|
|
@ -4880,7 +4970,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
|
|
|
Long onlineTotal = 0l;
|
|
|
if (oltotal != null && oltotal.size() > 0) {
|
|
|
onlineTotal = (Long) oltotal.get(0).get("total");
|
|
|
onlineTotal = Long.parseLong(oltotal.get(0).get("total").toString());
|
|
|
}
|
|
|
|
|
|
rs.put("onlineTotal",onlineTotal);
|
|
@ -4901,7 +4991,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
|
|
|
//总数
|
|
|
String sqlAll = "SELECT " +
|
|
|
" COUNT(room.outpatient_id) AS total " +
|
|
|
" COUNT(room.outpatient_id) AS \"total\" " +
|
|
|
"FROM " +
|
|
|
"wlyy_hospital_waiting_room room," +
|
|
|
"wlyy_outpatient outpatient " +
|
|
@ -4920,7 +5010,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
|
|
|
//图文复诊
|
|
|
String imgAll = "SELECT " +
|
|
|
" COUNT(room.outpatient_id) AS total " +
|
|
|
" COUNT(room.outpatient_id) AS \"total\" " +
|
|
|
"FROM " +
|
|
|
"wlyy_hospital_waiting_room room," +
|
|
|
"wlyy_outpatient outpatient " +
|
|
@ -4939,7 +5029,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
|
|
|
//视频复诊
|
|
|
String spsql = "SELECT " +
|
|
|
" COUNT(room.outpatient_id) AS total " +
|
|
|
" COUNT(room.outpatient_id) AS \"total\" " +
|
|
|
"FROM " +
|
|
|
"wlyy_hospital_waiting_room room," +
|
|
|
"wlyy_outpatient outpatient " +
|
|
@ -4959,7 +5049,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
|
|
|
//协同门诊
|
|
|
String xtsql = "SELECT " +
|
|
|
" COUNT(room.outpatient_id) AS total " +
|
|
|
" COUNT(room.outpatient_id) AS \"total\" " +
|
|
|
"FROM " +
|
|
|
"wlyy_hospital_waiting_room room," +
|
|
|
"wlyy_outpatient outpatient " +
|
|
@ -5817,6 +5907,18 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
params);
|
|
|
|
|
|
logger.info("调用电子病历查询接口请求成功,返回值xmlstr:" + returnValue);
|
|
|
XMLSerializer xmlSerializer = new XMLSerializer();
|
|
|
net.sf.json.JSON json = xmlSerializer.read(returnValue);
|
|
|
logger.info("返回json"+json);
|
|
|
Object retInfo= ((JSONObject) json).get("HtResponse");
|
|
|
logger.info("retInfo:"+retInfo);
|
|
|
if(retInfo!=null){
|
|
|
JSONObject jsonObject = (JSONObject)retInfo;
|
|
|
String content =jsonObject.getString("XML_CONT");
|
|
|
Document doc = Jsoup.parse(content);
|
|
|
Elements rows = doc.select("table[class=list]").get(0).select("tr");
|
|
|
}
|
|
|
|
|
|
return returnValue;
|
|
|
}
|
|
|
|