Browse Source

Merge branch '20230223_xt_api_new_branch' of http://git.shengws.com/csx/XT_New into 20230223_xt_api_new_branch

28169 1 year ago
parent
commit
7d82b3640b

+ 9 - 0
controllers/his_project_api_controller.go View File

149
 			firstLetter += string(py[0][0])
149
 			firstLetter += string(py[0][0])
150
 		}
150
 		}
151
 	}
151
 	}
152
+
152
 	hisProject := models.XtHisProject{
153
 	hisProject := models.XtHisProject{
153
 		ProjectName:                 project_name,
154
 		ProjectName:                 project_name,
154
 		Pinyin:                      firstLetter,
155
 		Pinyin:                      firstLetter,
191
 		ZuobiaoId:                   bbx01,
192
 		ZuobiaoId:                   bbx01,
192
 		FirstLetter:                 firstLetter,
193
 		FirstLetter:                 firstLetter,
193
 	}
194
 	}
195
+	if this.GetAdminUserInfo().CurrentOrgId == 10206 {
196
+		de, _ := service.GetDepartMentDetail(executive_section)
197
+		hisProject.Bck01b = de.Number
198
+	}
194
 	//查询项目名称是否存在
199
 	//查询项目名称是否存在
195
 	_, errcode := service.GetHisProjectIsExist(project_name, orgId)
200
 	_, errcode := service.GetHisProjectIsExist(project_name, orgId)
196
 	if errcode == gorm.ErrRecordNotFound {
201
 	if errcode == gorm.ErrRecordNotFound {
343
 		ZuobiaoId:                   bbx01,
348
 		ZuobiaoId:                   bbx01,
344
 		UserOrgId:                   orgId,
349
 		UserOrgId:                   orgId,
345
 	}
350
 	}
351
+	if this.GetAdminUserInfo().CurrentOrgId == 10206 {
352
+		de, _ := service.GetDepartMentDetail(executive_section)
353
+		hisProject.Bck01b = de.Number
354
+	}
346
 
355
 
347
 	err := service.UpdatedProject(id, &hisProject)
356
 	err := service.UpdatedProject(id, &hisProject)
348
 
357
 

+ 2 - 0
controllers/manager_center_api_controller.go View File

1682
 		Bbx01:                       bbx01,
1682
 		Bbx01:                       bbx01,
1683
 		Bby01:                       bby01,
1683
 		Bby01:                       bby01,
1684
 		ZuobiaoId:                   bbx01,
1684
 		ZuobiaoId:                   bbx01,
1685
+		Bck01b:                      "55",
1685
 	}
1686
 	}
1686
 	err, goodInfos := service.AddSigleGoodInfo(&goodInfo)
1687
 	err, goodInfos := service.AddSigleGoodInfo(&goodInfo)
1687
 	if err == nil {
1688
 	if err == nil {
1825
 		Bbx01:                       bbx01,
1826
 		Bbx01:                       bbx01,
1826
 		Bby01:                       bby01,
1827
 		Bby01:                       bby01,
1827
 		ZuobiaoId:                   bbx01,
1828
 		ZuobiaoId:                   bbx01,
1829
+		Bck01b:                      "55",
1828
 	}
1830
 	}
1829
 
1831
 
1830
 	totals := service.FindGoodInfoByNameOne(specification_name, adminUserInfo.CurrentOrgId, good_id, id, good_name)
1832
 	totals := service.FindGoodInfoByNameOne(specification_name, adminUserInfo.CurrentOrgId, good_id, id, good_name)

+ 1 - 1
controllers/statistics_api_controller.go View File

1021
 	}
1021
 	}
1022
 }
1022
 }
