2025-11-26 19:23:42 +00:00
|
|
|
// Code generated by sqlc. DO NOT EDIT.
|
|
|
|
|
// versions:
|
|
|
|
|
// sqlc v1.27.0
|
|
|
|
|
// source: fieldextractions.sql
|
|
|
|
|
|
|
|
|
|
package repository
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"context"
|
|
|
|
|
|
|
|
|
|
"github.com/google/uuid"
|
|
|
|
|
"github.com/jackc/pgx/v5/pgtype"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
const addFieldExtraction = `-- name: AddFieldExtraction :one
|
|
|
|
|
INSERT INTO documentFieldExtractions (
|
|
|
|
|
documentId,
|
|
|
|
|
fileName,
|
|
|
|
|
contractTitle,
|
|
|
|
|
aareteDerivedAmendmentNum,
|
|
|
|
|
clientName,
|
|
|
|
|
payerName,
|
|
|
|
|
payerState,
|
|
|
|
|
providerState,
|
|
|
|
|
filenameTin,
|
|
|
|
|
provGroupTin,
|
|
|
|
|
provGroupNpi,
|
|
|
|
|
provGroupNameFull,
|
|
|
|
|
provOtherTin,
|
|
|
|
|
provOtherNpi,
|
|
|
|
|
provOtherNameFull,
|
|
|
|
|
aareteDerivedEffectiveDt,
|
|
|
|
|
aareteDerivedTerminationDt,
|
|
|
|
|
autoRenewalInd,
|
|
|
|
|
autoRenewalTerm,
|
|
|
|
|
createdBy
|
|
|
|
|
) VALUES (
|
|
|
|
|
$1, $2, $3, $4, $5, $6, $7, $8, $9, $10,
|
|
|
|
|
$11, $12, $13, $14, $15, $16, $17, $18, $19, $20
|
|
|
|
|
)
|
|
|
|
|
RETURNING id, documentid, filename, contracttitle, aaretederivedamendmentnum, clientname, payername, payerstate, providerstate, filenametin, provgrouptin, provgroupnpi, provgroupnamefull, provothertin, provothernpi, provothernamefull, aaretederivedeffectivedt, aaretederivedterminationdt, autorenewalind, autorenewalterm, createdat, createdby
|
|
|
|
|
`
|
|
|
|
|
|
|
|
|
|
type AddFieldExtractionParams struct {
|
|
|
|
|
Documentid uuid.UUID `db:"documentid"`
|
|
|
|
|
Filename *string `db:"filename"`
|
|
|
|
|
Contracttitle *string `db:"contracttitle"`
|
|
|
|
|
Aaretederivedamendmentnum *int32 `db:"aaretederivedamendmentnum"`
|
|
|
|
|
Clientname *string `db:"clientname"`
|
|
|
|
|
Payername *string `db:"payername"`
|
|
|
|
|
Payerstate *string `db:"payerstate"`
|
|
|
|
|
Providerstate *string `db:"providerstate"`
|
|
|
|
|
Filenametin *string `db:"filenametin"`
|
|
|
|
|
Provgrouptin *string `db:"provgrouptin"`
|
|
|
|
|
Provgroupnpi *string `db:"provgroupnpi"`
|
|
|
|
|
Provgroupnamefull *string `db:"provgroupnamefull"`
|
|
|
|
|
Provothertin *string `db:"provothertin"`
|
|
|
|
|
Provothernpi *string `db:"provothernpi"`
|
|
|
|
|
Provothernamefull *string `db:"provothernamefull"`
|
|
|
|
|
Aaretederivedeffectivedt pgtype.Date `db:"aaretederivedeffectivedt"`
|
|
|
|
|
Aaretederivedterminationdt pgtype.Date `db:"aaretederivedterminationdt"`
|
|
|
|
|
Autorenewalind *bool `db:"autorenewalind"`
|
|
|
|
|
Autorenewalterm *string `db:"autorenewalterm"`
|
|
|
|
|
Createdby string `db:"createdby"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// AddFieldExtraction
|
|
|
|
|
//
|
|
|
|
|
// INSERT INTO documentFieldExtractions (
|
|
|
|
|
// documentId,
|
|
|
|
|
// fileName,
|
|
|
|
|
// contractTitle,
|
|
|
|
|
// aareteDerivedAmendmentNum,
|
|
|
|
|
// clientName,
|
|
|
|
|
// payerName,
|
|
|
|
|
// payerState,
|
|
|
|
|
// providerState,
|
|
|
|
|
// filenameTin,
|
|
|
|
|
// provGroupTin,
|
|
|
|
|
// provGroupNpi,
|
|
|
|
|
// provGroupNameFull,
|
|
|
|
|
// provOtherTin,
|
|
|
|
|
// provOtherNpi,
|
|
|
|
|
// provOtherNameFull,
|
|
|
|
|
// aareteDerivedEffectiveDt,
|
|
|
|
|
// aareteDerivedTerminationDt,
|
|
|
|
|
// autoRenewalInd,
|
|
|
|
|
// autoRenewalTerm,
|
|
|
|
|
// createdBy
|
|
|
|
|
// ) VALUES (
|
|
|
|
|
// $1, $2, $3, $4, $5, $6, $7, $8, $9, $10,
|
|
|
|
|
// $11, $12, $13, $14, $15, $16, $17, $18, $19, $20
|
|
|
|
|
// )
|
|
|
|
|
// RETURNING id, documentid, filename, contracttitle, aaretederivedamendmentnum, clientname, payername, payerstate, providerstate, filenametin, provgrouptin, provgroupnpi, provgroupnamefull, provothertin, provothernpi, provothernamefull, aaretederivedeffectivedt, aaretederivedterminationdt, autorenewalind, autorenewalterm, createdat, createdby
|
|
|
|
|
func (q *Queries) AddFieldExtraction(ctx context.Context, arg *AddFieldExtractionParams) (*Documentfieldextraction, error) {
|
|
|
|
|
row := q.db.QueryRow(ctx, addFieldExtraction,
|
|
|
|
|
arg.Documentid,
|
|
|
|
|
arg.Filename,
|
|
|
|
|
arg.Contracttitle,
|
|
|
|
|
arg.Aaretederivedamendmentnum,
|
|
|
|
|
arg.Clientname,
|
|
|
|
|
arg.Payername,
|
|
|
|
|
arg.Payerstate,
|
|
|
|
|
arg.Providerstate,
|
|
|
|
|
arg.Filenametin,
|
|
|
|
|
arg.Provgrouptin,
|
|
|
|
|
arg.Provgroupnpi,
|
|
|
|
|
arg.Provgroupnamefull,
|
|
|
|
|
arg.Provothertin,
|
|
|
|
|
arg.Provothernpi,
|
|
|
|
|
arg.Provothernamefull,
|
|
|
|
|
arg.Aaretederivedeffectivedt,
|
|
|
|
|
arg.Aaretederivedterminationdt,
|
|
|
|
|
arg.Autorenewalind,
|
|
|
|
|
arg.Autorenewalterm,
|
|
|
|
|
arg.Createdby,
|
|
|
|
|
)
|
|
|
|
|
var i Documentfieldextraction
|
|
|
|
|
err := row.Scan(
|
|
|
|
|
&i.ID,
|
|
|
|
|
&i.Documentid,
|
|
|
|
|
&i.Filename,
|
|
|
|
|
&i.Contracttitle,
|
|
|
|
|
&i.Aaretederivedamendmentnum,
|
|
|
|
|
&i.Clientname,
|
|
|
|
|
&i.Payername,
|
|
|
|
|
&i.Payerstate,
|
|
|
|
|
&i.Providerstate,
|
|
|
|
|
&i.Filenametin,
|
|
|
|
|
&i.Provgrouptin,
|
|
|
|
|
&i.Provgroupnpi,
|
|
|
|
|
&i.Provgroupnamefull,
|
|
|
|
|
&i.Provothertin,
|
|
|
|
|
&i.Provothernpi,
|
|
|
|
|
&i.Provothernamefull,
|
|
|
|
|
&i.Aaretederivedeffectivedt,
|
|
|
|
|
&i.Aaretederivedterminationdt,
|
|
|
|
|
&i.Autorenewalind,
|
|
|
|
|
&i.Autorenewalterm,
|
|
|
|
|
&i.Createdat,
|
|
|
|
|
&i.Createdby,
|
|
|
|
|
)
|
|
|
|
|
return &i, err
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const addFieldExtractionArrayField = `-- name: AddFieldExtractionArrayField :exec
|
|
|
|
|
INSERT INTO documentFieldExtractionArrayFields (
|
|
|
|
|
fieldExtractionId,
|
|
|
|
|
arrayIndex,
|
|
|
|
|
exhibitTitle,
|
|
|
|
|
exhibitPage,
|
|
|
|
|
reimbProvTin,
|
|
|
|
|
reimbProvNpi,
|
|
|
|
|
reimbProvName,
|
|
|
|
|
reimbEffectiveDt,
|
|
|
|
|
reimbTerminationDt,
|
|
|
|
|
aareteDerivedClaimTypeCd,
|
|
|
|
|
aareteDerivedProduct,
|
|
|
|
|
aareteDerivedLob,
|
|
|
|
|
aareteDerivedProgram,
|
|
|
|
|
aareteDerivedNetwork,
|
|
|
|
|
aareteDerivedProvType,
|
|
|
|
|
provTaxonomyCd,
|
|
|
|
|
provTaxonomyCdDesc,
|
|
|
|
|
provSpecialtyCd,
|
|
|
|
|
provSpecialtyCdDesc,
|
|
|
|
|
placeOfServiceCd,
|
|
|
|
|
placeOfServiceCdDesc,
|
|
|
|
|
billTypeCd,
|
|
|
|
|
billTypeCdDesc,
|
|
|
|
|
patientAgeMin,
|
|
|
|
|
patientAgeMax,
|
|
|
|
|
reimbTerm,
|
|
|
|
|
lobProgramRelationship,
|
|
|
|
|
lobProductRelationship,
|
|
|
|
|
carveoutInd,
|
|
|
|
|
carveoutCd,
|
|
|
|
|
lesserOfInd,
|
|
|
|
|
greaterOfInd,
|
|
|
|
|
aareteDerivedReimbMethod,
|
|
|
|
|
unitOfMeasure,
|
|
|
|
|
reimbPctRate,
|
|
|
|
|
reimbFeeRate,
|
|
|
|
|
reimbConversionFactor,
|
|
|
|
|
triggerCapThresholdAmt,
|
|
|
|
|
triggerBaseThreshold,
|
|
|
|
|
defaultInd,
|
|
|
|
|
additionDesc,
|
|
|
|
|
additionMaxFeeRateInc,
|
|
|
|
|
additionMaxPctRateInc,
|
|
|
|
|
aareteDerivedAdditionRateChangeTimeline,
|
|
|
|
|
aareteDerivedFeeSchedule,
|
|
|
|
|
aareteDerivedFeeScheduleVersion,
|
|
|
|
|
serviceTerm,
|
|
|
|
|
cpt4ProcCd,
|
|
|
|
|
cpt4ProcCdDesc,
|
|
|
|
|
cpt4ProcMod,
|
|
|
|
|
cpt4ProcModDesc,
|
|
|
|
|
revenueCd,
|
|
|
|
|
revenueCdDesc,
|
|
|
|
|
diagCd,
|
|
|
|
|
diagCdDesc,
|
|
|
|
|
ndcCd,
|
|
|
|
|
ndcCdDesc,
|
|
|
|
|
claimAdmitTypeCd,
|
|
|
|
|
authAdmitTypeDesc,
|
|
|
|
|
claimStatusCd,
|
|
|
|
|
claimStatusCdDesc,
|
|
|
|
|
grouperType,
|
|
|
|
|
grouperCd,
|
|
|
|
|
grouperCdDesc,
|
|
|
|
|
grouperPctRate,
|
|
|
|
|
grouperBaseRate,
|
|
|
|
|
aareteDerivedGrouperVersion,
|
|
|
|
|
grouperAlternativeLevelOfCare,
|
|
|
|
|
grouperSeverityInd,
|
|
|
|
|
grouperSeverity,
|
|
|
|
|
grouperRiskOfMortalitySubclass,
|
|
|
|
|
grouperTransferInd,
|
|
|
|
|
grouperReadmissionsInd,
|
|
|
|
|
grouperHacInd,
|
|
|
|
|
outlierTerm,
|
|
|
|
|
outlierFirstDollarInd,
|
|
|
|
|
rangeNbrDays,
|
|
|
|
|
outlierFixedLossNbrDaysThreshold,
|
|
|
|
|
outlierFixedLossThreshold,
|
|
|
|
|
outlierMaximum,
|
|
|
|
|
outlierMaximumFrequency,
|
|
|
|
|
outlierPctRate,
|
|
|
|
|
outlierExclusionCd,
|
|
|
|
|
outlierExclusionCdDesc,
|
|
|
|
|
facilityAdjustmentTerm,
|
|
|
|
|
dshInd,
|
|
|
|
|
dshPctRate,
|
|
|
|
|
dshFeeRate,
|
|
|
|
|
imeInd,
|
|
|
|
|
imePctRate,
|
|
|
|
|
imeFeeRate,
|
|
|
|
|
ntapInd,
|
|
|
|
|
ntapPctRate,
|
|
|
|
|
ntapFeeRate,
|
|
|
|
|
ucInd,
|
|
|
|
|
ucPctRate,
|
|
|
|
|
ucFeeRate,
|
|
|
|
|
gmeInd,
|
|
|
|
|
gmePctRate,
|
|
|
|
|
gmeFeeRate,
|
|
|
|
|
rateEscalatorInd,
|
|
|
|
|
rateEscalatorDesc,
|
|
|
|
|
rateEscalatorMaxRateIncPct,
|
|
|
|
|
rateEscalatorRateChangeTimeline,
|
|
|
|
|
stopLossTerm,
|
|
|
|
|
stopLossFirstDollarInd,
|
|
|
|
|
stopLossRangeNbrDays,
|
|
|
|
|
stopLossFixedLossThreshold,
|
|
|
|
|
stopLossMaximum,
|
|
|
|
|
stopLossMaximumFrequency,
|
|
|
|
|
stopLossDailyMaxRate,
|
|
|
|
|
stopLossPctRateOnExcessCharges,
|
|
|
|
|
stopLossExclusionCd,
|
|
|
|
|
stopLossExclusionDesc
|
|
|
|
|
) VALUES (
|
|
|
|
|
$1, $2, $3, $4, $5, $6, $7, $8, $9, $10,
|
|
|
|
|
$11, $12, $13, $14, $15, $16, $17, $18, $19, $20,
|
|
|
|
|
$21, $22, $23, $24, $25, $26, $27, $28, $29, $30,
|
|
|
|
|
$31, $32, $33, $34, $35, $36, $37, $38, $39, $40,
|
|
|
|
|
$41, $42, $43, $44, $45, $46, $47, $48, $49, $50,
|
|
|
|
|
$51, $52, $53, $54, $55, $56, $57, $58, $59, $60,
|
|
|
|
|
$61, $62, $63, $64, $65, $66, $67, $68, $69, $70,
|
|
|
|
|
$71, $72, $73, $74, $75, $76, $77, $78, $79, $80,
|
|
|
|
|
$81, $82, $83, $84, $85, $86, $87, $88, $89, $90,
|
|
|
|
|
$91, $92, $93, $94, $95, $96, $97, $98, $99, $100,
|
|
|
|
|
$101, $102, $103, $104, $105, $106, $107, $108, $109, $110,
|
|
|
|
|
$111, $112, $113, $114
|
|
|
|
|
)
|
|
|
|
|
`
|
|
|
|
|
|
|
|
|
|
type AddFieldExtractionArrayFieldParams struct {
|
|
|
|
|
Fieldextractionid uuid.UUID `db:"fieldextractionid"`
|
|
|
|
|
Arrayindex int16 `db:"arrayindex"`
|
|
|
|
|
Exhibittitle *string `db:"exhibittitle"`
|
|
|
|
|
Exhibitpage *string `db:"exhibitpage"`
|
|
|
|
|
Reimbprovtin *string `db:"reimbprovtin"`
|
|
|
|
|
Reimbprovnpi *string `db:"reimbprovnpi"`
|
|
|
|
|
Reimbprovname *string `db:"reimbprovname"`
|
|
|
|
|
Reimbeffectivedt pgtype.Date `db:"reimbeffectivedt"`
|
|
|
|
|
Reimbterminationdt pgtype.Date `db:"reimbterminationdt"`
|
|
|
|
|
Aaretederivedclaimtypecd *string `db:"aaretederivedclaimtypecd"`
|
|
|
|
|
Aaretederivedproduct *string `db:"aaretederivedproduct"`
|
|
|
|
|
Aaretederivedlob *string `db:"aaretederivedlob"`
|
|
|
|
|
Aaretederivedprogram *string `db:"aaretederivedprogram"`
|
|
|
|
|
Aaretederivednetwork *string `db:"aaretederivednetwork"`
|
|
|
|
|
Aaretederivedprovtype *string `db:"aaretederivedprovtype"`
|
|
|
|
|
Provtaxonomycd *string `db:"provtaxonomycd"`
|
|
|
|
|
Provtaxonomycddesc *string `db:"provtaxonomycddesc"`
|
|
|
|
|
Provspecialtycd *string `db:"provspecialtycd"`
|
|
|
|
|
Provspecialtycddesc *string `db:"provspecialtycddesc"`
|
|
|
|
|
Placeofservicecd *string `db:"placeofservicecd"`
|
|
|
|
|
Placeofservicecddesc *string `db:"placeofservicecddesc"`
|
|
|
|
|
Billtypecd *string `db:"billtypecd"`
|
|
|
|
|
Billtypecddesc *string `db:"billtypecddesc"`
|
|
|
|
|
Patientagemin *string `db:"patientagemin"`
|
|
|
|
|
Patientagemax *string `db:"patientagemax"`
|
|
|
|
|
Reimbterm *string `db:"reimbterm"`
|
|
|
|
|
Lobprogramrelationship *string `db:"lobprogramrelationship"`
|
|
|
|
|
Lobproductrelationship *string `db:"lobproductrelationship"`
|
|
|
|
|
Carveoutind *bool `db:"carveoutind"`
|
|
|
|
|
Carveoutcd *string `db:"carveoutcd"`
|
|
|
|
|
Lesserofind *bool `db:"lesserofind"`
|
|
|
|
|
Greaterofind *bool `db:"greaterofind"`
|
|
|
|
|
Aaretederivedreimbmethod *string `db:"aaretederivedreimbmethod"`
|
|
|
|
|
Unitofmeasure *string `db:"unitofmeasure"`
|
|
|
|
|
Reimbpctrate pgtype.Numeric `db:"reimbpctrate"`
|
|
|
|
|
Reimbfeerate pgtype.Numeric `db:"reimbfeerate"`
|
|
|
|
|
Reimbconversionfactor pgtype.Numeric `db:"reimbconversionfactor"`
|
|
|
|
|
Triggercapthresholdamt pgtype.Numeric `db:"triggercapthresholdamt"`
|
|
|
|
|
Triggerbasethreshold pgtype.Numeric `db:"triggerbasethreshold"`
|
|
|
|
|
Defaultind *bool `db:"defaultind"`
|
|
|
|
|
Additiondesc *string `db:"additiondesc"`
|
|
|
|
|
Additionmaxfeerateinc pgtype.Numeric `db:"additionmaxfeerateinc"`
|
|
|
|
|
Additionmaxpctrateinc pgtype.Numeric `db:"additionmaxpctrateinc"`
|
|
|
|
|
Aaretederivedadditionratechangetimeline *string `db:"aaretederivedadditionratechangetimeline"`
|
|
|
|
|
Aaretederivedfeeschedule *string `db:"aaretederivedfeeschedule"`
|
|
|
|
|
Aaretederivedfeescheduleversion *string `db:"aaretederivedfeescheduleversion"`
|
|
|
|
|
Serviceterm *string `db:"serviceterm"`
|
|
|
|
|
Cpt4proccd *string `db:"cpt4proccd"`
|
|
|
|
|
Cpt4proccddesc *string `db:"cpt4proccddesc"`
|
|
|
|
|
Cpt4procmod *string `db:"cpt4procmod"`
|
|
|
|
|
Cpt4procmoddesc *string `db:"cpt4procmoddesc"`
|
|
|
|
|
Revenuecd *string `db:"revenuecd"`
|
|
|
|
|
Revenuecddesc *string `db:"revenuecddesc"`
|
|
|
|
|
Diagcd *string `db:"diagcd"`
|
|
|
|
|
Diagcddesc *string `db:"diagcddesc"`
|
|
|
|
|
Ndccd *string `db:"ndccd"`
|
|
|
|
|
Ndccddesc *string `db:"ndccddesc"`
|
|
|
|
|
Claimadmittypecd *string `db:"claimadmittypecd"`
|
|
|
|
|
Authadmittypedesc *string `db:"authadmittypedesc"`
|
|
|
|
|
Claimstatuscd *string `db:"claimstatuscd"`
|
|
|
|
|
Claimstatuscddesc *string `db:"claimstatuscddesc"`
|
|
|
|
|
Groupertype *string `db:"groupertype"`
|
|
|
|
|
Groupercd *string `db:"groupercd"`
|
|
|
|
|
Groupercddesc *string `db:"groupercddesc"`
|
|
|
|
|
Grouperpctrate pgtype.Numeric `db:"grouperpctrate"`
|
|
|
|
|
Grouperbaserate pgtype.Numeric `db:"grouperbaserate"`
|
|
|
|
|
Aaretederivedgrouperversion *string `db:"aaretederivedgrouperversion"`
|
|
|
|
|
Grouperalternativelevelofcare *string `db:"grouperalternativelevelofcare"`
|
|
|
|
|
Grouperseverityind *bool `db:"grouperseverityind"`
|
|
|
|
|
Grouperseverity *string `db:"grouperseverity"`
|
|
|
|
|
Grouperriskofmortalitysubclass *string `db:"grouperriskofmortalitysubclass"`
|
|
|
|
|
Groupertransferind *bool `db:"groupertransferind"`
|
|
|
|
|
Grouperreadmissionsind *bool `db:"grouperreadmissionsind"`
|
|
|
|
|
Grouperhacind *bool `db:"grouperhacind"`
|
|
|
|
|
Outlierterm *string `db:"outlierterm"`
|
|
|
|
|
Outlierfirstdollarind *bool `db:"outlierfirstdollarind"`
|
|
|
|
|
Rangenbrdays *string `db:"rangenbrdays"`
|
|
|
|
|
Outlierfixedlossnbrdaysthreshold pgtype.Numeric `db:"outlierfixedlossnbrdaysthreshold"`
|
|
|
|
|
Outlierfixedlossthreshold pgtype.Numeric `db:"outlierfixedlossthreshold"`
|
|
|
|
|
Outliermaximum pgtype.Numeric `db:"outliermaximum"`
|
|
|
|
|
Outliermaximumfrequency pgtype.Numeric `db:"outliermaximumfrequency"`
|
|
|
|
|
Outlierpctrate pgtype.Numeric `db:"outlierpctrate"`
|
|
|
|
|
Outlierexclusioncd *string `db:"outlierexclusioncd"`
|
|
|
|
|
Outlierexclusioncddesc *string `db:"outlierexclusioncddesc"`
|
|
|
|
|
Facilityadjustmentterm *string `db:"facilityadjustmentterm"`
|
|
|
|
|
Dshind *bool `db:"dshind"`
|
|
|
|
|
Dshpctrate pgtype.Numeric `db:"dshpctrate"`
|
|
|
|
|
Dshfeerate pgtype.Numeric `db:"dshfeerate"`
|
|
|
|
|
Imeind *bool `db:"imeind"`
|
|
|
|
|
Imepctrate pgtype.Numeric `db:"imepctrate"`
|
|
|
|
|
Imefeerate pgtype.Numeric `db:"imefeerate"`
|
|
|
|
|
Ntapind *bool `db:"ntapind"`
|
|
|
|
|
Ntappctrate pgtype.Numeric `db:"ntappctrate"`
|
|
|
|
|
Ntapfeerate pgtype.Numeric `db:"ntapfeerate"`
|
|
|
|
|
Ucind *bool `db:"ucind"`
|
|
|
|
|
Ucpctrate pgtype.Numeric `db:"ucpctrate"`
|
|
|
|
|
Ucfeerate pgtype.Numeric `db:"ucfeerate"`
|
|
|
|
|
Gmeind *bool `db:"gmeind"`
|
|
|
|
|
Gmepctrate pgtype.Numeric `db:"gmepctrate"`
|
|
|
|
|
Gmefeerate pgtype.Numeric `db:"gmefeerate"`
|
|
|
|
|
Rateescalatorind *bool `db:"rateescalatorind"`
|
|
|
|
|
Rateescalatordesc *string `db:"rateescalatordesc"`
|
|
|
|
|
Rateescalatormaxrateincpct pgtype.Numeric `db:"rateescalatormaxrateincpct"`
|
|
|
|
|
Rateescalatorratechangetimeline pgtype.Numeric `db:"rateescalatorratechangetimeline"`
|
|
|
|
|
Stoplossterm *string `db:"stoplossterm"`
|
|
|
|
|
Stoplossfirstdollarind *bool `db:"stoplossfirstdollarind"`
|
|
|
|
|
Stoplossrangenbrdays pgtype.Numeric `db:"stoplossrangenbrdays"`
|
|
|
|
|
Stoplossfixedlossthreshold pgtype.Numeric `db:"stoplossfixedlossthreshold"`
|
|
|
|
|
Stoplossmaximum pgtype.Numeric `db:"stoplossmaximum"`
|
|
|
|
|
Stoplossmaximumfrequency pgtype.Numeric `db:"stoplossmaximumfrequency"`
|
|
|
|
|
Stoplossdailymaxrate pgtype.Numeric `db:"stoplossdailymaxrate"`
|
|
|
|
|
Stoplosspctrateonexcesscharges pgtype.Numeric `db:"stoplosspctrateonexcesscharges"`
|
|
|
|
|
Stoplossexclusioncd *string `db:"stoplossexclusioncd"`
|
|
|
|
|
Stoplossexclusiondesc *string `db:"stoplossexclusiondesc"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// AddFieldExtractionArrayField
|
|
|
|
|
//
|
|
|
|
|
// INSERT INTO documentFieldExtractionArrayFields (
|
|
|
|
|
// fieldExtractionId,
|
|
|
|
|
// arrayIndex,
|
|
|
|
|
// exhibitTitle,
|
|
|
|
|
// exhibitPage,
|
|
|
|
|
// reimbProvTin,
|
|
|
|
|
// reimbProvNpi,
|
|
|
|
|
// reimbProvName,
|
|
|
|
|
// reimbEffectiveDt,
|
|
|
|
|
// reimbTerminationDt,
|
|
|
|
|
// aareteDerivedClaimTypeCd,
|
|
|
|
|
// aareteDerivedProduct,
|
|
|
|
|
// aareteDerivedLob,
|
|
|
|
|
// aareteDerivedProgram,
|
|
|
|
|
// aareteDerivedNetwork,
|
|
|
|
|
// aareteDerivedProvType,
|
|
|
|
|
// provTaxonomyCd,
|
|
|
|
|
// provTaxonomyCdDesc,
|
|
|
|
|
// provSpecialtyCd,
|
|
|
|
|
// provSpecialtyCdDesc,
|
|
|
|
|
// placeOfServiceCd,
|
|
|
|
|
// placeOfServiceCdDesc,
|
|
|
|
|
// billTypeCd,
|
|
|
|
|
// billTypeCdDesc,
|
|
|
|
|
// patientAgeMin,
|
|
|
|
|
// patientAgeMax,
|
|
|
|
|
// reimbTerm,
|
|
|
|
|
// lobProgramRelationship,
|
|
|
|
|
// lobProductRelationship,
|
|
|
|
|
// carveoutInd,
|
|
|
|
|
// carveoutCd,
|
|
|
|
|
// lesserOfInd,
|
|
|
|
|
// greaterOfInd,
|
|
|
|
|
// aareteDerivedReimbMethod,
|
|
|
|
|
// unitOfMeasure,
|
|
|
|
|
// reimbPctRate,
|
|
|
|
|
// reimbFeeRate,
|
|
|
|
|
// reimbConversionFactor,
|
|
|
|
|
// triggerCapThresholdAmt,
|
|
|
|
|
// triggerBaseThreshold,
|
|
|
|
|
// defaultInd,
|
|
|
|
|
// additionDesc,
|
|
|
|
|
// additionMaxFeeRateInc,
|
|
|
|
|
// additionMaxPctRateInc,
|
|
|
|
|
// aareteDerivedAdditionRateChangeTimeline,
|
|
|
|
|
// aareteDerivedFeeSchedule,
|
|
|
|
|
// aareteDerivedFeeScheduleVersion,
|
|
|
|
|
// serviceTerm,
|
|
|
|
|
// cpt4ProcCd,
|
|
|
|
|
// cpt4ProcCdDesc,
|
|
|
|
|
// cpt4ProcMod,
|
|
|
|
|
// cpt4ProcModDesc,
|
|
|
|
|
// revenueCd,
|
|
|
|
|
// revenueCdDesc,
|
|
|
|
|
// diagCd,
|
|
|
|
|
// diagCdDesc,
|
|
|
|
|
// ndcCd,
|
|
|
|
|
// ndcCdDesc,
|
|
|
|
|
// claimAdmitTypeCd,
|
|
|
|
|
// authAdmitTypeDesc,
|
|
|
|
|
// claimStatusCd,
|
|
|
|
|
// claimStatusCdDesc,
|
|
|
|
|
// grouperType,
|
|
|
|
|
// grouperCd,
|
|
|
|
|
// grouperCdDesc,
|
|
|
|
|
// grouperPctRate,
|
|
|
|
|
// grouperBaseRate,
|
|
|
|
|
// aareteDerivedGrouperVersion,
|
|
|
|
|
// grouperAlternativeLevelOfCare,
|
|
|
|
|
// grouperSeverityInd,
|
|
|
|
|
// grouperSeverity,
|
|
|
|
|
// grouperRiskOfMortalitySubclass,
|
|
|
|
|
// grouperTransferInd,
|
|
|
|
|
// grouperReadmissionsInd,
|
|
|
|
|
// grouperHacInd,
|
|
|
|
|
// outlierTerm,
|
|
|
|
|
// outlierFirstDollarInd,
|
|
|
|
|
// rangeNbrDays,
|
|
|
|
|
// outlierFixedLossNbrDaysThreshold,
|
|
|
|
|
// outlierFixedLossThreshold,
|
|
|
|
|
// outlierMaximum,
|
|
|
|
|
// outlierMaximumFrequency,
|
|
|
|
|
// outlierPctRate,
|
|
|
|
|
// outlierExclusionCd,
|
|
|
|
|
// outlierExclusionCdDesc,
|
|
|
|
|
// facilityAdjustmentTerm,
|
|
|
|
|
// dshInd,
|
|
|
|
|
// dshPctRate,
|
|
|
|
|
// dshFeeRate,
|
|
|
|
|
// imeInd,
|
|
|
|
|
// imePctRate,
|
|
|
|
|
// imeFeeRate,
|
|
|
|
|
// ntapInd,
|
|
|
|
|
// ntapPctRate,
|
|
|
|
|
// ntapFeeRate,
|
|
|
|
|
// ucInd,
|
|
|
|
|
// ucPctRate,
|
|
|
|
|
// ucFeeRate,
|
|
|
|
|
// gmeInd,
|
|
|
|
|
// gmePctRate,
|
|
|
|
|
// gmeFeeRate,
|
|
|
|
|
// rateEscalatorInd,
|
|
|
|
|
// rateEscalatorDesc,
|
|
|
|
|
// rateEscalatorMaxRateIncPct,
|
|
|
|
|
// rateEscalatorRateChangeTimeline,
|
|
|
|
|
// stopLossTerm,
|
|
|
|
|
// stopLossFirstDollarInd,
|
|
|
|
|
// stopLossRangeNbrDays,
|
|
|
|
|
// stopLossFixedLossThreshold,
|
|
|
|
|
// stopLossMaximum,
|
|
|
|
|
// stopLossMaximumFrequency,
|
|
|
|
|
// stopLossDailyMaxRate,
|
|
|
|
|
// stopLossPctRateOnExcessCharges,
|
|
|
|
|
// stopLossExclusionCd,
|
|
|
|
|
// stopLossExclusionDesc
|
|
|
|
|
// ) VALUES (
|
|
|
|
|
// $1, $2, $3, $4, $5, $6, $7, $8, $9, $10,
|
|
|
|
|
// $11, $12, $13, $14, $15, $16, $17, $18, $19, $20,
|
|
|
|
|
// $21, $22, $23, $24, $25, $26, $27, $28, $29, $30,
|
|
|
|
|
// $31, $32, $33, $34, $35, $36, $37, $38, $39, $40,
|
|
|
|
|
// $41, $42, $43, $44, $45, $46, $47, $48, $49, $50,
|
|
|
|
|
// $51, $52, $53, $54, $55, $56, $57, $58, $59, $60,
|
|
|
|
|
// $61, $62, $63, $64, $65, $66, $67, $68, $69, $70,
|
|
|
|
|
// $71, $72, $73, $74, $75, $76, $77, $78, $79, $80,
|
|
|
|
|
// $81, $82, $83, $84, $85, $86, $87, $88, $89, $90,
|
|
|
|
|
// $91, $92, $93, $94, $95, $96, $97, $98, $99, $100,
|
|
|
|
|
// $101, $102, $103, $104, $105, $106, $107, $108, $109, $110,
|
|
|
|
|
// $111, $112, $113, $114
|
|
|
|
|
// )
|
|
|
|
|
func (q *Queries) AddFieldExtractionArrayField(ctx context.Context, arg *AddFieldExtractionArrayFieldParams) error {
|
|
|
|
|
_, err := q.db.Exec(ctx, addFieldExtractionArrayField,
|
|
|
|
|
arg.Fieldextractionid,
|
|
|
|
|
arg.Arrayindex,
|
|
|
|
|
arg.Exhibittitle,
|
|
|
|
|
arg.Exhibitpage,
|
|
|
|
|
arg.Reimbprovtin,
|
|
|
|
|
arg.Reimbprovnpi,
|
|
|
|
|
arg.Reimbprovname,
|
|
|
|
|
arg.Reimbeffectivedt,
|
|
|
|
|
arg.Reimbterminationdt,
|
|
|
|
|
arg.Aaretederivedclaimtypecd,
|
|
|
|
|
arg.Aaretederivedproduct,
|
|
|
|
|
arg.Aaretederivedlob,
|
|
|
|
|
arg.Aaretederivedprogram,
|
|
|
|
|
arg.Aaretederivednetwork,
|
|
|
|
|
arg.Aaretederivedprovtype,
|
|
|
|
|
arg.Provtaxonomycd,
|
|
|
|
|
arg.Provtaxonomycddesc,
|
|
|
|
|
arg.Provspecialtycd,
|
|
|
|
|
arg.Provspecialtycddesc,
|
|
|
|
|
arg.Placeofservicecd,
|
|
|
|
|
arg.Placeofservicecddesc,
|
|
|
|
|
arg.Billtypecd,
|
|
|
|
|
arg.Billtypecddesc,
|
|
|
|
|
arg.Patientagemin,
|
|
|
|
|
arg.Patientagemax,
|
|
|
|
|
arg.Reimbterm,
|
|
|
|
|
arg.Lobprogramrelationship,
|
|
|
|
|
arg.Lobproductrelationship,
|
|
|
|
|
arg.Carveoutind,
|
|
|
|
|
arg.Carveoutcd,
|
|
|
|
|
arg.Lesserofind,
|
|
|
|
|
arg.Greaterofind,
|
|
|
|
|
arg.Aaretederivedreimbmethod,
|
|
|
|
|
arg.Unitofmeasure,
|
|
|
|
|
arg.Reimbpctrate,
|
|
|
|
|
arg.Reimbfeerate,
|
|
|
|
|
arg.Reimbconversionfactor,
|
|
|
|
|
arg.Triggercapthresholdamt,
|
|
|
|
|
arg.Triggerbasethreshold,
|
|
|
|
|
arg.Defaultind,
|
|
|
|
|
arg.Additiondesc,
|
|
|
|
|
arg.Additionmaxfeerateinc,
|
|
|
|
|
arg.Additionmaxpctrateinc,
|
|
|
|
|
arg.Aaretederivedadditionratechangetimeline,
|
|
|
|
|
arg.Aaretederivedfeeschedule,
|
|
|
|
|
arg.Aaretederivedfeescheduleversion,
|
|
|
|
|
arg.Serviceterm,
|
|
|
|
|
arg.Cpt4proccd,
|
|
|
|
|
arg.Cpt4proccddesc,
|
|
|
|
|
arg.Cpt4procmod,
|
|
|
|
|
arg.Cpt4procmoddesc,
|
|
|
|
|
arg.Revenuecd,
|
|
|
|
|
arg.Revenuecddesc,
|
|
|
|
|
arg.Diagcd,
|
|
|
|
|
arg.Diagcddesc,
|
|
|
|
|
arg.Ndccd,
|
|
|
|
|
arg.Ndccddesc,
|
|
|
|
|
arg.Claimadmittypecd,
|
|
|
|
|
arg.Authadmittypedesc,
|
|
|
|
|
arg.Claimstatuscd,
|
|
|
|
|
arg.Claimstatuscddesc,
|
|
|
|
|
arg.Groupertype,
|
|
|
|
|
arg.Groupercd,
|
|
|
|
|
arg.Groupercddesc,
|
|
|
|
|
arg.Grouperpctrate,
|
|
|
|
|
arg.Grouperbaserate,
|
|
|
|
|
arg.Aaretederivedgrouperversion,
|
|
|
|
|
arg.Grouperalternativelevelofcare,
|
|
|
|
|
arg.Grouperseverityind,
|
|
|
|
|
arg.Grouperseverity,
|
|
|
|
|
arg.Grouperriskofmortalitysubclass,
|
|
|
|
|
arg.Groupertransferind,
|
|
|
|
|
arg.Grouperreadmissionsind,
|
|
|
|
|
arg.Grouperhacind,
|
|
|
|
|
arg.Outlierterm,
|
|
|
|
|
arg.Outlierfirstdollarind,
|
|
|
|
|
arg.Rangenbrdays,
|
|
|
|
|
arg.Outlierfixedlossnbrdaysthreshold,
|
|
|
|
|
arg.Outlierfixedlossthreshold,
|
|
|
|
|
arg.Outliermaximum,
|
|
|
|
|
arg.Outliermaximumfrequency,
|
|
|
|
|
arg.Outlierpctrate,
|
|
|
|
|
arg.Outlierexclusioncd,
|
|
|
|
|
arg.Outlierexclusioncddesc,
|
|
|
|
|
arg.Facilityadjustmentterm,
|
|
|
|
|
arg.Dshind,
|
|
|
|
|
arg.Dshpctrate,
|
|
|
|
|
arg.Dshfeerate,
|
|
|
|
|
arg.Imeind,
|
|
|
|
|
arg.Imepctrate,
|
|
|
|
|
arg.Imefeerate,
|
|
|
|
|
arg.Ntapind,
|
|
|
|
|
arg.Ntappctrate,
|
|
|
|
|
arg.Ntapfeerate,
|
|
|
|
|
arg.Ucind,
|
|
|
|
|
arg.Ucpctrate,
|
|
|
|
|
arg.Ucfeerate,
|
|
|
|
|
arg.Gmeind,
|
|
|
|
|
arg.Gmepctrate,
|
|
|
|
|
arg.Gmefeerate,
|
|
|
|
|
arg.Rateescalatorind,
|
|
|
|
|
arg.Rateescalatordesc,
|
|
|
|
|
arg.Rateescalatormaxrateincpct,
|
|
|
|
|
arg.Rateescalatorratechangetimeline,
|
|
|
|
|
arg.Stoplossterm,
|
|
|
|
|
arg.Stoplossfirstdollarind,
|
|
|
|
|
arg.Stoplossrangenbrdays,
|
|
|
|
|
arg.Stoplossfixedlossthreshold,
|
|
|
|
|
arg.Stoplossmaximum,
|
|
|
|
|
arg.Stoplossmaximumfrequency,
|
|
|
|
|
arg.Stoplossdailymaxrate,
|
|
|
|
|
arg.Stoplosspctrateonexcesscharges,
|
|
|
|
|
arg.Stoplossexclusioncd,
|
|
|
|
|
arg.Stoplossexclusiondesc,
|
|
|
|
|
)
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const addFieldExtractionEntry = `-- name: AddFieldExtractionEntry :exec
|
2025-12-02 19:13:08 +00:00
|
|
|
INSERT INTO documentFieldExtractionVersions (fieldExtractionId, documentId, version, createdBy)
|
|
|
|
|
VALUES ($1, $2, $3, $4)
|
2025-11-26 19:23:42 +00:00
|
|
|
`
|
|
|
|
|
|
|
|
|
|
type AddFieldExtractionEntryParams struct {
|
|
|
|
|
Fieldextractionid uuid.UUID `db:"fieldextractionid"`
|
2025-12-02 19:13:08 +00:00
|
|
|
Documentid uuid.UUID `db:"documentid"`
|
2025-11-26 19:23:42 +00:00
|
|
|
Version int64 `db:"version"`
|
|
|
|
|
Createdby string `db:"createdby"`
|
|
|
|
|
}
|
|
|
|
|
|
2025-12-02 19:13:08 +00:00
|
|
|
// Insert a new version entry for a field extraction
|
|
|
|
|
// documentId is required for the unique constraint enforcement
|
2025-11-26 19:23:42 +00:00
|
|
|
//
|
2025-12-02 19:13:08 +00:00
|
|
|
// INSERT INTO documentFieldExtractionVersions (fieldExtractionId, documentId, version, createdBy)
|
|
|
|
|
// VALUES ($1, $2, $3, $4)
|
2025-11-26 19:23:42 +00:00
|
|
|
func (q *Queries) AddFieldExtractionEntry(ctx context.Context, arg *AddFieldExtractionEntryParams) error {
|
2025-12-02 19:13:08 +00:00
|
|
|
_, err := q.db.Exec(ctx, addFieldExtractionEntry,
|
|
|
|
|
arg.Fieldextractionid,
|
|
|
|
|
arg.Documentid,
|
|
|
|
|
arg.Version,
|
|
|
|
|
arg.Createdby,
|
|
|
|
|
)
|
2025-11-26 19:23:42 +00:00
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const getCurrentFieldExtraction = `-- name: GetCurrentFieldExtraction :one
|
|
|
|
|
SELECT id, documentid, filename, contracttitle, aaretederivedamendmentnum, clientname, payername, payerstate, providerstate, filenametin, provgrouptin, provgroupnpi, provgroupnamefull, provothertin, provothernpi, provothernamefull, aaretederivedeffectivedt, aaretederivedterminationdt, autorenewalind, autorenewalterm, version, createdby, createdat FROM currentFieldExtractions
|
|
|
|
|
WHERE documentId = $1
|
|
|
|
|
`
|
|
|
|
|
|
|
|
|
|
// GetCurrentFieldExtraction
|
|
|
|
|
//
|
|
|
|
|
// SELECT id, documentid, filename, contracttitle, aaretederivedamendmentnum, clientname, payername, payerstate, providerstate, filenametin, provgrouptin, provgroupnpi, provgroupnamefull, provothertin, provothernpi, provothernamefull, aaretederivedeffectivedt, aaretederivedterminationdt, autorenewalind, autorenewalterm, version, createdby, createdat FROM currentFieldExtractions
|
|
|
|
|
// WHERE documentId = $1
|
|
|
|
|
func (q *Queries) GetCurrentFieldExtraction(ctx context.Context, documentid uuid.UUID) (*Currentfieldextraction, error) {
|
|
|
|
|
row := q.db.QueryRow(ctx, getCurrentFieldExtraction, documentid)
|
|
|
|
|
var i Currentfieldextraction
|
|
|
|
|
err := row.Scan(
|
|
|
|
|
&i.ID,
|
|
|
|
|
&i.Documentid,
|
|
|
|
|
&i.Filename,
|
|
|
|
|
&i.Contracttitle,
|
|
|
|
|
&i.Aaretederivedamendmentnum,
|
|
|
|
|
&i.Clientname,
|
|
|
|
|
&i.Payername,
|
|
|
|
|
&i.Payerstate,
|
|
|
|
|
&i.Providerstate,
|
|
|
|
|
&i.Filenametin,
|
|
|
|
|
&i.Provgrouptin,
|
|
|
|
|
&i.Provgroupnpi,
|
|
|
|
|
&i.Provgroupnamefull,
|
|
|
|
|
&i.Provothertin,
|
|
|
|
|
&i.Provothernpi,
|
|
|
|
|
&i.Provothernamefull,
|
|
|
|
|
&i.Aaretederivedeffectivedt,
|
|
|
|
|
&i.Aaretederivedterminationdt,
|
|
|
|
|
&i.Autorenewalind,
|
|
|
|
|
&i.Autorenewalterm,
|
|
|
|
|
&i.Version,
|
|
|
|
|
&i.Createdby,
|
|
|
|
|
&i.Createdat,
|
|
|
|
|
)
|
|
|
|
|
return &i, err
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const getCurrentFieldExtractionWithArrayCount = `-- name: GetCurrentFieldExtractionWithArrayCount :one
|
|
|
|
|
SELECT id, documentid, filename, contracttitle, aaretederivedamendmentnum, clientname, payername, payerstate, providerstate, filenametin, provgrouptin, provgroupnpi, provgroupnamefull, provothertin, provothernpi, provothernamefull, aaretederivedeffectivedt, aaretederivedterminationdt, autorenewalind, autorenewalterm, version, createdby, createdat, arraysize FROM currentFieldExtractionsWithArrayCount
|
|
|
|
|
WHERE documentId = $1
|
|
|
|
|
`
|
|
|
|
|
|
|
|
|
|
// GetCurrentFieldExtractionWithArrayCount
|
|
|
|
|
//
|
|
|
|
|
// SELECT id, documentid, filename, contracttitle, aaretederivedamendmentnum, clientname, payername, payerstate, providerstate, filenametin, provgrouptin, provgroupnpi, provgroupnamefull, provothertin, provothernpi, provothernamefull, aaretederivedeffectivedt, aaretederivedterminationdt, autorenewalind, autorenewalterm, version, createdby, createdat, arraysize FROM currentFieldExtractionsWithArrayCount
|
|
|
|
|
// WHERE documentId = $1
|
|
|
|
|
func (q *Queries) GetCurrentFieldExtractionWithArrayCount(ctx context.Context, documentid uuid.UUID) (*Currentfieldextractionswitharraycount, error) {
|
|
|
|
|
row := q.db.QueryRow(ctx, getCurrentFieldExtractionWithArrayCount, documentid)
|
|
|
|
|
var i Currentfieldextractionswitharraycount
|
|
|
|
|
err := row.Scan(
|
|
|
|
|
&i.ID,
|
|
|
|
|
&i.Documentid,
|
|
|
|
|
&i.Filename,
|
|
|
|
|
&i.Contracttitle,
|
|
|
|
|
&i.Aaretederivedamendmentnum,
|
|
|
|
|
&i.Clientname,
|
|
|
|
|
&i.Payername,
|
|
|
|
|
&i.Payerstate,
|
|
|
|
|
&i.Providerstate,
|
|
|
|
|
&i.Filenametin,
|
|
|
|
|
&i.Provgrouptin,
|
|
|
|
|
&i.Provgroupnpi,
|
|
|
|
|
&i.Provgroupnamefull,
|
|
|
|
|
&i.Provothertin,
|
|
|
|
|
&i.Provothernpi,
|
|
|
|
|
&i.Provothernamefull,
|
|
|
|
|
&i.Aaretederivedeffectivedt,
|
|
|
|
|
&i.Aaretederivedterminationdt,
|
|
|
|
|
&i.Autorenewalind,
|
|
|
|
|
&i.Autorenewalterm,
|
|
|
|
|
&i.Version,
|
|
|
|
|
&i.Createdby,
|
|
|
|
|
&i.Createdat,
|
|
|
|
|
&i.Arraysize,
|
|
|
|
|
)
|
|
|
|
|
return &i, err
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const getFieldExtractionArrayFields = `-- name: GetFieldExtractionArrayFields :many
|
|
|
|
|
SELECT id, fieldextractionid, arrayindex, exhibittitle, exhibitpage, reimbprovtin, reimbprovnpi, reimbprovname, reimbeffectivedt, reimbterminationdt, aaretederivedclaimtypecd, aaretederivedproduct, aaretederivedlob, aaretederivedprogram, aaretederivednetwork, aaretederivedprovtype, provtaxonomycd, provtaxonomycddesc, provspecialtycd, provspecialtycddesc, placeofservicecd, placeofservicecddesc, billtypecd, billtypecddesc, patientagemin, patientagemax, reimbterm, lobprogramrelationship, lobproductrelationship, carveoutind, carveoutcd, lesserofind, greaterofind, aaretederivedreimbmethod, unitofmeasure, reimbpctrate, reimbfeerate, reimbconversionfactor, triggercapthresholdamt, triggerbasethreshold, defaultind, additiondesc, additionmaxfeerateinc, additionmaxpctrateinc, aaretederivedadditionratechangetimeline, aaretederivedfeeschedule, aaretederivedfeescheduleversion, serviceterm, cpt4proccd, cpt4proccddesc, cpt4procmod, cpt4procmoddesc, revenuecd, revenuecddesc, diagcd, diagcddesc, ndccd, ndccddesc, claimadmittypecd, authadmittypedesc, claimstatuscd, claimstatuscddesc, groupertype, groupercd, groupercddesc, grouperpctrate, grouperbaserate, aaretederivedgrouperversion, grouperalternativelevelofcare, grouperseverityind, grouperseverity, grouperriskofmortalitysubclass, groupertransferind, grouperreadmissionsind, grouperhacind, outlierterm, outlierfirstdollarind, rangenbrdays, outlierfixedlossnbrdaysthreshold, outlierfixedlossthreshold, outliermaximum, outliermaximumfrequency, outlierpctrate, outlierexclusioncd, outlierexclusioncddesc, facilityadjustmentterm, dshind, dshpctrate, dshfeerate, imeind, imepctrate, imefeerate, ntapind, ntappctrate, ntapfeerate, ucind, ucpctrate, ucfeerate, gmeind, gmepctrate, gmefeerate, rateescalatorind, rateescalatordesc, rateescalatormaxrateincpct, rateescalatorratechangetimeline, stoplossterm, stoplossfirstdollarind, stoplossrangenbrdays, stoplossfixedlossthreshold, stoplossmaximum, stoplossmaximumfrequency, stoplossdailymaxrate, stoplosspctrateonexcesscharges, stoplossexclusioncd, stoplossexclusiondesc FROM documentFieldExtractionArrayFields
|
|
|
|
|
WHERE fieldExtractionId = $1
|
|
|
|
|
ORDER BY arrayIndex
|
|
|
|
|
`
|
|
|
|
|
|
|
|
|
|
// GetFieldExtractionArrayFields
|
|
|
|
|
//
|
|
|
|
|
// SELECT id, fieldextractionid, arrayindex, exhibittitle, exhibitpage, reimbprovtin, reimbprovnpi, reimbprovname, reimbeffectivedt, reimbterminationdt, aaretederivedclaimtypecd, aaretederivedproduct, aaretederivedlob, aaretederivedprogram, aaretederivednetwork, aaretederivedprovtype, provtaxonomycd, provtaxonomycddesc, provspecialtycd, provspecialtycddesc, placeofservicecd, placeofservicecddesc, billtypecd, billtypecddesc, patientagemin, patientagemax, reimbterm, lobprogramrelationship, lobproductrelationship, carveoutind, carveoutcd, lesserofind, greaterofind, aaretederivedreimbmethod, unitofmeasure, reimbpctrate, reimbfeerate, reimbconversionfactor, triggercapthresholdamt, triggerbasethreshold, defaultind, additiondesc, additionmaxfeerateinc, additionmaxpctrateinc, aaretederivedadditionratechangetimeline, aaretederivedfeeschedule, aaretederivedfeescheduleversion, serviceterm, cpt4proccd, cpt4proccddesc, cpt4procmod, cpt4procmoddesc, revenuecd, revenuecddesc, diagcd, diagcddesc, ndccd, ndccddesc, claimadmittypecd, authadmittypedesc, claimstatuscd, claimstatuscddesc, groupertype, groupercd, groupercddesc, grouperpctrate, grouperbaserate, aaretederivedgrouperversion, grouperalternativelevelofcare, grouperseverityind, grouperseverity, grouperriskofmortalitysubclass, groupertransferind, grouperreadmissionsind, grouperhacind, outlierterm, outlierfirstdollarind, rangenbrdays, outlierfixedlossnbrdaysthreshold, outlierfixedlossthreshold, outliermaximum, outliermaximumfrequency, outlierpctrate, outlierexclusioncd, outlierexclusioncddesc, facilityadjustmentterm, dshind, dshpctrate, dshfeerate, imeind, imepctrate, imefeerate, ntapind, ntappctrate, ntapfeerate, ucind, ucpctrate, ucfeerate, gmeind, gmepctrate, gmefeerate, rateescalatorind, rateescalatordesc, rateescalatormaxrateincpct, rateescalatorratechangetimeline, stoplossterm, stoplossfirstdollarind, stoplossrangenbrdays, stoplossfixedlossthreshold, stoplossmaximum, stoplossmaximumfrequency, stoplossdailymaxrate, stoplosspctrateonexcesscharges, stoplossexclusioncd, stoplossexclusiondesc FROM documentFieldExtractionArrayFields
|
|
|
|
|
// WHERE fieldExtractionId = $1
|
|
|
|
|
// ORDER BY arrayIndex
|
|
|
|
|
func (q *Queries) GetFieldExtractionArrayFields(ctx context.Context, fieldextractionid uuid.UUID) ([]*Documentfieldextractionarrayfield, error) {
|
|
|
|
|
rows, err := q.db.Query(ctx, getFieldExtractionArrayFields, fieldextractionid)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return nil, err
|
|
|
|
|
}
|
|
|
|
|
defer rows.Close()
|
|
|
|
|
items := []*Documentfieldextractionarrayfield{}
|
|
|
|
|
for rows.Next() {
|
|
|
|
|
var i Documentfieldextractionarrayfield
|
|
|
|
|
if err := rows.Scan(
|
|
|
|
|
&i.ID,
|
|
|
|
|
&i.Fieldextractionid,
|
|
|
|
|
&i.Arrayindex,
|
|
|
|
|
&i.Exhibittitle,
|
|
|
|
|
&i.Exhibitpage,
|
|
|
|
|
&i.Reimbprovtin,
|
|
|
|
|
&i.Reimbprovnpi,
|
|
|
|
|
&i.Reimbprovname,
|
|
|
|
|
&i.Reimbeffectivedt,
|
|
|
|
|
&i.Reimbterminationdt,
|
|
|
|
|
&i.Aaretederivedclaimtypecd,
|
|
|
|
|
&i.Aaretederivedproduct,
|
|
|
|
|
&i.Aaretederivedlob,
|
|
|
|
|
&i.Aaretederivedprogram,
|
|
|
|
|
&i.Aaretederivednetwork,
|
|
|
|
|
&i.Aaretederivedprovtype,
|
|
|
|
|
&i.Provtaxonomycd,
|
|
|
|
|
&i.Provtaxonomycddesc,
|
|
|
|
|
&i.Provspecialtycd,
|
|
|
|
|
&i.Provspecialtycddesc,
|
|
|
|
|
&i.Placeofservicecd,
|
|
|
|
|
&i.Placeofservicecddesc,
|
|
|
|
|
&i.Billtypecd,
|
|
|
|
|
&i.Billtypecddesc,
|
|
|
|
|
&i.Patientagemin,
|
|
|
|
|
&i.Patientagemax,
|
|
|
|
|
&i.Reimbterm,
|
|
|
|
|
&i.Lobprogramrelationship,
|
|
|
|
|
&i.Lobproductrelationship,
|
|
|
|
|
&i.Carveoutind,
|
|
|
|
|
&i.Carveoutcd,
|
|
|
|
|
&i.Lesserofind,
|
|
|
|
|
&i.Greaterofind,
|
|
|
|
|
&i.Aaretederivedreimbmethod,
|
|
|
|
|
&i.Unitofmeasure,
|
|
|
|
|
&i.Reimbpctrate,
|
|
|
|
|
&i.Reimbfeerate,
|
|
|
|
|
&i.Reimbconversionfactor,
|
|
|
|
|
&i.Triggercapthresholdamt,
|
|
|
|
|
&i.Triggerbasethreshold,
|
|
|
|
|
&i.Defaultind,
|
|
|
|
|
&i.Additiondesc,
|
|
|
|
|
&i.Additionmaxfeerateinc,
|
|
|
|
|
&i.Additionmaxpctrateinc,
|
|
|
|
|
&i.Aaretederivedadditionratechangetimeline,
|
|
|
|
|
&i.Aaretederivedfeeschedule,
|
|
|
|
|
&i.Aaretederivedfeescheduleversion,
|
|
|
|
|
&i.Serviceterm,
|
|
|
|
|
&i.Cpt4proccd,
|
|
|
|
|
&i.Cpt4proccddesc,
|
|
|
|
|
&i.Cpt4procmod,
|
|
|
|
|
&i.Cpt4procmoddesc,
|
|
|
|
|
&i.Revenuecd,
|
|
|
|
|
&i.Revenuecddesc,
|
|
|
|
|
&i.Diagcd,
|
|
|
|
|
&i.Diagcddesc,
|
|
|
|
|
&i.Ndccd,
|
|
|
|
|
&i.Ndccddesc,
|
|
|
|
|
&i.Claimadmittypecd,
|
|
|
|
|
&i.Authadmittypedesc,
|
|
|
|
|
&i.Claimstatuscd,
|
|
|
|
|
&i.Claimstatuscddesc,
|
|
|
|
|
&i.Groupertype,
|
|
|
|
|
&i.Groupercd,
|
|
|
|
|
&i.Groupercddesc,
|
|
|
|
|
&i.Grouperpctrate,
|
|
|
|
|
&i.Grouperbaserate,
|
|
|
|
|
&i.Aaretederivedgrouperversion,
|
|
|
|
|
&i.Grouperalternativelevelofcare,
|
|
|
|
|
&i.Grouperseverityind,
|
|
|
|
|
&i.Grouperseverity,
|
|
|
|
|
&i.Grouperriskofmortalitysubclass,
|
|
|
|
|
&i.Groupertransferind,
|
|
|
|
|
&i.Grouperreadmissionsind,
|
|
|
|
|
&i.Grouperhacind,
|
|
|
|
|
&i.Outlierterm,
|
|
|
|
|
&i.Outlierfirstdollarind,
|
|
|
|
|
&i.Rangenbrdays,
|
|
|
|
|
&i.Outlierfixedlossnbrdaysthreshold,
|
|
|
|
|
&i.Outlierfixedlossthreshold,
|
|
|
|
|
&i.Outliermaximum,
|
|
|
|
|
&i.Outliermaximumfrequency,
|
|
|
|
|
&i.Outlierpctrate,
|
|
|
|
|
&i.Outlierexclusioncd,
|
|
|
|
|
&i.Outlierexclusioncddesc,
|
|
|
|
|
&i.Facilityadjustmentterm,
|
|
|
|
|
&i.Dshind,
|
|
|
|
|
&i.Dshpctrate,
|
|
|
|
|
&i.Dshfeerate,
|
|
|
|
|
&i.Imeind,
|
|
|
|
|
&i.Imepctrate,
|
|
|
|
|
&i.Imefeerate,
|
|
|
|
|
&i.Ntapind,
|
|
|
|
|
&i.Ntappctrate,
|
|
|
|
|
&i.Ntapfeerate,
|
|
|
|
|
&i.Ucind,
|
|
|
|
|
&i.Ucpctrate,
|
|
|
|
|
&i.Ucfeerate,
|
|
|
|
|
&i.Gmeind,
|
|
|
|
|
&i.Gmepctrate,
|
|
|
|
|
&i.Gmefeerate,
|
|
|
|
|
&i.Rateescalatorind,
|
|
|
|
|
&i.Rateescalatordesc,
|
|
|
|
|
&i.Rateescalatormaxrateincpct,
|
|
|
|
|
&i.Rateescalatorratechangetimeline,
|
|
|
|
|
&i.Stoplossterm,
|
|
|
|
|
&i.Stoplossfirstdollarind,
|
|
|
|
|
&i.Stoplossrangenbrdays,
|
|
|
|
|
&i.Stoplossfixedlossthreshold,
|
|
|
|
|
&i.Stoplossmaximum,
|
|
|
|
|
&i.Stoplossmaximumfrequency,
|
|
|
|
|
&i.Stoplossdailymaxrate,
|
|
|
|
|
&i.Stoplosspctrateonexcesscharges,
|
|
|
|
|
&i.Stoplossexclusioncd,
|
|
|
|
|
&i.Stoplossexclusiondesc,
|
|
|
|
|
); err != nil {
|
|
|
|
|
return nil, err
|
|
|
|
|
}
|
|
|
|
|
items = append(items, &i)
|
|
|
|
|
}
|
|
|
|
|
if err := rows.Err(); err != nil {
|
|
|
|
|
return nil, err
|
|
|
|
|
}
|
|
|
|
|
return items, nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const getFieldExtractionByID = `-- name: GetFieldExtractionByID :one
|
|
|
|
|
SELECT id, documentid, filename, contracttitle, aaretederivedamendmentnum, clientname, payername, payerstate, providerstate, filenametin, provgrouptin, provgroupnpi, provgroupnamefull, provothertin, provothernpi, provothernamefull, aaretederivedeffectivedt, aaretederivedterminationdt, autorenewalind, autorenewalterm, createdat, createdby FROM documentFieldExtractions
|
|
|
|
|
WHERE id = $1
|
|
|
|
|
`
|
|
|
|
|
|
|
|
|
|
// GetFieldExtractionByID
|
|
|
|
|
//
|
|
|
|
|
// SELECT id, documentid, filename, contracttitle, aaretederivedamendmentnum, clientname, payername, payerstate, providerstate, filenametin, provgrouptin, provgroupnpi, provgroupnamefull, provothertin, provothernpi, provothernamefull, aaretederivedeffectivedt, aaretederivedterminationdt, autorenewalind, autorenewalterm, createdat, createdby FROM documentFieldExtractions
|
|
|
|
|
// WHERE id = $1
|
|
|
|
|
func (q *Queries) GetFieldExtractionByID(ctx context.Context, id uuid.UUID) (*Documentfieldextraction, error) {
|
|
|
|
|
row := q.db.QueryRow(ctx, getFieldExtractionByID, id)
|
|
|
|
|
var i Documentfieldextraction
|
|
|
|
|
err := row.Scan(
|
|
|
|
|
&i.ID,
|
|
|
|
|
&i.Documentid,
|
|
|
|
|
&i.Filename,
|
|
|
|
|
&i.Contracttitle,
|
|
|
|
|
&i.Aaretederivedamendmentnum,
|
|
|
|
|
&i.Clientname,
|
|
|
|
|
&i.Payername,
|
|
|
|
|
&i.Payerstate,
|
|
|
|
|
&i.Providerstate,
|
|
|
|
|
&i.Filenametin,
|
|
|
|
|
&i.Provgrouptin,
|
|
|
|
|
&i.Provgroupnpi,
|
|
|
|
|
&i.Provgroupnamefull,
|
|
|
|
|
&i.Provothertin,
|
|
|
|
|
&i.Provothernpi,
|
|
|
|
|
&i.Provothernamefull,
|
|
|
|
|
&i.Aaretederivedeffectivedt,
|
|
|
|
|
&i.Aaretederivedterminationdt,
|
|
|
|
|
&i.Autorenewalind,
|
|
|
|
|
&i.Autorenewalterm,
|
|
|
|
|
&i.Createdat,
|
|
|
|
|
&i.Createdby,
|
|
|
|
|
)
|
|
|
|
|
return &i, err
|
|
|
|
|
}
|
|
|
|
|
|
2025-12-02 19:13:08 +00:00
|
|
|
const getFieldExtractionByVersion = `-- name: GetFieldExtractionByVersion :one
|
|
|
|
|
SELECT
|
|
|
|
|
dfe.id,
|
|
|
|
|
dfe.documentId,
|
|
|
|
|
dfe.fileName,
|
|
|
|
|
dfe.contractTitle,
|
|
|
|
|
dfe.aareteDerivedAmendmentNum,
|
|
|
|
|
dfe.clientName,
|
|
|
|
|
dfe.payerName,
|
|
|
|
|
dfe.payerState,
|
|
|
|
|
dfe.providerState,
|
|
|
|
|
dfe.filenameTin,
|
|
|
|
|
dfe.provGroupTin,
|
|
|
|
|
dfe.provGroupNpi,
|
|
|
|
|
dfe.provGroupNameFull,
|
|
|
|
|
dfe.provOtherTin,
|
|
|
|
|
dfe.provOtherNpi,
|
|
|
|
|
dfe.provOtherNameFull,
|
|
|
|
|
dfe.aareteDerivedEffectiveDt,
|
|
|
|
|
dfe.aareteDerivedTerminationDt,
|
|
|
|
|
dfe.autoRenewalInd,
|
|
|
|
|
dfe.autoRenewalTerm,
|
|
|
|
|
dfev.version,
|
|
|
|
|
dfev.createdBy,
|
|
|
|
|
dfev.createdAt
|
|
|
|
|
FROM documentFieldExtractions dfe
|
|
|
|
|
JOIN documentFieldExtractionVersions dfev
|
|
|
|
|
ON dfev.fieldExtractionId = dfe.id
|
|
|
|
|
WHERE dfev.documentId = $1 AND dfev.version = $2
|
|
|
|
|
`
|
|
|
|
|
|
|
|
|
|
type GetFieldExtractionByVersionParams struct {
|
|
|
|
|
Documentid uuid.UUID `db:"documentid"`
|
|
|
|
|
Version int64 `db:"version"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type GetFieldExtractionByVersionRow struct {
|
|
|
|
|
ID uuid.UUID `db:"id"`
|
|
|
|
|
Documentid uuid.UUID `db:"documentid"`
|
|
|
|
|
Filename *string `db:"filename"`
|
|
|
|
|
Contracttitle *string `db:"contracttitle"`
|
|
|
|
|
Aaretederivedamendmentnum *int32 `db:"aaretederivedamendmentnum"`
|
|
|
|
|
Clientname *string `db:"clientname"`
|
|
|
|
|
Payername *string `db:"payername"`
|
|
|
|
|
Payerstate *string `db:"payerstate"`
|
|
|
|
|
Providerstate *string `db:"providerstate"`
|
|
|
|
|
Filenametin *string `db:"filenametin"`
|
|
|
|
|
Provgrouptin *string `db:"provgrouptin"`
|
|
|
|
|
Provgroupnpi *string `db:"provgroupnpi"`
|
|
|
|
|
Provgroupnamefull *string `db:"provgroupnamefull"`
|
|
|
|
|
Provothertin *string `db:"provothertin"`
|
|
|
|
|
Provothernpi *string `db:"provothernpi"`
|
|
|
|
|
Provothernamefull *string `db:"provothernamefull"`
|
|
|
|
|
Aaretederivedeffectivedt pgtype.Date `db:"aaretederivedeffectivedt"`
|
|
|
|
|
Aaretederivedterminationdt pgtype.Date `db:"aaretederivedterminationdt"`
|
|
|
|
|
Autorenewalind *bool `db:"autorenewalind"`
|
|
|
|
|
Autorenewalterm *string `db:"autorenewalterm"`
|
|
|
|
|
Version int64 `db:"version"`
|
|
|
|
|
Createdby string `db:"createdby"`
|
|
|
|
|
Createdat pgtype.Timestamp `db:"createdat"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Retrieves a specific version of field extraction for a document
|
|
|
|
|
// Returns the field extraction record with version metadata
|
|
|
|
|
//
|
|
|
|
|
// SELECT
|
|
|
|
|
// dfe.id,
|
|
|
|
|
// dfe.documentId,
|
|
|
|
|
// dfe.fileName,
|
|
|
|
|
// dfe.contractTitle,
|
|
|
|
|
// dfe.aareteDerivedAmendmentNum,
|
|
|
|
|
// dfe.clientName,
|
|
|
|
|
// dfe.payerName,
|
|
|
|
|
// dfe.payerState,
|
|
|
|
|
// dfe.providerState,
|
|
|
|
|
// dfe.filenameTin,
|
|
|
|
|
// dfe.provGroupTin,
|
|
|
|
|
// dfe.provGroupNpi,
|
|
|
|
|
// dfe.provGroupNameFull,
|
|
|
|
|
// dfe.provOtherTin,
|
|
|
|
|
// dfe.provOtherNpi,
|
|
|
|
|
// dfe.provOtherNameFull,
|
|
|
|
|
// dfe.aareteDerivedEffectiveDt,
|
|
|
|
|
// dfe.aareteDerivedTerminationDt,
|
|
|
|
|
// dfe.autoRenewalInd,
|
|
|
|
|
// dfe.autoRenewalTerm,
|
|
|
|
|
// dfev.version,
|
|
|
|
|
// dfev.createdBy,
|
|
|
|
|
// dfev.createdAt
|
|
|
|
|
// FROM documentFieldExtractions dfe
|
|
|
|
|
// JOIN documentFieldExtractionVersions dfev
|
|
|
|
|
// ON dfev.fieldExtractionId = dfe.id
|
|
|
|
|
// WHERE dfev.documentId = $1 AND dfev.version = $2
|
|
|
|
|
func (q *Queries) GetFieldExtractionByVersion(ctx context.Context, arg *GetFieldExtractionByVersionParams) (*GetFieldExtractionByVersionRow, error) {
|
|
|
|
|
row := q.db.QueryRow(ctx, getFieldExtractionByVersion, arg.Documentid, arg.Version)
|
|
|
|
|
var i GetFieldExtractionByVersionRow
|
|
|
|
|
err := row.Scan(
|
|
|
|
|
&i.ID,
|
|
|
|
|
&i.Documentid,
|
|
|
|
|
&i.Filename,
|
|
|
|
|
&i.Contracttitle,
|
|
|
|
|
&i.Aaretederivedamendmentnum,
|
|
|
|
|
&i.Clientname,
|
|
|
|
|
&i.Payername,
|
|
|
|
|
&i.Payerstate,
|
|
|
|
|
&i.Providerstate,
|
|
|
|
|
&i.Filenametin,
|
|
|
|
|
&i.Provgrouptin,
|
|
|
|
|
&i.Provgroupnpi,
|
|
|
|
|
&i.Provgroupnamefull,
|
|
|
|
|
&i.Provothertin,
|
|
|
|
|
&i.Provothernpi,
|
|
|
|
|
&i.Provothernamefull,
|
|
|
|
|
&i.Aaretederivedeffectivedt,
|
|
|
|
|
&i.Aaretederivedterminationdt,
|
|
|
|
|
&i.Autorenewalind,
|
|
|
|
|
&i.Autorenewalterm,
|
|
|
|
|
&i.Version,
|
|
|
|
|
&i.Createdby,
|
|
|
|
|
&i.Createdat,
|
|
|
|
|
)
|
|
|
|
|
return &i, err
|
|
|
|
|
}
|
|
|
|
|
|
2025-11-26 19:23:42 +00:00
|
|
|
const getFieldExtractionHistory = `-- name: GetFieldExtractionHistory :many
|
|
|
|
|
SELECT
|
|
|
|
|
dfe.id,
|
|
|
|
|
dfe.documentId,
|
|
|
|
|
dfev.version,
|
|
|
|
|
dfev.createdBy,
|
|
|
|
|
dfev.createdAt
|
|
|
|
|
FROM documentFieldExtractions dfe
|
|
|
|
|
JOIN documentFieldExtractionVersions dfev
|
|
|
|
|
ON dfev.fieldExtractionId = dfe.id
|
|
|
|
|
WHERE dfe.documentId = $1
|
|
|
|
|
ORDER BY dfev.version DESC
|
|
|
|
|
`
|
|
|
|
|
|
|
|
|
|
type GetFieldExtractionHistoryRow struct {
|
|
|
|
|
ID uuid.UUID `db:"id"`
|
|
|
|
|
Documentid uuid.UUID `db:"documentid"`
|
|
|
|
|
Version int64 `db:"version"`
|
|
|
|
|
Createdby string `db:"createdby"`
|
|
|
|
|
Createdat pgtype.Timestamp `db:"createdat"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// GetFieldExtractionHistory
|
|
|
|
|
//
|
|
|
|
|
// SELECT
|
|
|
|
|
// dfe.id,
|
|
|
|
|
// dfe.documentId,
|
|
|
|
|
// dfev.version,
|
|
|
|
|
// dfev.createdBy,
|
|
|
|
|
// dfev.createdAt
|
|
|
|
|
// FROM documentFieldExtractions dfe
|
|
|
|
|
// JOIN documentFieldExtractionVersions dfev
|
|
|
|
|
// ON dfev.fieldExtractionId = dfe.id
|
|
|
|
|
// WHERE dfe.documentId = $1
|
|
|
|
|
// ORDER BY dfev.version DESC
|
|
|
|
|
func (q *Queries) GetFieldExtractionHistory(ctx context.Context, documentid uuid.UUID) ([]*GetFieldExtractionHistoryRow, error) {
|
|
|
|
|
rows, err := q.db.Query(ctx, getFieldExtractionHistory, documentid)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return nil, err
|
|
|
|
|
}
|
|
|
|
|
defer rows.Close()
|
|
|
|
|
items := []*GetFieldExtractionHistoryRow{}
|
|
|
|
|
for rows.Next() {
|
|
|
|
|
var i GetFieldExtractionHistoryRow
|
|
|
|
|
if err := rows.Scan(
|
|
|
|
|
&i.ID,
|
|
|
|
|
&i.Documentid,
|
|
|
|
|
&i.Version,
|
|
|
|
|
&i.Createdby,
|
|
|
|
|
&i.Createdat,
|
|
|
|
|
); err != nil {
|
|
|
|
|
return nil, err
|
|
|
|
|
}
|
|
|
|
|
items = append(items, &i)
|
|
|
|
|
}
|
|
|
|
|
if err := rows.Err(); err != nil {
|
|
|
|
|
return nil, err
|
|
|
|
|
}
|
|
|
|
|
return items, nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const getFieldExtractionsByDocumentID = `-- name: GetFieldExtractionsByDocumentID :many
|
|
|
|
|
SELECT id, documentid, filename, contracttitle, aaretederivedamendmentnum, clientname, payername, payerstate, providerstate, filenametin, provgrouptin, provgroupnpi, provgroupnamefull, provothertin, provothernpi, provothernamefull, aaretederivedeffectivedt, aaretederivedterminationdt, autorenewalind, autorenewalterm, createdat, createdby FROM documentFieldExtractions
|
|
|
|
|
WHERE documentId = $1
|
|
|
|
|
ORDER BY createdAt DESC
|
|
|
|
|
`
|
|
|
|
|
|
|
|
|
|
// GetFieldExtractionsByDocumentID
|
|
|
|
|
//
|
|
|
|
|
// SELECT id, documentid, filename, contracttitle, aaretederivedamendmentnum, clientname, payername, payerstate, providerstate, filenametin, provgrouptin, provgroupnpi, provgroupnamefull, provothertin, provothernpi, provothernamefull, aaretederivedeffectivedt, aaretederivedterminationdt, autorenewalind, autorenewalterm, createdat, createdby FROM documentFieldExtractions
|
|
|
|
|
// WHERE documentId = $1
|
|
|
|
|
// ORDER BY createdAt DESC
|
|
|
|
|
func (q *Queries) GetFieldExtractionsByDocumentID(ctx context.Context, documentid uuid.UUID) ([]*Documentfieldextraction, error) {
|
|
|
|
|
rows, err := q.db.Query(ctx, getFieldExtractionsByDocumentID, documentid)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return nil, err
|
|
|
|
|
}
|
|
|
|
|
defer rows.Close()
|
|
|
|
|
items := []*Documentfieldextraction{}
|
|
|
|
|
for rows.Next() {
|
|
|
|
|
var i Documentfieldextraction
|
|
|
|
|
if err := rows.Scan(
|
|
|
|
|
&i.ID,
|
|
|
|
|
&i.Documentid,
|
|
|
|
|
&i.Filename,
|
|
|
|
|
&i.Contracttitle,
|
|
|
|
|
&i.Aaretederivedamendmentnum,
|
|
|
|
|
&i.Clientname,
|
|
|
|
|
&i.Payername,
|
|
|
|
|
&i.Payerstate,
|
|
|
|
|
&i.Providerstate,
|
|
|
|
|
&i.Filenametin,
|
|
|
|
|
&i.Provgrouptin,
|
|
|
|
|
&i.Provgroupnpi,
|
|
|
|
|
&i.Provgroupnamefull,
|
|
|
|
|
&i.Provothertin,
|
|
|
|
|
&i.Provothernpi,
|
|
|
|
|
&i.Provothernamefull,
|
|
|
|
|
&i.Aaretederivedeffectivedt,
|
|
|
|
|
&i.Aaretederivedterminationdt,
|
|
|
|
|
&i.Autorenewalind,
|
|
|
|
|
&i.Autorenewalterm,
|
|
|
|
|
&i.Createdat,
|
|
|
|
|
&i.Createdby,
|
|
|
|
|
); err != nil {
|
|
|
|
|
return nil, err
|
|
|
|
|
}
|
|
|
|
|
items = append(items, &i)
|
|
|
|
|
}
|
|
|
|
|
if err := rows.Err(); err != nil {
|
|
|
|
|
return nil, err
|
|
|
|
|
}
|
|
|
|
|
return items, nil
|
|
|
|
|
}
|
|
|
|
|
|
2025-12-02 19:13:08 +00:00
|
|
|
const getMaxFieldExtractionVersion = `-- name: GetMaxFieldExtractionVersion :one
|
|
|
|
|
SELECT COALESCE(MAX(version), 0) as max_version
|
|
|
|
|
FROM documentFieldExtractionVersions
|
|
|
|
|
WHERE documentId = $1
|
|
|
|
|
`
|
|
|
|
|
|
|
|
|
|
// Get the current max version for a document (call after LockFieldExtractionVersionsForDocument)
|
|
|
|
|
// Returns 0 if no versions exist, otherwise the max version number
|
|
|
|
|
// COALESCE ensures we always get a non-NULL value that can be scanned into int64
|
|
|
|
|
//
|
|
|
|
|
// SELECT COALESCE(MAX(version), 0) as max_version
|
|
|
|
|
// FROM documentFieldExtractionVersions
|
|
|
|
|
// WHERE documentId = $1
|
|
|
|
|
func (q *Queries) GetMaxFieldExtractionVersion(ctx context.Context, documentid uuid.UUID) (*int64, error) {
|
|
|
|
|
row := q.db.QueryRow(ctx, getMaxFieldExtractionVersion, documentid)
|
|
|
|
|
var max_version *int64
|
|
|
|
|
err := row.Scan(&max_version)
|
|
|
|
|
return max_version, err
|
|
|
|
|
}
|
|
|
|
|
|
2025-12-11 14:25:51 +00:00
|
|
|
const hasFieldExtraction = `-- name: HasFieldExtraction :one
|
|
|
|
|
SELECT EXISTS(
|
|
|
|
|
SELECT 1 FROM documentFieldExtractionVersions
|
|
|
|
|
WHERE documentId = $1
|
|
|
|
|
) as has_extraction
|
|
|
|
|
`
|
|
|
|
|
|
|
|
|
|
// Checks if a field extraction exists for a document
|
|
|
|
|
//
|
|
|
|
|
// SELECT EXISTS(
|
|
|
|
|
// SELECT 1 FROM documentFieldExtractionVersions
|
|
|
|
|
// WHERE documentId = $1
|
|
|
|
|
// ) as has_extraction
|
|
|
|
|
func (q *Queries) HasFieldExtraction(ctx context.Context, documentid uuid.UUID) (bool, error) {
|
|
|
|
|
row := q.db.QueryRow(ctx, hasFieldExtraction, documentid)
|
|
|
|
|
var has_extraction bool
|
|
|
|
|
err := row.Scan(&has_extraction)
|
|
|
|
|
return has_extraction, err
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const hasFieldExtractionBatch = `-- name: HasFieldExtractionBatch :many
|
|
|
|
|
SELECT
|
|
|
|
|
t.documentId,
|
|
|
|
|
EXISTS(SELECT 1 FROM documentFieldExtractionVersions dfev WHERE dfev.documentId = t.documentId) as has_extraction
|
|
|
|
|
FROM unnest($1::uuid[]) as t(documentId)
|
|
|
|
|
`
|
|
|
|
|
|
|
|
|
|
type HasFieldExtractionBatchRow struct {
|
|
|
|
|
Documentid *uuid.UUID `db:"documentid"`
|
|
|
|
|
HasExtraction bool `db:"has_extraction"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Checks if field extractions exist for multiple documents (for folder listing)
|
|
|
|
|
// Returns one row per input document ID indicating whether extraction exists
|
|
|
|
|
//
|
|
|
|
|
// SELECT
|
|
|
|
|
// t.documentId,
|
|
|
|
|
// EXISTS(SELECT 1 FROM documentFieldExtractionVersions dfev WHERE dfev.documentId = t.documentId) as has_extraction
|
|
|
|
|
// FROM unnest($1::uuid[]) as t(documentId)
|
|
|
|
|
func (q *Queries) HasFieldExtractionBatch(ctx context.Context, documentids []uuid.UUID) ([]*HasFieldExtractionBatchRow, error) {
|
|
|
|
|
rows, err := q.db.Query(ctx, hasFieldExtractionBatch, documentids)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return nil, err
|
|
|
|
|
}
|
|
|
|
|
defer rows.Close()
|
|
|
|
|
items := []*HasFieldExtractionBatchRow{}
|
|
|
|
|
for rows.Next() {
|
|
|
|
|
var i HasFieldExtractionBatchRow
|
|
|
|
|
if err := rows.Scan(&i.Documentid, &i.HasExtraction); err != nil {
|
|
|
|
|
return nil, err
|
|
|
|
|
}
|
|
|
|
|
items = append(items, &i)
|
|
|
|
|
}
|
|
|
|
|
if err := rows.Err(); err != nil {
|
|
|
|
|
return nil, err
|
|
|
|
|
}
|
|
|
|
|
return items, nil
|
|
|
|
|
}
|
|
|
|
|
|
2025-12-02 19:13:08 +00:00
|
|
|
const lockFieldExtractionVersionsForDocument = `-- name: LockFieldExtractionVersionsForDocument :many
|
|
|
|
|
SELECT id, version FROM documentFieldExtractionVersions
|
|
|
|
|
WHERE documentId = $1
|
|
|
|
|
FOR UPDATE
|
|
|
|
|
`
|
|
|
|
|
|
|
|
|
|
type LockFieldExtractionVersionsForDocumentRow struct {
|
|
|
|
|
ID uuid.UUID `db:"id"`
|
|
|
|
|
Version int64 `db:"version"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Lock all existing version rows for a document to prevent concurrent inserts
|
|
|
|
|
// Must be called within a transaction before GetMaxFieldExtractionVersion
|
|
|
|
|
// Returns the locked rows (which may be empty for first version)
|
|
|
|
|
//
|
|
|
|
|
// SELECT id, version FROM documentFieldExtractionVersions
|
|
|
|
|
// WHERE documentId = $1
|
|
|
|
|
// FOR UPDATE
|
|
|
|
|
func (q *Queries) LockFieldExtractionVersionsForDocument(ctx context.Context, documentid uuid.UUID) ([]*LockFieldExtractionVersionsForDocumentRow, error) {
|
|
|
|
|
rows, err := q.db.Query(ctx, lockFieldExtractionVersionsForDocument, documentid)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return nil, err
|
|
|
|
|
}
|
|
|
|
|
defer rows.Close()
|
|
|
|
|
items := []*LockFieldExtractionVersionsForDocumentRow{}
|
|
|
|
|
for rows.Next() {
|
|
|
|
|
var i LockFieldExtractionVersionsForDocumentRow
|
|
|
|
|
if err := rows.Scan(&i.ID, &i.Version); err != nil {
|
|
|
|
|
return nil, err
|
|
|
|
|
}
|
|
|
|
|
items = append(items, &i)
|
|
|
|
|
}
|
|
|
|
|
if err := rows.Err(); err != nil {
|
|
|
|
|
return nil, err
|
|
|
|
|
}
|
|
|
|
|
return items, nil
|
|
|
|
|
}
|
|
|
|
|
|
2025-11-26 19:23:42 +00:00
|
|
|
const validateArrayFieldCount = `-- name: ValidateArrayFieldCount :one
|
|
|
|
|
SELECT COUNT(*) as arrayFieldCount
|
|
|
|
|
FROM documentFieldExtractionArrayFields
|
|
|
|
|
WHERE fieldExtractionId = $1
|
|
|
|
|
`
|
|
|
|
|
|
|
|
|
|
// ValidateArrayFieldCount
|
|
|
|
|
//
|
|
|
|
|
// SELECT COUNT(*) as arrayFieldCount
|
|
|
|
|
// FROM documentFieldExtractionArrayFields
|
|
|
|
|
// WHERE fieldExtractionId = $1
|
|
|
|
|
func (q *Queries) ValidateArrayFieldCount(ctx context.Context, fieldextractionid uuid.UUID) (int64, error) {
|
|
|
|
|
row := q.db.QueryRow(ctx, validateArrayFieldCount, fieldextractionid)
|
|
|
|
|
var arrayfieldcount int64
|
|
|
|
|
err := row.Scan(&arrayfieldcount)
|
|
|
|
|
return arrayfieldcount, err
|
|
|
|
|
}
|