~umgeher/utos-usr-local-hcs-exam-ecg

ref: 67b7a6f4e83990d7d5591d5cd8c3f01486a4efa4 utos-usr-local-hcs-exam-ecg/src/utos_usr_local_hcs_exam_ecg_wb_delete.erl -rw-r--r-- 1015 bytes
67b7a6f4Umgeher Torgersen qt-ai upgraded to 0.2.0 1 year, 27 days ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
-module(utos_usr_local_hcs_exam_ecg_wb_delete).

-include_lib("utos_usr_db_influx/src/utos_usr_db_influx.hrl").
-include_lib("utos_usr_local_hcs_exam_include/src/utos_usr_local_hcs_exam_include.hrl").

-export([delete/4]).

delete(WB, [T0, T1], Influx, TSK) when is_binary(T0) ->
    delete(WB, [erlang:binary_to_integer(T0), T1], Influx, TSK);
delete(WB, [T0, T1], Influx, TSK) when is_binary(T1) ->
    delete(WB, [T0, erlang:binary_to_integer(T1)], Influx, TSK);
delete(#wb{ecg = null, exam = Exam, uid = null} = WB, TS, Influx, TSK) ->
    {ok, ECG} = utos_usr_local_Hcs_exam_ecg:uid(Exam),
    delete(WB#wb{ecg = ECG}, TS, Influx, TSK);
delete(#wb{ecg = ECG, phy = Phy, uid = null} = WB, TS, Influx, TSK) ->
    {ok, UID} = utos_usr_local_hcs_exam_ecg:wb_uid(ECG, Phy),
    delete(WB#wb{uid = UID}, TS, Influx, TSK);
delete(#wb{uid = UID}, [T0, T1], {Influx, DB}, TSK) when is_binary(UID) ->
    _ = utos_usr_db_influx:delete(Influx, DB, UID, [T0, T1]),
    _ = utos_usr_local_tsk:done(TSK),
    {ok, delete}.