1023
 func (c *StatisticsApiController) GetDialysisTotalDetailInfo() {
1023
 func (c *StatisticsApiController) GetDialysisTotalDetailInfo() {
1024
-	date_str := c.GetString("data")
1024
+	date_str := c.GetString("date")
1025
 	mode, _ := c.GetInt64("mode")
1025
 	mode, _ := c.GetInt64("mode")
1026
 	origin, _ := c.GetInt64("origin")
1026
 	origin, _ := c.GetInt64("origin")
1027
 	page, _ := c.GetInt64("page")
1027
 	page, _ := c.GetInt64("page")

+ 3 - 1
models/good_models.go View File

104
 	SumInCount                  int64                `gorm:"column:sum_in_count" json:"sum_in_count" form:"sum_in_count"`
104
 	SumInCount                  int64                `gorm:"column:sum_in_count" json:"sum_in_count" form:"sum_in_count"`
105
 	Bbx01                       string               `gorm:"column:bbx01" json:"bbx01" form:"bbx01"`
105
 	Bbx01                       string               `gorm:"column:bbx01" json:"bbx01" form:"bbx01"`
106
 	Bby01                       string               `gorm:"column:bby01" json:"bby01" form:"bby01"`
106
 	Bby01                       string               `gorm:"column:bby01" json:"bby01" form:"bby01"`
107
-	ZuobiaoId                   string               `gorm:"column:zuobiao_id" json:"zuobiao_id" form:"zuobiao_id"`
107
+	Bck01b                      string               `gorm:"column:bck01b" json:"bck01b" form:"bck01b"`
108
+
109
+	ZuobiaoId string `gorm:"column:zuobiao_id" json:"zuobiao_id" form:"zuobiao_id"`
108
 
110
 
109
 	WarehousingInfoOne []*StartWarehousingInfo `gorm:"json:"warehouse_info"` //期间增加
111
 	WarehousingInfoOne []*StartWarehousingInfo `gorm:"json:"warehouse_info"` //期间增加
110
 
112
 

+ 2 - 1
models/his_models.go View File

48
 	Bbx01                       string  `gorm:"column:bbx01" json:"bbx01" form:"bbx01"`
48
 	Bbx01                       string  `gorm:"column:bbx01" json:"bbx01" form:"bbx01"`
49
 	Bby01                       string  `gorm:"column:bby01" json:"bby01" form:"bby01"`
49
 	Bby01                       string  `gorm:"column:bby01" json:"bby01" form:"bby01"`
50
 	ZuobiaoId                   string  `gorm:"column:zuobiao_id" json:"zuobiao_id" form:"zuobiao_id"`
50
 	ZuobiaoId                   string  `gorm:"column:zuobiao_id" json:"zuobiao_id" form:"zuobiao_id"`
51
+	Bck01b                      string  `gorm:"column:bck01b" json:"bck01b" form:"bck01b"`
51
 }
52
 }
52
 
53
 
