|
@ -11,14 +11,28 @@ import com.yihu.jw.entity.base.dict.DictHospitalDeptDO;
|
|
|
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
|
|
|
import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
|
|
|
import com.yihu.jw.entity.base.doctor.BaseDoctorRoleDO;
|
|
|
import com.yihu.jw.entity.base.patient.BasePatientDO;
|
|
|
import com.yihu.jw.entity.base.score.BaseEvaluateDO;
|
|
|
import com.yihu.jw.entity.base.score.BaseEvaluateScoreDO;
|
|
|
import com.yihu.jw.entity.hospital.mapping.DoctorMappingDO;
|
|
|
import com.yihu.jw.entity.hospital.mapping.PatientMappingDO;
|
|
|
import com.yihu.jw.entity.hospital.prescription.WlyyOutpatientDO;
|
|
|
import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionDO;
|
|
|
import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionInfoDO;
|
|
|
import com.yihu.jw.evaluate.score.dao.BaseEvaluateDao;
|
|
|
import com.yihu.jw.evaluate.score.dao.BaseEvaluateScoreDao;
|
|
|
import com.yihu.jw.hospital.mapping.dao.DoctorMappingDao;
|
|
|
import com.yihu.jw.hospital.mapping.dao.PatientMappingDao;
|
|
|
import com.yihu.jw.hospital.prescription.dao.OutpatientDao;
|
|
|
import com.yihu.jw.hospital.prescription.dao.PrescriptionDao;
|
|
|
import com.yihu.jw.hospital.prescription.dao.PrescriptionInfoDao;
|
|
|
import com.yihu.jw.patient.dao.BasePatientDao;
|
|
|
import com.yihu.jw.util.common.IdCardUtil;
|
|
|
import com.yihu.jw.util.date.DateUtil;
|
|
|
import com.yihu.jw.utils.hibernate.HibenateUtils;
|
|
|
import com.yihu.utils.network.HttpResponse;
|
|
|
import com.yihu.utils.network.HttpUtils;
|
|
|
import com.yihu.utils.security.MD5;
|
|
|
import javafx.scene.DepthTest;
|
|
|
import org.apache.commons.collections.map.HashedMap;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
@ -63,9 +77,30 @@ public class YkyyEntranceService {
|
|
|
@Autowired
|
|
|
private BaseDoctorDao baseDoctorDao;
|
|
|
|
|
|
@Autowired
|
|
|
private PatientMappingDao patientMappingDao;
|
|
|
|
|
|
@Autowired
|
|
|
private BasePatientDao basePatientDao;
|
|
|
|
|
|
@Autowired
|
|
|
private HibenateUtils hibenateUtils;
|
|
|
|
|
|
@Autowired
|
|
|
private OutpatientDao outpatientDao;
|
|
|
|
|
|
@Autowired
|
|
|
private PrescriptionDao prescriptionDao;
|
|
|
|
|
|
@Autowired
|
|
|
private PrescriptionInfoDao prescriptionInfoDao;
|
|
|
|
|
|
@Autowired
|
|
|
private BaseEvaluateScoreDao baseEvaluateScoreDao;
|
|
|
|
|
|
@Autowired
|
|
|
private BaseEvaluateDao baseEvaluateDao;
|
|
|
|
|
|
public List<Map<String, Object>> createSQLQuery(String sql, Map<String, Object> params, Integer page, Integer size){
|
|
|
return hibenateUtils.createSQLQuery(sql,params,page,size);
|
|
|
}
|
|
@ -251,26 +286,270 @@ public class YkyyEntranceService {
|
|
|
return buffer.toString();
|
|
|
}
|
|
|
|
|
|
// public String test(){
|
|
|
public String getCFXX(String brids,String ysdm,String startDate)throws Exception{
|
|
|
BaseDoctorDO doctor = findByMapingCode(ysdm);
|
|
|
if(doctor==null){
|
|
|
return "doctor mapping not exist !";
|
|
|
}
|
|
|
BaseDoctorHospitalDO hospitalDO = getDept(doctor.getId());
|
|
|
if(hospitalDO==null){
|
|
|
return "hospital not exist!";
|
|
|
}
|
|
|
|
|
|
String sql ="SELECT " +
|
|
|
" c.BRID," +
|
|
|
" c.CFHM," +
|
|
|
" c.TSCF," +
|
|
|
" c.BRXM," +
|
|
|
" c.YSDM," +
|
|
|
" c.KSDM," +
|
|
|
" c.YPMC," +
|
|
|
" c.YPDJ," +
|
|
|
" c.YPSL," +
|
|
|
" c.HJJE," +
|
|
|
" c.JZXH," +
|
|
|
" c.FPHM," +
|
|
|
" c.FYBZ," +
|
|
|
" c.YPCD," +
|
|
|
" c.YPXH," +
|
|
|
" c.YPYF," +
|
|
|
" d.ICD," +
|
|
|
" d.JBMC," +
|
|
|
" x.YPDM," +
|
|
|
" x.YFGG," +
|
|
|
" x.YFDW," +
|
|
|
" x.YFBZ," +
|
|
|
" x.YPSX," +
|
|
|
" x.YPJL," +
|
|
|
" x.JLDW," +
|
|
|
" x.PYDM," +
|
|
|
" x.FYFS," +
|
|
|
" x.GYFF," +
|
|
|
" x.GYFFMC," +
|
|
|
" x.YFZF," +
|
|
|
" x.LSJG," +
|
|
|
" x.KCSL," +
|
|
|
" x.ZFPB," +
|
|
|
" x.JBYWBZ," +
|
|
|
" x.YDYP," +
|
|
|
" x.YPMC2," +
|
|
|
" p.JZKH " +
|
|
|
"FROM " +
|
|
|
" V_ZKSG_CFCX c, " +
|
|
|
" v_hlw_mzbrzd d, " +
|
|
|
" V_ZKSG_MZ_YPXX x," +
|
|
|
" V_ZKSG_BRCX p " +
|
|
|
"WHERE " +
|
|
|
" c.BRID = d.BRID " +
|
|
|
" AND c.jzxh = d.jzxh " +
|
|
|
" AND c.ysdm = '"+ysdm+"' " +
|
|
|
" AND x.ypxh = c.ypxh " +
|
|
|
" AND x.ypcd = c.ypcd " +
|
|
|
" AND p.BRID = c.BRID " +
|
|
|
" AND c.BRID in ("+brids+") order by c.BRID DESC";
|
|
|
Map<String,Object> params = new HashedMap();
|
|
|
params.put("sql",sql);
|
|
|
// HttpResponse response = HttpUtils.doGet(url,params);
|
|
|
// String content = response.getContent();
|
|
|
// logger.info("response:"+content);
|
|
|
// JSONObject rs = JSON.parseObject(content);
|
|
|
// Integer status = rs.getInteger("status");
|
|
|
// Map<String,String> map = new HashedMap();
|
|
|
// if(status!=null&&status == 200){
|
|
|
// JSONArray array = rs.getJSONArray("detailModelList");
|
|
|
// logger.info("detailModelList size:"+array.size());
|
|
|
// if(array!=null&&array.size()>0) {
|
|
|
// for(int i= 0;i<array.size();i++){
|
|
|
// JSONObject cfxx = array.getJSONObject(i);
|
|
|
// String brid = cfxx.getString("BRID");
|
|
|
// BasePatientDO patientDO = findPatientByMapingCode(brid);
|
|
|
// if(patientDO!=null){
|
|
|
// if(map.get(brid)==null){
|
|
|
// map.put(brid,brid);
|
|
|
// logger.info("1.创建门诊记录");
|
|
|
// //1.创建门诊记录
|
|
|
// WlyyOutpatientDO outpatientDO = saveOutPatient(cfxx,hospitalDO,patientDO,doctor,startDate);
|
|
|
//
|
|
|
// logger.info("2.生成处方记录");
|
|
|
// //2.生成处方记录
|
|
|
// savePrescription(outpatientDO,cfxx,startDate);
|
|
|
//
|
|
|
// DictHospitalDeptDO deptDO = new DictHospitalDeptDO();
|
|
|
//// deptDO.setId(5);
|
|
|
// deptDO.setOrgCode("test");
|
|
|
// deptDO.setCode("test");
|
|
|
// deptDO.setName("test");
|
|
|
// deptDO.setConsultDeptFlag("test");
|
|
|
// deptDO.setCreateTime(new Date());
|
|
|
// hospitalDeptDao.save(deptDO);
|
|
|
// logger.info("3.医生评价");
|
|
|
// //3.医生评价
|
|
|
// saveDoctorScore(outpatientDO);
|
|
|
//
|
|
|
//// BaseDoctorHospitalDO hospitalDO = new BaseDoctorHospitalDO();
|
|
|
//// hospitalDO.setDeptName("test");
|
|
|
//// hospitalDO.setDeptCode("test");
|
|
|
//// hospitalDO.setOrgCode("test");
|
|
|
//// hospitalDO.setOrgName("test");
|
|
|
//// hospitalDO.setDeptCode("test");
|
|
|
//// hospitalDO.setDeptName("test");
|
|
|
//// hospitalDO.setDel("1");
|
|
|
//// baseDoctorHospitalDao.save(hospitalDO);
|
|
|
// return "ok";
|
|
|
// }
|
|
|
// }
|
|
|
// }else{
|
|
|
// logger.info("brid:"+brid+" mapping not exist");
|
|
|
// }
|
|
|
// }
|
|
|
// }
|
|
|
// }
|
|
|
return "ok";
|
|
|
}
|
|
|
|
|
|
//生成门诊信息
|
|
|
public WlyyOutpatientDO saveOutPatient(JSONObject cfxx,BaseDoctorHospitalDO hospitalDO,BasePatientDO patientDO,BaseDoctorDO doctor,String startDate){
|
|
|
|
|
|
WlyyOutpatientDO outpatientDO = new WlyyOutpatientDO();
|
|
|
outpatientDO.setRegisterNo(cfxx.getString("JZXH"));
|
|
|
outpatientDO.setOutpatientType("1");
|
|
|
outpatientDO.setType("1");
|
|
|
outpatientDO.setHospital(orgCode);
|
|
|
outpatientDO.setHospitalName(orgName);
|
|
|
outpatientDO.setDept(hospitalDO.getDeptCode());
|
|
|
outpatientDO.setDeptName(hospitalDO.getDeptName());
|
|
|
|
|
|
outpatientDO.setPatient(patientDO.getId());
|
|
|
outpatientDO.setPatientName(patientDO.getName());
|
|
|
outpatientDO.setDoctor(doctor.getId());
|
|
|
outpatientDO.setDoctorName(doctor.getName());
|
|
|
|
|
|
outpatientDO.setIdcard(patientDO.getIdcard());
|
|
|
outpatientDO.setMjz("mz");
|
|
|
outpatientDO.setIcd10(cfxx.getString("ICD"));
|
|
|
outpatientDO.setIcd10Name(cfxx.getString("JBMC"));
|
|
|
outpatientDO.setAdvice("注意休息,防止过度疲劳");
|
|
|
|
|
|
outpatientDO.setStatus("2");
|
|
|
|
|
|
outpatientDO.setDescription("身体不舒服,焦虑");
|
|
|
outpatientDO.setCreateTime(DateUtil.strToDate(startDate+" 08:30:00","yyyy-MM-dd HH:mm:ss"));
|
|
|
outpatientDO.setDiseaseImg("https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1583567535353&di=6529f7ff05e79c26f37e0176adcb3241&imgtype=0&src=http%3A%2F%2Fimages.669pic.com%2Felement_pic%2F74%2F70%2F44%2F48%2F8997cd56af062ce6e1ca3da37506f3c9.jpg");
|
|
|
|
|
|
outpatientDO.setConNo(cfxx.getString("JZXH"));
|
|
|
outpatientDO.setRegisterDate(DateUtil.strToDate(startDate+" 08:30:00","yyyy-MM-dd HH:mm:ss"));
|
|
|
outpatientDO.setEvaluateStatus("1");
|
|
|
outpatientDO.setEndTime(DateUtil.strToDate(startDate+" 09:30:00","yyyy-MM-dd HH:mm:ss"));
|
|
|
|
|
|
outpatientDO.setAdmNo("001");
|
|
|
|
|
|
return outpatientDao.save(outpatientDO);
|
|
|
}
|
|
|
|
|
|
public void savePrescription(WlyyOutpatientDO outpatientDO,JSONObject cfxx,String startDate){
|
|
|
WlyyPrescriptionDO prescriptionDO = new WlyyPrescriptionDO();
|
|
|
|
|
|
prescriptionDO.setOutpatientId(outpatientDO.getId());
|
|
|
prescriptionDO.setRealOrder(cfxx.getString("CFHM"));
|
|
|
prescriptionDO.setSerialNo(cfxx.getString("JZXH"));
|
|
|
prescriptionDO.setType(1);
|
|
|
prescriptionDO.setPatientCode(outpatientDO.getPatient());
|
|
|
prescriptionDO.setPatientName(outpatientDO.getPatientName());
|
|
|
prescriptionDO.setIdcard(outpatientDO.getIdcard());
|
|
|
prescriptionDO.setSsc(outpatientDO.getCardNo());
|
|
|
prescriptionDO.setDoctor(outpatientDO.getDoctor());
|
|
|
prescriptionDO.setDoctorName(outpatientDO.getDoctorName());
|
|
|
prescriptionDO.setStatus(100);
|
|
|
|
|
|
prescriptionDO.setCreateTime(DateUtil.strToDate(startDate+" 09:00:00","yyyy-MM-dd HH:mm:ss"));
|
|
|
prescriptionDO.setDept(outpatientDO.getDept());
|
|
|
prescriptionDO.setDeptName(outpatientDO.getDeptName());
|
|
|
prescriptionDO.setHospital(outpatientDO.getHospital());
|
|
|
prescriptionDO.setHospitalName(outpatientDO.getHospitalName());
|
|
|
|
|
|
prescriptionDO.setRemark("001");
|
|
|
|
|
|
prescriptionDO.setDiseaseImg("https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1583567535353&di=6529f7ff05e79c26f37e0176adcb3241&imgtype=0&src=http%3A%2F%2Fimages.669pic.com%2Felement_pic%2F74%2F70%2F44%2F48%2F8997cd56af062ce6e1ca3da37506f3c9.jpg");
|
|
|
prescriptionDO.setDrugFee(cfxx.getDouble("HJJE"));
|
|
|
prescriptionDO.setInspectFee(0D);
|
|
|
prescriptionDO.setRegFee(0D);
|
|
|
|
|
|
WlyyPrescriptionDO temp = prescriptionDao.save(prescriptionDO);
|
|
|
|
|
|
WlyyPrescriptionInfoDO info = new WlyyPrescriptionInfoDO();
|
|
|
|
|
|
info.setPrescriptionId(temp.getId());
|
|
|
|
|
|
info.setDrugNo(cfxx.getString("PYDM"));
|
|
|
info.setDrugName(cfxx.getString("YPMC"));
|
|
|
info.setDosage(cfxx.getString("YPJL"));
|
|
|
info.setQuantity(cfxx.getString("YPSL"));
|
|
|
//计量单位
|
|
|
info.setUnitName(cfxx.getString("JLDW"));
|
|
|
//包装单位
|
|
|
info.setPackUnitName(cfxx.getString("YFDW"));
|
|
|
//用法
|
|
|
info.setSupplyCode(cfxx.getString("GYFF"));
|
|
|
info.setSupplyName(cfxx.getString("GYFFMC"));
|
|
|
//规格
|
|
|
info.setSpecification(cfxx.getString("YFGG"));
|
|
|
info.setDel(1);
|
|
|
info.setUsageCode(cfxx.getString("YPYF"));
|
|
|
info.setUsageName(cfxx.getString("YPYF"));
|
|
|
//药品单价
|
|
|
info.setPackRetprice(cfxx.getDouble("YPDJ"));
|
|
|
|
|
|
info.setComm("001");
|
|
|
|
|
|
prescriptionInfoDao.save(info);
|
|
|
}
|
|
|
|
|
|
public void saveDoctorScore(WlyyOutpatientDO outpatientDO){
|
|
|
BaseEvaluateScoreDO scoreDO = new BaseEvaluateScoreDO();
|
|
|
scoreDO.setHospital(orgCode);
|
|
|
scoreDO.setHospital(orgName);
|
|
|
|
|
|
scoreDO.setDoctor(outpatientDO.getDoctor());
|
|
|
scoreDO.setDoctorName(outpatientDO.getDoctorName());
|
|
|
scoreDO.setPatient(outpatientDO.getPatient());
|
|
|
scoreDO.setPatientName(outpatientDO.getPatientName());
|
|
|
|
|
|
scoreDO.setEvaluateType(1);
|
|
|
scoreDO.setScore(100D);
|
|
|
scoreDO.setType(1);
|
|
|
|
|
|
scoreDO.setRelationCode("001");
|
|
|
|
|
|
BaseEvaluateScoreDO temp = baseEvaluateScoreDao.save(scoreDO);
|
|
|
|
|
|
BaseEvaluateDO evaluateDO = new BaseEvaluateDO();
|
|
|
evaluateDO.setRelationCode(temp.getId());
|
|
|
evaluateDO.setScore(1D);
|
|
|
evaluateDO.setScoreType("4");
|
|
|
evaluateDO.setContent("五星好评!");
|
|
|
|
|
|
baseEvaluateDao.save(evaluateDO);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获取医生信息
|
|
|
* @param mappingCode
|
|
|
* @return
|
|
|
*/
|
|
|
public BaseDoctorDO findByMapingCode(String mappingCode){
|
|
|
|
|
|
String sql = "SELECT " +
|
|
|
" map.doctor AS \"doctor\" " +
|
|
|
" FROM " +
|
|
|
" base_doctor_mapping map " +
|
|
|
" WHERE " +
|
|
|
" map.org_code ='350211A5004' " +
|
|
|
" AND map.mapping_code ='"+mappingCode+"' ";
|
|
|
List<Map<String,Object>> list = hibenateUtils.createSQLQuery(sql);
|
|
|
if(list!=null&&list.size()>0){
|
|
|
BaseDoctorDO doctorDO = baseDoctorDao.findById(list.get(0).get("doctor").toString());
|
|
|
return doctorDO;
|
|
|
}
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
//获取部门
|
|
|
public BaseDoctorHospitalDO getDept(String doctor){
|
|
|
List<BaseDoctorHospitalDO> list = baseDoctorHospitalDao.findByDoctorCode(doctor);
|
|
|
if(list!=null&&list.size()>0){
|
|
|
return list.get(0);
|
|
|
}
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
//获取居民信息
|
|
|
public BasePatientDO findPatientByMapingCode(String mappingCode){
|
|
|
PatientMappingDO patientMappingDO = patientMappingDao.findByMappingCodeAndSource(mappingCode,"1");
|
|
|
if(patientMappingDO==null){
|
|
|
return null;
|
|
|
}
|
|
|
BasePatientDO patientDO = basePatientDao.findById(patientMappingDO.getPatient());
|
|
|
return patientDO;
|
|
|
}
|
|
|
}
|