12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661 |
- package service
-
- import (
- "XT_New/models"
- "fmt"
- "github.com/jinzhu/gorm"
- "math"
- "strconv"
- "strings"
- "time"
- )
-
- func GetAppVersionByAppType(apptype int64) (*models.AppVersion, error) {
- var version models.AppVersion
- err := readDb.Model(&models.AppVersion{}).Where("app_type=?", apptype).First(&version).Error
- if err == gorm.ErrRecordNotFound {
- return nil, nil
- }
-
- if err != nil {
- return nil, err
- }
- return &version, nil
- }
-
- func GetAllAppOrg() ([]*models.OrgApp, error) {
- var app []*models.OrgApp
- err := readUserDb.Model(&models.OrgApp{}).Where("status = 1 AND org_id > 0").Group("org_id").Find(&app).Error
- if err == gorm.ErrRecordNotFound {
- return nil, nil
- }
-
- if err != nil {
- return nil, err
- }
- return app, nil
- }
-
- func GetSystemApp() ([]*models.OrgApp, error) {
- var app []*models.OrgApp
- err := readDb.Model(&models.OrgApp{}).Where("status = 1 AND org_id = 0 ").Find(&app).Error
- if err == gorm.ErrRecordNotFound {
- return nil, nil
- }
-
- if err != nil {
- return nil, err
- }
- return app, nil
- }
-
- func GetApp() ([]*models.OrgApp, error) {
- var app []*models.OrgApp
- err := readDb.Model(&models.OrgApp{}).Where("status = 1 AND org_id = 0").Find(&app).Error
- if err == gorm.ErrRecordNotFound {
- return nil, nil
- }
-
- if err != nil {
- return nil, err
- }
- return app, nil
- }
-
- func GetAppByType(orgID int64, app_type int) (*models.OrgApp, error) {
- var apps models.OrgApp
- err := readUserDb.Where("app_type = ? AND org_id = ? AND status = 1", app_type, orgID).First(&apps).Error
- if err != nil {
- return nil, err
- }
- return &apps, nil
- }
-
- func CreateOrgApp(app *models.OrgApp) {
- writeUserDb.Create(&app)
-
- }
-
- func GetAllUserRole(org_id int64) (appRole []*models.App_Role) {
- if org_id == 0 {
- readUserDb.Model(&models.App_Role{}).Where("status = 1").Find(&appRole)
-
- } else {
- readUserDb.Model(&models.App_Role{}).Where("status = 1 AND org_id = ? ", org_id).Find(&appRole)
-
- }
- return
- }
-
- func GetAllUserRoleByUserTypeOne(org_id int) (appRole []*models.App_Role) {
- readUserDb.Model(&models.App_Role{}).Where("status = 1 AND user_type = 1").Find(&appRole)
- return
- }
-
- func GetAllUserRoleByUserTypeOther() (appRole []*models.App_Role) {
- //app, _ := GetOrgApp(int64(org_id), 3)
-
- //if org_id == 0 {
- readUserDb.Model(&models.App_Role{}).Where("status = 1 AND user_type > 1").Find(&appRole)
- //
- //} else {
- // readUserDb.Model(&models.App_Role{}).Where("status = 1 AND org_id = ? AND user_type > 1 AND app_id = ? ", org_id, app.Id).Find(&appRole)
- //
- //}
- return
- }
-
- func FindRoleByUserTypeOne(org_id int64) (role models.Role) {
- readUserDb.Model(&models.Role{}).Where("status = 1 AND org_id = ? AND is_system = 2 AND role_name = '医生'", org_id).First(&role)
- return
- }
-
- func FindRoleByUserTypeTwo(org_id int64) (role models.Role) {
- readUserDb.Model(&models.Role{}).Where("status = 1 AND org_id = ? AND is_system = 3 AND role_name = '护士'", org_id).First(&role)
- return
- }
-
- func GetAllRole() ([]*models.Role, error) {
- var app []*models.Role
- err := readUserDb.Model(&models.Role{}).Where("status = 1 AND org_id > 0").Group("org_id").Find(&app).Error
- if err == gorm.ErrRecordNotFound {
- return nil, nil
- }
- if err != nil {
- return nil, err
- }
- return app, nil
- }
-
- func UpdateRoleIds(id int64, ids string) {
- writeUserDb.Model(&models.App_Role{}).Where("status = 1 AND id = ?", id).Updates(map[string]interface{}{"role_ids": ids, "mtime": time.Now().Unix()})
-
- }
-
- func GetOrgAppA(orgID int64, app_type int) (*models.OrgApp, error) {
- var apps models.OrgApp
- err := readUserDb.Where("app_type = ? AND org_id = ? AND status = 1", app_type, orgID).First(&apps).Error
- if err != nil {
- return nil, err
- }
- return &apps, nil
- }
-
- func GetOrgByIdB(orgID int64) (*models.Org, error) {
- var org models.Org
- err := readUserDb.Model(&models.Org{}).Where("id = ?", orgID).First(&org).Error
- if err != nil {
- if err == gorm.ErrRecordNotFound {
- return nil, nil
- } else {
- return nil, err
- }
- }
- return &org, nil
- }
-
- func GetOrgAppB(orgID int64, app_type int) (*models.OrgApp, error) {
- var apps models.OrgApp
- err := readUserDb.Where("app_type = ? AND org_id = ? AND status = 1", app_type, orgID).First(&apps).Error
- if err != nil {
- return nil, err
- }
- return &apps, nil
- }
-
- func CreateOrgRoleB(role *models.Role) (err error) {
- err = writeUserDb.Create(&role).Error
- return
- }
-
- func CreateRolePurviewB(purview *models.RolePurview) (err error) {
- err = writeUserDb.Create(&purview).Error
- return
- }
-
- func CreateFuncRolePurviewB(purview *models.SgjUserRoleFuncPurview) (err error) {
- err = writeUserDb.Create(&purview).Error
- return
- }
-
- func GetSystemRole(orgID int64) ([]*models.Role, error) {
- var roles []*models.Role
- err := readUserDb.Where(" org_id = ? AND status = 1 AND is_system > 1", orgID).First(&roles).Error
- if err != nil {
- return nil, err
- }
- return roles, nil
- }
-
- func HandleData() {
- var pe []*models.PredialysisEvaluation
- //readDb.Model(&models.DialysisPrescription{}).Where("user_org_id = 12 AND record_date <= 1587571200").Find(&prescription)
- //for _, item := range prescription {
- // writeDb.Model(&models.AssessmentAfterDislysis{}).Where("user_org_id =12 AND assessment_date = ?", item.RecordDate).Updates(map[string]interface{}{"mtime": time.Now().Unix(), "actual_ultrafiltration": item.Ultrafiltration})
- //}
- readDb.Model(&models.PredialysisEvaluation{}).Where("status = 1 AND user_org_id = 9538 AND dialysis_order_id > 0").Find(&pe)
-
- for _, item := range pe {
- var sch models.Schedule
- err := readDb.Model(&models.Schedule{}).Where("status = 1 AND schedule_date = ? AND patient_id = ? AND user_org_id = 9538", item.AssessmentDate, item.PatientId).First(&sch).Error
- if err == nil {
- if sch.ID > 0 {
- order := &models.DialysisOrder{
- DialysisDate: sch.ScheduleDate,
- UserOrgId: 9538,
- PatientId: sch.PatientId,
- Stage: 2,
- BedID: sch.BedId,
- StartNurse: 554,
- FinishNurse: 554,
- Status: 1,
- CreatedTime: sch.ScheduleDate,
- UpdatedTime: sch.ScheduleDate,
- StartTime: sch.ScheduleDate,
- EndTime: sch.ScheduleDate,
- PunctureNurse: 554,
- Creator: 554,
- Modifier: 554,
- FinishCreator: 554,
- FinishModifier: 554,
- SchedualType: sch.ScheduleType,
- }
- writeDb.Create(&order)
- }
- }
-
- }
-
- }
-
- func FindAllOrgByImportType() (org []*models.Org, err error) {
- err = readUserDb.Model(&models.Org{}).Where("status =1 AND import = 0").Find(&org).Error
- return
- }
-
- func FindAllPrescription(org_id int64) (prescription []*models.DialysisPrescription, err error) {
- err = readDb.Model(&models.DialysisPrescription{}).Where("user_org_id=? AND status= 1 AND record_date >= 1593446400", org_id).Find(&prescription).Error
- return
- }
-
- func AddSigleDialysisBeforePre(before *models.DialysisBeforePrepare) {
- writeDb.Create(&before)
- }
-
- func GetAllHisDoctorInfo(org_id int64) (his []*models.HisDoctorAdviceInfo, err error) {
- err = readDb.Model(&models.HisDoctorAdviceInfo{}).Where("user_org_id = ? AND status = 1", org_id).Find(&his).Error
- return
- }
-
- func GetAllHisInfo(org_id int64) (his []*models.HisPrescriptionProject, err error) {
- err = readDb.Model(&models.HisPrescriptionProject{}).Where("user_org_id = ? AND status = 1", org_id).Find(&his).Error
- return
- }
-
- func UpDateHis(his *models.HisDoctorAdviceInfo) {
- writeDb.Save(&his)
- }
-
- func UpDateHis2(his *models.HisPrescriptionProject) {
- writeDb.Save(&his)
- }
-
- func GetAllHisOrder(org_id int64) (his []*models.HisOrder, err error) {
- err = readDb.Model(&models.HisOrder{}).Where("user_org_id = ? AND status = 1 AND order_status = 2 AND fa_piao_code = '' AND fa_piao_number = '' ", org_id).Find(&his).Error
- return
- }
-
- func GetAllHisOrderTwo(org_id int64) (his models.HisOrder, err error) {
- err = readDb.Model(&models.HisOrder{}).Where("user_org_id = ? AND status = 1 AND order_status = 2 AND fa_piao_code <> '' AND fa_piao_number <> '' ", org_id).Last(&his).Error
- return
- }
-
- func GetLastHisOrder() (his models.HisOrder, err error) {
- err = readDb.Model(&models.HisOrder{}).Where("user_org_id = 10106 AND status = 1 AND order_status = 2").Last(&his).Error
- return
- }
-
- type HisPrescriptionAdviceTemplate struct {
- ID int64 `gorm:"column:id" json:"id" form:"id"`
- UserOrgId int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
- PatientId int64 `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
- HisPatientId int64 `gorm:"column:his_patient_id" json:"his_patient_id" form:"his_patient_id"`
- AdviceType int64 `gorm:"column:advice_type" json:"advice_type" form:"advice_type"`
- AdviceDate int64 `gorm:"column:advice_date" json:"advice_date" form:"advice_date"`
- StartTime int64 `gorm:"column:start_time" json:"start_time" form:"start_time"`
- AdviceName string `gorm:"column:advice_name" json:"advice_name" form:"advice_name"`
- AdviceDesc string `gorm:"column:advice_desc" json:"advice_desc" form:"advice_desc"`
- ReminderDate int64 `gorm:"column:reminder_date" json:"reminder_date" form:"reminder_date"`
- SingleDose float64 `gorm:"column:single_dose" json:"single_dose" form:"single_dose"`
- SingleDoseUnit string `gorm:"column:single_dose_unit" json:"single_dose_unit" form:"single_dose_unit"`
- PrescribingNumber float64 `gorm:"column:prescribing_number" json:"prescribing_number" form:"prescribing_number"`
- PrescribingNumberUnit string `gorm:"column:prescribing_number_unit" json:"prescribing_number_unit" form:"prescribing_number_unit"`
- DeliveryWay string `gorm:"column:delivery_way" json:"delivery_way" form:"delivery_way"`
- ExecutionFrequency string `gorm:"column:execution_frequency" json:"execution_frequency" form:"execution_frequency"`
- AdviceDoctor int64 `gorm:"column:advice_doctor" json:"advice_doctor" form:"advice_doctor"`
- Status int64 `gorm:"column:status" json:"status" form:"status"`
- CreatedTime int64 `gorm:"column:created_time" json:"created_time" form:"created_time"`
- UpdatedTime int64 `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
- AdviceAffirm string `gorm:"column:advice_affirm" json:"advice_affirm" form:"advice_affirm"`
- Remark string `gorm:"column:remark" json:"remark" form:"remark"`
- StopTime int64 `gorm:"column:stop_time" json:"stop_time" form:"stop_time"`
- StopReason string `gorm:"column:stop_reason" json:"stop_reason" form:"stop_reason"`
- StopDoctor int64 `gorm:"column:stop_doctor" json:"stop_doctor" form:"stop_doctor"`
- StopState int64 `gorm:"column:stop_state" json:"stop_state" form:"stop_state"`
- ParentId int64 `gorm:"column:parent_id" json:"parent_id" form:"parent_id"`
- ExecutionTime int64 `gorm:"column:execution_time" json:"execution_time" form:"execution_time"`
- ExecutionStaff int64 `gorm:"column:execution_staff" json:"execution_staff" form:"execution_staff"`
- ExecutionState int64 `gorm:"column:execution_state" json:"execution_state" form:"execution_state"`
- Checker int64 `gorm:"column:checker" json:"checker" form:"checker"`
- RecordDate int64 `gorm:"column:record_date" json:"record_date" form:"record_date"`
- DialysisOrderId int64 `gorm:"column:dialysis_order_id" json:"dialysis_order_id" form:"dialysis_order_id"`
- CheckTime int64 `gorm:"column:check_time" json:"check_time" form:"check_time"`
- CheckState int64 `gorm:"column:check_state" json:"check_state" form:"check_state"`
- DrugSpec float64 `gorm:"column:drug_spec" json:"drug_spec" form:"drug_spec"`
- DrugSpecUnit string `gorm:"column:drug_spec_unit" json:"drug_spec_unit" form:"drug_spec_unit"`
- Groupno int64 `gorm:"column:groupno" json:"groupno" form:"groupno"`
- RemindType int64 `gorm:"column:remind_type" json:"remind_type" form:"remind_type"`
- FrequencyType int64 `gorm:"column:frequency_type" json:"frequency_type" form:"frequency_type"`
- DayCount int64 `gorm:"column:day_count" json:"day_count" form:"day_count"`
- WeekDay string `gorm:"column:week_day" json:"week_day" form:"week_day"`
- TemplateId string `gorm:"column:template_id" json:"template_id" form:"template_id"`
- Modifier int64 `gorm:"column:modifier" json:"modifier" form:"modifier"`
- DrugId int64 `gorm:"column:drug_id" json:"drug_id" form:"drug_id"`
- Price float64 `gorm:"column:price" json:"price" form:"price"`
- PrescriptionId int64 `gorm:"column:prescription_id" json:"prescription_id" form:"prescription_id"`
- MedListCodg string `gorm:"column:med_list_codg" json:"med_list_codg" form:"med_list_codg"`
- FeedetlSn string `gorm:"column:feedetl_sn" json:"feedetl_sn" form:"feedetl_sn"`
- Day int64 `gorm:"column:day" json:"day" form:"day"`
- Diagnosis int64 `gorm:"column:diagnosis" json:"diagnosis" form:"diagnosis"`
- HospApprFlag int64 `gorm:"column:hosp_appr_flag" json:"hosp_appr_flag" form:"hosp_appr_flag"`
- LmtUsedFlag int64 `gorm:"column:lmt_used_flag" json:"lmt_used_flag" form:"lmt_used_flag"`
- }
-
- func (HisPrescriptionAdviceTemplate) TableName() string {
- return "his_prescription_advice_template"
- }
-
- type HisPrescriptionInfoTemplateTwo struct {
- ID int64 `gorm:"column:id" json:"id" form:"id"`
- UserOrgId int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
- RecordDate int64 `gorm:"column:record_date" json:"record_date" form:"record_date"`
- PatientId int64 `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
- Status int64 `gorm:"column:status" json:"status" form:"status"`
- Ctime int64 `gorm:"column:ctime" json:"ctime" form:"ctime"`
- Mtime int64 `gorm:"column:mtime" json:"mtime" form:"mtime"`
- Type int64 `gorm:"column:type" json:"type" form:"type"`
- Creator int64 `gorm:"column:creator" json:"creator" form:"creator"`
- Modifier int64 `gorm:"column:modifier" json:"modifier" form:"modifier"`
- PType int64 `gorm:"column:p_type" json:"p_type" form:"p_type"`
- PTemplateId int64 `gorm:"column:p_template_id" json:"p_template_id" form:"p_template_id"`
- HisPrescriptionAdviceTemplate []HisPrescriptionAdviceTemplate `gorm:"ForeignKey:PrescriptionId;AssociationForeignKey:ID" json:"advices"`
- MedType string `gorm:"column:med_type" json:"med_type" form:"med_type"`
- }
-
- func (HisPrescriptionInfoTemplateTwo) TableName() string {
- return "his_prescription_info_template"
- }
-
- func GetHisPrescriptionTemplateTwo() (prescription []*HisPrescriptionInfoTemplateTwo, err error) {
- err = readDb.Model(&HisPrescriptionInfoTemplateTwo{}).
- Preload("HisPrescriptionAdviceTemplate", func(db *gorm.DB) *gorm.DB {
- return db.Where("status = 1")
- }).
- Where("status = 1 ").
- Find(&prescription).Error
- return
- }
-
- func SaveAdviceTemplate(advice HisPrescriptionAdviceTemplate) {
- writeDb.Save(&advice)
- }
-
- func GetAllPT(org_id int64) (his []*models.HisPrescriptionTemplate, err error) {
- err = readDb.Model(&models.HisPrescriptionTemplate{}).Where("user_org_id = ? AND status = 1", org_id).Find(&his).Error
- return
- }
-
- type HisPrescriptionProjectTemplate struct {
- ID int64 `gorm:"column:id" json:"id" form:"id"`
- ProjectId int64 `gorm:"column:project_id" json:"project_id" form:"project_id"`
- Price float64 `gorm:"column:price" json:"price" form:"price"`
- UserOrgId int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
- Status int64 `gorm:"column:status" json:"status" form:"status"`
- Ctime int64 `gorm:"column:ctime" json:"ctime" form:"ctime"`
- Mtime int64 `gorm:"column:mtime" json:"mtime" form:"mtime"`
- PatientId int64 `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
- HisPatientId int64 `gorm:"column:his_patient_id" json:"his_patient_id" form:"his_patient_id"`
- RecordDate int64 `gorm:"column:record_date" json:"record_date" form:"record_date"`
- Count string `gorm:"column:count" json:"count" form:"count"`
- FeedetlSn string `gorm:"column:feedetl_sn" json:"feedetl_sn" form:"feedetl_sn"`
- MedListCodg string `gorm:"column:med_list_codg" json:"med_list_codg" form:"med_list_codg"`
- SingleDose string `gorm:"column:single_dose" json:"single_dose" form:"single_dose"`
- DeliveryWay string `gorm:"column:delivery_way" json:"delivery_way" form:"delivery_way"`
- ExecutionFrequency string `gorm:"column:execution_frequency" json:"execution_frequency" form:"execution_frequency"`
- Day string `gorm:"column:day" json:"day" form:"day"`
- Remark string `gorm:"column:remark" json:"remark" form:"remark"`
- Unit string `gorm:"column:unit" json:"unit" form:"unit"`
- Type int64 `gorm:"column:type" json:"type" form:"type"`
- PrescriptionId int64 `gorm:"column:prescription_id" json:"prescription_id" form:"prescription_id"`
- FrequencyType int64 `gorm:"column:frequency_type" json:"frequency_type" form:"frequency_type"`
- DayCount int64 `gorm:"column:day_count" json:"day_count" form:"day_count"`
- WeekDay string `gorm:"column:week_day" json:"week_day" form:"week_day"`
- }
-
- func (HisPrescriptionProjectTemplate) TableName() string {
- return "his_prescription_project_template"
- }
-
- type HisPrescriptionInfoTemplateTHree struct {
- ID int64 `gorm:"column:id" json:"id" form:"id"`
- UserOrgId int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
- RecordDate int64 `gorm:"column:record_date" json:"record_date" form:"record_date"`
- PatientId int64 `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
- Status int64 `gorm:"column:status" json:"status" form:"status"`
- Ctime int64 `gorm:"column:ctime" json:"ctime" form:"ctime"`
- Mtime int64 `gorm:"column:mtime" json:"mtime" form:"mtime"`
- Type int64 `gorm:"column:type" json:"type" form:"type"`
- Creator int64 `gorm:"column:creator" json:"creator" form:"creator"`
- Modifier int64 `gorm:"column:modifier" json:"modifier" form:"modifier"`
- PType int64 `gorm:"column:p_type" json:"p_type" form:"p_type"`
- PTemplateId int64 `gorm:"column:p_template_id" json:"p_template_id" form:"p_template_id"`
- HisPrescriptionAdviceTemplate []HisPrescriptionAdviceTemplate `gorm:"ForeignKey:PrescriptionId;AssociationForeignKey:ID" json:"advices"`
- HisPrescriptionProjectTemplate []HisPrescriptionProjectTemplate `gorm:"ForeignKey:PrescriptionId;AssociationForeignKey:ID" json:"project"`
- MedType string `gorm:"column:med_type" json:"med_type" form:"med_type"`
- }
-
- func (HisPrescriptionInfoTemplateTHree) TableName() string {
- return "his_prescription_info_template"
- }
-
- func GetAllPTInfo(org_id int64, p_template_id int64) (his []*HisPrescriptionInfoTemplateTHree, err error) {
- err = readDb.Model(&HisPrescriptionInfoTemplateTHree{}).Preload("HisPrescriptionAdviceTemplate", func(db *gorm.DB) *gorm.DB {
- return db.Where("status = 1")
- }).Preload("HisPrescriptionProjectTemplate", func(db *gorm.DB) *gorm.DB {
- return db.Where("status = 1")
- }).Where("user_org_id = ? AND status = 1 AND p_template_id = ?", org_id, p_template_id).Find(&his).Error
- return
- }
-
- func GetAllInfo(org_id int64, project_id int64) (his []*HisPrescriptionProjectTemplate, err error) {
- err = readDb.Model(&HisPrescriptionProjectTemplate{}).Where("user_org_id = ? AND status = 1 AND project_id = ? ", org_id, project_id).Find(&his).Error
- return
- }
- func UpdateStatus(project_id int64, p_id int64) {
- writeDb.Model(&HisPrescriptionProjectTemplate{}).Where("id = ?", project_id).Updates(map[string]interface{}{"status": 0})
- writeDb.Model(&HisPrescriptionInfoTemplateTwo{}).Where("id = ?", p_id).Updates(map[string]interface{}{"status": 0})
- }
-
- func SaveOrder(order *models.HisOrder) {
- writeDb.Save(&order)
- }
-
- func SaveOrderTwo(order *models.HisOrder) error {
- err := writeDb.Save(&order).Error
- return err
- }
-
- func GetAllPrivateHis(org_id int64) (his []*models.HisPatient) {
- readDb.Model(&models.HisPatient{}).Where("user_org_id = ? AND balance_accounts_type = 2 AND status = 1", org_id).Find(&his)
- return
- }
-
- func SaveHis(his *models.HisPatient) {
- writeDb.Save(his)
- return
- }
-
- func GetAllProjectPrescription() (pre []*models.HisPrescription) {
- readDb.Model(&models.HisPrescription{}).Where("user_org_id = 10215 AND status = 1 AND type = 2 AND order_status = 1 AND record_date >= 1659283200").Find(&pre)
- return
- }
-
- func GetAllProject(id int64) (pre []*models.HisPrescriptionProject) {
- readDb.Model(&models.HisPrescriptionProject{}).Where("user_org_id = 10215 AND status = 1 AND project_id = 1735 AND prescription_id = ?", id).Find(&pre)
- return
- }
-
- //func GetHisOrderDetailByNumberTwo(order_number string, org_id int64) (order []*HisOrderInfo, err error) {
- // readDb.Model(&models.Patients{})
- //
- // err = readDb.Model(&HisOrderInfo{}).Where("order_number = ? AND status = 1", order_number).Preload("HisPrescriptionProject", func(db *gorm.DB) *gorm.DB {
- // return db.Where("status = 1 AND user_org_id = ?", org_id).Preload("VMHisPrescriptionTwo", "status = 1 AND user_org_id = ?", org_id).Preload("VMHisProject", "status = 1 AND user_org_id = ?", org_id).Preload("VMGoodInfo", "status = 1 AND org_id = ?", org_id)
- // }).Preload("HisDoctorAdviceInfo", func(db *gorm.DB) *gorm.DB {
- // return db.Where("status = 1 AND user_org_id = ?", org_id).Preload("VMHisPrescriptionTwo", "status = 1 AND user_org_id = ?", org_id).Preload("Drug", "status = 1 AND org_id = ?", org_id)
- // }).Find(&order).Error
- // return
- //}
-
- type HisOrderTen struct {
- ID int64 `gorm:"column:id" json:"id" form:"id"`
- UserOrgId int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
- HisPatientId int64 `gorm:"column:his_patient_id" json:"his_patient_id" form:"his_patient_id"`
- SettleAccountsDate int64 `gorm:"column:settle_accounts_date" json:"settle_accounts_date" form:"settle_accounts_date"`
- Ctime int64 `gorm:"column:ctime" json:"ctime" form:"ctime"`
- Mtime int64 `gorm:"column:mtime" json:"mtime" form:"mtime"`
- Status int64 `gorm:"column:status" json:"status" form:"status"`
- Number string `gorm:"column:number" json:"number" form:"number"`
- PatientId int64 `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
- Infcode int64 `gorm:"column:infcode" json:"infcode" form:"infcode"`
- WarnMsg string `gorm:"column:warn_msg" json:"warn_msg" form:"warn_msg"`
- Cainfo string `gorm:"column:cainfo" json:"cainfo" form:"cainfo"`
- ErrMsg string `gorm:"column:err_msg" json:"err_msg" form:"err_msg"`
- RespondTime string `gorm:"column:respond_time" json:"respond_time" form:"respond_time"`
- InfRefmsgid string `gorm:"column:inf_refmsgid" json:"inf_refmsgid" form:"inf_refmsgid"`
- OrderStatus int64 `gorm:"column:order_status" json:"order_status" form:"order_status"`
- MdtrtId string `gorm:"column:mdtrt_id" json:"mdtrt_id" form:"mdtrt_id"`
- SetlId string `gorm:"column:setl_id" json:"setl_id" form:"setl_id"`
- PsnNo string `gorm:"column:psn_no" json:"psn_no" form:"psn_no"`
- PsnName string `gorm:"column:psn_name" json:"psn_name" form:"psn_name"`
- PsnCertType string `gorm:"column:psn_cert_type" json:"psn_cert_type" form:"psn_cert_type"`
- Certno string `gorm:"column:certno" json:"certno" form:"certno"`
- Gend string `gorm:"column:gend" json:"gend" form:"gend"`
- Naty string `gorm:"column:naty" json:"naty" form:"naty"`
- Brdy time.Time `gorm:"column:brdy" json:"brdy" form:"brdy"`
- Age float64 `gorm:"column:age" json:"age" form:"age"`
- Insutype string `gorm:"column:insutype" json:"insutype" form:"insutype"`
- PsnType string `gorm:"column:psn_type" json:"psn_type" form:"psn_type"`
- CvlservFlag string `gorm:"column:cvlserv_flag" json:"cvlserv_flag" form:"cvlserv_flag"`
- SetlTime string `gorm:"column:setl_time" json:"setl_time" form:"setl_time"`
- MdtrtCertType string `gorm:"column:mdtrt_cert_type" json:"mdtrt_cert_type" form:"mdtrt_cert_type"`
- MedType string `gorm:"column:med_type" json:"med_type" form:"med_type"`
- MedfeeSumamt float64 `gorm:"column:medfee_sumamt" json:"medfee_sumamt" form:"medfee_sumamt"`
- FulamtOwnpayAmt float64 `gorm:"column:fulamt_ownpay_amt" json:"fulamt_ownpay_amt" form:"fulamt_ownpay_amt"`
- OverlmtSelfPay float64 `gorm:"column:overlmt_self_pay" json:"overlmt_self_pay" form:"overlmt_self_pay"`
- PreselfpayAmt float64 `gorm:"column:preselfpay_amt" json:"preselfpay_amt" form:"preselfpay_amt"`
- InscpScpAmt float64 `gorm:"column:inscp_scp_amt" json:"inscp_scp_amt" form:"inscp_scp_amt"`
- ActPayDedc float64 `gorm:"column:act_pay_dedc" json:"act_pay_dedc" form:"act_pay_dedc"`
- HifpPay float64 `gorm:"column:hifp_pay" json:"hifp_pay" form:"hifp_pay"`
- CvlservPay float64 `gorm:"column:cvlserv_pay" json:"cvlserv_pay" form:"cvlserv_pay"`
- PoolPropSelfpay float64 `gorm:"column:pool_prop_selfpay" json:"pool_prop_selfpay" form:"pool_prop_selfpay"`
- HifesPay float64 `gorm:"column:hifes_pay" json:"hifes_pay" form:"hifes_pay"`
- HifmiPay float64 `gorm:"column:hifmi_pay" json:"hifmi_pay" form:"hifmi_pay"`
- HifobPay float64 `gorm:"column:hifob_pay" json:"hifob_pay" form:"hifob_pay"`
- MafPay float64 `gorm:"column:maf_pay" json:"maf_pay" form:"maf_pay"`
- OthPay float64 `gorm:"column:oth_pay" json:"oth_pay" form:"oth_pay"`
- FundPaySumamt float64 `gorm:"column:fund_pay_sumamt" json:"fund_pay_sumamt" form:"fund_pay_sumamt"`
- PsnPartAmt float64 `gorm:"column:psn_part_amt" json:"psn_part_amt" form:"psn_part_amt"`
- AcctPay float64 `gorm:"column:acct_pay" json:"acct_pay" form:"acct_pay"`
- PsnCashPay float64 `gorm:"column:psn_cash_pay" json:"psn_cash_pay" form:"psn_cash_pay"`
- HospPartAmt float64 `gorm:"column:hosp_part_amt" json:"hosp_part_amt" form:"hosp_part_amt"`
- Balc float64 `gorm:"column:balc" json:"balc" form:"balc"`
- AcctMulaidPay float64 `gorm:"column:acct_mulaid_pay" json:"acct_mulaid_pay" form:"acct_mulaid_pay"`
- MedinsSetlId string `gorm:"column:medins_setl_id" json:"medins_setl_id" form:"medins_setl_id"`
- ClrOptins string `gorm:"column:clr_optins" json:"clr_optins" form:"clr_optins"`
- ClrWay string `gorm:"column:clr_way" json:"clr_way" form:"clr_way"`
- ClrType string `gorm:"column:clr_type" json:"clr_type" form:"clr_type"`
- SetlDetail string `gorm:"column:setl_detail" json:"setl_detail" form:"setl_detail"`
- IsMedicineInsurance int64 `gorm:"column:is_medicine_insurance" json:"is_medicine_insurance" form:"is_medicine_insurance"`
- PayWay int64 `gorm:"column:pay_way" json:"pay_way" form:"pay_way"`
- PayPrice float64 `gorm:"column:pay_price" json:"pay_price" form:"pay_price"`
- PayCardNo string `gorm:"column:pay_card_no" json:"pay_card_no" form:"pay_card_no"`
- DiscountPrice float64 `gorm:"column:discount_price" json:"discount_price" form:"discount_price"`
- PreferentialPrice float64 `gorm:"column:preferential_price" json:"preferential_price" form:"preferential_price"`
- RealityPrice float64 `gorm:"column:reality_price" json:"reality_price" form:"reality_price"`
- FoundPrice float64 `gorm:"column:found_price" json:"found_price" form:"found_price"`
- MedicalInsurancePrice float64 `gorm:"column:medical_insurance_price" json:"medical_insurance_price" form:"medical_insurance_price"`
- PrivatePrice float64 `gorm:"column:private_price" json:"private_price" form:"private_price"`
- DepartmentName string `gorm:"-" json:"department_name" form:"department_name"`
- DoctorName string `gorm:"-" json:"doctor_name" form:"doctor_name"`
- Creator int64 `gorm:"column:creator" json:"creator" form:"creator"`
- PType int64 `gorm:"column:p_type" json:"p_type" form:"p_type"`
- Decimal float64 `gorm:"column:decimal" json:"decimal" form:"decimal"`
- VmHisOrderInfo9504 []*VmHisOrderInfo9504 `gorm:"ForeignKey:OrderNumber;AssociationForeignKey:Number" json:"info"`
- //HisPrescriptionTen []*HisPrescriptionTen `gorm:"ForeignKey:BatchNumber;AssociationForeignKey:Number" json:"info"`
- Patients Patients `gorm:"ForeignKey:PatientId;AssociationForeignKey:ID" json:"patient"`
- CardDesc string `gorm:"card_desc" json:"card_desc" form:"card_desc"`
- }
-
- func (HisOrderTen) TableName() string {
- return "his_order"
- }
-
- type HisPrescriptionTen struct {
- ID int64 `gorm:"column:id" json:"id" form:"id"`
- UserOrgId int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
- RecordDate int64 `gorm:"column:record_date" json:"record_date" form:"record_date"`
- PatientId int64 `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
- HisPatientId int64 `gorm:"column:his_patient_id" json:"his_patient_id" form:"his_patient_id"`
- Status int64 `gorm:"column:status" json:"status" form:"status"`
- Ctime int64 `gorm:"column:ctime" json:"ctime" form:"ctime"`
- Mtime int64 `gorm:"column:mtime" json:"mtime" form:"mtime"`
- Number string `gorm:"column:number" json:"number" form:"number"`
- Type int64 `gorm:"column:type" json:"type" form:"type"`
- Doctor string `gorm:"column:doctor" json:"doctor" form:"doctor"`
- Creator int64 `gorm:"column:creator" json:"creator" form:"creator"`
- Modifier int64 `gorm:"column:modifier" json:"modifier" form:"modifier"`
- OrderStatus int64 `gorm:"column:order_status" json:"order_status" form:"order_status"`
- PreTime int64 `gorm:"column:pre_time" json:"pre_time" form:"pre_time"`
- BatchNumber string `gorm:"column:batch_number" json:"batch_number" form:"batch_number"`
- PrescriptionNumber string `gorm:"column:prescription_number" json:"prescription_number" form:"prescription_number"`
- Patients Patients `gorm:"ForeignKey:PatientId;AssociationForeignKey:ID" json:"patient"`
- HisDoctorAdviceInfoTen []*HisDoctorAdviceInfoTen `gorm:"ForeignKey:PrescriptionId;AssociationForeignKey:ID" json:"advices"`
- HisPrescriptionProjectTen []*HisPrescriptionProjectTen `gorm:"ForeignKey:PrescriptionId;AssociationForeignKey:ID" json:"project"`
- Total string `gorm:"-" json:"total" form:"total"`
- PType int64 `gorm:"column:p_type" json:"p_type" form:"p_type"`
- MedType string `gorm:"column:med_type" json:"med_type" form:"med_type"`
- IsMedicine int64 `gorm:"column:is_medicine" json:"is_medicine" form:"is_medicine"`
- }
-
- func (HisPrescriptionTen) TableName() string {
- return "his_prescription"
- }
-
- func GetHisOrderDetailThree(start_time string, end_time string, org_id int64) (order []*HisOrderTen, err error) {
- start_time = start_time + " 00:00:00"
- end_time = end_time + " 23:59:00"
-
- err = readDb.Model(&HisOrderTen{}).Preload("Patients", "status = 1").Preload("VmHisOrderInfo9504", func(db *gorm.DB) *gorm.DB {
- return db.Where("status = 1").Preload("HisPrescriptionProjectTen", func(db *gorm.DB) *gorm.DB {
- return db.Where("status = 1").Preload("VMHisProject", "status = 1").Preload("VMGoodInfo", "status = 1")
- }).Preload("HisDoctorAdviceInfoTen", func(db *gorm.DB) *gorm.DB {
- return db.Where("status = 1").Preload("Drug", "status = 1")
- })
- }).Where("setl_time >= ? AND setl_time <= ? AND status = 1 AND order_status =2 AND user_org_id = ?", start_time, end_time, org_id).Find(&order).Order("patient_id").Error
- return
- }
-
- type HisDoctorAdviceInfoTen struct {
- ID int64 `gorm:"column:id" json:"id" form:"id"`
- UserOrgId int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
- PatientId int64 `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
- AdviceDate int64 `gorm:"column:advice_date" json:"advice_date" form:"advice_date"`
- AdviceName string `gorm:"column:advice_name" json:"advice_name" form:"advice_name"`
- AdviceDesc string `gorm:"column:advice_desc" json:"advice_desc" form:"advice_desc"`
- SingleDose float64 `gorm:"column:single_dose" json:"single_dose" form:"single_dose"`
- SingleDoseUnit string `gorm:"column:single_dose_unit" json:"single_dose_unit" form:"single_dose_unit"`
- PrescribingNumber float64 `gorm:"column:prescribing_number" json:"prescribing_number" form:"prescribing_number"`
- PrescribingNumberUnit string `gorm:"column:prescribing_number_unit" json:"prescribing_number_unit" form:"prescribing_number_unit"`
- DeliveryWay string `gorm:"column:delivery_way" json:"delivery_way" form:"delivery_way"`
- ExecutionFrequency string `gorm:"column:execution_frequency" json:"execution_frequency" form:"execution_frequency"`
- Status int64 `gorm:"column:status" json:"status" form:"status"`
- CreatedTime int64 `gorm:"column:created_time" json:"created_time" form:"created_time"`
- RecordDate int64 `gorm:"column:record_date" json:"record_date" form:"record_date"`
- DrugSpec float64 `gorm:"column:drug_spec" json:"drug_spec" form:"drug_spec"`
- DrugSpecUnit string `gorm:"column:drug_spec_unit" json:"drug_spec_unit" form:"drug_spec_unit"`
- PrescriptionId int64 `gorm:"column:prescription_id" json:"prescription_id" form:"prescription_id"`
-
- Price float64 `gorm:"column:price" json:"price" form:"price"`
- DrugId int64 `gorm:"column:drug_id" json:"drug_id" form:"drug_id"`
- Drug Drug `gorm:"ForeignKey:ID;AssociationForeignKey:DrugId" json:"drug"`
- IsMedicine int64 `gorm:"column:is_medicine" json:"is_medicine" form:"is_medicine"`
- ExecutionFrequencyId int64 `gorm:"column:execution_frequency_id" json:"execution_frequency_id" form:"execution_frequency_id"`
- IsSelfDrug int64 `gorm:"column:is_self_drug" json:"is_self_drug" form:"is_self_drug"`
- }
-
- func (HisDoctorAdviceInfoTen) TableName() string {
- return "his_doctor_advice_info"
- }
-
- type HisPrescriptionProjectTen struct {
- ID int64 `gorm:"column:id" json:"id" form:"id"`
- ProjectId int64 `gorm:"column:project_id" json:"project_id" form:"project_id"`
- Price float64 `gorm:"column:price" json:"price" form:"price"`
- UserOrgId int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
- Status int64 `gorm:"column:status" json:"status" form:"status"`
- Ctime int64 `gorm:"column:ctime" json:"ctime" form:"ctime"`
- Mtime int64 `gorm:"column:mtime" json:"mtime" form:"mtime"`
- PatientId int64 `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
- HisPatientId int64 `gorm:"column:his_patient_id" json:"his_patient_id" form:"his_patient_id"`
- RecordDate int64 `gorm:"column:record_date" json:"record_date" form:"record_date"`
- PrescriptionId int64 `gorm:"column:prescription_id" json:"prescription_id" form:"prescription_id"`
- Count string `gorm:"column:count" json:"count" form:"count"`
- FeedetlSn string `gorm:"column:feedetl_sn" json:"feedetl_sn" form:"feedetl_sn"`
- MedListCodg string `gorm:"column:med_list_codg" json:"med_list_codg" form:"med_list_codg"`
- SingleDose string `gorm:"column:single_dose" json:"single_dose" form:"single_dose"`
- DeliveryWay string `gorm:"column:delivery_way" json:"delivery_way" form:"delivery_way"`
- ExecutionFrequency string `gorm:"column:execution_frequency" json:"execution_frequency" form:"execution_frequency"`
- Day string `gorm:"column:day" json:"day" form:"day"`
- VMHisProject VMHisProject `gorm:"ForeignKey:ProjectId;AssociationForeignKey:ID" json:"project"`
- VMGoodInfo VMGoodInfo `gorm:"ForeignKey:ProjectId;AssociationForeignKey:ID" json:"good_info"`
- Remark string `gorm:"column:remark" json:"remark" form:"remark"`
- Unit string `gorm:"column:unit" json:"unit" form:"unit"`
- Type int64 `gorm:"column:type" json:"type" form:"type"`
- Doctor int64 `gorm:"column:doctor" json:"doctor" form:"doctor"`
- ExecutionTime int64 `gorm:"column:execution_time" json:"execution_time" form:"execution_time"`
- ExecutionStaff int64 `gorm:"column:execution_staff" json:"execution_staff" form:"execution_staff"`
- ExecutionState int64 `gorm:"column:execution_state" json:"execution_state" form:"execution_state"`
- CheckTime int64 `gorm:"column:check_time" json:"check_time" form:"check_time"`
- CheckState int64 `gorm:"column:check_state" json:"check_state" form:"check_state"`
- Checker int64 `gorm:"column:checker" json:"checker" form:"checker"`
- StartTime int64 `gorm:"column:start_time" json:"start_time" form:"start_time"`
- TeamId int64 `gorm:"column:team_id" json:"team_id" form:"team_id"`
-
- FrequencyType int64 `gorm:"column:frequency_type" json:"frequency_type" form:"frequency_type"`
- DayCount int64 `gorm:"column:day_count" json:"day_count" form:"day_count"`
- WeekDay string `gorm:"column:week_day" json:"week_day" form:"week_day"`
- ExecutionFrequencyId int64 `gorm:"column:execution_frequency_id" json:"execution_frequency_id" form:"execution_frequency_id"`
- }
-
- func (HisPrescriptionProjectTen) TableName() string {
- return "his_prescription_project"
- }
-
- func GetHisPatient11111(orgid int64) (paitent []*models.HisHospitalCheckRecord, err error) {
-
- err = XTReadDB().Model(&paitent).Where("user_org_id = ? and status = 1 AND in_hosptial_time >= '2024-06-01 00:00:00' AND in_hosptial_time <= '2024-06-30 23:59:59'", orgid).Find(&paitent).Error
- return paitent, err
- }
-
- func SaveHP(paitent *models.HisHospitalCheckRecord) {
- writeDb.Save(&paitent)
-
- }
-
- func Savehis(paitent *models.HisPatient) {
- writeDb.Save(&paitent)
-
- }
-
- type HisOrder9504 struct {
- ID int64 `gorm:"column:id" json:"id" form:"id"`
- UserOrgId int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
- HisPatientId int64 `gorm:"column:his_patient_id" json:"his_patient_id" form:"his_patient_id"`
- SettleAccountsDate int64 `gorm:"column:settle_accounts_date" json:"settle_accounts_date" form:"settle_accounts_date"`
- Ctime int64 `gorm:"column:ctime" json:"ctime" form:"ctime"`
- Mtime int64 `gorm:"column:mtime" json:"mtime" form:"mtime"`
- Status int64 `gorm:"column:status" json:"status" form:"status"`
- Number string `gorm:"column:number" json:"number" form:"number"`
- PatientId int64 `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
- Infcode int64 `gorm:"column:infcode" json:"infcode" form:"infcode"`
- WarnMsg string `gorm:"column:warn_msg" json:"warn_msg" form:"warn_msg"`
- Cainfo string `gorm:"column:cainfo" json:"cainfo" form:"cainfo"`
- ErrMsg string `gorm:"column:err_msg" json:"err_msg" form:"err_msg"`
- RespondTime string `gorm:"column:respond_time" json:"respond_time" form:"respond_time"`
- InfRefmsgid string `gorm:"column:inf_refmsgid" json:"inf_refmsgid" form:"inf_refmsgid"`
- OrderStatus int64 `gorm:"column:order_status" json:"order_status" form:"order_status"`
- MdtrtId string `gorm:"column:mdtrt_id" json:"mdtrt_id" form:"mdtrt_id"`
- SetlId string `gorm:"column:setl_id" json:"setl_id" form:"setl_id"`
- PsnNo string `gorm:"column:psn_no" json:"psn_no" form:"psn_no"`
- PsnName string `gorm:"column:psn_name" json:"psn_name" form:"psn_name"`
- PsnCertType string `gorm:"column:psn_cert_type" json:"psn_cert_type" form:"psn_cert_type"`
- Certno string `gorm:"column:certno" json:"certno" form:"certno"`
- Gend string `gorm:"column:gend" json:"gend" form:"gend"`
- Naty string `gorm:"column:naty" json:"naty" form:"naty"`
- Brdy time.Time `gorm:"column:brdy" json:"brdy" form:"brdy"`
- Age float64 `gorm:"column:age" json:"age" form:"age"`
- Insutype string `gorm:"column:insutype" json:"insutype" form:"insutype"`
- PsnType string `gorm:"column:psn_type" json:"psn_type" form:"psn_type"`
- CvlservFlag string `gorm:"column:cvlserv_flag" json:"cvlserv_flag" form:"cvlserv_flag"`
- SetlTime string `gorm:"column:setl_time" json:"setl_time" form:"setl_time"`
- MdtrtCertType string `gorm:"column:mdtrt_cert_type" json:"mdtrt_cert_type" form:"mdtrt_cert_type"`
- MedType string `gorm:"column:med_type" json:"med_type" form:"med_type"`
- MedfeeSumamt float64 `gorm:"column:medfee_sumamt" json:"medfee_sumamt" form:"medfee_sumamt"`
- FulamtOwnpayAmt float64 `gorm:"column:fulamt_ownpay_amt" json:"fulamt_ownpay_amt" form:"fulamt_ownpay_amt"`
- OverlmtSelfPay float64 `gorm:"column:overlmt_self_pay" json:"overlmt_self_pay" form:"overlmt_self_pay"`
- PreselfpayAmt float64 `gorm:"column:preselfpay_amt" json:"preselfpay_amt" form:"preselfpay_amt"`
- InscpScpAmt float64 `gorm:"column:inscp_scp_amt" json:"inscp_scp_amt" form:"inscp_scp_amt"`
- ActPayDedc float64 `gorm:"column:act_pay_dedc" json:"act_pay_dedc" form:"act_pay_dedc"`
- HifpPay float64 `gorm:"column:hifp_pay" json:"hifp_pay" form:"hifp_pay"`
- CvlservPay float64 `gorm:"column:cvlserv_pay" json:"cvlserv_pay" form:"cvlserv_pay"`
- PoolPropSelfpay float64 `gorm:"column:pool_prop_selfpay" json:"pool_prop_selfpay" form:"pool_prop_selfpay"`
- HifesPay float64 `gorm:"column:hifes_pay" json:"hifes_pay" form:"hifes_pay"`
- HifmiPay float64 `gorm:"column:hifmi_pay" json:"hifmi_pay" form:"hifmi_pay"`
- HifobPay float64 `gorm:"column:hifob_pay" json:"hifob_pay" form:"hifob_pay"`
- MafPay float64 `gorm:"column:maf_pay" json:"maf_pay" form:"maf_pay"`
- OthPay float64 `gorm:"column:oth_pay" json:"oth_pay" form:"oth_pay"`
- FundPaySumamt float64 `gorm:"column:fund_pay_sumamt" json:"fund_pay_sumamt" form:"fund_pay_sumamt"`
- PsnPartAmt float64 `gorm:"column:psn_part_amt" json:"psn_part_amt" form:"psn_part_amt"`
- AcctPay float64 `gorm:"column:acct_pay" json:"acct_pay" form:"acct_pay"`
- PsnCashPay float64 `gorm:"column:psn_cash_pay" json:"psn_cash_pay" form:"psn_cash_pay"`
- HospPartAmt float64 `gorm:"column:hosp_part_amt" json:"hosp_part_amt" form:"hosp_part_amt"`
- Balc float64 `gorm:"column:balc" json:"balc" form:"balc"`
- AcctMulaidPay float64 `gorm:"column:acct_mulaid_pay" json:"acct_mulaid_pay" form:"acct_mulaid_pay"`
- MedinsSetlId string `gorm:"column:medins_setl_id" json:"medins_setl_id" form:"medins_setl_id"`
- ClrOptins string `gorm:"column:clr_optins" json:"clr_optins" form:"clr_optins"`
- ClrWay string `gorm:"column:clr_way" json:"clr_way" form:"clr_way"`
- ClrType string `gorm:"column:clr_type" json:"clr_type" form:"clr_type"`
- SetlDetail string `gorm:"column:setl_detail" json:"setl_detail" form:"setl_detail"`
- IsMedicineInsurance int64 `gorm:"column:is_medicine_insurance" json:"is_medicine_insurance" form:"is_medicine_insurance"`
- PayWay int64 `gorm:"column:pay_way" json:"pay_way" form:"pay_way"`
- PayPrice float64 `gorm:"column:pay_price" json:"pay_price" form:"pay_price"`
- PayCardNo string `gorm:"column:pay_card_no" json:"pay_card_no" form:"pay_card_no"`
- DiscountPrice float64 `gorm:"column:discount_price" json:"discount_price" form:"discount_price"`
- PreferentialPrice float64 `gorm:"column:preferential_price" json:"preferential_price" form:"preferential_price"`
- RealityPrice float64 `gorm:"column:reality_price" json:"reality_price" form:"reality_price"`
- FoundPrice float64 `gorm:"column:found_price" json:"found_price" form:"found_price"`
- MedicalInsurancePrice float64 `gorm:"column:medical_insurance_price" json:"medical_insurance_price" form:"medical_insurance_price"`
- PrivatePrice float64 `gorm:"column:private_price" json:"private_price" form:"private_price"`
- DepartmentName string `gorm:"-" json:"department_name" form:"department_name"`
- DoctorName string `gorm:"-" json:"doctor_name" form:"doctor_name"`
- SettleStartTime int64 `gorm:"settle_start_time" json:"settle_start_time" form:"settle_start_time"`
-
- Creator int64 `gorm:"column:creator" json:"creator" form:"creator"`
- PType int64 `gorm:"column:p_type" json:"p_type" form:"p_type"`
- Decimal float64 `gorm:"column:decimal" json:"decimal" form:"decimal"`
- VmHisOrderInfo9504 []*VmHisOrderInfo9504 `gorm:"ForeignKey:OrderNumber;AssociationForeignKey:Number" json:"info"`
- Patients Patients `gorm:"ForeignKey:PatientId;AssociationForeignKey:ID" json:"patient"`
- CardDesc string `gorm:"card_desc" json:"card_desc" form:"card_desc"`
- }
-
- func (HisOrder9504) TableName() string {
- return "his_order"
- }
-
- type VmHisOrderInfo9504 struct {
- ID int64 `gorm:"column:id" json:"id" form:"id"`
- OrderNumber string `gorm:"column:order_number" json:"order_number" form:"order_number"`
- UploadDate int64 `gorm:"column:upload_date" json:"upload_date" form:"upload_date"`
- AdviceId int64 `gorm:"column:advice_id" json:"advice_id" form:"advice_id"`
- DetItemFeeSumamt float64 `gorm:"column:det_item_fee_sumamt" json:"det_item_fee_sumamt" form:"det_item_fee_sumamt"`
- Cnt float64 `gorm:"column:cnt" json:"cnt" form:"cnt"`
- Pric float64 `gorm:"column:pric" json:"pric" form:"pric"`
- PatientId int64 `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
- PricUplmtAmt float64 `gorm:"column:pric_uplmt_amt" json:"pric_uplmt_amt" form:"pric_uplmt_amt"`
- SelfpayProp float64 `gorm:"column:selfpay_prop" json:"selfpay_prop" form:"selfpay_prop"`
- FulamtOwnpayAmt float64 `gorm:"column:fulamt_ownpay_amt" json:"fulamt_ownpay_amt" form:"fulamt_ownpay_amt"`
- OverlmtAmt float64 `gorm:"column:overlmt_amt" json:"overlmt_amt" form:"overlmt_amt"`
- PreselfpayAmt float64 `gorm:"column:preselfpay_amt" json:"preselfpay_amt" form:"preselfpay_amt"`
- BasMednFlag string `gorm:"column:bas_medn_flag" json:"bas_medn_flag" form:"bas_medn_flag"`
- MedChrgitmType string `gorm:"column:med_chrgitm_type" json:"med_chrgitm_type" form:"med_chrgitm_type"`
- HiNegoDrugFlag string `gorm:"column:hi_nego_drug_flag" json:"hi_nego_drug_flag" form:"hi_nego_drug_flag"`
- Status int64 `gorm:"column:status" json:"status" form:"status"`
- Memo string `gorm:"column:memo" json:"memo" form:"memo"`
- FeedetlSn string `gorm:"column:feedetl_sn" json:"feedetl_sn" form:"feedetl_sn"`
- Mtime int64 `gorm:"column:mtime" json:"mtime" form:"mtime"`
- InscpScpAmt float64 `gorm:"column:inscp_scp_amt" json:"inscp_scp_amt" form:"inscp_scp_amt"`
- DrtReimFlag string `gorm:"column:drt_reim_flag" json:"drt_reim_flag" form:"drt_reim_flag"`
- Ctime int64 `gorm:"column:ctime" json:"ctime" form:"ctime"`
- ListSpItemFlag string `gorm:"column:list_sp_item_flag" json:"list_sp_item_flag" form:"list_sp_item_flag"`
- ChldMedcFlag string `gorm:"column:chld_medc_flag" json:"chld_medc_flag" form:"chld_medc_flag"`
- LmtUsedFlag string `gorm:"column:lmt_used_flag" json:"lmt_used_flag" form:"lmt_used_flag"`
- ChrgitmLv string `gorm:"column:chrgitm_lv" json:"chrgitm_lv" form:"chrgitm_lv"`
- UserOrgId int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
- HisPatientId int64 `gorm:"column:his_patient_id" json:"his_patient_id" form:"his_patient_id"`
- OrderId int64 `gorm:"column:order_id" json:"order_id" form:"order_id"`
- ProjectId int64 `gorm:"column:project_id" json:"project_id" form:"project_id"`
- Type int64 `gorm:"column:type" json:"type" form:"type"`
- ItemId int64 `gorm:"column:item_id" json:"item_id" form:"item_id"`
- SettleType int64 `gorm:"column:settle_type" json:"settle_type" form:"settle_type"`
- HisPrescriptionProjectTen HisPrescriptionProjectTen `gorm:"ForeignKey:ID;AssociationForeignKey:ProjectId" json:"project"`
- HisDoctorAdviceInfoTen HisDoctorAdviceInfoTen `gorm:"ForeignKey:ID;AssociationForeignKey:AdviceId" json:"advices"`
- }
-
- func (VmHisOrderInfo9504) TableName() string {
- return "his_order_info"
- }
-
- type VmHisOrderInfo95042 struct {
- ID int64 `gorm:"column:id" json:"id" form:"id"`
- OrderNumber string `gorm:"column:order_number" json:"order_number" form:"order_number"`
- UploadDate int64 `gorm:"column:upload_date" json:"upload_date" form:"upload_date"`
- AdviceId int64 `gorm:"column:advice_id" json:"advice_id" form:"advice_id"`
- DetItemFeeSumamt float64 `gorm:"column:det_item_fee_sumamt" json:"det_item_fee_sumamt" form:"det_item_fee_sumamt"`
- Cnt float64 `gorm:"column:cnt" json:"cnt" form:"cnt"`
- Pric float64 `gorm:"column:pric" json:"pric" form:"pric"`
- PatientId int64 `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
- PricUplmtAmt float64 `gorm:"column:pric_uplmt_amt" json:"pric_uplmt_amt" form:"pric_uplmt_amt"`
- SelfpayProp float64 `gorm:"column:selfpay_prop" json:"selfpay_prop" form:"selfpay_prop"`
- FulamtOwnpayAmt float64 `gorm:"column:fulamt_ownpay_amt" json:"fulamt_ownpay_amt" form:"fulamt_ownpay_amt"`
- OverlmtAmt float64 `gorm:"column:overlmt_amt" json:"overlmt_amt" form:"overlmt_amt"`
- PreselfpayAmt float64 `gorm:"column:preselfpay_amt" json:"preselfpay_amt" form:"preselfpay_amt"`
- BasMednFlag string `gorm:"column:bas_medn_flag" json:"bas_medn_flag" form:"bas_medn_flag"`
- MedChrgitmType string `gorm:"column:med_chrgitm_type" json:"med_chrgitm_type" form:"med_chrgitm_type"`
- HiNegoDrugFlag string `gorm:"column:hi_nego_drug_flag" json:"hi_nego_drug_flag" form:"hi_nego_drug_flag"`
- Status int64 `gorm:"column:status" json:"status" form:"status"`
- Memo string `gorm:"column:memo" json:"memo" form:"memo"`
- FeedetlSn string `gorm:"column:feedetl_sn" json:"feedetl_sn" form:"feedetl_sn"`
- Mtime int64 `gorm:"column:mtime" json:"mtime" form:"mtime"`
- InscpScpAmt float64 `gorm:"column:inscp_scp_amt" json:"inscp_scp_amt" form:"inscp_scp_amt"`
- DrtReimFlag string `gorm:"column:drt_reim_flag" json:"drt_reim_flag" form:"drt_reim_flag"`
- Ctime int64 `gorm:"column:ctime" json:"ctime" form:"ctime"`
- ListSpItemFlag string `gorm:"column:list_sp_item_flag" json:"list_sp_item_flag" form:"list_sp_item_flag"`
- ChldMedcFlag string `gorm:"column:chld_medc_flag" json:"chld_medc_flag" form:"chld_medc_flag"`
- LmtUsedFlag string `gorm:"column:lmt_used_flag" json:"lmt_used_flag" form:"lmt_used_flag"`
- ChrgitmLv string `gorm:"column:chrgitm_lv" json:"chrgitm_lv" form:"chrgitm_lv"`
- UserOrgId int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
- HisPatientId int64 `gorm:"column:his_patient_id" json:"his_patient_id" form:"his_patient_id"`
- OrderId int64 `gorm:"column:order_id" json:"order_id" form:"order_id"`
- ProjectId int64 `gorm:"column:project_id" json:"project_id" form:"project_id"`
- Type int64 `gorm:"column:type" json:"type" form:"type"`
- ItemId int64 `gorm:"column:item_id" json:"item_id" form:"item_id"`
- SettleType int64 `gorm:"column:settle_type" json:"settle_type" form:"settle_type"`
- }
-
- func (VmHisOrderInfo95042) TableName() string {
- return "his_order_info"
- }
-
- func GetHisOrderDetail9504() (order []*HisOrder9504, err error) {
- err = readDb.Model(&HisOrder9504{}).Preload("Patients", "status = 1").Preload("VmHisOrderInfo9504", func(db *gorm.DB) *gorm.DB {
- return db.Where("status = 1").Preload("HisPrescriptionProjectTen", func(db *gorm.DB) *gorm.DB {
- return db.Where("status = 1").Preload("VMHisProject", "status = 1").Preload("VMGoodInfo", "status = 1")
- }).Preload("HisDoctorAdviceInfoTen", func(db *gorm.DB) *gorm.DB {
- return db.Where("status = 1").Preload("Drug", "status = 1")
- })
- }).Where("settle_accounts_date >= 1640966400 AND settle_accounts_date <= 1661875200 AND status = 1 AND order_status =2 AND user_org_id = 9504").Find(&order).Order("setl_time").Error
- return
- }
-
- func GetHisOrderDetail10188() (order []*HisOrder9504, err error) {
- err = readDb.Model(&HisOrder9504{}).Preload("Patients", "status = 1").Preload("VmHisOrderInfo9504", func(db *gorm.DB) *gorm.DB {
- return db.Where("status = 1").Preload("HisPrescriptionProjectTen", func(db *gorm.DB) *gorm.DB {
- return db.Where("status = 1").Preload("VMHisProject", "status = 1").Preload("VMGoodInfo", "status = 1")
- })
- }).Where("settle_accounts_date >= 1654012800 AND settle_accounts_date <= 1661875200 AND status = 1 AND order_status =2 AND user_org_id = 10188").Find(&order).Order("setl_time").Error
- return
- }
-
- //func GetHisOrderDetail10138() (order []*HisOrder9504, err error) {
- // err = readDb.Model(&HisOrder9504{}).Preload("Patients", "status = 1").Preload("VmHisOrderInfo9504", func(db *gorm.DB) *gorm.DB {
- // return db.Where("status = 1").Preload("HisPrescriptionProjectTen", func(db *gorm.DB) *gorm.DB {
- // return db.Where("status = 1").Preload("VMHisProject", "status = 1")
- // })
- // }).Where("settle_accounts_date >= 1640966400 AND settle_accounts_date <= 1648656000 AND status = 1 AND order_status =2 AND user_org_id = 10138").Find(&order).Order("setl_time").Error
- // return
- //}
-
- func GetHisOrderDetail10138() (order []*HisOrderTen, err error) {
- err = readDb.Model(&HisOrderTen{}).Preload("HisPrescriptionTen", func(db *gorm.DB) *gorm.DB {
- return db.Where("status = 1 AND order_status = 2").Preload("HisPrescriptionProjectTen", func(db *gorm.DB) *gorm.DB {
- return db.Where("status = 1").Preload("VMHisProject")
- })
- }).Where("setl_time >= '2024-07-01 00:00:00' AND setl_time <= '2024-09-30 23:00:00' AND status = 1 AND order_status =2 AND user_org_id = 10278").Find(&order).Error
- return
- }
-
- func GetHisOrderDetail10265() (order_infos []*VmHisOrderInfo9504, err error) {
- err = readDb.Model(&VmHisOrderInfo9504{}).Preload("HisPrescriptionProjectTen", func(db *gorm.DB) *gorm.DB {
- return db.Preload("VMHisProject").Preload("VMGoodInfo", "status = 1")
- }).Preload("HisDoctorAdviceInfoTen", func(db *gorm.DB) *gorm.DB {
- return db.Where("status = 1").Preload("Drug", "status = 1")
- }).Where(" status = 1 AND user_org_id = 10265 AND order_number = '2022090814370516482'").Find(&order_infos).Error
- return
- }
-
- func GetHisOrder10265() (order_infos []*VmHisOrderInfo9504, err error) {
- err = readDb.Model(&VmHisOrderInfo95042{}).Where(" status = 1 AND user_org_id = 10265 AND order_number = '2023031016334716192' AND project_id > 0").Find(&order_infos).Error
- return
- }
-
- func GetHisOrder10265two() (order_infos []*VmHisOrderInfo9504, err error) {
- err = readDb.Model(&VmHisOrderInfo95042{}).Where(" status = 1 AND user_org_id = 10265 AND order_number = '2023031016334716192'").Find(&order_infos).Error
- return
- }
-
- func SaveOrderInfo(info *VmHisOrderInfo9504) {
- writeDb.Save(&info)
- }
-
- func GetHisOrderDetail10106(start_time int64, end_time int64) (order []*HisOrder9504, err error) {
- err = readDb.Model(&HisOrder9504{}).Preload("Patients", "status = 1").Preload("VmHisOrderInfo9504", func(db *gorm.DB) *gorm.DB {
- return db.Where("status = 1").Preload("HisPrescriptionProjectTen", func(db *gorm.DB) *gorm.DB {
- return db.Where("status = 1").Preload("VMHisProject").Preload("VMGoodInfo")
- }).Preload("HisDoctorAdviceInfoTen", func(db *gorm.DB) *gorm.DB {
- return db.Where("status = 1").Preload("Drug")
- })
- }).Where("settle_accounts_date >= ? AND settle_accounts_date <= ? AND status = 1 AND order_status =2 AND user_org_id = 10265", start_time, end_time).Find(&order).Order("setl_time").Error
- return
- }
-
- func GetHisOrderDetail10318(start_time int64, end_time int64) (order []*HisOrder9504, err error) {
- err = readDb.Model(&HisOrder9504{}).Preload("Patients", "status = 1").Preload("VmHisOrderInfo9504", func(db *gorm.DB) *gorm.DB {
- return db.Where("status = 1").Preload("HisPrescriptionProjectTen", func(db *gorm.DB) *gorm.DB {
- return db.Where("status = 1").Preload("VMHisProject").Preload("VMGoodInfo")
- }).Preload("HisDoctorAdviceInfoTen", func(db *gorm.DB) *gorm.DB {
- return db.Where("status = 1").Preload("Drug")
- })
- }).Where("settle_accounts_date >= ? AND settle_accounts_date <= ? AND status = 1 AND order_status =2 AND user_org_id = 10318", start_time, end_time).Find(&order).Order("setl_time").Error
- return
- }
-
- func GetLongSolution() {
- records, _ := GetAllSchedules()
- fmt.Println(records)
- for _, item := range records {
- var DialysisMachineName string
- //1.透析器 2.灌流器 3.透析器/灌流器
- so, _ := GetDialysisSolutionTwo(item.UserOrgId, item.PatientId, item.ModeId)
- filedRecordOne, _ := FindFiledBy(item.UserOrgId, "透析器")
- filedRecordTwo, _ := FindFiledBy(item.UserOrgId, "灌流器")
- filedRecordThree, _ := FindFiledBy(item.UserOrgId, "透析器/灌流器")
- if filedRecordOne.IsShow == 1 {
- DialysisMachineName = so.DialysisDialyszers
- }
- if filedRecordThree.IsShow == 1 {
- if len(DialysisMachineName) > 0 {
- DialysisMachineName = DialysisMachineName + "," + so.DialyzerPerfusionApparatus
-
- } else {
- DialysisMachineName = so.DialyzerPerfusionApparatus
-
- }
- }
- if filedRecordTwo.IsShow == 1 {
- if len(DialysisMachineName) > 0 {
- DialysisMachineName = DialysisMachineName + "," + so.DialysisIrrigation
-
- } else {
- DialysisMachineName = so.DialysisIrrigation
-
- }
- }
- item.DialysisMachineName = DialysisMachineName
- UpdateSch(item)
- }
- }
-
- func GetAllSchMode() (modes []*models.PatientScheduleTemplateMode, getModesErr error) {
- getModesErr = readDb.Model(&models.PatientScheduleTemplateMode{}).Where("mode <> 0 AND status = 1 ").Find(&modes).Error
- return
- }
-
- type DialysisSolutionTwo struct {
- ID int64 `gorm:"column:id" json:"id" form:"id"`
- UserOrgId int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
- }
-
- func (DialysisSolutionTwo) TableName() string {
- return "xt_dialysis_solution"
- }
-
- type Schedule struct {
- ID int64 `gorm:"column:id" json:"id" form:"id"`
- UserOrgId int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
- PatientId int64 `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
- Status int64 `gorm:"column:status" json:"status" form:"status"`
- ScheduleDate int64 `gorm:"column:schedule_date" json:"schedule_date" form:"schedule_date"`
- ModeId int64 `gorm:"column:mode_id" json:"mode_id" form:"mode_id"`
- DialysisMachineName string `gorm:"column:dialysis_machine_name" json:"dialysis_machine_name" form:"dialysis_machine_name"`
- }
-
- func (Schedule) TableName() string {
- return "xt_schedule"
- }
-
- func GetAllSchedules() ([]Schedule, error) {
- var record []Schedule
-
- err := readDb.Model(&Schedule{}).Where("user_org_id = 10290 AND status = 1 AND schedule_date > 1672934400").Find(&record).Error
- if err != nil {
- if err == gorm.ErrRecordNotFound {
- return nil, nil
- } else {
- return nil, err
- }
- }
- return record, nil
- }
-
- func FindFiledBy(org_id int64, name string) (filedConfig models.FiledConfig, err error) {
- err = readDb.Model(&models.FiledConfig{}).Where("org_id =? AND module = 1 AND filed_name_cn= ?", org_id, name).First(&filedConfig).Error
- return
- }
-
- // 透析方案
- func GetDialysisSolutionTwo(orgID int64, patientID int64, mode_id int64) (models.DialysisSolution, error) {
- var record models.DialysisSolution
- err := readDb.Model(&models.DialysisSolution{}).Where("patient_id = ? and user_org_id = ? and status = 1 AND mode_id = ?", patientID, orgID, mode_id).Last(&record).Error
- return record, err
- }
-
- func UpdateSch(sch Schedule) (err error) {
- err = writeDb.Model(&Schedule{}).Where("status=1 AND id = ?", sch.ID).Updates(map[string]interface{}{"dialysis_machine_name": sch.DialysisMachineName}).Error
- return
- }
-
- func SaveSch(sch *models.Schedule) (err error) {
- err = writeDb.Save(&sch).Error
- return
- }
-
- func SaveSchTwo(sch models.Schedule, sch_two models.Schedule) (err error) {
- //err = writeDb.Save(&sch).Error
- err = writeDb.Model(&Schedule{}).Where("status=1 AND id = ?", sch.ID).Updates(map[string]interface{}{"status": 0}).Error
- err = writeDb.Model(&Schedule{}).Where("status=1 AND id = ?", sch_two.ID).Updates(map[string]interface{}{"status": 0}).Error
-
- return
- }
-
- func GetDrugstwo(orgId int64) (drugs []*XtBaseDrugtwo, err error) {
- err = readDb.Model(&XtBaseDrugtwo{}).Where("org_id = ? AND status = 1", orgId).Find(&drugs).Error
- return
- }
-
- func GetGoodInfotwo(orgId int64) (drugs []*XtGoodInformation, err error) {
- err = readDb.Model(&XtGoodInformation{}).Where("org_id = ? AND status = 1", orgId).Find(&drugs).Error
- return
- }
-
- func Getprojecttwo(orgId int64) (drugs []*XtHisProject, err error) {
- err = readDb.Model(&XtHisProject{}).Where("user_org_id = ? AND status = 1", orgId).Find(&drugs).Error
- return
- }
-
- func SaveDrugtwo(drugs *XtBaseDrugtwo) error {
- err := XTWriteDB().Save(&drugs).Error
- return err
- }
-
- func SaveGoodtwo(drugs *XtGoodInformation) error {
- err := XTWriteDB().Save(&drugs).Error
- return err
- }
-
- func SaveProject(drugs *XtHisProject) error {
- err := XTWriteDB().Save(&drugs).Error
- return err
- }
-
- type XtGoodInformation struct {
- ID int64 `gorm:"column:id" json:"id" form:"id"`
- GoodCode string `gorm:"column:good_code" json:"good_code" form:"good_code"`
- SpecificationName string `gorm:"column:specification_name" json:"specification_name" form:"specification_name"`
- GoodTypeId int64 `gorm:"column:good_type_id" json:"good_type_id" form:"good_type_id"`
- GoodUnit int64 `gorm:"column:good_unit" json:"good_unit" form:"good_unit"`
- BuyPrice float64 `gorm:"column:buy_price" json:"buy_price" form:"buy_price"`
- SellPrice float64 `gorm:"column:sell_price" json:"sell_price" form:"sell_price"`
- Remark string `gorm:"column:remark" json:"remark" form:"remark"`
- Ctime int64 `gorm:"column:ctime" json:"ctime" form:"ctime"`
- Mtime int64 `gorm:"column:mtime" json:"mtime" form:"mtime"`
- Manufacturer int64 `gorm:"column:manufacturer" json:"manufacturer" form:"manufacturer"`
- Dealer int64 `gorm:"column:dealer" json:"dealer" form:"dealer"`
- ExpiryDateWarnDayCount int64 `gorm:"column:expiry_date_warn_day_count" json:"expiry_date_warn_day_count" form:"expiry_date_warn_day_count"`
- StockWarnCount int64 `gorm:"column:stock_warn_count" json:"stock_warn_count" form:"stock_warn_count"`
- IsReuse int64 `gorm:"column:is_reuse" json:"is_reuse" form:"is_reuse"`
- Status int64 `gorm:"column:status" json:"status" form:"status"`
- FilmArea string `gorm:"column:film_area" json:"film_area" form:"film_area"`
- IsUse int64 `gorm:"column:is_use" json:"is_use" form:"is_use"`
- FilmMaterialQuality string `gorm:"column:film_material_quality" json:"film_material_quality" form:"film_material_quality"`
- OrgId int64 `gorm:"column:org_id" json:"org_id" form:"org_id"`
- Modifier int64 `gorm:"column:modifier" json:"modifier" form:"modifier"`
- Creater int64 `gorm:"column:creater" json:"creater" form:"creater"`
- GoodName string `gorm:"column:good_name" json:"good_name" form:"good_name"`
- Pinyin string `gorm:"column:pinyin" json:"pinyin" form:"pinyin"`
- Wubi string `gorm:"column:wubi" json:"wubi" form:"wubi"`
- GoodKind int64 `gorm:"column:good_kind" json:"good_kind" form:"good_kind"`
- MedicalInsuranceLevel int64 `gorm:"column:medical_insurance_level" json:"medical_insurance_level" form:"medical_insurance_level"`
- RetailPrice float64 `gorm:"column:retail_price" json:"retail_price" form:"retail_price"`
- MedicalInsuranceNumber string `gorm:"column:medical_insurance_number" json:"medical_insurance_number" form:"medical_insurance_number"`
- IsSpecialDiseases int64 `gorm:"column:is_special_diseases" json:"is_special_diseases" form:"is_special_diseases"`
- IsRecord int64 `gorm:"column:is_record" json:"is_record" form:"is_record"`
- StatisticsCategory int64 `gorm:"column:statistics_category" json:"statistics_category" form:"statistics_category"`
- GoodStatus string `gorm:"column:good_status" json:"good_status" form:"good_status"`
- DefaultCount int64 `gorm:"column:default_count" json:"default_count" form:"default_count"`
- IsDefault int64 `gorm:"column:is_default" json:"is_default" form:"is_default"`
- IsChargeUse int64 `gorm:"column:is_charge_use" json:"is_charge_use" form:"is_charge_use"`
- IsChargePredict int64 `gorm:"column:is_charge_predict" json:"is_charge_predict" form:"is_charge_predict"`
- IsStatisticsWork int64 `gorm:"column:is_statistics_work" json:"is_statistics_work" form:"is_statistics_work"`
- Sign int64 `gorm:"column:sign" json:"sign" form:"sign"`
- Sort int64 `gorm:"column:sort" json:"sort" form:"sort"`
- IsDoctorUse int64 `gorm:"column:is_doctor_use" json:"is_doctor_use" form:"is_doctor_use"`
- Agent string `gorm:"column:agent" json:"agent" form:"agent"`
- GoodNumber string `gorm:"column:good_number" json:"good_number" form:"good_number"`
- CommdityCode string `gorm:"column:commdity_code" json:"commdity_code" form:"commdity_code"`
- SocialSecurityDirectoryCode string `gorm:"column:social_security_directory_code" json:"social_security_directory_code" form:"social_security_directory_code"`
- ProductionType string `gorm:"column:production_type" json:"production_type" form:"production_type"`
- SpecialMedical string `gorm:"column:special_medical" json:"special_medical" form:"special_medical"`
- IsMark int64 `gorm:"column:is_mark" json:"is_mark" form:"is_mark"`
- Total float64 `gorm:"column:total" json:"total" form:"total"`
- MinNumber int64 `gorm:"column:min_number" json:"min_number" form:"min_number"`
- PackingUnit string `gorm:"column:packing_unit" json:"packing_unit" form:"packing_unit"`
- PackingPrice float64 `gorm:"column:packing_price" json:"packing_price" form:"packing_price"`
- DefaultCountUnit string `gorm:"column:default_count_unit" json:"default_count_unit" form:"default_count_unit"`
- MinUnit string `gorm:"column:min_unit" json:"min_unit" form:"min_unit"`
- RegisterNumber string `gorm:"column:register_number" json:"register_number" form:"register_number"`
- ProvincesCode string `gorm:"column:provinces_code" json:"provinces_code" form:"provinces_code"`
- IsUser int64 `gorm:"column:is_user" json:"is_user" form:"is_user"`
- Number string `gorm:"column:number" json:"number" form:"number"`
- IsWarehouse int64 `gorm:"column:is_warehouse" json:"is_warehouse" form:"is_warehouse"`
- BatchRetaiPrice float64 `gorm:"column:batch_retai_price" json:"batch_retai_price" form:"batch_retai_price"`
- SumCount int64 `gorm:"column:sum_count" json:"sum_count" form:"sum_count"`
- SumInCount int64 `gorm:"column:sum_in_count" json:"sum_in_count" form:"sum_in_count"`
- TotalCount int64 `gorm:"column:total_count" json:"total_count" form:"total_count"`
- SumOutCount int64 `gorm:"column:sum_out_count" json:"sum_out_count" form:"sum_out_count"`
- SumCancelCount int64 `gorm:"column:sum_cancel_count" json:"sum_cancel_count" form:"sum_cancel_count"`
- IsPrint int64 `gorm:"column:is_print" json:"is_print" form:"is_print"`
- FirstLetter string `gorm:"column:first_letter" json:"first_letter" form:"first_letter"`
- ZuobiaoId string `gorm:"column:zuobiao_id" json:"zuobiao_id" form:"zuobiao_id"`
- Bck01b string `gorm:"column:bck01b" json:"bck01b" form:"bck01b"`
- Bby01 string `gorm:"column:bby01" json:"bby01" form:"bby01"`
- }
-
- func (XtGoodInformation) TableName() string {
- return "xt_good_information"
- }
-
- type XtBaseDrugtwo struct {
- ID int64 `gorm:"column:id" json:"id" form:"id"`
- DrugName string `gorm:"column:drug_name" json:"drug_name" form:"drug_name"`
- Pinyin string `gorm:"column:pinyin" json:"pinyin" form:"pinyin"`
- Wubi string `gorm:"column:wubi" json:"wubi" form:"wubi"`
- DrugAlias string `gorm:"column:drug_alias" json:"drug_alias" form:"drug_alias"`
- DrugAliasPinyin string `gorm:"column:drug_alias_pinyin" json:"drug_alias_pinyin" form:"drug_alias_pinyin"`
- DrugAliasWubi string `gorm:"column:drug_alias_wubi" json:"drug_alias_wubi" form:"drug_alias_wubi"`
- DrugCategory int64 `gorm:"column:drug_category" json:"drug_category" form:"drug_category"`
- DrugSpec string `gorm:"column:drug_spec" json:"drug_spec" form:"drug_spec"`
- DrugType int64 `gorm:"column:drug_type" json:"drug_type" form:"drug_type"`
- DrugStockLimit string `gorm:"column:drug_stock_limit" json:"drug_stock_limit" form:"drug_stock_limit"`
- DrugOriginPlace string `gorm:"column:drug_origin_place" json:"drug_origin_place" form:"drug_origin_place"`
- DrugDosageForm int64 `gorm:"column:drug_dosage_form" json:"drug_dosage_form" form:"drug_dosage_form"`
- MedicalInsuranceLevel int64 `gorm:"column:medical_insurance_level" json:"medical_insurance_level" form:"medical_insurance_level"`
- MaxUnit string `gorm:"column:max_unit" json:"max_unit" form:"max_unit"`
- MinUnit string `gorm:"column:min_unit" json:"min_unit" form:"min_unit"`
- UnitMatrixing string `gorm:"column:unit_matrixing" json:"unit_matrixing" form:"unit_matrixing"`
- RetailPrice float64 `gorm:"column:retail_price" json:"retail_price" form:"retail_price"`
- LastPrice float64 `gorm:"column:last_price" json:"last_price" form:"last_price"`
- DrugControl int64 `gorm:"column:drug_control" json:"drug_control" form:"drug_control"`
- Number string `gorm:"column:number" json:"number" form:"number"`
- DrugClassify string `gorm:"column:drug_classify" json:"drug_classify" form:"drug_classify"`
- DrugDose float64 `gorm:"column:drug_dose" json:"drug_dose" form:"drug_dose"`
- DrugDoseUnit int64 `gorm:"column:drug_dose_unit" json:"drug_dose_unit" form:"drug_dose_unit"`
- MedicalInsuranceNumber string `gorm:"column:medical_insurance_number" json:"medical_insurance_number" form:"medical_insurance_number"`
- Manufacturer int64 `gorm:"column:manufacturer" json:"manufacturer" form:"manufacturer"`
- PharmacologyCategory int64 `gorm:"column:pharmacology_category" json:"pharmacology_category" form:"pharmacology_category"`
- StatisticsCategory int64 `gorm:"column:statistics_category" json:"statistics_category" form:"statistics_category"`
- Code string `gorm:"column:code" json:"code" form:"code"`
- IsSpecialDiseases int64 `gorm:"column:is_special_diseases" json:"is_special_diseases" form:"is_special_diseases"`
- IsRecord int64 `gorm:"column:is_record" json:"is_record" form:"is_record"`
- Agent string `gorm:"column:agent" json:"agent" form:"agent"`
- DrugStatus string `gorm:"column:drug_status" json:"drug_status" form:"drug_status"`
- LimitRemark string `gorm:"column:limit_remark" json:"limit_remark" form:"limit_remark"`
- DeliveryWay string `gorm:"column:delivery_way" json:"delivery_way" form:"delivery_way"`
- ExecutionFrequency string `gorm:"column:execution_frequency" json:"execution_frequency" form:"execution_frequency"`
- SingleDose float64 `gorm:"column:single_dose" json:"single_dose" form:"single_dose"`
- PrescribingNumber float64 `gorm:"column:prescribing_number" json:"prescribing_number" form:"prescribing_number"`
- Label int64 `gorm:"column:label" json:"label" form:"label"`
- Sort int64 `gorm:"column:sort" json:"sort" form:"sort"`
- IsUseDoctorAdvice int64 `gorm:"column:is_use_doctor_advice" json:"is_use_doctor_advice" form:"is_use_doctor_advice"`
- IsDefault int64 `gorm:"column:is_default" json:"is_default" form:"is_default"`
- IsChargePredict int64 `gorm:"column:is_charge_predict" json:"is_charge_predict" form:"is_charge_predict"`
- IsStatisticsWork int64 `gorm:"column:is_statistics_work" json:"is_statistics_work" form:"is_statistics_work"`
- IsChargeUse int64 `gorm:"column:is_charge_use" json:"is_charge_use" form:"is_charge_use"`
- Status int64 `gorm:"column:status" json:"status" form:"status"`
- Ctime int64 `gorm:"column:ctime" json:"ctime" form:"ctime"`
- Mtime int64 `gorm:"column:mtime" json:"mtime" form:"mtime"`
- OrgId int64 `gorm:"column:org_id" json:"org_id" form:"org_id"`
- DrugCode string `gorm:"column:drug_code" json:"drug_code" form:"drug_code"`
- Dealer int64 `gorm:"column:dealer" json:"dealer" form:"dealer"`
- DoseCode string `gorm:"column:dose_code" json:"dose_code" form:"dose_code"`
- RecordDate int64 `gorm:"column:record_date" json:"record_date" form:"record_date"`
- DrugRemark string `gorm:"column:drug_remark" json:"drug_remark" form:"drug_remark"`
- SocialSecurityDirectoryCode string `gorm:"column:social_security_directory_code" json:"social_security_directory_code" form:"social_security_directory_code"`
- IsMark int64 `gorm:"column:is_mark" json:"is_mark" form:"is_mark"`
- PrescriptionMark int64 `gorm:"column:prescription_mark" json:"prescription_mark" form:"prescription_mark"`
- HospApprFlag int64 `gorm:"column:hosp_appr_flag" json:"hosp_appr_flag" form:"hosp_appr_flag"`
- LmtUsedFlag int64 `gorm:"column:lmt_used_flag" json:"lmt_used_flag" form:"lmt_used_flag"`
- Total float64 `gorm:"column:total" json:"total" form:"total"`
- PrescribingNumberUnit string `gorm:"column:prescribing_number_unit" json:"prescribing_number_unit" form:"prescribing_number_unit"`
- MinNumber int64 `gorm:"column:min_number" json:"min_number" form:"min_number"`
- Dose string `gorm:"column:dose" json:"dose" form:"dose"`
- DoseUnit string `gorm:"column:dose_unit" json:"dose_unit" form:"dose_unit"`
- DrugDay string `gorm:"column:drug_day" json:"drug_day" form:"drug_day"`
- MinPrice float64 `gorm:"column:min_price" json:"min_price" form:"min_price"`
- ProvincesCode string `gorm:"column:provinces_code" json:"provinces_code" form:"provinces_code"`
- IsUser int64 `gorm:"column:is_user" json:"is_user" form:"is_user"`
- SumCount int64 `gorm:"column:sum_count" json:"sum_count" form:"sum_count"`
- BatchRetaiPrice float64 `gorm:"column:batch_retai_price" json:"batch_retai_price" form:"batch_retai_price"`
- SumInCount int64 `gorm:"column:sum_in_count" json:"sum_in_count" form:"sum_in_count"`
- IsPharmacy int64 `gorm:"column:is_pharmacy" json:"is_pharmacy" form:"is_pharmacy"`
- TotalCount int64 `gorm:"column:total_count" json:"total_count" form:"total_count"`
- DrugStockLimitCount int64 `gorm:"column:drug_stock_limit_count" json:"drug_stock_limit_count" form:"drug_stock_limit_count"`
- SumOutCount int64 `gorm:"column:sum_out_count" json:"sum_out_count" form:"sum_out_count"`
- SumCancelCount int64 `gorm:"column:sum_cancel_count" json:"sum_cancel_count" form:"sum_cancel_count"`
- FirstLetter string `gorm:"column:first_letter" json:"first_letter" form:"first_letter"`
- ZuobiaoId string `gorm:"column:zuobiao_id" json:"zuobiao_id" form:"zuobiao_id"`
- Bby01 string `gorm:"column:bby01" json:"bby01" form:"bby01"`
- Bck01b string `gorm:"column:bck01b" json:"bck01b" form:"bck01b"`
- IsZeroFlag int64 `gorm:"column:is_zero_flag" json:"is_zero_flag" form:"is_zero_flag"`
- }
-
- func (XtBaseDrugtwo) TableName() string {
- return "xt_base_drug"
- }
-
- type XtHisProject struct {
- ID int64 `gorm:"column:id" json:"id" form:"id"`
- ProjectName string `gorm:"column:project_name" json:"project_name" form:"project_name"`
- Pinyin string `gorm:"column:pinyin" json:"pinyin" form:"pinyin"`
- Wubi string `gorm:"column:wubi" json:"wubi" form:"wubi"`
- Price float64 `gorm:"column:price" json:"price" form:"price"`
- Unit string `gorm:"column:unit" json:"unit" form:"unit"`
- CostClassify int64 `gorm:"column:cost_classify" json:"cost_classify" form:"cost_classify"`
- ExecutiveSection int64 `gorm:"column:executive_section" json:"executive_section" form:"executive_section"`
- MedicalCoverage int64 `gorm:"column:medical_coverage" json:"medical_coverage" form:"medical_coverage"`
- StatisticalClassification int64 `gorm:"column:statistical_classification" json:"statistical_classification" form:"statistical_classification"`
- DiseaseDirectory int64 `gorm:"column:disease_directory" json:"disease_directory" form:"disease_directory"`
- IsRecord int64 `gorm:"column:is_record" json:"is_record" form:"is_record"`
- MedicalCode string `gorm:"column:medical_code" json:"medical_code" form:"medical_code"`
- TubeColor int64 `gorm:"column:tube_color" json:"tube_color" form:"tube_color"`
- MedicalStatus int64 `gorm:"column:medical_status" json:"medical_status" form:"medical_status"`
- Remark string `gorm:"column:remark" json:"remark" form:"remark"`
- Sign int64 `gorm:"column:sign" json:"sign" form:"sign"`
- DefaultNumber string `gorm:"column:default_number" json:"default_number" form:"default_number"`
- IsDefault int64 `gorm:"column:is_default" json:"is_default" form:"is_default"`
- IsCharge int64 `gorm:"column:is_charge" json:"is_charge" form:"is_charge"`
- IsEstimate int64 `gorm:"column:is_estimate" json:"is_estimate" form:"is_estimate"`
- IsWorkload int64 `gorm:"column:is_workload" json:"is_workload" form:"is_workload"`
- Sort string `gorm:"column:sort" json:"sort" form:"sort"`
- DoctorAdvice int64 `gorm:"column:doctor_advice" json:"doctor_advice" form:"doctor_advice"`
- UserOrgId int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
- Status int64 `gorm:"column:status" json:"status" form:"status"`
- CreatedTime int64 `gorm:"column:created_time" json:"created_time" form:"created_time"`
- UpdatedTime int64 `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
- SingleDose string `gorm:"column:single_dose" json:"single_dose" form:"single_dose"`
- ExecutionFrequency string `gorm:"column:execution_frequency" json:"execution_frequency" form:"execution_frequency"`
- DeliveryWay string `gorm:"column:delivery_way" json:"delivery_way" form:"delivery_way"`
- NumberDays string `gorm:"column:number_days" json:"number_days" form:"number_days"`
- Total string `gorm:"column:total" json:"total" form:"total"`
- IsMark int64 `gorm:"column:is_mark" json:"is_mark" form:"is_mark"`
- SpecailProject int64 `gorm:"column:specail_project" json:"specail_project" form:"specail_project"`
- SocialSecurityDirectoryCode string `gorm:"column:social_security_directory_code" json:"social_security_directory_code" form:"social_security_directory_code"`
- RecordDate int64 `gorm:"column:record_date" json:"record_date" form:"record_date"`
- Category int64 `gorm:"column:category" json:"category" form:"category"`
- IsPrint int64 `gorm:"column:is_print" json:"is_print" form:"is_print"`
- FirstLetter string `gorm:"column:first_letter" json:"first_letter" form:"first_letter"`
- ZuobiaoId string `gorm:"column:zuobiao_id" json:"zuobiao_id" form:"zuobiao_id"`
- Bck01b string `gorm:"column:bck01b" json:"bck01b" form:"bck01b"`
- Bby01 string `gorm:"column:bby01" json:"bby01" form:"bby01"`
- }
-
- func (XtHisProject) TableName() string {
- return "xt_his_project"
- }
-
- func Saved(drug models.BaseDrugLib) {
- writeDb.Create(&drug)
- }
-
- func Savegd(good GoodInfotwo) {
- writeDb.Create(&good)
- }
-
- type GoodInfotwo struct {
- ID int64 `gorm:"column:id" json:"id" form:"id"`
- GoodCode string `gorm:"column:good_code" json:"good_code" form:"good_code"`
- SpecificationName string `gorm:"column:specification_name" json:"specification_name" form:"specification_name"`
- GoodTypeId int64 `gorm:"column:good_type_id" json:"good_type_id" form:"good_type_id"`
- GoodUnit int64 `gorm:"column:good_unit" json:"good_unit" form:"good_unit"`
- BuyPrice float64 `gorm:"column:buy_price" json:"buy_price" form:"buy_price"`
- SellPrice float64 `gorm:"column:sell_price" json:"sell_price" form:"sell_price"`
- Remark string `gorm:"column:remark" json:"remark" form:"remark"`
- Ctime int64 `gorm:"column:ctime" json:"ctime" form:"ctime"`
- Mtime int64 `gorm:"column:mtime" json:"mtime" form:"mtime"`
- Manufacturer int64 `gorm:"column:manufacturer" json:"manufacturer" form:"manufacturer"`
- Dealer int64 `gorm:"column:dealer" json:"dealer" form:"dealer"`
- ExpiryDateWarnDayCount int64 `gorm:"column:expiry_date_warn_day_count" json:"expiry_date_warn_day_count" form:"expiry_date_warn_day_count"`
- StockWarnCount int64 `gorm:"column:stock_warn_count" json:"stock_warn_count" form:"stock_warn_count"`
- IsReuse int64 `gorm:"column:is_reuse" json:"is_reuse" form:"is_reuse"`
- Status int64 `gorm:"column:status" json:"status" form:"status"`
- FilmArea string `gorm:"column:film_area" json:"film_area" form:"film_area"`
- IsUse int64 `gorm:"column:is_use" json:"is_use" form:"is_use"`
- FilmMaterialQuality string `gorm:"column:film_material_quality" json:"film_material_quality" form:"film_material_quality"`
- OrgId int64 `gorm:"column:org_id" json:"org_id" form:"org_id"`
- Modifier int64 `gorm:"column:modifier" json:"modifier" form:"modifier"`
- Creater int64 `gorm:"column:creater" json:"creater" form:"creater"`
- GoodName string `gorm:"column:good_name" json:"good_name" form:"good_name"`
- Pinyin string `gorm:"column:pinyin" json:"pinyin" form:"pinyin"`
- Wubi string `gorm:"column:wubi" json:"wubi" form:"wubi"`
- GoodKind int64 `gorm:"column:good_kind" json:"good_kind" form:"good_kind"`
- MedicalInsuranceLevel int64 `gorm:"column:medical_insurance_level" json:"medical_insurance_level" form:"medical_insurance_level"`
- RetailPrice float64 `gorm:"column:retail_price" json:"retail_price" form:"retail_price"`
- MedicalInsuranceNumber string `gorm:"column:medical_insurance_number" json:"medical_insurance_number" form:"medical_insurance_number"`
- ProvincesCode string `gorm:"column:provinces_code" json:"provinces_code" form:"provinces_code"`
- FirstLetter string `gorm:"column:first_letter" json:"first_letter" form:"first_letter"`
- IsSpecialDiseases int64 `gorm:"column:is_special_diseases" json:"is_special_diseases" form:"is_special_diseases"`
- IsRecord int64 `gorm:"column:is_record" json:"is_record" form:"is_record"`
- StatisticsCategory int64 `gorm:"column:statistics_category" json:"statistics_category" form:"statistics_category"`
- GoodStatus string `gorm:"column:good_status" json:"good_status" form:"good_status"`
- DefaultCount int64 `gorm:"column:default_count" json:"default_count" form:"default_count"`
- Sign int64 `gorm:"column:sign" json:"sign" form:"sign"`
- IsDefault int64 `gorm:"column:is_default" json:"is_default" form:"is_default"`
- IsChargeUse int64 `gorm:"column:is_charge_use" json:"is_charge_use" form:"is_charge_use"`
- IsChargePredict int64 `gorm:"column:is_charge_predict" json:"is_charge_predict" form:"is_charge_predict"`
- IsStatisticsWork int64 `gorm:"column:is_statistics_work" json:"is_statistics_work" form:"is_statistics_work"`
- Sort int64 `gorm:"column:sort" json:"sort" form:"sort"`
- IsDoctorUse int64 `gorm:"column:is_doctor_use" json:"is_doctor_use" form:"is_doctor_use"`
- Agent string `gorm:"column:agent" json:"agent" form:"agent"`
- GoodNumber string `gorm:"column:good_number" json:"good_number" form:"good_number"`
- CommdityCode string `gorm:"column:commdity_code" json:"commdity_code" form:"commdity_code"`
- SocialSecurityDirectoryCode string `gorm:"column:social_security_directory_code" json:"social_security_directory_code" form:"social_security_directory_code"`
- ProductionType string `gorm:"column:production_type" json:"production_type" form:"production_type"`
- SpecialMedical string `gorm:"column:special_medical" json:"special_medical" form:"special_medical"`
- IsMark int64 `gorm:"column:is_mark" json:"is_mark" form:"is_mark"`
- MinNumber int64 `gorm:"column:min_number" json:"min_number" form:"min_number"`
- PackingUnit string `gorm:"column:packing_unit" json:"packing_unit" form:"packing_unit"`
- PackingPrice float64 `gorm:"column:packing_price" json:"packing_price" form:"packing_price"`
- DefaultCountUnit string `gorm:"column:default_count_unit" json:"default_count_unit" form:"default_count_unit"`
- MinUnit string `gorm:"column:min_unit" json:"min_unit" form:"min_unit"`
- Total float64 `gorm:"column:total" json:"total" form:"total"`
- RegisterNumber string `gorm:"column:register_number" json:"register_number" form:"register_number"`
- IsUser int64 `gorm:"column:is_user" json:"is_user" form:"is_user"`
- Number string `gorm:"column:number" json:"number" form:"number"`
- IsWarehouse int64 `gorm:"column:is_warehouse" json:"is_warehouse" form:"is_warehouse"`
- SumCount int64 `gorm:"column:sum_count" json:"sum_count" form:"sum_count"`
- BatchRetaiPrice float64 `gorm:"column:batch_retai_price" json:"batch_retai_price" form:"batch_retai_price"`
- SumInCount int64 `gorm:"column:sum_in_count" json:"sum_in_count" form:"sum_in_count"`
- Bbx01 int64 `gorm:"column:bbx01" json:"bbx01" form:"bbx01"`
- Bby01 int64 `gorm:"column:bby01" json:"bby01" form:"bby01"`
- }
-
- func (GoodInfotwo) TableName() string {
- return "xt_good_information"
- }
-
- func GetHisPatient4444555() (paitent []*models.HisPatient, err error) {
-
- err = XTReadDB().Model(&paitent).Where("user_org_id = 10485 and status = 1 AND record_date >= 1704038400").Find(&paitent).Error
- return paitent, err
- }
-
- func UpDateNumber(id int64, number string) {
- writeDb.Model(&models.GoodInfo{}).Where("id = ?", id).Updates(map[string]interface{}{"number": number})
- }
-
- func GetOrderinfo(org_id int64) (info []models.HisOrderInfo, err error) {
- err = readDb.Model(&models.HisOrderInfo{}).Where("user_org_id = ? and advice_id = 0 and project_id = 0 and ctime >= 1726675200", org_id).Find(&info).Error
- for _, in := range info {
- var doc models.HisDoctorAdviceInfo
- readDb.Model(&models.HisDoctorAdviceInfo{}).Where("user_org_id = ? and feedetl_sn = ? and status = 1 and advice_date >= 1726675200", org_id, in.FeedetlSn).First(&doc)
- writeDb.Model(&models.HisOrderInfo{}).Where("user_org_id = ? and feedetl_sn = ? and advice_id = 0 and project_id = 0 and ctime >= 1726675200", org_id, doc.FeedetlSn).Updates(map[string]interface{}{"advice_id": doc.ID})
- }
- return
- }
-
- type Result22 struct {
- InspectDate string
- Inspect int64
- PatientID int64
- ItemID1 int64
- ItemID2 int64
- ItemName1 string
- ItemName2 string
- InspectValue1 string
- InspectValue2 string
- WeightAfter float64
- ActualUltrafiltration float64
- ActualTreatmentHour int64
- ActualTreatmentHours float64
- WeightBefore float64
- }
-
- func Aaa() {
- var inspections []Result22
- readDb.Raw(`
- SELECT
- DATE(FROM_UNIXTIME(xts.inspect_date)) AS inspect_date,
- xts.inspect,
- xts.patient_id,
- xts.item_id AS item_id_1,
- b.item_id AS item_id_2,
- xts.item_name AS item_name_1,
- b.item_name AS item_name_2,
- xts.inspect_value AS inspect_value1,
- b.inspect_value AS inspect_value2,
- b.weight_after,
- b.actual_ultrafiltration,
- b.actual_treatment_hour,
- b.actual_treatment_minute / 60.0 AS actual_treatment_hours,
- xts.weight_before
- FROM
- (SELECT
- DATE(FROM_UNIXTIME(xts.inspect_date)) AS inspect_date,
- xts.inspect_date as inspect,
- xts.patient_id,
- xts.item_id,
- xts.item_name,
- xts.inspect_value,
- be.weight_before
- FROM xt_inspection xts
- JOIN xt_assessment_before_dislysis be
- ON be.patient_id = xts.patient_id
- AND DATE(FROM_UNIXTIME(xts.inspect_date)) = DATE(FROM_UNIXTIME(be.assessment_date))
- WHERE xts.org_id = 10677 AND xts.item_id = 106770503 and xts.inspect_date >= 1725120000) xts
- JOIN
- (SELECT
- DATE(FROM_UNIXTIME(xt.inspect_date)) AS inspect_date,
- xt.inspect_date as inspect,
- xt.patient_id,
- xt.item_id,
- xt.item_name,
- xt.inspect_value,
- ad.weight_after,
- ad.actual_ultrafiltration,
- ad.actual_treatment_hour,
- ad.actual_treatment_minute
- FROM xt_inspection xt
- JOIN xt_assessment_after_dislysis ad
- ON DATE(FROM_UNIXTIME(xt.inspect_date)) = DATE(FROM_UNIXTIME(ad.assessment_date))
- AND xt.patient_id = ad.patient_id
- WHERE xt.org_id = 10677 AND xt.item_id = 106771301 and xt.inspect_date >= 1725120000
- AND ad.weight_after > 0
- AND ad.actual_ultrafiltration > 0) b
- ON xts.inspect_date = b.inspect_date
- AND xts.patient_id = b.patient_id;
- `).Scan(&inspections)
-
- for _, item := range inspections {
- // 定义一个日期字符串
- timestamp := item.Inspect
- var ins models.Inspection
- ins.Status = 1
- ins.PatientId = item.PatientID
- ins.OrgId = 10677
- ins.ItemName = "透析前尿素氮"
- ins.CreatedTime = time.Now().Unix()
- ins.UpdatedTime = time.Now().Unix()
- ins.ProjectName = "KT/V"
- ins.InspectType = 3
- ins.InspectDate = timestamp
- ins.InspectValue = item.InspectValue1
- ins.ProjectId = 1014
- ins.ItemId = 10879
- writeDb.Create(&ins)
-
- var ins2 models.Inspection
- ins2.Status = 1
- ins2.PatientId = item.PatientID
- ins2.OrgId = 10677
- ins2.ItemName = "透析后尿素氮"
- ins2.CreatedTime = time.Now().Unix()
- ins2.UpdatedTime = time.Now().Unix()
- ins2.ProjectName = "KT/V"
- ins2.InspectType = 3
- ins2.InspectDate = timestamp
- ins2.InspectValue = item.InspectValue2
- ins2.ProjectId = 1014
- ins2.ItemId = 10878
- writeDb.Create(&ins2)
-
- var ins3 models.Inspection
- ins3.Status = 1
- ins3.PatientId = item.PatientID
- ins3.OrgId = 10677
- ins3.ItemName = "透析时间"
- ins3.CreatedTime = time.Now().Unix()
- ins3.UpdatedTime = time.Now().Unix()
- ins3.ProjectName = "KT/V"
- ins3.InspectType = 3
- ins3.InspectDate = timestamp
- strValue := fmt.Sprintf("%f", float64(item.ActualTreatmentHour)+item.ActualTreatmentHours)
- ins3.InspectValue = strValue
- ins3.ProjectId = 1014
- ins3.ItemId = 10877
- writeDb.Create(&ins3)
-
- var ins4 models.Inspection
-
- ins4.Status = 1
- ins4.PatientId = item.PatientID
- ins4.OrgId = 10677
- ins4.ItemName = "实际超滤量"
- ins4.CreatedTime = time.Now().Unix()
- ins4.UpdatedTime = time.Now().Unix()
- ins4.ProjectName = "KT/V"
- ins4.InspectType = 3
- ins4.InspectDate = timestamp
- strValue2 := fmt.Sprintf("%f", item.ActualUltrafiltration/1000)
- ins4.InspectValue = strValue2
- ins4.ProjectId = 1014
- ins4.ItemId = 10876
- writeDb.Create(&ins4)
-
- var ins7 models.Inspection
- ins7.Status = 1
- ins7.PatientId = item.PatientID
- ins7.OrgId = 10677
- ins7.ItemName = "透后体重"
- ins7.CreatedTime = time.Now().Unix()
- ins7.UpdatedTime = time.Now().Unix()
- ins7.ProjectName = "KT/V"
- ins7.InspectType = 3
- ins7.InspectDate = timestamp
- strValue5 := fmt.Sprintf("%f", item.WeightAfter)
- ins7.InspectValue = strValue5
- ins7.ProjectId = 1014
- ins7.ItemId = 10874
- writeDb.Create(&ins7)
-
- var ins8 models.Inspection
- ins8.Status = 1
- ins8.PatientId = item.PatientID
- ins8.OrgId = 10677
- ins8.ItemName = "KT/V"
- ins8.CreatedTime = time.Now().Unix()
- ins8.UpdatedTime = time.Now().Unix()
- ins8.ProjectName = "KT/V"
- ins8.InspectType = 3
- ins8.InspectDate = timestamp
- ins8.InspectValue = ""
- ins8.ProjectId = 1014
- ins8.ItemId = 10950
-
- C0, _ := strconv.ParseFloat(item.InspectValue1, 64)
- Ct, _ := strconv.ParseFloat(item.InspectValue2, 64)
-
- a := math.Log((Ct/C0 - (0.008 * (float64(item.ActualTreatmentHour) + item.ActualTreatmentHours))))
- b := (4 - 3.5*(Ct/C0)) * ((item.ActualUltrafiltration / 1000) / item.WeightAfter)
- c := -a + b
-
- // 格式化输出,保留5位小数
- valueFormatted := fmt.Sprintf("%.5f", c)
-
- ins8.InspectValue = valueFormatted
- writeDb.Create(&ins8)
-
- var ins9 models.Inspection
- ins9.Status = 1
- ins9.PatientId = item.PatientID
- ins9.OrgId = 10677
- ins9.ItemName = "URR(%)"
- ins9.CreatedTime = time.Now().Unix()
- ins9.UpdatedTime = time.Now().Unix()
- ins9.ProjectName = "KT/V"
- ins9.InspectType = 3
- ins9.InspectDate = timestamp
- before, _ := strconv.ParseFloat(item.InspectValue1, 64)
- after, _ := strconv.ParseFloat(item.InspectValue2, 64)
- value2 := (((before - after) / before) * 100)
- rounded := math.Round(value2*100) / 100
- strValue6 := fmt.Sprintf("%f", rounded)
- ins9.InspectValue = strValue6
- ins9.ProjectId = 1014
- ins9.ItemId = 10951
- writeDb.Create(&ins9)
- }
- }
-
- func GetOrder11111() {
- var info []models.HisOrder
- err = readDb.Model(&models.HisOrder{}).Where("user_org_id = 10138 and order_status = 2 and status = 1 and setl_time >= '2024-08-01 00:00:00' and setl_time <= '2024-12-31 23:59:59'").Find(&info).Error
- for _, in := range info {
- var p models.HisPatient
- var sss models.OutpatientServiceSick
- readDb.Model(&models.HisPatient{}).Where("number = ?", in.MdtrtId).First(&p)
- readDb.Model(&models.OutpatientServiceSick{}).Where("id = ?", p.SickType).First(&sss)
- in.SickName = sss.ClassName
- writeDb.Save(&in)
- //writeDb.Model(&models.HisOrderInfo{}).Where("user_org_id = ? and feedetl_sn = ? and advice_id = 0 and med_chrgitm_type = '09' and ctime >= 1717344000", org_id, doc.FeedetlSn).Updates(map[string]interface{}{"advice_id": doc.ID})
- }
- return
- }
-
- func GetOrder111112() {
- var info []models.HisOrder
- err = readDb.Model(&models.HisOrder{}).Where("user_org_id = 10138 and order_status = 2 and status = 1 and setl_time >= '2024-11-23 00:00:00'").Find(&info).Error
- for _, in := range info {
- var p_info models.HisPrescriptionInfo
- readDb.Model(&models.HisPrescriptionInfo{}).Where("user_org_id = 10138 and status = 1 and patient_id = ? and record_date = ?", in.PatientId, in.SettleAccountsDate).First(&p_info)
- //readUserDb.Model(&models.UserAdminRole{}).Where("admin_user_id = ? and org_id = 10138", p_info.DoctorId)
-
- diass := strings.Split(in.Diagnosis, ",")
- var dia_name = ""
- for _, dia := range diass {
- var sss models.HisXtDiagnoseConfig
- if len(dia) > 0 {
- readDb.Model(&models.HisXtDiagnoseConfig{}).Where("id = ?", dia).First(&sss)
- if len(dia_name) == 0 {
- dia_name = sss.ClassName
- } else {
- dia_name = dia_name + "," + sss.ClassName
- }
- }
- }
- if len(dia_name) > 0 {
- in.WarnMsg = dia_name
- writeDb.Save(&in)
- }
- }
- return
- }
|