53
 func (XtHisProject) TableName() string {
54
 func (XtHisProject) TableName() string {
557
 	BatchNumber            string                    `gorm:"column:batch_number" json:"batch_number" form:"batch_number"`
558
 	BatchNumber            string                    `gorm:"column:batch_number" json:"batch_number" form:"batch_number"`
558
 	PrescriptionNumber     string                    `gorm:"column:prescription_number" json:"prescription_number" form:"prescription_number"`
559
 	PrescriptionNumber     string                    `gorm:"column:prescription_number" json:"prescription_number" form:"prescription_number"`
559
 	Patients               Patients                  `gorm:"ForeignKey:PatientId;AssociationForeignKey:ID" json:"patient"`
560
 	Patients               Patients                  `gorm:"ForeignKey:PatientId;AssociationForeignKey:ID" json:"patient"`
560
-	HisPatient             VMHisPatient              `gorm:"ForeignKey:PatientId;AssociationForeignKey:patient_id" json:"hisPatient"`
561
+	HisPatient             VMHisPatient              `gorm:"ForeignKey:ID;AssociationForeignKey:HisPatientId" json:"hisPatient"`
561
 	HisDoctorAdviceInfo    []*HisDoctorAdviceInfo    `gorm:"ForeignKey:PrescriptionId;AssociationForeignKey:ID" json:"advices"`
562
 	HisDoctorAdviceInfo    []*HisDoctorAdviceInfo    `gorm:"ForeignKey:PrescriptionId;AssociationForeignKey:ID" json:"advices"`
562
 	HisPrescriptionProject []*HisPrescriptionProject `gorm:"ForeignKey:PrescriptionId;AssociationForeignKey:ID" json:"project"`
563
 	HisPrescriptionProject []*HisPrescriptionProject `gorm:"ForeignKey:PrescriptionId;AssociationForeignKey:ID" json:"project"`
563
 	HisAdditionalCharge    []*HisAdditionalCharge    `gorm:"ForeignKey:PrescriptionId;AssociationForeignKey:ID" json:"addition"`
564
 	HisAdditionalCharge    []*HisAdditionalCharge    `gorm:"ForeignKey:PrescriptionId;AssociationForeignKey:ID" json:"addition"`

+ 2 - 2
service/his_project_service.go View File

59
 
59
 
60
 func UpdatedProject(id int64, pro *models.XtHisProject) error {
60
 func UpdatedProject(id int64, pro *models.XtHisProject) error {
61
 
61
 
62
-	err := XTWriteDB().Model(&pro).Where("id=?", id).Updates(map[string]interface{}{"project_name": pro.ProjectName, "pinyin": pro.Pinyin, "wubi": pro.Pinyin, "price": pro.Price, "unit": pro.Unit, "cost_classify": pro.CostClassify, "executive_section": pro.ExecutiveSection, "medical_coverage": pro.MedicalCoverage, "statistical_classification": pro.StatisticalClassification, "disease_directory": pro.DiseaseDirectory, "is_record": pro.IsRecord, "medical_code": pro.MedicalCode, "tube_color": pro.TubeColor, "medical_status": pro.MedicalStatus, "remark": pro.Remark, "sign": pro.Sign, "default_number": pro.DefaultNumber, "is_default": pro.IsDefault, "is_charge": pro.IsCharge, "is_estimate": pro.IsEstimate, "is_workload": pro.IsWorkload, "sort": pro.Sort, "doctor_advice": pro.DoctorAdvice, "single_dose": pro.SingleDose, "execution_frequency": pro.ExecutionFrequency, "delivery_way": pro.DeliveryWay, "number_days": pro.NumberDays, "total": pro.Total, "updated_time": pro.UpdatedTime, "category": pro.Category, "specail_project": pro.SpecailProject, "social_security_directory_code": pro.SocialSecurityDirectoryCode, "record_date": pro.RecordDate, "is_print": pro.IsPrint, "bbx01": pro.Bbx01, "bby01": pro.Bby01, "zuobiao_id": pro.ZuobiaoId}).Error
62
+	err := XTWriteDB().Model(&pro).Where("id=?", id).Updates(map[string]interface{}{"project_name": pro.ProjectName, "pinyin": pro.Pinyin, "wubi": pro.Pinyin, "price": pro.Price, "unit": pro.Unit, "cost_classify": pro.CostClassify, "executive_section": pro.ExecutiveSection, "medical_coverage": pro.MedicalCoverage, "statistical_classification": pro.StatisticalClassification, "disease_directory": pro.DiseaseDirectory, "is_record": pro.IsRecord, "medical_code": pro.MedicalCode, "tube_color": pro.TubeColor, "medical_status": pro.MedicalStatus, "remark": pro.Remark, "sign": pro.Sign, "default_number": pro.DefaultNumber, "is_default": pro.IsDefault, "is_charge": pro.IsCharge, "is_estimate": pro.IsEstimate, "is_workload": pro.IsWorkload, "sort": pro.Sort, "doctor_advice": pro.DoctorAdvice, "single_dose": pro.SingleDose, "execution_frequency": pro.ExecutionFrequency, "delivery_way": pro.DeliveryWay, "number_days": pro.NumberDays, "total": pro.Total, "updated_time": pro.UpdatedTime, "category": pro.Category, "specail_project": pro.SpecailProject, "social_security_directory_code": pro.SocialSecurityDirectoryCode, "record_date": pro.RecordDate, "is_print": pro.IsPrint, "bbx01": pro.Bbx01, "bby01": pro.Bby01, "zuobiao_id": pro.ZuobiaoId, "bck01b": pro.Bck01b}).Error
63
 	return err
63
 	return err
64
 }
64
 }
65
 
65
 
419
 }
419
 }
420
 
420
 
