|
@ -5,6 +5,7 @@ import java.util.*;
|
|
|
import com.yihu.wlyy.entity.consult.ConsultTeam;
|
|
|
import com.yihu.wlyy.entity.doctor.team.admin.AdminTeam;
|
|
|
import com.yihu.wlyy.entity.doctor.team.sign.*;
|
|
|
import com.yihu.wlyy.entity.log.OperatorLog;
|
|
|
import com.yihu.wlyy.entity.organization.Hospital;
|
|
|
import com.yihu.wlyy.entity.dict.SystemDict;
|
|
|
import com.yihu.wlyy.entity.doctor.profile.Doctor;
|
|
@ -17,6 +18,7 @@ import com.yihu.wlyy.entity.patient.SignFamilyCode;
|
|
|
import com.yihu.wlyy.repository.consult.ConsultTeamDao;
|
|
|
import com.yihu.wlyy.repository.dict.SystemDictDao;
|
|
|
import com.yihu.wlyy.repository.doctor.*;
|
|
|
import com.yihu.wlyy.repository.log.OperatorLogDao;
|
|
|
import com.yihu.wlyy.repository.message.MessageDao;
|
|
|
import com.yihu.wlyy.repository.organization.HospitalDao;
|
|
|
import com.yihu.wlyy.repository.patient.PatientDao;
|
|
@ -116,6 +118,8 @@ public class FamilyContractService extends BaseService {
|
|
|
WeiXinAccessTokenUtils accessTokenUtils;
|
|
|
@Autowired
|
|
|
private DoctorWorkTimeService doctorWorkTimeService;
|
|
|
@Autowired
|
|
|
private OperatorLogDao operatorLogDao;
|
|
|
|
|
|
public SignFamily findSignFamilyByCode(String code) {
|
|
|
return signFamilyDao.findByCodeAndType(code, 2);
|
|
@ -383,7 +387,7 @@ public class FamilyContractService extends BaseService {
|
|
|
String idcard,
|
|
|
String ssc,
|
|
|
String mobile,
|
|
|
String emerMobile)throws Exception {
|
|
|
String emerMobile) throws Exception {
|
|
|
// 查询三师签约
|
|
|
JSONObject json = new JSONObject();
|
|
|
SignFamily sc = signFamilyDao.findByIdcard(idcard);
|
|
@ -507,7 +511,7 @@ public class FamilyContractService extends BaseService {
|
|
|
* @param doctorType 医生类型
|
|
|
* @return
|
|
|
*/
|
|
|
public int sign(String doctor, String patient, int doctorType) throws Exception{
|
|
|
public int sign(String doctor, String patient, int doctorType) throws Exception {
|
|
|
Patient p = patientDao.findByCode(patient);
|
|
|
if (p == null) {
|
|
|
return -1;
|
|
@ -583,7 +587,7 @@ public class FamilyContractService extends BaseService {
|
|
|
//如果在工作时间内就推送
|
|
|
PushMsgTask.getInstance().put(doctor, MessageType.MESSAGE_TYPE_DOCTOR_NEW_SIGN_WEB.D_SW_01.name(), MessageType.MESSAGE_TYPE_DOCTOR_NEW_SIGN_WEB.家庭签约.name(), "您有一条新的家庭签约申请!", patient);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return 1;
|
|
|
}
|
|
@ -635,7 +639,7 @@ public class FamilyContractService extends BaseService {
|
|
|
* @param reason 解约理由
|
|
|
* @return
|
|
|
*/
|
|
|
public int surrender(String patient, String patientName, String userPhoto, String doctor, String doctorName, String openid, String reason, int sex) throws Exception{
|
|
|
public int surrender(String patient, String patientName, String userPhoto, String doctor, String doctorName, String openid, String reason, int sex) throws Exception {
|
|
|
// 更新为待解约
|
|
|
int res = signFamilyDao.surrender(patient, doctor);
|
|
|
SignFamily signFamily = signFamilyDao.findByjiatingPatient(patient);
|
|
@ -1629,7 +1633,7 @@ public class FamilyContractService extends BaseService {
|
|
|
* @param healthDoctor 健康管理师code
|
|
|
* @return
|
|
|
*/
|
|
|
public JSONObject updateSignInfo(String patient, String healthDoctor, String doctor, String expensesType) {
|
|
|
public JSONObject updateSignInfo(String patient, String healthDoctor, String doctor, String expensesType, String loginUser) {
|
|
|
JSONObject result = new JSONObject();
|
|
|
Patient p = patientDao.findByCode(patient);
|
|
|
|
|
@ -1793,11 +1797,22 @@ public class FamilyContractService extends BaseService {
|
|
|
for (JSONObject msg : wxMessages) {
|
|
|
PushMsgTask.getInstance().putWxMsg(accessTokenUtils.getAccessToken(), 10, p.getOpenid(), p.getName(), msg);
|
|
|
}
|
|
|
|
|
|
OperatorLog operatorLog = new OperatorLog();
|
|
|
operatorLog.setCreateTime(new Date());
|
|
|
operatorLog.setMethod("/doctor/family_contract/sign_info_update");
|
|
|
operatorLog.setMethodName("签约信息变更");
|
|
|
operatorLog.setCreateUser(loginUser);
|
|
|
JSONObject jo = new JSONObject();
|
|
|
jo.put("patient", patient);
|
|
|
jo.put("healthDoctor", healthDoctor);
|
|
|
jo.put("expensesType", expensesType);
|
|
|
jo.put("doctor", doctor);
|
|
|
operatorLog.setParams(jo.toString());
|
|
|
operatorLogDao.save(operatorLog);
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
public JSONObject findNoHealthSignFamilyHealthByParams(String doctorCode,String teamCode, String params) throws Exception {
|
|
|
public JSONObject findNoHealthSignFamilyHealthByParams(String doctorCode, String teamCode, String params) throws Exception {
|
|
|
JSONObject returnMap = new JSONObject();
|
|
|
String addressSql = "select a.signcode,a.name,a.address,a.code,a.hasopenid,a.idcard from( SELECT " +
|
|
|
" sf.CODE signcode, " +
|
|
@ -1813,15 +1828,15 @@ public class FamilyContractService extends BaseService {
|
|
|
" WHERE " +
|
|
|
" sf.type = 2 " +
|
|
|
" AND sf. STATUS >= 0 " +
|
|
|
// " and sf.doctor = ? " +
|
|
|
// " and sf.doctor = ? " +
|
|
|
" and sf.admin_team_code = ? " +
|
|
|
" AND ( sf.doctor_health is null or sf.doctor_health ='' ) ) a where 1=1";
|
|
|
if (!org.springframework.util.StringUtils.isEmpty(params)) {
|
|
|
addressSql += " AND a.address like '%" + params + "%'";
|
|
|
}
|
|
|
List<Map<String, Object>> datas = jdbcTemplate.queryForList(addressSql,teamCode);
|
|
|
List<Map<String, Object>> datas = jdbcTemplate.queryForList(addressSql, teamCode);
|
|
|
if (datas != null && datas.size() > 0) {
|
|
|
JSONArray jsonArray=new JSONArray();
|
|
|
JSONArray jsonArray = new JSONArray();
|
|
|
for (Map<String, Object> map : datas) {
|
|
|
JSONObject jo = new JSONObject();
|
|
|
jo.put("signcode", map.get("signcode"));
|
|
@ -1834,7 +1849,7 @@ public class FamilyContractService extends BaseService {
|
|
|
jo.put("sex", IdCardUtil.getSexForIdcard_new(map.get("idcard").toString()));
|
|
|
jsonArray.put(jo);
|
|
|
}
|
|
|
returnMap.put("address",jsonArray);
|
|
|
returnMap.put("address", jsonArray);
|
|
|
}
|
|
|
String patientNameSql = "select a.signcode,a.name,a.address,a.code,a.hasopenid,a.idcard from( SELECT " +
|
|
|
" sf.CODE signcode, " +
|
|
@ -1857,9 +1872,9 @@ public class FamilyContractService extends BaseService {
|
|
|
if (!org.springframework.util.StringUtils.isEmpty(params)) {
|
|
|
patientNameSql += " AND a.name like '%" + params + "%'";
|
|
|
}
|
|
|
datas = jdbcTemplate.queryForList(patientNameSql,teamCode);
|
|
|
datas = jdbcTemplate.queryForList(patientNameSql, teamCode);
|
|
|
if (datas != null && datas.size() > 0) {
|
|
|
JSONArray jsonArray=new JSONArray();
|
|
|
JSONArray jsonArray = new JSONArray();
|
|
|
for (Map<String, Object> map : datas) {
|
|
|
JSONObject jo = new JSONObject();
|
|
|
jo.put("signcode", map.get("signcode"));
|
|
@ -1871,12 +1886,12 @@ public class FamilyContractService extends BaseService {
|
|
|
jo.put("sex", IdCardUtil.getSexForIdcard_new(map.get("idcard").toString()));
|
|
|
jsonArray.put(jo);
|
|
|
}
|
|
|
returnMap.put("name",jsonArray);
|
|
|
returnMap.put("name", jsonArray);
|
|
|
}
|
|
|
return returnMap;
|
|
|
}
|
|
|
|
|
|
public JSONObject findNoHealthSignFamilyHealth(String doctorCode, String labelType, String patientName,Long teamCode) throws Exception {
|
|
|
public JSONObject findNoHealthSignFamilyHealth(String doctorCode, String labelType, String patientName, Long teamCode) throws Exception {
|
|
|
JSONObject returnMap = new JSONObject();
|
|
|
//健康管理师
|
|
|
String sql = "SELECT " +
|
|
@ -1901,7 +1916,7 @@ public class FamilyContractService extends BaseService {
|
|
|
" AND ( sf.doctor_health is null or sf.doctor_health ='' ) ";
|
|
|
List<Map<String, Object>> datas = null;
|
|
|
//查找居民
|
|
|
datas = jdbcTemplate.queryForList(sql, labelType, doctorCode,teamCode);
|
|
|
datas = jdbcTemplate.queryForList(sql, labelType, doctorCode, teamCode);
|
|
|
|
|
|
//根据类别查找标签
|
|
|
List<SignPatientLabel> s = labelDao.findByLabelTypeAndStatus(labelType, 1);
|
|
@ -2156,26 +2171,26 @@ public class FamilyContractService extends BaseService {
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
public Map<String, List<Patient>> getPatientByLevel(String doctorCode,Long team) {
|
|
|
public Map<String, List<Patient>> getPatientByLevel(String doctorCode, Long team) {
|
|
|
Map<String, List<Patient>> returnMap = new HashMap<>();
|
|
|
Doctor doctor = doctorDao.findByCode(doctorCode);
|
|
|
//判断当前用户是健康管理师还是全科
|
|
|
if (doctor.getLevel() == 3) {
|
|
|
//健康管理师
|
|
|
List<Patient> jkgl = signFamilyDao.findByDoctorHealthPatient(doctorCode,team);
|
|
|
List<Patient> jkgl = signFamilyDao.findByDoctorHealthPatient(doctorCode, team);
|
|
|
returnMap.put("jk", jkgl);
|
|
|
} else if (doctor.getLevel() == 2) {
|
|
|
//全科医生
|
|
|
List<Patient> qkys = signFamilyDao.findByDoctorPatient(doctorCode,team);
|
|
|
List<Patient> qkys = signFamilyDao.findByDoctorPatient(doctorCode, team);
|
|
|
returnMap.put("qk", qkys);
|
|
|
//健康管理师
|
|
|
List<Patient> jkgl = signFamilyDao.findByDoctorHealthPatient(doctorCode,team);
|
|
|
List<Patient> jkgl = signFamilyDao.findByDoctorHealthPatient(doctorCode, team);
|
|
|
returnMap.put("jk", jkgl);
|
|
|
}
|
|
|
return returnMap;
|
|
|
}
|
|
|
|
|
|
public JSONObject getPatientByLable(String doctorCode, String labelType, String level,Long team) throws Exception {
|
|
|
public JSONObject getPatientByLable(String doctorCode, String labelType, String level, Long team) throws Exception {
|
|
|
JSONObject returnMap = new JSONObject();
|
|
|
Doctor doctor = doctorDao.findByCode(doctorCode);
|
|
|
//判断当前用户是健康管理师还是全科
|
|
@ -2199,11 +2214,11 @@ public class FamilyContractService extends BaseService {
|
|
|
" WHERE " +
|
|
|
" sf.type = 2 " +
|
|
|
" AND sf. STATUS >= 0 " +
|
|
|
" and sf.doctor_health = ? "+
|
|
|
" and sf.doctor_health = ? " +
|
|
|
" and sf.admin_team_code = ? ";
|
|
|
|
|
|
//查找居民
|
|
|
datas = jdbcTemplate.queryForList(sql, labelType, doctorCode,team);
|
|
|
datas = jdbcTemplate.queryForList(sql, labelType, doctorCode, team);
|
|
|
} else if (level.equals("2")) {
|
|
|
//全科
|
|
|
String sql = "SELECT " +
|
|
@ -2223,11 +2238,11 @@ public class FamilyContractService extends BaseService {
|
|
|
" WHERE " +
|
|
|
" sf.type = 2 " +
|
|
|
" AND sf. STATUS >= 0 " +
|
|
|
" and sf.doctor = ? "+
|
|
|
" and sf.doctor = ? " +
|
|
|
" and sf.admin_team_code = ? ";
|
|
|
|
|
|
//查找居民
|
|
|
datas = jdbcTemplate.queryForList(sql, labelType, doctorCode,team);
|
|
|
datas = jdbcTemplate.queryForList(sql, labelType, doctorCode, team);
|
|
|
|
|
|
} else {
|
|
|
throw new Exception("参数错误!");
|