|
|
@@ -7,7 +7,9 @@ import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
|
|
+import lombok.AllArgsConstructor;
|
|
|
import lombok.Data;
|
|
|
+import lombok.NoArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.thyy.emrquery.dao.EmrQualityControlDao;
|
|
|
@@ -20,6 +22,7 @@ import org.thyy.emrquery.utils.ListUtil;
|
|
|
import org.thyy.emrquery.utils.SocketUtil;
|
|
|
import org.thyy.emrquery.utils.StringUtil;
|
|
|
import org.thyy.emrquery.websocket.WebSocketServer;
|
|
|
+import org.thyy.utils.WebThreadLocal;
|
|
|
import org.thyy.utils.result.R;
|
|
|
import org.thyy.utils.result.ResultVo;
|
|
|
|
|
|
@@ -43,6 +46,15 @@ public class EmrQualityControlService {
|
|
|
*/
|
|
|
private final AfterTheInstructionIsGiven afterTheInstructionIsGiven;
|
|
|
|
|
|
+ @Data
|
|
|
+ @AllArgsConstructor
|
|
|
+ @NoArgsConstructor
|
|
|
+ public static class AuditParams {
|
|
|
+ private String startDate;
|
|
|
+ private String endDate;
|
|
|
+ private String approver;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 病程片段间隔
|
|
|
*/
|
|
|
@@ -72,7 +84,6 @@ public class EmrQualityControlService {
|
|
|
return percentFormat.format(result);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
public ResultVo<String> obtainTheProportionOfMedicalRecords(String startDate, String endDate, int finalControl) {
|
|
|
int linkQualityControlMolecules;
|
|
|
int linkQualityControlDenominator;
|
|
|
@@ -90,9 +101,17 @@ public class EmrQualityControlService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 环节质控
|
|
|
+ *
|
|
|
+ * @param params 数据
|
|
|
+ * @return 数据
|
|
|
+ */
|
|
|
public ResultVo<JSONObject> linkControl(LinkControlParams params) {
|
|
|
List<PatientInfo> list;
|
|
|
if ("intervalPatients".equals(params.getTimeType())) {
|
|
|
+ WebThreadLocal.create("AuditParams", new AuditParams(params.getStartDate(), params.getEndDate(), params.getApprover()));
|
|
|
+
|
|
|
String sql = "";
|
|
|
if (StringUtil.notBlank(params.getDeptCode())) {
|
|
|
sql = StrUtil.format("and zk_ward = '{}'", params.getDeptCode());
|
|
|
@@ -115,10 +134,12 @@ public class EmrQualityControlService {
|
|
|
return R.ok(js);
|
|
|
}
|
|
|
|
|
|
- public ResultVo<JSONObject> selectControlByPatNo(String patNo, Integer times) {
|
|
|
- return R.ok(patientEmrControlFunc(null, dao.selectControlByPatNo(patNo, times), SocketEnum.FINAL_CONTROL));
|
|
|
- }
|
|
|
-
|
|
|
+ /**
|
|
|
+ * 终末质控的高级检索
|
|
|
+ *
|
|
|
+ * @param param
|
|
|
+ * @return
|
|
|
+ */
|
|
|
public ResultVo<JSONObject> finalControlAdvancedRetrieval(FinalControlAdvancedRetrieval param) {
|
|
|
StringBuilder sb = new StringBuilder();
|
|
|
|
|
|
@@ -178,7 +199,7 @@ public class EmrQualityControlService {
|
|
|
sb.append(" and ( ")
|
|
|
.append(" dis_date >= '").append(param.getDisDate().get(0)).append("'")
|
|
|
.append(" and ")
|
|
|
- .append(" dis_date <= '").append(param.getDisDate().get(0)).append("'")
|
|
|
+ .append(" dis_date <= '").append(param.getDisDate().get(1)).append("'")
|
|
|
.append(" ) ");
|
|
|
}
|
|
|
|
|
|
@@ -199,6 +220,7 @@ public class EmrQualityControlService {
|
|
|
|
|
|
if (isQualityControl) {
|
|
|
sql.append(" where 1=1 ");
|
|
|
+ WebThreadLocal.create("AuditParams", new AuditParams(param.getStartDate(), param.getEndDate(), null));
|
|
|
}
|
|
|
|
|
|
if (ListUtil.notBlank(param.getDeptCode())) {
|
|
|
@@ -248,9 +270,6 @@ public class EmrQualityControlService {
|
|
|
afterAdmission.start(item, p);
|
|
|
afterTheInstructionIsGiven.start(item, p);
|
|
|
fragmentInterval.start(item, p);
|
|
|
- // 设置审核数据
|
|
|
-// List<EmrAuditDetail> auditDetail = dao.patientQualityControl(item.getPatNo(), item.getTimes());
|
|
|
-// item.setQualityControlOpinion(auditDetail);
|
|
|
setAdditionalInfo(item);
|
|
|
审核分组(电子病历审核分组, item);
|
|
|
socket.put("current", (i + 1));
|
|
|
@@ -270,7 +289,22 @@ public class EmrQualityControlService {
|
|
|
}
|
|
|
|
|
|
private void 审核分组(List<PatientInfo> 电子病历审核分组, PatientInfo 患者) {
|
|
|
- List<EmrAuditDetail> auditDetail = dao.patientQualityControl(患者.getPatNo(), 患者.getTimes());
|
|
|
+ AuditParams auditParams = WebThreadLocal.get("AuditParams");
|
|
|
+
|
|
|
+ QueryWrapper<EmrAuditDetail> qw = new QueryWrapper<>();
|
|
|
+ qw.eq("pat_no", 患者.getPatNo());
|
|
|
+ qw.eq("times", 患者.getTimes());
|
|
|
+ if (auditParams != null) {
|
|
|
+ qw.ge("review_time", auditParams.getStartDate());
|
|
|
+ qw.le("review_time", auditParams.getEndDate());
|
|
|
+
|
|
|
+ if (StrUtil.isNotBlank(auditParams.getApprover())) {
|
|
|
+ qw.eq("approver", auditParams.getApprover());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ List<EmrAuditDetail> auditDetail = dao.patientQualityControl(qw);
|
|
|
if (auditDetail.isEmpty()) {
|
|
|
return;
|
|
|
}
|
|
|
@@ -341,4 +375,5 @@ public class EmrQualityControlService {
|
|
|
|
|
|
}
|
|
|
|
|
|
+
|
|
|
}
|