28169 3 nedēļas atpakaļ
vecāks
revīzija
f9ae25b88b

+ 1 - 1
controllers/doctors_api_controller.go Parādīt failu

@@ -778,7 +778,7 @@ func (this *DoctorsApiController) GetInspectionMajorItem() {
778 778
 	last_time := this.GetString("last_time")
779 779
 	timeLayout := "2006-01-02"
780 780
 	loc, _ := time.LoadLocation("Local")
781
-	startTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", other_start_time+"23:59:59", loc)
781
+	startTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", other_start_time+" 23:59:59", loc)
782 782
 	lastTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", last_time+" 00:00:00", loc)
783 783
 	patient_id, _ := this.GetInt64("patient_id")
784 784
 	adminUserInfo := this.GetAdminUserInfo()

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 1537 - 865
controllers/his_api_controller.go


+ 2 - 1
controllers/self_drug_api_congtroller.go Parādīt failu

@@ -2392,10 +2392,11 @@ func (this *SelfDrugApiController) GetDrugInventoryDetailList() {
2392 2392
 	page, _ := this.GetInt64("page")
2393 2393
 	storehouse_id, _ := this.GetInt64("storehouse_id")
2394 2394
 	orgId := this.GetAdminUserInfo().CurrentOrgId
2395
+	appId := this.GetAdminUserInfo().CurrentAppId
2395 2396
 	list, total, err := service.GetDrugInventoryDetailList(keyword, page, limit, orgId, storehouse_id)
2396 2397
 	inventoryList, _, _ := service.GetDrugInventoryDetailListTwo(keyword, page, limit, orgId, storehouse_id)
2397 2398
 	houseList, _ := service.GetAllStoreHouseList(orgId)
2398
-	doctorList, _ := service.GetAllDoctorThree(orgId)
2399
+	doctorList, _ := service.GetAllDoctorListSix(orgId, appId)
2399 2400
 	if err != nil {
2400 2401
 		this.ServeFailJsonSend(enums.ErrorCodeDataException, "更新设备失败")
2401 2402
 		return

+ 10 - 11
controllers/sign_api_controller.go Parādīt failu

@@ -7,7 +7,6 @@ import (
7 7
 	"encoding/json"
8 8
 	"fmt"
9 9
 	"github.com/astaxie/beego"
10
-	"github.com/jung-kurt/gofpdf"
11 10
 	"io/ioutil"
12 11
 	"time"
13 12
 )
@@ -310,16 +309,16 @@ func (this *SignApiController) CreateEnterprise() {
310 309
 
311 310
 func (this *SignApiController) GetTestThrityMent() {
312 311
 
313
-	pdf := gofpdf.New("P", "mm", "A4", "")
314
-	pdf.AddPage()
315
-	pdf.SetFont("Arial", "B", 16)
316
-	pdf.Cell(40, 10, "Hello, World!")
317
-	pdf.OutputFileAndClose("output.pdf")
318
-
319
-	this.ServeSuccessJSON(map[string]interface{}{
320
-		"sign": "msg",
321
-	})
322
-	return
312
+	//pdf := gofpdf.New("P", "mm", "A4", "")
313
+	//pdf.AddPage()
314
+	//pdf.SetFont("Arial", "B", 16)
315
+	//pdf.Cell(40, 10, "Hello, World!")
316
+	//pdf.OutputFileAndClose("output.pdf")
317
+	//
318
+	//this.ServeSuccessJSON(map[string]interface{}{
319
+	//	"sign": "msg",
320
+	//})
321
+	//return
323 322
 }
324 323
 
325 324
 func loremList() []string {

+ 4 - 0
main.go Parādīt failu

@@ -5,6 +5,7 @@ import (
5 5
 	"XT_New/service"
6 6
 	"encoding/xml"
7 7
 	"github.com/astaxie/beego"
8
+	"net/http"
8 9
 )
9 10
 
10 11
 func init() {
@@ -24,6 +25,9 @@ func main() {
24 25
 	//beego.BConfig.WebConfig.Session.SessionGCMaxLifetime = 6000
25 26
 	//beego.BConfig.WebConfig.AutoRender = false
26 27
 	//
28
+	go func() {
29
+		http.ListenAndServe("localhost:6060", nil)
30
+	}()
27 31
 
28 32
 	beego.Run()
29 33
 

+ 1 - 1
models/schedule_models.go Parādīt failu

@@ -388,7 +388,7 @@ type VmBloodSchedule struct {
388 388
 	XtAssessmentBeforeDislysis XtAssessmentBeforeDislysis `gorm:"ForeignKey:PatientId,AssessmentDate;AssociationForeignKey:PatientId,ScheduleDate" json:"assessment_befor_dislysis"`
389 389
 	XtDoctorAdvice             XtDoctorAdvice             `gorm:"ForeignKey:PatientId,AdviceDate;AssociationForeignKey:PatientId,ScheduleDate" json:"xt_doctor_advice"`
390 390
 	XtDoctorAdviceOne          []*XtDoctorAdvice          `gorm:"ForeignKey:PatientId,AdviceDate;AssociationForeignKey:PatientId,ScheduleDate" json:"advice"`
391
-	HisDoctorAdvice            HisDoctorAdvice            `gorm:"ForeignKey:PatientId,AdviceDate;AssociationForeignKey:PatientId,ScheduleDate" json:"his_doctor_advice"`
391
+	HisDoctorAdvice            []*HisDoctorAdvice         `gorm:"ForeignKey:PatientId,AdviceDate;AssociationForeignKey:PatientId,ScheduleDate" json:"his_doctor_advice"`
392 392
 	ReceiveTreatmentAsses      ReceiveTreatmentAsses      `gorm:"ForeignKey:PatientId,RecordDate;AssociationForeignKey:PatientId,ScheduleDate" json:"xt_receive_treatment_asses"`
393 393
 	XtAssessmentAfterDislysis  XtAssessmentAfterDislysis  `gorm:"ForeignKey:PatientId,AssessmentDate;AssociationForeignKey:PatientId,ScheduleDate" json:"xt_assesment_after_dislysis"`
394 394
 	LastAfterWeight            AssessmentAfterDislysis    `gorm:"ForeignKey:PatientID;AssociationForeignKey:PatientID" json:"lastafterweight"`

+ 2 - 2
service/dialysis_solution_service.go Parādīt failu

@@ -103,11 +103,11 @@ func GetDialysisAdviceTemplateList(keywords string, limit int64, page int64, par
103 103
 		db = db.Joins("JOIN xt_patients AS patient ON patient.id=xt_schedule.patient_id AND patient.status = 1 AND patient.user_org_id = ? AND patient.name Like ?", orgID, keywords)
104 104
 		err = db.Count(&total).Offset(offset).Limit(limit).Preload("SchedualPatient", "status = 1 AND user_org_id = ?", orgID).
105 105
 			Preload("DeviceNumber", "status = 1 AND org_id = ?", orgID).
106
-			Preload("DeviceNumber.Zone", "status = 1 AND org_id = ?", orgID).Find(&schedule).Error
106
+			Preload("DeviceNumber.Zone", "status = 1 AND org_id = ?", orgID).Preload("HisDoctorAdvice", "status=1 and user_org_id =? and advice_date =?", orgID, scheduleDate).Find(&schedule).Error
107 107
 	} else {
108 108
 		err = db.Count(&total).Offset(offset).Limit(limit).Preload("SchedualPatient", "status = 1 AND user_org_id = ?", orgID).
109 109
 			Preload("DeviceNumber", "status = 1 AND org_id = ?", orgID).
110
-			Preload("DeviceNumber.Zone", "status = 1 AND org_id = ?", orgID).Find(&schedule).Error
110
+			Preload("DeviceNumber.Zone", "status = 1 AND org_id = ?", orgID).Preload("HisDoctorAdvice", "status=1 and user_org_id =? and advice_date =?", orgID, scheduleDate).Find(&schedule).Error
111 111
 	}
112 112
 
113 113
 	return schedule, total, err

+ 50 - 7
service/his_service.go Parādīt failu

@@ -402,7 +402,7 @@ func UpdatePatientCaseHistory(patient_id int64, record_date int64, user_org_id i
402 402
 	return err
403 403
 }
404 404
 
405
-func SaveHisPrescription(tx *gorm.DB, prescription *models.HisPrescription) (err error) {
405
+func SaveHisPrescriptionOne(tx *gorm.DB, prescription *models.HisPrescription) (err error) {
406 406
 
407 407
 	err = tx.Model(&models.HisPrescription{}).Save(prescription).Error
408 408
 	if err != nil {
@@ -413,6 +413,17 @@ func SaveHisPrescription(tx *gorm.DB, prescription *models.HisPrescription) (err
413 413
 	return
414 414
 }
415 415
 
416
+func SaveHisPrescription(prescription *models.HisPrescription) (err error) {
417
+	tx := writeDb.Begin()
418
+
419
+	if err = tx.Model(&models.HisPrescription{}).Save(prescription).Error; err != nil {
420
+		tx.Rollback()
421
+		return
422
+	}
423
+	tx.Commit()
424
+	return
425
+}
426
+
416 427
 func SaveHisPrescriptionTwo(prescription *models.HisPrescription) (err error) {
417 428
 
418 429
 	err = writeDb.Model(&models.HisPrescription{}).Save(prescription).Error
@@ -887,7 +898,7 @@ func GetHisAdminUserDoctors(org_id int64) (doctors []*models.UserAdminRole, err
887 898
 	return
888 899
 }
889 900
 
890
-func CreateHisDoctorAdvice(s *models.HisDoctorAdviceInfo, tx *gorm.DB) (err error) {
901
+func CreateHisDoctorAdviceOne(s *models.HisDoctorAdviceInfo, tx *gorm.DB) (err error) {
891 902
 
892 903
 	err = tx.Model(&models.HisDoctorAdviceInfo{}).Save(s).Error
893 904
 
@@ -898,6 +909,18 @@ func CreateHisDoctorAdvice(s *models.HisDoctorAdviceInfo, tx *gorm.DB) (err erro
898 909
 	return
899 910
 }
900 911
 
912
+func CreateHisDoctorAdvice(s *models.HisDoctorAdviceInfo) (err error) {
913
+
914
+	tx := writeDb.Begin()
915
+	if err = tx.Model(&models.HisDoctorAdviceInfo{}).Save(s).Error; err != nil {
916
+		tx.Rollback()
917
+		return
918
+	}
919
+	tx.Commit()
920
+
921
+	return
922
+}
923
+
901 924
 func CreateHisDoctorAdviceTwo(s *models.HisDoctorAdviceInfo) (err error) {
902 925
 	tx := writeDb.Begin()
903 926
 	if err = tx.Model(&models.HisDoctorAdviceInfo{}).Save(s).Error; err != nil {
@@ -909,7 +932,7 @@ func CreateHisDoctorAdviceTwo(s *models.HisDoctorAdviceInfo) (err error) {
909 932
 	return
910 933
 }
911 934
 
912
-func CreateHisProjectTwo(project *models.HisPrescriptionProject, tx *gorm.DB) (err error) {
935
+func CreateNewHisProjectTwo(project *models.HisPrescriptionProject, tx *gorm.DB) (err error) {
913 936
 	err = tx.Model(&models.HisPrescriptionProject{}).Save(project).Error
914 937
 	if err != nil {
915 938
 		tx.Rollback()
@@ -917,11 +940,21 @@ func CreateHisProjectTwo(project *models.HisPrescriptionProject, tx *gorm.DB) (e
917 940
 	}
918 941
 	return
919 942
 }
943
+func CreateHisProjectTwo(project *models.HisPrescriptionProject) (err error) {
944
+	tx := writeDb.Begin()
945
+	if err = tx.Model(&models.HisPrescriptionProject{}).Save(project).Error; err != nil {
946
+		tx.Rollback()
947
+		return
948
+	}
949
+	tx.Commit()
920 950
 
921
-func GetLastHisProject(patient_id int64, user_org_id int64, record_date int64, tx *gorm.DB) (models.HisPrescriptionProject, error) {
951
+	return
952
+}
953
+
954
+func GetLastHisProject(patient_id int64, user_org_id int64, record_date int64, tx *gorm.DB, good_id int64) (models.HisPrescriptionProject, error) {
922 955
 
923 956
 	prescriptionProject := models.HisPrescriptionProject{}
924
-	err := tx.Where("patient_id = ? and user_org_id = ? and record_date = ? and status=1", patient_id, user_org_id, record_date).Find(&prescriptionProject).Error
957
+	err := tx.Where("patient_id = ? and user_org_id = ? and record_date = ? and status=1 and project_id = ? and type =3", patient_id, user_org_id, record_date, good_id).Find(&prescriptionProject).Error
925 958
 	if err != gorm.ErrRecordNotFound {
926 959
 		if err != nil {
927 960
 			tx.Rollback()
@@ -940,7 +973,7 @@ func CreateHisProjectThree(project *models.HisPrescriptionProject) (err error) {
940 973
 	return
941 974
 }
942 975
 
943
-func SaveHisProjectTwo(project *models.HisPrescriptionProject, tx *gorm.DB) (err error) {
976
+func SaveNewHisProjectTwo(project *models.HisPrescriptionProject, tx *gorm.DB) (err error) {
944 977
 	//err = tx.Model(&models.HisPrescriptionProject{}).Where("user_org_id = ? AND id = ?", project.UserOrgId, project.ID).Updates(map[string]interface{}{"feedetl_sn": project.FeedetlSn, "mtime": time.Now().Unix()}).Error
945 978
 	if err = tx.Model(&models.HisPrescriptionProject{}).Where("user_org_id = ? AND id = ?", project.UserOrgId, project.ID).Updates(map[string]interface{}{"feedetl_sn": project.FeedetlSn, "mtime": time.Now().Unix()}).Error; err != nil {
946 979
 		tx.Rollback()
@@ -949,6 +982,11 @@ func SaveHisProjectTwo(project *models.HisPrescriptionProject, tx *gorm.DB) (err
949 982
 	return
950 983
 }
951 984
 
985
+func SaveHisProjectTwo(project *models.HisPrescriptionProject) (err error) {
986
+	err = writeDb.Model(&models.HisPrescriptionProject{}).Where("user_org_id = ? AND id = ?", project.UserOrgId, project.ID).Updates(map[string]interface{}{"feedetl_sn": project.FeedetlSn, "mtime": time.Now().Unix()}).Error
987
+	return
988
+}
989
+
952 990
 func CreateHisPatientTwo(patient *models.VMHisPatient) error {
953 991
 	err := writeDb.Create(&patient).Error
954 992
 	return err
@@ -2639,7 +2677,7 @@ func DeletePrintInfo(id int64) {
2639 2677
 	writeDb.Model(&models.HisLabelPrintInfo{}).Where("p_project_id = ?", id).Updates(map[string]interface{}{"status": 0})
2640 2678
 }
2641 2679
 
2642
-func CreateHisLabelRecord(label *models.HisLabelPrintInfo, tx *gorm.DB) (err error) {
2680
+func CreateNewHisLabelRecord(label *models.HisLabelPrintInfo, tx *gorm.DB) (err error) {
2643 2681
 	if err = tx.Save(&label).Error; err != nil {
2644 2682
 		tx.Rollback()
2645 2683
 		return
@@ -2647,6 +2685,11 @@ func CreateHisLabelRecord(label *models.HisLabelPrintInfo, tx *gorm.DB) (err err
2647 2685
 	return
2648 2686
 }
2649 2687
 
2688
+func CreateHisLabelRecord(label *models.HisLabelPrintInfo) error {
2689
+	err := writeDb.Save(&label).Error
2690
+	return err
2691
+}
2692
+
2650 2693
 func CreateHisLabelRecordTwo(label *models.HisLabelPrintInfo) (err error) {
2651 2694
 	err = writeDb.Save(&label).Error
2652 2695
 	return

+ 2 - 2
service/manage_center_service.go Parādīt failu

@@ -1083,8 +1083,8 @@ func DeletePatientDiagnose(id int64) error {
1083 1083
 	return err
1084 1084
 }
1085 1085
 
1086
-func GetPatientGoodStockCount(patient_id int64, record_time int64, user_org_id int64) (auto []*models.XtAutomaticReduceDetail, err error) {
1086
+func GetPatientGoodStockCount(patient_id int64, record_time int64, user_org_id int64) (auto []*models.AutomaticReduceDetail, err error) {
1087 1087
 
1088
-	err = XTReadDB().Where("patient_id = ? and record_time =? and user_org_id = ? and status=1", patient_id, record_time, user_org_id).Find(&auto).Error
1088
+	err = XTReadDB().Where("patient_id = ? and record_time =? and org_id = ? and status=1", patient_id, record_time, user_org_id).Find(&auto).Error
1089 1089
 	return auto, err
1090 1090
 }

+ 36 - 21
service/new_warehouse_service.go Parādīt failu

@@ -646,10 +646,13 @@ func FindNewOverCount(drug_id int64, org_id int64, storehouse_id int64, tx *gorm
646 646
 
647 647
 	stockCount := models.XtDrugStockCount{}
648 648
 	err := tx.Where("drug_id = ? and user_org_id = ? and storehouse_id=?", drug_id, org_id, storehouse_id).Find(&stockCount).Error
649
-	if err != nil {
650
-		tx.Rollback()
651
-		return stockCount, err
649
+	if err != gorm.ErrRecordNotFound {
650
+		if err != nil {
651
+			tx.Rollback()
652
+			return stockCount, err
653
+		}
652 654
 	}
655
+
653 656
 	return stockCount, err
654 657
 }
655 658
 
@@ -2555,11 +2558,13 @@ func GetNewSigleDrugWarehouseOutInfoTwo(patient_id int64, advice_date int64, org
2555 2558
 	info := models.XtDrugWarehouseOutInfo{}
2556 2559
 	var err error
2557 2560
 	err = tx.Where("patient_id = ? and sys_record_time = ? and org_id = ? and status = 1 and drug_id = ? and is_sys=1", patient_id, advice_date, orgid, drug_id).Find(&info).Error
2558
-
2559
-	if err != nil {
2560
-		tx.Rollback()
2561
-		return &info, nil
2561
+	if err != gorm.ErrRecordNotFound {
2562
+		if err != nil {
2563
+			tx.Rollback()
2564
+			return &info, nil
2565
+		}
2562 2566
 	}
2567
+
2563 2568
 	return &info, nil
2564 2569
 }
2565 2570
 
@@ -2579,10 +2584,13 @@ func UpdateSingleDrugWarehouseOutInfoSix(patient_id int64, advice_date int64, or
2579 2584
 func UpdateNewSingleDrugWarehouseOutInfoSix(patient_id int64, advice_date int64, orgid int64, info *models.DrugWarehouseOutInfo, advice_id int64, tx *gorm.DB) error {
2580 2585
 
2581 2586
 	err := tx.Model(&models.XtDrugWarehouseOutInfo{}).Where("patient_id = ? and sys_record_time = ? and org_id = ? and advice_id = ? and status= 1", patient_id, advice_date, orgid, advice_id).Update(map[string]interface{}{"count": info.Count, "price": info.Price, "total_price": info.TotalPrice, "product_date": info.ProductDate, "expiry_date": info.ExpiryDate, "remark": info.Remark, "dealer": info.Dealer, "manufacturer": info.Manufacturer, "retail_price": info.RetailPrice, "number": info.Number, "batch_number": info.BatchNumber, "count_unit": info.CountUnit, "warehouse_info_id": info.WarehouseInfoId, "storehouse_id": info.StorehouseId}).Error
2582
-	if err != nil {
2583
-		tx.Rollback()
2584
-		return err
2587
+	if err != gorm.ErrRecordNotFound {
2588
+		if err != nil {
2589
+			tx.Rollback()
2590
+			return err
2591
+		}
2585 2592
 	}
2593
+
2586 2594
 	return err
2587 2595
 }
2588 2596
 
@@ -2611,11 +2619,12 @@ func FindNewDrugAutoReduceRecordInfo(patient_id int64, advice_date int64, orgid
2611 2619
 	detail := models.DrugAutomaticReduceDetail{}
2612 2620
 	var err error
2613 2621
 	err = tx.Where("patient_id = ? and record_time = ? and org_id = ?", patient_id, advice_date, orgid).Find(&detail).Error
2614
-	if err == gorm.ErrRecordNotFound {
2615
-		return nil, err
2616
-	}
2617
-	if err != nil {
2618
-		return nil, err
2622
+
2623
+	if err != gorm.ErrRecordNotFound {
2624
+		if err != nil {
2625
+			tx.Rollback()
2626
+			return &detail, nil
2627
+		}
2619 2628
 	}
2620 2629
 	return &detail, nil
2621 2630
 }
@@ -2690,10 +2699,13 @@ func FindDrugWarehouseOutInfoCount(drugid int64, patient_id int64, record_date i
2690 2699
 func FindNewDrugWarehouseOutInfoCount(drugid int64, patient_id int64, record_date int64, org_id int64, advice_id int64, tx *gorm.DB) (flow []*models.DrugFlow, err error) {
2691 2700
 
2692 2701
 	err = tx.Where("drug_id = ? and patient_id = ? and system_time = ? and user_org_id = ? and consumable_type = 3 and status = 1 and advice_id = ?", drugid, patient_id, record_date, org_id, advice_id).Find(&flow).Error
2693
-	if err != nil {
2694
-		tx.Rollback()
2695
-		return flow, err
2702
+	if err != gorm.ErrRecordNotFound {
2703
+		if err != nil {
2704
+			tx.Rollback()
2705
+			return flow, err
2706
+		}
2696 2707
 	}
2708
+
2697 2709
 	return flow, err
2698 2710
 }
2699 2711
 
@@ -2711,10 +2723,13 @@ func FindDrugCancelOutInfo(drugid int64, patient_id int64, record_date int64, or
2711 2723
 func FindNewDrugCancelOutInfo(drugid int64, patient_id int64, record_date int64, org_id int64, advice_id int64, tx *gorm.DB) (flow []*models.DrugFlow, err error) {
2712 2724
 	err = tx.Where("drug_id = ? and patient_id = ? and system_time = ? and user_org_id = ? and consumable_type = 7 and status = 1 and advice_id = ?", drugid, patient_id, record_date, org_id, advice_id).Find(&flow).Error
2713 2725
 
2714
-	if err != nil {
2715
-		tx.Rollback()
2716
-		return flow, err
2726
+	if err != gorm.ErrRecordNotFound {
2727
+		if err != nil {
2728
+			tx.Rollback()
2729
+			return flow, err
2730
+		}
2717 2731
 	}
2732
+
2718 2733
 	return flow, err
2719 2734
 }
2720 2735
 

+ 1 - 1
service/schedule_service.go Parādīt failu

@@ -1880,6 +1880,6 @@ func UpdateMobileSchedule(id_two int64, mode_id int64, bed_id int64, zone_id int
1880 1880
 
1881 1881
 func GetPatientGoodCountToday(patient_id int64, schedule_date int64, user_org_id int64) (list []*models.WarehouseOutInfo, err error) {
1882 1882
 
1883
-	err = XTReadDB().Where("patient_id =? and record_time=? and use_org_id = ? and status=1", patient_id, schedule_date, user_org_id).Find(&list).Error
1883
+	err = XTReadDB().Where("patient_id =? and sys_record_time=? and org_id = ? and status=1", patient_id, schedule_date, user_org_id).Find(&list).Error
1884 1884
 	return list, err
1885 1885
 }

+ 11 - 12
service/sign_service.go Parādīt failu

@@ -10,10 +10,9 @@ import (
10 10
 	"encoding/json"
11 11
 	"fmt"
12 12
 	"github.com/astaxie/beego"
13
-	"github.com/jung-kurt/gofpdf"
13
+	//"github.com/jung-kurt/gofpdf"
14 14
 	"io/ioutil"
15 15
 	"net/http"
16
-	"path"
17 16
 )
18 17
 
19 18
 func GetSignNameByPhone(phoneOne string) string {
@@ -2039,16 +2038,16 @@ func UpdatePersionEnterPrise(id int64, userId string) error {
2039 2038
 }
2040 2039
 
2041 2040
 func SingleImg2Pdf(pathStr string) {
2042
-	pdf := gofpdf.New("P", "mm", "A4", "")
2043
-	pdf.AddPage()
2044
-	pdf.SetFont("Arial", "", 11)
2045
-	pdf.Image(pathStr, 10, 10, pdf.GetPageSizeStr("A4").Wd-20, 0, false, "", 0, "")
2046
-	// pdf.Text(50, 20, "logo.png")
2047
-	fileNameAll := path.Base(pathStr)
2048
-	fileSuffix := path.Ext(pathStr)
2049
-	fileStr := fmt.Sprintf("./pdfs/%s.pdf", fileNameAll[0:len(fileNameAll)-len(fileSuffix)])
2050
-	err := pdf.OutputFileAndClose(fileStr)
2051
-	fmt.Println(err)
2041
+	//pdf := gofpdf.New("P", "mm", "A4", "")
2042
+	//pdf.AddPage()
2043
+	//pdf.SetFont("Arial", "", 11)
2044
+	//pdf.Image(pathStr, 10, 10, pdf.GetPageSizeStr("A4").Wd-20, 0, false, "", 0, "")
2045
+	//// pdf.Text(50, 20, "logo.png")
2046
+	//fileNameAll := path.Base(pathStr)
2047
+	//fileSuffix := path.Ext(pathStr)
2048
+	//fileStr := fmt.Sprintf("./pdfs/%s.pdf", fileNameAll[0:len(fileNameAll)-len(fileSuffix)])
2049
+	//err := pdf.OutputFileAndClose(fileStr)
2050
+	//fmt.Println(err)
2052 2051
 }
2053 2052
 
2054 2053
 func GetAllPatientNew(org_id int64) (new []*models.XtPatients, err error) {

+ 1 - 1
service/stock_service.go Parādīt failu

@@ -3627,7 +3627,7 @@ func PostSearchStock(keyword string, orgid int64) (goods []*models.GoodsType, er
3627 3627
 
3628 3628
 func GetStockType(orgid int64) (goodstype []*models.GoodsTypeOne, err error) {
3629 3629
 	err = XTReadDB().Where("org_id = ? and status = 1 and (stock_attribute = 2 or stock_attribute = 3 or stock_attribute = 4)", orgid).
3630
-		Preload("GoodInfo", "org_id = ? and status = 1", orgid).Find(&goodstype).Error
3630
+		Preload("GoodInfo", "org_id = ? and status = 1 and  find_in_set('停用',good_status) = 0", orgid).Find(&goodstype).Error
3631 3631
 	return goodstype, err
3632 3632
 }
3633 3633
 

+ 6 - 5
service/warhouse_service.go Parādīt failu

@@ -6194,11 +6194,12 @@ func FindLastDrugWarehouseOutInfo(orgid int64) (models.DrugWarehouseOutInfo, err
6194 6194
 func FindNewLastDrugWarehouseOutInfo(orgid int64, tx *gorm.DB) (models.DrugWarehouseOutInfo, error) {
6195 6195
 	info := models.DrugWarehouseOutInfo{}
6196 6196
 	err := tx.Where("org_id = ? and status = 1", orgid).Last(&info).Error
6197
-	if err != nil {
6198
-		tx.Rollback()
6199
-		return info, err
6197
+	if err != gorm.ErrRecordNotFound {
6198
+		if err != nil {
6199
+			tx.Rollback()
6200
+			return info, err
6201
+		}
6200 6202
 	}
6201
-	tx.Rollback()
6202 6203
 	return info, err
6203 6204
 }
6204 6205
 
@@ -8011,7 +8012,7 @@ func ConsumableNewPrescriptionDelivery(orgID int64, patient_id int64, record_tim
8011 8012
 		OutInfo.Count = count - out_count_two + out_count_one
8012 8013
 
8013 8014
 		_, errcodes := GetNewNewWarehouseOutInfoIsExistSix(goods.GoodId, patient_id, record_time, goods.ProjectId, warehouse.ID, tx)
8014
-		fmt.Println("errcodes-------------------------------------------", errcodes)
8015
+
8015 8016
 		if errcodes == gorm.ErrRecordNotFound {
8016 8017
 			errOne := AddNewSigleWarehouseOutInfo(OutInfo, tx)
8017 8018
 			if errOne != nil {