협진과·입퇴원의사 4종 — 152종 → 156종
OCM_협진과(bzDataInterface.vb:6360 Case Else — 회신 완료 CstSttFlg='G' 협진의 회신 과, DISTINCT + 시작일 순 앞 2건을 ", " 결합. GNBEDRO 의 이중 DISTINCT 분기는 미이식), OCM_협진과_협진의(:6437 — M_UidMst 조인 + 앞 3건을 "과[의사]" 결합), OCM_입원의사(:6499 — 접수 시점 담당의 코드 → 접수일자 기준 UidNam), OCM_퇴원의사(:6583 — 퇴원일시가 비면 바로 빈 값, ILV 면 퇴원 시점·아니면 현재 시점 담당의 → 퇴원일자 기준 이름. 원문의 "퇴원일시 빈 값" If 갈래는 위의 조기 반환 탓에 도달 불가한 데드코드라 옮기지 않았다). CodInfAt(진료과+담당의 코드 행)·UserNameAt·Consults 를 신설. 이 시험 DB 에 O_CstInf 가 15,224행 있어 ㉞(회신 완료 협진이 있는 내원 → 협진과 실값)를 신설했다 — 2건 결합 확인. - dotnet test 338/338 · --edit-smoke 실패 0 (이름 검사 156종) - --db-patient ①~㉞ 전건 통과 - --db-render P062 md5 8d683835f5d81e7bb41c79071d6bf954 불변 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5
parent
c0ad782b6a
commit
f2f4cf81d3
@@ -101,12 +101,17 @@ public sealed class PatientContextStore
|
||||
/// 같은 규칙(시작일시 최신 1행)으로 고정한다. moment 가 비면 서버 현재시각이다.
|
||||
/// </summary>
|
||||
public string DepartmentCodeAt(decimal comNum, string? moment)
|
||||
=> PatientContext.Value(CodInfAt(comNum, moment), "CodDepCod");
|
||||
|
||||
/// <summary>특정 시점의 진료 행(진료과 코드 + 담당의 코드) — <see cref="DepartmentCodeAt"/> 의 원형</summary>
|
||||
public IReadOnlyDictionary<string, string> CodInfAt(decimal comNum, string? moment)
|
||||
{
|
||||
using var connection = new OracleConnection(connectionString);
|
||||
connection.Open();
|
||||
var at = (moment ?? string.Empty).Trim();
|
||||
var row = Row(connection,
|
||||
"SELECT CodDepCod FROM (SELECT CodDepCod FROM P_CodInf WHERE CodComNum = :k AND CodMtiSeq = 0"
|
||||
return Row(connection,
|
||||
"SELECT CodDepCod, CodDtrCod FROM (SELECT CodDepCod, CodDtrCod FROM P_CodInf"
|
||||
+ " WHERE CodComNum = :k AND CodMtiSeq = 0"
|
||||
+ (at.Length >= 12
|
||||
? " AND :t BETWEEN CodStrDtm AND CodEndDtm"
|
||||
: " AND TO_CHAR(SYSDATE, 'YYYYMMDDHH24MI') BETWEEN CodStrDtm AND CodEndDtm")
|
||||
@@ -114,7 +119,59 @@ public sealed class PatientContextStore
|
||||
at.Length >= 12
|
||||
? new (string, object)[] { ("k", comNum), ("t", at[..12]) }
|
||||
: new (string, object)[] { ("k", comNum) });
|
||||
return PatientContext.Value(row, "CodDepCod");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 특정 일자에 유효한 사용자 이름(M_UidMst.UidNam) — 입원의사·퇴원의사가 쓴다
|
||||
/// (bzDataInterface.vb:6520-6527). 유효기간이 겹치는 이중 행은 정상 데이터가 아니지만
|
||||
/// 원문의 Rows(0) 대신 한 행으로 고정한다.
|
||||
/// </summary>
|
||||
public string UserNameAt(string uidCod, string day)
|
||||
{
|
||||
if (uidCod.Trim().Length == 0 || day.Trim().Length < 8)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
using var connection = new OracleConnection(connectionString);
|
||||
connection.Open();
|
||||
var row = Row(connection,
|
||||
"SELECT UidNam FROM (SELECT UidNam FROM M_UidMst WHERE UidCod = :u"
|
||||
+ " AND :d BETWEEN UidStrDte AND UidEndDte ORDER BY UidStrDte DESC) WHERE ROWNUM = 1",
|
||||
("u", uidCod.Trim()), ("d", day.Trim()[..8]));
|
||||
return PatientContext.Value(row, "UidNam").Trim();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 협진 목록(bzDataInterface.vb:6360-6494) — 회신 완료(CstSttFlg='G')된 협진의
|
||||
/// 회신 과(+의사). 원문 그대로: DISTINCT + 시작일 순 + 앞에서 과는 2건, 과·의사는 3건.
|
||||
/// </summary>
|
||||
public IReadOnlyList<IReadOnlyDictionary<string, string>> Consults(decimal comNum, bool withDoctor)
|
||||
{
|
||||
using var connection = new OracleConnection(connectionString);
|
||||
connection.Open();
|
||||
using var command = connection.CreateCommand();
|
||||
command.BindByName = true;
|
||||
command.CommandText = withDoctor
|
||||
? "SELECT * FROM (SELECT DISTINCT UidCod, UidNam, DepCod, DepKorNam, CstStrDte FROM O_CstInf"
|
||||
+ " INNER JOIN M_DepMst ON CstRplDep = DepCod AND CstStrDte BETWEEN DepStrDte AND DepEndDte"
|
||||
+ " INNER JOIN M_UidMst ON CstRplDtr = UidCod AND CstStrDte BETWEEN UidStrDte AND UidEndDte"
|
||||
+ " WHERE CstComNum = :m AND CstSttFlg = 'G' ORDER BY CstStrDte) WHERE ROWNUM <= 3"
|
||||
: "SELECT * FROM (SELECT DISTINCT DepCod, DepKorNam, CstStrDte FROM O_CstInf"
|
||||
+ " INNER JOIN M_DepMst ON CstRplDep = DepCod AND CstStrDte BETWEEN DepStrDte AND DepEndDte"
|
||||
+ " WHERE CstComNum = :m AND CstSttFlg = 'G' ORDER BY CstStrDte) WHERE ROWNUM <= 2";
|
||||
command.Parameters.Add(new OracleParameter("m", comNum));
|
||||
var rows = new List<IReadOnlyDictionary<string, string>>();
|
||||
using var reader = command.ExecuteReader();
|
||||
while (reader.Read())
|
||||
{
|
||||
var row = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
|
||||
for (var i = 0; i < reader.FieldCount; i++)
|
||||
{
|
||||
row[reader.GetName(i)] = reader.IsDBNull(i) ? string.Empty : reader.GetValue(i).ToString()!.Trim();
|
||||
}
|
||||
rows.Add(row);
|
||||
}
|
||||
return rows;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user