421
 func GetDoctorAdvicePrint(his_patient_id int64, recorddate int64, schIDs []string, orgid int64, p_type int64) (prescription []*models.HisPrescription, err error) {
421
 func GetDoctorAdvicePrint(his_patient_id int64, recorddate int64, schIDs []string, orgid int64, p_type int64) (prescription []*models.HisPrescription, err error) {
422
-	err = XTReadDB().Model(&prescription).Where("patient_id = ? and record_date = ? and id in(?) and  status = 1 and p_type = ? ", his_patient_id, recorddate, schIDs, p_type).Preload("Patients", "status = 1 and user_org_id = ?", orgid).Preload("HisDoctorAdviceInfo", func(db *gorm.DB) *gorm.DB {
422
+	err = XTReadDB().Model(&prescription).Where("patient_id = ? and record_date = ? and id in(?) and  status = 1 and p_type = ? ", his_patient_id, recorddate, schIDs, p_type).Preload("HisPatient", "status = 1 and  user_org_id = ?", orgid).Preload("Patients", "status = 1 and user_org_id = ?", orgid).Preload("HisDoctorAdviceInfo", func(db *gorm.DB) *gorm.DB {
423
 		return db.Where("status = 1 and user_org_id = ?", orgid).Preload("Drug", "status = 1")
423
 		return db.Where("status = 1 and user_org_id = ?", orgid).Preload("Drug", "status = 1")
424
 	}).Preload("HisPrescriptionProject", func(db *gorm.DB) *gorm.DB {
424
 	}).Preload("HisPrescriptionProject", func(db *gorm.DB) *gorm.DB {
425
 		return db.Where("status = 1 AND user_org_id = ?", orgid).Preload("HisProject").Preload("GoodInfo", "status=1").Preload("XtHisProjectTeam", "status = 1")
425
 		return db.Where("status = 1 AND user_org_id = ?", orgid).Preload("HisProject").Preload("GoodInfo", "status=1").Preload("XtHisProjectTeam", "status = 1")

+ 13 - 6
service/statistis_qc_service.go View File

643
 
643
 
644
 func GetPrescriptionByDialyzer(page int64, limit int64, orgid int64, dialyzer string, start_time int64, end_time int64) (solution []*models.DialysisPrescription, total int64, err error) {
644
 func GetPrescriptionByDialyzer(page int64, limit int64, orgid int64, dialyzer string, start_time int64, end_time int64) (solution []*models.DialysisPrescription, total int64, err error) {
645
 
645
 
646
-	db := XTReadDB().Model(&models.DialysisPrescription{}).Where("status = 1")
646
+	db := XTReadDB().Model(&models.DialysisPrescription{}).Preload("QCPatients", "status = 1 and user_org_id = ?", orgid).Where("status = 1")
647
 	if len(dialyzer) > 0 {
647
 	if len(dialyzer) > 0 {
648
 		db = db.Where("dialysis_dialyszers = ?", dialyzer)
648
 		db = db.Where("dialysis_dialyszers = ?", dialyzer)
649
 	}
649
 	}
650
 	if orgid > 0 {
650
 	if orgid > 0 {
651
 		db = db.Where("user_org_id = ?", orgid)
651
 		db = db.Where("user_org_id = ?", orgid)
652
 	}
652
 	}
653
-	db = db.Where("record_date >= ? and record_date <= ?", start_time, end_time)
653
+	db = db.Where("record_date >= ? and record_date <= ? and status = 1", start_time, end_time)
654
 
654
 
655
 	offset := (page - 1) * limit
655
 	offset := (page - 1) * limit
656
 
656
 
736
 	      CONCAT(a.actual_treatment_hour, 'h', a.actual_treatment_minute,'min') as actual_duration,
736
 	      CONCAT(a.actual_treatment_hour, 'h', a.actual_treatment_minute,'min') as actual_duration,
737
 	      ABS(TIMESTAMPDIFF(MINUTE, MAKETIME(p.dialysis_duration_hour, p.dialysis_duration_minute, 0), MAKETIME(a.actual_treatment_hour, a.actual_treatment_minute, 0))) as diff,
737
 	      ABS(TIMESTAMPDIFF(MINUTE, MAKETIME(p.dialysis_duration_hour, p.dialysis_duration_minute, 0), MAKETIME(a.actual_treatment_hour, a.actual_treatment_minute, 0))) as diff,
738
 	      p.prescription_doctor as doctor,
738
 	      p.prescription_doctor as doctor,
739
-	      o.finish_nurse as nurse
739
+	      o.finish_nurse as nurse,
740
+	    	pp.id_card_no as id_card_no
740
 	   FROM
741
 	   FROM
741
 	       xt_dialysis_order o
742
 	       xt_dialysis_order o
742
 		JOIN
743
 		JOIN
765
 	      CONCAT(a.actual_treatment_hour, 'h', a.actual_treatment_minute,'min') as actual_duration,
766
 	      CONCAT(a.actual_treatment_hour, 'h', a.actual_treatment_minute,'min') as actual_duration,
766
 	      ABS(TIMESTAMPDIFF(MINUTE, MAKETIME(p.dialysis_duration_hour, p.dialysis_duration_minute, 0), MAKETIME(a.actual_treatment_hour, a.actual_treatment_minute, 0))) as diff,
767
 	      ABS(TIMESTAMPDIFF(MINUTE, MAKETIME(p.dialysis_duration_hour, p.dialysis_duration_minute, 0), MAKETIME(a.actual_treatment_hour, a.actual_treatment_minute, 0))) as diff,
767
 	      p.prescription_doctor as doctor,
768
 	      p.prescription_doctor as doctor,
768
-	      o.finish_nurse as nurse
769
+	      o.finish_nurse as nurse,
770
+	   pp.id_card_no as id_card_no
771
+	      
769
 	   FROM
772
 	   FROM
770
 	       xt_dialysis_order o
773
 	       xt_dialysis_order o
771
 		JOIN
774
 		JOIN
793
 	      CONCAT(a.actual_treatment_hour, 'h', a.actual_treatment_minute,'min') as actual_duration,
796
 	      CONCAT(a.actual_treatment_hour, 'h', a.actual_treatment_minute,'min') as actual_duration,
794
 	      ABS(TIMESTAMPDIFF(MINUTE, MAKETIME(p.dialysis_duration_hour, p.dialysis_duration_minute, 0), MAKETIME(a.actual_treatment_hour, a.actual_treatment_minute, 0))) as diff,
797
 	      ABS(TIMESTAMPDIFF(MINUTE, MAKETIME(p.dialysis_duration_hour, p.dialysis_duration_minute, 0), MAKETIME(a.actual_treatment_hour, a.actual_treatment_minute, 0))) as diff,
795
 	      p.prescription_doctor as doctor,
798
 	      p.prescription_doctor as doctor,
796
-	      o.finish_nurse as nurse
799
+	      o.finish_nurse as nurse,
800
+	   pp.id_card_no as id_card_no
797
 	   FROM
801
 	   FROM
798
 	       xt_dialysis_order o
802
 	       xt_dialysis_order o
799
 		JOIN
803
 		JOIN
821
 	      CONCAT(a.actual_treatment_hour, 'h', a.actual_treatment_minute,'min') as actual_duration,
825
 	      CONCAT(a.actual_treatment_hour, 'h', a.actual_treatment_minute,'min') as actual_duration,
822
 	      ABS(TIMESTAMPDIFF(MINUTE, MAKETIME(p.dialysis_duration_hour, p.dialysis_duration_minute, 0), MAKETIME(a.actual_treatment_hour, a.actual_treatment_minute, 0))) as diff,
826
 	      ABS(TIMESTAMPDIFF(MINUTE, MAKETIME(p.dialysis_duration_hour, p.dialysis_duration_minute, 0), MAKETIME(a.actual_treatment_hour, a.actual_treatment_minute, 0))) as diff,
823
 	      p.prescription_doctor as doctor,
827
 	      p.prescription_doctor as doctor,
824
-	      o.finish_nurse as nurse
828
+	      o.finish_nurse as nurse,
829
+	   pp.id_card_no as id_card_no
825
 	   FROM
830
 	   FROM
826
 	       xt_dialysis_order o
831
 	       xt_dialysis_order o
827
 		JOIN
832
 		JOIN
859
 		"diff":              0,
864
 		"diff":              0,
860
 		"doctor":            "",
865
 		"doctor":            "",
861
 		"nurse":             "",
866
 		"nurse":             "",
867
+		"id_card_no":        "",
862
 	}
868
 	}
863
 
869
 
864
 	// Create the dynamic struct type
870
 	// Create the dynamic struct type
882
 			reflect.ValueOf(result).Elem().FieldByName("Diff").Addr().Interface(),
888
 			reflect.ValueOf(result).Elem().FieldByName("Diff").Addr().Interface(),
883
 			reflect.ValueOf(result).Elem().FieldByName("Doctor").Addr().Interface(),
889
 			reflect.ValueOf(result).Elem().FieldByName("Doctor").Addr().Interface(),
884
 			reflect.ValueOf(result).Elem().FieldByName("Nurse").Addr().Interface(),
890
 			reflect.ValueOf(result).Elem().FieldByName("Nurse").Addr().Interface(),
891
+			reflect.ValueOf(result).Elem().FieldByName("Id_card_no").Addr().Interface(),
885
 		}
892
 		}
886
 
893
 
887
 		// Scan the row into the struct
894
 		// Scan the row into the struct